MAIN FILE
Code: Select all
<?php
include_once("common.php");
include ("includes/html/structure.php");
include ("modules/gallery/funcs.php");
//ini_set('display_errors', '1');
//error_reporting(E_ALL);
extract($_POST);
extract($_GET);
$userID = $_SESSION["userid"];
if (!$userID)
exit;
$query = "SELECT * FROM " . userTable . " where id=$userID";
$db->setFetchMode(DB_FETCHMODE_ASSOC);
$arrUser = $db->getAll($query);
// check actions
// TODO: messy code, extract should never be used, change it!!!
if ($add_gal)
addGal();
if ($_POST['op'] == 'update')
editGal();
if ($_POST['op'] == 'delete')
delGal();
$arrGalleries = getGalleries($userID);
$arrCount = getImageCountPerGallery($userID);
head('Card -> Galleries');
userBar(
array(
'index.php?id=' . $cardId => 'Close My Galleries' )// this creates the item "Close My Galleries" in the menu bar, This section of code is where $helpPage needs to be equal to 'my-gallery' and passed to the menu bar to make $helpPage available
);
?>
....
Code: Select all
<?php
function head($title = 'Card', $additional = '')
{
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<title><?php print $title; ?></title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<!-- This loads several js libraries and I have removed to shorten this code area for the purpose of this forum post -->
<?php print $additional; // output additional content i.e. js libraries ?>
</head>
<body>
<?php if (!isset($_GET['popup'])) { ?>
<div id="main">
<?php } else {?>
<div id="help-main">
<?php } ?>
<?php
}
function foot()
{
?>
<br clear="all"/>
</div>
</body>
</html>
<?php
}
function userBar ($arrAdditional= array(), $helpPage= '') // This line of code is where the $helpPage should be if $helpPage = 'mygallery' everything works correctly
{
//echo $helpPage;
?>
<div class="user_bar">
<a href="index.php">Index</a> |
<a href="update-profile.php">Update Profile</a> |
<?php
foreach ($arrAdditional as $link => $text) {
?>
<a href="<?php echo $link; ?>"><?php echo $text; ?></a> |
<?php
}
?>
<?php
echo
"<a href=\"#\" onclick=\"myPopup('module.php?module=help&key=$helpPage&popup', 500, 520)\">help</a> |"
?>
<a href="logout.php">Logout</a>
</div>
<br clear="all"/>
<?php
}
?>