Пример #1
0
function mediashare_source_zip_view(&$args)
{
    $albumId = mediashareGetIntUrl('aid', $args, 0);
    if (isset($_POST['saveButton'])) {
        return mediashareSourceZipUpload($args);
    }
    if (isset($_POST['moreButton']) || isset($_POST['continueButton'])) {
        // After upload - update items and then continue to next page
        if (!mediashareSourceZipUpdate()) {
            return false;
        }
    }
    if (isset($_POST['cancelButton']) || isset($_POST['continueButton'])) {
        return pnRedirect(pnModURL('mediashare', 'edit', 'view', array('aid' => $albumId)));
    }
    if (isset($_POST['moreButton'])) {
        return pnRedirect(pnModURL('mediashare', 'edit', 'addmedia', array('aid' => $albumId, 'source' => 'zip')));
    }
    // FIXME Required globals??
    pnModAPILoad('mediashare', 'edit');
    $uploadInfo = pnModAPIFunc('mediashare', 'source_zip', 'getUploadInfo');
    $render =& pnRender::getInstance('mediashare', false);
    $render->assign('imageNum', 1);
    $render->assign('uploadFields', array(1));
    $render->assign('post_max_size', $uploadInfo['post_max_size']);
    $render->assign('upload_max_filesize', $uploadInfo['upload_max_filesize']);
    return $render->fetch('mediashare_source_zip_view.html');
}
Пример #2
0
/**
 * Smarty function to display admin links for the example module
 * based on the user's permissions
 * 
 * Example
 * <!--[exampleadminlinks start="[" end="]" seperator="|" class="pn-menuitem-title"]-->
 * 
 * @author       Andreas Krapohl
 * @since        10/01/04
 * @see          function.exampleadminlinks.php::smarty_function_exampleadminlinks()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      &$smarty     Reference to the Smarty object
 * @param        string      $start       start string
 * @param        string      $end         end string
 * @param        string      $seperator   link seperator
 * @param        string      $class       CSS class
 * @return       string      the results of the module function
 */
function smarty_function_exampleadminlinks($params, &$smarty)
{
    extract($params);
    unset($params);
    // set some defaults
    if (!isset($start)) {
        $start = '[';
    }
    if (!isset($end)) {
        $end = ']';
    }
    if (!isset($seperator)) {
        $seperator = '|';
    }
    if (!isset($class)) {
        $class = 'pn-menuitem-title';
    }
    $adminlinks = "<span class=\"{$class}\">{$start} ";
    if (pnSecAuthAction(0, 'Example::', '::', ACCESS_READ)) {
        $adminlinks .= "<a href=\"" . pnVarPrepHTMLDisplay(pnModURL('Example', 'admin', 'view')) . "\">" . _VIEW . "</a> ";
    }
    if (pnSecAuthAction(0, 'Example::', '::', ACCESS_ADD)) {
        $adminlinks .= "{$seperator} <a href=\"" . pnVarPrepHTMLDisplay(pnModURL('Example', 'admin', 'new')) . "\">" . _NEW . "</a> ";
    }
    if (pnSecAuthAction(0, 'Example::', '::', ACCESS_ADMIN)) {
        $adminlinks .= "{$seperator} <a href=\"" . pnVarPrepHTMLDisplay(pnModURL('Example', 'admin', 'modifyconfig')) . "\">" . _MODIFYCONFIG . "</a> ";
    }
    $adminlinks .= "{$end}</span>\n";
    return $adminlinks;
}
Пример #3
0
function FlashChatBridge_adminapi_getlinks()
{
    $links = array();
    if (SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_ADMIN)) {
        $links[] = array('url' => pnModURL('FlashChatBridge', 'admin', 'main'), 'text' => __('Common Settings'));
        $links[] = array('url' => pnModURL('FlashChatBridge', 'admin', 'flashchatadmin'), 'text' => __('123FlashChat Settings'));
    }
    return $links;
}
Пример #4
0
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']}&amp;op=main", $mod['displayname'], $imgfile);
                }
            }
        }
    }
}
Пример #5
0
/**
 * get available admin panel links
 *
 * @return array array of admin links
 */
function mediashare_adminapi_getlinks()
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $links = array();
    if (SecurityUtil::checkPermission('mediashare::', '::', ACCESS_ADMIN)) {
        $links[] = array('url' => pnModURL('mediashare', 'user', 'view'), 'text' => __('Browse', $dom));
        $links[] = array('url' => pnModURL('mediashare', 'admin', 'plugins'), 'text' => __('Plugins', $dom));
        $links[] = array('url' => pnModURL('mediashare', 'admin', 'recalc'), 'text' => __('Regenerate', $dom));
        $links[] = array('url' => pnModURL('mediashare', 'admin', 'main'), 'text' => __('Settings', $dom));
    }
    return $links;
}
/**
 *  $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_form_nav_open($args = array())
{
    extract($args);
    unset($args);
    $viewtype = strtolower(pnVarCleanFromInput('viewtype'));
    if (_SETTING_OPEN_NEW_WINDOW && $viewtype == 'details') {
        $target = 'target="csCalendar"';
    } else {
        $target = '';
    }
    $fstart = '<form action="' . pnModURL(__POSTCALENDAR__, 'user', 'view') . '"' . ' method="post"' . ' enctype="application/x-www-form-urlencoded" ' . $target . '>';
    echo $fstart;
}
Пример #7
0
/**
 * display block
 */
function template_firstblock_display($blockinfo)
{
    // Security check
    if (!pnSecAuthAction(0, 'Template:Firstblock:', "{$blockinfo['title']}::", ACCESS_READ)) {
        return;
    }
    // Get variables from content block
    $vars = pnBlockVarsFromContent($blockinfo['content']);
    // Defaults
    if (empty($vars['numitems'])) {
        $vars['numitems'] = 5;
    }
    // Database information
    pnModDBInfoLoad('Template');
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $templatetable = $pntable['template'];
    $templatecolumn =& $pntable['template_column'];
    // Query
    $sql = "SELECT {$templatecolumn['tid']},\n                   {$templatecolumn['name']}\n            FROM {$templatetable}\n            ORDER by {$templatecolumn['name']}";
    $result = $dbconn->SelectLimit($sql, $vars['numitems']);
    if ($dbconn->ErrorNo() != 0) {
        return;
    }
    if ($result->EOF) {
        return;
    }
    // Create output object
    $output = new pnHTML();
    // Display each item, permissions permitting
    for (; !$result->EOF; $result->MoveNext()) {
        list($tid, $name) = $result->fields;
        if (pnSecAuthAction(0, 'Template::', "{$name}::{$tid}", ACCESS_OVERVIEW)) {
            if (pnSecAuthAction(0, 'Template::', "{$name}::{$tid}", ACCESS_READ)) {
                $output->URL(pnModURL('Template', 'user', 'viewdetail', array('tid' => $tid)), $name);
            } else {
                $output->Text($name);
            }
            $output->Linebreak();
        }
    }
    // Populate block info and pass to theme
    $blockinfo['content'] = $output->GetOutput();
    return themesideblock($blockinfo);
}
Пример #8
0
/**
 * Update 123FlashChat Settings
 *
 * @author Tree Florian
 * @return mixed true if successful, false if unsuccessful, error string otherwise
 */
