function get_header($menu_data, $title = '', $head_extra = '') { global $CFG_NAVLINKS, $CFG_COLOR_CSS; $title .= '' != $title ? ' :: ' . $title : ''; $html = <<<EOF <!doctype html> <html lang="en"> <head> \t<title>{$title}</title> \t<meta http-equiv="Content-Language" content="en-us" /> \t<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> \t<meta http-equiv="Content-Style-Type" content="text/css" /> \t<link rel="stylesheet" type="text/css" media="screen" href="css/messages.css" /> \t<link rel="stylesheet" type="text/css" media="screen" href="css/layout.css" /> \t<link rel="stylesheet" type="text/css" media="screen" href="css/{$CFG_COLOR_CSS}" /> \t{$head_extra} </head> <body> \t<div id="links">{$CFG_NAVLINKS}</div> \t<h1><img src="images/WebChess.png" alt="WebChess" /></h1> \t<div id="wrapper"> EOF; if (is_array($menu_data)) { $html .= ' <div id="menu"> <ul> <li' . get_active('mygames') . '><a href="?page=mygames">Your Games (' . $menu_data['numMyturn'] . '|' . $menu_data['numActive'] . ')</a></li> <li' . get_active('current') . '><a href="?page=current">Current Games (' . $menu_data['numOthers'] . ')</a></li> <li' . get_active('finished') . '><a href="?page=finished">Finished Games (' . $menu_data['numDone'] . '|' . $menu_data['numFiles'] . ')</a></li> <li' . get_active('invite') . '><a href="?page=invite">Invitations (' . $menu_data['numInvites'] . '|' . $menu_data['numOutvites'] . ')</a></li> <li' . get_active('stats') . '><a href="?page=stats">Statistics</a></li> <li' . get_active('messages') . '><a href="?page=messages">Messages (' . $menu_data['numMsgs'] . '|' . $menu_data['newMsgs'] . ')</a></li> <li' . get_active('prefs') . '><a href="?page=prefs">Preferences</a></li> <li' . get_active('personal') . '><a href="?page=personal">Personal</a></li> '; if (true == $_SESSION['is_admin']) { $html .= '<li' . get_active('admin') . '><a href="?page=admin">Admin</a></li>'; } $html .= ' <li><a href="?logout">Logout</a></li> </ul> </div> '; } return $html; }
function get_fields($bundle_name) { $fields = field_read_fields(array('entity_type' => 'node', 'bundle' => $bundle_name)); $result = array(); foreach ($fields as $name => $field) { $result[$name] = array('type' => $field['type'], 'card' => $field['cardinality']); // FIELD_CARDINALITY_UNLIMITED = -1 $f_type = trim($field['type']); $vocab = ""; $sub = ""; $active = ""; if ($f_type == 'taxonomy_term_reference') { $vocab = $field['settings']['allowed_values'][0]['vocabulary']; if (!empty($vocab)) { $result[$name]['vocab'] = $vocab; } $sub = empty($field['settings']['subtype']) ? get_taxon_subtype($name) : $field['settings']['subtype']; //$sub = $field['settings']['subtype']; //if(empty($sub)) $sub = get_taxon_subtype($name); } if ($f_type == 'text') { $sub = empty($field['settings']['subtype']) ? get_text_subtype($name) : $field['settings']['subtype']; //if(empty($sub)) $sub = get_text_subtype($name); } $result[$name]['subtype'] = $sub; // for every field $active_value = empty($field['settings']['active']) ? get_active($name) : $field['settings']['active']; //$active_value = $field['settings']['active']; //if(empty($active_value)) $active_value = get_active($name); if ($active_value == 'enable') { $result[$name]['active'] = true; } else { $result[$name]['active'] = false; } $instance = _get_field_instance($bundle_name, $name); $result[$name]['label'] = $instance['label']; } //mylog(print_r($fields, true), 'fields.txt'); //mylog(print_r($result, true), 'result.txt'); return $result; }
/** function get_header * Generate the HTML header portion of the page * * @param array [optional] meta variables * @option string 'title' the page title * @option string 'head_data' any HTML to be inserted in the head tag * @option array 'menu_data' the data for the counts in the menu * @option array 'game_data' the game data for my game list under the menu * @option bool 'show_menu' show the menu * @option string 'file_name' becomes the body id with _page appended * @return string HTML header for page */ function get_header($meta = null) { if (!defined('GAME_NAME')) { define('GAME_NAME', 'Game'); } $title = !empty($meta['title']) ? GAME_NAME . ' :: ' . $meta['title'] : GAME_NAME; $show_menu = isset($meta['show_menu']) ? (bool) $meta['show_menu'] : true; $show_nav_links = isset($meta['show_nav_links']) ? (bool) $meta['show_nav_links'] : true; $menu_data = isset($meta['menu_data']) ? $meta['menu_data'] : false; $head_data = isset($meta['head_data']) ? $meta['head_data'] : ''; $file_name = isset($meta['file_name']) ? $meta['file_name'] : basename($_SERVER['SCRIPT_NAME']); $file_name = substr($file_name, 0, strrpos($file_name, '.')); // make sure we have these $GLOBALS['_&_DEBUG_QUERY'] = !empty($GLOBALS['_&_DEBUG_QUERY']) ? $GLOBALS['_&_DEBUG_QUERY'] : ''; $GLOBALS['_?_DEBUG_QUERY'] = !empty($GLOBALS['_?_DEBUG_QUERY']) ? $GLOBALS['_?_DEBUG_QUERY'] : (defined('DEBUG') && DEBUG ? '?' : ''); $flash = ''; if (class_exists('Flash')) { $flash = Flash::retrieve(); } if ($show_menu) { if (!$menu_data) { $menu_data = array('my_turn' => 0, 'my_games' => 0, 'games' => 0, 'in_vites' => 0, 'out_vites' => 0, 'open_vites' => 0, 'new_msgs' => 0, 'msgs' => 0); list($menu_data['games'], ) = Game::get_count(); list($menu_data['setups'], $menu_data['my_setups']) = Setup::get_count($_SESSION['player_id']); list($menu_data['my_games'], $menu_data['my_turn']) = Game::get_my_count($_SESSION['player_id']); list($menu_data['in_vites'], $menu_data['out_vites'], $menu_data['open_vites']) = Game::get_invite_count($_SESSION['player_id']); $messages = Message::get_count($_SESSION['player_id']); $menu_data['msgs'] = (int) @$messages[0]; $menu_data['new_msgs'] = (int) @$messages[1]; $allow_blink = 'index.php' == basename($_SERVER['PHP_SELF']); } // highlight the important menu values foreach ($menu_data as $key => $value) { switch ($key) { case 'my_turn': case 'new_msgs': case 'in_vites': if (0 < $value) { $menu_data[$key] = '<span class="notice">' . $value . '</span>'; } break; default: // do nothing break; } } $game_data = isset($meta['game_data']) ? $meta['game_data'] : Game::get_list($_SESSION['player_id'], false); } // if we are admin logged in as someone else, let us know $admin_css = $admin_div = ''; if (isset($_SESSION['admin_id']) && isset($_SESSION['player_id']) && $_SESSION['player_id'] != $_SESSION['admin_id']) { $admin_css = ' <style type="text/css"> html { border: 5px solid red; } #admin_username { background: red; color: black; position: fixed; top: 0; left: 50%; z-index: 99999; width: 200px; margin-left: -100px; text-align: center; font-weight: bold; font-size: larger; padding: 3px; } </style>'; $admin_div = '<div id="admin_username">' . $GLOBALS['Player']->username . ' [ ' . $GLOBALS['Player']->id . ' ]</div>'; } $query_strings = 'var debug_query_ = "' . $GLOBALS['_&_DEBUG_QUERY'] . '"; var debug_query = "' . $GLOBALS['_?_DEBUG_QUERY'] . '";'; $debug_string = defined('DEBUG') && DEBUG ? 'var debug = true;' : 'var debug = false;'; $nav_links = ''; if ($show_nav_links && class_exists('Settings') && Settings::test()) { $nav_links = Settings::read('nav_links'); } $GAME_NAME = GAME_NAME; $html = <<<EOF <!DOCTYPE html> <html lang="en-us"> <head> \t<title>{$title}</title> \t<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> \t<script type="text/javascript"> \t\t{$debug_string} \t\t{$query_strings} \t</script> \t<script type="text/javascript" src="scripts/json.js"></script> \t<script type="text/javascript" src="scripts/jquery-1.8.0.min.js"></script> \t<script type="text/javascript" src="scripts/jquery.tablesorter.js"></script> \t<!-- fancybox --> \t<link rel="stylesheet" type="text/css" media="screen" href="scripts/jquery.fancybox/jquery.fancybox-1.3.4.css" /> \t<script type="text/javascript" src="scripts/jquery.fancybox/jquery.fancybox-1.3.4.pack.js"></script> \t<script type="text/javascript"> \t\t\$(document).ready( function( ) { \t\t\t// set fancybox defaults \t\t\t\$.fn.fancybox.defaults['overlayColor'] = '#000'; \t\t\t\$('a.help').fancybox({ \t\t\t\tautoDimensions : false, \t\t\t\twidth: 500, \t\t\t\tpadding : 10, \t\t\t\thideOnContentClick : false \t\t\t}); \t\t}); \t</script> \t<!-- hide the fancybox titles --> \t<style type="text/css"> \t\t#fancy_title { display: none !important; } \t</style> \t<link rel="stylesheet" type="text/css" media="screen" href="css/layout.css" /> \t{$head_data} \t{$flash} \t<link rel="stylesheet" type="text/css" media="screen" href="css/c_{$GLOBALS['_DEFAULT_COLOR']}.css" /> \t{$admin_css} </head> <body id="{$file_name}_page"> \t{$admin_div} \t<header> \t\t<h1><a href="index.php">{$GAME_NAME}</a></h1> \t\t<nav class="site">{$nav_links}</nav> \t</header> EOF; if ($show_menu) { $html .= ' <aside id="nav">'; if ($menu_data) { $html .= ' <nav id="menu" class="box"> <ul> <li' . get_active('index') . '><a href="index.php' . $GLOBALS['_?_DEBUG_QUERY'] . '" title="(Your Turn | Your Games | Total Games)"' . ($allow_blink && $menu_data['my_turn'] ? ' class="blink"' : '') . '>Games <span class="sep">(</span> ' . $menu_data['my_turn'] . ' <span class="sep">|</span> ' . $menu_data['my_games'] . ' <span class="sep">|</span> ' . $menu_data['games'] . ' <span class="sep">)</span></a></li> <li' . get_active('invite') . '><a href="invite.php' . $GLOBALS['_?_DEBUG_QUERY'] . '" title="(Received | Open | Sent)"' . ($allow_blink && $menu_data['in_vites'] ? ' class="blink"' : '') . '>Invitations <span class="sep">(</span> ' . $menu_data['in_vites'] . ' <span class="sep">|</span> ' . $menu_data['open_vites'] . ' <span class="sep">|</span> ' . $menu_data['out_vites'] . ' <span class="sep">)</span></a></li> <li' . get_active('messages', 'read', 'send') . '><a href="messages.php' . $GLOBALS['_?_DEBUG_QUERY'] . '" title="(New Messages | Total Messages)"' . ($allow_blink && $menu_data['new_msgs'] ? ' class="blink"' : '') . '>Messages <span class="sep">(</span> ' . $menu_data['new_msgs'] . ' <span class="sep">|</span> ' . $menu_data['msgs'] . ' <span class="sep">)</span></a></li> <li' . get_active('setups') . '><a href="setups.php' . $GLOBALS['_?_DEBUG_QUERY'] . '" title="(Yours | Total)">Setups <span class="sep">(</span> ' . $menu_data['my_setups'] . ' <span class="sep">|</span> ' . $menu_data['setups'] . ' <span class="sep">)</span></a></li> <li' . get_active('stats') . '><a href="stats.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Statistics</a></li> <li' . get_active('prefs') . '><a href="prefs.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Preferences</a></li> <li' . get_active('profile') . '><a href="profile.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Profile</a></li> '; if (true == $GLOBALS['Player']->is_admin) { $html .= '<li' . get_active('admin') . '><a href="admin.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Admin</a></li>'; } $html .= ' <li><a href="login.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Logout</a></li> </ul> </nav><!-- #menu -->'; } if ($game_data) { $html .= ' <div id="mygames_title">My Games</div> <nav id="mygames" class="box"> <ul>'; foreach ($game_data as $game) { $class = $game['my_turn'] ? 'playing' : (in_array($game['state'], array('Finished', 'Draw')) ? 'finished' : 'waiting'); $html .= ' <li class="' . $class . '"><a href="game.php?id=' . $game['game_id'] . $GLOBALS['_&_DEBUG_QUERY'] . '">' . htmlentities($game['opponent'], ENT_QUOTES, 'ISO-8859-1', false) . '</a></li>'; } $html .= ' </ul> </nav><!-- #mygames -->'; } $html .= ' </aside><!-- #nav -->'; } return $html; }
?> ">Ricehalla</a> </li> </ul> </li> <li class="<?php echo get_active("contact", $CONF); ?> "> <a href="<?php echo get_page_url("contact", $CONF); ?> ">Contact</a> </li> <li class="<?php echo get_active("help", $CONF); ?> "> <a href="<?php echo get_page_url("help", $CONF); ?> ">Help</a> </li> </ul> <ul class="nav navbar-nav pull-right"> <?php if ($logged_in) { ?> <li class="dropdown"> <a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown"><?php
/** function get_header * Generate the HTML header portion of the page * * @param array [optional] meta variables * @option string 'title' the page title * @option string 'head_data' any HTML to be inserted in the head tag * @option array 'menu_data' the data for the counts in the menu * @option array 'game_data' the game data for my game list under the menu * @option bool 'show_menu' show the menu * @option string 'file_name' becomes the body id with _page appended * @return string HTML header for page */ function get_header($meta = null) { if (!defined('GAME_NAME')) { define('GAME_NAME', 'Game'); } $title = !empty($meta['title']) ? GAME_NAME . ' :: ' . $meta['title'] : GAME_NAME; $show_menu = isset($meta['show_menu']) ? (bool) $meta['show_menu'] : true; $show_nav_links = isset($meta['show_nav_links']) ? (bool) $meta['show_nav_links'] : true; $menu_data = isset($meta['menu_data']) ? $meta['menu_data'] : false; $head_data = isset($meta['head_data']) ? $meta['head_data'] : ''; $file_name = isset($meta['file_name']) ? $meta['file_name'] : basename($_SERVER['SCRIPT_NAME']); $file_name = substr($file_name, 0, strrpos($file_name, '.')); // make sure we have these $GLOBALS['_&_DEBUG_QUERY'] = isset($GLOBALS['_&_DEBUG_QUERY']) ? $GLOBALS['_&_DEBUG_QUERY'] : ''; $GLOBALS['_?_DEBUG_QUERY'] = isset($GLOBALS['_?_DEBUG_QUERY']) ? $GLOBALS['_?_DEBUG_QUERY'] : ''; $flash = ''; if (class_exists('Flash')) { $flash = Flash::retrieve(); } if ($show_menu) { if (!$menu_data) { $menu_data = array('my_turn' => 0, 'my_games' => 0, 'games' => 0, 'new_msgs' => 0, 'msgs' => 0, 'in_vites' => 0, 'out_vites' => 0); $list = Game::get_list($_SESSION['player_id']); $invites = Game::get_invites($_SESSION['player_id']); if (is_array($list)) { foreach ($list as $game) { ++$menu_data['games']; if ($game['in_game'] && !in_array($game['state'], array('Finished', 'Draw'))) { ++$menu_data['my_games']; } if ($game['my_turn'] && 'Placing' != $game['state']) { ++$menu_data['my_turn']; } } } if (is_array($invites)) { foreach ($invites as $game) { if ($game['invite']) { ++$menu_data['in_vites']; } else { ++$menu_data['out_vites']; } } } $messages = Message::get_count($_SESSION['player_id']); $menu_data['msgs'] = (int) @$messages[0]; $menu_data['new_msgs'] = (int) @$messages[1]; $allow_blink = 'index.php' == basename($_SERVER['PHP_SELF']); } // highlight the important menu values foreach ($menu_data as $key => $value) { switch ($key) { case 'my_turn': case 'new_msgs': case 'in_vites': if (0 < $value) { $menu_data[$key] = '<span class="notice">' . $value . '</span>'; } break; default: // do nothing break; } } $game_data = isset($meta['game_data']) ? $meta['game_data'] : Game::get_list($_SESSION['player_id'], false); } // if we are admin logged in as someone else, let us know $admin_css = $admin_div = ''; if (isset($_SESSION['admin_id']) && isset($_SESSION['player_id']) && $_SESSION['player_id'] != $_SESSION['admin_id']) { $admin_css = ' <style type="text/css"> html { border: 5px solid red; } #admin_username { background: red; color: black; position: fixed; top: 0; left: 50%; width: 200px; margin-left: -100px; text-align: center; font-weight: bold; font-size: larger; padding: 3px; } </style>'; $admin_div = '<div id="admin_username">' . $GLOBALS['Player']->username . ' [ ' . $GLOBALS['Player']->id . ' ]</div>'; } $query_strings = 'var debug_query_ = "' . $GLOBALS['_&_DEBUG_QUERY'] . '"; var debug_query = "' . $GLOBALS['_?_DEBUG_QUERY'] . '";'; $debug_string = defined('DEBUG') && DEBUG ? 'var debug = true;' : 'var debug = false;'; $nav_links = ''; if ($show_nav_links && class_exists('Settings') && Settings::test()) { $nav_links = Settings::read('nav_links'); } $GAME_NAME = GAME_NAME; $html = <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" \t"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> \t<title>{$title}</title> \t<meta http-equiv="Content-Language" content="en-us" /> \t<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> \t<meta http-equiv="Content-Style-Type" content="text/css" /> \t<script type="text/javascript">//<![CDATA[ \t\t{$debug_string} \t\t{$query_strings} \t/*]]>*/</script> \t<link rel="stylesheet" type="text/css" media="screen" href="css/reset.css" /> \t<link rel="stylesheet" type="text/css" media="screen" href="css/layout.css" /> \t<link rel="stylesheet" type="text/css" media="screen" href="css/datatable.css" /> \t<link rel="stylesheet" type="text/css" media="screen" href="css/forms.css" /> \t<link rel="stylesheet" type="text/css" media="screen" href="css/c_{$GLOBALS['_DEFAULT_COLOR']}.css" /> \t<script type="text/javascript" src="scripts/json.js"></script> \t<script type="text/javascript" src="scripts/jquery-1.4.2.min.js"></script> \t<script type="text/javascript" src="scripts/jquery.tablesorter.js"></script> \t<!-- fancybox --> \t<link rel="stylesheet" type="text/css" media="screen" href="scripts/jquery.fancybox/jquery.fancybox-1.3.1.css" /> \t<script type="text/javascript" src="scripts/jquery.fancybox/jquery.fancybox-1.3.1.pack.js"></script> \t<script type="text/javascript">//<![CDATA[ \t\t\$(document).ready( function( ) { \t\t\t\$('a.help').fancybox({ \t\t\t\tautoDimensions : false, \t\t\t\twidth: 500, \t\t\t\theight: 400, \t\t\t\tpadding : 10, \t\t\t\toverlayOpacity : 0.7, \t\t\t\thideOnContentClick : false \t\t\t}); \t\t}); \t/*]]>*/</script> \t<!-- hide the fancybox titles --> \t<style type="text/css">/*<![CDATA[*/ \t\t#fancy_title { display: none !important; } \t/*]]>*/</style> \t{$head_data} \t{$flash} \t{$admin_css} </head> <body id="{$file_name}_page"> \t{$admin_div} \t<div id="links">{$nav_links}</div> \t<h1><a href="index.php">{$GAME_NAME}</a></h1> \t<div id="wrapper"> EOF; if ($show_menu) { $html .= ' <div id="menuholder">'; if ($menu_data) { $html .= ' <div id="menu"> <ul> <li' . get_active('index') . '><a href="index.php' . $GLOBALS['_?_DEBUG_QUERY'] . '" title="(Your Turn | Your Games | Total Games)"' . ($allow_blink && $menu_data['my_turn'] ? ' class="blink"' : '') . '>Games (' . $menu_data['my_turn'] . '|' . $menu_data['my_games'] . '|' . $menu_data['games'] . ')</a></li> <li' . get_active('invite') . '><a href="invite.php' . $GLOBALS['_?_DEBUG_QUERY'] . '" title="(Invites Recieved | Invites Sent)"' . ($allow_blink && $menu_data['in_vites'] ? ' class="blink"' : '') . '>Invitations (' . $menu_data['in_vites'] . '|' . $menu_data['out_vites'] . ')</a></li> <li' . get_active('messages') . '><a href="messages.php' . $GLOBALS['_?_DEBUG_QUERY'] . '" title="(New Messages | Total Messages)"' . ($allow_blink && $menu_data['new_msgs'] ? ' class="blink"' : '') . '>Messages (' . $menu_data['new_msgs'] . '|' . $menu_data['msgs'] . ')</a></li> <li' . get_active('stats') . '><a href="stats.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Statistics</a></li> <li' . get_active('prefs') . '><a href="prefs.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Preferences</a></li> <li' . get_active('profile') . '><a href="profile.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Profile</a></li> '; if (true == $GLOBALS['Player']->is_admin) { $html .= '<li' . get_active('admin') . '><a href="admin.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Admin</a></li>'; } $html .= ' <li><a href="login.php' . $GLOBALS['_?_DEBUG_QUERY'] . '">Logout</a></li> </ul> </div>'; } if ($game_data) { $html .= ' <div id="mygames_title"><strong>My Games</strong></div> <div id="mygames"> <ul>'; foreach ($game_data as $game) { $class = $game['my_turn'] ? 'playing' : 'waiting'; $html .= ' <li class="' . $class . '"><a href="game.php?id=' . $game['game_id'] . $GLOBALS['_&_DEBUG_QUERY'] . '">' . htmlentities($game['opponent'], ENT_QUOTES, 'ISO-8859-1', false) . '</a></li>'; } $html .= ' </ul> </div>'; } $html .= ' </div>'; } return $html; }
projects.php" class="<?php echo get_active('projects'); ?> ">Projects</a></li> <li><a href="<?php echo $root_url; ?> skills.php" class="<?php echo get_active('skills'); ?> ">Skills</a></li> <li><a href="<?php echo $root_url; ?> testimonials.php" class="<?php echo get_active('testimonials'); ?> ">Testimonials</a></li> <li><a href="<?php echo $root_url; ?> contact.php" class="<?php echo get_active('contact'); ?> ">Contact Me</a></li> </ul> </div> </div> </div> </div>