Example #1
0
/**
 *    postcalendar_userapi_buildSubmitForm()
 *    create event submit form
 */
function postcalendar_userapi_buildSubmitForm($args, $admin = false)
{
    $_SESSION['category'] = "";
    if (!PC_ACCESS_ADD) {
        return _POSTCALENDARNOAUTH;
    }
    extract($args);
    unset($args);
    //since we seem to clobber category
    $cat = $category;
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    // set up Smarty
    $tpl = new pcSmarty();
    $tpl->caching = false;
    $template_name = pnModGetVar(__POSTCALENDAR__, 'pcTemplate');
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    //=================================================================
    //  Setup the correct config file path for the templates
    //=================================================================
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $modir = pnVarPrepForOS($modinfo['directory']);
    $modname = $modinfo['displayname'];
    $all_categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    //print_r($all_categories);
    unset($modinfo);
    $tpl->config_dir = "modules/{$modir}/pntemplates/{$template_name}/config/";
    //=================================================================
    //  PARSE MAIN
    //=================================================================
    $tpl->assign('webroot', $GLOBALS['web_root']);
    $tpl->assign_by_ref('TPL_NAME', $template_name);
    $tpl->assign('FUNCTION', pnVarCleanFromInput('func'));
    $tpl->assign_by_ref('ModuleName', $modname);
    $tpl->assign_by_ref('ModuleDirectory', $modir);
    $tpl->assign_by_ref('category', $all_categories);
    $tpl->assign('NewEventHeader', _PC_NEW_EVENT_HEADER);
    $tpl->assign('EventTitle', _PC_EVENT_TITLE);
    $tpl->assign('Required', _PC_REQUIRED);
    $tpl->assign('DateTimeTitle', _PC_DATE_TIME);
    $tpl->assign('AlldayEventTitle', _PC_ALLDAY_EVENT);
    $tpl->assign('TimedEventTitle', _PC_TIMED_EVENT);
    $tpl->assign('TimedDurationTitle', _PC_TIMED_DURATION);
    $tpl->assign('TimedDurationHoursTitle', _PC_TIMED_DURATION_HOURS);
    $tpl->assign('TimedDurationMinutesTitle', _PC_TIMED_DURATION_MINUTES);
    $tpl->assign('EventDescTitle', _PC_EVENT_DESC);
    //the double book variable comes from the eventdata array that is
    //passed here and extracted, injection is not an issue here
    if (is_numeric($double_book)) {
        $tpl->assign('double_book', $double_book);
    }
    //pennfirm begin patient info handling
    $ProviderID = pnVarCleanFromInput("provider_id");
    if (is_numeric($ProviderID)) {
        $tpl->assign('ProviderID', $ProviderID);
        $tpl->assign('provider_id', $ProviderID);
    } elseif (is_numeric($event_userid) && $event_userid != 0) {
        $tpl->assign('ProviderID', $event_userid);
        $tpl->assign('provider_id', $event_userid);
    } else {
        if ($_SESSION['userauthorized'] == 1) {
            $tpl->assign('ProviderID', $_SESSION['authUserID']);
        } else {
            $tpl->assign('ProviderID', "");
        }
    }
    $provinfo = getProviderInfo();
    $tpl->assign('providers', $provinfo);
    $PatientID = pnVarCleanFromInput("patient_id");
    // limit the number of results returned by getPatientPID
    // this helps to prevent the server from stalling on a request with
    // no PID and thousands of PIDs in the database -- JRM
    // the function getPatientPID($pid, $given, $orderby, $limit, $start) <-- defined in library/patient.inc
    $plistlimit = 500;
    if (is_numeric($PatientID)) {
        $tpl->assign('PatientList', getPatientPID(array('pid' => $PatientID, 'limit' => $plistlimit)));
    } elseif (is_numeric($event_pid)) {
        $tpl->assign('PatientList', getPatientPID(array('pid' => $event_pid, 'limit' => $plistlimit)));
    } else {
        $tpl->assign('PatientList', getPatientPID(array('limit' => $plistlimit)));
    }
    $tpl->assign('event_pid', $event_pid);
    $tpl->assign('event_aid', $event_aid);
    $tpl->assign('event_category', pnVarCleanFromInput("event_category"));
    if (empty($event_patient_name)) {
        $patient_data = getPatientData($event_pid, $given = "lname, fname");
        $event_patient_name = $patient_data['lname'] . ", " . $patient_data['fname'];
    }
    $tpl->assign('patient_value', $event_patient_name);
    //=================================================================
    //  PARSE INPUT_EVENT_TITLE
    //=================================================================
    $tpl->assign('InputEventTitle', 'event_subject');
    $tpl->assign('ValueEventTitle', pnVarPrepForDisplay($event_subject));
    //=================================================================
    //  PARSE SELECT_DATE_TIME
    //=================================================================
    // It seems that with Mozilla at least, <select> fields that are disabled
    // do not get passed as form data.  Therefore we ignore $double_book so
    // that the fields will not be disabled.  -- Rod 2005-03-22
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata = $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata .= $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, '');
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata = $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata .= $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, '');
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_startyear));
    $formdata .= $output->FormSelectMultiple('event_startyear', $sel_data, 0, 1, "", "", false, '');
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectDateTime', $formdata);
    $tpl->assign('InputAllday', 'event_allday');
    $tpl->assign('ValueAllday', '1');
    $tpl->assign('SelectedAllday', $event_allday == 1 ? 'checked' : '');
    $tpl->assign('InputTimed', 'event_allday');
    $tpl->assign('ValueTimed', '0');
    $tpl->assign('SelectedTimed', $event_allday == 0 ? 'checked' : '');
    $tpl->assign('STYLE', $GLOBALS['style']);
    //=================================================================
    //  PARSE SELECT_END_DATE_TIME
    //=================================================================
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    //if there is no end date we want the box to read todays date instead of jan 01 1994 :)
    if ($event_endmonth == 0 && $event_endday == 0 && $event_endyear == 0) {
        $event_endmonth = $month;
        $event_endday = $day;
        $event_endyear = $year;
    }
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata = $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata .= $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata = $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata .= $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_endyear));
    $formdata .= $output->FormSelectMultiple('event_endyear', $sel_data, 0, 1, "", "", false, '');
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectEndDate', $formdata);
    //=================================================================
    //  PARSE SELECT_TIMED_EVENT
    //=================================================================
    $stimes = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildTimeSelect', array('hselected' => $event_starttimeh, 'mselected' => $event_starttimem));
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $timed_hours = $output->FormSelectMultiple('event_starttimeh', $stimes['h'], 0, 1, "", "", false, '');
    $timed_minutes = $output->FormSelectMultiple('event_starttimem', $stimes['m'], 0, 1, "", "", false, '');
    if (!_SETTING_TIME_24HOUR) {
        $ampm = array();
        $ampm[0]['id'] = pnVarPrepForStore(_AM_VAL);
        $ampm[0]['name'] = pnVarPrepForDisplay(_PC_AM);
        $ampm[1]['id'] = pnVarPrepForStore(_PM_VAL);
        $ampm[1]['name'] = pnVarPrepForDisplay(_PC_PM);
        if ($event_startampm == "AM" || $event_startampm == _AM_VAL) {
            $ampm[0]['selected'] = 1;
        } else {
            $ampm[1]['selected'] = 1;
        }
        $timed_ampm = $output->FormSelectMultiple('event_startampm', $ampm, 0, 1, "", "", false, '');
    } else {
        $timed_ampm = '';
    }
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectTimedHours', $timed_hours);
    $tpl->assign('SelectTimedMinutes', $timed_minutes);
    $tpl->assign('SelectTimedAMPM', $timed_ampm);
    $tpl->assign('event_startday', $event_startday);
    $tpl->assign('event_startmonth', $event_startmonth);
    $tpl->assign('event_startyear', $event_startyear);
    $tpl->assign('event_starttimeh', $event_starttimeh);
    $tpl->assign('event_starttimem', $event_starttimem);
    $tpl->assign('event_startampm', $event_startampm);
    $tpl->assign('event_dur_hours', $event_dur_hours);
    $tpl->assign('event_dur_minutes', $event_dur_minutes);
    //=================================================================
    //  PARSE SELECT_DURATION
    //=================================================================
    $event_dur_hours = (int) $event_dur_hours;
    for ($i = 0; $i <= 24; $i += 1) {
        $TimedDurationHours[$i] = array('value' => $i, 'selected' => $event_dur_hours == $i ? 'selected' : '', 'name' => sprintf('%02d', $i));
    }
    $tpl->assign('TimedDurationHours', $TimedDurationHours);
    $tpl->assign('InputTimedDurationHours', 'event_dur_hours');
    $found_time = false;
    for ($i = 0; $i < 60; $i += _SETTING_TIME_INCREMENT) {
        $TimedDurationMinutes[$i] = array('value' => $i, 'selected' => $event_dur_minutes == $i ? 'selected' : '', 'name' => sprintf('%02d', $i));
        if ($TimedDurationMinutes[$i]['selected'] == 'selected') {
            $found_time = true;
        }
    }
    if (!$found_time) {
        $TimedDurationMinutes[$i] = array('value' => $event_dur_minutes, 'selected' => 'selected', 'name' => sprintf('%02d', $event_dur_minutes));
    }
    $tpl->assign('TimedDurationMinutes', $TimedDurationMinutes);
    $tpl->assign('hidden_event_dur_minutes', $event_dur_minutes);
    $tpl->assign('InputTimedDurationMinutes', 'event_dur_minutes');
    //=================================================================
    //  PARSE INPUT_EVENT_DESC
    //=================================================================
    $tpl->assign('InputEventDesc', 'event_desc');
    if (empty($pc_html_or_text)) {
        $display_type = substr($event_desc, 0, 6);
        if ($display_type == ':text:') {
            $pc_html_or_text = 'text';
            $event_desc = substr($event_desc, 6);
        } elseif ($display_type == ':html:') {
            $pc_html_or_text = 'html';
            $event_desc = substr($event_desc, 6);
        } else {
            $pc_html_or_text = 'text';
        }
        unset($display_type);
    }
    $tpl->assign('ValueEventDesc', pnVarPrepForDisplay($event_desc));
    $eventHTMLorText = "<select name=\"pc_html_or_text\">";
    if ($pc_html_or_text == 'text') {
        $eventHTMLorText .= "<option value=\"text\" selected=\"selected\">" . _PC_SUBMIT_TEXT . "</option>";
    } else {
        $eventHTMLorText .= "<option value=\"text\">" . _PC_SUBMIT_TEXT . "</option>";
    }
    if ($pc_html_or_text == 'html') {
        $eventHTMLorText .= "<option value=\"html\" selected=\"selected\">" . _PC_SUBMIT_HTML . "</option>";
    } else {
        $eventHTMLorText .= "<option value=\"html\">" . _PC_SUBMIT_HTML . "</option>";
    }
    $eventHTMLorText .= "</select>";
    $tpl->assign('EventHTMLorText', $eventHTMLorText);
    //=================================================================
    //  PARSE select_event_topic_block
    //=================================================================
    $tpl->assign('displayTopics', _SETTING_DISPLAY_TOPICS);
    if ((bool) _SETTING_DISPLAY_TOPICS) {
        $a_topics =& postcalendar_userapi_getTopics();
        $topics = array();
        foreach ($a_topics as $topic) {
            array_push($topics, array('value' => $topic['id'], 'selected' => $topic['id'] == $event_topic ? 'selected' : '', 'name' => $topic['text']));
        }
        unset($a_topics);
        // only show this if we have topics to show
        if (count($topics) > 0) {
            $tpl->assign('topics', $topics);
            $tpl->assign('EventTopicTitle', _PC_EVENT_TOPIC);
            $tpl->assign('InputEventTopic', 'event_topic');
        }
    }
    //=================================================================
    //  PARSE select_event_type_block
    //=================================================================
    $categories = array();
    foreach ($all_categories as $category) {
        array_push($categories, array('value' => $category['id'], 'selected' => $category['id'] == $event_category ? 'selected' : '', 'name' => $category['name'], 'color' => $category['color'], 'desc' => $category['desc']));
    }
    // only show this if we have categories to show
    // you should ALWAYS have at least one valid category
    if (count($categories) > 0) {
        $tpl->assign('categories', $categories);
        $tpl->assign('EventCategoriesTitle', _PC_EVENT_CATEGORY);
        $tpl->assign('InputEventCategory', 'event_category');
        $tpl->assign('hidden_event_category', $event_category);
    }
    //=================================================================
    //  PARSE event_sharing_block
    //=================================================================
    $data = array();
    if (_SETTING_ALLOW_USER_CAL) {
        array_push($data, array(SHARING_PRIVATE, _PC_SHARE_PRIVATE));
        array_push($data, array(SHARING_PUBLIC, _PC_SHARE_PUBLIC));
        array_push($data, array(SHARING_BUSY, _PC_SHARE_SHOWBUSY));
    }
    if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADMIN) || _SETTING_ALLOW_GLOBAL || !_SETTING_ALLOW_USER_CAL) {
        array_push($data, array(SHARING_GLOBAL, _PC_SHARE_GLOBAL));
    }
    $sharing = array();
    foreach ($data as $cell) {
        array_push($sharing, array('value' => $cell[0], 'selected' => (int) $event_sharing == $cell[0] ? 'selected' : '', 'name' => $cell[1]));
    }
    //pennfirm get list of providers from openemr code in calendar.inc
    $tpl->assign("user", getCalendarProviderInfo());
    $tpl->assign('sharing', $sharing);
    $tpl->assign('EventSharingTitle', _PC_SHARING);
    $tpl->assign('InputEventSharing', 'event_sharing');
    //=================================================================
    //  location information
    //=================================================================
    $tpl->assign('EventLocationTitle', _PC_EVENT_LOCATION);
    $tpl->assign('InputLocation', 'event_location');
    $tpl->assign('ValueLocation', pnVarPrepForDisplay($event_location));
    $tpl->assign('EventStreetTitle', _PC_EVENT_STREET);
    $tpl->assign('InputStreet1', 'event_street1');
    $tpl->assign('ValueStreet1', pnVarPrepForDisplay($event_street1));
    $tpl->assign('InputStreet2', 'event_street2');
    $tpl->assign('ValueStreet2', pnVarPrepForDisplay($event_street2));
    $tpl->assign('EventCityTitle', _PC_EVENT_CITY);
    $tpl->assign('InputCity', 'event_city');
    $tpl->assign('ValueCity', pnVarPrepForDisplay($event_city));
    $tpl->assign('EventStateTitle', _PC_EVENT_STATE);
    $tpl->assign('InputState', 'event_state');
    $tpl->assign('ValueState', pnVarPrepForDisplay($event_state));
    $tpl->assign('EventPostalTitle', _PC_EVENT_POSTAL);
    $tpl->assign('InputPostal', 'event_postal');
    $tpl->assign('ValuePostal', pnVarPrepForDisplay($event_postal));
    //=================================================================
    //  contact information
    //=================================================================
    $tpl->assign('EventContactTitle', _PC_EVENT_CONTACT);
    $tpl->assign('InputContact', 'event_contname');
    $tpl->assign('ValueContact', pnVarPrepForDisplay($event_contname));
    $tpl->assign('EventPhoneTitle', _PC_EVENT_PHONE);
    $tpl->assign('InputPhone', 'event_conttel');
    $tpl->assign('ValuePhone', pnVarPrepForDisplay($event_conttel));
    $tpl->assign('EventEmailTitle', _PC_EVENT_EMAIL);
    $tpl->assign('InputEmail', 'event_contemail');
    $tpl->assign('ValueEmail', pnVarPrepForDisplay($event_contemail));
    $tpl->assign('EventWebsiteTitle', _PC_EVENT_WEBSITE);
    $tpl->assign('InputWebsite', 'event_website');
    $tpl->assign('ValueWebsite', pnVarPrepForDisplay($event_website));
    $tpl->assign('EventFeeTitle', _PC_EVENT_FEE);
    $tpl->assign('InputFee', 'event_fee');
    $tpl->assign('ValueFee', pnVarPrepForDisplay($event_fee));
    //=================================================================
    //  Repeating Information
    //=================================================================
    $tpl->assign('RepeatingHeader', _PC_REPEATING_HEADER);
    $tpl->assign('NoRepeatTitle', _PC_NO_REPEAT);
    $tpl->assign('RepeatTitle', _PC_REPEAT);
    $tpl->assign('RepeatOnTitle', _PC_REPEAT_ON);
    $tpl->assign('OfTheMonthTitle', _PC_OF_THE_MONTH);
    $tpl->assign('EndDateTitle', _PC_END_DATE);
    $tpl->assign('NoEndDateTitle', _PC_NO_END);
    $tpl->assign('InputNoRepeat', 'event_repeat');
    $tpl->assign('ValueNoRepeat', '0');
    $tpl->assign('SelectedNoRepeat', (int) $event_repeat == 0 ? 'checked' : '');
    $tpl->assign('InputRepeat', 'event_repeat');
    $tpl->assign('ValueRepeat', '1');
    $tpl->assign('SelectedRepeat', (int) $event_repeat == 1 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY, _PC_EVERY_OTHER, _PC_EVERY_THIRD, _PC_EVERY_FOURTH);
    $keys = array(REPEAT_EVERY, REPEAT_EVERY_OTHER, REPEAT_EVERY_THIRD, REPEAT_EVERY_FOURTH);
    $repeat_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreq', 'event_repeat_freq');
    if (empty($event_repeat_freq) || $event_repeat_freq < 1) {
        $event_repeat_freq = 1;
    }
    $tpl->assign('InputRepeatFreqVal', $event_repeat_freq);
    $tpl->assign('repeat_freq', $repeat_freq);
    unset($in);
    $in = array(_PC_EVERY_DAY, _PC_EVERY_WORKDAY, _PC_EVERY_WEEK, _PC_EVERY_MONTH, _PC_EVERY_YEAR);
    $keys = array(REPEAT_EVERY_DAY, REPEAT_EVERY_WORK_DAY, REPEAT_EVERY_WEEK, REPEAT_EVERY_MONTH, REPEAT_EVERY_YEAR);
    $repeat_freq_type = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq_type, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq_type ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreqType', 'event_repeat_freq_type');
    $tpl->assign('repeat_freq_type', $repeat_freq_type);
    $tpl->assign('InputRepeatOn', 'event_repeat');
    $tpl->assign('ValueRepeatOn', '2');
    $tpl->assign('SelectedRepeatOn', (int) $event_repeat == 2 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY_1ST, _PC_EVERY_2ND, _PC_EVERY_3RD, _PC_EVERY_4TH, _PC_EVERY_LAST);
    $keys = array(REPEAT_ON_1ST, REPEAT_ON_2ND, REPEAT_ON_3RD, REPEAT_ON_4TH, REPEAT_ON_LAST);
    $repeat_on_num = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_num, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_num ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnNum', 'event_repeat_on_num');
    $tpl->assign('repeat_on_num', $repeat_on_num);
    unset($in);
    $in = array(_PC_EVERY_SUN, _PC_EVERY_MON, _PC_EVERY_TUE, _PC_EVERY_WED, _PC_EVERY_THU, _PC_EVERY_FRI, _PC_EVERY_SAT);
    $keys = array(REPEAT_ON_SUN, REPEAT_ON_MON, REPEAT_ON_TUE, REPEAT_ON_WED, REPEAT_ON_THU, REPEAT_ON_FRI, REPEAT_ON_SAT);
    $repeat_on_day = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_day, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_day ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnDay', 'event_repeat_on_day');
    $tpl->assign('repeat_on_day', $repeat_on_day);
    unset($in);
    $in = array(_PC_OF_EVERY_MONTH, _PC_OF_EVERY_2MONTH, _PC_OF_EVERY_3MONTH, _PC_OF_EVERY_4MONTH, _PC_OF_EVERY_6MONTH, _PC_OF_EVERY_YEAR);
    $keys = array(REPEAT_ON_MONTH, REPEAT_ON_2MONTH, REPEAT_ON_3MONTH, REPEAT_ON_4MONTH, REPEAT_ON_6MONTH, REPEAT_ON_YEAR);
    $repeat_on_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnFreq', 'event_repeat_on_freq');
    if (empty($event_repeat_on_freq) || $event_repeat_on_freq < 1) {
        $event_repeat_on_freq = 1;
    }
    $tpl->assign('InputRepeatOnFreqVal', $event_repeat_on_freq);
    $tpl->assign('repeat_on_freq', $repeat_on_freq);
    $tpl->assign('MonthsTitle', _PC_MONTHS);
    //=================================================================
    //  PARSE INPUT_END_DATE
    //=================================================================
    $tpl->assign('InputEndOn', 'event_endtype');
    $tpl->assign('ValueEndOn', '1');
    $tpl->assign('SelectedEndOn', (int) $event_endtype == 1 ? 'checked' : '');
    //=================================================================
    //  PARSE INPUT_NO_END
    //=================================================================
    $tpl->assign('InputNoEnd', 'event_endtype');
    $tpl->assign('ValueNoEnd', '0');
    $tpl->assign('SelectedNoEnd', (int) $event_endtype == 0 ? 'checked' : '');
    $qstring = preg_replace("/provider_id=[0-9]*[&]{0,1}/", "", $_SERVER['QUERY_STRING']);
    $tpl->assign('qstring', $qstring);
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $authkey = $output->FormHidden('authid', pnSecGenAuthKey());
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $form_hidden = "<input type=\"hidden\" name=\"is_update\" value=\"{$is_update}\" />";
    $form_hidden .= "<input type=\"hidden\" name=\"pc_event_id\" value=\"{$pc_event_id}\" />";
    $form_hidden .= "<input type=\"hidden\" name=\"category\" value=\"{$cat}\" />";
    if (isset($data_loaded)) {
        $form_hidden .= "<input type=\"hidden\" name=\"data_loaded\" value=\"{$data_loaded}\" />";
        $tpl->assign('FormHidden', $form_hidden);
    }
    $form_submit = '<input type=hidden name="form_action" value="commit"/>
                   ' . $authkey . '<input type="submit" name="submit" value="go">';
    $tpl->assign('FormSubmit', $form_submit);
    // do not cache this page
    if ($admin) {
        $output->Text($tpl->fetch($template_name . '/admin/submit.html'));
    } elseif (pnVarCleanFromInput("no_nav") == 1) {
        $output->Text($tpl->fetch($template_name . '/user/submit_no_nav.html'));
    } else {
        $output->Text($tpl->fetch($template_name . '/user/submit.html'));
    }
    $output->Text(postcalendar_footer());
    return $output->GetOutput();
}
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();
}
Example #3
0
function postcalendar_admin_categoryDetail($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';
    }
    //=================================================================
    //  Setup the correct config file path for the templates
    //=================================================================
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $modir = pnVarPrepForOS($modinfo['directory']);
    $modname = $modinfo['displayname'];
    $all_categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    $all_details =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCatDetails');
    unset($modinfo);
    $tpl->config_dir = "modules/{$modir}/pntemplates/{$template_name}/config/";
    //=================================================================
    //  PARSE MAIN
    //=================================================================
    $tpl->assign_by_ref('TPL_NAME', $template_name);
    $tpl->assign('FUNCTION', pnVarCleanFromInput('func'));
    $tpl->assign_by_ref('ModuleName', $modname);
    $tpl->assign_by_ref('ModuleDirectory', $modir);
    $tpl->assign('Category', "Category");
    $tpl->assign_by_ref('categories', $all_categories);
    //=================================================================
    //  Repeating Information
    //=================================================================
    $tpl->assign('RepeatingHeader', _PC_REPEATING_HEADER);
    $tpl->assign('NoRepeatTitle', _PC_NO_REPEAT);
    $tpl->assign('RepeatTitle', _PC_REPEAT);
    $tpl->assign('RepeatOnTitle', _PC_REPEAT_ON);
    $tpl->assign('OfTheMonthTitle', _PC_OF_THE_MONTH);
    $tpl->assign('EndDateTitle', _PC_END_DATE);
    $tpl->assign('NoEndDateTitle', _PC_NO_END);
    $tpl->assign('InputNoRepeat', 'event_repeat');
    $tpl->assign('ValueNoRepeat', '0');
    $tpl->assign('SelectedNoRepeat', (int) $event_repeat == 0 ? 'checked' : '');
    $tpl->assign('InputRepeat', 'event_repeat');
    $tpl->assign('ValueRepeat', '1');
    $tpl->assign('SelectedRepeat', (int) $event_repeat == 1 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY, _PC_EVERY_OTHER, _PC_EVERY_THIRD, _PC_EVERY_FOURTH);
    $keys = array(REPEAT_EVERY, REPEAT_EVERY_OTHER, REPEAT_EVERY_THIRD, REPEAT_EVERY_FOURTH);
    $repeat_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreq', 'event_repeat_freq');
    if (empty($event_repeat_freq) || $event_repeat_freq < 1) {
        $event_repeat_freq = 1;
    }
    $tpl->assign('InputRepeatFreqVal', $event_repeat_freq);
    $tpl->assign('repeat_freq', $repeat_freq);
    unset($in);
    $in = array(_PC_EVERY_DAY, _PC_EVERY_WORKDAY, _PC_EVERY_WEEK, _PC_EVERY_MONTH, _PC_EVERY_YEAR);
    $keys = array(REPEAT_EVERY_DAY, REPEAT_EVERY_WORK_DAY, REPEAT_EVERY_WEEK, REPEAT_EVERY_MONTH, REPEAT_EVERY_YEAR);
    $repeat_freq_type = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq_type, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq_type ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreqType', 'event_repeat_freq_type');
    $tpl->assign('repeat_freq_type', $repeat_freq_type);
    $tpl->assign('InputRepeatOn', 'event_repeat');
    $tpl->assign('ValueRepeatOn', '2');
    $tpl->assign('SelectedRepeatOn', (int) $event_repeat == 2 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY_1ST, _PC_EVERY_2ND, _PC_EVERY_3RD, _PC_EVERY_4TH, _PC_EVERY_LAST);
    $keys = array(REPEAT_ON_1ST, REPEAT_ON_2ND, REPEAT_ON_3RD, REPEAT_ON_4TH, REPEAT_ON_LAST);
    $repeat_on_num = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_num, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_num ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnNum', 'event_repeat_on_num');
    $tpl->assign('repeat_on_num', $repeat_on_num);
    unset($in);
    $in = array(_PC_EVERY_SUN, _PC_EVERY_MON, _PC_EVERY_TUE, _PC_EVERY_WED, _PC_EVERY_THU, _PC_EVERY_FRI, _PC_EVERY_SAT);
    $keys = array(REPEAT_ON_SUN, REPEAT_ON_MON, REPEAT_ON_TUE, REPEAT_ON_WED, REPEAT_ON_THU, REPEAT_ON_FRI, REPEAT_ON_SAT);
    $repeat_on_day = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_day, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_day ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnDay', 'event_repeat_on_day');
    $tpl->assign('repeat_on_day', $repeat_on_day);
    unset($in);
    $in = array(_PC_OF_EVERY_MONTH, _PC_OF_EVERY_2MONTH, _PC_OF_EVERY_3MONTH, _PC_OF_EVERY_4MONTH, _PC_OF_EVERY_6MONTH, _PC_OF_EVERY_YEAR);
    $keys = array(REPEAT_ON_MONTH, REPEAT_ON_2MONTH, REPEAT_ON_3MONTH, REPEAT_ON_4MONTH, REPEAT_ON_6MONTH, REPEAT_ON_YEAR);
    $repeat_on_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnFreq', 'event_repeat_on_freq');
    if (empty($event_repeat_on_freq) || $event_repeat_on_freq < 1) {
        $event_repeat_on_freq = 1;
    }
    $tpl->assign('InputRepeatOnFreqVal', $event_repeat_on_freq);
    $tpl->assign('repeat_on_freq', $repeat_on_freq);
    $tpl->assign('MonthsTitle', _PC_MONTHS);
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $authkey = $output->FormHidden('authid', pnSecGenAuthKey());
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $form_hidden = "<input type=\"hidden\" name=\"is_update\" value=\"{$is_update}\" />";
    $form_hidden .= "<input type=\"hidden\" name=\"pc_event_id\" value=\"{$pc_event_id}\" />";
    if (isset($data_loaded)) {
        $form_hidden .= "<input type=\"hidden\" name=\"data_loaded\" value=\"{$data_loaded}\" />";
        $tpl->assign('FormHidden', $form_hidden);
    }
    $form_submit = '<input type=hidden name="form_action" value="commit"/>
				   ' . $authkey . '<input type="submit" name="submit" value="go">';
    $tpl->assign('FormSubmit', $form_submit);
    $output->Text($tpl->fetch($template_name . '/admin/submit_detail.html'));
    $output->Text(postcalendar_footer());
    return $output->GetOutput();
}
Example #4
0
 /**
  * composite function for generic confirmation of action
  *
  * @param string $confirm_text Confirmation message to display
  * @param string $confirm_url URL to go to if confirm button is clicked
  * @param string $cancel_text Link text cor the cancel message
  * @param string $cancel_url URL to go to is action is canceled
  * @param array $arg An array of args to create hidden fields for
  *
  * @access public
  */
 function ConfirmAction($confirm_text, $confirm_url, $cancel_text, $cancel_url, $arg = array())
 {
     $compoutput = new pnHTML();
     $compoutput->FormStart($confirm_url);
     $compoutput->Text($confirm_text);
     $compoutput->Linebreak(2);
     $arg['confirm'] = 1;
     $arg['authid'] = pnSecGenAuthKey();
     $arg['confirmation'] = 1;
     $compoutput->FormHidden($arg);
     $compoutput->FormSubmit(_CONFIRM);
     $compoutput->Linebreak(2);
     $compoutput->URL($cancel_url, $cancel_text);
     $compoutput->FormEnd();
     if ($this->GetOutputMode() == _PNH_RETURNOUTPUT) {
         $compoutput->SetOutputMode(_PNH_RETURNOUTPUT);
         return $compoutput->PrintPage();
     } else {
         $compoutput->SetOutputMode(_PNH_RETURNOUTPUT);
         $this->output .= $compoutput->GetOutput();
     }
 }