function FlashChatBridge_admin_updateconfig()
{
    // Security check
    if (!SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerPermissionError();
    }
    // get settings from form - do before authid check
    $settings = FormUtil::getPassedValue('settings', null, 'POST');
    // if this form wasnt posted to redirect back
    if ($settings === NULL) {
        return pnRedirect(pnModURL('Settings', 'admin', 'modifyconfig'));
    }
    /*
        // confirm the forms auth key
        if (!SecurityUtil::confirmAuthKey()) {
            return LogUtil::registerAuthidError();
        }
    */
    $lastchar = substr($settings['client_path'], -1);
    if ($lastchar != "\\" && $lastchar != "/" && $settings['client_path'] != "") {
        $settings['client_path'] = $settings['client_path'] . "/";
    }
    $settings['server_data_path'] = str_replace("\\", "/", $settings['server_data_path']);
    $lastchar = substr($settings['server_data_path'], -1);
    if ($lastchar != "\\" && $lastchar != "/" && $settings['client_path'] != "") {
        $settings['server_data_path'] = $settings['server_data_path'] . "/";
    }
    $settings['active_chat_standard'] = $settings['active_chat_standard'] == 1 ? 1 : 0;
    $settings['active_chat_html'] = $settings['active_chat_html'] == 1 ? 1 : 0;
    $settings['active_chat_avatar'] = $settings['active_chat_avatar'] == 1 ? 1 : 0;
    $settings['active_chat_live'] = $settings['active_chat_live'] == 1 ? 1 : 0;
    $settings['active_chat_pocket'] = $settings['active_chat_pocket'] == 1 ? 1 : 0;
    $settings['active_chat_lite'] = $settings['active_chat_lite'] == 1 ? 1 : 0;
    $settings['active_chat_banner'] = $settings['active_chat_banner'] == 1 ? 1 : 0;
    // Write the vars
    //$configvars = pnModGetVar('FlashChatBridge');
    foreach ($settings as $key => $value) {
        pnModSetVar('FlashChatBridge', $key, $value);
    }
    //$configvars = pnModGetVar('FlashChatBridge');
    // Let any other modules know that the modules configuration has been updated
    pnModCallHooks('module', 'updateconfig', 'FlashChatBridge', array('module' => 'FlashChatBridge'));
    return pnRedirect(pnModURL('FlashChatBridge', 'admin', 'modifyconfig'));
}
Пример #9
0
/**
 * 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);
}
Пример #10
0
function Lenses_admin_update_lens($args)
{
    // Clean input from the form.
    $lens_data = pnVarCleanFromInput('lens_data');
    $bc = pnVarCleanFromInput('bc');
    $enh_colors = pnVarCleanFromInput('enh_colors');
    $opaque_colors = pnVarCleanFromInput('opaque_colors');
    // Extract any extra arguments.
    extract($args);
    // Confirm $authid hidden field from form template.
    if (!pnSecConfirmAuthKey()) {
        pnSessionSetVar('errormsg', pnVarPrepHTMLDisplay(_BADAUTHKEY));
        return pnRedirect(pnModURL('Lenses', 'admin', 'main'));
    }
    //take the arrays for the base curves and the simple opaque and enhancer colors
    //and create a string that's added to the appropriate parts of the $lens_data array
    $lens_data[bc_simple] = $bc[0] . " " . $bc[1] . " " . $bc[2];
    $lens_data[enh_names_simple] = "";
    $lens_data[opaque_names_simple] = "";
    foreach ($enh_colors as $value) {
        $lens_data[enh_names_simple] .= $value . " ";
    }
    foreach ($opaque_colors as $value) {
        $lens_data[opaque_names_simple] .= $value . " ";
    }
    // Attempt to update lens.
    if (pnModAPIFunc('Lenses', 'admin', 'update_lens', array('lens_data' => $lens_data))) {
        pnSessionSetVar('statusmsg', pnVarPrepHTMLDisplay(_UPDATESUCCEDED));
    }
    // No output.  Redirect user.
    return pnRedirect(pnModURL('Lenses', 'user', 'view', array('tid' => $lens_data[tid])));
}
Пример #11
0
/**
 *  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;
}
Пример #12
0
function blocks_menu_block($row)
{
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    // Generic check
    if (!pnSecAuthAction(0, 'Menublock::', "{$row['title']}::", ACCESS_READ)) {
        return;
    }
    // Break out options from our content field
    $vars = pnBlockVarsFromContent($row['content']);
    // Display style
    // style = 1 - simple list
    // style = 2 - drop-down list
    // Title
    $block['title'] = $row['title'];
    // Styling
    if (empty($vars['style'])) {
        $vars['style'] = 1;
    }
    $block['content'] = startMenuStyle($vars['style']);
    $content = 0;
    // nkame: must start with some blank line, otherwise we're not able to
    // chose the first option in case of a drop-down menu.
    // a better solution would be to detect where we are, and adjust the selected
    // option in the list, and only add a blank line in case of no recognition.
    if ($vars['style'] == 2) {
        $block['content'] .= addMenuStyledUrl($vars['style'], "", "", "");
    }
    // Content
    if (!empty($vars['content'])) {
        $contentlines = explode("LINESPLIT", $vars['content']);
        foreach ($contentlines as $contentline) {
            list($url, $title, $comment) = explode('|', $contentline);
            if (pnSecAuthAction(0, "Menublock::", "{$row['title']}:{$title}:", ACCESS_READ)) {
                $block['content'] .= addMenuStyledUrl($vars['style'], pnVarPrepForDisplay($title), $url, pnVarPrepForDisplay($comment));
                $content = 1;
            }
        }
    }
    // Modules
    if (!empty($vars['displaymodules'])) {
        $mods = pnModGetUserMods();
        // Separate from current content, if any
        if ($content == 1) {
            $block['content'] .= addMenuStyledUrl($vars['style'], "", "", "");
        }
        foreach ($mods as $mod) {
            // jgm - need to work back ML into modules table somehow
            //            if (file_exists("modules/$mod/modname.php")) {
            //                include "modules/$mod/modname.php";
            //            } else {
            if (pnSecAuthAction(0, "{$mod['name']}::", "::", ACCESS_OVERVIEW)) {
                switch ($mod['type']) {
                    case 1:
                        $block['content'] .= addMenuStyledUrl($vars['style'], pnVarPrepForDisplay($mod['displayname']), "modules.php?op=modload&amp;name=" . pnVarPrepForDisplay($mod['directory']) . "&amp;file=index", pnVarPrepForDisplay($mod['description']));
                        $content = 1;
                        break;
                    case 2:
                        $block['content'] .= addMenuStyledUrl($vars['style'], pnVarPrepForDisplay($mod['displayname']), pnModURL($mod['name'], 'user', 'main'), pnVarPrepForDisplay($mod['description']));
                        $content = 1;
                        break;
                }
            }
        }
    }
    // Waiting content
    if (!empty($vars['displaywaiting'])) {
        // Separate from current content, if any
        if ($content == 1) {
            $block['content'] .= addMenuStyledUrl($vars['style'], "", "", "");
        }
        $header = 0;
        if (pnSecAuthAction(0, "Stories::Story", "::", ACCESS_ADD)) {
            $result = $dbconn->Execute("SELECT count(1) FROM {$pntable['queue']}\n                                      WHERE {$pntable['queue_column']['arcd']}=0");
            if ($dbconn->ErrorNo() == 0) {
                list($qnum) = $result->fields;
                $result->Close();
                if ($qnum) {
                    if ($header == 0) {
                        $block['content'] .= addMenuStyledUrl($vars['style'], "<strong>" . _WAITINGCONT . "</strong>", "", "");
                        $header = 1;
                    }
                    $block['content'] .= addMenuStyledUrl($vars['style'], _SUBMISSIONS . ": {$qnum}", "admin.php?module=NS-AddStory&amp;op=submissions", "");
                    $content = 1;
                }
            }
        }
        if (pnSecAuthAction(0, "Reviews::", "::", ACCESS_ADD)) {
            $result = $dbconn->Execute("SELECT count(1) FROM {$pntable['reviews_add']}");
            if ($dbconn->ErrorNo() == 0) {
                list($rnum) = $result->fields;
                $result->Close();
                if ($rnum) {
                    if ($header == 0) {
                        $block['content'] .= addMenuStyledUrl($vars['style'], "<strong>" . _WAITINGCONT . "</strong>", "", "");
                        $header = 1;
                    }
                    $block['content'] .= addMenuStyledUrl($vars['style'], _WREVIEWS . ": {$rnum}", "admin.php?module=Reviews&amp;op=main", "");
                    $content = 1;
                }
            }
        }
        if (pnSecAuthAction(0, "Web Links::Link", "::", ACCESS_ADD)) {
            $result = $dbconn->Execute("SELECT count(1) FROM {$pntable['links_newlink']}");
            if ($dbconn->ErrorNo() == 0) {
                list($lnum) = $result->fields;
                $result->Close();
                if ($lnum) {
                    if ($header == 0) {
                        $block['content'] .= addMenuStyledUrl($vars['style'], "<strong>" . _WAITINGCONT . "</strong>", "", "");
                        $header = 1;
                    }
                    $block['content'] .= addMenuStyledUrl($vars['style'], _WLINKS . ": {$lnum}", "admin.php?module=Web_Links&amp;op=main", "");
                    $content = 1;
                }
            }
        }
        if (pnSecAuthAction(0, "Downloads::Item", "::", ACCESS_ADD)) {
            $result = $dbconn->Execute("SELECT count(1) FROM {$pntable['downloads_newdownload']}");
            if ($dbconn->ErrorNo() == 0) {
                list($dnum) = $result->fields;
                $result->Close();
                if ($dnum) {
                    if ($header == 0) {
                        $block['content'] .= addMenuStyledUrl($vars['style'], "<strong>" . _WAITINGCONT . "</strong>", "", "");
                        $header = 1;
                    }
                    $block['content'] .= addMenuStyledUrl($vars['style'], _WDOWNLOADS . ": {$dnum}", "admin.php?module=Downloads&amp;op=main", "");
                    $content = 1;
                }
            }
        }
        if (pnSecAuthAction(0, "FAQ::", "::", ACCESS_ADD)) {
            $faqcolumn =& $pntable['faqanswer_column'];
            $result = $dbconn->Execute("SELECT count(1) FROM {$pntable['faqanswer']} WHERE {$faqcolumn['answer']}=''");
            if ($dbconn->ErrorNo() == 0) {
                list($fnum) = $result->fields;
                $result->Close();
                if ($fnum) {
                    if ($header == 0) {
                        $block['content'] .= addMenuStyledUrl($vars['style'], "<strong>" . _WAITINGCONT . "</strong>", "", "");
                        $header = 1;
                    }
                    $block['content'] .= addMenuStyledUrl($vars['style'], _FQUESTIONS . ": {$fnum}", "admin.php?module=FAQ&amp;op=FaqCatUnanswered", "");
                    $content = 1;
                }
            }
        }
    }
    // Styling
    $block['content'] .= endMenuStyle($vars['style']);
    if ($content) {
        $row['title'] = $block['title'];
        $row['content'] = $block['content'];
        return themesideblock($row);
    }
}
Пример #13
0
/**
* http://www.smarty.hu/plugins/duda/function.pager.phps
* Smarty plugin
* -------------------------------------------------------------
* Type:     function
* Name:     pager
* Purpose:  create a paging output to be able to browse long lists
* Version:  1.0
* Date:     September 29, 2002
* Last Modified:    Sep 29, 2003
* Install:  Drop into the plugin directory
* Author:   Peter Dudas <pager_mail at netrendorseg dot hu>
* -------------------------------------------------------------
*
* Example:
* <--[pager show="page" rowcount=$pager.numitems limit=$pager.itemsperpage posvar=startnum shift=1]-->
*
*    @param    mixed     $rowcount        - total number of items to page in between (if array=>numeer of lines)
*    @param    string    $show            - 'page' - to show page numbers, 'record' - to show record numbers (default records)
*    @param    int       $limit           - number of items on a page (if <0 unlimited)
*    @param    string    $posvar          - name of the variable that contains the position data, eg "offset"
*    @param    string    $forwardvars     - comma- semicolon- or space-separated list of POST and GET variables to forward in the pager links. If unset, all vars are forwarded.
*    @param    string    $txt_first       - on the first page, don't print out all pages, just this text; if set empty, prints all page numbers
*    @param    string    $img_first       - on the first page, don't print out all pages, just this image; if set empty, prints all page numbers
*    @param    boolean   $no_first        - print out all the pages, do not start with txt_firts, equals to txt_first set empty
*    @param    string    $txt_prev        - script to go to the prev page
*    @param    string    $img_prev        - button image to the prev page
*    @param    string    $txt_next        - script to go to the next page
*    @param    string    $img_next        - button image to go to the next page
*    @param    string    $txt_pos         - text position = 'top', 'bottom', 'middle/side'
*    @param    string    $class_num       - class for the pager links (<a> tags)
*    @param    string    $class_numon     - class for the active page
*    @param    string    $class_text      - class for the texts
*    @param    string    $separator       - string to put between the page numbers, eg "&nbsp;-&nbsp;" makes 1&nbsp;-&nbsp;2&nbsp;-&nbsp;3
*    @param    int       $firstpos        - record number of the first position
*    @param    int       $shift           - shift the record numbers with this value (useful if the position variable is printed, 0. page look bad, but 1. page!)
*
*    CHANGES:        2003-03-14:    positionable prev/next string. can use image instead of text
*                    2003-03-21:    Bugfixes
*                    2003-04-14:    Ability to show page number instead of row number, shift parameter
*                    2003-07-07:    prepared for negative limits (unlimited), bugfix
*                    2003-09-29:    fixed notices / warnings which are reported if all warnings and errors are reported (error_reporting(0))
*                    2005-07-03:    Overhauled with pnAPI URLs for ShortURL support;
*                                   Rewrote forwardvar section after Init and before link buildup sections. - msandersen
*                    2005-08-19:    Changed default behavior if forwardvars unset to forward all vars - msandersen
*/
function smarty_function_pager($params, &$smarty)
{
    // START INIT
    $show = 'record';
    $posvar = 'pagenum';
    $pos = 'offset';
    $separator = '&ndash;';
    $class_text = 'nav';
    $class_num = 'small';
    $class_numon = 'big';
    $txt_pos = 'middle';
    $txt_prev = '&lt;';
    // < previous
    $txt_next = '&gt;';
    // > next
    $txt_first = '';
    // archive, more articles
    $shift = 0;
    $Request = array_merge($_POST, $_GET);
    $pager = '';
    foreach ($params as $key => $value) {
        $tmps[strtolower($key)] = $value;
        $tmp = strtolower($key);
        if (!(${$tmp} = $value)) {
            ${$tmp} = '';
        }
    }
    settype($shift, 'integer');
    // START data check
    $minVars = array('limit');
    foreach ($minVars as $tmp) {
        if (empty($params[$tmp])) {
            $smarty->trigger_error('plugin "pager": missing or empty parameter: "' . $tmp . '"');
        }
    }
    // END data check
    if ($txt_pos == 'middle') {
        $txt_pos = 'side';
    }
    if (!in_array($txt_pos, array('side', 'top', 'bottom'))) {
        $smarty->trigger_error('plugin "pager": bad value for : "txt_pos"');
    }
    // If there is no need for paging at all
    if (is_array($rowcount)) {
        $rowcount = count($rowcount);
    } elseif (!is_int($rowcount)) {
        ceil($rowcount);
    }
    if ($rowcount <= $limit) {
        return '';
    }
    if ($limit < 1) {
        $limit = $rowcount + 1;
    }
    if (!empty($no_first)) {
        unset($txt_first);
    }
    // Determine the real position if the diplayed numbers were shifted (eg: showing 1 instead of 0)
    if ($shift > 0) {
        if (isset($Request[$posvar])) {
            $pos = $Request[$posvar] - $shift;
            if ($pos < 0) {
                $pos = 0;
            }
        } else {
            $pos = 0;
        }
    } else {
        //$pos = 0;   //29-sep-2003 markus weber   added line
        //if ( isset($Request[$posvar]) ) { //29-sep-2003 markus weber   added if around existing code
        //    $pos = $Request[$posvar];
        //}
    }
    // END INIT
    // If $forwardvars set, add only listed vars to query string, else add all POST and GET vars
    $vars = array();
    if (isset($forwardvars)) {
        if (!is_array($forwardvars)) {
            $forwardvars = preg_split('/[,;\\s]/', $forwardvars, -1, PREG_SPLIT_NO_EMPTY);
        }
        foreach ((array) $forwardvars as $key => $var) {
            if (!empty($var) and !empty($Request[$var])) {
                $vars[$var] = $Request[$var];
            }
        }
    } else {
        $vars = $Request;
    }
    unset($vars['module']);
    unset($vars['func']);
    unset($vars['type']);
    unset($vars['name']);
    unset($vars['file']);
    unset($vars[$posvar]);
    // if there is no position (or 0), prepare the link for the second page
    if ((empty($pos) or $pos < 1) and $rowcount > $limit) {
        if (!empty($firstpos)) {
            $vars[$posvar] = $firstpos;
            $short['first'] .= $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '=' . $firstpos;
            // $url.$link.$posvar.'='.$firstpos;
        } elseif ($pos == -1) {
            $vars[$posvar] = 1 + $shift;
            $short['first'] .= $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '=' . (1 + $shift);
            // $url.$link.$posvar.'='.(1 + $shift);
        } else {
            $vars[$posvar] = $limit + $shift;
            $short['first'] = $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '=' . ($limit + $shift);
            // $url.$link.$posvar.'='.($limit+$shift);
        }
    }
    // START create data to print
    if ($rowcount > $limit) {
        if ($rowcount < $limit * 30) {
            for ($i = 1; $i < $rowcount + 1; $i += $limit) {
                if ($pos + 1 >= $i and $pos + 1 < $i + $limit) {
                    $short['now'] = $i;
                }
                $vars[$posvar] = $i - 1 + $shift;
                $pages[$i] = $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '/' . $vars[$posvar];
                // $url.$link.$posvar.'='.($i - 1 + $shift);
            }
        } else {
            // If there are a lot of records long before the actual position,
            // do big steps ($limit*10)
            for ($i = 1; $i < $pos - 16 * $limit; $i += 10 * $limit) {
                $vars[$posvar] = $i - 1 + $shift;
                $pages[$i] = $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '/' . $vars[$posvar];
                //$pages[$i] = $url.$link.$posvar.'='.($i - 1 + $shift);
            }
            // Around the actual position, do small steps ($limit)
            for ($tmp = 1; $i < $pos + 16 * $limit and $i < $rowcount + 1; $i += $limit) {
                if ($pos + 1 >= $i and $pos + 1 < $i + $limit) {
                    $short['now'] = $i;
                }
                $vars[$posvar] = $i - 1 + $shift;
                $pages[$i] = $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '/' . $vars[$posvar];
                // $url.$link.$posvar.'='.($i - 1 + $shift);
            }
            // Over $pos do big steps ($limit*10)
            for ($tmp = 1; $i < $rowcount + 1; $i += 10 * $limit) {
                $vars[$posvar] = $i - 1 + $shift;
                $pages[$i] = $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '/' . $vars[$posvar];
                // $url.$link.$posvar.'='.($i - 1 + $shift);
            }
        }
        // previous - next stepping
        if ($pos >= $limit) {
            $vars[$posvar] = $pos - $limit + $shift;
            $short['prev'] = $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '/' . $vars[$posvar];
            // $url.$link.$posvar.'='.($pos - $limit + $shift);
        }
        if ($pos < $rowcount - $limit) {
            $vars[$posvar] = $pos + $limit + $shift;
            $short['next'] = $modurl ? pnModURL($module, $type, $func, $vars) : $url . '/' . $posvar . '/' . $vars[$posvar];
            // $url.$link.$posvar.'='.($pos + $limit + $shift);
        }
    }
    // END preparing the arrays to print
    //print_r($short); die;
    // START DISPLAY ---------------------------------------------------------------------------
    // all neccesary data are in $pages, and in $short
    if ($pos == 0 and (!empty($txt_first) or !empty($img_first))) {
        $pager .= '<p style="text-align:center;">';
        $pager .= '<a class="' . $class_text . '" href="' . $short['first'] . '">';
        if (!empty($img_first)) {
            if (strpos($img_first, '<') === true) {
                // preg_match('/<img/i', $img_first)
                // image tag
                $pager .= $img_first;
            } else {
                // image url
                $pager .= '<img src="' . $img_first . '" />';
            }
        } else {
            $pager .= $txt_first;
        }
        $pager .= '</a></p>' . "\n";
    } else {
        // -----------------------------------------------------------------------
        // START prepare the prev and next string/image, make it a link...
        if ($pos >= $limit) {
            $cache['prev'] = '<a class="' . $class_text . '" href="' . htmlspecialchars($short['prev']) . '" style="text-decoration: none;">';
            if (!empty($img_prev)) {
                if (strpos($img_prev, '<') === true) {
                    // preg_match('/\</', $img_prev)
                    // image tag
                    $cache['prev'] .= $img_prev;
                } else {
                    // image url
                    $cache['prev'] .= '<img src="' . $img_prev . '" />';
                }
            } else {
                $cache['prev'] .= $txt_prev;
            }
            $cache['prev'] .= '</a>&nbsp;&nbsp;&nbsp;';
        } else {
            $cache['prev'] = '&nbsp;&nbsp;&nbsp;&nbsp;';
        }
        // next
        if ($pos < $rowcount - $limit) {
            $cache['next'] = '&nbsp;&nbsp;&nbsp;<a class="' . $class_text . '" href="' . htmlspecialchars($short['next']) . '" style="text-decoration: none;">';
            if (!empty($img_next)) {
                if (preg_match('/\\</', $img_next)) {
                    // image tag
                    $cache['next'] .= $img_next;
                } else {
                    // image url
                    $cache['next'] .= '<img src="' . $img_next . '" />';
                }
            } else {
                $cache['next'] .= $txt_next;
            }
            $cache['next'] .= '</a>';
        } else {
            $cache['next'] = '&nbsp;&nbsp;&nbsp;&nbsp;';
        }
        // END prepare the prev and next string/image, make it a link...
        // -----------------------------------------------------------------------
        // START PRINTOUT
        if ($txt_pos == 'top') {
            $pager .= '<p style="text-align:center; text-decoration: none;">' . $cache['prev'] . $cache['next'] . '</p>' . "\n";
        }
        $pager .= '<p style="text-align:center" class="pager">';
        if ($txt_pos == 'side' and !empty($cache['prev'])) {
            $pager .= $cache['prev'];
        }
        foreach ($pages as $num => $url) {
            if ($num > $limit) {
                $pager .= ' ' . $separator . ' ';
            }
            if ($show == 'record') {
                // show record number for paging
                $tmp = $num;
            } else {
                // show page number for paging
                // [jorg] Fix: Pager starts at page 2 if displaying 1 item per page. Credits to na-oma
                // $tmp = floor($num/$limit) + 1;
                $tmp = ceil($num / $limit);
            }
            if ($num != $short['now']) {
                // Don't have a link to the current page
                $pager .= '<a class="' . $class_num . '" href="' . htmlspecialchars($url) . '">' . $tmp . '</a>';
            } else {
                $pager .= '<span class="' . $class_numon . '">' . $tmp . '</span>';
            }
        }
        if ($txt_pos == 'side' and !empty($cache['next'])) {
            $pager .= $cache['next'];
        }
        $pager .= '</p>' . "\n";
        // END NUMBERS
        // START PREVIOUS, NEXT paging
        if ($txt_pos == 'bottom') {
            $pager .= '<p style="text-align:center; text-decoration: none;">' . $cache['prev'] . $cache['next'] . '</p>' . "\n";
        }
        // END PREVIOUS, NEXT paging
    }
    // END DISPLAY
    return $pager;
}
Пример #14
0
/**
 *  $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;
}
Пример #15
0
function postcalendar_userapi_eventDetail($args, $admin = false)
{
    if (!(bool) PC_ACCESS_READ) {
        return _POSTCALENDARNOAUTH;
    }
    // get the theme globals :: is there a better way to do this?
    pnThemeLoad(pnUserGetTheme());
    global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5;
    global $textcolor1, $textcolor2;
    $popup = pnVarCleanFromInput('popup');
    extract($args);
    unset($args);
    if (!isset($cacheid)) {
        $cacheid = null;
    }
    if (!isset($eid)) {
        return false;
    }
    if (!isset($nopop)) {
        $nopop = false;
    }
    $uid = pnUserGetVar('uid');
    //=================================================================
    //  Find out what Template we're using
    //=================================================================
    $template_name = _SETTING_TEMPLATE;
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    //=================================================================
    //  Setup Smarty Template Engine
    //=================================================================
    $tpl = new pcSmarty();
    if ($admin) {
        $template = $template_name . '/admin/details.html';
        $args['cacheid'] = '';
        $print = 0;
        $Date =& postcalendar_getDate();
        $tpl->caching = false;
    } else {
        $template = $template_name . '/user/details.html';
    }
    if (!$tpl->is_cached($template, $cacheid)) {
        // let's get the DB information
        list($dbconn) = pnDBGetConn();
        $pntable = pnDBGetTables();
        // get the event's information
        $event =& postcalendar_userapi_pcGetEventDetails($eid);
        // if the above is false, it's a private event for another user
        // we should not diplay this - so we just exit gracefully
        if ($event === false) {
            return false;
        }
        //=================================================================
        //  get event's topic information
        //=================================================================
        $topics_table = $pntable['topics'];
        $topics_column = $pntable['topics_column'];
        $topicsql = "SELECT {$topics_column['topictext']},{$topics_column['topicimage']}\n                     FROM {$topics_table}\n                     WHERE {$topics_column['topicid']} = {$event['topic']}\n                     LIMIT 1";
        $topic_result = $dbconn->Execute($topicsql);
        list($event['topictext'], $event['topicimg']) = $topic_result->fields;
        $location = unserialize($event['location']);
        $event['location'] = $location['event_location'];
        $event['street1'] = $location['event_street1'];
        $event['street2'] = $location['event_street2'];
        $event['city'] = $location['event_city'];
        $event['state'] = $location['event_state'];
        $event['postal'] = $location['event_postal'];
        $event['date'] = str_replace('-', '', $Date);
        //=================================================================
        //  populate the template
        //=================================================================
        if (!empty($event['location']) || !empty($event['street1']) || !empty($event['street2']) || !empty($event['city']) || !empty($event['state']) || !empty($event['postal'])) {
            $tpl->assign('LOCATION_INFO', true);
        } else {
            $tpl->assign('LOCATION_INFO', false);
        }
        if (!empty($event['contname']) || !empty($event['contemail']) || !empty($event['conttel']) || !empty($event['website'])) {
            $tpl->assign('CONTACT_INFO', true);
        } else {
            $tpl->assign('CONTACT_INFO', false);
        }
        $display_type = substr($event['hometext'], 0, 6);
        if ($display_type == ':text:') {
            $prepFunction = 'pcVarPrepForDisplay';
            $event['hometext'] = substr($event['hometext'], 6);
        } elseif ($display_type == ':html:') {
            $prepFunction = 'pcVarPrepHTMLDisplay';
            $event['hometext'] = substr($event['hometext'], 6);
        } else {
            $prepFunction = 'pcVarPrepHTMLDisplay';
        }
        unset($display_type);
        // prep the vars for output
        $event['title'] =& $prepFunction($event['title']);
        $event['hometext'] =& $prepFunction($event['hometext']);
        $event['desc'] =& $event['hometext'];
        $event['conttel'] =& $prepFunction($event['conttel']);
        $event['contname'] =& $prepFunction($event['contname']);
        $event['contemail'] =& $prepFunction($event['contemail']);
        $event['website'] =& $prepFunction(postcalendar_makeValidURL($event['website']));
        $event['fee'] =& $prepFunction($event['fee']);
        $event['location'] =& $prepFunction($event['location']);
        $event['street1'] =& $prepFunction($event['street1']);
        $event['street2'] =& $prepFunction($event['street2']);
        $event['city'] =& $prepFunction($event['city']);
        $event['state'] =& $prepFunction($event['state']);
        $event['postal'] =& $prepFunction($event['postal']);
        $tpl->assign_by_ref('A_EVENT', $event);
        //=================================================================
        //  populate the template $ADMIN_OPTIONS
        //=================================================================
        $target = '';
        if (_SETTING_OPEN_NEW_WINDOW) {
            $target = 'target="csCalendar"';
        }
        $admin_edit_url = $admin_delete_url = '';
        if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADMIN)) {
            $admin_edit_url = pnModURL(__POSTCALENDAR__, 'admin', 'submit', array('pc_event_id' => $eid));
            $admin_delete_url = pnModURL(__POSTCALENDAR__, 'admin', 'adminevents', array('action' => _ACTION_DELETE, 'pc_event_id' => $eid));
        }
        $user_edit_url = $user_delete_url = '';
        if (pnUserLoggedIn()) {
            $logged_in_uname = $_SESSION['authUser'];
        } else {
            $logged_in_uname = '';
        }
        $can_edit = false;
        if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADD) && validateGroupStatus($logged_in_uname, getUsername($event['uname']))) {
            $user_edit_url = pnModURL(__POSTCALENDAR__, 'user', 'submit', array('pc_event_id' => $eid));
            $user_delete_url = pnModURL(__POSTCALENDAR__, 'user', 'delete', array('pc_event_id' => $eid));
            $can_edit = true;
        }
        $tpl->assign('STYLE', $GLOBALS['style']);
        $tpl->assign_by_ref('ADMIN_TARGET', $target);
        $tpl->assign_by_ref('ADMIN_EDIT', $admin_edit_url);
        $tpl->assign_by_ref('ADMIN_DELETE', $admin_delete_url);
        $tpl->assign_by_ref('USER_TARGET', $target);
        $tpl->assign_by_ref('USER_EDIT', $user_edit_url);
        $tpl->assign_by_ref('USER_DELETE', $user_delete_url);
        $tpl->assign_by_ref('USER_CAN_EDIT', $can_edit);
    }
    //=================================================================
    //  Parse the template
    //=================================================================
    if ($popup != 1 && $print != 1) {
        $output = "\n\n<!-- START POSTCALENDAR OUTPUT [-: HTTP://POSTCALENDAR.TV :-] -->\n\n";
        $output .= $tpl->fetch($template, $cacheid);
        $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";
        $tpl->display($template, $cacheid);
        echo postcalendar_footer();
        echo "\n</body></html>";
        session_write_close();
        exit;
    }
    return $output;
}
Пример #16
0
function Lenses_admin_update_company($args)
{
    // Clean input from the form.
    $company = pnVarCleanFromInput('company');
    // Extract any extra arguments.
    extract($args);
    // Confirm $authid hidden field from form template.
    if (!pnSecConfirmAuthKey()) {
        pnSessionSetVar('errormsg', pnVarPrepHTMLDisplay(_BADAUTHKEY));
        return pnRedirect(pnModURL('Lenses', 'admin', 'main'));
    }
    // Attempt to update company.
    if (pnModAPIFunc('Lenses', 'admin', 'update_company', array('company' => $company))) {
        pnSessionSetVar('statusmsg', pnVarPrepHTMLDisplay(_UPDATESUCCEDED));
    }
    // No output.  Redirect user.
    return pnRedirect(pnModURL('Lenses', 'admin', 'viewall_companies'));
}
Пример #17
0
/**
 * Display a block based on the current theme
 *
 */
