Advertisement
Guest User

header.php

a guest
Apr 23rd, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.71 KB | None | 0 0
  1. <?php
  2.  
  3. require_once(dirname(__FILE__) . '/../../../_standards/bootstrap.php');
  4. require_once(dirname(__FILE__) . '/../../../db/cdbmember.php');
  5. require_once(dirname(__FILE__) . '/../../../classes/cusersecurity.php');
  6.  
  7. $DBMember = new CDBMember();
  8. $UserSecurity = new CUserSecurity();
  9.  
  10. $sBody = '';
  11.  
  12. $sTemplateDir = get_bloginfo('template_url');
  13. $sTemplateName = get_post_meta($post->ID, '_wp_page_template', true);
  14. $bIsChamber = ($sTemplateName == 'chamber.php');
  15. $bIsHomePage = ($sTemplateName == 'home_template.php');
  16. $bIsSearch = is_search();
  17. $bIs404 = is_404();
  18.  
  19. $sLogoID = 'logo';
  20. if ($bIsChamber)
  21. {
  22. $sLogoID = 'chamber_logo';
  23. }
  24. if ($bIsHomePage)
  25. {
  26. $sBody = 'home';
  27. }
  28. $bIsBlogPage = false;
  29. if (((is_home() || is_front_page()) && !$bIsHomePage) || is_archive() || is_single())
  30. {
  31. $bIsBlogPage = true;
  32. }
  33.  
  34. if (($post->ID == 515) || ($post->ID == 620) || $bIsSearch)
  35. {
  36. $sBody = 'interactive_body';
  37. }
  38.  
  39. /////////////////////////////
  40. // Inputs
  41. /////////////////////////////
  42.  
  43. if (isset($_POST['Login']))
  44. {
  45. $sUserName = isset($_POST['UserName']) ? strtolower(trim($_POST['UserName'])) : '';
  46. $sPassword = isset($_POST['Pwd']) ? trim($_POST['Pwd']) : '';
  47. $aRow = $DBMember->VerifyLogin($sUserName, $sPassword);
  48. if ($aRow)
  49. {
  50. $UserSecurity->Login($aRow[0]['MemberID'], 'ChamberMember');
  51. $iUserID = $UserSecurity->UserID();
  52. $iMenuID = $iChamberMenuID;
  53. $bIsLoggedIn = true;
  54. }
  55. else
  56. {
  57. $UserSecurity->Logout();
  58. $iUserID = -1;
  59. $sUserType = '';
  60. $bIsLoggedIn = false;
  61. $sLoginMsg = 'Your login could not be verified. Please try again.';
  62. }
  63. }
  64.  
  65. if (isset($_GET['logout']))
  66. {
  67. $UserSecurity->Logout();
  68. $iUserID = -1;
  69. $sUserType = '';
  70. $bIsLoggedIn = false;
  71. $sLoginMsg = 'You have been logged out.';
  72. }
  73.  
  74. //////////////////////////////
  75. // User Info
  76. //////////////////////////////
  77.  
  78. $iUserID = $UserSecurity->UserID();
  79. $bIsLoggedIn = $UserSecurity->IsValid();
  80. $sMemberName = '';
  81. if ($bIsLoggedIn)
  82. {
  83. $aRow = $DBMember->GetForMemberID($iUserID);
  84. if ($aRow)
  85. {
  86. $sMemberName = $aRow[0]['OwnerName'];
  87. }
  88. }
  89. elseif ($post->ID == 616)
  90. {
  91. ?>
  92. <script type="text/javascript">
  93. location.href="<?php echo get_permalink(255); ?>";
  94. </script>
  95. <?php
  96. }
  97.  
  98. /////////////////////////////
  99. // Display
  100. /////////////////////////////
  101. ?>
  102. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  103. <html <?php language_attributes(); ?>>
  104. <head>
  105. <meta charset="<?php bloginfo( 'charset' ); ?>" />
  106. <title>
  107. <?php
  108. /*
  109. * Print the <title> tag based on what is being viewed.
  110. */
  111. global $page, $paged;
  112.  
  113. wp_title( '|', true, 'right' );
  114.  
  115. // Add the blog name.
  116. bloginfo( 'name' );
  117.  
  118. // Add the blog description for the home/front page.
  119. $site_description = get_bloginfo( 'description', 'display' );
  120. if ( $site_description && ( is_home() || is_front_page() ) )
  121. echo " | $site_description";
  122.  
  123. // Add a page number if necessary:
  124. if ( $paged >= 2 || $page >= 2 )
  125. echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
  126.  
  127. ?></title>
  128. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
  129. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js" type="text/javascript"></script>
  130. <script src="<?php echo $sTemplateDir; ?>/js/superfish.js" type="text/javascript"></script>
  131. <script src="<?php echo $sTemplateDir; ?>/js/jquery.cycle.js" type="text/javascript"></script>
  132. <script src="<?php echo $sTemplateDir; ?>/js/jquery.qtip-1.0.0-rc3.min.js" type="text/javascript"></script>
  133. <script src="<?php echo $sTemplateDir; ?>/js/formValidator2.5/jquery.validationEngine.js" type="text/javascript"></script>
  134. <script src="<?php echo $sTemplateDir; ?>/js/formValidator2.5/languages/jquery.validationEngine-en.js" type="text/javascript"></script>
  135. <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
  136. <link rel="stylesheet" type="text/css" media="all" href="<?php echo $sTemplateDir; ?>/css/jquery-ui-1.8.6.custom.css" />
  137. <link rel="stylesheet" href="<?php echo $sTemplateDir; ?>/css/validationEngine.jquery.css" type="text/css" media="all" />
  138. <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
  139. <?php
  140. if ( is_singular() && get_option( 'thread_comments' ) )
  141. wp_enqueue_script( 'comment-reply' );
  142. wp_head();
  143. ?>
  144. <script type="text/javascript">
  145. $(document).ready(function() {
  146. <?php
  147. if ($bIsHomePage)
  148. {
  149. ?>
  150. $('.gallery').cycle({
  151. fx: 'fade',
  152. timeout: 6000
  153. });
  154. <?php
  155. }
  156. elseif ($bIsChamber)
  157. {
  158. ?>
  159. iHeightLeft = $('#chamber_left').height();
  160. iHeightRight = $('#chamber_right').height();
  161. if (iHeightLeft < iHeightRight)
  162. {
  163. $('#chamber_left').height(iHeightRight);
  164. }
  165. <?php
  166. }
  167. elseif ($post->post_parent == 48)
  168. {
  169. ?>
  170. $('#secondary_right').css({'position': 'relative', 'top': '140px'});
  171. $('#tertiary_nav .page-item-57').prepend('<img src="<?php echo $sTemplateDir; ?>/images/green_dot_mtn.png">&nbsp;');
  172. $('#tertiary_nav .page-item-60').prepend('<img src="<?php echo $sTemplateDir; ?>/images/blue_dot_valley.png">&nbsp;');
  173. $('#tertiary_nav .page-item-63').prepend('<img src="<?php echo $sTemplateDir; ?>/images/orange_dot_underground.png">&nbsp;');
  174. <?php
  175. }
  176. elseif ($post->ID == 620)
  177. {
  178. ?>
  179. if ($('#secondary_right aside').length == 0)
  180. {
  181. sContentCheck = $.trim($('#secondary_right').text());
  182. }
  183. else
  184. {
  185. sContentCheck = $.trim($('#secondary_right aside').text());
  186. }
  187. if (sContentCheck == '')
  188. {
  189. $('#secondary_right').hide();
  190. $('#secondary_left').css({'width' : '840px'});
  191. }
  192. <?php
  193. }
  194. ?>
  195. $('#top_nav ul ul li').hover(
  196. function () {
  197. $(this).parent().parent().addClass('hover');
  198. },
  199. function () {
  200. $(this).parent().parent().removeClass('hover');
  201. }
  202. );
  203. $.fn.qtip.styles.tipstyle = { // Last part is the name of the style
  204. width: 490,
  205. background: '#ffffff',
  206. color: '#000000',
  207. border: {
  208. width: 0,
  209. radius: 2,
  210. color: '#000000'
  211. },
  212. title: {
  213. background: '#004990',
  214. color: '#ffffff'
  215. },
  216. padding: 5,
  217. margin: 0,
  218. tip: false,
  219. name: 'dark' // Inherit the rest of the attributes from the preset style
  220. };
  221. });
  222. var _gaq = _gaq || [];
  223. _gaq.push(['_setAccount', 'UA-32603220-1']);
  224. _gaq.push(['_trackPageview']);
  225.  
  226. (function() {
  227. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  228. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  229. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  230. })();
  231. </script>
  232. <?php
  233. if ($post->ID == 620)
  234. {
  235. ?>
  236. <script type="text/javascript">
  237. var __htmlcontainer_domain = "issuu.com";
  238. </script>
  239.  
  240. <script src='http://static.issuu.com/static/1594/w/viewer/v2/standalone/index.js' type='text/javascript'></script>
  241.  
  242. <!--[if IE]>
  243. <script type="text/javascript">
  244. function fixOutOfMemoryError() { //Fix IE memory leak from using External Interface
  245. __flash_unloadHandler = function() {};
  246. __flash_savedUnloadHandler = function() {};
  247. }
  248. window.attachEvent("onbeforeunload", fixOutOfMemoryError);
  249. </script>
  250. <![endif]-->
  251.  
  252. <script type="text/javascript">
  253. //=== SERVER SIDE OVERRIDES
  254.  
  255. //---Carrier protocol
  256. var __protocol = "http://";
  257.  
  258. /*
  259. //domain
  260. var __domain = "issuu.com";
  261. */
  262.  
  263. //---Specifies the minimum required version of flash for this page to show
  264. var __req_flash = "9.0.0";
  265.  
  266. // Document ID
  267. var documentId = "110920163545-9aa14c5e01ec4328ab58791850f201ea";
  268.  
  269. //=== REDIRECT TO AJAX VIEWER IF FLASH VERSION IS BELOW REQUIRED VERSION
  270.  
  271.  
  272. if (!swfobject.hasFlashPlayerVersion(__req_flash)) {
  273. var breakdown = window.location.href.split('?')
  274. var ajv_url = breakdown[0] + "?mode=a_p";
  275. window.location.href= ajv_url;
  276. }
  277.  
  278. //=== Insert flash
  279.  
  280. var bl_swfUrl = "http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf";
  281. var bl_domId = "flashcontent";
  282. var bl_width = "100%";
  283. var bl_height = "100%";
  284. var bl_flashver = __req_flash; //flex publishing version
  285. var bl_flashvars = {
  286. mode:"window",documentId: "110920163545-9aa14c5e01ec4328ab58791850f201ea",
  287. pageNumber: 1,
  288. bl_domain: "issuu.com",
  289. bl_resource: "http://issuu.com/lpccc/docs/2012_getaway_guide",
  290. bl_query: "mode=window",
  291. bl_referrer: "",
  292. bl_viewuser: "",
  293. userAgent: "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28"
  294. };
  295. var bl_params = {
  296. allowfullscreen: "true",
  297. menu: "false",
  298. salign: "tl",
  299. scale: "noscale",
  300. wmode: 'transparent',
  301. allowscriptaccess: "always"
  302. };
  303. var bl_attr = {
  304. id: bl_domId,
  305. name: bl_domId
  306. };
  307.  
  308. swfobject.embedSWF(bl_swfUrl, bl_domId, bl_width, bl_height, bl_flashver, {}, bl_flashvars, bl_params, bl_attr);
  309.  
  310. </script>
  311. <?php
  312. }
  313. ?>
  314. </head>
  315. <body id="<?php echo $sBody; ?>">
  316. <div id="container_wrapper">
  317. <div id="container">
  318. <?php
  319. if ($bIsHomePage)
  320. {
  321. ?>
  322. <div class="gallery-holder">
  323. <ul class="gallery">
  324. <?php
  325. $aChildren = get_children('post_parent=69&post_type=page&orderby=menu_order&order=ASC', ARRAY_A);
  326. foreach ($aChildren as $iIndex => $aOneChild)
  327. {
  328. echo '<li>' . strip_tags($aOneChild['post_content'], '<img>') . '</li>' . "\n";
  329. }
  330. wp_reset_query();
  331. ?>
  332. </ul>
  333. </div>
  334. <?php
  335. }
  336. ?>
  337. <div id="header">
  338. <div id="transparent_banner"></div>
  339. <div class="clear"></div>
  340. <div id="banner">
  341. <div id="banner_col1">
  342. <form id="searchform" method="get" action="<?php bloginfo('siteurl'); ?>">
  343. <input id="s" class="field" type="text" placeholder="Search" name="s">
  344. <input id="searchsubmit" class="submit" type="submit" value="Search" name="submit">
  345. </form>
  346. </div>
  347. <div id="banner_col2">
  348. <!-- AddThis Button BEGIN -->
  349. <a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;pubid=inprint"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a>
  350. <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=inprint"></script>
  351. <!-- AddThis Button END -->
  352. </div>
  353. <div id="banner_col3">
  354. <?php
  355. $iPageID = 974;
  356. $aPage = get_page($iPageID, ARRAY_A);
  357. if ($aPage)
  358. {
  359. $aPage['post_content'] = str_replace(array('<p>', '</p>'), '', $aPage['post_content']);
  360. echo $aPage['post_content'];
  361. }
  362. ?>
  363. </div>
  364. </div>
  365. <?php
  366. wp_nav_menu(array('container_id' => 'top_nav', 'menu' => 'Main', 'container' => 'div'));
  367. ?>
  368. <a id="<?php echo $sLogoID; ?>" href="<?php bloginfo('siteurl'); ?>" alt="Luray &amp; Page County" title="Luray &amp; Page County"><?php bloginfo('name'); ?></a>
  369. <?php
  370. if (!$bIsChamber)
  371. {
  372. ?>
  373. <div id="choose_nav">
  374. <ul>
  375. <li><a href="#"><img src="<?php echo $sTemplateDir; ?>/images/level_graphic.png" alt="Choose Your Level" title="Choose Your Level" /></a>
  376. <?php
  377. wp_nav_menu(array('menu' => 'Level', 'container' => 'div'));
  378. ?>
  379. </li>
  380. </ul>
  381. </div>
  382. <?php
  383. }
  384. ?>
  385. </div>
  386. <?php
  387. $bHasHeaderImage = false;
  388. if (!$bIsHomePage && !$bIsSearch && !$bIs404)
  389. {
  390. $sStyle = '';
  391. if ($bIsBlogPage)
  392. {
  393. $iMainBlogID = get_option('page_for_posts');
  394. $bHasHeaderImage = true;
  395. $sImage = wp_get_attachment_image(get_post_thumbnail_id($iMainBlogID), 'full');
  396. echo '<div id="header_image">' . "\n";
  397. echo $sImage . "\n";
  398. echo '</div>' . "\n";
  399. }
  400. elseif (has_post_thumbnail())
  401. {
  402. $bHasHeaderImage = true;
  403. $sImage = wp_get_attachment_image(get_post_thumbnail_id($post->ID), 'full');
  404. echo '<div id="header_image">' . "\n";
  405. echo $sImage . "\n";
  406. echo '</div>' . "\n";
  407. }
  408.  
  409. if (!$bIsChamber)
  410. {
  411. if ($post->post_parent)
  412. {
  413. $aPage = get_page($post->post_parent, ARRAY_A);
  414. $sTertiaryMenuClass = $aPage['post_name'];
  415. $sMenuTitle = $aPage['post_title'];
  416. }
  417. else
  418. {
  419. $sTertiaryMenuClass = $post->post_name;
  420. $sMenuTitle = $post->post_title;
  421. }
  422.  
  423. if ($post->post_parent)
  424. {
  425. $aArgs = array('child_of' => $post->post_parent,
  426. 'depth' => 1,
  427. 'sort_column' => 'menu_order',
  428. 'echo' => 0,
  429. 'title_li' => '');
  430. }
  431. else
  432. {
  433. $aArgs = array('child_of' => $post->ID,
  434. 'depth' => 1,
  435. 'sort_column' => 'menu_order',
  436. 'echo' => 0,
  437. 'title_li' => '');
  438. }
  439. $sTertiaryMenu = wp_list_pages($aArgs);
  440. if ($sTertiaryMenu != '')
  441. {
  442. ?>
  443. <div id="tertiary_nav" class="<?php echo $sTertiaryMenuClass; ?>">
  444. <span id="tertiary_nav_title"><?php echo $sMenuTitle; ?> ></span>
  445. <ul>
  446. <?php echo $sTertiaryMenu; ?>
  447. </ul>
  448. </div>
  449. <?php
  450. }
  451. }
  452. }
  453. ?>
  454. <div id="content"<?php echo (($sBody == 'interactive_body') && $bHasHeaderImage) ? ' style="padding-top: 0;"' : ''; ?>>
  455. <?php
  456. if ($bIsChamber && !$bIsSearch && !$bIs404)
  457. {
  458. ?>
  459. <div id="chamber_left">
  460. <h3 class="chamber_title">Chamber<br />of Commerce</h3>
  461. <?php
  462. $sMenu = wp_nav_menu(array('container_id' => 'chamber_nav', 'menu' => 'Main', 'container' => 'div', 'echo' => false));
  463. $iStartPos1 = strpos($sMenu, 'menu-item-283');
  464. $iStartPos2 = strpos($sMenu, '<ul', $iStartPos1);
  465. $sTmpMenu = substr($sMenu, $iStartPos2);
  466. $sTmpMenu = str_replace(' class="sub-menu"', '', $sTmpMenu);
  467. echo '<div id="chamber_nav">' . "\n";
  468. echo $sTmpMenu;
  469.  
  470. if (($post->ID == 255) || ($post->ID == 616))
  471. {
  472. // Member directory page. Display login area.
  473. if (!$bIsLoggedIn)
  474. {
  475. if ($sLoginMsg != '')
  476. {
  477. echo '<p><b>' . $sLoginMsg . '</b></p>';
  478. }
  479. ?>
  480. <div class="login_form">
  481. <form name="LoginForm" method="post" action="<?php echo get_permalink(255); ?>">
  482. <h3 class="chamber_title">Member Login</h3>
  483. <div class="section_row">
  484. <input class="default_text" type="text" name="UserName" size="15" maxlength="80" value="" title="Email" />
  485. </div>
  486. <div class="section_row">
  487. <input class="default_text" type="password" name="Pwd" size="15" maxlength="20" value="" title="Password" />
  488. </div>
  489. <div class="section_row">
  490. <input type="submit" name="Login" value="Login" />
  491. </div>
  492. <div class="section_row">
  493. <a href="<?php echo get_permalink(618); ?>">Forgot password?</a>
  494. </div>
  495. </form>
  496. </div>
  497. <?php
  498. }
  499. else
  500. {
  501. ?>
  502. <p class="member_welcome">Welcome, <?php echo $sMemberName; ?></p>
  503. <div id="member_nav">
  504. <ul>
  505. <li><a href="<?php echo get_permalink(616); ?>">Edit Your Profile</a></li>
  506. <li><a href="<?php echo get_permalink(255); ?>?logout=1">Logout</a></li>
  507. </ul>
  508. </div>
  509. <?php
  510. }
  511. }
  512. ?>
  513. <div id="chamber_left_shim"></div>
  514. </div>
  515. <?php
  516. }
  517. elseif (!$bIsHomePage && !$bIsSearch && !$bIs404)
  518. {
  519. $sStyle = '';
  520. if ($bIsBlogPage)
  521. {
  522. $sStyle = ' style="float: left; padding-left: 20px;"';
  523. }
  524. ?>
  525. <div id="secondary_right"<?php echo $sStyle; ?>>
  526. <?php
  527. if ($bIsBlogPage)
  528. {
  529. $oCategories = get_the_category();
  530. $sCategory = '';
  531. $iCategoryID = -1;
  532. if ($oCategories)
  533. {
  534. $sCategory = $oCategories[0]->cat_name;
  535. $iCategoryID = $oCategories[0]->term_id;
  536. }
  537.  
  538. // Display all posts for this category
  539. $sQuery = 'cat=' . $iCategoryID . '&post_status=publish';
  540. $Query = new WP_Query($sQuery);
  541. while ($Query->have_posts() ) : $Query->the_post();
  542. echo '<p><a href="';
  543. the_permalink();
  544. echo '">';
  545. the_title();
  546. echo '</a> - ';
  547. the_time('n/d/y');
  548. echo '</p>' . "\n";
  549. endwhile;
  550. }
  551. else
  552. {
  553. if (!dynamic_sidebar()) :
  554. endif;
  555. }
  556. ?>
  557. </div>
  558. <?php
  559. }
  560. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement