/** Set up session handling. * Set all PHP options for PostNuke session handling */ function pnSessionSetup() { global $HTTP_SERVER_VARS; // -- Defaults // Base URI $path = pnGetBaseURI(); if (empty($path)) { $path = '/'; } // Host $host = $HTTP_SERVER_VARS['HTTP_HOST']; if (empty($host)) { $host = getenv('HTTP_HOST'); } $host = preg_replace('/:.*/', '', $host); // -- PHP configuration variables // Stop adding SID to URLs ini_set('session.use_trans_sid', 0); // User-defined save handler ini_set('session.save_handler', 'user'); // How to store data ini_set('session.serialize_handler', 'php'); // Use cookie to store the session ID ini_set('session.use_cookies', 1); // Name of our cookie ini_set('session.name', 'POSTNUKESID'); // Lifetime of our cookie $seclevel = pnConfigGetVar('seclevel'); switch ($seclevel) { case 'High': // Session lasts duration of browser $lifetime = 0; // Referer check //ini_set('session.referer_check', "$host$path"); ini_set('session.referer_check', "{$host}"); break; case 'Medium': // Session lasts set number of days $lifetime = pnConfigGetVar('secmeddays') * 86400; break; case 'Low': // Session lasts unlimited number of days (well, lots, anyway) // (Currently set to 25 years) $lifetime = 788940000; break; } // ini_set('session.cookie_lifetime', $lifetime); // ini_set('session.cookie_path', $path); // Garbage collection ini_set('session.gc_probability', 1); // Inactivity timeout for user sessions ini_set('session.gc_maxlifetime', pnConfigGetVar('secinactivemins') * 60); // Auto-start session ini_set('session.auto_start', 1); // Session handlers session_set_save_handler("pnSessionOpen", "pnSessionClose", "pnSessionRead", "pnSessionWrite", "pnSessionDestroy", "pnSessionGC"); return true; }
function getMediaDisplayHtml($url, $width, $height, $id, $args) { if ((string) (int) $width == "{$width}") { $width = "{$width}px"; } $widthHtml = $width == null ? '' : " width:{$width}"; $heightHtml = $height == null ? '' : " height:{$height}"; $onclickHtml = empty($args['onclick']) ? '' : " onclick=\"{$args['onclick']}\""; $classHtml = empty($args['class']) ? '' : " class=\"{$args['class']}\""; $idHtml = $id != '' ? " id=\"{$id}\"" : ''; $style = " style=\"{$widthHtml}{$heightHtml}\""; $title = isset($args['title']) ? htmlspecialchars($args['title']) : ''; $url = pnGetBaseURI() . '/' . $url; $html = "<img src=\"{$url}\"{$style}{$idHtml} title=\"{$title}\" alt=\"{$title}\"{$onclickHtml}{$classHtml}/>"; if (isset($args['url'])) { $rel = isset($args['urlRel']) ? " rel=\"{$args['urlRel']}\"" : ''; $html = "<a href=\"{$args['url']}\"{$rel}>{$html}</a>"; } return $html; }
/** * get base URL for PostNuke * @returns string * @return base URL for PostNuke */ function pnGetBaseURL() { global $HTTP_SERVER_VARS; if (empty($HTTP_SERVER_VARS['HTTP_HOST'])) { $server = getenv('HTTP_HOST'); } else { $server = $HTTP_SERVER_VARS['HTTP_HOST']; } // IIS sets HTTPS=off if (isset($HTTP_SERVER_VARS['HTTPS']) && $HTTP_SERVER_VARS['HTTPS'] != 'off' || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { $proto = 'https://'; } else { $proto = 'http://'; } $path = pnGetBaseURI(); return "{$proto}{$server}{$path}/"; }
// This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // To read the license please visit http://www.gnu.org/copyleft/gpl.html // ---------------------------------------------------------------------- // Original Author of file: Francisco Burzi // Purpose of file: Legacy code still around for various old modules // ---------------------------------------------------------------------- if (strpos($_SERVER['PHP_SELF'], 'legacy.php')) { die("You can't access this file directly..."); } // Recreate $pnconfig['nukeurl'] global $pnconfig; $pnconfig['nukeurl'] = pnGetBaseURI(); global $mainfile; $mainfile = 1; function delQuotes($string) { // No recursive function to add quote to an HTML tag if needed // and delete duplicate spaces between attribs. $tmp = ""; # string buffer $result = ""; # result string $i = 0; $attrib = -1; # Are us in an HTML attrib ? -1: no attrib 0: name of the attrib 1: value of the atrib $quote = 0; # Is a string quote delimited opened ? 0=no, 1=yes
function head() { global $index, $artpage, $topic, $hlpfile, $hr, $theme, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $textcolor1, $textcolor2, $textcolor3, $textcolor4, $forumpage, $thename, $postnuke_theme, $pntheme, $themename, $themeimages, $additional_header, $themeOverrideCategory, $themeOverrideStory; // modification mouzaia .71 $cWhereIsPerso = WHERE_IS_PERSO; if (!empty($cWhereIsPerso)) { include "modules/NS-Multisites/head.inc.php"; } else { global $themesarein; if (pnUserLoggedIn() && pnConfigGetVar('theme_change') != 1) { $thistheme = pnUserGetTheme(); if (isset($theme)) { $thistheme = pnVarPrepForOs($theme); } } else { $thistheme = pnConfigGetVar('Default_Theme'); if (isset($theme)) { $thistheme = pnVarPrepForOs($theme); } } // eugenio themeover 20020413 // override the theme per category or story // precedence is story over category override if ($themeOverrideCategory != '' && file_exists("themes/{$themeOverrideCategory}")) { $thistheme = $themeOverrideCategory; } if ($themeOverrideStory != '' && file_exists("themes/{$themeOverrideStory}")) { $thistheme = $themeOverrideStory; } if (@file(WHERE_IS_PERSO . "themes/" . $thistheme . "/theme.php")) { $themesarein = WHERE_IS_PERSO; } else { $themesarein = ""; } } // eugenio themeover 20020413 pnThemeLoad($thistheme); /** * Simple XHTML Beginnings */ if (pnConfigGetVar('supportxhtml')) { //include("includes/xhtml.php"); xhtml_head_start(0); /* Transitional Support for now */ } else { echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; echo "<html>\n<head>\n"; if (defined("_CHARSET") && _CHARSET != "") { echo "<meta http-equiv=\"Content-Type\" " . "content=\"text/html; charset=" . _CHARSET . "\">\n"; } } if ($artpage == 1) { /** * article page output */ global $info, $hometext; echo "<title>{$info['title']} :: " . pnConfigGetVar('sitename') . ' :: ' . pnConfigGetVar('slogan') . "</title>\n"; if (pnConfigGetVar('dyn_keywords') == 1) { $htmlless = check_html($info['maintext'], $strip = 'nohtml'); $symbolLess = trim(ereg_replace('("|\\?|!|:|\\.|\\(|\\)|;|\\\\)+', ' ', $htmlless)); $keywords = ereg_replace('( |' . CHR(10) . '|' . CHR(13) . ')+', ',', $symbolLess); $metatags = ereg_replace(",+", ",", $keywords); echo "<meta http-equiv=\"Keywords\" content=\"{$metatags}\">\n"; } else { echo "<meta name=\"KEYWORDS\" content=\"" . pnConfigGetVar('metakeywords') . "\">\n"; } } else { /** * all other page output */ echo '<title>' . pnConfigGetVar('sitename') . ' :: ' . pnConfigGetVar('slogan') . "</title>\n"; echo '<meta name="KEYWORDS" content="' . pnConfigGetVar('metakeywords') . "\">\n"; } echo '<meta name="DESCRIPTION" content="' . pnConfigGetVar('slogan') . "\">\n"; echo "<meta name=\"ROBOTS\" content=\"INDEX,FOLLOW\">\n"; echo "<meta name=\"resource-type\" content=\"document\">\n"; echo "<meta http-equiv=\"expires\" content=\"0\">\n"; echo '<meta name="author" content="' . pnConfigGetVar('sitename') . "\">\n"; echo '<meta name="copyright" content="Copyright (c) 2003 by ' . pnConfigGetVar('sitename') . "\">\n"; echo "<meta name=\"revisit-after\" content=\"1 days\">\n"; echo "<meta name=\"distribution\" content=\"Global\">\n"; echo '<meta name="generator" content="PostNuke ' . _PN_VERSION_NUM . " - http://postnuke.com\">\n"; echo "<meta name=\"rating\" content=\"General\">\n"; global $themesarein; echo "<link rel=\"StyleSheet\" href=\"" . $themesarein . "themes/" . $thistheme . "/style/styleNN.css\" type=\"text/css\">\n"; echo "<style type=\"text/css\">"; echo "@import url(\"" . $themesarein . "themes/" . $thistheme . "/style/style.css\"); "; echo "</style>\n"; echo "<script type=\"text/javascript\" src=\"javascript/showimages.php\"></script>\n\n"; /* Enable Wysiwyg editor configuration at seeting Added by bharvey42 edited by Neo */ $pnWysiwygEditor = pnConfigGetVar('WYSIWYGEditor'); if (is_numeric($pnWysiwygEditor) && $pnWysiwygEditor == 1) { $pnWSEditorPath = pnGetBaseURI(); echo "<!--Visual Editor Plug-in-->" . "<script type=\"text/javascript\">QBPATH='" . $pnWSEditorPath . "/javascript'; VISUAL=0; SECURE=1;</script>" . "<script type=\"text/javascript\" src='" . $pnWSEditorPath . "/javascript/quickbuild.js'></script>" . "<script type=\"text/javascript\" src='" . $pnWSEditorPath . "/javascript/tabedit.js'></script>"; } else { } echo "<script type=\"text/javascript\" src=\"javascript/openwindow.php?hlpfile={$hlpfile}\"></script>\n\n"; if (isset($additional_header)) { echo @implode("\n", $additional_header); } themeheader(); }
/** * Set up session handling * * Set all PHP options for PostNuke session handling */ function pnSessionSetup() { $path = pnGetBaseURI(); if (empty($path)) { $path = '/'; } $host = pnServerGetVar('HTTP_HOST'); if (strpos($host, ':') !== false) { $host = substr($host, 0, strpos($host, ':')); } // PHP configuration variables // Stop adding SID to URLs ini_set('session.use_trans_sid', 0); @ini_set('url_rewriter.tags', ''); // User-defined save handler ini_set('session.save_handler', 'user'); // How to store data ini_set('session.serialize_handler', 'php'); // Use cookie to store the session ID ini_set('session.use_cookies', 1); // Name of our cookie ini_set('session.name', 'POSTNUKESID'); // Lifetime of our cookie $seclevel = pnConfigGetVar('seclevel'); switch ($seclevel) { case 'High': // Session lasts duration of browser $lifetime = 0; // Referer check // ini_set('session.referer_check', "$host$path"); ini_set('session.referer_check', "{$host}"); break; case 'Medium': // Session lasts set number of days $lifetime = pnConfigGetVar('secmeddays') * 86400; break; case 'Low': default: // Session lasts unlimited number of days (well, lots, anyway) // (Currently set to 25 years) $lifetime = 788940000; break; } ini_set('session.cookie_lifetime', $lifetime); // Cookie path ini_set('session.cookie_path', $path); // Cookie domain // only needed for multi-server multisites - adapt as needed // $domain = preg_replace('/^[^.]+/','',$host); // ini_set('session.cookie_domain', $domain); // Garbage collection ini_set('session.gc_probability', 1); // Inactivity timeout for user sessions ini_set('session.gc_maxlifetime', pnConfigGetVar('secinactivemins') * 60); // Auto-start session ini_set('session.auto_start', 1); // Session handlers // PHP 5.2 workaround if (version_compare(phpversion(), '5.2.0', '>=')) { register_shutdown_function('session_write_close'); } session_set_save_handler('pnSessionOpen', 'pnSessionClose', 'pnSessionRead', 'pnSessionWrite', 'pnSessionDestroy', 'pnSessionGC'); return true; }
function mediashare_userapi_getRelativeMediadir() { $zkroot = substr(pnServerGetVar('DOCUMENT_ROOT'), 0, -1) . pnGetBaseURI(); $mediaBase = substr(str_replace('\\', '/', realpath(pnModGetVar('mediashare', 'mediaDirName', 'mediashare'))), strlen($zkroot) + 1); return $mediaBase . '/'; }
/** * get base URL for PostNuke * * @return string base URL for PostNuke */ function pnGetBaseURL() { $server = pnServerGetVar('HTTP_HOST'); // IIS sets HTTPS=off $https = pnServerGetVar('HTTPS'); if (isset($https) && $https != 'off') { $proto = 'https://'; } else { $proto = 'http://'; } $path = pnGetBaseURI(); return "{$proto}{$server}{$path}/"; }
/** * Get the base directory for a module * * Example: If the webroot is located at * /var/www/html * and the module name is Template and is found * in the modules directory then this function * would return /var/www/html/modules/Template * * If the Template module was located in the system * directory then this function would return * /var/www/html/system/Template * * This allows you to say: * include(pnModGetBaseDir() . '/includes/private_functions.php'); * * @author Chris Miller * @param $modname - name of module to that you want the * base directory of. * @return string - the path from the root directory to the * specified module. */ function pnModGetBaseDir($modname = '') { if (empty($modname)) { $modname = pnModGetName(); } $path = pnGetBaseURI(); $directory = 'modules/' . $modname; if ($path != '') { $path .= '/'; } $url = $path . $directory; return $url; }