function themesideblock($row)
{
    if (!isset($row['bid'])) {
        $row['bid'] = '';
    }
    if (!isset($row['title'])) {
        $row['title'] = '';
    }
    // check for collapsable menus being enabled, and setup the collapsable menu image.
    if (file_exists('themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/upb.gif')) {
        $upb = '<img src="themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/upb.gif" alt="" />';
    } else {
        $upb = '<img src="images/global/upb.gif" alt="" />';
    }
    if (file_exists('themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/downb.gif')) {
        $downb = '<img src="themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/downb.gif" alt="" />';
    } else {
        $downb = '<img src="images/global/downb.gif" alt="" />';
    }
    if (pnUserLoggedIn() && pnModGetVar('Blocks', 'collapseable') == 1 && isset($row['collapsable']) && $row['collapsable'] == '1') {
        if (pnCheckUserBlock($row) == '1') {
            if (!empty($row['title'])) {
                $row['minbox'] = '<a href="' . pnVarPrepForDisplay(pnModURL('Blocks', 'user', 'changestatus', array('bid' => $row['bid'], 'authid' => pnSecGenAuthKey()))) . '">' . $upb . '</a>';
            }
        } else {
            $row['content'] = '';
            if (!empty($row['title'])) {
                $row['minbox'] = '<a href="' . pnVarPrepForDisplay(pnModURL('Blocks', 'user', 'changestatus', array('bid' => $row['bid'], 'authid' => pnSecGenAuthKey()))) . '">' . $downb . '</a>';
            }
        }
    } else {
        $row['minbox'] = '';
    }
    // end collapseable menu config
    return themesidebox($row);
}
Пример #18
0
function Lenses_user_display($args)
{
    //Permission check.
    if (!pnSecAuthAction(0, 'Lenses::', '::', ACCESS_READ)) {
        return pnVarPrepHTMLDisplay(_MODULENOAUTH);
    }
    // Clean $tid from input.
    $tid = pnVarCleanFromInput('tid');
    extract($args);
    // Ensure valid values were passed in.
    if (empty($tid) || !is_numeric($tid)) {
        //echo 'TID: $tid<br />';
        pnSessionSetVar('errormsg', _MODARGSERROR);
        return false;
    }
    // Start a new output object.
    $pnRender =& new pnRender('Lenses');
    // Call API function to get all lens data.
    $lens_data = pnModAPIFunc('Lenses', 'user', 'get', array('item_type' => 'lens', 'item_id' => $tid));
    //the image field will be a comma-separated string.  Explode it.  The first element will be placed into the "image1" field and the rest will be kept in the images field
    $lens_data[images] = explode(",", $lens_data[image]);
    //record lens ID as a session variable so it can be used to provide an option to compare recently searched lenses
    $saved_lens_array = array();
    $saved_lens_array = pnSessionGetVar('saved_lens_array');
    $saved_lens_array[$lens_data[name]] = $tid;
    pnSessionSetVar('saved_lens_array', array_unique($saved_lens_array));
    //count how many recently searched lenses are now saved as a session variable.
    $saved_lens_count = count($saved_lens_array);
    //create text for company popups:
    $lens_data['comp_info'] = pnModFunc('Lenses', 'user', 'company_popup', array('comp_id' => $lens_data['comp_id']));
    //create popup text for FDA groups:
    $fda_desc = pnModAPIFunc('Lenses', 'user', 'fda_descriptions');
    $lens_data['fda_grp_desc'] = $fda_desc[$lens_data['fda_grp']];
    //if possible, create dk/t value
    if ($lens_data['dk'] > 0 && $lens_data['ct'] > 0) {
        $lens_data['dkt'] = $lens_data['dk'] / $lens_data['ct'] / 10;
    }
    // Let any hooks know that we are displaying an item.  As this is a display
    // hook we're passing a URL as the extra info, which is the URL that any
    // hooks will show after they have finished their own work.  It is normal
    // for that URL to bring the user back to this function
    $pnRender->assign('hooks', pnModCallHooks('item', 'display', $tid, pnModURL('Lenses', 'user', 'display', array('tid' => $tid))));
    //if user is allowed to edit, allow them to go to the edit page for the lens they're veiwing
    if (pnSecAuthAction(0, 'Lenses::', '::', ACCESS_EDIT)) {
        $pnRender->assign('edit_lens', true);
    }
    //only enable those with comment access (users) to see wholesale prices
    if (!pnSecAuthAction(0, 'Lenses::', '::', ACCESS_COMMENT)) {
        $lens_data['price'] = "";
    }
    // Assign $lenses to template.
    $pnRender->assign('lens_data', $lens_data);
    $pnRender->assign('saved_lens_count', $saved_lens_count);
    // return templated output.
    return $pnRender->fetch('lenses_user_display.htm');
}
Пример #19
0
function Meds_user_display($args)
{
    // Permission check.
    if (!pnSecAuthAction(0, 'Meds::', '::', ACCESS_READ)) {
        return pnVarPrepHTMLDisplay(_MODULENOTSUBSCRIBED);
    }
    // This is a flag to use in the template for
    // the purpose of displaying a go-back link.
    // This flag is needed because the go back link
    // is not needed when the user dialed in a med
    // and displayed it directly (ie, non-search)
    $search = pnVarCleanFromInput('search');
    // Get the object type and start number.
    $med_id = pnVarCleanFromInput('med_id');
    // Get medication from database.
    $med = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'med', 'med_id' => $med_id));
    // Check if medication could not be obtained.
    if (!$med) {
        return pnVarPrepHTMLDisplay(_NOSUCHITEM);
    }
    if (strpos($med['rxInfo'], "pdf/") === 0) {
        $med['rxInfo'] = "modules/Meds/pn" . $med['rxInfo'];
    }
    //print (strpos($med['rxInfo'], "pdf/"));
    //information used for popup windows. I'm sure there's a better way to do this but...
    $pregnancy = pnModAPIFunc('Meds', 'user', 'preg_descriptions');
    $schedules = pnModAPIFunc('Meds', 'user', 'sched_descriptions');
    if ($med['pres_id1']) {
        $pres_info1 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'preserve', 'pres_id' => $med['pres_id1']));
    }
    if ($med['pres_id2']) {
        $pres_info2 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'preserve', 'pres_id' => $med['pres_id2']));
    }
    $comp_info = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'company', 'comp_id' => $med['comp_id']));
    $comp_text = pnModFunc('Meds', 'user', 'company_popup', array('comp_info' => $comp_info));
    if ($med['moa_id1']) {
        $moa_info1 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id1']));
    }
    if ($med['moa_id2']) {
        $moa_info2 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id2']));
    }
    if ($med['moa_id3']) {
        $moa_info3 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id3']));
    }
    if ($med['moa_id4']) {
        $moa_info4 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id4']));
    }
    // Start a new output object.
    $pnRender =& new pnRender('Meds');
    // Assign medication's data to template.
    $pnRender->assign('med', $med);
    //assign popup info to templates
    $pnRender->assign('preg', $pregnancy[$med['preg']]);
    $pnRender->assign('sched', $schedules[$med['schedule']]);
    $pnRender->assign('comp_text', $comp_text);
    $pnRender->assign('preserve_info1', $pres_info1['comments']);
    $pnRender->assign('preserve_info2', $pres_info2['comments']);
    $pnRender->assign('moa_info1', $moa_info1['comments']);
    $pnRender->assign('moa_info2', $moa_info2['comments']);
    $pnRender->assign('moa_info3', $moa_info3['comments']);
    $pnRender->assign('moa_info4', $moa_info4['comments']);
    // Assign flag to template; for search back-links.
    if (!empty($search)) {
        $pnRender->assign('search', $search);
    }
    // Assign flag for admin permission capacity.
    $pnRender->assign('is_admin', pnSecAuthAction(0, 'Meds::', '::', ACCESS_ADMIN));
    // Let any hooks know that we are displaying an item.  As this is a display
    // hook we're passing a URL as the extra info, which is the URL that any
    // hooks will show after they have finished their own work.  It is normal
    // for that URL to bring the user back to this function
    $pnRender->assign('hooks', pnModCallHooks('item', 'display', $med_id, pnModURL('Meds', 'user', 'display', array('med_id' => $med_id))));
    // Get options for all dropdowns.  These are not used
    // for dropdowns here, but rather are used to help convert
    // the med's various ids back into meaning texts.
    $pnRender->assign(pnModAPIFunc('Meds', 'user', 'getall_selects'));
    // Return templated output.
    return $pnRender->fetch('meds_user_display.htm');
}
Пример #20
0
 *  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
 *
 */
