/** * $Id$ * * PostCalendar::PostNuke Events Calendar Module * Copyright (C) 2002 The PostCalendar Team * http://postcalendar.tv * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * To read the license please read the docs/license.txt or visit * http://www.gnu.org/copyleft/gpl.html * */ function smarty_function_pc_view_select($args) { @define('_PC_FORM_TEMPLATE', true); $Date = postcalendar_getDate(); if (!isset($y)) { $y = substr($Date, 0, 4); } if (!isset($m)) { $m = substr($Date, 4, 2); } if (!isset($d)) { $d = substr($Date, 6, 2); } $tplview = pnVarCleanFromInput('tplview'); $viewtype = pnVarCleanFromInput('viewtype'); if (!isset($viewtype)) { $viewtype = _SETTING_DEFAULT_VIEW; } $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $mdir = pnVarPrepForOS($modinfo['directory']); unset($modinfo); $pcTemplate = pnVarPrepForOS(_SETTING_TEMPLATE); if (empty($pcTemplate)) { $pcTemplate = 'default'; } $viewlist = array(); $handle = opendir("modules/{$mdir}/pntemplates/{$pcTemplate}/views/{$viewtype}"); $hide_list = array('.', '..', 'CVS', 'index.html'); while ($f = readdir($handle)) { if (!in_array($f, $hide_list)) { $viewlist[] = $f; } } closedir($handle); unset($no_list); sort($viewlist); $tcount = count($viewlist); //$options = "<select id=\"tplview\" name=\"tplview\" class=\"$args[class]\">"; - pennfirm $options = "<select id=\"tplview\" name=\"viewtype\" class=\"{$args['class']}\">"; $selected = $tplview; for ($t = 0; $t < $tcount; $t++) { $id = str_replace('.html', '', $viewlist[$t]); $sel = $selected == $id ? 'selected' : ''; $options .= "<option value=\"{$id}\" {$sel} class=\"{$args['class']}\">{$id}</option>"; } $options .= '</select>'; if (!isset($args['label'])) { $args['label'] = _PC_TPL_VIEW_SUBMIT; } $submit = '<input type="submit" valign="middle" name="submit" value="' . $args['label'] . '" class="' . $args['class'] . '" />'; // build the form if ($t > 1) { echo $options, $submit; } }
function admin_menu($help_file = '') { $pntable = pnDBGetTables(); list($newsubs) = db_select_one_row("SELECT count(*) FROM {$pntable['queue']}"); if (!pnSecAuthAction(0, "::", '::', ACCESS_EDIT)) { // suppress admin display - return to index. pnRedirect('index.php'); } else { menu_title('admin.php', _ADMINMENU); menu_graphic(pnConfigGetVar('admingraphic')); if ($help_file != '') { menu_help($help_file, _ONLINEMANUAL); } $mods = pnModGetAdminMods(); if ($mods == false) { // there aren't admin modules return; } foreach ($mods as $mod) { // Hack until the new news module comes into being // TODO - remove this at appropriate time if ($mod['name'] == 'AddStory') { $mod['name'] = 'Stories'; } if (pnSecAuthAction(0, "{$mod['name']}::", '::', ACCESS_EDIT)) { if (file_exists("modules/" . pnVarPrepForOS($mod['directory']) . "/pnadmin.php")) { $file = "modules/" . pnVarPrepForOS($mod['directory']) . "/pnimages/admin."; if (file_exists($file . 'gif')) { $imgfile = $file . 'gif'; } elseif (file_exists($file . 'jpg')) { $imgfile = $file . 'jpg'; } elseif (file_exists($file . 'png')) { $imgfile = $file . 'png'; } else { $imgfile = 'modules/NS-Admin/images/default.gif'; } menu_add_option(pnVarPrepForDisplay(pnModURL($mod['name'], 'admin')), $mod['displayname'], $imgfile); } else { $file = "modules/" . pnVarPrepForOS($mod['directory']) . "/images/admin."; if (file_exists($file . 'gif')) { $imgfile = $file . 'gif'; } elseif (file_exists($file . 'jpg')) { $imgfile = $file . 'jpg'; } elseif (file_exists($file . 'png')) { $imgfile = $file . 'png'; } else { $imgfile = 'modules/NS-Admin/images/default.gif'; } menu_add_option("admin.php?module={$mod['directory']}&op=main", $mod['displayname'], $imgfile); } } } } }
/** * pnThemeInfo() * <br /> * This function returns information about a certain theme. * For this purpose, it includes the xaninfo.php file (for * Xanthia themes) or the themeinfo.php (for other themes). * <br /> * If the name passed isn't a valid theme, false is returned. * <br /> * For a valid theme, at least these values are returned: * xanthia (boolean, true if this is a Xanthia theme) * hidden (boolean, true if this is a hidden theme) * active (boolean, true if the theme is active) * * @author Joerg Napp * @since PostNuke .760 * @param string $theme the name of the theme * @return array the theme information **/ function pnThemeInfo($theme) { $theme = isset($theme) ? $theme : ''; if (!pnVarValidate($theme, 'theme')) { return false; } $themepath = pnVarPrepForOS($theme); // determine if this is a valid theme if (!file_exists(WHERE_IS_PERSO . "themes/{$themepath}/theme.php") && !file_exists("themes/{$themepath}/theme.php")) { return false; } $themeinfo = array(); // Setting the defaults $themeinfo['name'] = $theme; // might be useful $themeinfo['hidden'] = false; // A theme isn't hidden unless explicitly marked as hidden $themeinfo['xanthia'] = false; // assume the theme not to be a Xanthia theme unless xaninfo.php is present. $themeinfo['active'] = true; // assume the theme to be active unless it isn't if (file_exists($file = WHERE_IS_PERSO . "themes/{$themepath}/themeinfo.php")) { include $file; } elseif (file_exists($file = "themes/{$themepath}/themeinfo.php")) { include $file; } elseif (file_exists($file = WHERE_IS_PERSO . "themes/{$themepath}/xaninfo.php")) { $themeinfo['xanthia'] = true; include $file; } elseif (file_exists($file = "themes/{$themepath}/xaninfo.php")) { $themeinfo['xanthia'] = true; include $file; } if ($themeinfo['xanthia']) { if (pnModAPILoad('Xanthia', 'user')) { // see if the skin is in the database (=active) $skinid = pnModAPIFunc('Xanthia', 'user', 'getSkinID', array('skin' => $theme)); $themeinfo['active'] = (bool) $skinid; } else { // don't use Xanthia themes without Xanthia. // Maybe the function should return false (= not a valid theme) in this case? $themeinfo['active'] = false; } } return $themeinfo; }
function getmodulesinstanceschemainfo() { $moddir = opendir('modules/'); while ($modname = readdir($moddir)) { // Old-style version file $osfile = 'modules/' . pnVarPrepForOS($modname) . '/Version.php'; @(include $osfile); // New-style version file $osfile = 'modules/' . pnVarPrepForOS($modname) . '/pnversion.php'; @(include $osfile); if (!empty($modversion['securityschema'])) { foreach ($modversion['securityschema'] as $component => $instance) { pnSecAddSchema($component, $instance); } } $modversion['securityschema'] = ''; } closedir($moddir); }
exit; } else { // Old-old style of loading modules if (empty($op)) { $op = "modload"; } if (empty($file)) { $file = "index"; } include 'includes/legacy.php'; switch ($op) { case 'modload': define("LOADED_AS_MODULE", "1"); // added for the module/system seperation [class007] if (file_exists('modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php')) { include 'modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php'; } else { // Failed to load the module $output = new pnHTML(); //$output->StartPage(); $output->Text('Failed to load module ' . $module); $output->EndPage(); $output->PrintPage(); exit; } break; default: // Failed to load the module $output = new pnHTML(); //$output->StartPage(); $output->Text('Sorry, you cannot access this file directly...');
function postcalendar_admin_categoryLimits($msg = '', $e = '', $args) { if (!PC_ACCESS_ADD) { return _POSTCALENDARNOAUTH; } extract($args); unset($args); $output = new pnHTML(); $output->SetInputMode(_PNH_VERBATIMINPUT); // set up Smarty $tpl = new pcSmarty(); $tpl->caching = false; $template_name = pnModGetVar(__POSTCALENDAR__, 'pcTemplate'); if (!isset($template_name)) { $template_name = 'default'; } if (!empty($e)) { $output->Text('<div style="padding:5px; border:1px solid red; background-color: pink;">'); $output->Text('<center><b>' . $e . '</b></center>'); $output->Text('</div><br />'); } if (!empty($msg)) { $output->Text('<div style="padding:5px; border:1px solid green; background-color: lightgreen;">'); $output->Text('<center><b>' . $msg . '</b></center>'); $output->Text('</div><br />'); } //================================================================= // Setup the correct config file path for the templates //================================================================= $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $modir = pnVarPrepForOS($modinfo['directory']); $modname = $modinfo['displayname']; //print_r($all_categories); unset($modinfo); $tpl->assign('action', pnModURL(__POSTCALENDAR__, 'admin', 'categoryLimitsUpdate')); //=============================================================== // Setup titles for smarty //=============================================================== $tpl->assign('_PC_LIMIT_TITLE', _PC_LIMIT_TITLE); $tpl->assign('StartTimeTitle', _PC_LIMIT_START_TIME); $tpl->assign('EndTimeTile', _PC_LIMIT_END_TIME); $tpl->assign('LimitHoursTitle', _PC_TIMED_DURATION_HOURS); $tpl->assign('LimitMinutesTitle', _PC_TIMED_DURATION_MINUTES); //============================================================= // Setup Vars for smarty //============================================================ $tpl->assign('mer_title', 'mer'); $mer = array('am', 'pm'); $tpl->assign_by_ref('mer', $mer); $tpl->assign('starttimeh', 'starttimeh'); $tpl->assign('starttimem', 'starttimem'); $tpl->assign('endtimeh', 'endtimeh'); $tpl->assign('endtimem', 'endtimem'); $tpl->assign('InputLimit', 'limit'); $tpl->assign('LimitTitle', _PC_LIMIT_TITLE); $tpl->assign('_PC_NEW_LIMIT_TITLE', _PC_NEW_LIMIT_TITLE); $tpl->assign('_PC_CAT_DELETE', _PC_CAT_DELETE); $tpl->assign('EndTimeTitle', _PC_LIMIT_END_TIME); $hour_array = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '21', '21', '22', '23'); $min_array = array('00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55'); $tpl->assign_by_ref('hour_array', $hour_array); $tpl->assign_by_ref('min_array', $min_array); $categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories'); // create translations of category names if applicable $sizeAllCat = count($categories); for ($m = 0; $m < $sizeAllCat; $m++) { $tempCategory = $categories[$m]["name"]; $categories[$m]["name"] = xl_appt_category($tempCategory); } $tpl->assign_by_ref('categories', $categories); $limits = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategoryLimits'); $tpl->assign_by_ref('limits', $limits); $tpl->assign('BGCOLOR2', $GLOBALS['style']['BGCOLOR2']); $tpl->assign("catTitle", _PC_REP_CAT_TITLE_S); $tpl->assign("catid", "catid"); $form_submit = '<input type=hidden name="form_action" value="commit"/> ' . $authkey . '<input type="submit" name="submit" value="' . xl('go') . '">'; $tpl->assign('FormSubmit', $form_submit); $output->Text($tpl->fetch($template_name . '/admin/submit_category_limit.html')); $output->Text(postcalendar_footer()); return $output->GetOutput(); }
function __construct() { $theme = pnUserGetTheme(); $osTheme = pnVarPrepForOS($theme); pnThemeLoad($theme); global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $bgcolor6, $textcolor1, $textcolor2; // call constructor parent::__construct(); // gather module information $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $pcDir = pnVarPrepForOS($pcModInfo['directory']); $pcDisplayName = $pcModInfo['displayname']; unset($pcModInfo); // setup up pcSmarty configs $this->compile_check = true; $this->force_compile = false; $this->debugging = false; $this->template_dir = "modules/{$pcDir}/pntemplates"; array_push($this->plugins_dir, "modules/{$pcDir}/pnincludes/Smarty/plugins"); array_push($this->plugins_dir, "modules/{$pcDir}/plugins"); $this->compile_dir = "modules/{$pcDir}/pntemplates/compiled"; $this->cache_dir = "modules/{$pcDir}/pntemplates/cache"; $this->caching = _SETTING_USE_CACHE; $this->cache_lifetime = _SETTING_CACHE_LIFETIME; $this->left_delimiter = '[-'; $this->right_delimiter = '-]'; //============================================================ // checks for safe mode // i think it's safe to say we can do this automagically now //============================================================ $safe_mode = ini_get('safe_mode'); $safe_mode_gid = ini_get('safe_mode_gid'); $open_basedir = ini_get('open_basedir'); $use_safe_mode = (bool) $safe_mode || (bool) $safe_mode_gid || !empty($open_basedir); if ($use_safe_mode) { $this->use_sub_dirs = false; } else { $this->use_sub_dirs = true; } unset($use_safe_mode, $safe_mode, $safe_mode_gid, $open_basedir); $this->autoload_filters = array('output' => array('trimwhitespace')); $lang = pnUserGetLang(); $func = pnVarCleanFromInput('func'); $print = pnVarCleanFromInput('print'); // assign theme globals $this->assign_by_ref('BGCOLOR1', $bgcolor1); $this->assign_by_ref('BGCOLOR2', $bgcolor2); $this->assign_by_ref('BGCOLOR3', $bgcolor3); $this->assign_by_ref('BGCOLOR4', $bgcolor4); $this->assign_by_ref('BGCOLOR5', $bgcolor5); $this->assign_by_ref('BGCOLOR6', $bgcolor6); $this->assign_by_ref('TEXTCOLOR1', $textcolor1); $this->assign_by_ref('TEXTCOLOR2', $textcolor2); $this->assign_by_ref('USER_LANG', $lang); $this->assign_by_ref('FUNCTION', $func); $this->assign('PRINT_VIEW', $print); $this->assign('USE_POPUPS', _SETTING_USE_POPUPS); $this->assign('USE_TOPICS', _SETTING_DISPLAY_TOPICS); $this->assign('USE_INT_DATES', _SETTING_USE_INT_DATES); $this->assign('OPEN_NEW_WINDOW', _SETTING_OPEN_NEW_WINDOW); $this->assign('EVENT_DATE_FORMAT', _SETTING_DATE_FORMAT); $this->assign('HIGHLIGHT_COLOR', _SETTING_DAY_HICOLOR); $this->assign('24HOUR_TIME', _SETTING_TIME_24HOUR); $this->assign_by_ref('MODULE_NAME', $pcDisplayName); $this->assign_by_ref('MODULE_DIR', $pcDir); $this->assign('ACCESS_NONE', PC_ACCESS_NONE); $this->assign('ACCESS_OVERVIEW', PC_ACCESS_OVERVIEW); $this->assign('ACCESS_READ', PC_ACCESS_READ); $this->assign('ACCESS_COMMENT', PC_ACCESS_COMMENT); $this->assign('ACCESS_MODERATE', PC_ACCESS_MODERATE); $this->assign('ACCESS_EDIT', PC_ACCESS_EDIT); $this->assign('ACCESS_ADD', PC_ACCESS_ADD); $this->assign('ACCESS_DELETE', PC_ACCESS_DELETE); $this->assign('ACCESS_ADMIN', PC_ACCESS_ADMIN); //================================================================= // Find out what Template we're using //================================================================= $template_name = _SETTING_TEMPLATE; if (!isset($template_name)) { $template_name = 'default'; } //================================================================= // Find out what Template View to use //================================================================= $template_view = pnVarCleanFromInput('tplview'); if (!isset($template_view)) { $template_view = 'default'; } $this->config_dir = "modules/{$pcDir}/pntemplates/{$template_name}/config/"; $this->assign_by_ref('TPL_NAME', $template_name); $this->assign_by_ref('TPL_VIEW', $template_view); $this->assign('TPL_IMAGE_PATH', $GLOBALS['rootdir'] . "/main/calendar/modules/{$pcDir}/pntemplates/{$template_name}/images"); $this->assign('TPL_ROOTDIR', $GLOBALS['rootdir']); $this->assign('TPL_STYLE_PATH', "modules/{$pcDir}/pntemplates/{$template_name}/style"); $this->assign('THEME_PATH', "themes/{$osTheme}"); }
/** * postcalendar_userapi_buildView * * Builds the calendar display * @param string $Date mm/dd/yyyy format (we should use timestamps) * @return string generated html output * @access public */ function postcalendar_userapi_buildView($args) { $print = pnVarCleanFromInput('print'); $show_days = pnVarCleanFromInput('show_days'); extract($args); unset($args); $schedule_start = $GLOBALS[schedule_start]; $schedule_end = $GLOBALS[schedule_end]; // $times is an array of associative arrays, where each sub-array // has keys 'hour', 'minute' and 'mer'. // $times = array(); // For each hour in the schedule... // for ($blocknum = $schedule_start; $blocknum <= $schedule_end; $blocknum++) { $mer = $blocknum >= 12 ? 'pm' : 'am'; // $minute is an array of time slot strings within this hour. $minute = array('00'); for ($minutes = $GLOBALS['calendar_interval']; $minutes <= 60; $minutes += $GLOBALS['calendar_interval']) { if ($minutes <= '9') { $under_ten = "0" . $minutes; array_push($minute, "{$under_ten}"); } else { if ($minutes >= '60') { break; } else { array_push($minute, "{$minutes}"); } } } foreach ($minute as $m) { array_push($times, array("hour" => $blocknum, "minute" => $m, "mer" => $mer)); } } //================================================================= // get the module's information //================================================================= $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $pcDir = $modinfo['directory']; unset($modinfo); //================================================================= // grab the for post variable //================================================================= // $pc_username = pnVarCleanFromInput('pc_username'); $pc_username = $_SESSION['pc_username']; // from Michael Brinson 2006-09-19 $category = pnVarCleanFromInput('pc_category'); $topic = pnVarCleanFromInput('pc_topic'); //================================================================= // set the correct date //================================================================= $Date = postcalendar_getDate(); //================================================================= // get the current view //================================================================= if (!isset($viewtype)) { $viewtype = 'month'; } //================================================================= // Find out what Template we're using //================================================================= $template_name = _SETTING_TEMPLATE; if (!isset($template_name)) { $template_name = 'default'; } //================================================================= // Find out what Template View to use //================================================================= $template_view = pnVarCleanFromInput('tplview'); if (!isset($template_view)) { $template_view = 'default'; } //================================================================= // See if the template view exists //================================================================= if (!file_exists("modules/{$pcDir}/pntemplates/{$template_name}/views/{$viewtype}/{$template_view}.html")) { $template_view_load = 'default'; } else { $template_view_load = pnVarPrepForOS($template_view); } //================================================================= // Grab the current theme information //================================================================= pnThemeLoad(pnUserGetTheme()); global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $bgcolor6, $textcolor1, $textcolor2; //================================================================= // Insert necessary JavaScript into the page //================================================================= $output = pnModAPIFunc(__POSTCALENDAR__, 'user', 'pageSetup'); //================================================================= // Setup Smarty Template Engine //================================================================= $tpl = new pcSmarty(); //if(!$tpl->is_cached("$template_name/views/$viewtype/$template_view_load.html",$cacheid)) { //diable caching completely if (true) { //================================================================= // Let's just finish setting things up //================================================================= $the_year = substr($Date, 0, 4); $the_month = substr($Date, 4, 2); $the_day = substr($Date, 6, 2); $last_day = Date_Calc::daysInMonth($the_month, $the_year); //================================================================= // populate the template object with information for // Month Names, Long Day Names and Short Day Names // as translated in the language files // (may be adding more here soon - based on need) //================================================================= $pc_month_names = array(_CALJAN, _CALFEB, _CALMAR, _CALAPR, _CALMAY, _CALJUN, _CALJUL, _CALAUG, _CALSEP, _CALOCT, _CALNOV, _CALDEC); $pc_short_day_names = array(_CALSUNDAYSHORT, _CALMONDAYSHORT, _CALTUESDAYSHORT, _CALWEDNESDAYSHORT, _CALTHURSDAYSHORT, _CALFRIDAYSHORT, _CALSATURDAYSHORT); $pc_long_day_names = array(_CALSUNDAY, _CALMONDAY, _CALTUESDAY, _CALWEDNESDAY, _CALTHURSDAY, _CALFRIDAY, _CALSATURDAY); //================================================================= // here we need to set up some information for later // variable creation. This helps us establish the correct // date ranges for each view. There may be a better way // to handle all this, but my brain hurts, so your comments // are very appreciated and welcomed. //================================================================= switch (_SETTING_FIRST_DAY_WEEK) { case _IS_MONDAY: $pc_array_pos = 1; $first_day = date('w', mktime(0, 0, 0, $the_month, 0, $the_year)); $week_day = date('w', mktime(0, 0, 0, $the_month, $the_day - 1, $the_year)); $end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year)); if ($end_dow != 0) { $the_last_day = $last_day + (7 - $end_dow); } else { $the_last_day = $last_day; } break; case _IS_SATURDAY: $pc_array_pos = 6; $first_day = date('w', mktime(0, 0, 0, $the_month, 2, $the_year)); $week_day = date('w', mktime(0, 0, 0, $the_month, $the_day + 1, $the_year)); $end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year)); if ($end_dow == 6) { $the_last_day = $last_day + 6; } elseif ($end_dow != 5) { $the_last_day = $last_day + (5 - $end_dow); } else { $the_last_day = $last_day; } break; case _IS_SUNDAY: default: $pc_array_pos = 0; $first_day = date('w', mktime(0, 0, 0, $the_month, 1, $the_year)); $week_day = date('w', mktime(0, 0, 0, $the_month, $the_day, $the_year)); $end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year)); if ($end_dow != 6) { $the_last_day = $last_day + (6 - $end_dow); } else { $the_last_day = $last_day; } break; } // passing the times array to the tpl the times array is for the days schedule $tpl->assign_by_ref("times", $times); // load the table width to the template // $tpl->assign("day_td_width",$GLOBALS['day_view_td_width']); //================================================================= // Week View is a bit of a pain in the ass, so we need to // do some extra setup for that view. This section will // find the correct starting and ending dates for a given // seven day period, based on the day of the week the // calendar is setup to run under (Sunday, Saturday, Monday) //================================================================= $first_day_of_week = sprintf('%02d', $the_day - $week_day); $week_first_day = date('m/d/Y', mktime(0, 0, 0, $the_month, $first_day_of_week, $the_year)); list($week_first_day_month, $week_first_day_date, $week_first_day_year) = explode('/', $week_first_day); $week_first_day_month_name = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getmonthname', array('Date' => mktime(0, 0, 0, $week_first_day_month, $week_first_day_date, $week_first_day_year))); $week_last_day = date('m/d/Y', mktime(0, 0, 0, $the_month, $first_day_of_week + 6, $the_year)); list($week_last_day_month, $week_last_day_date, $week_last_day_year) = explode('/', $week_last_day); $week_last_day_month_name = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getmonthname', array('Date' => mktime(0, 0, 0, $week_last_day_month, $week_last_day_date, $week_last_day_year))); $week_view_start = date('Y-m-d', mktime(0, 0, 0, $the_month, $first_day_of_week, $the_year)); $week_view_end = date('Y-m-d', mktime(0, 0, 0, $the_month, $first_day_of_week + 6, $the_year)); //================================================================= // Setup some information so we know the actual month's dates // also get today's date for later use and highlighting //================================================================= $month_view_start = date('Y-m-d', mktime(0, 0, 0, $the_month, 1, $the_year)); $month_view_end = date('Y-m-t', mktime(0, 0, 0, $the_month, 1, $the_year)); $today_date = postcalendar_today('%Y-%m-%d'); //================================================================= // Setup the starting and ending date ranges for pcGetEvents() //================================================================= switch ($viewtype) { case 'day': $starting_date = date('m/d/Y', mktime(0, 0, 0, $the_month, $the_day, $the_year)); $ending_date = date('m/d/Y', mktime(0, 0, 0, $the_month, $the_day, $the_year)); break; case 'week': $starting_date = "{$week_first_day_month}/{$week_first_day_date}/{$week_first_day_year}"; $ending_date = "{$week_last_day_month}/{$week_last_day_date}/{$week_last_day_year}"; $calendarView = Date_Calc::getCalendarWeek($week_first_day_date, $week_first_day_month, $week_first_day_year, '%Y-%m-%d'); break; case 'month': $starting_date = date('m/d/Y', mktime(0, 0, 0, $the_month, 1 - $first_day, $the_year)); $ending_date = date('m/d/Y', mktime(0, 0, 0, $the_month, $the_last_day, $the_year)); $calendarView = Date_Calc::getCalendarMonth($the_month, $the_year, '%Y-%m-%d'); break; case 'year': $starting_date = date('m/d/Y', mktime(0, 0, 0, 1, 1, $the_year)); $ending_date = date('m/d/Y', mktime(0, 0, 0, 1, 1, $the_year + 1)); $calendarView = Date_Calc::getCalendarYear($the_year, '%Y-%m-%d'); break; } //================================================================= // Identify the Providers whose schedules we should load //================================================================= //================================== //FACILITY FILTERING (CHEMED) if ($_SESSION['pc_facility']) { $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); } else { $provinfo = getProviderInfo(); } //EOS FACILITY FILTERING (CHEMED) //================================== $single = array(); $provIDs = array(); // array of numeric provider IDs // filter the display on the requested username, the provinfo array is // used to build columns in the week view. foreach ($provinfo as $provider) { if (is_array($pc_username)) { foreach ($pc_username as $uname) { if (!empty($pc_username) && $provider['username'] == $uname) { array_push($single, $provider); array_push($provIDs, $provider['id']); } } } else { if (!empty($pc_username) && $provider['username'] == $pc_username) { array_push($single, $provider); array_push($provIDs, $provider['id']); } } } if ($single != null) { $provinfo = $single; } //================================================================= // Load the events //================================================================= if ($viewtype != 'year') { $eventsByDate =& postcalendar_userapi_pcGetEvents(array('start' => $starting_date, 'end' => $ending_date, 'viewtype' => $viewtype, 'provider_id' => $provIDs)); } else { $eventsByDate = array(); } //================================================================= // Create an array with the day names in the correct order //================================================================= $daynames = array(); $numDays = count($pc_long_day_names); for ($i = 0; $i < $numDays; $i++) { if ($pc_array_pos >= $numDays) { $pc_array_pos = 0; } array_push($daynames, $pc_long_day_names[$pc_array_pos]); $pc_array_pos++; } unset($numDays); $sdaynames = array(); $numDays = count($pc_short_day_names); for ($i = 0; $i < $numDays; $i++) { if ($pc_array_pos >= $numDays) { $pc_array_pos = 0; } array_push($sdaynames, $pc_short_day_names[$pc_array_pos]); $pc_array_pos++; } unset($numDays); //================================================================= // Prepare some values for the template //================================================================= $prev_month = Date_Calc::beginOfPrevMonth(1, $the_month, $the_year, '%Y%m%d'); $next_month = Date_Calc::beginOfNextMonth(1, $the_month, $the_year, '%Y%m%d'); $pc_prev = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $prev_month, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); $pc_next = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $next_month, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); $prev_day = Date_Calc::prevDay($the_day, $the_month, $the_year, '%Y%m%d'); $next_day = Date_Calc::nextDay($the_day, $the_month, $the_year, '%Y%m%d'); $pc_prev_day = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $prev_day, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); $pc_next_day = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $next_day, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); $prev_week = date('Ymd', mktime(0, 0, 0, $week_first_day_month, $week_first_day_date - 7, $week_first_day_year)); $next_week = date('Ymd', mktime(0, 0, 0, $week_last_day_month, $week_last_day_date + 1, $week_last_day_year)); $pc_prev_week = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'week', 'Date' => $prev_week, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); $pc_next_week = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'week', 'Date' => $next_week, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); $prev_year = date('Ymd', mktime(0, 0, 0, 1, 1, $the_year - 1)); $next_year = date('Ymd', mktime(0, 0, 0, 1, 1, $the_year + 1)); $pc_prev_year = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'year', 'Date' => $prev_year, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); $pc_next_year = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'year', 'Date' => $next_year, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic)); //================================================================= // Populate the template //================================================================= $all_categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories'); if (isset($calendarView)) { $tpl->assign_by_ref('CAL_FORMAT', $calendarView); } if ($viewtype == "week") { $last_blocks = array(); foreach ($eventsByDate as $cdate => $day) { $tblock = array_reverse($day['blocks']); $last_blocks[$cdate] = count($tblock) - 1; for ($i = 0; $i < count($tblock); $i++) { if (!empty($tblock[$i])) { $last_blocks[$cdate] = count($tblock) - $i; break; } } } $tpl->assign("last_blocks", $last_blocks); } $tpl->assign('STYLE', $GLOBALS['style']); $tpl->assign('show_days', $show_days); //$provinfo[count($provinfo) +1] = array("id" => "","lname" => "Other"); $tpl->assign_by_ref('providers', $provinfo); if (pnVarCleanFromInput("show_days") != 1) { $tpl->assign('showdaysurl', "index.php?" . $_SERVER['QUERY_STRING'] . "&show_days=1"); } $tpl->assign('interval', $GLOBALS['calendar_interval']); $tpl->assign_by_ref('VIEW_TYPE', $viewtype); $tpl->assign_by_ref('A_MONTH_NAMES', $pc_month_names); $tpl->assign_by_ref('A_LONG_DAY_NAMES', $pc_long_day_names); $tpl->assign_by_ref('A_SHORT_DAY_NAMES', $pc_short_day_names); $tpl->assign_by_ref('S_LONG_DAY_NAMES', $daynames); $tpl->assign_by_ref('S_SHORT_DAY_NAMES', $sdaynames); $tpl->assign_by_ref('A_EVENTS', $eventsByDate); $tpl->assign_by_ref('A_CATEGORY', $all_categories); $tpl->assign_by_ref('PREV_MONTH_URL', $pc_prev); $tpl->assign_by_ref('NEXT_MONTH_URL', $pc_next); $tpl->assign_by_ref('PREV_DAY_URL', $pc_prev_day); $tpl->assign_by_ref('NEXT_DAY_URL', $pc_next_day); $tpl->assign_by_ref('PREV_WEEK_URL', $pc_prev_week); $tpl->assign_by_ref('NEXT_WEEK_URL', $pc_next_week); $tpl->assign_by_ref('PREV_YEAR_URL', $pc_prev_year); $tpl->assign_by_ref('NEXT_YEAR_URL', $pc_next_year); $tpl->assign_by_ref('WEEK_START_DATE', $week_view_start); $tpl->assign_by_ref('WEEK_END_DATE', $week_view_end); $tpl->assign_by_ref('MONTH_START_DATE', $month_view_start); $tpl->assign_by_ref('MONTH_END_DATE', $month_view_end); $tpl->assign_by_ref('TODAY_DATE', $today_date); $tpl->assign_by_ref('DATE', $Date); $tpl->assign('SCHEDULE_BASE_URL', pnModURL(__POSTCALENDAR__, 'user', 'submit')); $tpl->assign_by_ref('intervals', $intervals); } //================================================================= // Parse the template //================================================================= $template = "{$template_name}/views/{$viewtype}/{$template_view_load}.html"; if (!$print) { $output .= "\n\n<!-- START POSTCALENDAR OUTPUT [-: HTTP://POSTCALENDAR.TV :-] -->\n\n"; $output .= $tpl->fetch($template, $cacheid); // cache id $output .= "\n\n<!-- END POSTCALENDAR OUTPUT [-: HTTP://POSTCALENDAR.TV :-] -->\n\n"; } else { $theme = pnUserGetTheme(); echo "<html><head>"; echo "<LINK REL=\"StyleSheet\" HREF=\"themes/{$theme}/style/styleNN.css\" TYPE=\"text/css\">\n\n\n"; echo "<style type=\"text/css\">\n"; echo "@import url(\"themes/{$theme}/style/style.css\"); "; echo "</style>\n"; echo "</head><body>\n"; echo $output; $tpl->display($template, $cacheid); echo postcalendar_footer(); echo "\n</body></html>"; session_write_close(); exit; } //================================================================= // Return the output //================================================================= return $output; }
/** * $Id$ * * PostCalendar::PostNuke Events Calendar Module * Copyright (C) 2002 The PostCalendar Team * http://postcalendar.tv * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * To read the license please read the docs/license.txt or visit * http://www.gnu.org/copyleft/gpl.html * */ function smarty_function_pc_filter($args, &$smarty) { extract($args); unset($args); if (empty($type)) { $smarty->trigger_error("pc_filter: missing 'type' parameter"); return; } $Date = postcalendar_getDate(); if (!isset($y)) { $y = substr($Date, 0, 4); } if (!isset($m)) { $m = substr($Date, 4, 2); } if (!isset($d)) { $d = substr($Date, 6, 2); } $tplview = pnVarCleanFromInput('tplview'); $viewtype = pnVarCleanFromInput('viewtype'); $pc_username = pnVarCleanFromInput('pc_username'); if (!isset($viewtype)) { $viewtype = _SETTING_DEFAULT_VIEW; } $types = explode(',', $type); $output = new pnHTML(); $output->SetOutputMode(_PNH_RETURNOUTPUT); $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $mdir = pnVarPrepForOS($modinfo['directory']); unset($modinfo); $pcTemplate = pnVarPrepForOS(_SETTING_TEMPLATE); if (empty($pcTemplate)) { $pcTemplate = 'default'; } list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); //================================================================ // build the username filter pulldown //================================================================ if (in_array('user', $types)) { @define('_PC_FORM_USERNAME', true); $sql = "SELECT DISTINCT users.username, users.lname, users.fname\n\t \t\t\tFROM {$pntable['postcalendar_events']}, users where users.id=pc_aid\n\t\t\t\tORDER BY pc_aid"; $result = $dbconn->Execute($sql); if ($result !== false) { $useroptions = "<select multiple='multiple' size='3' name=\"pc_username[]\" class=\"{$class}\">"; $useroptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_USERS . "</option>"; $selected = $pc_username == '__PC_ALL__' ? 'selected="selected"' : ''; $useroptions .= "<option value=\"__PC_ALL__\" class=\"{$class}\" {$selected}>" . _PC_FILTER_USERS_ALL . "</option>"; for (; !$result->EOF; $result->MoveNext()) { $sel = $pc_username == $result->fields[0] ? 'selected="selected"' : ''; $useroptions .= "<option value=\"" . $result->fields[0] . "\" {$sel} class=\"{$class}\">" . $result->fields[1] . ", " . $result->fields[2] . "</option>"; } $useroptions .= '</select>'; $result->Close(); } } //================================================================ // build the category filter pulldown //================================================================ if (in_array('category', $types)) { @define('_PC_FORM_CATEGORY', true); $category = pnVarCleanFromInput('pc_category'); $categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories'); $catoptions = "<select name=\"pc_category\" class=\"{$class}\">"; $catoptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_CATEGORY . "</option>"; foreach ($categories as $c) { $sel = $category == $c['id'] ? 'selected="selected"' : ''; $catoptions .= "<option value=\"{$c['id']}\" {$sel} class=\"{$class}\">" . xl_appt_category($c[name]) . "</option>"; } $catoptions .= '</select>'; } //================================================================ // build the topic filter pulldown //================================================================ if (in_array('topic', $types) && _SETTING_DISPLAY_TOPICS) { @define('_PC_FORM_TOPIC', true); $topic = pnVarCleanFromInput('pc_topic'); $topics = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getTopics'); $topoptions = "<select name=\"pc_topic\" class=\"{$class}\">"; $topoptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_TOPIC . "</option>"; foreach ($topics as $t) { $sel = $topic == $t['id'] ? 'selected="selected"' : ''; $topoptions .= "<option value=\"{$t['id']}\" {$sel} class=\"{$class}\">{$t['text']}</option>"; } $topoptions .= '</select>'; } else { $topoptions = ''; } //================================================================ // build it in the correct order //================================================================ if (!isset($label)) { $label = _PC_TPL_VIEW_SUBMIT; } $submit = "<input type=\"submit\" valign=\"middle\" name=\"submit\" value=\"{$label}\" class=\"{$class}\" />"; $orderArray = array('user' => $useroptions, 'category' => $catoptions, 'topic' => $topoptions, 'jump' => $submit); if (isset($order)) { $newOrder = array(); $order = explode(',', $order); foreach ($order as $tmp_order) { array_push($newOrder, $orderArray[$tmp_order]); } foreach ($orderArray as $key => $old_order) { if (!in_array($key, $newOrder)) { array_push($newOrder, $orderArray[$old_order]); } } $order = $newOrder; } else { $order = $orderArray; } foreach ($order as $element) { echo $element; } if (!in_array('user', $types)) { echo $output->FormHidden('pc_username', $pc_username); } }
/** * load all blocks */ function pnBlockLoadAll() { // Load core and old-style blocks global $blocks_modules; $dib = opendir('includes/blocks/'); while ($f = readdir($dib)) { if (preg_match('/\\.php$/', $f)) { $block = preg_replace('/\\.php$/', '', $f); if (!pnBlockLoad('Core', $block)) { // Block load failed return false; } if (!isset($blocks_modules[$block]['module'])) { $blocks_modules[$block]['bkey'] = $block; $blocks_modules[$block]['module'] = 'Core'; $blocks_modules[$block]['mid'] = 0; } } } closedir($dib); // Load new-style blocks list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); $modulestable = $pntable['modules']; $modulescolumn =& $pntable['modules_column']; $sql = "SELECT {$modulescolumn['name']},\n {$modulescolumn['directory']},\n {$modulescolumn['id']}\n FROM {$modulestable}"; $result = $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { return; } while (list($name, $directory, $mid) = $result->fields) { $result->MoveNext(); $blockdir = 'modules/' . pnVarPrepForOS($directory) . '/pnblocks'; if (!@is_dir($blockdir)) { continue; } $dib = opendir($blockdir); while ($f = readdir($dib)) { if (preg_match('/\\.php$/', $f)) { $block = preg_replace('/\\.php$/', '', $f); if (!pnBlockLoad($name, $block)) { // Block load failed return false; } // Get info on the block $usname = preg_replace('/ /', '_', $name); $infofunc = $usname . '_' . $block . 'block_info'; if (function_exists($infofunc)) { $blocks_modules["{$name}{$block}"] = $infofunc(); if (!isset($blocks_modules["{$name}{$block}"]['module'])) { $blocks_modules["{$name}{$block}"]['module'] = $name; } $blocks_modules["{$name}{$block}"]['bkey'] = $block; $blocks_modules["{$name}{$block}"]['mid'] = $mid; } else { // Might be old-style block in new place - sigh if (!empty($blocks_modules[$block])) { $blocks_modules["{$name}{$block}"] = $blocks_modules[$block]; unset($blocks_modules[$block]); if (!isset($blocks_modules["{$name}{$block}"]['module'])) { $blocks_modules["{$name}{$block}"]['module'] = $name; } $blocks_modules["{$name}{$block}"]['bkey'] = $block; $blocks_modules["{$name}{$block}"]['mid'] = $mid; } } } } } $result->Close(); // Return information gathered return $blocks_modules; }
/** * $Id$ * * PostCalendar::PostNuke Events Calendar Module * Copyright (C) 2002 The PostCalendar Team * http://postcalendar.tv * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * To read the license please read the docs/license.txt or visit * http://www.gnu.org/copyleft/gpl.html * */ function smarty_function_pc_url($args) { //print "<br />args<br />"; //print_r($args); //print "<br />args<br />"; extract($args); unset($args); if (!isset($action)) { $action = _SETTING_DEFAULT_VIEW; } if (empty($print)) { $print = false; } else { $print = true; } $starth = ""; if ($setdeftime == 1) { $starth = date("H"); } $ampm = 1; if ($starth >= 12) { $ampm = 2; } $template_view = pnVarCleanFromInput('tplview'); $viewtype = strtolower(pnVarCleanFromInput('viewtype')); // pnVarCleanFromInput('pc_username'); //(CHEMED) replaced by the code below //(CHEMED) Facility filtering $pc_username = $_SESSION['pc_username']; $pc_facility = $_SESSION['pc_facility']; //END (CHEMED) $category = pnVarCleanFromInput('pc_category'); $topic = pnVarCleanFromInput('pc_topic'); $popup = pnVarCleanFromInput('popup'); if (!isset($date)) { $Date = postcalendar_getDate(); } else { $Date = $date; } // some extra cleanup if necessary $Date = str_replace('-', '', $Date); $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $pcDir = pnVarPrepForOS($pcModInfo['directory']); switch ($action) { case 'submit': if (!empty($starth)) { $link = pnModURL(__POSTCALENDAR__, 'user', 'submit', array('tplview' => $template_view, 'Date' => $Date, 'event_starttimeh' => $starth, 'event_startampm' => $ampm)); } else { $link = pnModURL(__POSTCALENDAR__, 'user', 'submit', array('tplview' => $template_view, 'Date' => $Date)); } break; case 'submit-admin': $link = pnModURL(__POSTCALENDAR__, 'admin', 'submit', array('tplview' => $template_view, 'Date' => $Date)); break; case 'search': $link = pnModURL(__POSTCALENDAR__, 'user', 'search'); break; case 'day': $link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print), $localpath); break; case 'week': $link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'week', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print)); break; case 'month': $link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print)); break; case 'year': $link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'year', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print)); break; case 'detail': if (isset($eid)) { if (_SETTING_OPEN_NEW_WINDOW && !$popup) { $link = "javascript:opencal({$eid},'{$Date}');"; } else { $link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('Date' => $Date, 'tplview' => $template_view, 'viewtype' => 'details', 'eid' => $eid, 'print' => $print), $localpath); } } else { $link = ''; } break; } if ($print) { $link .= '" target="_blank"'; } elseif (_SETTING_OPEN_NEW_WINDOW && $viewtype == 'details') { $link .= '" target="csCalendar"'; } echo $link; }
function user_dynamic_data() { list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); $currentlangfile = 'language/' . pnVarPrepForOS(pnUserGetLang()) . '/user.php'; $defaultlangfile = 'language/' . pnVarPrepForOS(pnConfigGetVar('language')) . '/user.php'; if (file_exists($currentlangfile)) { include $currentlangfile; } elseif (file_exists($defaultlangfile)) { include $defaultlangfile; } include "header.php"; GraphicAdmin(); OpenTable(); echo "<center><font class=\"pn-title\"><b>" . _USERADMIN . "</b></font></center>"; CloseTable(); // This section displays the dynamic fields // and the order in which they are displayed OpenTable(); print '<center><font size="3" class="pn-title"><b>' . _DYNAMICDATA . '</b></font></center><br>' . '<table class=\'pn-normal\' border=\'1\' width=\'100%\'>' . '<tr>' . '<th>' . _FIELDACTIVE . '</th>' . '<th colspan=\'2\'>' . _FIELDLABEL . '</th>' . '<th>' . _FIELDWEIGHT . '</th>' . '<th>' . _FIELDTYPE . '</th>' . '<th>' . _FIELDLENGTH . '</th>' . '<th>' . _DELETE . '</th>' . '</tr>'; $column =& $pntable['user_property_column']; $result = $dbconn->Execute("SELECT {$column['prop_id']}, {$column['prop_label']},{$column['prop_dtype']},\n {$column['prop_length']}, {$column['prop_weight']}, {$column['prop_validation']}\n FROM {$pntable['user_property']} ORDER BY {$column['prop_weight']}"); if ($dbconn->ErrorNo() != 0) { echo $dbconn->ErrorNo() . "List User Properties: " . $dbconn->ErrorMsg() . "<br>"; error_log($dbconn->ErrorNo() . "List User Properties: " . $dbconn->ErrorMsg() . "<br>"); return; } $active_count = 0; $true_count = 0; $total_count = $result->PO_RecordCount(); $prop_weight = 0; while (list($prop_id, $prop_label, $prop_dtype, $prop_length, $prop_weight, $prop_validation) = $result->fields) { $result->MoveNext(); $true_count++; if ($prop_weight != 0) { $active_count++; $next_prop_weight = $active_count + 1; } $eval_cmd = "\$prop_label_text={$prop_label};"; @eval($eval_cmd); // display the proper icom and link to enable or disable the field switch (true) { // Mandatory Images can't be disabled case $prop_dtype == _UDCONST_MANDATORY: $img_cmd = '<img src="images/global/green_dot.gif" border=0 ALT="' . _FIELD_REQUIRED . '">'; break; case $prop_weight != 0: $img_cmd = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&op=deactivate_property&property={$prop_id}&weight={$prop_weight}\">" . '<img src="images/global/green_dot.gif" border=0 ALT="' . _FIELD_DEACTIVATE . '">' . '</a>'; break; default: $img_cmd = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&op=activate_property&property={$prop_id}&weight={$prop_weight}\">" . '<img src="images/global/red_dot.gif" border=0 ALT="' . _FIELD_ACTIVATE . '">' . '</a>'; } switch ($prop_dtype) { case _UDCONST_MANDATORY: $data_type_text = _UDT_MANDATORY; $data_length_text = _FIELD_NA; break; case _UDCONST_CORE: $data_type_text = _UDT_CORE; $data_length_text = _FIELD_NA; break; case _UDCONST_STRING: $data_type_text = _UDT_STRING; $data_length_text = $prop_length; break; case _UDCONST_TEXT: $data_type_text = _UDT_TEXT; $data_length_text = _FIELD_NA; break; case _UDCONST_FLOAT: $data_type_text = _UDT_FLOAT; $data_length_text = _FIELD_NA; break; case _UDCONST_INTEGER: $data_type_text = _UDT_INTEGER; $data_length_text = _FIELD_NA; break; default: $data_length_text = ""; $data_type_text = ""; } switch (true) { case $active_count == 0: $arrows = " "; break; case $active_count == 1: $arrows = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&op=increase_weight&property={$prop_id}&weight={$prop_weight}\">" . '<img src="images/global/down.gif" alt="' . _DOWN . '" border="0">' . '</a>'; break; case $true_count == $total_count: $arrows = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&op=decrease_weight&property={$prop_id}&weight={$prop_weight}\">" . '<img src="images/global/up.gif" alt="' . _UP . '" border="0">' . '</a>'; break; default: $arrows = '<img src="images/global/up.gif" alt="' . _UP . '"> <img src="images/global/down.gif" alt="' . _DOWN . '">'; $arrows = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&op=decrease_weight&property={$prop_id}&weight={$prop_weight}\">" . '<img src="images/global/up.gif" border="0" alt="' . _UP . '">' . '</a> ' . "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&op=increase_weight&property={$prop_id}&weight={$prop_weight}\">" . '<img src="images/global/down.gif" border="0" alt="' . _DOWN . '">' . '</a>'; } if ($prop_dtype == _UDCONST_MANDATORY || $prop_dtype == _UDCONST_CORE) { $del_text = _FIELD_NA; } else { $del_text = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&op=delete_property&property={$prop_id}\">" . _DELETE . '</a>'; } // .'<img src=\'images/global/green_dot.gif\'>' print '<tr><td width=\'5%\' align=\'center\'>' . "{$img_cmd}" . '</td>' . '<td width=\'12%\'>' . $prop_label . '</td>' . '<td width=\'12%\'>' . $prop_label_text . '</td>' . '<td width=\'10%\' align=\'center\'>' . $arrows . '</td>' . '<td width=\'15%\' align=\'center\'>' . $data_type_text . '</td>' . '<td width=\'10%\' align=\'center\'>' . $data_length_text . '</td>' . '<td width=\'10%\' align=\'center\'>' . $del_text . '</td>' . '</tr>'; } print '</table>'; CloseTable(); print "<br>"; OpenTable(); print '<center><font size="3" class="pn-title"><b>' . _ADDFIELD . '</b></font></center><br>' . '<form action="admin.php" method="post">' . '<table class=\'pn-normal\'>' . '<tr>' . '<th align=\'left\'>' . _FIELDLABEL . ':</th>' . '<td>' . '<input type="text" name="label" value="" size="20" maxlength="20" class="pn-normal">' . ' ' . _ADDINSTRUCTIONS . '</td>' . '</tr>' . '<tr>' . '<th align=\'left\'>' . _FIELDTYPE . ':</th>' . '<td>' . '<select name="dtype" class="pn-normal">' . '<option value="' . _UDCONST_STRING . '">' . _UDT_STRING . '</option>' . "\n" . '<option value="' . _UDCONST_TEXT . '">' . _UDT_TEXT . '</option>' . "\n" . '<option value="' . _UDCONST_FLOAT . '">' . _UDT_FLOAT . '</option>' . "\n" . '<option value="' . _UDCONST_INTEGER . '">' . _UDT_INTEGER . '</option>' . "\n" . '</select>' . '</td>' . '</tr>' . '<tr>' . '<th align=\'left\'>' . _FIELDLENGTH . ':</th>' . '<td>' . '<input type="text" name="prop_len" value="" size="3" maxlength="3" class="pn-normal">' . ' ' . _STRING_INSTRUCTIONS . '</td>' . '</tr>' . '<tr><td></td><td>' . "<input type=\"hidden\" name=\"module\" value=\"" . $GLOBALS['module'] . "\">" . "<input type=\"hidden\" name=\"op\" value=\"addDynamic\">" . "<input type=\"submit\" value=\"" . _SUBMIT . "\">" . '</td></tr>' . '</table>' . '<input type="hidden" name="prop_weight" value="' . $next_prop_weight . '">' . '<input type="hidden" name="validation" value="">' . "<input type=\"hidden\" name=\"authid\" value=\"" . pnSecGenAuthKey() . "\">" . '<input type="hidden" name="op" value="add_property">' . '</form>'; CloseTable(); include "footer.php"; }
$pnRender =& new pnRender($modinfo['name']); $pnRender->assign($return); if (isset($return['template'])) { echo $pnRender->fetch($return['template']); } else { $modname = strtolower($modinfo['name']); $type = strtolower($type); $func = strtolower($func); echo $pnRender->fetch("{$modname}_{$type}_{$func}.htm"); } } else { echo 'Function <em>' . pnVarPrepForDisplay($func) . '</em> in module <em>' . pnVarPrepForDisplay($module) . '</em> returned.'; } include_once 'footer.php'; } } else { // Old-old style of loading modules if (empty($file)) { $file = 'index'; } define('LOADED_AS_MODULE', '1'); if (file_exists('modules/' . pnVarPrepForOS($modinfo['directory']) . '/' . pnVarPrepForOS($file) . '.php')) { include 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/' . pnVarPrepForOS($file) . '.php'; } else { // Failed to load the module header('HTTP/1.0 404 Not Found'); include 'header.php'; echo 'Failed to load module <strong>' . pnVarPrepForDisplay($modinfo['name']) . '</strong>'; include 'footer.php'; } }
/** * Checks which path to use for required template * * @param string $template */ function get_template_path($template) { // the current module $pnmodgetname = pnModGetName(); // get the module path to templates $module = $this->module; $modinfo = pnModGetInfo(pnModGetIDFromName($module)); // get the theme path to templates $theme = pnUserGetTheme(); // prepare the values for OS $os_pnmodgetname = pnVarPrepForOS($pnmodgetname); $os_module = pnVarPrepForOS($module); $os_modpath = pnVarPrepForOS($modinfo['directory']); $os_theme = pnVarPrepForOS($theme); // Define the locations in which we will look for templates // (in this order) // Note: Paths 1, 3, 5 - This allows for the hook or block functions // (such as ratings and comments) to use different templates depending // on the top level module. e.g. the comments dialog can be different // for news and polls... // They are only evaluated when the calling module is not the current one. // // 1. The top level module directory in the requested module folder // in the theme directory. $themehookpath = "themes/{$theme}/templates/modules/{$module}/{$pnmodgetname}"; // 2. The module directory in the current theme. $themepath = "themes/{$theme}/templates/modules/{$module}"; // 3. The top level module directory in the requested module folder // in the modules sub folder. $modhookpath = "modules/{$modinfo['directory']}/pntemplates/{$pnmodgetname}"; // 4. The module directory in the modules sub folder. $modpath = "modules/{$modinfo['directory']}/pntemplates"; // 5. The top level module directory in the requested module folder // in the system sub folder. $syshookpath = "system/{$modinfo['directory']}/pntemplates/{$pnmodgetname}"; // 6. The module directory in the system sub folder. $syspath = "system/{$modinfo['directory']}/pntemplates"; $ostemplate = pnVarPrepForOS($template); //.'.htm'; // check the module for which we're looking for a template is the // same as the top level mods. This limits the places to look for // templates. if ($module == $pnmodgetname) { $search_path = array($themepath, $modpath, $syspath); } else { $search_path = array($themehookpath, $themepath, $modhookpath, $modpath, $syshookpath, $syspath); } foreach ($search_path as $path) { if (file_exists("{$path}/{$ostemplate}") && is_readable("{$path}/{$ostemplate}")) { return $path; } } // when we arrive here, no path was found return false; }
* GNU General Public License for more details. * * To read the license please visit http://www.gnu.org/copyleft/gpl.html * ---------------------------------------------------------------------- * Original Author of file: larsneo * Purpose of file: Error Handling * Usage: Set up the redirection in your .htaccess with * ErrorDocument 404 http://www.yoursite.com/error.php * Note: REDIRECT_URL won't be available but * due to subfolders one can't use a relative path :-/ * ---------------------------------------------------------------------- **/ include_once 'includes/pnAPI.php'; pnInit(); $currentlang = pnUserGetLang(); $currentlang = pnVarPrepForOS($currentlang); if (file_exists("language/{$currentlang}/error.php")) { include "language/{$currentlang}/error.php"; } elseif (file_exists("language/eng/error.php")) { include "language/eng/error.php"; } $reportlevel = pnConfigGetVar('reportlevel'); $funtext = pnConfigGetVar('funtext'); header('HTTP/1.1 404 Not Found'); include 'header.php'; if ($funtext == 0) { echo "<h2>" . _ERROR404_HEAD . "</h2>\n" . "<br /><br />\n" . "<strong>" . _ERROR404_TRY . "</strong><br />\n" . _ERROR404_TRY1 . "<br />\n" . "<a href=\"index.php\">" . _ERROR404_TRY2 . "</a><br />\n" . _ERROR404_TRY3 . "<br />\n" . _ERROR404_TRY4 . "\n"; if (pnModAvailable('Search')) { echo '<br /><a href="' . pnVarPrepForDisplay(pnModURL('Search')) . '">' . _ERROR404_TRY5 . "</a>\n"; } } else {
// ---------------------------------------------------------------------- /** * Function to display banners in all pages */ if (!function_exists('pnInit')) { include 'includes/pnAPI.php'; pnInit(); include 'includes/legacy.php'; // eugenio themeover 20020413 // pnThemeLoad(); } /** * Load lang file */ if (file_exists("language/" . pnVarPrepForOS(pnUserGetLang()) . "/banners.php")) { include "language/" . pnVarPrepForOS(pnUserGetLang()) . "/banners.php"; } elseif (file_exists("language/eng/banners.php")) { include "language/eng/banners.php"; } /** * Function to redirect the clicks to the * correct url and add 1 click */ function clickbanner() { list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); $bid = pnVarCleanFromInput('bid'); $column =& $pntable['banner_column']; $bresult = $dbconn->Execute("SELECT {$column['clickurl']}\n FROM {$pntable['banner']}\n WHERE {$column['bid']}='" . pnVarPrepForStore($bid) . "'"); list($clickurl) = $bresult->fields;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * To read the license please read the docs/license.txt or visit * http://www.gnu.org/copyleft/gpl.html * */ //========================================================================= // Require utility classes //========================================================================= $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $pcDir = pnVarPrepForOS($pcModInfo['directory']); require_once "modules/{$pcDir}/common.api.php"; unset($pcModInfo, $pcDir); function postcalendar_adminapi_buildHourSelect($args) { extract($args); $time24hours = pnModGetVar(__POSTCALENDAR__, 'time24hours'); if (!isset($hour)) { $hour = $time24hours ? date('H') : date('h'); } $output = new pnHTML(); $output->SetInputMode(_PNH_VERBATIMINPUT); $options = array(); if ($time24hours) { for ($i = 0; $i < 24; $i++) { $sel = false;
function draw_menu() { global $hlpfile; $currentlang = pnVarCleanFromInput('currentlang'); OpenTable(); echo '<center>' . "\n"; if (count($this->options) == 0) { $this->title_file = ''; } if ($this->title_file != '') { echo '<a href="' . $this->title_file . '" class="pn-title">'; } echo '<font class="pn-title"><b>' . pnVarPrepForDisplay($this->title_text) . '</b></font>'; if ($this->title_file != '') { echo '</a></center>'; } echo "\n" . '<br>' . "\n"; // if (($this->detail_menu) or ($GLOBALS['module']=='oldway')) // { // if (isset($this->help_file)) // { $currentlang = pnUserGetLang(); // fixed bug [ #357 ] empty pop up window if (file_exists($file = "modules/" . $GLOBALS['module'] . "/lang/" . pnVarPrepForOS($currentlang) . "/manual.html")) { $hlpfile = $file; echo '<center>[ <a href="javascript:openwindow(' . ')" class="pn-normal">' . _ONLINEMANUAL . '</a> ]' . "</center>\n"; } // } // } if ($this->detail_menu) { if (count($this->options) == 0) { echo _ADMIN_NO_OPTION . "\n"; } else { echo '<br><br>' . "\n" . '<table border="0" width="100%" cellspacing="1">' . "\n"; if ($this->graphic_menu) { $this->draw_options_graphic(); } else { $this->draw_options(); } echo '</table>' . "\n"; } } CloseTable(); }
/** * display block */ function postcalendar_calendarblock_display($blockinfo) { // You supposed to be here? if (!pnSecAuthAction(0, 'PostCalendar:calendarblock:', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) { return false; } // find out what view we're using $template_view = pnVarCleanFromInput('tplview'); if (!isset($template_view)) { $template_view = 'default'; } // find out what template we're using $template_name = _SETTING_TEMPLATE; if (!isset($template_name) || empty($template_name)) { $template_name = 'default'; } // What is today's correct date $Date =& postcalendar_getDate(); // Get variables from content block $vars = unserialize($blockinfo['content']); $showcalendar = $vars['pcbshowcalendar']; $showevents = $vars['pcbeventoverview']; $eventslimit = $vars['pcbeventslimit']; $nextevents = $vars['pcbnextevents']; $pcbshowsslinks = $vars['pcbshowsslinks']; $pcbeventsrange = $vars['pcbeventsrange']; // Let's setup the info to build this sucka! $the_year = substr($Date, 0, 4); $the_month = substr($Date, 4, 2); $the_day = substr($Date, 6, 2); $uid = pnUserGetVar('uid'); $cacheid1 = $cacheid2 = $cacheid3 = ''; $theme = pnUserGetTheme(); pnThemeLoad($theme); global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5; global $textcolor1, $textcolor2; // 20021125 - rraymond :: we have to do this to make it work with envolution $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $pcDir = pnVarPrepForOS($pcModInfo['directory']); require_once "modules/{$pcDir}/pnincludes/Smarty/Config_File.class.php"; unset($pcModInfo); // set up Smarty $tpl =& new pcSmarty(); // setup the Smarty cache id $templates_cached = true; if ($showcalendar) { $cacheid1 = md5($Date . 'M' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme); if (!$tpl->is_cached($template_name . '/views/calendarblock/month_view.html', $cacheid1)) { $templates_cached = false; } } if ($showevents) { $cacheid2 = md5($Date . 'T' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme); if (!$tpl->is_cached($template_name . '/views/calendarblock/todays_events.html', $cacheid2)) { $templates_cached = false; } } if ($nextevents) { $cacheid3 = md5($Date . 'U' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme); if (!$tpl->is_cached($template_name . '/views/calendarblock/upcoming_events.html', $cacheid3)) { $templates_cached = false; } } // start the output container $output = pnModAPIFunc(__POSTCALENDAR__, 'user', 'pageSetup'); // if one of the templates is not cached, we need to run the following if (!$templates_cached) { // set up the next and previous months to move to $prev_month = Date_Calc::beginOfPrevMonth(1, $the_month, $the_year, '%Y%m%d'); $next_month = Date_Calc::beginOfNextMonth(1, $the_month, $the_year, '%Y%m%d'); $last_day = Date_Calc::daysInMonth($the_month, $the_year); $pc_prev = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $prev_month)); $pc_next = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $next_month)); $pc_month_name = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getmonthname', array('Date' => mktime(0, 0, 0, $the_month, $the_day, $the_year))); $month_link_url = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => date('Ymd', mktime(0, 0, 0, $the_month, 1, $the_year)))); $month_link_text = $pc_month_name . ' ' . $the_year; //******************************************************************* // Here we get the events for the current month view //******************************************************************* $day_of_week = 1; $pc_month_names = array(_CALJAN, _CALFEB, _CALMAR, _CALAPR, _CALMAY, _CALJUN, _CALJUL, _CALAUG, _CALSEP, _CALOCT, _CALNOV, _CALDEC); $pc_short_day_names = array(_CALSUNDAYSHORT, _CALMONDAYSHORT, _CALTUESDAYSHORT, _CALWEDNESDAYSHORT, _CALTHURSDAYSHORT, _CALFRIDAYSHORT, _CALSATURDAYSHORT); $pc_long_day_names = array(_CALSUNDAY, _CALMONDAY, _CALTUESDAY, _CALWEDNESDAY, _CALTHURSDAY, _CALFRIDAY, _CALSATURDAY); switch (_SETTING_FIRST_DAY_WEEK) { case _IS_MONDAY: $pc_array_pos = 1; $first_day = date('w', mktime(0, 0, 0, $the_month, 0, $the_year)); $end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year)); if ($end_dow != 0) { $the_last_day = $last_day + (7 - $end_dow); } else { $the_last_day = $last_day; } break; case _IS_SATURDAY: $pc_array_pos = 6; $first_day = date('w', mktime(0, 0, 0, $the_month, 2, $the_year)); $end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year)); if ($end_dow == 6) { $the_last_day = $last_day + 6; } elseif ($end_dow != 5) { $the_last_day = $last_day + (5 - $end_dow); } else { $the_last_day = $last_day; } break; case _IS_SUNDAY: default: $pc_array_pos = 0; $first_day = date('w', mktime(0, 0, 0, $the_month, 1, $the_year)); $end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year)); if ($end_dow != 6) { $the_last_day = $last_day + (6 - $end_dow); } else { $the_last_day = $last_day; } break; } $month_view_start = date('Y-m-d', mktime(0, 0, 0, $the_month, 1, $the_year)); $month_view_end = date('Y-m-t', mktime(0, 0, 0, $the_month, 1, $the_year)); $today_date = postcalendar_today('%Y-%m-%d'); $starting_date = date('m/d/Y', mktime(0, 0, 0, $the_month, 1 - $first_day, $the_year)); $ending_date = date('m/t/Y', mktime(0, 0, 0, $the_month + $pcbeventsrange, 1, $the_year)); $eventsByDate =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'pcGetEvents', array('start' => $starting_date, 'end' => $ending_date)); $calendarView = Date_Calc::getCalendarMonth($the_month, $the_year, '%Y-%m-%d'); $sdaynames = array(); $numDays = count($pc_short_day_names); for ($i = 0; $i < $numDays; $i++) { if ($pc_array_pos >= $numDays) { $pc_array_pos = 0; } array_push($sdaynames, $pc_short_day_names[$pc_array_pos]); $pc_array_pos++; } $daynames = array(); $numDays = count($pc_long_day_names); for ($i = 0; $i < $numDays; $i++) { if ($pc_array_pos >= $numDays) { $pc_array_pos = 0; } array_push($daynames, $pc_long_day_names[$pc_array_pos]); $pc_array_pos++; } $dates = array(); while ($starting_date <= $ending_date) { array_push($dates, $starting_date); list($m, $d, $y) = explode('/', $starting_date); $starting_date = Date_Calc::nextDay($d, $m, $y, '%m/%d/%Y'); } $categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories'); if (isset($calendarView)) { $tpl->assign_by_ref('CAL_FORMAT', $calendarView); } $tpl->assign_by_ref('A_MONTH_NAMES', $pc_month_names); $tpl->assign_by_ref('A_LONG_DAY_NAMES', $pc_long_day_names); $tpl->assign_by_ref('A_SHORT_DAY_NAMES', $pc_short_day_names); $tpl->assign_by_ref('S_LONG_DAY_NAMES', $daynames); $tpl->assign_by_ref('S_SHORT_DAY_NAMES', $sdaynames); $tpl->assign_by_ref('A_EVENTS', $eventsByDate); $tpl->assign_by_ref('A_CATEGORY', $categories); $tpl->assign_by_ref('PREV_MONTH_URL', $pc_prev); $tpl->assign_by_ref('NEXT_MONTH_URL', $pc_next); $tpl->assign_by_ref('MONTH_START_DATE', $month_view_start); $tpl->assign_by_ref('MONTH_END_DATE', $month_view_end); $tpl->assign_by_ref('TODAY_DATE', $today_date); $tpl->assign_by_ref('DATE', $Date); $tpl->assign_by_ref('DISPLAY_LIMIT', $eventslimit); $tpl->assign('TODAYS_EVENTS_TITLE', _PC_TODAYS_EVENTS); $tpl->assign('UPCOMING_EVENTS_TITLE', _PC_UPCOMING_EVENTS); $tpl->assign('NO_EVENTS', _PC_BLOCK_NO_EVENTS); } if ($showcalendar) { // we need to create a unique ID for caching purposes $output .= $tpl->fetch($template_name . '/views/calendarblock/month_view.html', $cacheid1); } if ($showevents) { if ($showcalendar) { $tpl->assign('SHOW_TITLE', 1); } else { $tpl->assign('SHOW_TITLE', 0); } // we need to create a unique ID for caching purposes $output .= $tpl->fetch($template_name . '/views/calendarblock/todays_events.html', $cacheid2); } if ($nextevents) { if ($showcalendar || $showevents) { $tpl->assign('SHOW_TITLE', 1); } else { $tpl->assign('SHOW_TITLE', 0); } // we need to create a unique ID for caching purposes $output .= $tpl->fetch($template_name . '/views/calendarblock/upcoming_events.html', $cacheid3); } if ($pcbshowsslinks) { $output .= '<br /><br />'; $submit_event_url = pnModURL(__POSTCALENDAR__, 'user', 'submit'); $search_event_url = pnModURL(__POSTCALENDAR__, 'user', 'search'); $output .= '<center>'; if (PC_ACCESS_ADD) { $output .= '[ <a href="' . $submit_event_url . '">' . _PC_SUBMIT_EVENT . '</a> ] '; } $output .= '[ <a href="' . $search_event_url . '">' . _PC_SEARCH_EVENT . '</a> ]'; $output .= '</center>'; } // Populate block info and pass to theme $blockinfo['content'] = $output; return themesideblock($blockinfo); }
/** * upgrade a module */ function modules_adminapi_upgrade($args) { // 20021216 fixed the fix : larsneo (thx to cmgrote and jojodee) // Get arguments from argument array extract($args); // Argument check if (!isset($mid) || !is_numeric($mid)) { pnSessionSetVar('errormsg', _MODARGSERROR); return false; } // Get module information $modinfo = pnModGetInfo($mid); if (empty($modinfo)) { pnSessionSetVar('errormsg', _MODNOSUCHMOD); return false; } // Get module database info pnModDBInfoLoad($modinfo['name'], $modinfo['directory']); // Module upgrade function $osdir = pnVarPrepForOS($modinfo['directory']); @(include "modules/{$osdir}/pninit.php"); $func = $modinfo['name'] . '_upgrade'; if (function_exists($func)) { if ($func($modinfo['version']) != true) { return false; } } // Update state of module if (!modules_adminapi_setstate(array('mid' => $mid, 'state' => _PNMODULE_STATE_INACTIVE))) { return false; } // BEGIN bugfix (561802) - cmgrote // Get the new version information... $modversion['version'] = '0'; @(include "modules/{$modinfo['directory']}/Version.php"); @(include "modules/{$modinfo['directory']}/pnversion.php"); $version = $modversion['version']; // Note the changes in the database... list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); $modulestable = $pntable['modules']; $modulescolumn =& $pntable['modules_column']; $sql = "UPDATE {$modulestable}\n\t\t\tSET {$modulescolumn['version']} = '" . pnVarPrepForStore($modversion['version']) . "',\n\t\t\t\t{$modulescolumn['admin_capable']} = '" . pnVarPrepForStore($modversion['admin']) . "',\n\t\t\t\t{$modulescolumn['description']} = '" . pnVarPrepForStore($modversion['description']) . "'\n\t\t\tWHERE {$modulescolumn['id']} = " . pnVarPrepForStore($mid); $dbconn->Execute($sql); // END bugfix (561802) - cmgrote // Message pnSessionSetVar('errormsg', _MODULESAPIUPGRADED); // Success return true; }
/** * load a module * @param name - name of module to load * @param type - type of functions to load * @returns string * @return name of module loaded, or false on failure */ function pnModLoad($modname, $type = 'user') { static $loaded = array(); if (empty($modname)) { return false; } list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); $modulestable = $pntable['modules']; $modulescolumn =& $pntable['modules_column']; if (!empty($loaded["{$modname}{$type}"])) { // Already loaded from somewhere else return $modname; } $query = "SELECT {$modulescolumn['directory']},\n {$modulescolumn['state']}\n FROM {$modulestable}\n WHERE {$modulescolumn['name']} = '" . pnVarPrepForStore($modname) . "'"; $result = $dbconn->Execute($query); if ($dbconn->ErrorNo() != 0) { return; } if ($result->EOF) { return false; } list($directory, $state) = $result->fields; $result->Close(); // Load the module and module language files list($osdirectory, $ostype) = pnVarPrepForOS($directory, $type); $osfile = "modules/{$osdirectory}/pn{$ostype}.php"; if (!file_exists($osfile)) { // File does not exist return false; } // Load file include $osfile; $loaded["{$modname}{$type}"] = 1; $defaultlang = pnConfigGetVar('language'); if (empty($defaultlang)) { $defaultlang = 'eng'; } $currentlang = pnUserGetLang(); if (file_exists("modules/{$osdirectory}/pnlang/{$currentlang}/{$ostype}.php")) { include "modules/{$osdirectory}/pnlang/" . pnVarPrepForOS($currentlang) . "/{$ostype}.php"; } elseif (file_exists("modules/{$directory}/pnlang/{$defaultlang}/{$ostype}.php")) { include "modules/{$osdirectory}/pnlang/" . pnVarPrepForOS($defaultlang) . "/{$ostype}.php"; } // Load datbase info pnModDBInfoLoad($modname, $directory); // Return the module name return $modname; }
/** * get the user's theme * @public * @returns string * @return the name of the user's theme */ function pnUserGetTheme() { // Order of theme priority: // - page-specific // - user // - system // - PostNuke // Page-specific theme $pagetheme = pnVarCleanFromInput('theme'); if (!empty($pagetheme)) { if (@opendir("themes/" . pnVarPrepForOS($pagetheme))) { return $pagetheme; } } if (pnUserLoggedIn() && !pnConfigGetVar('theme_change')) { $usertheme = pnUserGetVar('theme'); // modification mouzaia .71 if (!empty($usertheme)) { if (@opendir(WHERE_IS_PERSO . "themes/" . pnVarPrepForOS($usertheme))) { return $usertheme; } if (@opendir("themes/" . pnVarPrepForOS($usertheme))) { return $usertheme; } } } $systemtheme = pnConfigGetVar('Default_Theme'); if (!empty($systemtheme)) { if (@opendir(WHERE_IS_PERSO . "themes/" . pnVarPrepForOS($systemtheme))) { return $systemtheme; } if (@opendir("themes/" . pnVarPrepForOS($systemtheme))) { return $systemtheme; } } // why is this hard coded ?????? // $defaulttheme = 'PostNuke'; $defaulttheme = pnConfigGetVar('Default_Theme'); if (@opendir(WHERE_IS_PERSO . "themes/" . pnVarPrepForOS($defaulttheme))) { return $defaulttheme; } if (@opendir("themes/" . pnVarPrepForOS($defaulttheme))) { return $defaulttheme; } return false; }
/** * postcalendar_userapi_buildSubmitForm() * create event submit form */ function postcalendar_userapi_buildSubmitForm($args, $admin = false) { $_SESSION['category'] = ""; if (!PC_ACCESS_ADD) { return _POSTCALENDARNOAUTH; } extract($args); unset($args); //since we seem to clobber category $cat = $category; $output = new pnHTML(); $output->SetInputMode(_PNH_VERBATIMINPUT); // set up Smarty $tpl = new pcSmarty(); $tpl->caching = false; $template_name = pnModGetVar(__POSTCALENDAR__, 'pcTemplate'); if (!isset($template_name)) { $template_name = 'default'; } //================================================================= // Setup the correct config file path for the templates //================================================================= $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__)); $modir = pnVarPrepForOS($modinfo['directory']); $modname = $modinfo['displayname']; $all_categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories'); //print_r($all_categories); unset($modinfo); $tpl->config_dir = "modules/{$modir}/pntemplates/{$template_name}/config/"; //================================================================= // PARSE MAIN //================================================================= $tpl->assign('webroot', $GLOBALS['web_root']); $tpl->assign_by_ref('TPL_NAME', $template_name); $tpl->assign('FUNCTION', pnVarCleanFromInput('func')); $tpl->assign_by_ref('ModuleName', $modname); $tpl->assign_by_ref('ModuleDirectory', $modir); $tpl->assign_by_ref('category', $all_categories); $tpl->assign('NewEventHeader', _PC_NEW_EVENT_HEADER); $tpl->assign('EventTitle', _PC_EVENT_TITLE); $tpl->assign('Required', _PC_REQUIRED); $tpl->assign('DateTimeTitle', _PC_DATE_TIME); $tpl->assign('AlldayEventTitle', _PC_ALLDAY_EVENT); $tpl->assign('TimedEventTitle', _PC_TIMED_EVENT); $tpl->assign('TimedDurationTitle', _PC_TIMED_DURATION); $tpl->assign('TimedDurationHoursTitle', _PC_TIMED_DURATION_HOURS); $tpl->assign('TimedDurationMinutesTitle', _PC_TIMED_DURATION_MINUTES); $tpl->assign('EventDescTitle', _PC_EVENT_DESC); //the double book variable comes from the eventdata array that is //passed here and extracted, injection is not an issue here if (is_numeric($double_book)) { $tpl->assign('double_book', $double_book); } //pennfirm begin patient info handling $ProviderID = pnVarCleanFromInput("provider_id"); if (is_numeric($ProviderID)) { $tpl->assign('ProviderID', $ProviderID); $tpl->assign('provider_id', $ProviderID); } elseif (is_numeric($event_userid) && $event_userid != 0) { $tpl->assign('ProviderID', $event_userid); $tpl->assign('provider_id', $event_userid); } else { if ($_SESSION['userauthorized'] == 1) { $tpl->assign('ProviderID', $_SESSION['authUserID']); } else { $tpl->assign('ProviderID', ""); } } $provinfo = getProviderInfo(); $tpl->assign('providers', $provinfo); $PatientID = pnVarCleanFromInput("patient_id"); // limit the number of results returned by getPatientPID // this helps to prevent the server from stalling on a request with // no PID and thousands of PIDs in the database -- JRM // the function getPatientPID($pid, $given, $orderby, $limit, $start) <-- defined in library/patient.inc $plistlimit = 500; if (is_numeric($PatientID)) { $tpl->assign('PatientList', getPatientPID(array('pid' => $PatientID, 'limit' => $plistlimit))); } elseif (is_numeric($event_pid)) { $tpl->assign('PatientList', getPatientPID(array('pid' => $event_pid, 'limit' => $plistlimit))); } else { $tpl->assign('PatientList', getPatientPID(array('limit' => $plistlimit))); } $tpl->assign('event_pid', $event_pid); $tpl->assign('event_aid', $event_aid); $tpl->assign('event_category', pnVarCleanFromInput("event_category")); if (empty($event_patient_name)) { $patient_data = getPatientData($event_pid, $given = "lname, fname"); $event_patient_name = $patient_data['lname'] . ", " . $patient_data['fname']; } $tpl->assign('patient_value', $event_patient_name); //================================================================= // PARSE INPUT_EVENT_TITLE //================================================================= $tpl->assign('InputEventTitle', 'event_subject'); $tpl->assign('ValueEventTitle', pnVarPrepForDisplay($event_subject)); //================================================================= // PARSE SELECT_DATE_TIME //================================================================= // It seems that with Mozilla at least, <select> fields that are disabled // do not get passed as form data. Therefore we ignore $double_book so // that the fields will not be disabled. -- Rod 2005-03-22 $output->SetOutputMode(_PNH_RETURNOUTPUT); if (_SETTING_USE_INT_DATES) { $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday)); $formdata = $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, ''); $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth)); $formdata .= $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, ''); } else { $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth)); $formdata = $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, ''); $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday)); $formdata .= $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, ''); } $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_startyear)); $formdata .= $output->FormSelectMultiple('event_startyear', $sel_data, 0, 1, "", "", false, ''); $output->SetOutputMode(_PNH_KEEPOUTPUT); $tpl->assign('SelectDateTime', $formdata); $tpl->assign('InputAllday', 'event_allday'); $tpl->assign('ValueAllday', '1'); $tpl->assign('SelectedAllday', $event_allday == 1 ? 'checked' : ''); $tpl->assign('InputTimed', 'event_allday'); $tpl->assign('ValueTimed', '0'); $tpl->assign('SelectedTimed', $event_allday == 0 ? 'checked' : ''); $tpl->assign('STYLE', $GLOBALS['style']); //================================================================= // PARSE SELECT_END_DATE_TIME //================================================================= $output->SetOutputMode(_PNH_RETURNOUTPUT); //if there is no end date we want the box to read todays date instead of jan 01 1994 :) if ($event_endmonth == 0 && $event_endday == 0 && $event_endyear == 0) { $event_endmonth = $month; $event_endday = $day; $event_endyear = $year; } if (_SETTING_USE_INT_DATES) { $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday)); $formdata = $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, ''); $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth)); $formdata .= $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, ''); } else { $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth)); $formdata = $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, ''); $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday)); $formdata .= $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, ''); } $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_endyear)); $formdata .= $output->FormSelectMultiple('event_endyear', $sel_data, 0, 1, "", "", false, ''); $output->SetOutputMode(_PNH_KEEPOUTPUT); $tpl->assign('SelectEndDate', $formdata); //================================================================= // PARSE SELECT_TIMED_EVENT //================================================================= $stimes = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildTimeSelect', array('hselected' => $event_starttimeh, 'mselected' => $event_starttimem)); $output->SetOutputMode(_PNH_RETURNOUTPUT); $timed_hours = $output->FormSelectMultiple('event_starttimeh', $stimes['h'], 0, 1, "", "", false, ''); $timed_minutes = $output->FormSelectMultiple('event_starttimem', $stimes['m'], 0, 1, "", "", false, ''); if (!_SETTING_TIME_24HOUR) { $ampm = array(); $ampm[0]['id'] = pnVarPrepForStore(_AM_VAL); $ampm[0]['name'] = pnVarPrepForDisplay(_PC_AM); $ampm[1]['id'] = pnVarPrepForStore(_PM_VAL); $ampm[1]['name'] = pnVarPrepForDisplay(_PC_PM); if ($event_startampm == "AM" || $event_startampm == _AM_VAL) { $ampm[0]['selected'] = 1; } else { $ampm[1]['selected'] = 1; } $timed_ampm = $output->FormSelectMultiple('event_startampm', $ampm, 0, 1, "", "", false, ''); } else { $timed_ampm = ''; } $output->SetOutputMode(_PNH_KEEPOUTPUT); $tpl->assign('SelectTimedHours', $timed_hours); $tpl->assign('SelectTimedMinutes', $timed_minutes); $tpl->assign('SelectTimedAMPM', $timed_ampm); $tpl->assign('event_startday', $event_startday); $tpl->assign('event_startmonth', $event_startmonth); $tpl->assign('event_startyear', $event_startyear); $tpl->assign('event_starttimeh', $event_starttimeh); $tpl->assign('event_starttimem', $event_starttimem); $tpl->assign('event_startampm', $event_startampm); $tpl->assign('event_dur_hours', $event_dur_hours); $tpl->assign('event_dur_minutes', $event_dur_minutes); //================================================================= // PARSE SELECT_DURATION //================================================================= $event_dur_hours = (int) $event_dur_hours; for ($i = 0; $i <= 24; $i += 1) { $TimedDurationHours[$i] = array('value' => $i, 'selected' => $event_dur_hours == $i ? 'selected' : '', 'name' => sprintf('%02d', $i)); } $tpl->assign('TimedDurationHours', $TimedDurationHours); $tpl->assign('InputTimedDurationHours', 'event_dur_hours'); $found_time = false; for ($i = 0; $i < 60; $i += _SETTING_TIME_INCREMENT) { $TimedDurationMinutes[$i] = array('value' => $i, 'selected' => $event_dur_minutes == $i ? 'selected' : '', 'name' => sprintf('%02d', $i)); if ($TimedDurationMinutes[$i]['selected'] == 'selected') { $found_time = true; } } if (!$found_time) { $TimedDurationMinutes[$i] = array('value' => $event_dur_minutes, 'selected' => 'selected', 'name' => sprintf('%02d', $event_dur_minutes)); } $tpl->assign('TimedDurationMinutes', $TimedDurationMinutes); $tpl->assign('hidden_event_dur_minutes', $event_dur_minutes); $tpl->assign('InputTimedDurationMinutes', 'event_dur_minutes'); //================================================================= // PARSE INPUT_EVENT_DESC //================================================================= $tpl->assign('InputEventDesc', 'event_desc'); if (empty($pc_html_or_text)) { $display_type = substr($event_desc, 0, 6); if ($display_type == ':text:') { $pc_html_or_text = 'text'; $event_desc = substr($event_desc, 6); } elseif ($display_type == ':html:') { $pc_html_or_text = 'html'; $event_desc = substr($event_desc, 6); } else { $pc_html_or_text = 'text'; } unset($display_type); } $tpl->assign('ValueEventDesc', pnVarPrepForDisplay($event_desc)); $eventHTMLorText = "<select name=\"pc_html_or_text\">"; if ($pc_html_or_text == 'text') { $eventHTMLorText .= "<option value=\"text\" selected=\"selected\">" . _PC_SUBMIT_TEXT . "</option>"; } else { $eventHTMLorText .= "<option value=\"text\">" . _PC_SUBMIT_TEXT . "</option>"; } if ($pc_html_or_text == 'html') { $eventHTMLorText .= "<option value=\"html\" selected=\"selected\">" . _PC_SUBMIT_HTML . "</option>"; } else { $eventHTMLorText .= "<option value=\"html\">" . _PC_SUBMIT_HTML . "</option>"; } $eventHTMLorText .= "</select>"; $tpl->assign('EventHTMLorText', $eventHTMLorText); //================================================================= // PARSE select_event_topic_block //================================================================= $tpl->assign('displayTopics', _SETTING_DISPLAY_TOPICS); if ((bool) _SETTING_DISPLAY_TOPICS) { $a_topics =& postcalendar_userapi_getTopics(); $topics = array(); foreach ($a_topics as $topic) { array_push($topics, array('value' => $topic['id'], 'selected' => $topic['id'] == $event_topic ? 'selected' : '', 'name' => $topic['text'])); } unset($a_topics); // only show this if we have topics to show if (count($topics) > 0) { $tpl->assign('topics', $topics); $tpl->assign('EventTopicTitle', _PC_EVENT_TOPIC); $tpl->assign('InputEventTopic', 'event_topic'); } } //================================================================= // PARSE select_event_type_block //================================================================= $categories = array(); foreach ($all_categories as $category) { array_push($categories, array('value' => $category['id'], 'selected' => $category['id'] == $event_category ? 'selected' : '', 'name' => $category['name'], 'color' => $category['color'], 'desc' => $category['desc'])); } // only show this if we have categories to show // you should ALWAYS have at least one valid category if (count($categories) > 0) { $tpl->assign('categories', $categories); $tpl->assign('EventCategoriesTitle', _PC_EVENT_CATEGORY); $tpl->assign('InputEventCategory', 'event_category'); $tpl->assign('hidden_event_category', $event_category); } //================================================================= // PARSE event_sharing_block //================================================================= $data = array(); if (_SETTING_ALLOW_USER_CAL) { array_push($data, array(SHARING_PRIVATE, _PC_SHARE_PRIVATE)); array_push($data, array(SHARING_PUBLIC, _PC_SHARE_PUBLIC)); array_push($data, array(SHARING_BUSY, _PC_SHARE_SHOWBUSY)); } if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADMIN) || _SETTING_ALLOW_GLOBAL || !_SETTING_ALLOW_USER_CAL) { array_push($data, array(SHARING_GLOBAL, _PC_SHARE_GLOBAL)); } $sharing = array(); foreach ($data as $cell) { array_push($sharing, array('value' => $cell[0], 'selected' => (int) $event_sharing == $cell[0] ? 'selected' : '', 'name' => $cell[1])); } //pennfirm get list of providers from openemr code in calendar.inc $tpl->assign("user", getCalendarProviderInfo()); $tpl->assign('sharing', $sharing); $tpl->assign('EventSharingTitle', _PC_SHARING); $tpl->assign('InputEventSharing', 'event_sharing'); //================================================================= // location information //================================================================= $tpl->assign('EventLocationTitle', _PC_EVENT_LOCATION); $tpl->assign('InputLocation', 'event_location'); $tpl->assign('ValueLocation', pnVarPrepForDisplay($event_location)); $tpl->assign('EventStreetTitle', _PC_EVENT_STREET); $tpl->assign('InputStreet1', 'event_street1'); $tpl->assign('ValueStreet1', pnVarPrepForDisplay($event_street1)); $tpl->assign('InputStreet2', 'event_street2'); $tpl->assign('ValueStreet2', pnVarPrepForDisplay($event_street2)); $tpl->assign('EventCityTitle', _PC_EVENT_CITY); $tpl->assign('InputCity', 'event_city'); $tpl->assign('ValueCity', pnVarPrepForDisplay($event_city)); $tpl->assign('EventStateTitle', _PC_EVENT_STATE); $tpl->assign('InputState', 'event_state'); $tpl->assign('ValueState', pnVarPrepForDisplay($event_state)); $tpl->assign('EventPostalTitle', _PC_EVENT_POSTAL); $tpl->assign('InputPostal', 'event_postal'); $tpl->assign('ValuePostal', pnVarPrepForDisplay($event_postal)); //================================================================= // contact information //================================================================= $tpl->assign('EventContactTitle', _PC_EVENT_CONTACT); $tpl->assign('InputContact', 'event_contname'); $tpl->assign('ValueContact', pnVarPrepForDisplay($event_contname)); $tpl->assign('EventPhoneTitle', _PC_EVENT_PHONE); $tpl->assign('InputPhone', 'event_conttel'); $tpl->assign('ValuePhone', pnVarPrepForDisplay($event_conttel)); $tpl->assign('EventEmailTitle', _PC_EVENT_EMAIL); $tpl->assign('InputEmail', 'event_contemail'); $tpl->assign('ValueEmail', pnVarPrepForDisplay($event_contemail)); $tpl->assign('EventWebsiteTitle', _PC_EVENT_WEBSITE); $tpl->assign('InputWebsite', 'event_website'); $tpl->assign('ValueWebsite', pnVarPrepForDisplay($event_website)); $tpl->assign('EventFeeTitle', _PC_EVENT_FEE); $tpl->assign('InputFee', 'event_fee'); $tpl->assign('ValueFee', pnVarPrepForDisplay($event_fee)); //================================================================= // Repeating Information //================================================================= $tpl->assign('RepeatingHeader', _PC_REPEATING_HEADER); $tpl->assign('NoRepeatTitle', _PC_NO_REPEAT); $tpl->assign('RepeatTitle', _PC_REPEAT); $tpl->assign('RepeatOnTitle', _PC_REPEAT_ON); $tpl->assign('OfTheMonthTitle', _PC_OF_THE_MONTH); $tpl->assign('EndDateTitle', _PC_END_DATE); $tpl->assign('NoEndDateTitle', _PC_NO_END); $tpl->assign('InputNoRepeat', 'event_repeat'); $tpl->assign('ValueNoRepeat', '0'); $tpl->assign('SelectedNoRepeat', (int) $event_repeat == 0 ? 'checked' : ''); $tpl->assign('InputRepeat', 'event_repeat'); $tpl->assign('ValueRepeat', '1'); $tpl->assign('SelectedRepeat', (int) $event_repeat == 1 ? 'checked' : ''); unset($in); $in = array(_PC_EVERY, _PC_EVERY_OTHER, _PC_EVERY_THIRD, _PC_EVERY_FOURTH); $keys = array(REPEAT_EVERY, REPEAT_EVERY_OTHER, REPEAT_EVERY_THIRD, REPEAT_EVERY_FOURTH); $repeat_freq = array(); foreach ($in as $k => $v) { array_push($repeat_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq ? 'selected' : '', 'name' => $v)); } $tpl->assign('InputRepeatFreq', 'event_repeat_freq'); if (empty($event_repeat_freq) || $event_repeat_freq < 1) { $event_repeat_freq = 1; } $tpl->assign('InputRepeatFreqVal', $event_repeat_freq); $tpl->assign('repeat_freq', $repeat_freq); unset($in); $in = array(_PC_EVERY_DAY, _PC_EVERY_WORKDAY, _PC_EVERY_WEEK, _PC_EVERY_MONTH, _PC_EVERY_YEAR); $keys = array(REPEAT_EVERY_DAY, REPEAT_EVERY_WORK_DAY, REPEAT_EVERY_WEEK, REPEAT_EVERY_MONTH, REPEAT_EVERY_YEAR); $repeat_freq_type = array(); foreach ($in as $k => $v) { array_push($repeat_freq_type, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq_type ? 'selected' : '', 'name' => $v)); } $tpl->assign('InputRepeatFreqType', 'event_repeat_freq_type'); $tpl->assign('repeat_freq_type', $repeat_freq_type); $tpl->assign('InputRepeatOn', 'event_repeat'); $tpl->assign('ValueRepeatOn', '2'); $tpl->assign('SelectedRepeatOn', (int) $event_repeat == 2 ? 'checked' : ''); unset($in); $in = array(_PC_EVERY_1ST, _PC_EVERY_2ND, _PC_EVERY_3RD, _PC_EVERY_4TH, _PC_EVERY_LAST); $keys = array(REPEAT_ON_1ST, REPEAT_ON_2ND, REPEAT_ON_3RD, REPEAT_ON_4TH, REPEAT_ON_LAST); $repeat_on_num = array(); foreach ($in as $k => $v) { array_push($repeat_on_num, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_num ? 'selected' : '', 'name' => $v)); } $tpl->assign('InputRepeatOnNum', 'event_repeat_on_num'); $tpl->assign('repeat_on_num', $repeat_on_num); unset($in); $in = array(_PC_EVERY_SUN, _PC_EVERY_MON, _PC_EVERY_TUE, _PC_EVERY_WED, _PC_EVERY_THU, _PC_EVERY_FRI, _PC_EVERY_SAT); $keys = array(REPEAT_ON_SUN, REPEAT_ON_MON, REPEAT_ON_TUE, REPEAT_ON_WED, REPEAT_ON_THU, REPEAT_ON_FRI, REPEAT_ON_SAT); $repeat_on_day = array(); foreach ($in as $k => $v) { array_push($repeat_on_day, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_day ? 'selected' : '', 'name' => $v)); } $tpl->assign('InputRepeatOnDay', 'event_repeat_on_day'); $tpl->assign('repeat_on_day', $repeat_on_day); unset($in); $in = array(_PC_OF_EVERY_MONTH, _PC_OF_EVERY_2MONTH, _PC_OF_EVERY_3MONTH, _PC_OF_EVERY_4MONTH, _PC_OF_EVERY_6MONTH, _PC_OF_EVERY_YEAR); $keys = array(REPEAT_ON_MONTH, REPEAT_ON_2MONTH, REPEAT_ON_3MONTH, REPEAT_ON_4MONTH, REPEAT_ON_6MONTH, REPEAT_ON_YEAR); $repeat_on_freq = array(); foreach ($in as $k => $v) { array_push($repeat_on_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_freq ? 'selected' : '', 'name' => $v)); } $tpl->assign('InputRepeatOnFreq', 'event_repeat_on_freq'); if (empty($event_repeat_on_freq) || $event_repeat_on_freq < 1) { $event_repeat_on_freq = 1; } $tpl->assign('InputRepeatOnFreqVal', $event_repeat_on_freq); $tpl->assign('repeat_on_freq', $repeat_on_freq); $tpl->assign('MonthsTitle', _PC_MONTHS); //================================================================= // PARSE INPUT_END_DATE //================================================================= $tpl->assign('InputEndOn', 'event_endtype'); $tpl->assign('ValueEndOn', '1'); $tpl->assign('SelectedEndOn', (int) $event_endtype == 1 ? 'checked' : ''); //================================================================= // PARSE INPUT_NO_END //================================================================= $tpl->assign('InputNoEnd', 'event_endtype'); $tpl->assign('ValueNoEnd', '0'); $tpl->assign('SelectedNoEnd', (int) $event_endtype == 0 ? 'checked' : ''); $qstring = preg_replace("/provider_id=[0-9]*[&]{0,1}/", "", $_SERVER['QUERY_STRING']); $tpl->assign('qstring', $qstring); $output->SetOutputMode(_PNH_RETURNOUTPUT); $authkey = $output->FormHidden('authid', pnSecGenAuthKey()); $output->SetOutputMode(_PNH_KEEPOUTPUT); $form_hidden = "<input type=\"hidden\" name=\"is_update\" value=\"{$is_update}\" />"; $form_hidden .= "<input type=\"hidden\" name=\"pc_event_id\" value=\"{$pc_event_id}\" />"; $form_hidden .= "<input type=\"hidden\" name=\"category\" value=\"{$cat}\" />"; if (isset($data_loaded)) { $form_hidden .= "<input type=\"hidden\" name=\"data_loaded\" value=\"{$data_loaded}\" />"; $tpl->assign('FormHidden', $form_hidden); } $form_submit = '<input type=hidden name="form_action" value="commit"/> ' . $authkey . '<input type="submit" name="submit" value="go">'; $tpl->assign('FormSubmit', $form_submit); // do not cache this page if ($admin) { $output->Text($tpl->fetch($template_name . '/admin/submit.html')); } elseif (pnVarCleanFromInput("no_nav") == 1) { $output->Text($tpl->fetch($template_name . '/user/submit_no_nav.html')); } else { $output->Text($tpl->fetch($template_name . '/user/submit.html')); } $output->Text(postcalendar_footer()); return $output->GetOutput(); }
/** * load all blocks * @return array array of blocks */ function pnBlockLoadAll() { // Load core and old-style blocks $dib = opendir('includes/blocks/'); while ($f = readdir($dib)) { // itevo if (substr($f, -4) == ".php") { // itevo $block = substr($f, 0, -4); pnBlockLoad('Core', $block); } } closedir($dib); // Load new-style blocks from system and modules tree $mods = pnModGetAllMods(); //while (list($name, $directory, $mid) = $result->fields) { foreach ($mods as $mod) { $name = $mod['name']; $directory = $mod['directory']; $blockdir = 'modules/' . pnVarPrepForOS($directory) . '/pnblocks'; if (!@is_dir($blockdir)) { continue; } $dib = opendir($blockdir); while ($f = readdir($dib)) { // itevo if (substr($f, -4) == ".php") { // itevo $block = substr($f, 0, -4); pnBlockLoad($name, $block); } } } // Return information gathered return $GLOBALS['blocks_modules']; }
/** * Initialise PostNuke * <br> * Carries out a number of initialisation tasks to get PostNuke up and * running. * @returns void */ function pnInit() { // proper error_repoting // e_all for development // error_reporting(E_ALL); // without warnings and notices for release error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED); // Hack for some weird PHP systems that should have the // LC_* constants defined, but don't if (!defined('LC_TIME')) { define('LC_TIME', 'LC_TIME'); } // ADODB configuration define('ADODB_DIR', 'pnadodb'); require 'pnadodb/adodb.inc.php'; // Temporary fix for hacking the hlpfile global // TODO - remove with pre-0.71 code global $hlpfile; $hlpfile = ''; // Initialise and load configuration global $pnconfig, $pndebug; $pnconfig = array(); include 'config.php'; // Set up multisites // added this @define for .71, ugly ? // i guess the E_ALL stuff. @define('WHERE_IS_PERSO', ''); // Initialise and load pntables global $pntable; $pntable = array(); // if a multisite has its own pntables. if (file_exists(WHERE_IS_PERSO . 'pntables.php')) { include WHERE_IS_PERSO . 'pntables.php'; } else { require 'pntables.php'; } // Decode encoded DB parameters if ($pnconfig['encoded']) { $pnconfig['dbuname'] = base64_decode($pnconfig['dbuname']); $pnconfig['dbpass'] = base64_decode($pnconfig['dbpass']); $pnconfig['encoded'] = 0; } // Connect to database if (!pnDBInit()) { die('Database initialisation failed'); } // debugger if required if ($pndebug['debug']) { include_once 'includes/lensdebug.inc.php'; global $dbg, $debug_sqlcalls; $dbg = new LensDebug(); $debug_sqlcalls = 0; } // Build up old config array pnConfigInit(); // Set compression on if desired // if (pnConfigGetVar('UseCompression') == 1) { ob_start("ob_gzhandler"); } // Other includes include 'includes/pnSession.php'; include 'includes/pnUser.php'; // Start session if (!pnSessionSetup()) { die('Session setup failed'); } if (!pnSessionInit()) { die('Session initialisation failed'); } include 'includes/security.php'; // See if a language update is required $newlang = pnVarCleanFromInput('newlang'); if (!empty($newlang)) { $lang = $newlang; pnSessionSetVar('lang', $newlang); } else { $lang = pnSessionGetVar('lang'); } // Load global language defines if (isset($lang) && file_exists('language/' . pnVarPrepForOS($lang) . '/global.php')) { $currentlang = $lang; } else { $currentlang = pnConfigGetVar('language'); pnSessionSetVar('lang', $currentlang); } include 'language/' . pnVarPrepForOS($currentlang) . '/global.php'; include 'modules/NS-Languages/api.php'; // Cross-Site Scripting attack defense - Sent by larsneo // some syntax checking against injected javascript $pnAntiCrackerMode = pnConfigGetVar('pnAntiCracker'); if ($pnAntiCrackerMode == 1) { pnSecureInput(); } // Banner system include 'includes/pnBanners.php'; // Other other includes include 'includes/advblocks.php'; include 'includes/counter.php'; include 'includes/pnHTML.php'; include 'includes/pnMod.php'; include 'includes/queryutil.php'; include 'includes/xhtml.php'; include 'includes/oldfuncs.php'; // Handle referer if (pnConfigGetVar('httpref') == 1) { include 'referer.php'; httpreferer(); } return true; }
$function_op = $function . $op; $function_main = $function . 'main'; $var = array_merge($GLOBALS['HTTP_GET_VARS'], $GLOBALS['HTTP_POST_VARS']); if (function_exists($function_op)) { $function_op($var); } elseif (function_exists($function_main)) { $function_main($var); } else { die("error : user_execute({$file},{$function_op})"); } } $caselist = array(); $moddir = opendir('modules/'); while ($modulename = readdir($moddir)) { if (@is_dir("modules/" . pnVarPrepForOS($modulename) . "/user/case/")) { $casedir = opendir("modules/" . pnVarPrepForOS($modulename) . "/user/case/"); while ($func = readdir($casedir)) { if (eregi('^case.', $func)) { $caselist[$func]['path'] = "modules/" . pnVarPrepForOS($modulename) . "/user/case"; $caselist[$func]['module'] = $modulename; } } closedir($casedir); } } closedir($moddir); ksort($caselist); foreach ($caselist as $k => $v) { $ModName = $v['module']; include $v['path'] . '/' . pnVarPrepForOS($k); }
/** * Loads the required manual for module */ function modules_get_manual() { $currentlang = pnSessionGetVar('lang'); $language = pnConfigGetVar('language'); if (!isset($GLOBALS['ModName'])) { $modname = pnModGetName(); } else { $modname = $GLOBALS['ModName']; } $modinfo = pnModGetInfo(pnModGetIDFromName($modname)); if (file_exists('modules/' . pnVarPrepForOS($modinfo['directory']) . '/lang/' . pnVarPrepForOS($currentlang) . '/manual.html')) { $hlpfile = 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/lang/' . pnVarPrepForOS($currentlang) . '/manual.html'; } elseif (!empty($language)) { if (file_exists('modules/' . pnVarPrepForOS($modinfo['directory']) . '/lang/' . pnVarPrepForOS($language) . '/manual.html')) { $hlpfile = 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/lang/' . pnVarPrepForOS($language) . '/manual.html'; } } else { $hlpfile = 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/lang/eng/manual.html'; } return; }
function user_menu($help_file = '') { $pntable = pnDBGetTables(); user_menu_title('user.php', _THISISYOURPAGE); user_menu_graphic(pnConfigGetVar('usergraphic')); if ($help_file != '') { user_menu_help($help_file, _ONLINEMANUAL); } // include 'modules/NS-Modules/data.php'; // foreach ($module_item as $k=>$item) // user_menu_add_option('user.php?module='.$item['module'].'&op=main',$item['text'],$item['image']); // modules, old way $moddir = opendir('modules/'); while ($modulename = readdir($moddir)) { if (@is_dir($dir = 'modules/' . pnVarPrepForOS($modulename) . '/user/links/')) { $linksdir = opendir("modules/" . pnVarPrepForOS($modulename) . "/user/links/"); while ($func = readdir($linksdir)) { if (eregi('^links.', $func)) { // modified by Chris van de Steeg to have $ModName available in the links file // $menulist[$func] = "modules/$modulename/user/links"; $menulist[$func]["dir"] = 'modules/' . pnVarPrepForOS($modulename) . '/user/links'; $menulist[$func]["modname"] = $modulename; // end mofication by Chris van de Steeg } } closedir($linksdir); } } closedir($moddir); // display ksort($menulist); foreach ($menulist as $k => $v) { // modified by Chris van de Steeg to have $ModName available in the links file // $currMod = $GLOBALS["ModName"]; //moved a bit down by Andy Varganov $GLOBALS["ModName"] = $v["modname"]; $currMod = $GLOBALS["ModName"]; include $v['dir'] . '/' . pnVarPrepForOS($k); $GLOBALS["ModName"] = $currMod; // end mofication by Chris van de Steeg } user_menu_add_option('user.php?module=NS-User&op=logout', _LOGOUTEXIT, 'modules/NS-Your_Account/images/exit.gif'); }
// call for an unavailable module - either not available or not authorized header('HTTP/1.0 403 Access Denied'); include 'header.php'; echo 'Module <strong>' . pnVarPrepForDisplay($module) . '</strong> not available'; include 'footer.php'; exit; } } // get the module information $modinfo = pnModGetInfo(pnModGetIDFromName($module)); if ($modinfo['type'] == 2 || $modinfo['type'] == 3) { // Redirect to new style admin panel pnRedirect(pnModURL($module, 'admin')); exit; } if (!file_exists($adminfile = 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/admin.php')) { // Module claims to be old-style, but no admin.php present - quit here header('HTTP/1.0 404 Not Found'); include 'header.php'; echo 'Wrong call for Adminfunction in Module <strong>' . pnVarPrepForDisplay($module) . '</strong>'; include 'footer.php'; exit; } /** * old style module administration */ list($func, $op, $name, $file, $type) = pnVarCleanFromInput('func', 'op', 'name', 'file', 'type'); // load the legacy includes include_once 'modules/Admin/pnlegacy/tools.php'; // set a constant so we can check the correct entry point later define('LOADED_AS_MODULE', '1');
exit; } elseif (function_exists($function_main)) { $function_main($_REQUEST); exit; } else { // die("error : user_execute($file,$function_op)"); pnRedirect('index.php'); return true; } } // when we are here, the call is the result of an action // requested by a (legacy) Your_Account plugin. // Get all user modules... $usermods = pnModGetUserMods(); // since the your account module does't have index.php/pnuser.php it // won't be listed as user_capable hence we need to manually add it to // our result set. [markwest] $usermods[] = pnModGetInfo(pnModGetIDFromName('Your_Account')); // ...and run the requested action (specified by $op) foreach ($usermods as $usermod) { if (@is_dir($dir = 'modules/' . $usermod['directory'] . '/user/case/')) { $casedir = opendir($dir); while ($func = readdir($casedir)) { if (eregi('^case.', $func)) { $ModName = $usermod['name']; include $dir . pnVarPrepForOS($func); } } closedir($casedir); } }