/**
 * 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);
}
Example #6
0
function modifyGroup()
{
    $module = pnVarCleanFromInput('module');
    $gid = pnVarCleanFromInput('gid');
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $groupstable = $pntable['groups'];
    $groupscolumn =& $pntable['groups_column'];
    include "header.php";
    GraphicAdmin();
    $query = "SELECT {$groupscolumn['name']}\n              FROM {$groupstable}\n              WHERE {$groupscolumn['gid']}='" . (int) pnVarPrepForStore($gid) . "'";
    $result = $dbconn->Execute($query);
    if ($result->EOF) {
        die("No such group ID {$gid}");
    }
    list($gname) = $result->fields;
    $result->Close();
    // Heading
    OpenTable();
    echo "<CENTER><A HREF=\"admin.php?module=" . $module . "&amp;op=secviewgroups\" CLASS=\"pn-title\"><FONT SIZE=\"4\"<B>" . _GROUPADMIN . "</B></FONT></A><font class=\"pn-normal\">: " . pnVarPrepForDisplay($gname) . "</font></CENTER>";
    echo "<br>";
    if (!pnSecAuthAction(0, 'Groups::', "{$gname}::{$gid}", ACCESS_EDIT)) {
        CloseTable();
        echo _GROUPSEDITNOAUTH;
        include 'footer.php';
        return;
    }
    echo "<form action=\"admin.php\" method=\"post\">" . "<input type=\"hidden\" name=\"module\" value=\"" . $module . "\">" . "<input type=\"hidden\" name=\"op\" value=\"secrenamegroup\">" . "<input type=\"hidden\" name=\"gid\" value=\"{$gid}\">" . "<input type=\"hidden\" name=\"authid\" value=\"" . pnSecGenAuthKey() . "\">" . _GROUPNAME . ": <input type=\"text\" name=\"gname\" value=\"{$gname}\"><P>" . "<input type=submit value=\"" . _RENAMEGROUP . "\">" . "</form>";
    if (pnSecAuthAction(0, 'Groups::', "{$gname}::{$gid}", ACCESS_DELETE)) {
        echo "<FORM ACTION=\"admin.php\" METHOD=\"POST\">" . "<input type=\"hidden\" name=\"module\" value=\"" . $module . "\">" . "<INPUT TYPE=\"HIDDEN\" NAME=\"op\" VALUE=\"secdeletegroup\">" . "<input type=\"hidden\" NAME=\"gid\" VALUE=\"{$gid}\">" . '<input type="hidden" name="authid" value="' . pnSecGenAuthKey() . '">' . '<input type="submit" value="' . _DELETE . '">' . '</form>';
    } else {
        echo "<TD>&nbsp;</TD>";
    }
    CloseTable();
    include "footer.php";
}
Example #7
0
function deletemsg()
{
    list($mid, $ok) = pnVarCleanFromInput('mid', 'ok');
    if (!isset($ok)) {
        $ok = 0;
    }
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $column =& $pntable['message_column'];
    $result = $dbconn->Execute("SELECT {$column['title']}\n                                FROM {$pntable['message']}\n                                WHERE {$column['mid']} = '" . pnVarPrepForStore($mid) . "'");
    list($title) = $result->fields;
    $result->Close();
    if (!pnSecAuthAction(0, 'Messages::', "{$title}::{$mid}", ACCESS_DELETE)) {
        include 'header.php';
        echo _MESSAGESDELNOAUTH;
        include 'footer.php';
        return;
    }
    if ($ok) {
        if (!pnSecConfirmAuthKey()) {
            include 'header.php';
            echo _BADAUTHKEY;
            include 'footer.php';
            return;
        }
        $result = $dbconn->Execute("DELETE FROM {$pntable['message']}\n                                    WHERE {$column['mid']}='" . pnVarPrepForStore($mid) . "'");
        if ($dbconn->ErrorNo() != 0) {
            error_log("Error: " . $dbconn->ErrorMsg());
            echo $dbconn->ErrorNo() . ": " . $dbconn->ErrorMsg() . "<br>";
            return;
        }
        pnRedirect('admin.php?module=' . $GLOBALS['module'] . '&op=messages');
    } else {
        include "header.php";
        GraphicAdmin();
        OpenTable();
        echo "<center><font class=\"pn-title\"><b>" . _MESSAGESADMIN . "</b></font></center>";
        CloseTable();
        OpenTable();
        echo "<center><font class=\"pn-normal\">" . _REMOVEMSG . " <b>{$mid} </font></b>";
        echo "<table><tr><td>\n";
        echo myTextForm("admin.php?module=" . $GLOBALS['module'] . "&op=messages", _NO);
        echo "</td><td>\n";
        echo myTextForm("admin.php?module=" . $GLOBALS['module'] . "&op=deletemsg&amp;mid={$mid}&amp;ok=1&amp;authid=" . pnSecGenAuthKey(), _YES);
        echo "</td></tr></table>\n";
        echo "</center>\n";
        CloseTable();
        include "footer.php";
    }
}
Example #8
0
function referers_admin_getConfig()
{
    include "header.php";
    // prepare vars
    $sel_httpref['0'] = '';
    $sel_httpref['1'] = '';
    $sel_httpref[pnConfigGetVar('httpref')] = ' checked';
    $sel_httprefmax['100'] = '';
    $sel_httprefmax['250'] = '';
    $sel_httprefmax['500'] = '';
    $sel_httprefmax['1000'] = '';
    $sel_httprefmax['2000'] = '';
    $sel_httprefmax[pnConfigGetVar('httprefmax')] = ' selected';
    GraphicAdmin();
    OpenTable();
    print '<center><font size="3" class="pn-title"><b>' . _REFERERSCONF . '</b></font></center><br />' . '<form action="admin.php" method="post">' . '<table border="0"><tr><td class="pn-normal">' . _ACTIVATEHTTPREF . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xhttpref\" value=\"1\" class=\"pn-normal\"" . $sel_httpref['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xhttpref\" value=\"0\" class=\"pn-normal\"" . $sel_httpref['0'] . ">" . _NO . '</td></tr><tr><td class="pn-normal">' . _MAXREF . '</td><td>' . '<select name="xhttprefmax" size="1" class="pn-normal">' . "<option value=\"100\"" . $sel_httprefmax['100'] . ">100</option>\n" . "<option value=\"250\"" . $sel_httprefmax['250'] . ">250</option>\n" . "<option value=\"500\"" . $sel_httprefmax['500'] . ">500</option>\n" . "<option value=\"1000\"" . $sel_httprefmax['1000'] . ">1000</option>\n" . "<option value=\"1000\"" . $sel_httprefmax['2000'] . ">2000</option>\n" . '</select>' . '</td></tr></table>' . "<input type=\"hidden\" name=\"module\" value=\"" . $GLOBALS['module'] . "\">" . "<input type=\"hidden\" name=\"authid\" value=\"" . pnSecGenAuthKey() . "\">" . "<input type=\"hidden\" name=\"op\" value=\"setConfig\">" . "<input type=\"submit\" value=\"" . _SUBMIT . "\">" . "</form>";
    CloseTable();
    include "footer.php";
}
Example #9
0
function admin_main_article()
{
    $bgcolor1 = $GLOBALS["bgcolor1"];
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $admart = pnConfigGetVar('admart');
    if (pnSecAuthAction(0, 'Stories::Story', '::', ACCESS_EDIT)) {
        OpenTable();
        echo '<center><b><font class=\\"pn-normal\\">' . _LAST . ' ' . pnVarPrepForDisplay($admart) . ' ' . _ARTICLES . '</font></b></center>' . "\n" . '<br>' . "\n" . '<table border="1" width="100%" bgcolor="' . $bgcolor1 . '">';
        $storiescolumn =& $pntable['stories_column'];
        $topicscolumn =& $pntable['topics_column'];
        if (strcmp(pnConfigGetVar('dbtype'), 'oci8') == 0) {
            $myquery = "SELECT {$storiescolumn['sid']},\n                               {$storiescolumn['cid']},\n                               {$storiescolumn['aid']},\n                               {$storiescolumn['title']},\n                               {$storiescolumn['time']},\n                               {$storiescolumn['topic']},\n                               {$storiescolumn['informant']},\n                               {$storiescolumn['alanguage']},\n                               {$topicscolumn['topicname']}\n                        FROM {$pntable['stories']}, {$pntable['topics']}\n                        WHERE  {$storiescolumn['topic']}={$topicscolumn['topicid']}(+)\n                        ORDER BY  {$storiescolumn['time']} DESC LIMIT {$admart}";
        } else {
            $myquery = "SELECT {$storiescolumn['sid']},\n                               {$storiescolumn['cid']},\n                               {$storiescolumn['aid']},\n                               {$storiescolumn['title']},\n                               {$storiescolumn['time']},\n                               {$storiescolumn['topic']},\n                               {$storiescolumn['informant']},\n                               {$storiescolumn['alanguage']},\n                               {$topicscolumn['topicname']}\n                        FROM {$pntable['stories']}\n                        LEFT JOIN {$pntable['topics']} ON {$storiescolumn['topic']}={$topicscolumn['topicid']}\n                        ORDER BY  {$storiescolumn['time']} DESC LIMIT {$admart}";
        }
        $result = $dbconn->Execute($myquery);
        while (list($sid, $cid, $said, $title, $time, $topic, $informant, $alanguage, $topicname) = $result->fields) {
            if ($alanguage == '') {
                $alanguage = 'x_all';
            }
            formatTimestamp($time);
            if ($title == "") {
                $title = '- No title -';
            }
            echo '<tr>' . "\n" . '<td align="right"><b>' . pnVarPrepForDisplay($sid) . '</b></td>' . '<td align="left" width="100%"><a href="modules.php?op=modload&amp;name=News&amp;file=article&amp;sid=' . $sid . '">' . pnVarPrepForDisplay($title) . '</a></td>' . "\n" . '<td align="center">' . language_name($alanguage) . '</td>' . "\n" . '<td align="right" nowrap>' . pnVarPrepForDisplay($topicname) . '</td>' . "\n";
            if ($cid == 0) {
                // Default category
                $cattitle = "" . _ARTICLES . "";
            } else {
                $catcolumn =& $pntable['stories_cat_column'];
                $catquery = buildSimpleQuery('stories_cat', array('title'), "{$catcolumn['catid']} = {$cid}");
                $catresult = $dbconn->Execute($catquery);
                list($cattitle) = $catresult->fields;
            }
            if (pnSecAuthAction(0, 'Stories::Story', "{$said}:{$cattitle}:", ACCESS_EDIT)) {
                echo '<td align="right" nowrap>(<a href="admin.php?module=NS-AddStory&amp;op=EditStory&amp;sid=' . $sid . '">' . _EDIT . '</a>';
                if (pnSecAuthAction(0, 'Stories::Story', "{$said}:{$cattitle}:", ACCESS_DELETE)) {
                    echo '-<a href="admin.php?module=NS-AddStory&amp;op=RemoveStory&amp;sid=' . $sid . '">' . _DELETE . '</a>' . "\n";
                }
                echo ')</td>';
            } else {
                echo '<td>&nbsp;</td>';
            }
            echo '</tr>' . "\n";
            $result->MoveNext();
        }
        echo '</table>' . "\n";
        if (pnSecAuthAction(0, 'Stories::Story', '::', ACCESS_EDIT)) {
            echo '<center>' . "\n" . '<form action="admin.php" method="post">' . "\n" . '<input type="hidden" name="module" value="NS-AddStory">' . "\n" . _STORYID . ': <input type="text" NAME="sid" SIZE="10">' . "\n" . '<select name="op">' . "\n" . '<option value="EditStory" SELECTED>' . _EDIT . '</option>' . "\n";
            if (pnSecAuthAction(0, 'Stories::Story', '::', ACCESS_DELETE)) {
                echo '<option value="RemoveStory">' . _DELETE . '</option>' . "\n";
            }
            echo '</select>' . "\n" . '<input type="hidden" name="authid" value="' . pnSecGenAuthKey() . '">' . '<input type="submit" value="' . _GO . '">' . "\n" . '</form>' . "\n" . '</center>' . "\n";
        }
        CloseTable();
    }
}
function themesideblock($row)
{
    global $postnuke_theme, $pntheme;
    if (!isset($row['bid'])) {
        $row['bid'] = '';
    }
    if (!isset($row['title'])) {
        $row['title'] = '';
    }
    // check for collapseable menus being enabled.
    if (pnModGetVar('Blocks', 'collapseable') == 1) {
        if (pnUserLoggedIn()) {
            if (checkuserblock($row) == '1') {
                if (!empty($row['title'])) {
                    $row['title'] .= " <a href=\"modules.php?op=modload&amp;name=Blocks&amp;file=index&amp;req=ChangeStatus&amp;bid={$row['bid']}&amp;authid=" . pnSecGenAuthKey() . "\"><img src=\"images/global/upb.gif\" border=\"0\" alt=\"\"></a>";
                }
            } else {
                $row['content'] = '';
                if (!empty($row['title'])) {
                    $row['title'] .= " <a href=\"modules.php?op=modload&amp;name=Blocks&amp;file=index&amp;req=ChangeStatus&amp;bid={$row['bid']}&amp;authid=" . pnSecGenAuthKey() . "\"><img src=\"images/global/downb.gif\" border=\"0\" alt=\"\"></a>";
                }
            }
        }
    }
    // end collapseable menu config
    if ($postnuke_theme || $pntheme['support_blocks2']) {
        return themesidebox($row);
    } else {
        return themesidebox($row['title'], $row['content']);
    }
}
Example #11
0
function user_admin_getRegConfig()
{
    include "header.php";
    // prepare vars
    $sel_reg_uniemail['0'] = '';
    $sel_reg_uniemail['1'] = '';
    $sel_reg_uniemail[pnConfigGetVar('reg_uniemail')] = ' checked';
    $sel_reg_optitems['0'] = '';
    $sel_reg_optitems['1'] = '';
    $sel_reg_optitems[pnConfigGetVar('reg_optitems')] = ' checked';
    $sel_reg_allowreg['0'] = '';
    $sel_reg_allowreg['1'] = '';
    $sel_reg_allowreg[pnConfigGetVar('reg_allowreg')] = ' checked';
    $sel_reg_verifyemail['0'] = '';
    $sel_reg_verifyemail['1'] = '';
    $sel_reg_verifyemail[pnConfigGetVar('reg_verifyemail')] = ' checked';
    $sel_minpass['3'] = '';
    $sel_minpass['5'] = '';
    $sel_minpass['8'] = '';
    $sel_minpass['10'] = '';
    $sel_minpass[pnConfigGetVar('minpass')] = ' selected';
    GraphicAdmin();
    OpenTable();
    print '<center><font size="3" class="pn-title"><b>' . _REGCONF . '</b></font></center><br>' . '<form action="admin.php" method="post">' . '<table border="0"><tr><td class="pn-normal">' . _UNIEMAIL . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xreg_uniemail\" value=\"1\" class=\"pn-normal\"" . $sel_reg_uniemail['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xreg_uniemail\" value=\"0\" class=\"pn-normal\"" . $sel_reg_uniemail['0'] . ">" . _NO . " &nbsp;" . _UNIEMAILDESC . "\n" . '</td></tr><tr><td class="pn-normal">' . _OPTITEMS . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xreg_optitems\" value=\"1\" class=\"pn-normal\"" . $sel_reg_optitems['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xreg_optitems\" value=\"0\" class=\"pn-normal\"" . $sel_reg_optitems['0'] . ">" . _NO . " &nbsp;" . _OPTITEMSDESC . "\n" . '</td></tr><tr><td class="pn-normal" valign="top">' . _ALLOWREG . ' </td><td class="pn-normal">' . "<input type=\"radio\" name=\"xreg_allowreg\" value=\"1\" class=\"pn-normal\"" . $sel_reg_allowreg['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xreg_allowreg\" value=\"0\" class=\"pn-normal\"" . $sel_reg_allowreg['0'] . ">" . _NO . " &nbsp;<br>\n" . _IFNO . "<br>&nbsp;&nbsp;&nbsp;<textarea name=\"xreg_noregreasons\" cols=\"80\" rows=\"10\">" . pnConfigGetVar('reg_noregreasons') . "</textarea>" . '</td></tr><tr><td class="pn-normal">' . _VERIFYEMAIL . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xreg_verifyemail\" value=\"1\" class=\"pn-normal\"" . $sel_reg_verifyemail['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xreg_verifyemail\" value=\"0\" class=\"pn-normal\"" . $sel_reg_verifyemail['0'] . ">" . _NO . " &nbsp;" . _PASSBYMAIL . "\n" . "</td></tr><tr><td class=\"pn-normal\">" . _NOTIFYEMAIL . "</td><td class=\"pn-normal\">" . "<input type=\"text\" name=\"xreg_notifyemail\" value=\"" . pnConfigGetVar('reg_notifyemail') . "\" size=\"20\" maxlength=\"200\" class=\"pn-normal\">" . _NOTIFYEMAILDESC . "\n" . "</td></tr><tr><td class=\"pn-normal\">" . _ILLEGALUNAME . "</td><td class=\"pn-normal\">" . "<input type=\"text\" name=\"xreg_Illegalusername\" value=\"" . pnConfigGetVar('reg_Illegalusername') . "\" size=\"20\" class=\"pn-normal\">" . _ILLEGALUNAMEDESC . "\n" . '</td></tr><tr><td class="pn-normal">' . _MINAGE . "</td><td class=\"pn-normal\"><input type=\"text\" name=\"xminage\" value=\"" . pnConfigGetVar('minage') . "\" size=\"2\" maxlength=\"2\" class=\"pn-normal\"> " . _MINAGEDESCR . "\n" . '</td></tr><tr><td class="pn-normal">' . _PASSWDLEN . '</td><td>' . '<select name="xminpass" size="1" class="pn-normal">' . "<option value=\"3\"" . $sel_minpass['3'] . ">3</option>\n" . "<option value=\"5\"" . $sel_minpass['5'] . ">5</option>\n" . "<option value=\"8\"" . $sel_minpass['8'] . ">8</option>\n" . "<option value=\"10\"" . $sel_minpass['10'] . ">10</option>\n" . '</select>' . '</td></tr></table>' . "<input type=\"hidden\" name=\"module\" value=\"" . $GLOBALS['module'] . "\">" . "<input type=\"hidden\" name=\"op\" value=\"setRegConfig\">" . "<input type=\"hidden\" name=\"authid\" value=\"" . pnSecGenAuthKey() . "\">" . "<input type=\"submit\" value=\"" . _SUBMIT . "\">" . "</form>";
    CloseTable();
    include "footer.php";
}
Example #12
0
function dplink_adminmenu()
{
    $theme = pnUserGetTheme();
    pnThemeLoad($theme);
    // Create output object
    $output = new pnHTML();
    // Security check
    if (!pnSecAuthAction(0, 'dplink::', '::', ACCESS_ADMIN)) {
        $output->Text(pnVarPrepHTMLDisplay(_SHIMLINKNOAUTH));
        return $output->GetOutput();
    }
    //Title
    ob_start();
    OpenTable();
    $oTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($oTable);
    $output->Title(pnVarPrepHTMLDisplay('<b>' . _SHIMLINK . '</b>'));
    $output->Text(pnVarPrepHTMLDisplay(_SHIMLINKMODIFYCONFIG));
    ob_start();
    CloseTable();
    $cTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($cTable);
    // Start form
    $output->FormStart(pnModURL('dplink', 'admin', 'updateconfig'));
    // Add an authorisation ID
    $output->FormHidden('authid', pnSecGenAuthKey());
    // Start the table that holds the information to be modified.
    ob_start();
    OpenTable();
    $oTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($oTable);
    $output->TableStart();
    // dplink location
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODSUBJECT));
    $row[] = $output->FormText('url', pnModGetVar('dplink', 'url'), 50, 50);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    // Warning
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODWARNING));
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    // Use I-frame
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODWRAP));
    $row[] = $output->FormCheckbox('use_wrap', pnModGetVar('dplink', 'use_wrap'));
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    // Open in New >Window
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODWINDOW));
    $row[] = $output->FormCheckbox('use_window', pnModGetVar('dplink', 'use_window'));
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    $output->TableEnd();
    ob_start();
    CloseTable();
    $cTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($cTable);
    // End form
    //$output->Linebreak(1);
    ob_start();
    OpenTable();
    $oTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($oTable);
    $output->Text('<div align="center"><br>');
    $output->FormSubmit(pnVarPrepHTMLDisplay(_SHIMLINKUPDATE));
    $output->Text('<br><br></div>');
    ob_start();
    CloseTable();
    $cTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($cTable);
    $output->FormEnd();
    // Return the output that has been generated by this function
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    return $output->GetOutput();
}
Example #13
0
/**
 * This is a standard function to modify the configuration parameters of the
 * module
 */