/*******************************************************
    This file is for the old module load routine
    You can now link the module in a menu using the
    module name enclosed with brackets
    (ex: [PostCalendar])
 *******************************************************/
if (!defined("LOADED_AS_MODULE")) {
    echo 'You may not access this module directly';
} else {
    pnRedirect(pnModURL(pnVarCleanFromInput('name'), 'user', 'main'));
}
Пример #21
0
function mediashareUpdateAccess($args)
{
    if (!SecurityUtil::confirmAuthKey()) {
        return LogUtil::registerAuthidError();
    }
    $albumId = mediashareGetIntUrl('aid', $args, 1);
    if (!($groups = pnModAPIFunc('mediashare', 'edit', 'getAccessGroups'))) {
        return false;
    }
    $access = array();
    foreach ($groups as $group) {
        $accessView = FormUtil::getPassedValue('accessView' . $group['groupId']) != null;
        $accessEditAlbum = FormUtil::getPassedValue('accessEditAlbum' . $group['groupId']) != null;
        $accessEditMedia = FormUtil::getPassedValue('accessEditMedia' . $group['groupId']) != null;
        $accessAddAlbum = FormUtil::getPassedValue('accessAddAlbum' . $group['groupId']) != null;
        $accessAddMedia = FormUtil::getPassedValue('accessAddMedia' . $group['groupId']) != null;
        $access[] = array('groupId' => $group['groupId'], 'accessView' => $accessView, 'accessEditAlbum' => $accessEditAlbum, 'accessEditMedia' => $accessEditMedia, 'accessAddAlbum' => $accessAddAlbum, 'accessAddMedia' => $accessAddMedia);
    }
    if (!pnModAPIFunc('mediashare', 'edit', 'updateAccessSettings', array('albumId' => $albumId, 'access' => $access))) {
        return false;
    }
    return pnRedirect(pnModURL('mediashare', 'edit', 'view', array('aid' => $albumId)));
}
Пример #22
0
function mediashare_admin_onoffsources()
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (FormUtil::getPassedValue('id')) {
        if (!pnModAPIFunc('mediashare', 'sources', 'OnOffSources', array('id' => FormUtil::getPassedValue('id'), 'active' => FormUtil::getPassedValue('active')))) {
            return false;
        }
    }
    LogUtil::registerStatus(__('Done!', $dom));
    return pnRedirect(pnModURL('mediashare', 'admin', 'plugins'));
}
Пример #23
0
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();
}
Пример #24
0
function mediashare_invitation_open()
{
    $key = FormUtil::getPassedValue('inv');
    $result = pnModAPIFunc('mediashare', 'invitation', 'register', array('key' => $key));
    if ($result === false) {
        return false;
    } else {
        if (!$result['ok']) {
            return $result['message'];
        }
    }
    return pnRedirect(pnModURL('mediashare', 'user', 'view', array('aid' => $result['albumId'])));
}
Пример #25
0
/**
 * search events
 */
function postcalendar_user_search()
{
    if (!(bool) PC_ACCESS_OVERVIEW) {
        return _POSTCALENDARNOAUTH;
    }
    $tpl = new pcSmarty();
    $k = formData("pc_keywords", "R");
    //from library/formdata.inc.php
    $k_andor = pnVarCleanFromInput('pc_keywords_andor');
    $pc_category = pnVarCleanFromInput('pc_category');
    $pc_facility = pnVarCleanFromInput('pc_facility');
    $pc_topic = pnVarCleanFromInput('pc_topic');
    $submit = pnVarCleanFromInput('submit');
    $event_dur_hours = pnVarCleanFromInput('event_dur_hours');
    $event_dur_minutes = pnVarCleanFromInput('event_dur_minutes');
    $start = pnVarCleanFromInput('start');
    $end = pnVarCleanFromInput('end');
    // get list of categories for the user to choose from
    $categories = postcalendar_userapi_getCategories();
    $cat_options = '';
    foreach ($categories as $category) {
        $selected = "";
        if ($pc_category == $category[id]) {
            $selected = " SELECTED ";
        }
        //modified 8/09 by BM to allow translation if applicable
        $cat_options .= "<option value=\"{$category['id']}\" {$selected}>" . xl_appt_category($category[name]) . "</option>";
    }
    $tpl->assign_by_ref('CATEGORY_OPTIONS', $cat_options);
    $tpl->assign('event_dur_hours', $event_dur_hours);
    $tpl->assign('event_dur_minutes', $event_dur_minutes);
    // create default start and end dates for the search form
    if (isset($start) && $start != "") {
        $tpl->assign('DATE_START', $start);
    } else {
        $tpl->assign('DATE_START', date("m/d/Y"));
    }
    if (isset($end) && $end != "") {
        $tpl->assign('DATE_END', $end);
    } else {
        $tpl->assign('DATE_END', date("m/d/Y", strtotime("+7 Days", time())));
    }
    // then override the setting if we have a value from the submitted form
    $ProviderID = pnVarCleanFromInput("provider_id");
    if (is_numeric($ProviderID)) {
        $tpl->assign('ProviderID', $ProviderID);
    } elseif ($ProviderID == "_ALL_") {
    } else {
        $tpl->assign('ProviderID', "");
    }
    $provinfo = getProviderInfo();
    $tpl->assign('providers', $provinfo);
    // build a list of provider-options for the select box on the input form -- JRM
    $provider_options = "<option value='_ALL_' ";
    if ($ProviderID == "_ALL_") {
        $provider_options .= " SELECTED ";
    }
    $provider_options .= ">" . xl('All Providers') . "</option>";
    foreach ($provinfo as $provider) {
        $selected = "";
        // if we don't have a ProviderID chosen, pick the first one from the
        // pc_username Session variable
        if ($ProviderID == "") {
            // that variable stores the 'username' and not the numeric 'id'
            if ($_SESSION['pc_username'][0] == $provider['username']) {
                $selected = " SELECTED ";
            }
        } else {
            if ($ProviderID == $provider['id']) {
                $selected = " SELECTED ";
            }
        }
        $provider_options .= "<option value=\"" . $provider['id'] . "\" " . $selected . ">";
        $provider_options .= $provider['lname'] . ", " . $provider['fname'] . "</option>";
    }
    $tpl->assign_by_ref('PROVIDER_OPTIONS', $provider_options);
    // build a list of facility options for the select box on the input form -- JRM
    $facilities = getFacilities();
    $fac_options = "<option value=''>" . xl('All Facilities') . "</option>";
    foreach ($facilities as $facility) {
        $selected = "";
        if ($facility['id'] == $pc_facility) {
            $selected = " SELECTED ";
        }
        $fac_options .= "<option value=\"" . $facility['id'] . "\" " . $selected . ">";
        $fac_options .= $facility['name'] . "</option>";
    }
    $tpl->assign_by_ref('FACILITY_OPTIONS', $fac_options);
    $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)));
    } else {
        $tpl->assign('PatientList', getPatientPID(array('limit' => $plistlimit)));
    }
    $event_endday = pnVarCleanFromInput("event_endday");
    $event_endmonth = pnVarCleanFromInput("event_endmonth");
    $event_endyear = pnVarCleanFromInput("event_endyear");
    $event_startday = pnVarCleanFromInput("event_startday");
    $event_startmonth = pnVarCleanFromInput("event_startmonth");
    $event_startyear = pnVarCleanFromInput("event_startyear");
    if ($event_startday > $event_endday) {
        $event_endday = $event_startday;
    }
    if ($event_startmonth > $event_endmonth) {
        $event_endmonth = $event_startmonth;
    }
    if ($event_startyear > $event_endyear) {
        $event_endyear = $event_startyear;
    }
    $tpl->assign('patient_id', $PatientID);
    $tpl->assign('provider_id', $ProviderID);
    $tpl->assign("event_category", pnVarCleanFromInput("event_category"));
    $tpl->assign("event_subject", pnVarCleanFromInput("event_subject"));
    $output = new pnHTML();
    $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);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata .= $output->FormSelectMultiple('event_startmonth', $sel_data);
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata = $output->FormSelectMultiple('event_startmonth', $sel_data);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata .= $output->FormSelectMultiple('event_startday', $sel_data);
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_startyear));
    $formdata .= $output->FormSelectMultiple('event_startyear', $sel_data);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectDateTimeStart', $formdata);
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    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);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata .= $output->FormSelectMultiple('event_endmonth', $sel_data);
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata = $output->FormSelectMultiple('event_endmonth', $sel_data);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata .= $output->FormSelectMultiple('event_endday', $sel_data);
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_endyear));
    $formdata .= $output->FormSelectMultiple('event_endyear', $sel_data);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectDateTimeEnd', $formdata);
    $output = null;
    if (_SETTING_DISPLAY_TOPICS) {
        $topics = postcalendar_userapi_getTopics();
        $top_options = '';
        foreach ($topics as $topic) {
            $top_options .= "<option value=\"{$topic['id']}\">{$topic['text']}</option>";
        }
        $tpl->assign_by_ref('TOPIC_OPTIONS', $top_options);
    }
    //=================================================================
    //  Find out what Template we're using
    //=================================================================
    $template_name = _SETTING_TEMPLATE;
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    //=================================================================
    //  Output the search form
    //=================================================================
    $tpl->assign('FORM_ACTION', pnModURL(__POSTCALENDAR__, 'user', 'search'));
    //=================================================================
    //  Perform the search if we have data
    //=================================================================
    if (!empty($submit) && strtolower($submit) == "find first") {
        // not sure how we get here...
        $searchargs = array();
        $searchargs['start'] = pnVarCleanFromInput("event_startmonth") . "/" . pnVarCleanFromInput("event_startday") . "/" . pnVarCleanFromInput("event_startyear");
        $searchargs['end'] = pnVarCleanFromInput("event_endmonth") . "/" . pnVarCleanFromInput("event_endday") . "/" . pnVarCleanFromInput("event_endyear");
        $searchargs['provider_id'] = pnVarCleanFromInput("provider_id");
        $searchargs['faFlag'] = true;
        //print_r($searchargs);
        //echo "<br />";
        //set defaults to current week if empty
        if ($searchargs['start'] == "//") {
            $searchargs['start'] = date("m/d/Y");
        }
        if ($searchargs['end'] == "//") {
            $searchargs['end'] = date("m/d/Y", strtotime("+7 Days", strtotime($searchargs['start'])));
        }
        //print_r($searchargs);
        $eventsByDate =& postcalendar_userapi_pcGetEvents($searchargs);
        //print_r($eventsByDate);
        $found = findFirstAvailable($eventsByDate);
        $tpl->assign('available_times', $found);
        //print_r($_POST);
        $tpl->assign('SEARCH_PERFORMED', true);
        $tpl->assign('A_EVENTS', $eventsByDate);
    }
    if (!empty($submit) && strtolower($submit) == "listapps") {
        // not sure how we get here...
        $searchargs = array();
        $searchargs['start'] = date("m/d/Y");
        $searchargs['end'] = date("m/d/Y", strtotime("+1 year", strtotime($searchargs['start'])));
        $searchargs['patient_id'] = pnVarCleanFromInput("patient_id");
        $searchargs['listappsFlag'] = true;
        $sqlKeywords .= "(a.pc_pid = '" . pnVarCleanFromInput("patient_id") . "' )";
        $searchargs['s_keywords'] = $sqlKeywords;
        //print_r($searchargs);
        $eventsByDate =& postcalendar_userapi_pcGetEvents($searchargs);
        //print_r($eventsByDate);
        $tpl->assign('appointments', $eventsByDate);
        //print_r($_POST);
        $tpl->assign('SEARCH_PERFORMED', true);
        $tpl->assign('A_EVENTS', $eventsByDate);
    } elseif (!empty($submit)) {
        // we get here by searching via the PostCalendar search
        $sqlKeywords = '';
        $keywords = explode(' ', $k);
        // build our search query
        foreach ($keywords as $word) {
            if (!empty($sqlKeywords)) {
                $sqlKeywords .= " {$k_andor} ";
            }
            $sqlKeywords .= '(';
            $sqlKeywords .= "pd.lname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "pd.fname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "u.lname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "u.fname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "a.pc_title LIKE '%{$word}%' OR ";
            $sqlKeywords .= "a.pc_hometext LIKE '%{$word}%' OR ";
            $sqlKeywords .= "a.pc_location LIKE '%{$word}%'";
            $sqlKeywords .= ') ';
        }
        if (!empty($pc_category)) {
            $s_category = "a.pc_catid = '{$pc_category}'";
        }
        if (!empty($pc_topic)) {
            $s_topic = "a.pc_topic = '{$pc_topic}'";
        }
        $searchargs = array();
        if (!empty($sqlKeywords)) {
            $searchargs['s_keywords'] = $sqlKeywords;
        }
        if (!empty($s_category)) {
            $searchargs['s_category'] = $s_category;
        }
        if (!empty($s_topic)) {
            $searchargs['s_topic'] = $s_topic;
        }
        // some new search parameters introduced in the ajax_search form...  JRM March 2008
        // the ajax_search form has form parameters for 'start' and 'end' already built in
        // so use them if available
        $tmpDate = pnVarCleanFromInput("start");
        if (isset($tmpDate) && $tmpDate != "") {
            $searchargs['start'] = pnVarCleanFromInput("start");
        } else {
            $searchargs['start'] = "//";
        }
        $tmpDate = pnVarCleanFromInput("end");
        if (isset($tmpDate) && $tmpDate != "") {
            $searchargs['end'] = pnVarCleanFromInput("end");
        } else {
            $searchargs['end'] = "//";
        }
        // we can limit our search by provider -- JRM March 2008
        if (isset($ProviderID) && $ProviderID != "") {
            // && $ProviderID != "_ALL_") {
            $searchargs['provider_id'] = array();
            array_push($searchargs['provider_id'], $ProviderID);
        }
        $eventsByDate =& postcalendar_userapi_pcGetEvents($searchargs);
        // we can limit our search by facility -- JRM March 2008
        if (isset($pc_facility) && $pc_facility != "") {
            $searchargs['pc_facility'] = $pc_facility;
        }
        //print_r($eventsByDate);
        $tpl->assign('SEARCH_PERFORMED', true);
        $tpl->assign('A_EVENTS', $eventsByDate);
    }
    $tpl->caching = false;
    $tpl->assign('STYLE', $GLOBALS['style']);
    $pageSetup =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'pageSetup');
    if (pnVarCleanFromInput("no_nav") == 1) {
        $return = $pageSetup . $tpl->fetch($template_name . '/user/findfirst.html');
    } elseif (pnVarCleanFromInput("no_nav") == 2) {
        $return = $pageSetup . $tpl->fetch($template_name . '/user/listapps.html');
    } else {
        $return = $pageSetup . $tpl->fetch($template_name . '/user/search.html');
    }
    return $return;
}
Пример #26
0
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 {
    echo "<strong>" . _ERROR404_MAILSUBJECT . "</strong><br /><br />\n";
    echo _ERROR404_FUNTEXT;
}
function send_email()
{
    $adminmail = pnConfigGetVar('adminmail');
    $subject = "" . _ERROR404_MAILSUBJECT . "";
    $sitename = pnConfigGetVar('sitename');
    $remote_addr = pnServerGetVar('REMOTE_ADDR');
    $http_referer = pnServerGetVar('HTTP_REFERER');
    $redirect_url = pnServerGetVar('REDIRECT_URL');
    $server = pnServerGetVar('HTTP_HOST');
    $errordoc = "http://{$server}{$redirect_url}";
Пример #27
0
     * the datepicker DIV
     */
    var ChangeDate = function(eObj) {
        baseURL = "<?php 
echo pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => $viewtype, 'Date' => '~REPLACEME~', 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
?>
";
        newURL = baseURL.replace(/~REPLACEME~/, eObj.id);
        document.location.href=newURL;
    }

    /* pop up a window to print the current view
     */
    var PrintView = function (eventObject) {
        printURL = "<?php 
echo pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => $viewtype, 'Date' => $Date, 'print' => 1, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
?>
";
        window.open(printURL,'printwindow','width=740,height=480,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=yes');
        return false;
    }

    /* change the provider(s)
     */
    var ChangeProviders = function (eventObject) {
        $('#theform').submit();
    }

    /* change the calendar view
     */
    var ChangeView = function (eventObject) {
Пример #28
0
function postcalendar_adminapi_buildAdminList($args)
{
    extract($args);
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    pnThemeLoad(pnUserGetTheme());
    // get the theme globals :: is there a better way to do this?
    global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5;
    global $textcolor1, $textcolor2;
    $formUrl = pnModUrl(__POSTCALENDAR__, 'admin', 'adminevents');
    $output->FormStart($formUrl);
    $output->Text('<table border="0" cellpadding="1" cellspacing="0" width="100%" bgcolor="' . $bgcolor2 . '"><tr><td>');
    $output->Text('<table border="0" cellpadding="5" cellspacing="0" width="100%" bgcolor="' . $bgcolor1 . '"><tr><td>');
    $output->Text('<center><font size="4"><b>' . $title . '</b></font></center>');
    $output->Text('</td></tr></table>');
    $output->Text('</td></tr></table>');
    $output->Linebreak();
    $output->Text('<table border="0" cellpadding="1" cellspacing="0" width="100%" bgcolor="' . $bgcolor2 . '"><tr><td>');
    $output->Text('<table border="0" cellpadding="5" cellspacing="0" width="100%" bgcolor="' . $bgcolor1 . '">');
    if (!$result || $result->EOF) {
        $output->Text('<tr><td width="100%" bgcolor="' . $bgcolor1 . '" align="center"><b>' . _PC_NO_EVENTS . '</b></td></tr>');
    } else {
        $output->Text('<tr><td bgcolor="' . $bgcolor1 . '" align="center"><b>' . _PC_EVENTS . '</b></td></tr>');
        $output->Text('<table border="0" cellpadding="2" cellspacing="0" width="100%" bgcolor="' . $bgcolor1 . '">');
        // build sorting urls
        if (!isset($sdir)) {
            $sdir = 1;
        } else {
            $sdir = $sdir ? 0 : 1;
        }
        $title_sort_url = pnModUrl(__POSTCALENDAR__, 'admin', $function, array('offset' => $offset, 'sort' => 'title', 'sdir' => $sdir));
        $time_sort_url = pnModUrl(__POSTCALENDAR__, 'admin', $function, array('offset' => $offset, 'sort' => 'time', 'sdir' => $sdir));
        $output->Text('<tr><td>select</td><td><a href="' . $title_sort_url . '">title</a></td><td><a href="' . $time_sort_url . '">timestamp</a><td></tr>');
        // output the queued events
        $count = 0;
        for (; !$result->EOF; $result->MoveNext()) {
            list($eid, $title, $timestamp) = $result->fields;
            $output->Text('<tr>');
            $output->Text('<td align="center" valign="top">');
            $output->FormCheckbox('pc_event_id[]', false, $eid);
            $output->Text('</td>');
            $output->Text('<td  align="left" valign="top" width="100%">');
            $output->URL(pnModURL(__POSTCALENDAR__, 'admin', 'edit', array('pc_event_id' => $eid)), pnVarPrepHTMLDisplay(postcalendar_removeScriptTags($title)));
            $output->Text('</td>');
            $output->Text('<td  align="left" valign="top" nowrap>');
            $output->Text($timestamp);
            $output->Text('</td>');
            $output->Text('</tr>');
            $count++;
        }
        $output->Text('</table>');
    }
    $output->Text('</td></tr></table>');
    if ($result->NumRows()) {
        $output->Linebreak();
        // action to take?
        $output->Text('<table border="0" cellpadding="1" cellspacing="0" width="100%" bgcolor="' . $bgcolor2 . '"><tr><td>');
        $output->Text('<table border="0" cellpadding="5" cellspacing="0" width="100%" bgcolor="' . $bgcolor1 . '"><tr>');
        $output->Text('<td align="left" valign="middle">');
        $seldata[0]['id'] = _ADMIN_ACTION_VIEW;
        $seldata[0]['selected'] = 1;
        $seldata[0]['name'] = _PC_ADMIN_ACTION_VIEW;
        $seldata[1]['id'] = _ADMIN_ACTION_APPROVE;
        $seldata[1]['selected'] = 0;
        $seldata[1]['name'] = _PC_ADMIN_ACTION_APPROVE;
        $seldata[2]['id'] = _ADMIN_ACTION_HIDE;
        $seldata[2]['selected'] = 0;
        $seldata[2]['name'] = _PC_ADMIN_ACTION_HIDE;
        $seldata[3]['id'] = _ADMIN_ACTION_DELETE;
        $seldata[3]['selected'] = 0;
        $seldata[3]['name'] = _PC_ADMIN_ACTION_DELETE;
        $output->FormSelectMultiple('action', $seldata);
        $output->FormHidden('thelist', $function);
        $output->FormSubmit(_PC_PERFORM_ACTION);
        $output->Text('</td>');
        $output->Text('</tr></table>');
        $output->Text('</td></tr></table>');
        $output->Linebreak();
        // start previous next links
        $output->Text('<table border="0" cellpadding="1" cellspacing="0" width="100%" bgcolor="' . $bgcolor2 . '"><tr><td>');
        $output->Text('<table border="0" cellpadding="5" cellspacing="0" width="100%" bgcolor="' . $bgcolor1 . '"><tr>');
        if ($offset > 1) {
            $output->Text('<td align="left">');
            $next_link = pnModUrl(__POSTCALENDAR__, 'admin', $function, array('offset' => $offset - $offset_increment, 'sort' => $sort, 'sdir' => $sdir));
            $output->Text('<a href="' . $next_link . '"><< ' . _PC_PREV . ' ' . $offset_increment . '</a>');
            $output->Text('</td>');
        } else {
            $output->Text('<td align="left"><< ' . _PC_PREV . '</td>');
        }
        if ($result->NumRows() >= $offset_increment) {
            $output->Text('<td align="right">');
            $next_link = pnModUrl(__POSTCALENDAR__, 'admin', $function, array('offset' => $offset + $offset_increment, 'sort' => $sort, 'sdir' => $sdir));
            $output->Text('<a href="' . $next_link . '">' . _PC_NEXT . ' ' . $offset_increment . ' >></a>');
            $output->Text('</td>');
        } else {
            $output->Text('<td align="right">' . _PC_NEXT . ' >></td>');
        }
        $output->Text('</tr></table>');
    }
    $output->Text('</td></tr></table>');
    // end previous next links
    $output->FormEnd();
    return $output->GetOutput();
}
Пример #29
0
    exit;
} else {
    if (!pnModAvailable($module) || !pnSecAuthAction(0, "{$module}::", '::', ACCESS_EDIT)) {
        // 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
Пример #30
0
function modules_adminmenu()
{
    $output = new pnHTML();
    if (!pnSecAuthAction(0, 'Modules::', '::', ACCESS_ADMIN)) {
        $output->Text(_MODULESNOAUTH);
        return $output->GetOutput();
    }
    $output->Text(pnGetStatusMsg());
    $output->Linebreak(2);
    $output->TableStart(_MODULES);
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $columns = array();
    $columns[] = $output->URL(pnVarPrepForDisplay(pnModURL('Modules', 'admin', 'list')), _LIST);
    $columns[] = $output->URL(pnVarPrepForDisplay(pnModURL('Modules', 'admin', 'regenerate', array('authid' => pnSecGenAuthKey()))), _REGENERATE);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddRow($columns);
    $output->SetInputMode(_PNH_PARSEINPUT);
    $output->TableEnd();
    return $output->GetOutput();
}