function template_admin_modifyconfig()
{
    // Create output object - this object will store all of our output so that
    // we can return it easily when required
    $output = new pnHTML();
    // Security check - important to do this as early as possible to avoid
    // potential security holes or just too much wasted processing
    if (!pnSecAuthAction(0, 'Template::', '::', ACCESS_ADMIN)) {
        $output->Text(_TEMPLATENOAUTH);
        return $output->GetOutput();
    }
    // Add menu to output - it helps if all of the module pages have a standard
    // menu at their head to aid in navigation
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text(template_adminmenu());
    $output->SetInputMode(_PNH_PARSEINPUT);
    // Title - putting a title ad the head of each page reminds the user what
    // they are doing
    $output->Title(_TEMPLATEMODIFYCONFIG);
    // Start form - note the use of pnModURL() to create the recipient URL of
    // this form.  All URLs should be generated through pnModURL() to ensure
    // compatibility with future versions of PostNuke
    $output->FormStart(pnModURL('Template', 'admin', 'updateconfig'));
    // Add an authorisation ID - this adds a hidden field in the form that
    // contains an authorisation ID.  The authorisation ID is very important in
    // preventing certain attacks on the website
    $output->FormHidden('authid', pnSecGenAuthKey());
    // Start the table that holds the information to be modified.  Note how
    // each item in the form is kept logically separate in the code; this helps
    // to see which part of the code is responsible for the display of each
    // item, and helps with future modifications
    $output->TableStart();
    // Bold
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepForDisplay(_TEMPLATEDISPLAYBOLD));
    $row[] = $output->FormCheckbox('bold', pnModGetVar('Template', 'bold'));
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    $output->SetInputMode(_PNH_PARSEINPUT);
    $output->Linebreak(2);
    // Number of items to display per page
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepForDisplay(_TEMPLATEITEMSPERPAGE));
    $row[] = $output->FormText('itemsperpage', pnModGetVar('Template', 'itemsperpage'), 3, 3);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    $output->SetInputMode(_PNH_PARSEINPUT);
    $output->Linebreak(2);
    $output->TableEnd();
    // End form
    $output->Linebreak(2);
    $output->FormSubmit(_TEMPLATEUPDATE);
    $output->FormEnd();
    // Return the output that has been generated by this function
    return $output->GetOutput();
}
Example #14
0
function settings_admin_main($var)
{
    $pnconfig = $GLOBALS["pnconfig"];
    if (strlen(WHERE_IS_PERSO) > 0) {
        $pnconfig['tipath'] = str_replace(WHERE_IS_PERSO, '', pnConfigGetVar('tipath'));
    }
    include 'header.php';
    GraphicAdmin();
    OpenTable();
    print '<center><font size="4" class="pn-pagetitle">' . _SITECONFIG . '</font></center>';
    CloseTable();
    if (!pnSecAuthAction(0, 'Settings::', '::', ACCESS_ADMIN)) {
        echo _SETTINGSNOAUTH;
        include 'footer.php';
        return;
    }
    // Set the current settings for select fields, radio buttons and checkboxes.
    // Much better then using if() statements all over the place :-)
    $sel_dynkeywords['0'] = '';
    $sel_dynkeywords['1'] = '';
    $sel_dynkeywords[pnConfigGetVar('dyn_keywords')] = ' checked';
    $sel_storyhome['5'] = '';
    $sel_storyhome['10'] = '';
    $sel_storyhome['15'] = '';
    $sel_storyhome['20'] = '';
    $sel_storyhome['25'] = '';
    $sel_storyhome['30'] = '';
    $sel_storyhome[pnConfigGetVar('storyhome')] = ' selected';
    $sel_storyorder['0'] = '';
    $sel_storyorder['1'] = '';
    $sel_storyorder[pnConfigGetVar('storyorder')] = ' selected';
    $sel_defaulttheme[pnConfigGetVar('Default_Theme')] = ' selected';
    $sel_themechange['0'] = '';
    $sel_themechange['1'] = '';
    $sel_themechange[pnConfigGetVar('theme_change')] = ' checked';
    $sel_lang[pnConfigGetVar('language')] = ' selected';
    $sel_nobox['0'] = '';
    $sel_nobox['1'] = '';
    $sel_nobox[pnConfigGetVar('nobox')] = ' checked';
    $sel_tzoffset[pnConfigGetVar('timezone_offset')] = ' selected';
    $sel_backendlanguage[pnConfigGetVar('backend_language')] = ' selected';
    $sel_admingraphic['0'] = '';
    $sel_admingraphic['1'] = '';
    $sel_admingraphic[pnConfigGetVar('admingraphic')] = ' checked';
    $sel_admart['10'] = '';
    $sel_admart['15'] = '';
    $sel_admart['20'] = '';
    $sel_admart['25'] = '';
    $sel_admart['30'] = '';
    $sel_admart['50'] = '';
    $sel_admart[pnConfigGetVar('admart')] = ' selected';
    $sel_reportlevel['0'] = '';
    $sel_reportlevel['1'] = '';
    $sel_reportlevel['2'] = '';
    $sel_reportlevel[pnConfigGetVar('reportlevel')] = ' checked';
    $sel_funtext['0'] = '';
    $sel_funtext['1'] = '';
    $sel_funtext[pnConfigGetVar('funtext')] = ' checked';
    $sel_intranet['0'] = '';
    $sel_intranet['1'] = '';
    $sel_WYSIWYGEditor['0'] = '';
    $sel_WYSIWYGEditor['1'] = '';
    $sel_WYSIWYGEditor[pnConfigGetVar('WYSIWYGEditor')] = ' checked';
    $sel_pnAntiCracker['0'] = '';
    $sel_pnAntiCracker['1'] = '';
    $sel_pnAntiCracker[pnConfigGetVar('pnAntiCracker')] = ' checked';
    $sel_intranet[pnConfigGetVar('intranet')] = ' checked';
    $sel_seclevel['High'] = '';
    $sel_seclevel['Medium'] = '';
    $sel_seclevel['Low'] = '';
    $sel_seclevel[pnConfigGetVar('seclevel')] = 'selected';
    $sel_htmlentities['0'] = '';
    $sel_htmlentities['1'] = '';
    $sel_htmlentities[pnConfigGetVar('htmlentities')] = 'checked';
    $sel_usecompression['0'] = '';
    $sel_usecompression['1'] = '';
    $sel_usecompression[pnConfigGetVar('UseCompression')] = ' selected';
    $sel_refereronprint['0'] = '';
    $sel_refereronprint['1'] = '';
    $sel_refereronprint[pnConfigGetVar('refereronprint')] = ' selected';
    //
    // let's pre-create an array of the current times for each TZ
    //
    $tzo = 0;
    $gmt = time() - date('Z');
    for ($i = -12; $i <= 12; $i++) {
        $tzstring["tz{$tzo}"] = strftime(_TIMEBRIEF, $gmt + 3600 * $i);
        $tzo++;
    }
    // some special cases
    $tzstring['tz8a'] = strftime(_TIMEBRIEF, $gmt - 12600);
    $tzstring['tz15a'] = strftime(_TIMEBRIEF, $gmt + 12600);
    $tzstring['tz16a'] = strftime(_TIMEBRIEF, $gmt + 16200);
    $tzstring['tz17a'] = strftime(_TIMEBRIEF, $gmt + 19800);
    $tzstring['tz21a'] = strftime(_TIMEBRIEF, $gmt + 34200);
    // done, now on to the form
    echo '<form action="admin.php" name="settings" method="post">';
    OpenTable();
    print '<center><font size="3" class="pn-title">' . _GENSITEINFO . '</font></center>' . '<input type="hidden" name="_magic_quotes_gpc_test" value="&quot;">' . '<table border="0"><tr><td class="pn-normal">' . _SITENAME . ":</td><td><input type=\"text\" name=\"xsitename\" value=\"" . pnConfigGetVar('sitename') . "\" size=\"50\" maxlength=\"100\" class=\"pn-normal\">" . '</td></tr><tr><td class="pn-normal">' . _SITELOGO . ":</td><td><input type=\"text\" name=\"xsite_logo\" value=\"" . pnConfigGetVar('site_logo') . "\" size=\"50\" maxlength=\"100\" class=\"pn-normal\">" . '</td></tr><tr><td class="pn-normal">' . _SITESLOGAN . ":</td><td><input type=\"text\" name=\"xslogan\" value=\"" . pnConfigGetVar('slogan') . "\" size=\"50\" maxlength=\"100\" class=\"pn-normal\">" . '</td></tr><tr><td class="pn-normal">' . _METAKEYWORDS . ':</td><td><textarea name="xmetakeywords" cols="80" rows="10" class="pn-normal">' . htmlspecialchars(pnConfigGetVar('metakeywords')) . '</textarea>' . '</td></tr><tr><td class="pn-normal">' . _DYNKEYWORDS . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xdyn_keywords\" value=\"1\"" . $sel_dynkeywords['1'] . " class=\"pn-normal\">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xdyn_keywords\" value=\"0\"" . $sel_dynkeywords['0'] . " class=\"pn-normal\">" . _NO . '&nbsp;' . '</td></tr><tr><td class="pn-normal">' . _STARTDATE . ":</td><td><input type=\"text\" name=\"xstartdate\" value=\"" . pnConfigGetVar('startdate') . "\" size=\"20\" maxlength=\"30\">" . '</td></tr><tr><td class="pn-normal">' . _ADMINEMAIL . ":</td><td><input type=\"text\" name=\"xadminmail\" value=\"" . pnConfigGetVar('adminmail') . "\" size=30 maxlength=100>" . '</td></tr><tr><td class="pn-normal">' . '</td></tr><tr><td class="pn-normal">' . _DEFAULTTHEME . ':</td><td><select name="xDefault_Theme" size="1" class="pn-normal">';
    $handle = opendir('themes');
    while ($f = readdir($handle)) {
        if ($f != '.' && $f != '..' && $f != 'CVS' && !ereg("[.]", $f)) {
            $themelist[] = $f;
        }
    }
    closedir($handle);
    /* modif sebastien multi sites le 09/09/2001. */
    $cWhereIsPerso = WHERE_IS_PERSO;
    if (!empty($cWhereIsPerso)) {
        $handle = opendir(WHERE_IS_PERSO . 'themes');
        while ($f = readdir($handle)) {
            if ($f != '.' && $f != '..' && $f != 'CVS' && !ereg("[.]", $f)) {
                $themelist[] = $f;
            }
        }
        closedir($handle);
    }
    /* fin modif sebastien */
    sort($themelist);
    foreach ($themelist as $v) {
        if (!isset($sel_defaulttheme[$v])) {
            $sel_defaulttheme[$v] = '';
        }
        print "<option value=\"{$v}\"{$sel_defaulttheme[$v]}>{$v}</option>\n";
    }
    print '</select>' . '</td></tr><tr><td class="pn-normal">' . _THEMECHANGE . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xtheme_change\" value=\"0\" class=\"pn-normal\"{$sel_themechange['0']}>" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xtheme_change\" value=\"1\" class=\"pn-normal\"{$sel_themechange['1']}>" . _NO . '</td></tr><tr><td class="pn-normal">' . _BLOCKSINARTICLES . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xnobox\" value=\"0\" class=\"pn-normal\"{$sel_nobox['0']}>" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xnobox\" value=\"1\" class=\"pn-normal\"{$sel_nobox['1']}>" . _NO . '</td></tr><tr><td class="pn-normal">' . _LOCALEFORMAT . ":</td><td><input type=\"text\" name=\"xlocale\" value=\"" . pnConfigGetVar('locale') . "\" size=\"20\" maxlength=\"40\" class=\"pn-normal\">" . '</td></tr><tr><td class="pn-normal">' . _TIMEZONEOFFSET . ':</td><td class="pn-normal">';
    $tzoffset = pnConfigGetVar('timezone_offset');
    global $tzinfo;
    echo "<select name=\"xtimezone_offset\" size=\"1\" class=\"pn-normal\">\n";
    foreach ($tzinfo as $tzindex => $tzdata) {
        echo "<option value=\"{$tzindex}\"";
        if ($tzoffset == $tzindex) {
            echo "selected";
        }
        echo ">";
        echo $tzdata;
        echo "</option>";
    }
    echo '</select>' . '</td></tr><tr><td class="pn-normal">' . '</td></tr><tr><td class="pn-normal">' . _STARTPAGE . "</td><td class=\"pn-normal\">" . "<select name=\"xstartpage\" size=\"1\" class=\"pn-normal\">\n";
    /* Must changed */
    /* 
    	// this way everything from /modules is listed 
    	// even not initialized/not active modules
    $handle = opendir('modules');
    while ($f = readdir($handle))
    {
        if ((!ereg('[.]', $f)) && $f != 'CVS' && (!ereg('NS-', $f)))
        {
            $startpagepath = "$f";
            if (pnConfigGetVar('startpage') == $startpagepath)
            {
                $sel_startpage = " selected";
            }
            else
            {
                $sel_startpage = "";
            }
            echo "<option value=\"$startpagepath\"$sel_startpage>$f</option>\n";
        }
    }
    closedir($handle);
    */
    // better to use the API to display the correct mods / thx to jn
    $usermods = pnModGetUserMods();
    foreach ($usermods as $usermod) {
        if (pnConfigGetVar('startpage') == $usermod['name']) {
            $sel_startpage = " selected";
        } else {
            $sel_startpage = "";
        }
        echo "<option value=\"{$usermod['name']}\"{$sel_startpage}>{$usermod['name']}</option>\n";
    }
    echo "</select> " . _STARTPAGEDESCR . "\n" . "</td></tr><tr><td class=\"pn-normal\">\n" . _ARTINADMIN . ':</td><td>' . '<select name="xadmart" size="1" class="pn-normal">' . "<option value=\"10\"" . $sel_admart['10'] . ">10</option>\n" . "<option value=\"15\"" . $sel_admart['15'] . ">15</option>\n" . "<option value=\"20\"" . $sel_admart['20'] . ">20</option>\n" . "<option value=\"25\"" . $sel_admart['25'] . ">25</option>\n" . "<option value=\"30\"" . $sel_admart['30'] . ">30</option>\n" . "<option value=\"50\"" . $sel_admart['50'] . ">50</option>\n" . '</select>' . "</td></tr><tr><td class=\"pn-normal\">\n" . _STORIESHOME . ':</td><td>' . '<select name="xstoryhome" size="1" class="pn-normal">' . "<option value=\"5\"" . $sel_storyhome['5'] . ">5</option>\n" . "<option value=\"10\"" . $sel_storyhome['10'] . ">10</option>\n" . "<option value=\"15\"" . $sel_storyhome['15'] . ">15</option>\n" . "<option value=\"20\"" . $sel_storyhome['20'] . ">20</option>\n" . "<option value=\"25\"" . $sel_storyhome['25'] . ">25</option>\n" . "<option value=\"30\"" . $sel_storyhome['30'] . ">30</option>\n" . '</select>' . "</td></tr><tr><td class=\"pn-normal\">\n" . _STORIESORDER . ':</td><td>' . '<select name="xstoryorder" size="1" class="pn-normal">' . "<option value=\"0\"" . $sel_storyorder['0'] . ">" . _STORIESORDER0 . "</option>\n" . "<option value=\"1\"" . $sel_storyorder['1'] . ">" . _STORIESORDER1 . "</option>\n" . '</select>' . "</td></tr><tr><td class=\"pn-normal\">\n" . _ADMINGRAPHIC . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xadmingraphic\" value=\"1\" class=\"pn-normal\"" . $sel_admingraphic['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xadmingraphic\" value=\"0\" class=\"pn-normal\"" . $sel_admingraphic['0'] . ">" . _NO . "</td></tr><tr><td class=\"pn-normal\">\n" . _REPORTLEVEL . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xreportlevel\" value=\"0\" class=\"pn-normal\"" . $sel_reportlevel['0'] . ">" . _REPORTLEVEL0 . ' &nbsp;' . "<input type=\"radio\" name=\"xreportlevel\" value=\"1\" class=\"pn-normal\"" . $sel_reportlevel['1'] . ">" . _REPORTLEVEL1 . ' &nbsp;' . "<input type=\"radio\" name=\"xreportlevel\" value=\"2\" class=\"pn-normal\"" . $sel_reportlevel['2'] . ">" . _REPORTLEVEL2 . '</td></tr><tr><td class="pn-normal">' . _FUNTEXT . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xfuntext\" value=\"1\" class=\"pn-normal\"" . $sel_funtext['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xfuntext\" value=\"0\" class=\"pn-normal\"" . $sel_funtext['0'] . ">" . _NO . '</td></tr><tr><td class="pn-normal">' . _WYSIWYGEDITORTEXT . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xWYSIWYGEditor\" value=\"1\" class=\"pn-normal\"" . $sel_WYSIWYGEditor['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xWYSIWYGEditor\" value=\"0\" class=\"pn-normal\"" . $sel_WYSIWYGEditor['0'] . ">" . _NO . '</td></tr><tr><td class="pn-normal">' . _PNANTICRACKERTEXT . '</td><td class="pn-normal">' . "<input type=\"radio\" name=\"xpnAntiCracker\" value=\"1\" class=\"pn-normal\"" . $sel_pnAntiCracker['1'] . ">" . _YES . ' &nbsp;' . "<input type=\"radio\" name=\"xpnAntiCracker\" value=\"0\" class=\"pn-normal\"" . $sel_pnAntiCracker['0'] . ">" . _NO . '</td></tr><tr><td class="pn-normal">' . _DEFAULTGROUP . '</td><td class="pn-normal">' . "<input type=\"text\" name=\"xdefaultgroup\" value=\"" . pnConfigGetVar('defaultgroup') . "\" class=\"pn-normal\">" . '</td></tr><tr><td class="pn-normal">' . _SELLANGUAGE . ':</td><td><select name="xlanguage" size="1" class="pn-normal">';
    $lang = languagelist();
    foreach ($lang as $k => $v) {
        echo '<option value="' . $k . '"';
        if (isset($sel_lang[$k])) {
            echo ' selected';
        }
        echo '>';
        echo "[{$k}] ";
        echo "{$v}";
        echo '</option>' . "\n";
    }
    echo '</select>' . '</td></tr>' . '<tr><td class="pn-normal">' . _USECOMPRESSION . '</td><td class="pn-normal">' . "<select name=\"xUseCompression\" class=\"pn-normal\">\n" . "<option value=\"0\"" . $sel_usecompression['0'] . " class=\"pn-normal\">" . _NO . "</option>" . "<option value=\"1\"" . $sel_usecompression['1'] . " class=\"pn-normal\">" . _YES . "</option>" . "</select>\n" . '</td></tr>' . '</table>';
    CloseTable();
    OpenTable();
    print '<center><font class="pn-title">' . _FOOTERMSG . '</font></center>' . '<table border="0"><tr><td class="pn-normal">' . _FOOTERLINE . ':</td><td><textarea name="xfoot1" cols="80" rows="10" class="pn-normal">' . htmlspecialchars(pnConfigGetVar('foot1')) . '</textarea>' . '</td></tr></table>';
    CloseTable();
    OpenTable();
    print '<center><font class="pn-title">' . _BACKENDCONF . '</font></center>' . '<table border="0"><tr><td class="pn-normal">' . _BACKENDTITLE . ":</td><td><input type=\"text\" name=\"xbackend_title\" value=\"" . pnConfigGetVar('backend_title') . "\" size=\"50\" maxlength=\"100\" class=\"pn-normal\">" . '</td></tr><tr><td class="pn-normal">' . _BACKENDLANG . ':</td><td><select name="xbackend_language" size="1" class="pn-normal">';
    $rsslang = rsslanguagelist();
    foreach ($rsslang as $k => $v) {
        echo '<option value="' . $k . '"';
        if (isset($sel_backendlanguage[$k])) {
            echo ' selected';
        }
        echo '>';
        echo "[{$k}] ";
        echo "{$v}";
        echo '</option>' . "\n";
    }
    echo '</select>' . '</td></tr></table>';
    CloseTable();
    print '<br>';
    OpenTable();
    print '<center><font size="3" class="pn-title">' . _SECOPT . '</font></center>' . '<table border="0"><tr><td class="pn-normal">' . _SECLEVEL . ':</td><td>' . '<select name="xseclevel" size="1" class="pn-normal">' . "<option value=\"High\" {$sel_seclevel['High']}>" . _SECHIGH . "</option>\n" . "<option value=\"Medium\" {$sel_seclevel['Medium']}>" . _SECMEDIUM . "</option>\n" . "<option value=\"Low\" {$sel_seclevel['Low']}>" . _SECLOW . "</option>\n" . '</select>' . '</td></tr><tr><td class="pn-normal">' . _SECMEDLENGTH . ":</td><td><input type=\"text\" name=\"xsecmeddays\" value=\"" . pnConfigGetVar('secmeddays') . "\" size=\"4\" class=\"pn-normal\"> " . _DAYS . '</td></tr><tr><td class="pn-normal">' . _SECINACTIVELENGTH . ":</td><td><input type=\"text\" name=\"xsecinactivemins\" value=\"" . pnConfigGetVar('secinactivemins') . "\" size=\"4\" class=\"pn-normal\"> " . _MINUTES . "</td></tr>" . "<tr><td class=\"pn-normal\">" . _REFERERONPRINT . '</td><td class="pn-normal">' . "<select name=\"xrefereronprint\" class=\"pn-normal\">\n" . "<option value=\"0\"" . $sel_refereronprint['0'] . " class=\"pn-normal\">" . _NO . "</option>" . "<option value=\"1\"" . $sel_refereronprint['1'] . " class=\"pn-normal\">" . _YES . "</option>" . "</select>\n" . "</td></tr></table>\n";
    CloseTable();
    // Intranet configuration
    OpenTable();
    print '<br>';
    print '<center><font size="3" class="pn-title">' . _INTRANETOPT . '</font></center>';
    print '<table border="0">';
    print '<tr>';
    print '<td><font class="pn-normal">' . _INTRANET . '</font></td><td class="pn-normal">';
    print "<input type=\"radio\" name=\"xintranet\" value=\"1\" class=\"pn-normal\"" . $sel_intranet['1'] . ">" . _YES . ' &nbsp;';
    print "<input type=\"radio\" name=\"xintranet\" value=\"0\" class=\"pn-normal\"" . $sel_intranet['0'] . ">" . _NO;
    print '</td></tr>';
    print '</table>';
    print '<b><font class="pn-normal"> ' . _INTRANETWARNING . '</font></b>';
    CloseTable();
    // Allowed HTML
    OpenTable();
    print '<br>';
    print '<center><font size="3" class="pn-title">' . _HTMLOPT . '</font></center>' . '<table border="0"><tr><td class="pn-normal">' . _HTMLALLOWED . ':</td></tr></table>';
    echo '<table border="2">';
    echo '<tr><th><font class="pn-title">' . _HTMLTAGNAME . '</font></th>' . '<th><font class="pn-title">' . _HTMLTAGNOTALLOWED . '</font></th>' . '<th><font class="pn-title">' . _HTMLTAGALLOWED . '</font></th>' . '<th><font class="pn-title">' . _HTMLTAGALLOWEDWITHPARAMS . '</font></th>' . '</tr>';
    $htmltags = settingsGetHTMLTags();
    $currenthtmltags = pnConfigGetVar('AllowableHTML');
    foreach ($htmltags as $htmltag) {
        $selected[0] = '';
        $selected[1] = '';
        $selected[2] = '';
        if (isset($currenthtmltags[$htmltag])) {
            $selected[$currenthtmltags[$htmltag]] = ' checked';
        } else {
            $selected[0] = ' checked';
        }
        echo '<tr>';
        echo '<td><font class="pn-normal">&lt;' . pnVarPrepForDisplay($htmltag) . '&gt;</font></td>';
        echo '<td align="center"><input type=radio value="0" name="htmlallow' . pnVarPrepForDisplay($htmltag) . 'tag" ' . $selected[0] . '></td>';
        echo '<td align="center"><input type=radio value="1" name="htmlallow' . pnVarPrepForDisplay($htmltag) . 'tag" ' . $selected[1] . '></td>';
        echo '<td align="center"><input type=radio value="2" name="htmlallow' . pnVarPrepForDisplay($htmltag) . 'tag" ' . $selected[2] . '></td>';
        echo '</tr>';
    }
    echo '</table>';
    CloseTable();
    echo '<table><tr><td><b><font class="pn-normal"> ' . _HTMLWARNING . '</font></b>';
    echo '<br />';
    echo _HTMLALLOWENTITIES . '<input type="radio" name="xhtmlentities" value="1" class="pn-normal"' . $sel_htmlentities[1] . '>' . _YES . ' &nbsp;' . '<input type="radio" name="xhtmlentities" value="0" class="pn-normal"' . $sel_htmlentities[0] . '>' . _NO;
    // Finish
    echo '<input type="hidden" name="op" value="generate">' . '<input type="hidden" name="module" value="NS-Settings">' . '<input type="hidden" name="authid" value="' . pnSecGenAuthKey() . '">' . '<center><input type="submit" value="' . _SAVECHANGES . '" class="pn-normal" style="text-align:center"></center>' . '</td></tr></table>' . '</form>';
    include 'footer.php';
}