/** * Shows the story submission form * */ function submitstory($topic = '') { global $_CONF, $_TABLES, $_USER, $LANG12, $LANG24, $REMOTE_ADDR; $retval = ''; $story = new Story(); if (isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) { // preview $story->loadSubmission(); $retval .= COM_startBlock($LANG12[32]) . STORY_renderArticle($story, 'p') . COM_endBlock(); $retval .= '<div style="border-bottom:1px solid #cccccc"></div>'; } else { $story->initSubmission($topic); $story->loadSubmission(); } if ($_CONF['story_submit_by_perm_only']) { $topicList = COM_topicList('tid,topic', $story->EditElements('tid'), 1, false, 3); } else { $topicList = COM_topicList('tid,topic', $story->EditElements('tid')); } // no topics if ($topicList == '') { $retval = COM_showMessageText($LANG24[66], '', 1, 'error'); return $retval; } $retval .= COM_startBlock($LANG12[6]); $storyform = new Template($_CONF['path_layout'] . 'submit'); $storyform->set_file('storyform', 'submitstory.thtml'); if ($story->EditElements('postmode') == 'html') { $storyform->set_var('show_htmleditor', true); } else { $storyform->unset_var('show_htmleditor'); } $storyform->set_var('site_admin_url', $_CONF['site_admin_url']); $storyform->set_var('lang_username', $LANG12[27]); if (!COM_isAnonUser()) { $storyform->set_var('story_username', $_USER['username']); $storyform->set_var('author', COM_getDisplayName()); $storyform->set_var('status_url', $_CONF['site_url'] . '/users.php?mode=logout'); $storyform->set_var('lang_loginout', $LANG12[34]); } else { $storyform->set_var('status_url', $_CONF['site_url'] . '/users.php'); $storyform->set_var('lang_loginout', $LANG12[2]); if (!$_CONF['disable_new_user_registration']) { $storyform->set_var('separator', ' | '); $storyform->set_var('seperator', ' | '); $storyform->set_var('create_account', COM_createLink($LANG12[53], $_CONF['site_url'] . '/users.php?mode=new', array('rel' => "nofollow"))); } } $storyform->set_var('lang_title', $LANG12[10]); $storyform->set_var('story_title', $story->EditElements('title')); $storyform->set_var('lang_topic', $LANG12[28]); $storyform->set_var('story_topic_options', $topicList); /* if ( $_CONF['story_submit_by_perm_only'] ) { $storyform->set_var('story_topic_options', COM_topicList('tid,topic',$story->EditElements('tid'),1,false,3)); } else { $storyform->set_var('story_topic_options', COM_topicList('tid,topic',$story->EditElements('tid'))); } */ $storyform->set_var('lang_story', $LANG12[29]); $storyform->set_var('lang_introtext', $LANG12[54]); $storyform->set_var('lang_bodytext', $LANG12[55]); $storyform->set_var('story_introtext', $story->EditElements('introtext')); $storyform->set_var('story_bodytext', $story->EditElements('bodytext')); $storyform->set_var('lang_postmode', $LANG12[36]); $storyform->set_var('story_postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $story->EditElements('postmode'))); $storyform->set_var('postmode', $story->EditElements('postmode')); $storyform->set_var('allowed_html', COM_allowedHTML(SEC_getUserPermissions(), false, 'glfusion', 'story') . '<br/>' . COM_allowedAutotags(SEC_getUserPermissions(), false, 'glfusion', 'story')); $storyform->set_var('story_uid', $story->EditElements('uid')); $storyform->set_var('story_sid', $story->EditElements('sid')); $storyform->set_var('story_date', $story->EditElements('unixdate')); PLG_templateSetVars('story', $storyform); if ($_CONF['skip_preview'] == 1 || isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) { $storyform->set_var('save_button', '<input name="mode" type="submit" value="' . $LANG12[8] . '"' . XHTML . '>'); } $storyform->set_var('lang_preview', $LANG12[32]); $storyform->parse('theform', 'storyform'); $retval .= $storyform->finish($storyform->get_var('theform')); $retval .= COM_endBlock(); $urlfor = 'advancededitor'; if (COM_isAnonUser()) { $urlfor = 'advancededitor' . md5($REMOTE_ADDR); } $rc = @setcookie($_CONF['cookie_name'] . 'adveditor', SEC_createTokenGeneral($urlfor), time() + 1200, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']); return $retval; }
function CUSTOM_userEdit($uid) { global $_CONF, $_TABLES; $retval = ''; $var = "Value from custom table"; $cookietimeout = DB_getitem($_TABLES['users'], 'cookietimeout', $uid); $selection = '<select name="cooktime">' . LB; $selection .= COM_optionList($_TABLES['cookiecodes'], 'cc_value,cc_descr', $cookietimeout, 0); $selection .= '</select>'; $retval .= '<tr> <td align="right">Remember user for:</td> <td>' . $selection . '</td> </tr>'; $retval .= '<tr> <td align="right"><b>Custom Fields:</b></td> <td><input type="text" name="custom1" size="50" value="' . $var . '"' . XHTML . '></td> </tr>'; $retval .= '<tr><td colspan="2"><hr' . XHTML . '></td></tr>'; return $retval; }
$X = DB_fetchArray($tempvar); if ($X[0] != 0) { $task_false_value .= nfidtolid($X[0]); } } } } $p->set_var('if_taskfalse_value', $task_false_value); } else { $logical_taskid = getnextlid($templateID); $p->set_var('logical_task_id', $logical_taskid); $p->set_var('steptype_options', COM_optionList($_TABLES['nf_steptype'], 'id,stepType', '', 0)); $p->set_var('form_options', COM_optionList($_TABLES['nxform_definitions'], 'id,name')); $p->set_var('task_handler_selection', nf_makeDropDown("id", "handler", $_TABLES['nf_handlers'])); $p->set_var('next_tasks', ''); $userOptions = COM_optionList($_TABLES['users'], 'uid,fullname', '', 1, "fullname <> '' AND uid > 1"); $p->set_var('available_userOptions', $userOptions); $variableOptions = nf_makeDropDownWithSelected("id", "variableName", $_TABLES['nf_templatevariables'], $taskRec['dynamicFormVariableID'], '', 1); $p->set_var('available_variablesOptions', $variableOptions); $sql = "{$_TABLES['nf_templatevariables']} ifTask WHERE ifTask.nf_templateID='{$templateID}'"; $p->set_var('if_task_variables', nf_makeDropDownSql("ifTask.id", "ifTask.variableName", $sql, 1)); $sql = "{$_TABLES['nf_ifprocessarguments']} ifTask "; $p->set_var('if_task_option', nf_makeDropDownSql("ifTask.id", "ifTask.label", $sql, 1)); $sql = "{$_TABLES['nf_ifoperators']} ifTask "; $p->set_var('if_task_operator', nf_makeDropDownSql("ifTask.id", "ifTask.operator", $sql, 1)); $options = ''; for ($i = 1; $i <= 31; $i++) { $options .= "<option value=\"{$i}\">{$i}</option>"; } $p->set_var('notifyIntervalOptions', $options); $p->set_var('notifyInterval2Options', $options);
/** * Shows the story submission form * */ function submitstory() { global $_CONF, $_TABLES, $_USER, $LANG01, $LANG12, $LANG24, $_SCRIPTS; // Add JavaScript $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js'); $retval = ''; $story = new Story(); if (isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) { // preview $story->loadSubmission(); $retval .= COM_startBlock($LANG12[32]) . STORY_renderArticle($story, 'p') . COM_endBlock(); } else { $story->initSubmission(); } $storyform = COM_newTemplate($_CONF['path_layout'] . 'submit'); if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) { $storyform->set_file('storyform', 'submitstory_advanced.thtml'); $storyform->set_var('change_editormode', 'onchange="change_editmode(this);"'); $storyform->set_var('lang_expandhelp', $LANG24[67]); $storyform->set_var('lang_reducehelp', $LANG24[68]); $link_message = COM_isAnonUser() ? '' : $LANG01[138]; $storyform->set_var('noscript', COM_getNoScript(false, '', $link_message)); // Setup Advanced Editor COM_setupAdvancedEditor('/javascript/submitstory_adveditor.js'); if ($story->EditElements('postmode') === 'html') { $storyform->set_var('show_texteditor', 'none'); $storyform->set_var('show_htmleditor', ''); } else { $storyform->set_var('show_texteditor', ''); $storyform->set_var('show_htmleditor', 'none'); } } else { $storyform->set_file('storyform', 'submitstory.thtml'); if ($story->EditElements('postmode') === 'html') { $storyform->set_var('show_texteditor', 'none'); $storyform->set_var('show_htmleditor', ''); } else { $storyform->set_var('show_texteditor', ''); $storyform->set_var('show_htmleditor', 'none'); } } $storyform->set_var('lang_username', $LANG12[27]); if (!COM_isAnonUser()) { $storyform->set_var('story_username', $_USER['username']); $storyform->set_var('author', COM_getDisplayName()); $storyform->set_var('status_url', $_CONF['site_url'] . '/users.php?mode=logout'); $storyform->set_var('lang_loginout', $LANG12[34]); } else { $storyform->set_var('status_url', $_CONF['site_url'] . '/users.php'); $storyform->set_var('lang_loginout', $LANG12[2]); if (!$_CONF['disable_new_user_registration']) { $storyform->set_var('separator', ' | '); $storyform->set_var('seperator', ' | '); $storyform->set_var('create_account', COM_createLink($LANG12[53], $_CONF['site_url'] . '/users.php?mode=new', array('rel' => 'nofollow'))); } } $storyform->set_var('lang_title', $LANG12[10]); $storyform->set_var('story_title', $story->EditElements('title')); $storyform->set_var('lang_topic', $LANG12[28]); $tlist = TOPIC_getTopicSelectionControl('article', '', false, false, false); $storyform->set_var('topic_selection', $tlist); if (empty($tlist)) { $retval .= COM_showMessage(101); return $retval; } $storyform->set_var('story_topic_options', $tlist); $storyform->set_var('lang_story', $LANG12[29]); $storyform->set_var('lang_introtext', $LANG12[54]); $storyform->set_var('lang_bodytext', $LANG12[55]); $storyform->set_var('story_introtext', $story->EditElements('introtext')); $storyform->set_var('story_bodytext', $story->EditElements('bodytext')); $storyform->set_var('lang_postmode', $LANG12[36]); $postmode = $story->EditElements('postmode'); $storyform->set_var('story_postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode)); $allowed_html = ''; foreach (array('plaintext', 'html') as $pm) { $allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm); } $allowed_html .= COM_allowedAutotags(); $storyform->set_var('allowed_html', $allowed_html); $storyform->set_var('story_uid', $story->EditElements('uid')); $storyform->set_var('story_sid', $story->EditElements('sid')); $storyform->set_var('story_date', $story->EditElements('unixdate')); $storyform->set_var('lang_preview', $LANG12[32]); PLG_templateSetVars('story', $storyform); if ($_CONF['skip_preview'] == 1 || isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) { $storyform->set_var('save_button', '<input name="mode" type="submit" value="' . $LANG12[8] . '"' . XHTML . '>'); } $retval .= COM_startBlock($LANG12[6], 'submitstory.html'); $storyform->parse('theform', 'storyform'); $retval .= $storyform->finish($storyform->get_var('theform')); $retval .= COM_endBlock(); return $retval; }
/** * Shows the story submission form * */ function submitstory($topic = '') { global $_CONF, $_TABLES, $_USER, $LANG12, $LANG24; $retval = ''; $story = new Story(); if (isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) { // preview $story->loadSubmission(); $retval .= COM_startBlock($LANG12[32]) . STORY_renderArticle($story, 'p') . COM_endBlock(); } else { $story->initSubmission($topic); } $storyform = new Template($_CONF['path_layout'] . 'submit'); if (isset($_CONF['advanced_editor']) && $_CONF['advanced_editor'] == 1 && file_exists($_CONF['path_layout'] . 'submit/submitstory_advanced.thtml')) { $storyform->set_file('storyform', 'submitstory_advanced.thtml'); $storyform->set_var('change_editormode', 'onchange="change_editmode(this);"'); $storyform->set_var('lang_expandhelp', $LANG24[67]); $storyform->set_var('lang_reducehelp', $LANG24[68]); if ($story->EditElements('postmode') == 'html') { $storyform->set_var('show_texteditor', 'none'); $storyform->set_var('show_htmleditor', ''); } else { $storyform->set_var('show_texteditor', ''); $storyform->set_var('show_htmleditor', 'none'); } } else { $storyform->set_file('storyform', 'submitstory.thtml'); if ($story->EditElements('postmode') == 'html') { $storyform->set_var('show_texteditor', 'none'); $storyform->set_var('show_htmleditor', ''); } else { $storyform->set_var('show_texteditor', ''); $storyform->set_var('show_htmleditor', 'none'); } } $storyform->set_var('xhtml', XHTML); $storyform->set_var('site_url', $_CONF['site_url']); $storyform->set_var('site_admin_url', $_CONF['site_admin_url']); $storyform->set_var('layout_url', $_CONF['layout_url']); $storyform->set_var('lang_username', $LANG12[27]); if (!empty($_USER['username'])) { $storyform->set_var('story_username', $_USER['username']); $storyform->set_var('author', COM_getDisplayName()); $storyform->set_var('status_url', $_CONF['site_url'] . '/users.php?mode=logout'); $storyform->set_var('lang_loginout', $LANG12[34]); } else { $storyform->set_var('status_url', $_CONF['site_url'] . '/users.php'); $storyform->set_var('lang_loginout', $LANG12[2]); if (!$_CONF['disable_new_user_registration']) { $storyform->set_var('separator', ' | '); $storyform->set_var('seperator', ' | '); $storyform->set_var('create_account', COM_createLink($LANG12[53], $_CONF['site_url'] . '/users.php?mode=new', array('rel' => "nofollow"))); } } $storyform->set_var('lang_title', $LANG12[10]); $storyform->set_var('story_title', $story->EditElements('title')); $storyform->set_var('lang_topic', $LANG12[28]); $tlist = COM_topicList('tid,topic', $story->EditElements('tid')); if (empty($tlist)) { $retval .= COM_showMessage(101); return $retval; } $storyform->set_var('story_topic_options', $tlist); $storyform->set_var('lang_story', $LANG12[29]); $storyform->set_var('lang_introtext', $LANG12[54]); $storyform->set_var('lang_bodytext', $LANG12[55]); $storyform->set_var('story_introtext', $story->EditElements('introtext')); $storyform->set_var('story_bodytext', $story->EditElements('bodytext')); $storyform->set_var('lang_postmode', $LANG12[36]); $storyform->set_var('story_postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $story->EditElements('postmode'))); $storyform->set_var('allowed_html', COM_allowedHTML()); $storyform->set_var('story_uid', $story->EditElements('uid')); $storyform->set_var('story_sid', $story->EditElements('sid')); $storyform->set_var('story_date', $story->EditElements('unixdate')); $storyform->set_var('lang_preview', $LANG12[32]); PLG_templateSetVars('story', $storyform); if ($_CONF['skip_preview'] == 1 || isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) { $storyform->set_var('save_button', '<input name="mode" type="submit" value="' . $LANG12[8] . '"' . XHTML . '>'); } $retval .= COM_startBlock($LANG12[6], 'submitstory.html'); $storyform->parse('theform', 'storyform'); $retval .= $storyform->finish($storyform->get_var('theform')); $retval .= COM_endBlock(); return $retval; }
/** * Creates the edit form. * * @param integer $id Attributeal ID, current record used if zero * @return string HTML for edit form */ function Edit() { global $_TABLES, $_CONF, $_PP_CONF, $LANG_PP; // If there are no products defined, return a formatted error message // instead of the form. if (DB_count($_TABLES['paypal.products']) == 0) { return PAYPAL_errMsg($LANG_PP['todo_noproducts']); } $T = new Template(PAYPAL_PI_PATH . '/templates'); $T->set_file(array('attrform' => 'attribute_form.thtml')); $id = $this->attr_id; // If we have a nonzero category ID, then we edit the existing record. // Otherwise, we're creating a new item. Also set the $not and $items // values to be used in the parent category selection accordingly. if ($id > 0) { $retval = COM_startBlock($LANG_PP['edit'] . ': ' . $this->attr_value); $T->set_var('attr_id', $id); } else { $retval = COM_startBlock($LANG_PP['new_option']); $T->set_var('attr_id', ''); } $T->set_var(array('action_url' => PAYPAL_ADMIN_URL, 'pi_url' => PAYPAL_URL, 'doc_url' => PAYPAL_getDocURL('attribute_form.html', $_CONF['language']), 'attr_value' => $this->attr_value, 'attr_price' => $this->attr_price, 'product_select' => COM_optionList($_TABLES['paypal.products'], 'id,name', $this->item_id), 'option_group_select' => COM_optionList($_TABLES['paypal.prod_attr'], 'DISTINCT attr_name,attr_name', $this->attr_name, 1), 'orderby' => $this->orderby, 'ena_chk' => $this->enabled == 1 ? ' checked="checked"' : '')); $retval .= $T->parse('output', 'attrform'); $retval .= COM_endBlock(); return $retval; }
/** * Displays user preferences * */ function editpreferences() { global $_TABLES, $_CONF, $LANG04, $_USER, $_GROUPS; $result = DB_query("SELECT noicons,willing,dfid,tzid,noboxes,maxstories,tids,aids,boxes,emailfromadmin,emailfromuser,showonline FROM {$_TABLES['userprefs']},{$_TABLES['userindex']} WHERE {$_TABLES['userindex']}.uid = {$_USER['uid']} AND {$_TABLES['userprefs']}.uid = {$_USER['uid']}"); $A = DB_fetchArray($result); // 'maxstories' may be 0, in which case it will pick up the default // setting for the current topic or $_CONF['limitnews'] (see index.php) if (empty($A['maxstories'])) { $A['maxstories'] = 0; } else { if ($A['maxstories'] > 0) { if ($A['maxstories'] < $_CONF['minnews']) { $A['maxstories'] = $_CONF['minnews']; } } } $preferences = new Template($_CONF['path_layout'] . 'preferences'); $preferences->set_file(array('prefs' => 'displayprefs.thtml', 'display' => 'displayblock.thtml', 'exclude' => 'excludeblock.thtml', 'digest' => 'digestblock.thtml', 'boxes' => 'boxesblock.thtml', 'comment' => 'commentblock.thtml', 'language' => 'language.thtml', 'theme' => 'theme.thtml', 'privacy' => 'privacyblock.thtml')); $preferences->set_var('xhtml', XHTML); $preferences->set_var('site_url', $_CONF['site_url']); $preferences->set_var('layout_url', $_CONF['layout_url']); $preferences->set_var('user_name', $_USER['username']); $preferences->set_var('lang_language', $LANG04[73]); $preferences->set_var('lang_theme', $LANG04[72]); $preferences->set_var('lang_theme_text', $LANG04[74]); $preferences->set_var('lang_misc_title', $LANG04[138]); $preferences->set_var('lang_misc_help_title', $LANG04[139]); $preferences->set_var('lang_misc_help', $LANG04[140]); $preferences->set_var('lang_noicons', $LANG04[40]); $preferences->set_var('lang_noicons_text', $LANG04[49]); $preferences->set_var('lang_noboxes', $LANG04[44]); $preferences->set_var('lang_noboxes_text', $LANG04[51]); $preferences->set_var('lang_maxstories', $LANG04[43]); if (strpos($LANG04[52], '%d') === false) { $maxtext = $LANG04[52] . ' ' . $_CONF['limitnews']; } else { $maxtext = sprintf($LANG04[52], $_CONF['limitnews']); } $preferences->set_var('lang_maxstories_text', $maxtext); $preferences->set_var('lang_dateformat', $LANG04[42]); $preferences->set_var('lang_excluded_items_title', $LANG04[137]); $preferences->set_var('lang_excluded_items', $LANG04[54]); $preferences->set_var('lang_exclude_title', $LANG04[136]); $preferences->set_var('lang_topics', $LANG04[48]); $preferences->set_var('lang_emailedtopics', $LANG04[76]); $preferences->set_var('lang_digest_top_header', $LANG04[131]); $preferences->set_var('lang_digest_help_header', $LANG04[132]); $preferences->set_var('lang_boxes_title', $LANG04[144]); $preferences->set_var('lang_boxes_help_title', $LANG04[143]); $preferences->set_var('lang_boxes', $LANG04[55]); $preferences->set_var('lang_displaymode', $LANG04[57]); $preferences->set_var('lang_displaymode_text', $LANG04[60]); $preferences->set_var('lang_sortorder', $LANG04[58]); $preferences->set_var('lang_sortorder_text', $LANG04[61]); $preferences->set_var('lang_comment_title', $LANG04[133]); $preferences->set_var('lang_comment_help_title', $LANG04[134]); $preferences->set_var('lang_comment_help', $LANG04[135]); $preferences->set_var('lang_commentlimit', $LANG04[59]); $preferences->set_var('lang_commentlimit_text', $LANG04[62]); $preferences->set_var('lang_privacy_title', $LANG04[141]); $preferences->set_var('lang_privacy_help_title', $LANG04[141]); $preferences->set_var('lang_privacy_help', $LANG04[142]); $preferences->set_var('lang_emailfromadmin', $LANG04[100]); $preferences->set_var('lang_emailfromadmin_text', $LANG04[101]); $preferences->set_var('lang_emailfromuser', $LANG04[102]); $preferences->set_var('lang_emailfromuser_text', $LANG04[103]); $preferences->set_var('lang_showonline', $LANG04[104]); $preferences->set_var('lang_showonline_text', $LANG04[105]); $preferences->set_var('lang_submit', $LANG04[9]); $display_name = COM_getDisplayName($_USER['uid']); $preferences->set_var('lang_authors_exclude', $LANG04[46]); $preferences->set_var('lang_boxes_exclude', $LANG04[47]); $preferences->set_var('start_block_display', COM_startBlock($LANG04[45] . ' ' . $display_name)); $preferences->set_var('start_block_digest', COM_startBlock($LANG04[75] . ' ' . $display_name)); $preferences->set_var('start_block_comment', COM_startBlock($LANG04[64] . ' ' . $display_name)); $preferences->set_var('start_block_privacy', COM_startBlock($LANG04[99] . ' ' . $display_name)); $preferences->set_var('end_block', COM_endBlock()); $preferences->set_var('display_headline', $LANG04[45] . ' ' . $display_name); $preferences->set_var('exclude_headline', $LANG04[46] . ' ' . $display_name); $preferences->set_var('digest_headline', $LANG04[75] . ' ' . $display_name); $preferences->set_var('boxes_headline', $LANG04[47] . ' ' . $display_name); $preferences->set_var('comment_headline', $LANG04[64] . ' ' . $display_name); $preferences->set_var('privacy_headline', $LANG04[99] . ' ' . $display_name); // display preferences block if ($_CONF['allow_user_language'] == 1) { if (empty($_USER['language'])) { $userlang = $_CONF['language']; } else { $userlang = $_USER['language']; } // Get available languages $language = MBYTE_languageList($_CONF['default_charset']); $has_valid_language = count(array_keys($language, $userlang)); if ($has_valid_language == 0) { // The user's preferred language is no longer available. // We have a problem now, since we've overwritten $_CONF['language'] // with the user's preferred language ($_USER['language']) and // therefore don't know what the system's default language is. // So we'll try to find a similar language. If that doesn't help, // the dropdown will default to the first language in the list ... $tmp = explode('_', $userlang); $similarLang = $tmp[0]; } $selection = '<select id="language" name="language">' . LB; foreach ($language as $langFile => $langName) { $selection .= '<option value="' . $langFile . '"'; if ($langFile == $userlang || $has_valid_language == 0 && strpos($langFile, $similarLang) === 0) { $selection .= ' selected="selected"'; $has_valid_language = 1; } else { if ($userlang == $langFile) { $selection .= ' selected="selected"'; } } $selection .= '>' . $langName . '</option>' . LB; } $selection .= '</select>'; $preferences->set_var('language_selector', $selection); $preferences->parse('language_selection', 'language', true); } else { $preferences->set_var('language_selection', ''); } if ($_CONF['allow_user_themes'] == 1) { $selection = '<select id="theme" name="theme">' . LB; if (empty($_USER['theme'])) { $usertheme = $_CONF['theme']; } else { $usertheme = $_USER['theme']; } $themeFiles = COM_getThemes(); usort($themeFiles, 'strcasecmp'); foreach ($themeFiles as $theme) { $selection .= '<option value="' . $theme . '"'; if ($usertheme == $theme) { $selection .= ' selected="selected"'; } $words = explode('_', $theme); $bwords = array(); foreach ($words as $th) { if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $bwords[] = ucfirst($th); } else { $bwords[] = $th; } } $selection .= '>' . implode(' ', $bwords) . '</option>' . LB; } $selection .= '</select>'; $preferences->set_var('theme_selector', $selection); $preferences->parse('theme_selection', 'theme', true); } else { $preferences->set_var('theme_selection', ''); } // Timezone require_once $_CONF['path_system'] . 'classes/timezoneconfig.class.php'; $timezone = TimeZoneConfig::getUserTimeZone(); $selection = TimeZoneConfig::getTimeZoneDropDown($timezone, array('id' => 'tzid', 'name' => 'tzid')); $preferences->set_var('timezone_selector', $selection); $preferences->set_var('lang_timezone', $LANG04[158]); if ($A['noicons'] == '1') { $preferences->set_var('noicons_checked', 'checked="checked"'); } else { $preferences->set_var('noicons_checked', ''); } if ($A['noboxes'] == 1) { $preferences->set_var('noboxes_checked', 'checked="checked"'); } else { $preferences->set_var('noboxes_checked', ''); } $preferences->set_var('maxstories_value', $A['maxstories']); $selection = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', $A['dfid']) . '</select>'; $preferences->set_var('dateformat_selector', $selection); $preferences->parse('display_block', 'display', true); // privacy options block if ($A['emailfromadmin'] == 1) { $preferences->set_var('emailfromadmin_checked', 'checked="checked"'); } else { $preferences->set_var('emailfromadmin_checked', ''); } if ($A['emailfromuser'] == 1) { $preferences->set_var('emailfromuser_checked', 'checked="checked"'); } else { $preferences->set_var('emailfromuser_checked', ''); } if ($A['showonline'] == 1) { $preferences->set_var('showonline_checked', 'checked="checked"'); } else { $preferences->set_var('showonline_checked', ''); } PLG_profileVariablesEdit($_USER['uid'], $preferences); $preferences->parse('privacy_block', 'privacy', true); // excluded items block $permissions = COM_getPermSQL(''); $preferences->set_var('exclude_topic_checklist', COM_checkList($_TABLES['topics'], 'tid,topic', $permissions, $A['tids'], 'topics')); if ($_CONF['contributedbyline'] == 1 && $_CONF['hide_author_exclusion'] == 0) { $preferences->set_var('lang_authors', $LANG04[56]); $sql = "SELECT DISTINCT story.uid, users.username,users.fullname FROM {$_TABLES['stories']} story, {$_TABLES['users']} users WHERE story.uid = users.uid"; if ($_CONF['show_fullname'] == 1) { $sql .= ' ORDER BY users.fullname'; } else { $sql .= ' ORDER BY users.username'; } $query = DB_query($sql); $nrows = DB_numRows($query); $authors = explode(' ', $A['aids']); $selauthors = ''; for ($i = 0; $i < $nrows; $i++) { $B = DB_fetchArray($query); $selauthors .= '<option value="' . $B['uid'] . '"'; if (in_array(sprintf('%d', $B['uid']), $authors)) { $selauthors .= ' selected'; } $selauthors .= '>' . COM_getDisplayName($B['uid'], $B['username'], $B['fullname']) . '</option>' . LB; } if (DB_count($_TABLES['topics']) > 10) { $Selboxsize = intval(DB_count($_TABLES['topics']) * 1.5); } else { $Selboxsize = 15; } $preferences->set_var('exclude_author_checklist', '<select name="selauthors[]" multiple="multiple" size="' . $Selboxsize . '">' . $selauthors . '</select>'); } else { $preferences->set_var('lang_authors', ''); $preferences->set_var('exclude_author_checklist', ''); } $preferences->parse('exclude_block', 'exclude', true); // daily digest block if ($_CONF['emailstories'] == 1) { $user_etids = DB_getItem($_TABLES['userindex'], 'etids', "uid = {$_USER['uid']}"); if (empty($user_etids)) { // an empty string now means "all topics" $etids = USER_getAllowedTopics(); $user_etids = implode(' ', $etids); } elseif ($user_etids == '-') { // this means "no topics" $user_etids = ''; } $tmp = COM_checkList($_TABLES['topics'], 'tid,topic', $permissions, $user_etids, 'topics'); $preferences->set_var('email_topic_checklist', str_replace($_TABLES['topics'], 'etids', $tmp)); $preferences->parse('digest_block', 'digest', true); } else { $preferences->set_var('digest_block', ''); } // boxes block $selectedblocks = ''; if (strlen($A['boxes']) > 0) { $blockresult = DB_query("SELECT bid FROM {$_TABLES['blocks']} WHERE bid NOT IN (" . str_replace(' ', ',', $A['boxes']) . ")"); for ($x = 1; $x <= DB_numRows($blockresult); $x++) { $row = DB_fetchArray($blockresult); $selectedblocks .= $row['bid']; if ($x != DB_numRows($blockresult)) { $selectedblocks .= ' '; } } } $whereblock = ''; if (!empty($permissions)) { $whereblock .= $permissions . ' AND '; } $whereblock .= "((type != 'layout' AND type != 'gldefault' AND is_enabled = 1) OR " . "(type = 'gldefault' AND is_enabled = 1 AND name IN ('whats_new_block','older_stories'))) " . "ORDER BY onleft desc,blockorder,title"; $preferences->set_var('boxes_checklist', COM_checkList($_TABLES['blocks'], 'bid,title,type', $whereblock, $selectedblocks)); $preferences->parse('boxes_block', 'boxes', true); // comment preferences block $result = DB_query("SELECT commentmode,commentorder,commentlimit FROM {$_TABLES['usercomment']} WHERE uid = {$_USER['uid']}"); $A = DB_fetchArray($result); if (empty($A['commentmode'])) { $A['commentmode'] = $_CONF['comment_mode']; } if (empty($A['commentorder'])) { $A['commentorder'] = 0; } if (empty($A['commentlimit'])) { $A['commentlimit'] = 100; } $selection = '<select id="commentmode" name="commentmode">'; $selection .= COM_optionList($_TABLES['commentmodes'], 'mode,name', $A['commentmode']); $selection .= '</select>'; $preferences->set_var('displaymode_selector', $selection); $selection = '<select id="commentorder" name="commentorder">'; $selection .= COM_optionList($_TABLES['sortcodes'], 'code,name', $A['commentorder']); $selection .= '</select>'; $preferences->set_var('sortorder_selector', $selection); $preferences->set_var('commentlimit_value', $A['commentlimit']); $preferences->parse('comment_block', 'comment', true); return $preferences->finish($preferences->parse('output', 'prefs')); }
/** * Shows event editor * * @param string $mode Indicates if this is a submission or a regular entry * @param array $A array holding the event's details * @param string $msg an optional error message to display * @return string HTML for event editor or error message * */ function CALENDAR_editEvent($mode, $A, $msg = '') { global $_CONF, $_GROUPS, $_TABLES, $_USER, $_CA_CONF, $LANG_CAL_1, $LANG_CAL_ADMIN, $LANG10, $LANG12, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS; // Loads jQuery UI datepicker and timepicker-addon $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider'); $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n'); $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js'); // Add JavaScript $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js'); $langCode = COM_getLangIso639Code(); $toolTip = $MESSAGE[118]; $imgUrl = $_CONF['site_url'] . '/images/calendar.png'; $_SCRIPTS->setJavaScript("jQuery(function () {" . " geeklog.hour_mode = {$_CONF['hour_mode']};" . " geeklog.datetimepicker.options.stepMinute = 15;" . " geeklog.datetimepicker.set('start', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . " geeklog.datetimepicker.set('end', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE); $retval = ''; if (!empty($msg)) { $retval .= COM_showMessageText($msg, $LANG_CAL_ADMIN[2]); } $event_templates = COM_newTemplate(CTL_plugin_templatePath('calendar', 'admin')); $event_templates->set_file('editor', 'eventeditor.thtml'); $allowed = ''; foreach (array('plaintext', 'html') as $pm) { $allowed .= COM_allowedHTML('calendar.edit', false, 1, $pm); } $allowed .= COM_allowedAutotags(); $event_templates->set_var('lang_allowed_html', $allowed); $event_templates->set_var('lang_postmode', $LANG_CAL_ADMIN[3]); if ($mode != 'editsubmission' and !empty($A['eid'])) { // Get what level of access user has to this object $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); if ($access == 0 or $access == 2) { // Uh, oh! User doesn't have access to this object $retval .= COM_showMessageText($LANG_CAL_ADMIN[17], $LANG_ACCESS['accessdenied']); COM_accessLog("User {$_USER['username']} tried to illegally submit or edit event {$eid}."); return $retval; } } else { if (empty($A['owner_id'])) { $A['owner_id'] = $_USER['uid']; } if (isset($_GROUPS['Calendar Admin'])) { $A['group_id'] = $_GROUPS['Calendar Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('calendar.edit'); } SEC_setDefaultPermissions($A, $_CA_CONF['default_permissions']); $access = 3; } if ($mode == 'editsubmission') { $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', 'plaintext')); } else { if (!isset($A['postmode'])) { $A['postmode'] = $_CONF['postmode']; } $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', $A['postmode'])); } $token = SEC_createToken(); $retval .= COM_startBlock($LANG_CAL_ADMIN[1], '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= SEC_getTokenExpiryNotice($token); if (!empty($A['eid'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $event_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $event_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); $event_templates->set_var('allow_delete', true); $event_templates->set_var('lang_delete', $LANG_ADMIN['delete']); $event_templates->set_var('confirm_message', $MESSAGE[76]); if ($mode == 'editsubmission') { $event_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>'); } } else { // new event $A['eid'] = COM_makesid(); $A['title'] = ''; $A['description'] = ''; $A['url'] = ''; $A['hits'] = 0; // in case a start date/time has been passed from the calendar, // pick it up for the end date/time if (empty($A['dateend'])) { $A['dateend'] = $A['datestart']; } if (empty($A['timeend'])) { $A['timeend'] = $A['timestart']; } $A['event_type'] = ''; $A['location'] = ''; $A['address1'] = ''; $A['address2'] = ''; $A['city'] = ''; $A['state'] = ''; $A['zipcode'] = ''; $A['allday'] = 0; } $event_templates->set_var('lang_eventid', $LANG_CAL_ADMIN[34]); $event_templates->set_var('event_id', $A['eid']); $event_templates->set_var('lang_eventtitle', $LANG_ADMIN['title']); $A['title'] = str_replace('{', '{', $A['title']); $A['title'] = str_replace('}', '}', $A['title']); $A['title'] = str_replace('"', '"', $A['title']); $event_templates->set_var('event_title', stripslashes($A['title'])); $event_templates->set_var('lang_eventtype', $LANG_CAL_1[37]); $event_templates->set_var('lang_editeventtypes', $LANG12[50]); $event_templates->set_var('type_options', CALENDAR_eventTypeList($A['event_type'])); $event_templates->set_var('lang_eventurl', $LANG_CAL_ADMIN[4]); $event_templates->set_var('max_url_length', 255); $event_templates->set_var('event_url', $A['url']); $event_templates->set_var('lang_includehttp', $LANG_CAL_ADMIN[9]); $event_templates->set_var('lang_eventstartdate', $LANG_CAL_ADMIN[5]); //$event_templates->set_var('event_startdate', $A['datestart']); $event_templates->set_var('lang_starttime', $LANG_CAL_1[30]); // Combine date/time for easier manipulation $A['datestart'] = trim($A['datestart'] . ' ' . $A['timestart']); if (empty($A['datestart'])) { $start_stamp = time(); } else { $start_stamp = strtotime($A['datestart']); } $A['dateend'] = trim($A['dateend'] . ' ' . $A['timeend']); if (empty($A['dateend'])) { $end_stamp = time(); } else { $end_stamp = strtotime($A['dateend']); } $start_month = date('m', $start_stamp); $start_day = date('d', $start_stamp); $start_year = date('Y', $start_stamp); $end_month = date('m', $end_stamp); $end_day = date('d', $end_stamp); $end_year = date('Y', $end_stamp); $start_hour = date('H', $start_stamp); $start_minute = intval(date('i', $start_stamp) / 15) * 15; if ($start_hour >= 12) { $startampm = 'pm'; } else { $startampm = 'am'; } $start_hour_24 = $start_hour % 24; if ($start_hour > 12) { $start_hour = $start_hour - 12; } else { if ($start_hour == 0) { $start_hour = 12; } } $end_hour = date('H', $end_stamp); $end_minute = intval(date('i', $end_stamp) / 15) * 15; if ($end_hour >= 12) { $endampm = 'pm'; } else { $endampm = 'am'; } $end_hour_24 = $end_hour % 24; if ($end_hour > 12) { $end_hour = $end_hour - 12; } else { if ($end_hour == 0) { $end_hour = 12; } } $month_options = COM_getMonthFormOptions($start_month); $event_templates->set_var('startmonth_options', $month_options); $month_options = COM_getMonthFormOptions($end_month); $event_templates->set_var('endmonth_options', $month_options); $day_options = COM_getDayFormOptions($start_day); $event_templates->set_var('startday_options', $day_options); $day_options = COM_getDayFormOptions($end_day); $event_templates->set_var('endday_options', $day_options); $year_options = COM_getYearFormOptions($start_year); $event_templates->set_var('startyear_options', $year_options); $year_options = COM_getYearFormOptions($end_year); $event_templates->set_var('endyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($start_hour_24, 24); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour_24, 24); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 24); } else { $hour_options = COM_getHourFormOptions($start_hour); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 12); } $event_templates->set_var('startampm_selection', COM_getAmPmFormSelection('start_ampm', $startampm)); $event_templates->set_var('endampm_selection', COM_getAmPmFormSelection('end_ampm', $endampm)); $event_templates->set_var('startminute_options', COM_getMinuteFormOptions($start_minute, 15)); $event_templates->set_var('endminute_options', COM_getMinuteFormOptions($end_minute, 15)); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_eventenddate', $LANG_CAL_ADMIN[6]); $event_templates->set_var('event_enddate', $A['dateend']); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_endtime', $LANG_CAL_1[29]); $event_templates->set_var('lang_alldayevent', $LANG_CAL_1[31]); if ($A['allday'] == 1) { $event_templates->set_var('allday_checked', 'checked="checked"'); } $event_templates->set_var('lang_location', $LANG12[51]); $event_templates->set_var('event_location', stripslashes($A['location'])); $event_templates->set_var('lang_addressline1', $LANG12[44]); $event_templates->set_var('event_address1', stripslashes($A['address1'])); $event_templates->set_var('lang_addressline2', $LANG12[45]); $event_templates->set_var('event_address2', stripslashes($A['address2'])); $event_templates->set_var('lang_city', $LANG12[46]); $event_templates->set_var('event_city', stripslashes($A['city'])); $event_templates->set_var('lang_state', $LANG12[47]); $event_templates->set_var('state_options', ''); $event_templates->set_var('event_state', stripslashes($A['state'])); $event_templates->set_var('lang_zipcode', $LANG12[48]); $event_templates->set_var('event_zipcode', $A['zipcode']); $event_templates->set_var('lang_eventlocation', $LANG_CAL_ADMIN[7]); $event_templates->set_var('event_location', stripslashes($A['location'])); $event_templates->set_var('lang_eventdescription', $LANG_CAL_ADMIN[8]); $event_templates->set_var('event_description', stripslashes($A['description'])); $event_templates->set_var('lang_hits', $LANG10[30]); $event_templates->set_var('hits', COM_numberFormat($A['hits'])); $event_templates->set_var('lang_save', $LANG_ADMIN['save']); $event_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); // user access info $event_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $event_templates->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($A['owner_id']); $event_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}")); $event_templates->set_var('owner_name', $ownername); $event_templates->set_var('owner', $ownername); $event_templates->set_var('owner_id', $A['owner_id']); $event_templates->set_var('lang_group', $LANG_ACCESS['group']); $event_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $event_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $event_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']); $event_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $event_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $event_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $event_templates->set_var('gltoken_name', CSRF_TOKEN); $event_templates->set_var('gltoken', $token); $event_templates->parse('output', 'editor'); $retval .= $event_templates->finish($event_templates->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
$T->set_var('exidmsg', $LANG_EX00['exidmsg']); $T->set_var('titlemsg', $LANG_EX00['titlemsg']); $T->set_var('urlmsg', $LANG_EX00['urlmsg']); $T->set_var('hitsmsg', $LANG_EX00['hitsmsg']); $T->set_var('save', $LANG_EX00['save']); $T->set_var('delete', $LANG_EX00['delete']); $T->set_var('cancel', $LANG_EX00['cancel']); $T->set_var('exid', $exid); $T->set_var('title', $title); $T->set_var('url', $url); $T->set_var('hits', $hits); $T->set_var('perms', SEC_getPermissionsHTML($perm_owner, $perm_group, $perm_members, $perm_anon)); $T->set_var('lang_owner', $LANG_ACCESS[owner]); if (SEC_inGroup('Root')) { $T->set_var('owner_username', ''); $usrdd = '<SELECT name="owner_id">' . COM_optionList($_TABLES['users'], "uid,username", $owner_id) . "</SELECT>"; $T->set_var('owner_id', $usrdd); } else { $T->set_var('owner_username', '  ' . DB_getItem($_TABLES['users'], 'username', "uid = {$c_oid}")); $T->set_var('owner_id', "<input type='hidden' name='owner_id[]' value='" . $owner_id . "'>"); } $T->set_var('lang_group', $LANG_ACCESS[group]); $usergroups = SEC_getUserGroups(); $groupdd .= '<SELECT name="group_id">'; for ($i = 0; $i < count($usergroups); $i++) { $groupdd .= '<option value="' . $usergroups[key($usergroups)] . '"'; if ($group_id == $usergroups[key($usergroups)]) { $groupdd .= ' SELECTED'; } $groupdd .= '>' . key($usergroups) . '</option>'; next($usergroups);
function display_wfFlowsStatus($uid = 0, $allflows = true) { global $_TABLES, $_CONF, $_USER, $CONF_NF, $LANG_NF00, $formstatus_options, $op; $searchString = COM_applyFilter($_POST['srchText']); $srchFilter = COM_applyFilter($_POST['srchFilter']); $srchOrderBy = COM_applyFilter($_POST['srchOrderBy']); $idForAppGroup = COM_applyFilter($_REQUEST['idAppGroup'], true); $srchOrderDir = COM_applyFilter($_POST['srchOrderDir']); $tmplt = new Template($_CONF['path_layout'] . 'nexflow/taskconsole'); $tmplt->set_file(array('page' => 'wfreport_layout.thtml', 'pageSections' => 'wfreport_page_sections.thtml', 'projectRow' => 'wfreport_project_row.thtml', 'regularRow' => 'wfreport_regular_row.thtml', 'outstandingtasks' => 'wfreport_outstanding.thtml', 'javascript' => 'javascript/taskconsole.thtml')); $tmplt->set_var('srchFilter', $LANG_NF00['srchFilter']); $tmplt->set_var('srchFilterTitle', $LANG_NF00['srchFilterTitle']); $tmplt->set_var('srchFilterReqDesc', $LANG_NF00['srchFilterReqDesc']); $tmplt->set_var('srchFilterPrjName', $LANG_NF00['srchFilterPrjName']); $tmplt->set_var('srchDoSearch', $LANG_NF00['srchDoSearch']); $tmplt->set_var('processFilter', $LANG_NF00['processFilter']); $tmplt->set_var('chooseAll', $LANG_NF00['chooseAll']); $tmplt->set_var('srchTxt', $searchString); $tmplt->set_var('srchOrderDir', $srchOrderDir); $tmplt->set_var('srchProcessRow', 'hidden'); $tmplt->set_var('whichop', $op); $tmplt->set_var('userid', $uid); $tmplt->set_var('site_url', $_CONF['site_url']); $tmplt->set_var('col2width', 'width="60%"'); $tmplt->set_var('statusvisible', 'none'); $tmplt->set_var('flowrecord_initialstate', 'none'); //search/filter area setup $appGroupDDL = COM_optionList($_TABLES['nf_appgroups'], 'id,AppGroup'); $tmplt->set_var('show_selectappfield', 'none'); $tmplt->set_var('show_searchtextfield', ''); switch (strtolower($srchFilter)) { case 'appgroup': $appGroupDDL = COM_optionList($_TABLES['nf_appgroups'], 'id,AppGroup', $idForAppGroup); $tmplt->set_var('srchselappgroup', 'selected'); $tmplt->set_var('show_selectappfield', ''); $tmplt->set_var('show_searchtextfield', 'none'); case 'title': $tmplt->set_var('srchseltitle', 'selected'); break; case 'desc': $tmplt->set_var('srchselreqdesc', 'selected'); break; } $tmplt->set_var('srchApplicationGroups', $appGroupDDL); $holdTaskLink = '<a href="#" onclick="ajaxPutProcessOnHold(%s,%s);"><img src="' . $_CONF['layout_url'] . '/nexflow/images/onhold.png" border=0 alt="%s"></a>'; $actionurl = $_CONF['site_url'] . '/nexflow/index.php'; $projectProcesses = array(); $relatedProcesses = ''; $sql = "SELECT related_processes from {$_TABLES['nf_projects']} "; $res = DB_query($sql); while ($B = DB_fetchArray($res)) { if ($B['related_processes'] != '') { if ($relatedProcesses == '') { $relatedProcesses = $B['related_processes']; } else { $relatedProcesses .= ',' . $B['related_processes']; } } } $uid = NXCOM_filterInt($uid); $sql = "SELECT DISTINCT a.id as nf_processID, a.nf_templateID, a.complete, a.initiator_uid, a.initiatedDate, "; $sql .= "a.completedDate, b.templateName, f.description as prjDescription,f.id as project_id, a.customFlowName "; $sql .= "FROM {$_TABLES['nf_process']} a "; $sql .= "INNER JOIN {$_TABLES['nf_template']} b ON a.nf_templateID = b.id "; $sql .= "INNER JOIN {$_TABLES['nf_templatedata']} c ON b.id = c.nf_templateID "; $sql .= "INNER JOIN {$_TABLES['nf_queue']} d ON (d.nf_templateDataId = c.id AND d.nf_processID = a.id) "; if ($srchFilter == 'appgroup') { $sql .= "INNER JOIN {$_TABLES['nf_appgroups']} i on b.AppGroup=i.id "; } $sql .= "LEFT OUTER JOIN {$_TABLES['nf_processvariables']} e ON ( e.nf_processid = a.id AND c.argumentvariable = e.nf_templateVariableId ) "; $sql .= "LEFT OUTER JOIN {$_TABLES['nf_projects']} f on (f.wf_process_id = a.id) "; $sql .= "LEFT OUTER JOIN {$_TABLES['nf_templatevariables']} g on (e.nf_templateVariableID=g.id) "; $sql .= "LEFT OUTER JOIN {$_TABLES['nf_projecttaskhistory']} h on h.process_id=a.id "; $sql .= "LEFT OUTER JOIN {$_TABLES['nf_productionassignments']} j ON (j.task_id = d.id ) "; $sql .= "WHERE 1=1 "; if (!$allflows) { $sql .= "AND (d.uid = '{$uid}' OR (e.variableValue = '{$uid}' AND g.variableName='INITIATOR') OR h.assigned_uid='{$uid}' OR j.uid='{$uid}') "; } $chksql = ''; //now to create the dynamic search string if ($srchFilter == 'appgroup') { if ($searchString != '') { $sql .= " AND (b.templateName like '%{$searchString}%' or c.taskname like '%{$searchString}%' or f.description like '%{$searchString}%') "; } $sql .= " AND (b.AppGroup='{$idForAppGroup}') "; $tmplt->set_var('srchselappgroup', 'selected'); } elseif ($searchString != '') { switch (strtolower($srchFilter)) { case 'title': $sql .= " AND (b.templateName like '{$searchString}%' or c.taskname like '{$searchString}%') "; $tmplt->set_var('srchseltitle', 'selected'); break; case 'desc': $sql .= " AND (f.description like '{$searchString}%') "; $tmplt->set_var('srchselreqdesc', 'selected'); break; default: $sql .= " AND (b.templateName like '%{$searchString}%' or c.taskname like '%{$searchString}%' or f.description like '%{$searchString}%') "; break; } } if ($relatedProcesses != '') { $sql .= " AND a.id not in ({$relatedProcesses})"; } $res = DB_query($sql); $nrows = DB_numRows($res); $i = 0; $timesThru = 0; $completedRecords = 0; $activeRecords = 0; if ($nrows > 0) { while ($A = DB_fetchArray($res)) { //cycle thru the Active result set. $i += 1; $rowid = $i; $project_id = $A['project_id']; if ($A['project_id'] != '' && $A['project_id'] != NULL) { if (SEC_hasRights('nexflow.admin')) { if ($A['complete'] == 3) { $tmplt->set_var('onHoldIMG', sprintf($holdTaskLink, $i, $A['nf_processID'], 'Re-activate')); $tmplt->set_var('isOnHold', ''); } elseif ($A['complete'] != 1) { $tmplt->set_var('onHoldIMG', sprintf($holdTaskLink, $i, $A['nf_processID'], 'Toggle On-Hold')); $tmplt->set_var('isOnHold', 'none'); } else { $tmplt->set_var('onHoldIMG', ''); $tmplt->set_var('isOnHold', 'none'); } } else { if ($A['complete'] == 3) { $tmplt->set_var('isOnHold', ''); } elseif ($A['complete'] != 1) { $tmplt->set_var('isOnHold', 'none'); } else { $tmplt->set_var('onHoldIMG', ''); $tmplt->set_var('isOnHold', 'none'); } } $tmplt->set_var('hold_icon', 'onhold2.png'); $tmplt->set_var('imgset', $_CONF['layout_url'] . '/nexflow/images'); $tmplt->set_var('whichID', $A['nf_processID']); $tmplt->set_var('flowStatus', $CONF_NF['processstatus'][$A['complete']]); if ($A['pid'] != 0) { $tmplt->set_var('isRegenerated', '<span style="color:red">[R]</span>'); } $tmplt->set_var('project_id', $project_id); $tmplt->set_var('rowid', $rowid); $prjDesc = ''; if ($A['prjDescription'] == '') { $prjDesc = $A['templateName']; } else { $prjDesc = $A['prjDescription']; } if ($A['customFlowName'] != '') { $prjDesc = $A['customFlowName']; } $tmplt->set_var('prjDescription', $prjDesc); $tmplt->set_var('initiatedDate', $A['initiatedDate']); if ($A['completedDate'] == '' || $A['completedDate'] == NULL) { $tmplt->set_var('completedDate', 'Active'); } else { $tmplt->set_var('completedDate', $A['completedDate']); } $tmplt->set_var('prjDetailsIMG', '<img src="' . $_CONF['layout_url'] . '/nexflow/images/details.png" border="0" TITLE="View Details">'); $actionurl = $_CONF['site_url'] . '/nexflow/index.php'; if ($A['complete'] == 0 || $A['complete'] == 3) { $tmplt->set_var('state', 'active'); $tmplt->parse('prjrowOutput', 'projectRow', true); $activeRecords++; } else { $tmplt->set_var('state', 'complete'); $tmplt->parse('completedOutput', 'projectRow', true); $completedRecords++; } } else { if (SEC_hasRights('nexflow.admin')) { if ($A['complete'] == 3) { $tmplt->set_var('onHoldIMG', sprintf($holdTaskLink, $i, $A['nf_processID'], 'Re-activate')); $tmplt->set_var('isOnHold', ''); } elseif ($A['complete'] != 1) { $tmplt->set_var('onHoldIMG', sprintf($holdTaskLink, $i, $A['nf_processID'], 'Toggle On-Hold')); $tmplt->set_var('isOnHold', 'none'); } else { $tmplt->set_var('onHoldIMG', ''); $tmplt->set_var('isOnHold', 'none'); } } else { if ($A['complete'] == 3) { $tmplt->set_var('isOnHold', ''); } elseif ($A['complete'] != 1) { $tmplt->set_var('isOnHold', 'none'); } else { $tmplt->set_var('onHoldIMG', ''); $tmplt->set_var('isOnHold', 'none'); } } $tmplt->set_var('hold_icon', 'onhold2.png'); $tmplt->set_var('imgset', $_CONF['layout_url'] . '/nexflow/images'); $tmplt->set_var('rowid', $i); //we have a row that does NOT have a project entry $tmplt->set_var('whichID', $A['nf_processID']); $tmplt->set_var('flowStatus', $CONF_NF['processstatus'][$A['complete']]); if ($A['pid'] != 0) { $tmplt->set_var('isRegenerated', '<span style="color:red">[R]</span>'); } $tmplt->set_var('prjDescription', $A['templateName']); $tmplt->set_var('initiatedDate', $A['initiatedDate']); if ($A['completedDate'] == '' || $A['completedDate'] == NULL) { $tmplt->set_var('completedDate', 'Active'); } else { $tmplt->set_var('completedDate', $A['completedDate']); } $tmplt->set_var('prjDetailsIMG', '<img src="' . $_CONF['layout_url'] . '/nexflow/images/details.png" border="0" TITLE="View Details">'); $projectProcesses = explode(',', $relatedProcesses); nf_formatOutstandingTasks($A['nf_processID'], $projectProcesses, $tmplt); if ($A['complete'] == 0 || $A['complete'] == 3) { $tmplt->set_var('state', 'active'); $tmplt->parse('prjrowOutput', 'regularRow', true); $activeRecords++; } else { if ($A['complete'] != 2) { //this strips off the regen'd task $tmplt->set_var('state', 'complete'); $tmplt->parse('completedOutput', 'regularRow', true); $completedRecords++; } } } } } $tmplt->set_var('active_label', "Active ({$activeRecords})"); $tmplt->set_var('completed_label', "Completed ({$completedRecords})"); $tmplt->set_var('showActive', $otpt . $tmplt->get_var('prjrowOutput')); $tmplt->set_var('showCompleted', $otpt . $tmplt->get_var('completedOutput')); $tmplt->set_var('layout_url', $_CONF['layout_url']); $tmplt->set_var('open_icon', 'arrow-down.gif'); $tmplt->set_var('closed_icon', 'arrow-right.gif'); $tmplt->parse('mainFilterPage', 'pageSections'); $tmplt->set_var('results', $tmplt->get_var('mainFilterPage')); $tmplt->set_var('beginCommentOut', '/*'); $tmplt->set_var('endCommentOut', '*/'); $tmplt->parse('javascript_code', 'javascript'); $tmplt->parse('output', 'page', true); echo $tmplt->finish($tmplt->get_var('output')); }
/** * Displays the comment form * * @param string $title Title of comment * @param string $comment Text of comment * @param string $sid ID of object comment belongs to * @param int $pid ID of parent comment * @param string $type Type of object comment is posted to * @param string $mode Mode, e.g. 'preview' * @param string $postmode Indicates if comment is plain text or HTML * @param string $format 'threaded', 'nested', or 'flat' * @param string $order 'ASC' or 'DESC' or blank * @param int $page Page number of comments to display * @return string HTML for comment form * */ function CMT_commentForm($title, $comment, $sid, $pid = '0', $type, $mode, $postmode, $format = '', $order = '', $page = '') { global $_CONF, $_TABLES, $_USER, $LANG01, $LANG03, $LANG12, $LANG_ADMIN, $LANG_ACCESS, $MESSAGE, $_SCRIPTS; $retval = ''; // never trust $uid ... if (empty($_USER['uid'])) { $uid = 1; } else { $uid = $_USER['uid']; } if (empty($format)) { if (isset($_REQUEST['format'])) { $format = COM_applyFilter($_REQUEST['format']); } if (!in_array($format, array('threaded', 'nested', 'flat', 'nocomment'))) { if (COM_isAnonUser()) { $format = $_CONF['comment_mode']; } else { $format = DB_getItem($_TABLES['usercomment'], 'commentmode', "uid = {$uid}"); } } } if (empty($order)) { if (isset($_REQUEST['order'])) { $order = COM_applyFilter($_REQUEST['order']); } } if (empty($page)) { if (isset($_REQUEST['cpage'])) { $page = COM_applyFilter($_REQUEST['cpage'], true); if (empty($page)) { $page = 1; } } } $commentuid = $uid; $table = ''; if ($mode == 'edit' || $mode == $LANG03[28]) { $table = $_TABLES['comments']; } elseif ($mode == 'editsubmission' || $mode == $LANG03[34]) { $table = $_TABLES['commentsubmissions']; } if (!empty($table)) { $cid = 0; if (isset($_REQUEST[CMT_CID])) { $cid = COM_applyFilter($_REQUEST[CMT_CID], true); } if ($cid <= 0) { return COM_refresh($_CONF['site_url'] . '/index.php'); } $commentuid = DB_getItem($table, 'uid', "cid = '{$cid}'"); } if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['commentsloginrequired'] == 1)) { $retval .= SEC_loginRequiredForm(); return $retval; } else { COM_clearSpeedlimit($_CONF['commentspeedlimit'], 'comment'); $last = 0; if ($mode != 'edit' && $mode != 'editsubmission' && $mode != $LANG03[28] && $mode != $LANG03[34]) { // not edit mode or preview changes $last = COM_checkSpeedlimit('comment'); } if ($last > 0) { if (COMMENT_ON_SAME_PAGE) { $retval .= COM_showMessageText($LANG03[45], $MESSAGE[40]); } else { $retval .= COM_showMessageText($LANG03[7] . $last . $LANG03[8], $LANG12[26]); } } else { // Add JavaScript $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js'); if ($postmode != 'html' && $postmode != 'plaintext') { if (empty($postmode) && $_CONF['advanced_editor'] && $_USER['advanced_editor']) { $postmode = 'html'; } elseif (empty($postmode)) { $postmode = $_CONF['postmode']; } } $sig = ''; if ($uid > 1) { $sig = DB_getItem($_TABLES['users'], 'sig', "uid = '{$uid}'"); } // Note: // $comment / $newcomment is what goes into the preview / is // actually stored in the database -> strip HTML // $commenttext is what the user entered and goes back into the // <textarea> -> don't strip HTML $commenttext = htmlspecialchars(COM_stripslashes($comment)); // Replace $, {, and } with special HTML equivalents $commenttext = str_replace('$', '$', $commenttext); $commenttext = str_replace('{', '{', $commenttext); $commenttext = str_replace('}', '}', $commenttext); // Remove any autotags the user doesn't have permission to use $commenttext = PLG_replaceTags($commenttext, '', true); // Autotags can now be used in templates when an article is rendered // for this reason, replace [, ] in order to prevent garbled characters $commenttext = str_replace('[', '[', $commenttext); $commenttext = str_replace(']', ']', $commenttext); $title = COM_checkWords(strip_tags(COM_stripslashes($title))); // $title = str_replace('$','$',$title); done in CMT_getComment $_POST['title'] = $title; $newcomment = $comment; if ($mode == $LANG03[28]) { // for preview $newcomment = CMT_prepareText($comment, $postmode, $type, true, $cid); } elseif ($mode == $LANG03[34]) { $newcomment = CMT_prepareText($comment, $postmode, $type, true); } else { $newcomment = CMT_prepareText($comment, $postmode, $type); } $_POST['comment'] = $newcomment; // Preview mode: if (($mode == $LANG03[14] || $mode == $LANG03[28] || $mode == $LANG03[34]) && !empty($title) && !empty($comment)) { $start = COM_newTemplate($_CONF['path_layout'] . 'comment'); $start->set_file(array('comment' => 'startcomment.thtml')); $start->set_var('hide_if_preview', 'style="display:none"'); $start->set_var('area_id', 'commentpreview'); // Clean up all the vars $A = array(); foreach ($_POST as $key => $value) { if ($key == CMT_PID || $key == CMT_CID) { $A[$key] = COM_applyFilter($_POST[$key], true); } else { if ($key == 'title' || $key == 'comment') { // these have already been filtered above $A[$key] = $_POST[$key]; } else { if ($key == CMT_USERNAME) { $A[$key] = htmlspecialchars(COM_checkWords(strip_tags(COM_stripslashes($_POST[$key])))); } else { $A[$key] = COM_applyFilter($_POST[$key]); } } } } // correct time and username for edit preview if ($mode == $LANG03[28] || $mode == $LANG03[34]) { $A['nice_date'] = DB_getItem($table, 'UNIX_TIMESTAMP(date)', "cid = '{$cid}'"); if ($_USER['uid'] != $commentuid) { $uresult = DB_query("SELECT username, fullname, email, photo FROM {$_TABLES['users']} WHERE uid = {$commentuid}"); $A = array_merge($A, DB_fetchArray($uresult)); } } if ($uid != 1 || empty($A[CMT_USERNAME])) { $A[CMT_USERNAME] = DB_getItem($_TABLES['users'], 'username', "uid = {$uid}"); } if (COMMENT_ON_SAME_PAGE) { if (isset($A[CMT_CID])) { $A['cid'] = $A[CMT_CID]; } $A['sid'] = $A[CMT_SID]; $A['pid'] = $A[CMT_PID]; $A['uid'] = $A[CMT_UID]; $A['type'] = $A[CMT_TYPE]; $A['username'] = $A[CMT_USERNAME]; } $thecomments = CMT_getComment($A, 'flat', $type, 'ASC', false, true); $start->set_var('comments', $thecomments); $retval .= COM_startBlock($LANG03[14]) . $start->finish($start->parse('output', 'comment')) . COM_endBlock(); } else { if ($mode == $LANG03[14]) { $retval .= COM_showMessageText($LANG03[12], $LANG03[17]); $mode = 'error'; } } $permission = $type == 'article' ? 'story.edit' : "{$type}.edit"; $comment_template = COM_newTemplate($_CONF['path_layout'] . 'comment'); if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) { $comment_template->set_file('form', 'commentform_advanced.thtml'); if (COM_isAnonUser()) { $link_message = ""; } else { $link_message = $LANG01[138]; } $comment_template->set_var('noscript', COM_getNoScript(false, '', $link_message)); // Setup Advanced Editor COM_setupAdvancedEditor('/javascript/submitcomment_adveditor.js', $permission); } else { $comment_template->set_file('form', 'commentform.thtml'); } $is_comment_page = CMT_isCommentPage(); if ($is_comment_page) { $comment_template->set_var('nprefix', ''); } else { $comment_template->set_var('nprefix', 'cmt_'); } $comment_template->set_var('format', $format); $comment_template->set_var('order', $order); $comment_template->set_var('cpage', $page); $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[1])); if ($_CONF['show_fullname'] == 1) { $comment_template->set_var('lang_username', $LANG_ACCESS['name']); } elseif (COM_isAnonUser()) { $comment_template->set_var('lang_username', $LANG03[44]); } else { $comment_template->set_var('lang_username', $LANG03[5]); } $comment_template->set_var('sid', $sid); $comment_template->set_var('pid', $pid); $comment_template->set_var('type', $type); if ($mode == 'edit' || $mode == 'editsubmission' || $mode == $LANG03[28] || $mode == $LANG03[34]) { $comment_template->set_var('hidewhenediting', ' style="display:none;"'); } else { $comment_template->set_var('hidewhenediting', ''); } if (COMMENT_ON_SAME_PAGE) { list($plgurl, $plgid) = CMT_getCommentUrlId($type); // Filemgmt plugin is doing special processing. // Therefore, I support specially, against my better judgment. // May should delete this code part. if ($type == 'filemgmt') { $sid = str_replace('fileid_', '', $sid); } $formurl = "{$plgurl}?{$plgid}={$sid}#commentpreview"; } else { $formurl = $_CONF['site_url'] . '/comment.php#commentpreview'; // commentpreview needed for when showing replies on the same page } if ($mode == 'edit' || $mode == $LANG03[28]) { //edit modes $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[32])); $comment_template->set_var('cid', '<input type="hidden" name="' . CMT_CID . '" value="' . $cid . '"' . XHTML . '>'); } else { if ($mode == 'editsubmission' || $mode == $LANG03[34]) { $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[33])); $comment_template->set_var('cid', '<input type="hidden" name="' . CMT_CID . '" value="' . $cid . '"' . XHTML . '>'); } else { $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[1])); $comment_template->set_var('cid', ''); } } $comment_template->set_var('form_url', $formurl); if (COM_isAnonUser()) { // Anonymous user $comment_template->set_var('uid', 1); if (isset($A[CMT_USERNAME])) { $name = $A[CMT_USERNAME]; // for preview } elseif (isset($_COOKIE[$_CONF['cookie_anon_name']])) { // stored as cookie, name used before $name = htmlspecialchars(COM_checkWords(strip_tags(COM_stripslashes($_COOKIE[$_CONF['cookie_anon_name']])))); } else { $name = COM_getDisplayName(1); // anonymous user } $usernameblock = '<input type="text" name="' . CMT_USERNAME . '" size="16" value="' . $name . '" maxlength="32"' . XHTML . '>'; $comment_template->set_var('username', $usernameblock); $comment_template->set_var('action_url', $_CONF['site_url'] . '/users.php?mode=new'); $comment_template->set_var('lang_logoutorcreateaccount', $LANG03[04]); } else { if ($commentuid != $_USER['uid']) { $uresult = DB_query("SELECT username, fullname FROM {$_TABLES['users']} WHERE uid = {$commentuid}"); list($username, $fullname) = DB_fetchArray($uresult); } else { $username = $_USER['username']; $fullname = $_USER['fullname']; } $comment_template->set_var('gltoken_name', CSRF_TOKEN); $comment_template->set_var('gltoken', SEC_createToken()); $comment_template->set_var('uid', $commentuid); $name = COM_getDisplayName($commentuid, $username, $fullname); $comment_template->set_var('username', $name); $comment_template->set_var('action_url', $_CONF['site_url'] . '/users.php?mode=logout'); $comment_template->set_var('lang_logoutorcreateaccount', $LANG03[03]); } $comment_template->set_var('lang_cancel', $LANG_ADMIN['cancel']); if ($mode == 'editsubmission' or $mode == 'edit' or $mode == $LANG03[34] or $mode == $LANG03[28]) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $comment_template->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $comment_template->set_var('allow_delete', true); $comment_template->set_var('lang_delete', $LANG_ADMIN['delete']); $comment_template->set_var('confirm_message', $MESSAGE[76]); } if ($mode == 'editsubmission' or $mode == $LANG03[34]) { // Preview Submission changes (for edit) $comment_template->set_var('formtype', 'editsubmission'); } elseif ($mode == 'edit' or $mode == $LANG03[28]) { // Preview changes (for edit) $comment_template->set_var('formtype', 'edit'); } else { $comment_template->set_var('formtype', 'new'); } if ($postmode == 'html') { $comment_template->set_var('show_texteditor', 'none'); $comment_template->set_var('show_htmleditor', ''); } else { $comment_template->set_var('show_texteditor', ''); $comment_template->set_var('show_htmleditor', 'none'); } $comment_template->set_var('lang_title', $LANG03[16]); $comment_template->set_var('title', htmlspecialchars($title)); $comment_template->set_var('lang_comment', $LANG03[9]); $comment_template->set_var('comment', $commenttext); $comment_template->set_var('lang_postmode', $LANG03[2]); $comment_template->set_var('postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode)); $allowed_html = ''; foreach (array('plaintext', 'html') as $pm) { $allowed_html .= COM_allowedHTML($permission, false, 1, $pm); } $allowed_html .= COM_allowedAutotags(); $comment_template->set_var('allowed_html', $allowed_html); $comment_template->set_var('lang_importantstuff', $LANG03[18]); $comment_template->set_var('lang_instr_line1', $LANG03[19]); $comment_template->set_var('lang_instr_line2', $LANG03[20]); $comment_template->set_var('lang_instr_line3', $LANG03[21]); $comment_template->set_var('lang_instr_line4', $LANG03[22]); $comment_template->set_var('lang_instr_line5', $LANG03[23]); if ($mode == 'edit' || $mode == $LANG03[28]) { //editing comment or preview changes $comment_template->set_var('lang_preview', $LANG03[28]); } elseif ($mode == 'editsubmission' || $mode == $LANG03[34]) { $comment_template->set_var('lang_preview', $LANG03[34]); } else { //new comment $comment_template->set_var('lang_preview', $LANG03[14]); } if ($mode == $LANG03[28] || $mode == 'edit' && $_CONF['skip_preview'] == 1) { PLG_templateSetVars('comment', $comment_template); // Only for a edit form with a save button displayed (CAPTCHA related issue) // for editing $comment_template->set_var('save_option', '<input type="submit" name="' . CMT_MODE . '" value="' . $LANG03[29] . '"' . XHTML . '>'); $comment_template->set_var('allow_save', true); $comment_template->set_var('lang_save', $LANG03[29]); } elseif ($mode == $LANG03[34] || $mode == 'editsubmission' && $_CONF['skip_preview'] == 1) { PLG_templateSetVars('comment', $comment_template); // editing submission comment $comment_template->set_var('save_option', '<input type="submit" name="' . CMT_MODE . '" value="' . $LANG03[35] . '"' . XHTML . '>'); $comment_template->set_var('allow_save', true); $comment_template->set_var('lang_save', $LANG03[35]); } elseif ($_CONF['skip_preview'] == 1 || $mode == $LANG03[14]) { PLG_templateSetVars('comment', $comment_template); $comment_template->set_var('save_option', '<input type="submit" name="' . CMT_MODE . '" value="' . $LANG03[11] . '"' . XHTML . '>'); $comment_template->set_var('allow_save', true); $comment_template->set_var('lang_save', $LANG03[11]); } if ($_CONF['allow_reply_notifications'] == 1 && $uid != 1 && ($mode == '' || $mode == $LANG03[14] || $mode == 'error')) { $checked = ''; if (isset($_POST['notify'])) { $checked = ' checked="checked"'; } $comment_template->set_var('notification', '<p><input type="checkbox"' . ' name="notify"' . $checked . '>' . $LANG03[36] . '</p>'); } $comment_template->set_var('end_block', COM_endBlock()); $comment_template->parse('output', 'form'); $retval .= $comment_template->finish($comment_template->get_var('output')); } } return $retval; }
function display_mytasks() { global $CONF_NF, $_USER, $_CONF, $_POST, $_TABLES, $actionurl, $formstatus_options, $usermodeUID, $optLinkVars, $errmsg, $LANG_NF00; $nfclass = new nexflow(); $nfclass->_nfUserId = $usermodeUID; $nfclass->set_debug(false); $nfclass->getQueue(); $srchFilter = COM_applyFilter($_REQUEST['srchFilter']); $srchText = COM_applyFilter($_REQUEST['srchText']); $idForAppGroup = COM_applyFilter($_REQUEST['idAppGroup'], true); $searchString = COM_applyFilter($_REQUEST['srchText']); $srchStatus = COM_applyFilter($_REQUEST['srchStatus']); $doSearch = COM_applyFilter($_POST['dosearch']); $taskconsolefilter = COM_applyFilter($_POST['taskconsolefilter'], true); $taskSort = COM_applyFilter($_REQUEST['tasksort']); $sortDirection = COM_applyFilter($_REQUEST['sortorder']); if (empty($taskSort)) { $taskSort = 'cdate'; } if (empty($sortDirection)) { $sortDirection = 'desc'; } //RK included these items here for future filtering abilities $pagesize = COM_applyFilter($_REQUEST['$pagesize'], true); $filterdate = COM_applyFilter($_REQUEST['filterdate']); $page = COM_applyFilter($_REQUEST['$page'], true); $imgset = $_CONF['layout_url'] . '/nexflow/images'; $headingFilterOptions = '&taskuser='******'desc') { $headingFilterOptions .= '&sortorder=asc'; } else { $headingFilterOptions .= '&sortorder=desc'; } if (!empty($srchFilter)) { $headingFilterOptions .= "&srchFilter={$srchFilter}"; } if (!empty($srchText)) { $headingFilterOptions .= "&srchText={$srchText}"; } if (!empty($idForAppGroup)) { $headingFilterOptions .= "&idAppGroup={$idForAppGroup}"; } if (!empty($srchStatus)) { $headingFilterOptions .= "&srchStatus={$srchStatus}"; } $p = new Template($_CONF['path_layout'] . 'nexflow'); $p->set_file(array('report' => 'taskconsole/viewtasks.thtml', 'records' => 'taskconsole/viewtask_record.thtml', 'javascript' => 'taskconsole/javascript/taskconsole.thtml')); $p->set_var('layout_url', $_CONF['layout_url']); $p->set_var('site_url', $_CONF['site_url']); $p->set_var('imgset', $imgset); $p->set_var('actionurl', $actionurl); $p->set_var('taskuser', $usermodeUID); $p->set_var('show_awaystatus', 'none'); $heading1 = "<a href=\"{$actionurl}?tasksort=template{$headingFilterOptions}\">Flow Name</a>"; if ($taskSort == 'template') { if ($sortDirection == 'asc') { $heading1 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowdown.gif" border="0"></span>'; } else { $heading1 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowup.gif" border="0"></span>'; } } $p->set_var('heading1', $heading1); $heading2 = "<a href=\"{$actionurl}?tasksort=taskname{$headingFilterOptions}\">Task Name</a>"; if ($taskSort == 'taskname') { if ($sortDirection == 'asc') { $heading2 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowdown.gif" border="0"></span>'; } else { $heading2 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowup.gif" border="0"></span>'; } } $heading2 .= '<span style="padding-left:5px;font-weight:normal;font-size:9px;">[click on task name to perform]</span>'; $p->set_var('heading2', $heading2); $heading3 = "<a href=\"{$actionurl}?tasksort=cdate{$headingFilterOptions}\">Assigned</a>"; if ($taskSort == 'cdate') { if ($sortDirection == 'asc') { $heading3 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowdown.gif" border="0"></span>'; } else { $heading3 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowup.gif" border="0"></span>'; } } $p->set_var('heading3', $heading3); $p->set_var('srchText', $LANG_NF00['srchText']); $p->set_var('srchFilter', $LANG_NF00['srchFilter']); $p->set_var('srchFilterTitle', $LANG_NF00['srchFilterTitle']); $p->set_var('srchFilterReqDesc', $LANG_NF00['srchFilterReqDesc']); $p->set_var('srchFilterPrjName', $LANG_NF00['srchFilterPrjName']); $p->set_var('srchDoSearch', $LANG_NF00['srchDoSearch']); //search/filter area setup $appGroupDDL = COM_optionList($_TABLES['nf_appgroups'], 'id,AppGroup'); $p->set_var('show_selectappfield', 'none'); $p->set_var('show_searchtextfield', ''); switch (strtolower($srchFilter)) { case 'appgroup': $appGroupDDL = COM_optionList($_TABLES['nf_appgroups'], 'id,AppGroup', $idForAppGroup); $p->set_var('srchselappgroup', 'selected'); $p->set_var('show_selectappfield', ''); $p->set_var('show_searchtextfield', 'none'); case 'title': $p->set_var('srchseltitle', 'selected'); break; case 'desc': $p->set_var('srchselreqdesc', 'selected'); break; } $p->set_var('srchTextValue', $srchText); $p->set_var('srchApplicationGroups', $appGroupDDL); switch ($srchStatus) { case 1: $srchStatus = 0; //since the COM_applyfilter makes everything zero, we need to change this from 1 to 0 in code. $p->set_var('srchselactive', 'selected'); break; case 2: $p->set_var('srchselonhold', 'selected'); break; case 3: $p->set_var('srchselstarted', 'selected'); break; case 4: $p->set_var('srchselunstarted', 'selected'); break; case -1: $p->set_var('srchselany', 'selected'); break; } $sel_sort_options = ''; foreach ($CONF_NF['sortOptions'] as $value => $label) { if ($taskSort == $value) { $sel_sort_options .= '<option value="' . $value . '" SELECTED=SELECTED>' . $label . '</option>'; $p->set_var('selected_tasksort_option', $value); } else { $sel_sort_options .= '<option value="' . $value . '">' . $label . '</option>'; } } $p->set_var('sel_sort_options', $sel_sort_options); //end of search/filter area if (trim($errmsg) != '') { $p->set_var('error_message', $errmsg); } else { $p->set_var('show_message', 'none'); } // Test to see if we enable the ability to select taskconsole view for another user if (SEC_hasRights('nexflow.admin')) { $p->set_var('show_seltaskuser', ''); $p->set_var('sel_user_options', COM_optionList($_TABLES['users'], 'uid,username', $usermodeUID)); } else { $p->set_var('show_seltaskuser', 'none'); $p->set_var('sel_user_options', ''); } if ($_REQUEST['autoclose']) { $autoclose = '<script type="text/javascript">' . LB; $autoclose .= 'window.onload = function() { ' . LB; $autoclose .= ' self.close();' . LB; $autoclose .= ' return true;' . LB; $autoclose .= '}' . LB; $autoclose .= '</script>' . LB; $p->set_var('javascript_close_onload', $autoclose); } $LANG_CONFIRM = 'Please confirm that you want to delete this process and task records'; /* Clicking on Task Name triggers action and need to use icon in Actions Column to display project Details */ $newFormLink = $actionurl . '?op=edit&formid=%s&projectid=%s&taskid=%s' . $optLinkVars; $editFormLink = $actionurl . '?op=edit&formid=%s&result=%s&taskid=%s' . $optLinkVars; $onClick_action = 'OnClick="ajaxStartTask(%s);"'; /* @TODO: Commented out for now (Blaine) //$holdTaskLink = '<a href="#" onclick="ajaxPutOnHold(%s,%s);"><img src="' . $_CONF['layout_url'] . '/nexflow/images/onhold.png" border=0 alt="%s"></a>'; */ // Check if this user has any tasks that were reassigned $reassignedTaskCount = DB_count($_TABLES['nf_productionassignments'], 'assignBack_uid', $usermodeUID); if ($reassignedTaskCount > 0) { $reassignment_message .= '<div style="font-weight:normal;padding-left:20px;">'; if ($reassignedTaskCount == 1) { $reassignment_message .= "You have 1 task that has been re-assigned. Click "; } else { $reassignment_message .= "You have {$reassignedTaskCount} tasks that have been re-assigned. Click "; } $reassignment_message .= '<a href="' . $actionurl . '?op=reassignments' . $optLinkVars . '">here</a> to view them</div>'; $p->set_var('reassignment_message', $reassignment_message); } else { $p->set_var('show_reassignmentmessage', 'none'); } /* This delete feature is disabled for production use via a config option. It will delete all related records for the project this task is linked to */ $deleteLink = '<a href="' . $actionurl . '?op=delete&taskid=%s&project_id=%s' . $optLinkVars . '" onclick="return confirm(\'' . $LANG_CONFIRM . '\');">'; $deleteLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/delete.gif" border="0" TITLE="Delete Record"></a>'; $tasks = $nfclass->get_tasks(); if ($taskconsolefilter) { $p->set_var('lang_hidefilter', 'hide filter'); $sortedtasks = nf_getSortedTaskArray($tasks, $srchFilter, $taskSort, $srchText, $idForAppGroup, $srchStatus, $sortDirection); } elseif (!empty($taskSort)) { $p->set_var('hidefilter', 'none'); $p->set_var('lang_hidefilter', 'show filter'); $sortedtasks = nf_getSortedTaskArray($tasks, $srchFilter, $taskSort, $srchText, $idForAppGroup, $srchStatus, $sortDirection); } else { $p->set_var('hidefilter', 'none'); $p->set_var('lang_hidefilter', 'show filter'); if (is_array($tasks) and count($tasks) > 0) { arsort($tasks); // Show latest task first $sortedtasks = $tasks; } else { $sortedtasks = ''; } } if (is_array($sortedtasks) and count($sortedtasks) > 0) { $i = 1; $p->set_var('num_records', count($sortedtasks)); foreach ($sortedtasks as $taskrec) { $p->set_var('task_action_url', ''); $p->set_var('task_onclick', ''); $p->set_var('edit', '<span style="padding-left:2px;"> </span>'); $p->set_var('rowid', $i); $p->set_var('csscode', $i % 2 + 1); $p->set_var('class_newtask', ''); $startedDate = DB_getItem($_TABLES['nf_queue'], 'startedDate', "id='{$taskrec['id']}'"); $taskStatus = DB_getItem($_TABLES['nf_queue'], 'status', "id='{$taskrec['id']}'"); $p->set_var('on_hold_notice', ''); if ($taskStatus == 2) { $p->set_var('task_icon', 'onhold2.png'); $p->set_var('on_hold_notice', '<p style="margin-bottom:5px;color:red">This Task is ON HOLD. It cannot be executed until it is put back into active status.</p>'); } else { $p->set_var('task_icon', 'task.gif'); } if ($startedDate == NULL or $startedDate == 0) { $p->set_var('task_icon', 'new_task.gif'); $p->set_var('task_started_date', ",task not started"); $p->set_var('task_onclick', sprintf($onClick_action, $taskrec['id'])); } else { $p->set_var('task_started_date', ",started:{$startedDate}"); $p->set_var('task_onclick', ''); } $nfclass->_nfProcessId = $taskrec['processid']; $project_id = $nfclass->get_ProcessVariable('PID'); $project_id = NXCOM_filterInt($project_id); if ($project_id == 0) { //lets try to do a simple select in the nfprojects table to ensure no project exists. $sql = "SELECT id from {$_TABLES['nf_projects']} where wf_process_id='{$taskrec['processid']}'"; $res = DB_query($sql); list($project_id) = DB_fetchArray($res); $project_id = NXCOM_filterInt($project_id); } //at this point, if the project_id is still 0, then we have no project data to show //show a general task console line item for execution by the end user. $taskStatus = DB_getItem($_TABLES['nf_queue'], 'status', "id='{$taskrec['id']}'"); if (SEC_hasRights('nexflow.admin')) { if ($taskStatus == 2) { $p->set_var('hold', sprintf($holdTaskLink, $i, $taskrec['id'], 'Re-activate')); } else { $p->set_var('hold', sprintf($holdTaskLink, $i, $taskrec['id'], 'Toggle On-Hold')); } } if ($project_id > 0) { $p->set_var('hidetaskinfo', ''); $project_detailsLink = '<a href="#" onClick=\'ajaxViewProjectDetails(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/details.png" border="0" TITLE="View Project Details"></a> '; $project_detailsLink .= '<a href="#" onClick=\'ajaxViewProjectComments(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/comment.gif" border="0" TITLE="View Project Comments"></a> '; // If task is for a project on hold or in a Recycled or Killed status then do not show it // There should never be any tasks appearing is status is Killed as that workflow should have been forced to complete state. $project_state = DB_getItem($_TABLES['nf_projects'], 'status', "id='{$project_id}'"); if ($project_state != 6 && $project_state != 7) { if ($nfclass->_debug) { $logmsg = "Row:{$i} -> Project ID:{$project_id},Task ID:{$taskrec['id']}. "; $logmsg .= "Processid:{$taskrec['processid']}, Task:{$taskrec['taskname']}, "; $logmsg .= "TaskID: {$taskrec['templateTaskid']}, TaskType: {$taskrec['stepType']}"; COM_errorLog($logmsg); } $p->set_var('task_id', $taskrec['id']); $p->set_var('project_id', $project_id); $p->set_var('project_details', sprintf($project_detailsLink, $i, $project_id, $usermodeUID, $taskrec['id'], $i, $project_id, $usermodeUID, $taskrec['id'])); // Determine if this task is for a regenerated workflow and we need to update the main project/request record $parentProcessID = DB_getItem($_TABLES['nf_process'], 'pid', "id='{$taskrec['processid']}'"); if ($parentProcessID > 0) { // Now check if this same template task id was executed in the previous process - if so then it is a recycled task // Don't show the re-generated attribute if in this instance of the process we proceed further and are executing new tasks if (DB_count($_TABLES['nf_queue'], array('nf_processID', 'nf_templateDataId'), array($parentProcessID, $taskrec['templateTaskid'])) > 0) { $taskrec['taskname'] = '<div style="color:red;padding-right:5px;display:inline;">[R]</div>' . $taskrec['taskname']; } } $pquery = DB_query("SELECT wf_process_id FROM {$_TABLES['nf_projects']} WHERE id='{$project_id}'"); list($wf_process_id) = DB_fetchArray($pquery); if ($wf_process_id > 0 and $wf_process_id == $parentProcessID) { if ($nfclass->_debug) { COM_errorLog("Taskconsole: Updated wf_process_id for project: {$project_id} from {$wf_process_id} to {$taskrec['processid']}"); } DB_query("UPDATE {$_TABLES['nf_projects']} SET wf_process_id='{$taskrec['processid']}' WHERE id='{$project_id}'"); } $p->set_var('project_number', $project_id); // Retrieve any Project Comments $comment_count = DB_count($_TABLES['nf_projectcomments'], 'project_id', $project_id); if ($comment_count > 0) { $csql = "SELECT timestamp, b.username FROM {$_TABLES['nf_projectcomments']} a "; $csql .= "LEFT JOIN {$_TABLES['users']} b on a.uid=b.uid WHERE project_id='{$project_id}' "; $csql .= "ORDER BY timestamp DESC LIMIT 1"; list($timestamp, $username) = DB_fetchArray(DB_query($csql)); $p->set_var('comments_note', "({$comment_count}) <b>Last by:</b> {$username}, " . strftime('%m/%d/%Y %H:%M', $timestamp)); } else { $p->set_var('comments_note', 'No Comments'); } // If this this is an interactive tasktype - Check and see if taskhistory record has a "started" timestamp set. if ($taskrec['stepType'] == 1 or $taskrec['stepType'] == 7 or $taskrec['stepType'] == 8) { $q1 = DB_query("SELECT project_id,date_started FROM {$_TABLES['nf_projecttaskhistory']} WHERE task_id='{$taskrec['id']}'"); if (DB_numRows($q1) == 0) { // No task history record yet $p->set_var('class_newtask', 'class="nexflowNewTask"'); $q2 = DB_query("SELECT UNIX_TIMESTAMP(createdDate) FROM {$_TABLES['nf_queue']} WHERE id='{$taskrec['id']}' "); list($date_assigned) = DB_fetchArray($q2); DB_query("INSERT INTO {$_TABLES['nf_projecttaskhistory']} (project_id,process_id,task_id,assigned_uid,date_assigned)\r\n VALUES ('{$project_id}','{$taskrec['processid']}','{$taskrec['id']}','{$usermodeUID}','{$date_assigned}') "); } else { list($xprj_id, $xdate_started) = DB_fetchArray($q1); if ($xprj_id == 0) { // Task history record - but missing project_id $p->set_var('class_newtask', 'class="nexflowNewTask"'); DB_query("UPDATE {$_TABLES['nf_projecttaskhistory']} SET project_id='{$project_id}' WHERE task_id='{$taskrec['id']}'"); } } } else { unset($xdate_started); } // Retrieve the project description for this task - used as Project Title $pquery = DB_query("SELECT description,originator_uid FROM {$_TABLES['nf_projects']} WHERE id='{$project_id}'"); list($description, $originator) = DB_fetchArray($pquery); $submitted_date = DB_getItem($_TABLES['nf_process'], 'initiatedDate', "id={$taskrec['processid']}"); $submitter_info = COM_getDisplayName($originator) . " / {$submitted_date}"; // Retrieve the flow name dynamic custom functions for appending to the display name to be used for the description $descSQL = "SELECT b.templateName, a.customFlowName FROM {$_TABLES['nf_process']} a "; $descSQL .= "INNER JOIN {$_TABLES['nf_template']} b on b.id=a.nf_templateId "; $descSQL .= "WHERE a.id={$taskrec['processid']} "; $descRes = DB_query($descSQL); list($templateName, $processCustomName) = DB_fetchArray($descRes); if (trim($description) != '') { $p->set_var('description', $description); } else { $p->set_var('description', $templateName); } if ($processCustomName != '') { $p->set_var('project_title', $processCustomName); } else { $p->set_var('project_title', $templateName); } $p->set_var('assigned_date', $taskrec['cdate']); $p->set_var('submitter_info', $submitter_info); if ($taskrec['stepType'] == 8) { // This is a nexform autotag handler $form_id = $taskrec['url']; // Check and see if the same form has been submitted for this task yet. $sql = "SELECT a.id,a.formtype,a.results_id,a.status,a.created_by_taskid, b.nf_templateDataID "; $sql .= "FROM {$_TABLES['nf_projectforms']} a "; $sql .= "LEFT JOIN {$_TABLES['nf_queue']} b on b.id=a.created_by_taskid "; $sql .= "WHERE project_id='{$project_id}' AND form_id='{$form_id}' "; $query = DB_query($sql); $newFormRecord = false; if (DB_numRows($query) >= 1) { $newFormRecord = true; while (list($prj_formid, $formtype, $result_id, $state, $created_by_taskid, $form_taskTemplateDataID) = DB_fetchArray($query)) { // Check if this is the same task editing, Rejected form so Task is a new queue ID but same templateDataID or Final Edit Task if ($taskrec['id'] == $created_by_taskid || $form_taskTemplateDataID == $taskrec['templateTaskid'] || in_array($taskrec['templateTaskid'], $CONF_NF['final_edit_tasks'])) { // Check and see if the created_by_taskid has been updated - since it will have the original task id if ($processPID != 0 and $created_by_taskid != $taskrec['id']) { DB_query("UPDATE {$_TABLES['nf_projectforms']} SET created_by_taskid='{$taskrec['id']}' WHERE id='{$prj_formid}'"); } $p->set_var('state', $formstatus_options[$state]); if ($state == 0 or $state == 2 or $state == 3 or $state == 6) { // Not final distributed version or rejected // Need to reset the process variable used to check the form approval result $nfclass->_nfProcessId = $taskrec['processid']; $nfclass->set_ProcessVariable('Review_Approval', 0); /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', sprintf($editFormLink, $form_id, $result_id, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); } } $sql = "SELECT timestamp FROM {$_TABLES['nf_projecttimestamps']} "; $sql .= "WHERE project_id={$project_id} ORDER BY timestamp DESC LIMIT 1"; $q = DB_query($sql); list($timestamp) = DB_fetchArray($q); if ($timestamp > 0) { $p->set_var('date', strftime("%Y-%m-%d", $timestamp)); } else { $q2 = DB_query("SELECT UNIX_TIMESTAMP(createdDate) FROM {$_TABLES['nf_queue']} WHERE id='{$taskrec['id']}' "); list($date_assigned) = DB_fetchArray($q2); $p->set_var('date', strftime("%Y-%m-%d", $date_assigned)); } $newFormRecord = false; } } } if (DB_numRows($query) == 0 or $newFormRecord) { // No record yet for this form and process - create mode $p->set_var('state', 'New Task'); $p->set_var('class_newtask', 'class="nexflowNewTask"'); /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', sprintf($newFormLink, $form_id, $project_id, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); } $q2 = DB_query("SELECT UNIX_TIMESTAMP(createdDate) FROM {$_TABLES['nf_queue']} WHERE id='{$taskrec['id']}' "); list($date_assigned) = DB_fetchArray($q2); $p->set_var('date', strftime("%Y-%m-%d", $date_assigned)); } $q = DB_QUERY("SELECT statusmsg FROM {$_TABLES['nf_projecttimestamps']} WHERE project_id = '{$project_id}' ORDER BY timestamp DESC LIMIT 1"); list($statusmsg) = DB_fetchArray($q); $p->set_var('full_statusmsg', $statusmsg); $msglen = strpos($statusmsg, '.'); if ($msglen > 0 and $pos !== FALSE) { $statusmsg = substr($statusmsg, 0, $msglen); } $p->set_var('statusmsg', $statusmsg); $p->set_var('id', $project_id); $p->set_var('task_name', $taskrec['taskname']); $p->set_var('view', ''); $p->set_var('action_record', ''); } else { // Nexflow task - not a form, Check for interactive function or manualweb step type $p->set_var('id', $taskrec['id']); $p->set_var('process_id', $taskrec['processid']); /* Task date is in format yyyy-mm-dd hh:mm:ss -- only want to show date portion */ $showdate = explode(' ', $taskrec['cdate']); $p->set_var('date', $showdate[0]); $sql = "SELECT timestamp,statusmsg FROM {$_TABLES['nf_projecttimestamps']} "; $sql .= "WHERE project_id = '{$project_id}' ORDER BY timestamp DESC LIMIT 1"; $q = DB_query($sql); list($timestamp, $statusmsg) = DB_fetchArray($q); $p->set_var('full_statusmsg', $statusmsg); $msglen = strpos($statusmsg, '.'); if ($msglen > 0 and $pos !== FALSE) { $statusmsg = substr($statusmsg, 0, $msglen); } $p->set_var('statusmsg', $statusmsg); /* @TODO: $xdate_started has not be set */ if (isset($xdate_started) and $xdate_started == 0) { // Task exists in the taskhistory table but no start_date yet $p->set_var('state', 'New Task'); } else { $p->set_var('state', 'Started'); } $p->set_var('task_name', $taskrec['taskname']); if (strrpos($taskrec['url'], '?') > 0) { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}&processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } else { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}?processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } $url .= $optLinkVars; /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', '#'); $p->set_var('task_onclick', "onClick=\"togglerec('action',{$i});ajaxStartTask({$taskrec['id']});\" "); } else { $p->set_var('task_action_url', '#'); $p->set_var('task_onclick', ""); } $p->set_var('chk_accept', ''); $p->set_var('chk_reject', ''); $p->set_var('project_id', $project_id); $p->set_var('project_id', $project_id); $p->set_var('form_id', $form_id); $p->set_var('taskuser', $usermodeUID); /* Check for any specific tasks that will then over-ride the action url link */ if ($taskrec['stepType'] == 7) { // Interactive Function $function = $taskrec['url']; if (function_exists($function)) { /* Call the interactive function passing * taskrec, template, rowid and current user if using the user-switch feature */ $function($taskrec, $p, $i, $usermodeUID); } } elseif ($taskrec['stepType'] == 8) { //nexform /* @TODO: What should we be doing in this case? */ } else { /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', $url); $p->set_var('task_onclick', sprintf($onClick_action, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); $p->set_var('task_onclick', ""); } $p->set_var('action_record', ''); } } if (!is_numeric($project_id)) { // Disable the icon to show the task/project detail $p->set_var('project_details', '<span style="padding-right:14px;"> </span>'); $p->set_var('project_detail', ''); } } } else { //there is no project ID to be found. //we'll display the non-project formatted item instead $project_detailsLink = '<a href="#" onClick=\'ajaxViewProjectDetails(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/details.png" border="0" TITLE="View Details"></a> '; $project_detailsLink .= '<a href="#" onClick=\'ajaxViewProjectComments(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/comment.gif" border="0" TITLE="View Project Comments"></a> '; $p->set_var('hidetaskinfo', 'none'); $p->set_var('task_id', $taskrec['id']); $p->set_var('project_id', $project_id); $p->set_var('project_details', sprintf($project_detailsLink, $i, $project_id, $usermodeUID, $taskrec['id'], $i, $project_id, $usermodeUID, $taskrec['id'])); $p->set_var('id', $taskrec['id']); $p->set_var('process_id', $taskrec['processid']); //get the template name here: $sql = "SELECT c.templateName, d.customFlowName FROM {$_TABLES['nf_queue']} a "; $sql .= "inner join {$_TABLES['nf_templatedata']} b on a.nf_templatedataid=b.id "; $sql .= "inner join {$_TABLES['nf_template']} c on b.nf_templateid=c.id "; $sql .= "inner join {$_TABLES['nf_process']} d on a.nf_processid=d.id "; $sql .= "WHERE a.id={$taskrec['id']}"; $res2 = DB_query($sql); list($tname, $customDisplay) = DB_fetchArray($res2); if ($customDisplay != '') { $tname .= $customDisplay; } $p->set_var('project_title', $tname); /* Task date is in format yyyy-mm-dd hh:mm:ss -- only want to show date portion */ $showdate = explode(' ', $taskrec['cdate']); $p->set_var('date', $showdate[0]); $q = DB_QUERY("SELECT timestamp,statusmsg FROM {$_TABLES['nf_projecttimestamps']} WHERE project_id={$project_id} ORDER BY timestamp DESC LIMIT 1"); list($timestamp, $statusmsg) = DB_fetchArray($q); $p->set_var('full_statusmsg', $statusmsg); $msglen = strpos($statusmsg, '.'); if ($msglen > 0 and $pos !== FALSE) { $statusmsg = substr($statusmsg, 0, $msglen); } $p->set_var('statusmsg', $statusmsg); if (isset($xdate_started) and $xdate_started == 0) { // Task exists in the taskhistory table but no start_date yet $p->set_var('state', 'New Task'); } else { $p->set_var('state', 'Started'); } $p->set_var('task_name', $taskrec['taskname']); if (strrpos($taskrec['url'], '?') > 0) { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}&processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } else { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}?processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } $url .= $optLinkVars; /* Using Click on Task to trigger action method */ $p->set_var('task_action_url', '#'); if ($taskStatus != 2) { $p->set_var('task_onclick', "onClick=\"togglerec('action',{$i});ajaxStartTask({$taskrec['id']});\" "); } else { $p->set_var('task_onclick', ""); } $p->set_var('task_name', $taskrec['taskname']); $p->set_var('chk_accept', ''); $p->set_var('chk_reject', ''); $p->set_var('project_id', $project_id); $p->set_var('form_id', $form_id); $p->set_var('taskuser', $usermodeUID); /* Check for any specific tasks that will then over-ride the action url link */ if ($taskrec['stepType'] == 7) { // Interactive Function $function = $taskrec['url']; if (function_exists($function)) { /* Call the interactive function passing * taskrec, template, rowid and current user if using the user-switch feature */ $function($taskrec, $p, $i, $usermodeUID); } } elseif ($taskrec['stepType'] == 8) { // nexform Task $form_id = $taskrec['url']; /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', sprintf($newFormLink, $form_id, $project_id, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); } } else { /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', $url); $p->set_var('task_onclick', sprintf($onClick_action, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); $p->set_var('task_onclick', ""); } $p->set_var('action_record', ''); } $p->set_var('project_details', '<span style="padding-right:14px;"> </span>'); $p->set_var('project_detail', ''); } //end if - test for valid project_id $p->parse('view_records', 'records', true); $i++; } //end foreach } else { $p->set_var('num_records', 0); $p->set_var('view_records', '<tr><td colspan=5 style="padding-left:20px;">No Tasks</td></tr>'); } $p->parse('javascript_code', 'javascript'); $p->parse('output', 'report'); return $p->finish($p->get_var('output')); }
/** * Displays the list of product attributes. * * @return string HTML string containing the contents of the ipnlog */ function PAYPAL_adminlist_Attributes() { global $_CONF, $_PP_CONF, $_TABLES, $LANG_PP, $_USER, $LANG_ADMIN; $sql = "SELECT a.*, p.name AS prod_name\n FROM {$_TABLES['paypal.prod_attr']} a\n LEFT JOIN {$_TABLES['paypal.products']} p\n ON a.item_id = p.id \n WHERE 1=1 "; if (isset($_POST['product_id']) && $_POST['product_id'] != '0') { $sel_prod_id = (int) $_POST['product_id']; $sql .= "AND p.id = '{$sel_prod_id}' "; } else { $sel_prod_id = ''; } $header_arr = array(array('text' => 'ID', 'field' => 'attr_id', 'sort' => true), array('text' => $LANG_PP['edit'], 'field' => 'edit', 'sort' => false, 'align' => 'center'), array('text' => $LANG_PP['enabled'], 'field' => 'enabled', 'sort' => false, 'align' => 'center'), array('text' => $LANG_PP['product'], 'field' => 'prod_name', 'sort' => true), array('text' => $LANG_PP['attr_name'], 'field' => 'attr_name', 'sort' => true), array('text' => $LANG_PP['attr_value'], 'field' => 'attr_value', 'sort' => true), array('text' => $LANG_PP['order'], 'field' => 'orderby', 'sort' => true), array('text' => $LANG_PP['attr_price'], 'field' => 'attr_price', 'sort' => true), array('text' => $LANG_ADMIN['delete'], 'field' => 'delete', 'sort' => 'false', 'align' => 'center')); $defsort_arr = array('field' => 'prod_name,attr_name,orderby', 'direction' => 'ASC'); $display = COM_startBlock('', '', COM_getBlockTemplate('_admin_block', 'header')); $filter = "{$LANG_PP['product']}: <select name=\"product_id\"\n onchange=\"this.form.submit();\">\n <option value=\"0\">-- Any --</option>\n" . COM_optionList($_TABLES['paypal.products'], 'id, name', $sel_prod_id) . "</select> \n"; $query_arr = array('table' => 'paypal.prod_attr', 'sql' => $sql, 'query_fields' => array('p.name', 'attr_name', 'attr_value'), 'default_filter' => ''); $text_arr = array('has_extras' => true, 'form_url' => PAYPAL_ADMIN_URL . '/index.php?attributes=x'); $options = array('chkdelete' => true, 'chkfield' => 'attr_id'); if (!isset($_REQUEST['query_limit'])) { $_GET['query_limit'] = 20; } $display .= ADMIN_list('paypal', 'PAYPAL_getAdminField_Attribute', $header_arr, $text_arr, $query_arr, $defsort_arr, $filter, '', $options, ''); $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $display; }
/** * Displays the static page editor form * * @param array $A Data to display * @return string HTML for the static page editor * */ function staticpageeditor_form($A, $error = false) { global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $mode, $sp_id, $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG24, $LANG_postmodes, $MESSAGE; $template_path = staticpages_templatePath('admin'); if (!empty($sp_id) && $mode == 'edit') { $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); } else { if ($mode != 'clone') { $A['sp_inblock'] = $_SP_CONF['in_block']; } $A['owner_id'] = $_USER['uid']; if (isset($_GROUPS['Static Page Admin'])) { $A['group_id'] = $_GROUPS['Static Page Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('staticpages.edit'); } SEC_setDefaultPermissions($A, $_SP_CONF['default_permissions']); $access = 3; if (isset($_CONF['advanced_editor']) && $_CONF['advanced_editor'] == 1 && file_exists($template_path . '/editor_advanced.thtml')) { $A['advanced_editor_mode'] = 1; } } $retval = ''; $sp_template = new Template($template_path); if (isset($_CONF['advanced_editor']) && $_CONF['advanced_editor'] == 1 && file_exists($template_path . '/editor_advanced.thtml')) { $sp_template->set_file('form', 'editor_advanced.thtml'); $sp_template->set_var('lang_expandhelp', $LANG24[67]); $sp_template->set_var('lang_reducehelp', $LANG24[68]); $sp_template->set_var('lang_toolbar', $LANG24[70]); $sp_template->set_var('toolbar1', $LANG24[71]); $sp_template->set_var('toolbar2', $LANG24[72]); $sp_template->set_var('toolbar3', $LANG24[73]); $sp_template->set_var('toolbar4', $LANG24[74]); $sp_template->set_var('toolbar5', $LANG24[75]); $sp_template->set_var('lang_nojavascript', $LANG24[77]); $sp_template->set_var('lang_postmode', $LANG24[4]); if (isset($A['postmode']) && $A['postmode'] == 'adveditor') { $sp_template->set_var('show_adveditor', ''); $sp_template->set_var('show_htmleditor', 'none'); } else { $sp_template->set_var('show_adveditor', 'none'); $sp_template->set_var('show_htmleditor', ''); } $post_options = '<option value="html" selected="selected">' . $LANG_postmodes['html'] . '</option>'; if (isset($A['postmode']) && $A['postmode'] == 'adveditor') { $post_options .= '<option value="adveditor" selected="selected">' . $LANG24[86] . '</option>'; } else { $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>'; } $sp_template->set_var('post_options', $post_options); $sp_template->set_var('change_editormode', 'onchange="change_editmode(this);"'); } else { $sp_template->set_file('form', 'editor.thtml'); } $sp_template->set_var('layout_url', $_CONF['layout_url']); $sp_template->set_var('lang_mode', $LANG24[3]); $sp_template->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $A['commentcode'])); $sp_template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $sp_template->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($A['owner_id']); $sp_template->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}")); $sp_template->set_var('owner_name', $ownername); $sp_template->set_var('owner', $ownername); $sp_template->set_var('owner_id', $A['owner_id']); $sp_template->set_var('lang_group', $LANG_ACCESS['group']); $sp_template->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $sp_template->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $sp_template->set_var('lang_permissions', $LANG_ACCESS['permissions']); $sp_template->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $sp_template->set_var('permissions_msg', $LANG_ACCESS['permmsg']); $sp_template->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $sp_template->set_var('site_url', $_CONF['site_url']); $sp_template->set_var('site_admin_url', $_CONF['site_admin_url']); $token = SEC_createToken(); $start_block = COM_startBlock($LANG_STATIC['staticpageeditor'], '', COM_getBlockTemplate('_admin_block', 'header')); $start_block .= SEC_getTokenExpiryNotice($token); $sp_template->set_var('start_block_editor', $start_block); $sp_template->set_var('lang_save', $LANG_ADMIN['save']); $sp_template->set_var('lang_cancel', $LANG_ADMIN['cancel']); $sp_template->set_var('lang_preview', $LANG_ADMIN['preview']); if (SEC_hasRights('staticpages.delete') && $mode != 'clone' && !empty($A['sp_old_id'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $sp_template->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $sp_template->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); } else { $sp_template->set_var('delete_option', ''); } $sp_template->set_var('lang_writtenby', $LANG_STATIC['writtenby']); $sp_template->set_var('username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['sp_uid']}")); $authorname = COM_getDisplayName($A['sp_uid']); $sp_template->set_var('name', $authorname); $sp_template->set_var('author', $authorname); $sp_template->set_var('lang_url', $LANG_STATIC['url']); $sp_template->set_var('lang_id', $LANG_STATIC['id']); $sp_template->set_var('sp_uid', $A['sp_uid']); $sp_template->set_var('sp_id', $A['sp_id']); $sp_template->set_var('sp_old_id', $A['sp_old_id']); $sp_template->set_var('example_url', COM_buildURL($_CONF['site_url'] . '/staticpages/index.php?page=' . $A['sp_id'])); $sp_template->set_var('lang_centerblock', $LANG_STATIC['centerblock']); $sp_template->set_var('lang_centerblock_help', $LANG_ADMIN['help_url']); $sp_template->set_var('lang_centerblock_include', $LANG21[51]); $sp_template->set_var('lang_centerblock_desc', $LANG21[52]); $sp_template->set_var('centerblock_help', $A['sp_help']); $sp_template->set_var('lang_centerblock_msg', $LANG_STATIC['centerblock_msg']); if (isset($A['sp_centerblock']) && $A['sp_centerblock'] == 1) { $sp_template->set_var('centerblock_checked', 'checked="checked"'); } else { $sp_template->set_var('centerblock_checked', ''); } $sp_template->set_var('lang_topic', $LANG_STATIC['topic']); $sp_template->set_var('lang_position', $LANG_STATIC['position']); $current_topic = ''; if (isset($A['sp_tid'])) { $current_topic = $A['sp_tid']; } if (empty($current_topic)) { $current_topic = 'none'; } $topics = COM_topicList('tid,topic', $current_topic, 1, true); $alltopics = '<option value="all"'; if ($current_topic == 'all') { $alltopics .= ' selected="selected"'; } $alltopics .= '>' . $LANG_STATIC['all_topics'] . '</option>' . LB; $notopic = '<option value="none"'; if ($current_topic == 'none') { $notopic .= ' selected="selected"'; } $notopic .= '>' . $LANG_STATIC['no_topic'] . '</option>' . LB; $sp_template->set_var('topic_selection', '<select name="sp_tid">' . $alltopics . $notopic . $topics . '</select>'); $position = '<select name="sp_where">'; $position .= '<option value="1"'; if ($A['sp_where'] == 1) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_top'] . '</option>'; $position .= '<option value="2"'; if ($A['sp_where'] == 2) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_feat'] . '</option>'; $position .= '<option value="3"'; if ($A['sp_where'] == 3) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_bottom'] . '</option>'; $position .= '<option value="0"'; if ($A['sp_where'] == 0) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_entire'] . '</option>'; $position .= '</select>'; $sp_template->set_var('pos_selection', $position); if ($_SP_CONF['allow_php'] == 1 && SEC_hasRights('staticpages.PHP')) { if (!isset($A['sp_php'])) { $A['sp_php'] = 0; } $selection = '<select name="sp_php">' . LB; $selection .= '<option value="0"'; if ($A['sp_php'] <= 0 || $A['sp_php'] > 2) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_none'] . '</option>' . LB; $selection .= '<option value="1"'; if ($A['sp_php'] == 1) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_return'] . '</option>' . LB; $selection .= '<option value="2"'; if ($A['sp_php'] == 2) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_free'] . '</option>' . LB; $selection .= '</select>'; $sp_template->set_var('php_selector', $selection); $sp_template->set_var('php_warn', $LANG_STATIC['php_warn']); } else { $sp_template->set_var('php_selector', ''); $sp_template->set_var('php_warn', $LANG_STATIC['php_not_activated']); } $sp_template->set_var('php_msg', $LANG_STATIC['php_msg']); // old variables (for the 1.3-type checkbox) $sp_template->set_var('php_checked', ''); $sp_template->set_var('php_type', 'hidden'); if (isset($A['sp_nf']) && $A['sp_nf'] == 1) { $sp_template->set_var('exit_checked', 'checked="checked"'); } else { $sp_template->set_var('exit_checked', ''); } $sp_template->set_var('exit_msg', $LANG_STATIC['exit_msg']); $sp_template->set_var('exit_info', $LANG_STATIC['exit_info']); if ($A['sp_inblock'] == 1) { $sp_template->set_var('inblock_checked', 'checked="checked"'); } else { $sp_template->set_var('inblock_checked', ''); } $sp_template->set_var('inblock_msg', $LANG_STATIC['inblock_msg']); $sp_template->set_var('inblock_info', $LANG_STATIC['inblock_info']); $curtime = COM_getUserDateTimeFormat($A['unixdate']); $sp_template->set_var('lang_lastupdated', $LANG_STATIC['date']); $sp_template->set_var('sp_formateddate', $curtime[0]); $sp_template->set_var('sp_date', $curtime[1]); $sp_template->set_var('lang_title', $LANG_STATIC['title']); $title = ''; if (isset($A['sp_title'])) { $title = htmlspecialchars(stripslashes($A['sp_title'])); } $sp_template->set_var('sp_title', $title); $sp_template->set_var('lang_metadescription', $LANG_ADMIN['meta_description']); $sp_template->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']); if (!empty($A['meta_description'])) { $sp_template->set_var('meta_description', $A['meta_description']); } if (!empty($A['meta_keywords'])) { $sp_template->set_var('meta_keywords', $A['meta_keywords']); } $sp_template->set_var('lang_addtomenu', $LANG_STATIC['addtomenu']); if (isset($A['sp_onmenu']) && $A['sp_onmenu'] == 1) { $sp_template->set_var('onmenu_checked', 'checked="checked"'); } else { $sp_template->set_var('onmenu_checked', ''); } $sp_template->set_var('lang_label', $LANG_STATIC['label']); if (isset($A['sp_label'])) { $sp_template->set_var('sp_label', $A['sp_label']); } else { $sp_template->set_var('sp_label', ''); } $sp_template->set_var('lang_pageformat', $LANG_STATIC['pageformat']); $sp_template->set_var('lang_blankpage', $LANG_STATIC['blankpage']); $sp_template->set_var('lang_noblocks', $LANG_STATIC['noblocks']); $sp_template->set_var('lang_leftblocks', $LANG_STATIC['leftblocks']); $sp_template->set_var('lang_leftrightblocks', $LANG_STATIC['leftrightblocks']); if (!isset($A['sp_format'])) { $A['sp_format'] = ''; } if ($A['sp_format'] == 'noblocks') { $sp_template->set_var('noblock_selected', 'selected="selected"'); } else { $sp_template->set_var('noblock_selected', ''); } if ($A['sp_format'] == 'leftblocks') { $sp_template->set_var('leftblocks_selected', 'selected="selected"'); } else { $sp_template->set_var('leftblocks_selected', ''); } if ($A['sp_format'] == 'blankpage') { $sp_template->set_var('blankpage_selected', 'selected="selected"'); } else { $sp_template->set_var('blankpage_selected', ''); } if ($A['sp_format'] == 'allblocks' or empty($A['sp_format'])) { $sp_template->set_var('allblocks_selected', 'selected="selected"'); } else { $sp_template->set_var('allblocks_selected', ''); } $sp_template->set_var('lang_content', $LANG_STATIC['content']); $content = ''; if (isset($A['sp_content'])) { $content = htmlspecialchars(stripslashes($A['sp_content'])); $content = str_replace(array('{', '}'), array('{', '}'), $content); } $sp_template->set_var('sp_content', $content); if ($_SP_CONF['filter_html'] == 1) { $allowed = COM_allowedHTML('staticpages.edit'); $sp_template->set_var('lang_allowedhtml', $allowed); $sp_template->set_var('lang_allowed_html', $allowed); } else { $sp_template->set_var('lang_allowedhtml', $LANG_STATIC['all_html_allowed']); $allowed = '<span class="warningsmall">' . $LANG_STATIC['all_html_allowed'] . ',</span>' . LB . '<div dir="ltr" class="warningsmall">'; $autotags = array_keys(PLG_collectTags()); $allowed .= '[' . implode(':], [', $autotags) . ':]'; $allowed .= '</div>'; $sp_template->set_var('lang_allowed_html', $allowed); } $sp_template->set_var('lang_hits', $LANG_STATIC['hits']); if (empty($A['sp_hits'])) { $sp_template->set_var('sp_hits', '0'); $sp_template->set_var('sp_hits_formatted', '0'); } else { $sp_template->set_var('sp_hits', $A['sp_hits']); $sp_template->set_var('sp_hits_formatted', COM_numberFormat($A['sp_hits'])); } $sp_template->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'))); $sp_template->set_var('xhtml', XHTML); $sp_template->set_var('gltoken_name', CSRF_TOKEN); $sp_template->set_var('gltoken', $token); $sp_template->parse('output', 'form'); $retval .= $sp_template->finish($sp_template->get_var('output')); return $retval; }
/** * Displays the static page editor form * * @param array $A Data to display * @return string HTML for the static page editor * */ function staticpageeditor_form($A) { global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $mode, $sp_id, $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG01, $LANG24, $LANG_postmodes, $MESSAGE, $_IMAGE_TYPE, $_SCRIPTS; if (!empty($sp_id) && $mode == 'edit') { $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); } else { if ($mode != 'clone') { $A['sp_inblock'] = $_SP_CONF['in_block']; } $A['owner_id'] = $_USER['uid']; if (isset($_GROUPS['Static Page Admin'])) { $A['group_id'] = $_GROUPS['Static Page Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('staticpages.edit'); } SEC_setDefaultPermissions($A, $_SP_CONF['default_permissions']); $access = 3; if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) { $A['advanced_editor_mode'] = 1; } } $retval = ''; $sp_template = COM_newTemplate(CTL_plugin_templatePath('staticpages', 'admin')); if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) { $sp_template->set_file('form', 'editor_advanced.thtml'); // Shouldn't really have to check if anonymous user but who knows... if (COM_isAnonUser()) { $link_message = ""; } else { $link_message = $LANG01[138]; } $sp_template->set_var('noscript', COM_getNoScript(false, '', $link_message)); // Setup Advanced Editor COM_setupAdvancedEditor('/staticpages/adveditor.js', 'staticpages.edit'); $sp_template->set_var('lang_expandhelp', $LANG24[67]); $sp_template->set_var('lang_reducehelp', $LANG24[68]); $sp_template->set_var('lang_toolbar', $LANG24[70]); $sp_template->set_var('toolbar1', $LANG24[71]); $sp_template->set_var('toolbar2', $LANG24[72]); $sp_template->set_var('toolbar3', $LANG24[73]); $sp_template->set_var('toolbar4', $LANG24[74]); $sp_template->set_var('toolbar5', $LANG24[75]); $sp_template->set_var('lang_nojavascript', $LANG24[77]); $sp_template->set_var('lang_postmode', $LANG24[4]); if (isset($A['postmode']) && $A['postmode'] == 'adveditor') { $sp_template->set_var('show_adveditor', ''); $sp_template->set_var('show_htmleditor', 'none'); } else { $sp_template->set_var('show_adveditor', 'none'); $sp_template->set_var('show_htmleditor', ''); } $post_options = '<option value="html" selected="selected">' . $LANG_postmodes['html'] . '</option>'; if (isset($A['postmode']) && $A['postmode'] == 'adveditor') { $post_options .= '<option value="adveditor" selected="selected">' . $LANG24[86] . '</option>'; } else { $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>'; } $sp_template->set_var('post_options', $post_options); $sp_template->set_var('change_editormode', 'onchange="change_editmode(this);"'); } else { $sp_template->set_file('form', 'editor.thtml'); } // Add JavaScript if ($_CONF['titletoid']) { $_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js'); $sp_template->set_var('titletoid', true); } $sp_template->set_var('lang_mode', $LANG24[3]); $sp_template->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $A['commentcode'])); $sp_template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $sp_template->set_var('lang_owner', $LANG_ACCESS['owner']); $owner_name = COM_getDisplayName($A['owner_id']); $owner_username = DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"); $sp_template->set_var('owner_id', $A['owner_id']); $sp_template->set_var('owner', $owner_name); $sp_template->set_var('owner_name', $owner_name); $sp_template->set_var('owner_username', $owner_username); if ($A['owner_id'] > 1) { $profile_link = $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['owner_id']; $sp_template->set_var('start_owner_anchortag', '<a href="' . $profile_link . '">'); $sp_template->set_var('end_owner_anchortag', '</a>'); $sp_template->set_var('owner_link', COM_createLink($owner_name, $profile_link)); $photo = ''; if ($_CONF['allow_user_photo']) { $photo = DB_getItem($_TABLES['users'], 'photo', "uid = {$A['owner_id']}"); if (!empty($photo)) { $camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""' . XHTML . '>'; $sp_template->set_var('camera_icon', COM_createLink($camera_icon, $profile_link)); } } if (empty($photo)) { $sp_template->set_var('camera_icon', ''); } } else { $sp_template->set_var('start_owner_anchortag', ''); $sp_template->set_var('end_owner_anchortag', ''); $sp_template->set_var('owner_link', $owner_name); } $sp_template->set_var('lang_group', $LANG_ACCESS['group']); $sp_template->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $sp_template->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $sp_template->set_var('lang_permissions', $LANG_ACCESS['permissions']); $sp_template->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $sp_template->set_var('permissions_msg', $LANG_ACCESS['permmsg']); $sp_template->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $token = SEC_createToken(); $start_block = COM_startBlock($LANG_STATIC['staticpageeditor'], '', COM_getBlockTemplate('_admin_block', 'header')); $start_block .= SEC_getTokenExpiryNotice($token); $sp_template->set_var('start_block_editor', $start_block); $sp_template->set_var('lang_save', $LANG_ADMIN['save']); $sp_template->set_var('lang_cancel', $LANG_ADMIN['cancel']); $sp_template->set_var('lang_preview', $LANG_ADMIN['preview']); if (SEC_hasRights('staticpages.delete') && $mode != 'clone' && !empty($A['sp_old_id'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $sp_template->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $sp_template->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); } else { $sp_template->set_var('delete_option', ''); } $sp_template->set_var('lang_writtenby', $LANG_STATIC['writtenby']); $sp_template->set_var('username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}")); $authorname = COM_getDisplayName($A['owner_id']); $sp_template->set_var('name', $authorname); $sp_template->set_var('author', $authorname); $sp_template->set_var('lang_url', $LANG_STATIC['url']); $sp_template->set_var('lang_id', $LANG_STATIC['id']); $sp_template->set_var('sp_uid', $A['owner_id']); $sp_template->set_var('sp_id', $A['sp_id']); $sp_template->set_var('sp_old_id', $A['sp_old_id']); $sp_template->set_var('example_url', COM_buildURL($_CONF['site_url'] . '/staticpages/index.php?page=' . $A['sp_id'])); $sp_template->set_var('lang_centerblock', $LANG_STATIC['centerblock']); $sp_template->set_var('lang_centerblock_help', $LANG_ADMIN['help_url']); $sp_template->set_var('lang_centerblock_include', $LANG21[51]); $sp_template->set_var('lang_centerblock_desc', $LANG21[52]); $sp_template->set_var('centerblock_help', $A['sp_help']); $sp_template->set_var('lang_centerblock_msg', $LANG_STATIC['centerblock_msg']); if (isset($A['sp_centerblock']) && $A['sp_centerblock'] == 1) { $sp_template->set_var('centerblock_checked', 'checked="checked"'); } else { $sp_template->set_var('centerblock_checked', ''); } $sp_template->set_var('lang_position', $LANG_STATIC['position']); $position = '<select name="sp_where">'; $position .= '<option value="1"'; if ($A['sp_where'] == 1) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_top'] . '</option>'; $position .= '<option value="2"'; if ($A['sp_where'] == 2) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_feat'] . '</option>'; $position .= '<option value="3"'; if ($A['sp_where'] == 3) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_bottom'] . '</option>'; $position .= '<option value="0"'; if ($A['sp_where'] == 0) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_entire'] . '</option>'; $position .= '</select>'; $sp_template->set_var('pos_selection', $position); if ($_SP_CONF['allow_php'] == 1 && SEC_hasRights('staticpages.PHP')) { if (!isset($A['sp_php'])) { $A['sp_php'] = 0; } $selection = '<select name="sp_php">' . LB; $selection .= '<option value="0"'; if ($A['sp_php'] <= 0 || $A['sp_php'] > 2) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_none'] . '</option>' . LB; $selection .= '<option value="1"'; if ($A['sp_php'] == 1) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_return'] . '</option>' . LB; $selection .= '<option value="2"'; if ($A['sp_php'] == 2) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_free'] . '</option>' . LB; $selection .= '</select>'; $sp_template->set_var('php_selector', $selection); $sp_template->set_var('php_warn', $LANG_STATIC['php_warn']); } else { $sp_template->set_var('php_selector', ''); $sp_template->set_var('php_warn', $LANG_STATIC['php_not_activated']); } $sp_template->set_var('php_msg', $LANG_STATIC['php_msg']); // old variables (for the 1.3-type checkbox) $sp_template->set_var('php_checked', ''); $sp_template->set_var('php_type', 'hidden'); if (isset($A['sp_nf']) && $A['sp_nf'] == 1) { $sp_template->set_var('exit_checked', 'checked="checked"'); } else { $sp_template->set_var('exit_checked', ''); } $sp_template->set_var('exit_msg', $LANG_STATIC['exit_msg']); $sp_template->set_var('exit_info', $LANG_STATIC['exit_info']); if ($A['sp_inblock'] == 1) { $sp_template->set_var('inblock_checked', 'checked="checked"'); } else { $sp_template->set_var('inblock_checked', ''); } $sp_template->set_var('inblock_msg', $LANG_STATIC['inblock_msg']); $sp_template->set_var('inblock_info', $LANG_STATIC['inblock_info']); if ($A['draft_flag'] == 1) { $sp_template->set_var('draft_flag_checked', 'checked="checked"'); } else { $sp_template->set_var('draft_flag_checked', ''); } $sp_template->set_var('lang_draft', $LANG_STATIC['draft']); $sp_template->set_var('lang_cache_time', $LANG_STATIC['cache_time']); $sp_template->set_var('lang_cache_time_desc', $LANG_STATIC['cache_time_desc']); $sp_template->set_var('cache_time', $A['cache_time']); $curtime = COM_getUserDateTimeFormat($A['unixdate']); $sp_template->set_var('lang_lastupdated', $LANG_STATIC['date']); $sp_template->set_var('sp_formateddate', $curtime[0]); $sp_template->set_var('sp_date', $curtime[1]); $sp_template->set_var('lang_title', $LANG_STATIC['title']); $sp_template->set_var('lang_page_title', $LANG_STATIC['page_title']); $title = ''; $page_title = ''; if (isset($A['sp_title'])) { $title = htmlspecialchars(stripslashes($A['sp_title'])); } if (isset($A['sp_page_title'])) { $page_title = htmlspecialchars(stripslashes($A['sp_page_title'])); } $sp_template->set_var('sp_title', $title); $sp_template->set_var('sp_page_title', $page_title); $sp_template->set_var('lang_topic', $LANG_STATIC['topic']); if ($mode != 'clone') { // want to use default topic selection if new staticpage so pass in blank id $topic_sp_id = $A['sp_id']; if (empty($sp_id) && $mode == 'edit') { // means new $topic_sp_id = ''; } $sp_template->set_var('topic_selection', TOPIC_getTopicSelectionControl('staticpages', $topic_sp_id, true, false, true)); } else { $sp_template->set_var('topic_selection', TOPIC_getTopicSelectionControl('staticpages', $A['clone_sp_id'], true, false, true)); } $sp_template->set_var('lang_metadescription', $LANG_ADMIN['meta_description']); $sp_template->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']); if (!empty($A['meta_description'])) { $sp_template->set_var('meta_description', $A['meta_description']); } if (!empty($A['meta_keywords'])) { $sp_template->set_var('meta_keywords', $A['meta_keywords']); } if ($_CONF['meta_tags'] > 0 && $_SP_CONF['meta_tags'] > 0) { $sp_template->set_var('hide_meta', ''); } else { $sp_template->set_var('hide_meta', ' style="display:none;"'); } if ($A['template_flag'] == 1) { $sp_template->set_var('template_flag_checked', 'checked="checked"'); } else { $sp_template->set_var('template_flag_checked', ''); } $sp_template->set_var('lang_template', $LANG_STATIC['template']); $sp_template->set_var('lang_template_flag_msg', $LANG_STATIC['template_msg']); $template_list = templatelist($A['template_id']); $template_none = '<option value=""'; if ($A['template_id'] == "") { $template_none .= ' selected="selected"'; } $template_none .= '>' . $LANG_STATIC['none'] . '</option>'; $sp_template->set_var('use_template_selection', '<select name="template_id">' . $template_none . $template_list . '</select>'); $sp_template->set_var('lang_use_template', $LANG_STATIC['use_template']); $sp_template->set_var('lang_use_template_msg', $LANG_STATIC['use_template_msg']); $sp_template->set_var('lang_addtomenu', $LANG_STATIC['addtomenu']); if (isset($A['sp_onmenu']) && $A['sp_onmenu'] == 1) { $sp_template->set_var('onmenu_checked', 'checked="checked"'); } else { $sp_template->set_var('onmenu_checked', ''); } $sp_template->set_var('lang_label', $LANG_STATIC['label']); if (isset($A['sp_label'])) { $sp_template->set_var('sp_label', $A['sp_label']); } else { $sp_template->set_var('sp_label', ''); } $sp_template->set_var('lang_pageformat', $LANG_STATIC['pageformat']); $sp_template->set_var('lang_blankpage', $LANG_STATIC['blankpage']); $sp_template->set_var('lang_noblocks', $LANG_STATIC['noblocks']); $sp_template->set_var('lang_leftblocks', $LANG_STATIC['leftblocks']); $sp_template->set_var('lang_leftrightblocks', $LANG_STATIC['leftrightblocks']); if (!isset($A['sp_format'])) { $A['sp_format'] = ''; } if ($A['sp_format'] == 'noblocks') { $sp_template->set_var('noblock_selected', 'selected="selected"'); } else { $sp_template->set_var('noblock_selected', ''); } if ($A['sp_format'] == 'leftblocks') { $sp_template->set_var('leftblocks_selected', 'selected="selected"'); } else { $sp_template->set_var('leftblocks_selected', ''); } if ($A['sp_format'] == 'blankpage') { $sp_template->set_var('blankpage_selected', 'selected="selected"'); } else { $sp_template->set_var('blankpage_selected', ''); } if ($A['sp_format'] == 'allblocks' or empty($A['sp_format'])) { $sp_template->set_var('allblocks_selected', 'selected="selected"'); } else { $sp_template->set_var('allblocks_selected', ''); } $sp_template->set_var('lang_content', $LANG_STATIC['content']); $content = ''; if (isset($A['sp_content'])) { $content = htmlspecialchars(stripslashes($A['sp_content'])); $content = str_replace(array('{', '}'), array('{', '}'), $content); } $sp_template->set_var('sp_content', $content); $allowed = COM_allowedHTML('staticpages.edit', false, $_SP_CONF['filter_html']) . COM_allowedAutotags(); $sp_template->set_var('lang_allowedhtml', $allowed); $sp_template->set_var('lang_allowed_html', $allowed); $sp_template->set_var('lang_hits', $LANG_STATIC['hits']); if (empty($A['sp_hits'])) { $sp_template->set_var('sp_hits', '0'); $sp_template->set_var('sp_hits_formatted', '0'); } else { $sp_template->set_var('sp_hits', $A['sp_hits']); $sp_template->set_var('sp_hits_formatted', COM_numberFormat($A['sp_hits'])); } $sp_template->set_var('lang_comments', $LANG_STATIC['comments']); if ($A['commentcode'] == -1) { $sp_template->set_var('sp_comments', $LANG_ADMIN['na']); } else { $num_comments = DB_count($_TABLES['comments'], array('sid', 'type'), array(DB_escapeString($A['sp_id']), 'staticpages')); $sp_template->set_var('sp_comments', COM_numberFormat($num_comments)); } $sp_template->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'))); $sp_template->set_var('gltoken_name', CSRF_TOKEN); $sp_template->set_var('gltoken', $token); $sp_template->parse('output', 'form'); $retval .= $sp_template->finish($sp_template->get_var('output')); return $retval; }
/** * Displays the contact form * * @param int $uid User ID of article author * @param string $subject Subject of email * @param string $message Text of message to send * @return string HTML for the contact form * */ function contactform($uid, $subject = '', $message = '') { global $_CONF, $_TABLES, $_USER, $LANG03, $LANG08, $LANG_LOGIN; $retval = ''; if (COM_isAnonUser()) { if (!SEC_inGroup('Contact', (int) $uid)) { if (($_CONF['loginrequired'] == 1 || $_CONF['emailuserloginrequired'] == 1) && $uid != 2) { $display = COM_siteHeader('menu', $LANG_LOGIN[1]); $display .= SEC_loginRequiredForm(); $display .= COM_siteFooter(); echo $display; exit; } } } $result = DB_query("SELECT emailfromadmin,emailfromuser FROM {$_TABLES['userprefs']} WHERE uid = " . (int) $uid); $P = DB_fetchArray($result); if (SEC_inGroup('Root') || SEC_hasRights('user.mail')) { $isAdmin = true; } else { $isAdmin = false; } $postmode = $_CONF['mailuser_postmode']; $displayname = COM_getDisplayName($uid); if ($P['emailfromadmin'] == 1 && $isAdmin || $P['emailfromuser'] == 1 && !$isAdmin) { $retval = COM_startBlock($LANG08[10] . ' ' . $displayname); $mail_template = new Template($_CONF['path_layout'] . 'profiles'); $mail_template->set_file('form', 'contactuserform.thtml'); if ($postmode == 'html') { $mail_template->set_var('show_htmleditor', true); } else { $mail_template->unset_var('show_htmleditor'); } $mail_template->set_var('lang_postmode', $LANG03[2]); $mail_template->set_var('postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode)); $mail_template->set_var('lang_description', $LANG08[26]); $mail_template->set_var('lang_username', $LANG08[11]); if (COM_isAnonUser()) { $sender = ''; if (isset($_POST['author'])) { $sender = strip_tags($_POST['author']); $sender = substr($sender, 0, strcspn($sender, "\r\n")); $sender = @htmlspecialchars(trim($sender), ENT_QUOTES, COM_getEncodingt()); } $mail_template->set_var('username', $sender); } else { $mail_template->set_var('username', COM_getDisplayName($_USER['uid'], $_USER['username'], $_USER['fullname'])); } $mail_template->set_var('lang_useremail', $LANG08[12]); if (empty($_USER['email'])) { $email = ''; if (isset($_POST['authoremail'])) { $email = strip_tags($_POST['authoremail']); $email = substr($email, 0, strcspn($email, "\r\n")); $email = @htmlspecialchars(trim($email), ENT_QUOTES, COM_getEncodingt()); } $mail_template->set_var('useremail', $email); } else { $mail_template->set_var('useremail', $_USER['email']); } $mail_template->set_var('lang_subject', $LANG08[13]); $mail_template->set_var('subject', $subject); $mail_template->set_var('lang_message', $LANG08[14]); $mail_template->set_var('message', @htmlspecialchars($message), ENT_QUOTES, COM_getEncodingt()); $mail_template->set_var('lang_nohtml', $LANG08[15]); $mail_template->set_var('lang_submit', $LANG08[16]); $mail_template->set_var('uid', $uid); PLG_templateSetVars('contact', $mail_template); $mail_template->parse('output', 'form'); $retval .= $mail_template->finish($mail_template->get_var('output')); $retval .= COM_endBlock(); } else { $retval = COM_showMessageText($LANG08[35], $LANG08[10], false, 'error'); } return $retval; }
/** * Displays the static page form * * @param array $A Data to display * @param string $error Error message to display * */ function PAGE_form($A, $error = false) { global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $action, $sp_id, $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG24, $LANG_postmodes, $MESSAGE; USES_lib_admin(); $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/staticpages/index.php', 'text' => $LANG_STATIC['page_list']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home'])); $template_path = staticpages_templatePath('admin'); if (!empty($sp_id) && ($action == 'edit' || $action == 'clone')) { $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); } else { $A['owner_id'] = $_USER['uid']; if (isset($_GROUPS['staticpages Admin'])) { $A['group_id'] = $_GROUPS['staticpages Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('staticpages.edit'); } SEC_setDefaultPermissions($A, $_SP_CONF['default_permissions']); $access = 3; } $retval = ''; if (empty($A['owner_id'])) { $error = COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')); $error .= $LANG_STATIC['deny_msg']; $error .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); } if ($error) { $retval .= $error . '<br/><br/>'; } else { $sp_template = new Template($template_path); $sp_template->set_file('form', 'editor.thtml'); $sp_template->set_var('lang_mode', $LANG24[3]); $sp_template->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $A['commentcode'])); $ownername = COM_getDisplayName($A['owner_id']); $sp_template->set_var(array('sp_search_checked' => $A['sp_search'] == 1 ? ' checked="checked"' : '', 'sp_status_checked' => $A['sp_status'] == 1 ? ' checked="checked"' : '', 'lang_accessrights' => $LANG_ACCESS['accessrights'], 'lang_owner' => $LANG_ACCESS['owner'], 'owner_username' => DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"), 'owner_name' => $ownername, 'owner' => $ownername, 'owner_id' => $A['owner_id'], 'lang_group' => $LANG_ACCESS['group'], 'group_dropdown' => SEC_getGroupDropdown($A['group_id'], $access), 'permissions_editor' => SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']), 'lang_permissions' => $LANG_ACCESS['permissions'], 'lang_perm_key' => $LANG_ACCESS['permissionskey'], 'permissions_msg' => $LANG_ACCESS['permmsg'], 'start_block_editor' => COM_startBlock($LANG_STATIC['staticpages'] . ' :: ' . $LANG_STATIC['staticpageeditor'], '', COM_getBlockTemplate('_admin_block', 'header')), 'lang_save' => $LANG_ADMIN['save'], 'lang_cancel' => $LANG_ADMIN['cancel'], 'lang_preview' => $LANG_ADMIN['preview'], 'lang_editor' => $LANG_STATIC['staticpageeditor'], 'lang_attributes' => $LANG_STATIC['attributes'])); if (SEC_hasRights('staticpages.delete') && $action != 'clone' && !empty($A['sp_old_id'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s/>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $sp_template->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $sp_template->set_var('delete_button', true); $sp_template->set_var('lang_delete_confirm', $MESSAGE[76]); $sp_template->set_var('lang_delete', $LANG_ADMIN['delete']); $sp_template->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); } else { $sp_template->set_var('delete_option', ''); } $sp_template->set_var('lang_writtenby', $LANG_STATIC['writtenby']); $sp_template->set_var('username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['sp_uid']}")); $authorname = COM_getDisplayName($A['sp_uid']); $sp_template->set_var('name', $authorname); $sp_template->set_var('author', $authorname); $sp_template->set_var('lang_url', $LANG_STATIC['url']); $sp_template->set_var('lang_id', $LANG_STATIC['id']); $sp_template->set_var('sp_uid', $A['sp_uid']); $sp_template->set_var('sp_id', $A['sp_id']); $sp_template->set_var('sp_old_id', $A['sp_old_id']); $sp_template->set_var('example_url', COM_buildURL($_CONF['site_url'] . '/page.php?page=' . $A['sp_id'])); $sp_template->set_var('lang_centerblock', $LANG_STATIC['centerblock']); $sp_template->set_var('lang_centerblock_help', $LANG_ADMIN['help_url']); $sp_template->set_var('lang_centerblock_include', $LANG21[51]); $sp_template->set_var('lang_centerblock_desc', $LANG21[52]); $sp_template->set_var('centerblock_help', $A['sp_help']); $sp_template->set_var('lang_centerblock_msg', $LANG_STATIC['centerblock_msg']); if (isset($A['sp_centerblock']) && $A['sp_centerblock'] == 1) { $sp_template->set_var('centerblock_checked', 'checked="checked"'); } else { $sp_template->set_var('centerblock_checked', ''); } $sp_template->set_var('lang_topic', $LANG_STATIC['topic']); $sp_template->set_var('lang_position', $LANG_STATIC['position']); $current_topic = ''; if (isset($A['sp_tid'])) { $current_topic = $A['sp_tid']; } if (empty($current_topic)) { $current_topic = 'none'; } $topics = COM_topicList('tid,topic', $current_topic, 1, true); $alltopics = '<option value="all"'; if ($current_topic == 'all') { $alltopics .= ' selected="selected"'; } $alltopics .= '>' . $LANG_STATIC['all_topics'] . '</option>' . LB; $allnhp = '<option value="allnhp"'; if ($current_topic == 'allnhp') { $allnhp .= ' selected="selected"'; } $allnhp .= '>' . $LANG_STATIC['allnhp_topics'] . '</option>' . LB; $notopic = '<option value="none"'; if ($current_topic == 'none') { $notopic .= ' selected="selected"'; } $notopic .= '>' . $LANG_STATIC['no_topic'] . '</option>' . LB; $sp_template->set_var('topic_selection', '<select name="sp_tid">' . $alltopics . $allnhp . $notopic . $topics . '</select>'); $position = '<select name="sp_where">'; $position .= '<option value="1"'; if ($A['sp_where'] == 1) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_top'] . '</option>'; $position .= '<option value="2"'; if ($A['sp_where'] == 2) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_feat'] . '</option>'; $position .= '<option value="3"'; if ($A['sp_where'] == 3) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_bottom'] . '</option>'; $position .= '<option value="0"'; if ($A['sp_where'] == 0) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_entire'] . '</option>'; $position .= '<option value="4"'; if ($A['sp_where'] == 4) { $position .= ' selected="selected"'; } $position .= '>' . $LANG_STATIC['position_nonews'] . '</option>'; $position .= '</select>'; $sp_template->set_var('pos_selection', $position); if ($_SP_CONF['allow_php'] == 1 && SEC_hasRights('staticpages.PHP')) { if (!isset($A['sp_php'])) { $A['sp_php'] = 0; } $selection = '<select name="sp_php">' . LB; $selection .= '<option value="0"'; if ($A['sp_php'] <= 0 || $A['sp_php'] > 2) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_none'] . '</option>' . LB; $selection .= '<option value="1"'; if ($A['sp_php'] == 1) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_return'] . '</option>' . LB; $selection .= '<option value="2"'; if ($A['sp_php'] == 2) { $selection .= ' selected="selected"'; } $selection .= '>' . $LANG_STATIC['select_php_free'] . '</option>' . LB; $selection .= '</select>'; $sp_template->set_var('php_selector', $selection); $sp_template->set_var('php_warn', $LANG_STATIC['php_warn']); } else { $sp_template->set_var('php_selector', ''); $sp_template->set_var('php_warn', $LANG_STATIC['php_not_activated']); } $sp_template->set_var('php_msg', $LANG_STATIC['php_msg']); // old variables (for the 1.3-type checkbox) $sp_template->set_var('php_checked', ''); $sp_template->set_var('php_type', 'hidden'); if (isset($A['sp_nf']) && $A['sp_nf'] == 1) { $sp_template->set_var('exit_checked', 'checked="checked"'); } else { $sp_template->set_var('exit_checked', ''); } $sp_template->set_var('exit_msg', $LANG_STATIC['exit_msg']); $sp_template->set_var('exit_info', $LANG_STATIC['exit_info']); if (isset($A['sp_inblock']) && $A['sp_inblock'] == 1) { $sp_template->set_var('inblock_checked', 'checked="checked"'); } else { $sp_template->set_var('inblock_checked', ''); } $sp_template->set_var('inblock_msg', $LANG_STATIC['inblock_msg']); $sp_template->set_var('inblock_info', $LANG_STATIC['inblock_info']); $curtime = COM_getUserDateTimeFormat($A['unixdate']); $sp_template->set_var('lang_lastupdated', $LANG_STATIC['date']); $sp_template->set_var('sp_formateddate', $curtime[0]); $sp_template->set_var('sp_date', $curtime[1]); $sp_template->set_var('lang_title', $LANG_STATIC['title']); $title = ''; if (isset($A['sp_title'])) { $title = htmlspecialchars($A['sp_title']); } $sp_template->set_var('sp_title', $title); $sp_template->set_var('lang_addtomenu', $LANG_STATIC['addtomenu']); if (isset($A['sp_onmenu']) && $A['sp_onmenu'] == 1) { $sp_template->set_var('onmenu_checked', 'checked="checked"'); } else { $sp_template->set_var('onmenu_checked', ''); } $sp_template->set_var('lang_label', $LANG_STATIC['label']); if (isset($A['sp_label'])) { $sp_template->set_var('sp_label', $A['sp_label']); } else { $sp_template->set_var('sp_label', ''); } $sp_template->set_var('lang_pageformat', $LANG_STATIC['pageformat']); $sp_template->set_var('lang_blankpage', $LANG_STATIC['blankpage']); $sp_template->set_var('lang_noblocks', $LANG_STATIC['noblocks']); $sp_template->set_var('lang_leftblocks', $LANG_STATIC['leftblocks']); $sp_template->set_var('lang_rightblocks', $LANG_STATIC['rightblocks']); $sp_template->set_var('lang_leftrightblocks', $LANG_STATIC['leftrightblocks']); if (!isset($A['sp_format'])) { $A['sp_format'] = ''; } if ($A['sp_format'] == 'noblocks') { $sp_template->set_var('noblock_selected', 'selected="selected"'); } else { $sp_template->set_var('noblock_selected', ''); } if ($A['sp_format'] == 'leftblocks') { $sp_template->set_var('leftblocks_selected', 'selected="selected"'); } else { $sp_template->set_var('leftblocks_selected', ''); } if ($A['sp_format'] == 'rightblocks') { $sp_template->set_var('rightblocks_selected', 'selected="selected"'); } else { $sp_template->set_var('rightblocks_selected', ''); } if ($A['sp_format'] == 'blankpage') { $sp_template->set_var('blankpage_selected', 'selected="selected"'); } else { $sp_template->set_var('blankpage_selected', ''); } if ($A['sp_format'] == 'allblocks' or empty($A['sp_format'])) { $sp_template->set_var('allblocks_selected', 'selected="selected"'); } else { $sp_template->set_var('allblocks_selected', ''); } $sp_template->set_var('lang_content', $LANG_STATIC['content']); $content = ''; if (isset($A['sp_content'])) { $content = htmlspecialchars($A['sp_content']); } $sp_template->set_var('sp_content', $content); if ($_SP_CONF['filter_html'] == 1) { $sp_template->set_var('lang_allowedhtml', COM_allowedHTML(SEC_getUserPermissions(), false, 'staticpages', 'page')); } else { $sp_template->set_var('lang_allowedhtml', $LANG_STATIC['all_html_allowed']); } $sp_template->set_var('lang_hits', $LANG_STATIC['hits']); if (empty($A['sp_hits'])) { $sp_template->set_var('sp_hits', '0'); $sp_template->set_var('sp_hits_formatted', '0'); } else { $sp_template->set_var('sp_hits', $A['sp_hits']); $sp_template->set_var('sp_hits_formatted', COM_numberFormat($A['sp_hits'])); } $sp_template->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'))); $sp_template->set_var('owner_dropdown', COM_buildOwnerList('owner_id', $A['owner_id'])); $sp_template->set_var('writtenby_dropdown', COM_buildOwnerList('sp_uid', $A['sp_uid'])); $sp_template->set_var('gltoken_name', CSRF_TOKEN); $sp_template->set_var('gltoken', SEC_createToken()); $sp_template->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG_STATIC['instructions_edit'], plugin_geticon_staticpages())); PLG_templateSetVars('sp_editor', $sp_template); $retval .= $sp_template->parse('output', 'form'); } return $retval; }
function LIB_List($pi_name) { global $_CONF; global $_TABLES; global $LANG_ADMIN; global $LANG09; $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN"; global ${$lang_box_admin}; $lang_box_admin = ${$lang_box_admin}; $lang_box = "LANG_" . strtoupper($pi_name); global ${$lang_box}; $lang_box = ${$lang_box}; $table = $_TABLES[strtoupper($pi_name) . '_def_category']; $table2 = $_TABLES[strtoupper($pi_name) . '_def_group']; $table3 = $_TABLES[strtoupper($pi_name) . '_def_category']; require_once $_CONF['path_system'] . 'lib-admin.php'; $retval = ''; //フィルタ filter if (!empty($_GET['filter_val'])) { $filter_val = COM_applyFilter($_GET['filter_val']); } elseif (!empty($_POST['filter_val'])) { $filter_val = COM_applyFilter($_POST['filter_val']); } else { $filter_val = $LANG09[9]; } if ($filter_val == $LANG09[9]) { $exclude = ""; } else { $exclude = " AND categorygroup_id={$filter_val}"; } $filter = "{$lang_box_admin['group']}:"; $filter .= "<select name='filter_val' style='width: 125px' onchange='this.form.submit()'>"; $filter .= "<option value='{$LANG09[9]}'"; if ($filter_val == $LANG09[9]) { $filter .= " selected='selected'"; } $filter .= " >{$LANG09[9]}</option>"; $filter .= COM_optionList($table2, 'group_id,name,orderno', $filter_val, 2, "group_id<>0"); $filter .= "</select>"; //MENU1:管理画面 $url1 = $_CONF['site_admin_url'] . '/plugins/' . THIS_SCRIPT . '?mode=new'; $url2 = $_CONF['site_url'] . '/' . $pi_name . '/list.php'; $url3 = $_CONF['site_url'] . '/' . $pi_name . '/category.php'; $url5 = $_CONF['site_admin_url'] . '/plugins/' . THIS_SCRIPT . '?mode=export'; $url6 = $_CONF['site_admin_url'] . '/plugins/' . THIS_SCRIPT . '?mode=import'; $menu_arr[] = array('url' => $url1, 'text' => $lang_box_admin['new']); $menu_arr[] = array('url' => $url2, 'text' => $lang_box['list']); $menu_arr[] = array('url' => $url5, 'text' => $lang_box_admin['export']); $menu_arr[] = array('url' => $url3, 'text' => $lang_box['category_top']); //$menu_arr[]=array('url' => $url6,'text' => $lang_box['export']); $menu_arr[] = array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']); $retval .= COM_startBlock($lang_box_admin['admin_list'], '', COM_getBlockTemplate('_admin_block', 'header')); $function = "plugin_geticon_" . $pi_name; $icon = $function(); $retval .= ADMIN_createMenu($menu_arr, $lang_box_admin['instructions'], $icon); //ヘッダ:編集~ $header_arr[] = array('text' => $lang_box_admin['orderno'], 'field' => 'orderno', 'sort' => true); $header_arr[] = array('text' => $LANG_ADMIN['edit'], 'field' => 'editid', 'sort' => false); $header_arr[] = array('text' => $LANG_ADMIN['copy'], 'field' => 'copy', 'sort' => false); $header_arr[] = array('text' => $lang_box_admin['category_id'], 'field' => 'category_id', 'sort' => true); $header_arr[] = array('text' => $lang_box_admin['code'], 'field' => 'code', 'sort' => true); $header_arr[] = array('text' => $lang_box_admin['name'], 'field' => 'name', 'sort' => true); $header_arr[] = array('text' => $lang_box_admin['group'], 'field' => 'group_name', 'sort' => true); $header_arr[] = array('text' => $lang_box_admin['parent'], 'field' => 'parent_name', 'sort' => true); // $text_arr = array('has_menu' => true, 'has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . "/plugins/" . THIS_SCRIPT); //Query $sql = "SELECT "; $sql .= " t.category_id" . LB; $sql .= " ,t.code" . LB; $sql .= " ,t.name" . LB; $sql .= " ,t.orderno" . LB; $sql .= " ,(SELECT t2.name FROM {$table2} AS t2 WHERE t2.group_id=t.categorygroup_id ) AS group_name " . LB; $sql .= " ,(SELECT t3.name FROM {$table3} AS t3 WHERE t3.category_id=t.parent_id ) AS parent_name " . LB; $sql .= " ,t.allow_display"; $sql .= " FROM "; $sql .= " {$table} AS t" . LB; $sql .= " WHERE " . LB; $sql .= " 1=1" . LB; // $query_arr = array('table' => $table, 'sql' => $sql, 'query_fields' => array('t.category_id', 't.code', 't.name', 't.orderno', "(SELECT t2.name FROM {$table2} AS t2 WHERE t2.group_id=t.categorygroup_id ) ", "(SELECT t3.name FROM {$table3} AS t3 WHERE t3.category_id=t.parent_id )"), 'default_filter' => $exclude); //デフォルトソート項目: $defsort_arr = array('field' => 't.orderno', 'direction' => 'ASC'); $form_arr = array('bottom' => '', 'top' => ''); $pagenavurl = '&filter_val=' . $filter_val; //List 取得 if (COM_versionCompare(VERSION, "2.0.0", '>=')) { $retval .= ADMIN_list($pi_name, "LIB_GetListField", $header_arr, $text_arr, $query_arr, $defsort_arr, $filter, '', '', $form_arr, true, $pagenavurl); } else { $retval .= ADMIN_list($pi_name, "LIB_GetListField", $header_arr, $text_arr, $query_arr, $defsort_arr, $filter, '', '', $form_arr, true); } $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
function modCat() { global $_CONF, $_TABLES, $_TABLES, $myts, $eh, $mytree, $LANG_FM02; $cid = COM_applyFilter($_POST["cid"]); $display = COM_siteHeader('menu'); // $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); $display .= filemgmt_navbar($LANG_FM02['nav2']); $display .= '<form action="index.php" method="post" enctype="multipart/form-data" style="margin:0px;">'; $display .= '<input type="hidden" name="op" value="modCatS">'; $display .= '<input type="hidden" name="cid" value="' . $cid . '">'; $display .= '<table width="100%" border="0" class="plugin">'; $display .= '<tr><td colspan="2" class="pluginHeader" style="width:100%;padding:5px;">' . _MD_MODCAT . '</td></tr>'; $result = DB_query("SELECT pid, title, imgurl, grp_access,grp_writeaccess FROM {$_TABLES['filemgmt_cat']} WHERE cid='" . DB_escapeString($cid) . "'"); list($pid, $title, $imgurl, $grp_access, $writeaccess) = DB_fetchArray($result); $title = $myts->makeTboxData4Edit($title); $imgurl = rawurldecode($myts->makeTboxData4Edit($imgurl)); $display .= '<form action="index.php" method="post" enctype="multipart/form-data">'; $display .= '<tr><td>' . _MD_TITLEC . '</td><td><input type="text" name="title" value="' . $title . '" size="51" maxlength="50"></td></tr>'; $display .= '<tr><td>' . _MD_CATSEC . '</td><td><select name="sel_access"><option value="0">Select Access</option>'; $display .= COM_optionList($_TABLES['groups'], "grp_id,grp_name", $grp_access) . '</select></td></tr>'; $display .= '<tr><td>' . _MD_UPLOADSEC . '</td><td><select name="sel_uploadaccess"><option value="0">Select Access</option>'; $display .= COM_optionList($_TABLES['groups'], "grp_id,grp_name", $writeaccess) . '</select></td></tr>'; $display .= '<tr><td>' . _MD_IMGURLMAIN . '</td><td><input type="file" name="imgurl" value="' . $imgurl . '" size="50" maxlength="100"></td></tr>'; $display .= '<tr><td>' . _MD_PARENT . '</td><td>'; $display .= $mytree->makeMySelBox("title", "title", $pid, 1, "pid", '', $cid); $display .= '</td></tr>'; $display .= '<tr><td colspan="2" style="text-align:center;padding:10px;">'; $display .= '<input type="submit" value="' . _MD_SAVE . '">'; $display .= '<input type="submit" value="' . _MD_DELETE . '" onClick=\'if (confirm("Delete this file ?")) {this.form.op.value="delCat";return true}; return false\'>'; $display .= " <input type=\"submit\" value=" . _MD_CANCEL . " name=\"cancel\" />"; $display .= '</td></tr></table>'; $display .= "</form>"; $display .= COM_endBlock(); $display .= COM_siteFooter(); echo $display; }
function fncEdit($id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit") { $pi_name = "userbox"; global $_CONF; global $_TABLES; global $LANG_ADMIN; global $MESSAGE; global $LANG_ACCESS; global $_USER; global $LANG28; global $_SCRIPTS; global $_USERBOX_CONF; global $LANG_USERBOX_ADMIN; global $LANG_USERBOX; $retval = ''; $delflg = false; $addition_def = DATABOX_getadditiondef($pi_name); //メッセージ表示 if (!empty($msg)) { $retval .= COM_showMessage($msg, $pi_name); $retval .= $errmsg; // clean 'em up $code = COM_applyFilter($_POST['code']); //@@@@@ $title = COM_applyFilter($_POST['title']); //@@@@@ $username = COM_applyFilter($_POST['username']); //@@@@@ $fullname = COM_applyFilter($_POST['fullname']); //@@@@@ $page_title = COM_applyFilter($_POST['page_title']); $description = $_POST['description']; //COM_applyFilter($_POST['description']); $defaulttemplatesdirectory = COM_applyFilter($_POST['defaulttemplatesdirectory']); //@@@@@@ $draft_flag = COM_applyFilter($_POST['draft_flag'], true); $hits = COM_applyFilter($_POST['hits'], true); $comments = COM_applyFilter($_POST['comments'], true); $commentcode = COM_applyFilter($_POST['commentcode'], true); $trackbackcode = COM_applyFilter($_POST['trackbackcode'], true); $cache_time = COM_applyFilter($_POST['cache_time'], true); //@@@@@ $comment_expire_flag = COM_applyFilter($_POST['comment_expire_flag'], true); if ($comment_expire_flag === 0) { $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y')); $comment_expire_year = date('Y', $w); $comment_expire_month = date('m', $w); $comment_expire_day = date('d', $w); $comment_expire_hour = 0; $comment_expire_minute = 0; } else { $comment_expire_month = COM_applyFilter($_POST['comment_expire_month'], true); $comment_expire_day = COM_applyFilter($_POST['comment_expire_day'], true); $comment_expire_year = COM_applyFilter($_POST['comment_expire_year'], true); $comment_expire_hour = COM_applyFilter($_POST['comment_expire_hour'], true); $comment_expire_minute = COM_applyFilter($_POST['comment_expire_minute'], true); } $meta_description = COM_applyFilter($_POST['meta_description']); $meta_keywords = COM_applyFilter($_POST['meta_keywords']); $language_id = COM_applyFilter($_POST['language_id']); $category = $_POST['category']; $additionfields = $_POST['afield']; $additionfields_fnm = $_POST['afield_fnm']; //@@@@@ $additionfields_del = $_POST['afield_del']; $additionfields_date = array(); $additionfields_alt = $_POST['afield_alt']; $additionfields = DATABOX_cleanaddtiondatas($additionfields, $addition_def, $additionfields_fnm, $additionfields_del, $additionfields_date, $additionfields_alt, false); $owner_id = COM_applyFilter($_POST['owner_id'], true); $group_id = COM_applyFilter($_POST['group_id'], true); // $array['perm_owner'] = $_POST['perm_owner']; $array['perm_group'] = $_POST['perm_group']; $array['perm_members'] = $_POST['perm_members']; $array['perm_anon'] = $_POST['perm_anon']; if (is_array($array['perm_owner']) || is_array($array['perm_group']) || is_array($array['perm_members']) || is_array($array['perm_anon'])) { list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($array['perm_owner'], $array['perm_group'], $array['perm_members'], $array['perm_anon']); } else { $perm_owner = $array['perm_owner']; $perm_group = $array['perm_group']; $perm_members = $array['perm_members']; $perm_anon = $array['perm_anon']; } //編集日 $modified_autoupdate = COM_applyFilter($_POST['modified_autoupdate'], true); $modified_month = COM_applyFilter($_POST['modified_month'], true); $modified_day = COM_applyFilter($_POST['modified_day'], true); $modified_year = COM_applyFilter($_POST['modified_year'], true); $modified_hour = COM_applyFilter($_POST['modified_hour'], true); $modified_minute = COM_applyFilter($_POST['modified_minute'], true); //公開日 $released_month = COM_applyFilter($_POST['released_month'], true); $released_day = COM_applyFilter($_POST['released_day'], true); $released_year = COM_applyFilter($_POST['released_year'], true); $released_hour = COM_applyFilter($_POST['released_hour'], true); $released_minute = COM_applyFilter($_POST['released_minute'], true); //公開終了日 $expired_available = COM_applyFilter($_POST['expired_available'], true); $expired_flag = COM_applyFilter($_POST['expired_flag'], true); if ($expired_flag === 0) { $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y')); $expired_year = date('Y', $w); $expired_month = date('m', $w); $expired_day = date('d', $w); $expired_hour = 0; $expired_minute = 0; } else { $expired_month = COM_applyFilter($_POST['expired_month'], true); $expired_day = COM_applyFilter($_POST['expired_day'], true); $expired_year = COM_applyFilter($_POST['expired_year'], true); $expired_hour = COM_applyFilter($_POST['expired_hour'], true); $expired_minute = COM_applyFilter($_POST['expired_minute'], true); } //作成日付 $created = COM_applyFilter($_POST['created']); $created_un = COM_applyFilter($_POST['created_un']); $orderno = COM_applyFilter($_POST['orderno']); $uuid = $_USER['uid']; $udatetime = COM_applyFilter($_POST['udatetime']); //""; $fieldset_id = COM_applyFilter($_POST['fieldset'], true); //""; $fieldset_name = COM_applyFilter($_POST['fieldset_name']); //""; } else { $sql = "SELECT "; $sql .= " t.*"; $sql .= " ,t2.name AS fieldset_name" . LB; $sql .= " ,t1.username"; $sql .= " ,t1.fullname"; $sql .= " ,UNIX_TIMESTAMP(t.modified) AS modified_un" . LB; $sql .= " ,UNIX_TIMESTAMP(t.released) AS released_un" . LB; $sql .= " ,UNIX_TIMESTAMP(t.comment_expire) AS comment_expire_un" . LB; $sql .= " ,UNIX_TIMESTAMP(t.expired) AS expired_un" . LB; $sql .= " ,UNIX_TIMESTAMP(t.udatetime) AS udatetime_un" . LB; $sql .= " ,UNIX_TIMESTAMP(t.created) AS created_un" . LB; $sql .= " FROM "; $sql .= $_TABLES['USERBOX_base'] . " AS t"; $sql .= "," . $_TABLES['users'] . " AS t1"; $sql .= "," . $_TABLES['USERBOX_def_fieldset'] . " AS t2 " . LB; $sql .= " WHERE "; $sql .= " t.id = {$id}"; $sql .= " AND t.id = t1.uid"; $sql .= " AND t.fieldset_id = t2.fieldset_id" . LB; $result = DB_query($sql); $A = DB_fetchArray($result); $fieldset_id = COM_stripslashes($A['fieldset_id']); $fieldset_name = COM_stripslashes($A['fieldset_name']); $code = COM_stripslashes($A['code']); //@@@@@ $title = COM_stripslashes($A['title']); //@@@@@ $username = COM_stripslashes($A['username']); //@@@@@ $fullname = COM_stripslashes($A['fullname']); //@@@@@ $page_title = COM_stripslashes($A['page_title']); $description = COM_stripslashes($A['description']); $defaulttemplatesdirectory = COM_stripslashes($A['defaulttemplatesdirectory']); $hits = COM_stripslashes($A['hits']); $comments = COM_stripslashes($A['comments']); $comment_expire = COM_stripslashes($A['comment_expire']); if ($comment_expire === "0000-00-00 00:00:00") { $comment_expire_flag = 0; $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y')); $comment_expire_year = date('Y', $w); $comment_expire_month = date('m', $w); $comment_expire_day = date('d', $w); $comment_expire_hour = 0; $comment_expire_minute = 0; } else { $comment_expire_flag = 1; $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['comment_expire_un'])); $comment_expire = $wary[1]; $comment_expire_year = date('Y', $comment_expire); $comment_expire_month = date('m', $comment_expire); $comment_expire_day = date('d', $comment_expire); $comment_expire_hour = date('H', $comment_expire); $comment_expire_minute = date('i', $comment_expire); } $commentcode = COM_stripslashes($A['commentcode']); $trackbackcode = COM_stripslashes($A['trackbackcode']); $cache_time = COM_stripslashes($A['cache_time']); $meta_description = COM_stripslashes($A['meta_description']); $meta_keywords = COM_stripslashes($A['meta_keywords']); $language_id = COM_stripslashes($A['language_id']); $owner_id = COM_stripslashes($A['owner_id']); $group_id = COM_stripslashes($A['group_id']); $perm_owner = COM_stripslashes($A['perm_owner']); $perm_group = COM_stripslashes($A['perm_group']); $perm_members = COM_stripslashes($A['perm_members']); $perm_anon = COM_stripslashes($A['perm_anon']); $category = DATABOX_getdatas("category_id", $_TABLES['USERBOX_category'], "id = {$id}"); $additionfields = DATABOX_getadditiondatas($id, $pi_name); $additionfields_fnm = array(); //@@@@@ $additionfields_del = array(); $additionfields_date = ""; $draft_flag = COM_stripslashes($A['draft_flag']); //編集日 $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['modified_un'])); $modified = $wary[1]; //$modified = strtotime(COM_stripslashes($A['modified'])); $modified_month = date('m', $modified); $modified_day = date('d', $modified); $modified_year = date('Y', $modified); $modified_hour = date('H', $modified); $modified_minute = date('i', $modified); //公開日 $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['released_un'])); $released = $wary[1]; //$released = strtotime(COM_stripslashes($A['released'])); $released_month = date('m', $released); $released_day = date('d', $released); $released_year = date('Y', $released); $released_hour = date('H', $released); $released_minute = date('i', $released); //公開終了日 $expired = COM_stripslashes($A['expired']); if ($expired === "0000-00-00 00:00:00") { $expired_flag = 0; $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y')); $expired_year = date('Y', $w); $expired_month = date('m', $w); $expired_day = date('d', $w); $expired_hour = 0; $expired_minute = 0; } else { $expired_flag = 1; $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['expired_un'])); $expired = $wary[1]; $expired_year = date('Y', $expired); $expired_month = date('m', $expired); $expired_day = date('d', $expired); $expired_hour = date('H', $expired); $expired_minute = date('i', $expired); } //作成日付 $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['created_un'])); $created = $wary[0]; $created_un = $wary[1]; $orderno = COM_stripslashes($A['orderno']); $uuid = COM_stripslashes($A['uuid']); $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un'])); $udatetime = $wary[0]; if ($edt_flg == FALSE) { $delflg = true; } } //template フォルダ $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name); $templates = new Template($tmplfld); $templates->set_file(array('editor' => 'profile_editor.thtml', 'row' => 'row.thtml', 'col' => "profile_col_detail.thtml")); // Add JavaScript geeklog >=2.1.0 // Loads jQuery UI datepicker and timepicker-addon $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider'); // $_SCRIPTS->setJavaScriptLibrary('jquery.ui.button'); $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n'); // $_SCRIPTS->setJavaScriptLibrary('jquery-ui-slideraccess'); $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js'); $_SCRIPTS->setJavaScriptFile('datepicker', '/javascript/datepicker.js'); $langCode = COM_getLangIso639Code(); $toolTip = $MESSAGE[118]; $imgUrl = $_CONF['site_url'] . '/images/calendar.png'; $_SCRIPTS->setJavaScript("jQuery(function () {" . " geeklog.hour_mode = {$_CONF['hour_mode']};" . " geeklog.datetimepicker.set('comment_expire', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . " geeklog.datetimepicker.set('modified', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . " geeklog.datetimepicker.set('released', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . " geeklog.datetimepicker.set('expired', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE); //-- if ($_CONF['meta_tags'] > 0 && $_USERBOX_CONF['meta_tags'] > 0) { $templates->set_var('hide_meta', ''); } else { $templates->set_var('hide_meta', ' style="display:none;"'); } $templates->set_var('maxlength_description', $_USERBOX_CONF['maxlength_description']); $templates->set_var('maxlength_meta_description', $_USERBOX_CONF['maxlength_meta_description']); $templates->set_var('maxlength_meta_keywords', $_USERBOX_CONF['maxlength_meta_keywords']); $templates->set_var('about_thispage', $LANG_USERBOX_ADMIN['about_admin_profile']); $templates->set_var('lang_must', $LANG_USERBOX_ADMIN['must']); $templates->set_var('site_url', $_CONF['site_url']); $templates->set_var('site_admin_url', $_CONF['site_admin_url']); $templates->set_var('lang_ref', $LANG_USERBOX_ADMIN['ref']); $templates->set_var('lang_view', $LANG_USERBOX_ADMIN['view']); $token = SEC_createToken(); $retval .= SEC_getTokenExpiryNotice($token); $templates->set_var('gltoken_name', CSRF_TOKEN); $templates->set_var('gltoken', $token); $templates->set_var('xhtml', XHTML); $templates->set_var('script', THIS_SCRIPT); $templates->set_var('dateformat', $_USERBOX_CONF['dateformat']); //ビューリンク@@@@@ $url = $_CONF['site_url'] . "/userbox/profile.php"; $url .= "?"; if ($_USERBOX_CONF['datacode']) { $url .= "code=" . $A['username']; $url .= "&m=code"; } else { $url .= "id=" . $A['id']; $url .= "&m=id"; } $url = COM_buildUrl($url); $view = COM_createLink($LANG_USERBOX['view'], $url); $templates->set_var('view', $view); // $templates->set_var('lang_link_admin', $LANG_USERBOX_ADMIN['link_admin']); $templates->set_var('lang_link_admin_top', $LANG_USERBOX_ADMIN['link_admin_top']); $templates->set_var('lang_link_public', $LANG_USERBOX_ADMIN['link_public']); $templates->set_var('lang_link_list', $LANG_USERBOX_ADMIN['link_list']); $templates->set_var('lang_link_detail', $LANG_USERBOX_ADMIN['link_detail']); //fieldset_id $templates->set_var('lang_fieldset', $LANG_USERBOX_ADMIN['fieldset']); $templates->set_var('fieldset_id', $fieldset_id); $templates->set_var('fieldset_name', $fieldset_name); //id $templates->set_var('lang_id', $LANG_USERBOX_ADMIN['id']); //@@@@@ $templates->set_var('help_id', $LANG_USERBOX_ADMIN['help']); $templates->set_var('id', $id); //下書 $templates->set_var('lang_draft', $LANG_USERBOX_ADMIN['draft']); if ($draft_flag == 1) { $templates->set_var('draft_flag', "checked=checked"); } else { $templates->set_var('draft_flag', ""); } // $templates->set_var('lang_field', $LANG_USERBOX_ADMIN['field']); $templates->set_var('lang_fields', $LANG_USERBOX_ADMIN['fields']); $templates->set_var('lang_content', $LANG_USERBOX_ADMIN['content']); $templates->set_var('lang_templatesetvar', $LANG_USERBOX_ADMIN['templatesetvar']); //基本項目 $templates->set_var('lang_basicfields', $LANG_USERBOX_ADMIN['basicfields']); //コード&タイトル&説明&テンプレートセット値@@@@@ $templates->set_var('lang_code', $LANG_USERBOX_ADMIN['code']); if ($_USERBOX_CONF['datacode']) { $templates->set_var('lang_must_code', $LANG_USERBOX_ADMIN['must']); } else { $templates->set_var('lang_must_code', ""); } $templates->set_var('code', $code); $templates->set_var('lang_title', $LANG_USERBOX_ADMIN['title']); $templates->set_var('title', $title); //$LANG28 = array( // 2 => 'ユーザID', // 3 => 'ユーザ名', username // 4 => '氏名', fullname $templates->set_var('lang_uid', $LANG28['2']); $templates->set_var('lang_username', $LANG28['3']); $templates->set_var('username', $username); $templates->set_var('lang_fullname', $LANG28['4']); $templates->set_var('fullname', $fullname); // $templates->set_var('lang_page_title', $LANG_USERBOX_ADMIN['page_title']); $templates->set_var('page_title', $page_title); $templates->set_var('lang_description', $LANG_USERBOX_ADMIN['description']); $templates->set_var('description', $description); $templates->set_var('lang_defaulttemplatesdirectory', $LANG_USERBOX_ADMIN['defaulttemplatesdirectory']); $templates->set_var('defaulttemplatesdirectory', $defaulttemplatesdirectory); $select_defaulttemplatesdirectory = fnctemplatesdirectory($defaulttemplatesdirectory); $templates->set_var('select_defaulttemplatesdirectory', $select_defaulttemplatesdirectory); //@@@@@ //meta_description $templates->set_var('lang_meta_description', $LANG_USERBOX_ADMIN['meta_description']); $templates->set_var('meta_description', $meta_description); //meta_keywords $templates->set_var('lang_meta_keywords', $LANG_USERBOX_ADMIN['meta_keywords']); $templates->set_var('meta_keywords', $meta_keywords); //language_id if (is_array($_CONF['languages'])) { $templates->set_var('hide_language_id', ''); $select_language_id = DATABOX_getoptionlist("language_id", $language_id, 0, $pi_name, "", 0); } else { $templates->set_var('hide_language_id', ' style="display:none;"'); $select_language_id = ""; } $templates->set_var('lang_language_id', $LANG_USERBOX_ADMIN['language_id']); $templates->set_var('language_id', $language_id); $templates->set_var('select_language_id', $select_language_id); //@@@@@ //hits $templates->set_var('lang_hits', $LANG_USERBOX_ADMIN['hits']); $templates->set_var('hits', $hits); //comments $templates->set_var('lang_comments', $LANG_USERBOX_ADMIN['comments']); $templates->set_var('comments', $comments); //commentcode $templates->set_var('lang_commentcode', $LANG_USERBOX_ADMIN['commentcode']); $templates->set_var('commentcode', $commentcode); $optionlist_commentcode = COM_optionList($_TABLES['commentcodes'], 'code,name', $commentcode); $templates->set_var('optionlist_commentcode', $optionlist_commentcode); //trackbackcode $templates->set_var('lang_trackbackcode', $LANG_USERBOX_ADMIN['trackbackcode']); $templates->set_var('trackbackcode', $trackbackcode); $optionlist_trackbackcode = COM_optionList($_TABLES['trackbackcodes'], 'code,name', $trackbackcode); $templates->set_var('optionlist_trackbackcode', $optionlist_trackbackcode); $templates->set_var('lang_cache_time', $LANG_USERBOX_ADMIN['cache_time']); $templates->set_var('lang_cache_time_desc', $LANG_USERBOX_ADMIN['cache_time_desc']); $templates->set_var('cache_time', $cache_time); //comment_expire $templates->set_var('lang_enabled', $LANG_USERBOX_ADMIN['enabled']); if ($comment_expire_flag === 0) { $templates->set_var('show_comment_expire', 'false'); $templates->set_var('is_checked_comment_expire', ''); } else { $templates->set_var('show_comment_expire', 'true'); $templates->set_var('is_checked_comment_expire', 'checked="checked"'); } $templates->set_var('lang_comment_expire', $LANG_USERBOX_ADMIN['comment_expire']); $w = COM_convertDate2Timestamp($comment_expire_year . "-" . $comment_expire_month . "-" . $comment_expire_day, $comment_expire_hour . ":" . $comment_expire_minute . "::00"); $datetime_comment_expire = DATABOX_datetimeedit($w, "LANG_USERBOX_ADMIN", "comment_expire"); $templates->set_var('datetime_comment_expire', $datetime_comment_expire); //編集日 $templates->set_var('lang_modified_autoupdate', $LANG_USERBOX_ADMIN['modified_autoupdate']); $templates->set_var('lang_modified', $LANG_USERBOX_ADMIN['modified']); $w = COM_convertDate2Timestamp($modified_year . "-" . $modified_month . "-" . $modified_day, $modified_hour . ":" . $modified_minute . "::00"); $datetime_modified = DATABOX_datetimeedit($w, "LANG_USERBOX_ADMIN", "modified"); $templates->set_var('datetime_modified', $datetime_modified); //公開日 $templates->set_var('lang_released', $LANG_USERBOX_ADMIN['released']); $w = COM_convertDate2Timestamp($released_year . "-" . $released_month . "-" . $released_day, $released_hour . ":" . $released_minute . "::00"); $datetime_released = DATABOX_datetimeedit($w, "LANG_USERBOX_ADMIN", "released"); $templates->set_var('datetime_released', $datetime_released); //公開終了日 $templates->set_var('lang_expired', $LANG_USERBOX_ADMIN['expired']); //if ($expired=="0000-00-00 00:00:00"){ if ($expired_flag == 0) { $templates->set_var('show_expired', 'false'); $templates->set_var('is_checked_expired', ''); } else { $templates->set_var('show_expired', 'true'); $templates->set_var('is_checked_expired', 'checked="expired"'); } $templates->set_var('lang_expired', $LANG_USERBOX_ADMIN['expired']); $w = COM_convertDate2Timestamp($expired_year . "-" . $expired_month . "-" . $expired_day, $expired_hour . ":" . $expired_minute . "::00"); $datetime_expired = DATABOX_datetimeedit($w, "LANG_USERBOX_ADMIN", "expired"); $templates->set_var('datetime_expired', $datetime_expired); //順序 $templates->set_var('lang_orderno', $LANG_USERBOX_ADMIN['orderno']); $templates->set_var('orderno', $orderno); //koko //カテゴリ $templates->set_var('lang_category', $LANG_USERBOX_ADMIN['category']); $checklist_category = DATABOX_getcategoriesinp($category, $fieldset_id, $pi_name); $templates->set_var('checklist_category', $checklist_category); //追加項目 $templates->set_var('lang_additionfields', $LANG_USERBOX_ADMIN['additionfields']); $rt = DATABOX_getaddtionfieldsEdit($additionfields, $addition_def, $templates, 9999, $pi_name, $additionfields_fnm, $additionfields_del, $fieldset_id, $additionfields_date); //保存日時 $templates->set_var('lang_udatetime', $LANG_USERBOX_ADMIN['udatetime']); $templates->set_var('udatetime', $udatetime); $templates->set_var('lang_uuid', $LANG_USERBOX_ADMIN['uuid']); $templates->set_var('uuid', $uuid); //作成日付 $templates->set_var('lang_created', $LANG_USERBOX_ADMIN['created']); $templates->set_var('created', $created); $templates->set_var('created_un', $created_un); //アクセス権 $templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $templates->set_var('lang_owner', $LANG_ACCESS['owner']); $owner_name = COM_getDisplayName($owner_id); $templates->set_var('owner_name', $owner_name); $templates->set_var('owner_id', $owner_id); $templates->set_var('lang_group', $LANG_ACCESS['group']); $templates->set_var('group_dropdown', SEC_getGroupDropdown($group_id, 3)); $templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $templates->set_var('permissions_editor', SEC_getPermissionsHTML($perm_owner, $perm_group, $perm_members, $perm_anon)); $templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']); $templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); // SAVE、CANCEL ボタン $templates->set_var('lang_save', $LANG_ADMIN['save']); $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); $templates->set_var('lang_preview', $LANG_ADMIN['preview']); //delete_option //$delflg=false;//@@@@@ 削除不可 if ($delflg) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); } // $templates->parse('output', 'editor'); $retval .= $templates->finish($templates->get_var('output')); return $retval; }
/** * Shows poll editor * * Diplays the poll editor form * * @param string $pid ID of poll to edit * @return string HTML for poll editor form * */ function editpoll($pid = '') { global $_CONF, $_PO_CONF, $_GROUPS, $_TABLES, $_USER, $LANG25, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $LANG_POLLS; $retval = ''; if (!empty($pid)) { $topic = DB_query("SELECT * FROM {$_TABLES['polltopics']} WHERE pid='{$pid}'"); $T = DB_fetchArray($topic); // Get permissions for poll $access = SEC_hasAccess($T['owner_id'], $T['group_id'], $T['perm_owner'], $T['perm_group'], $T['perm_members'], $T['perm_anon']); if ($access == 0 or $access == 2) { // User doesn't have access...bail $retval .= COM_startBlock($LANG25[21], '', COM_getBlockTemplate('_msg_block', 'header')); $retval .= $LANG25[22]; $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); COM_accessLog("User {$_USER['username']} tried to illegally submit or edit poll {$pid}."); return $retval; } } // writing the menu on top require_once $_CONF['path_system'] . 'lib-admin.php'; $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/polls/index.php', 'text' => $LANG_ADMIN['list_all']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home'])); $token = SEC_createToken(); $retval .= COM_startBlock($LANG25[5], '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= ADMIN_createMenu($menu_arr, $LANG_POLLS['editinstructions'], plugin_geticon_polls()); $retval .= SEC_getTokenExpiryNotice($token); $poll_templates = new Template($_CONF['path'] . 'plugins/polls/templates/admin/'); $poll_templates->set_file(array('editor' => 'polleditor.thtml', 'question' => 'pollquestions.thtml', 'answer' => 'pollansweroption.thtml')); $poll_templates->set_var('xhtml', XHTML); $poll_templates->set_var('site_url', $_CONF['site_url']); $poll_templates->set_var('site_admin_url', $_CONF['site_admin_url']); $poll_templates->set_var('layout_url', $_CONF['layout_url']); if (!empty($pid) and $access == 3 and !empty($T['owner_id'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $poll_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $poll_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); } else { $T['pid'] = COM_makeSid(); $T['topic'] = ''; $T['meta_description'] = ''; $T['meta_keywords'] = ''; $T['voters'] = 0; $T['display'] = 1; $T['is_open'] = 1; $T['hideresults'] = 0; $T['owner_id'] = $_USER['uid']; if (isset($_GROUPS['Polls Admin'])) { $T['group_id'] = $_GROUPS['Polls Admin']; } else { $T['group_id'] = SEC_getFeatureGroup('polls.edit'); } SEC_setDefaultPermissions($T, $_PO_CONF['default_permissions']); $T['statuscode'] = 0; $T['commentcode'] = $_CONF['comment_code']; $access = 3; } $poll_templates->set_var('lang_pollid', $LANG25[6]); $poll_templates->set_var('poll_id', $T['pid']); $poll_templates->set_var('lang_donotusespaces', $LANG25[7]); $poll_templates->set_var('lang_topic', $LANG25[9]); $poll_templates->set_var('poll_topic', htmlspecialchars($T['topic'])); $poll_templates->set_var('lang_mode', $LANG25[1]); $poll_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']); $poll_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']); if (!empty($T['meta_description'])) { $poll_templates->set_var('meta_description', $T['meta_description']); } if (!empty($T['meta_keywords'])) { $poll_templates->set_var('meta_keywords', $T['meta_keywords']); } $poll_templates->set_var('status_options', COM_optionList($_TABLES['statuscodes'], 'code,name', $T['statuscode'])); $poll_templates->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $T['commentcode'])); $poll_templates->set_var('lang_appearsonhomepage', $LANG25[8]); $poll_templates->set_var('lang_openforvoting', $LANG25[33]); $poll_templates->set_var('lang_hideresults', $LANG25[37]); $poll_templates->set_var('poll_hideresults_explain', $LANG25[38]); $poll_templates->set_var('poll_topic_info', $LANG25[39]); if ($T['display'] == 1) { $poll_templates->set_var('poll_display', 'checked="checked"'); } if ($T['is_open'] == 1) { $poll_templates->set_var('poll_open', 'checked="checked"'); } if ($T['hideresults'] == 1) { $poll_templates->set_var('poll_hideresults', 'checked="checked"'); } // user access info $poll_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $poll_templates->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($T['owner_id']); $poll_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$T['owner_id']}")); $poll_templates->set_var('owner_name', $ownername); $poll_templates->set_var('owner', $ownername); $poll_templates->set_var('owner_id', $T['owner_id']); $poll_templates->set_var('lang_group', $LANG_ACCESS['group']); $poll_templates->set_var('group_dropdown', SEC_getGroupDropdown($T['group_id'], $access)); $poll_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $poll_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']); $poll_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $poll_templates->set_var('permissions_editor', SEC_getPermissionsHTML($T['perm_owner'], $T['perm_group'], $T['perm_members'], $T['perm_anon'])); $poll_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $poll_templates->set_var('lang_answersvotes', $LANG25[10]); $poll_templates->set_var('lang_save', $LANG_ADMIN['save']); $poll_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); // repeat for several questions $question_sql = "SELECT question,qid " . "FROM {$_TABLES['pollquestions']} WHERE pid='{$pid}' ORDER BY qid;"; $questions = DB_query($question_sql); include $_CONF['path_system'] . 'classes/navbar.class.php'; $navbar = new navbar(); for ($j = 0; $j < $_PO_CONF['maxquestions']; $j++) { $display_id = $j + 1; if ($j > 0) { $poll_templates->set_var('style', 'style="display:none;"'); } else { $poll_templates->set_var('style', ''); } $navbar->add_menuitem($LANG25[31] . " {$display_id}", "showhidePollsEditorDiv(\"{$j}\",{$j},{$_PO_CONF['maxquestions']});return false;", true); $Q = DB_fetchArray($questions); $poll_templates->set_var('question_text', $Q['question']); $poll_templates->set_var('question_id', $j); $poll_templates->set_var('lang_question', $LANG25[31] . " {$display_id}"); $poll_templates->set_var('lang_saveaddnew', $LANG25[32]); // answers $answer_sql = "SELECT answer,aid,votes,remark " . "FROM {$_TABLES['pollanswers']} WHERE qid='{$j}' AND pid='{$pid}' ORDER BY aid"; $answers = DB_query($answer_sql); for ($i = 0; $i < $_PO_CONF['maxanswers']; $i++) { if (isset($answers)) { $A = DB_fetchArray($answers); $poll_templates->set_var('answer_text', htmlspecialchars($A['answer'])); $poll_templates->set_var('answer_votes', $A['votes']); $poll_templates->set_var('remark_text', $A['remark']); } else { $poll_templates->set_var('answer_text', ''); $poll_templates->set_var('answer_votes', ''); $poll_templates->set_var('remark_text', ''); } $poll_templates->parse('answer_option', 'answer', true); } $poll_templates->parse('question_list', 'question', true); $poll_templates->clear_var('answer_option'); } $navbar->set_selected($LANG25[31] . " 1"); $poll_templates->set_var('navbar', $navbar->generate()); $poll_templates->set_var('gltoken_name', CSRF_TOKEN); $poll_templates->set_var('gltoken', $token); $poll_templates->parse('output', 'editor'); $retval .= $poll_templates->finish($poll_templates->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
function USER_layoutPanel($U, $newuser = 0) { global $_CONF, $_SYSTEM, $_TABLES, $_USER, $LANG_MYACCOUNT, $LANG04, $LANG_confignames, $LANG_configselects; $uid = $U['uid']; // set template $userform = new Template($_CONF['path_layout'] . 'admin/user/'); $userform->set_file('user', 'layoutpanel.thtml'); $userform->set_var('lang_misc_title', $LANG04[138]); $userform->set_var('lang_misc_help_title', $LANG04[139]); $userform->set_var('lang_misc_help', $LANG04[140]); $userform->set_var('lang_language', $LANG04[73]); $userform->set_var('lang_theme', $LANG04[72]); $userform->set_var('lang_noicons', $LANG04[40]); $userform->set_var('lang_noboxes', $LANG04[44]); $userform->set_var('lang_maxstories', $LANG04[43]); $userform->set_var('lang_timezone', $LANG04[158]); $userform->set_var('lang_dateformat', $LANG04[42]); $userform->set_var('lang_search_format', $LANG_confignames['Core']['search_show_type']); $userform->set_var('lang_comment_title', $LANG04[133]); $userform->set_var('lang_comment_help_title', $LANG04[134]); $userform->set_var('lang_comment_help', $LANG04[135]); $userform->set_var('lang_displaymode', $LANG04[57]); $userform->set_var('lang_sortorder', $LANG04[58]); $userform->set_var('lang_commentlimit', $LANG04[59]); if ($_CONF['allow_user_language'] == 1) { if (empty($U['language'])) { $userlang = $_CONF['language']; } else { $userlang = $U['language']; } // Get available languages $language = MBYTE_languageList($_CONF['default_charset']); $has_valid_language = count(array_keys($language, $userlang)); if ($has_valid_language == 0) { // The user's preferred language is no longer available. // We have a problem now, since we've overwritten $_CONF['language'] // with the user's preferred language ($U['language']) and // therefore don't know what the system's default language is. // So we'll try to find a similar language. If that doesn't help, // the dropdown will default to the first language in the list ... $tmp = explode('_', $userlang); $similarLang = $tmp[0]; } // build language select $selection = '<select id="language" name="language">' . LB; foreach ($language as $langFile => $langName) { $selection .= '<option value="' . $langFile . '"'; if ($langFile == $userlang || $has_valid_language == 0 && strpos($langFile, $similarLang) === 0) { $selection .= ' selected="selected"'; $has_valid_language = 1; } else { if ($userlang == $langFile) { $selection .= ' selected="selected"'; } } $selection .= '>' . $langName . '</option>' . LB; } $selection .= '</select>'; $userform->set_var('language_selector', $selection); } else { $userform->set_var('language_selector', $_CONF['language']); } if ($_CONF['allow_user_themes'] == 1) { $selection = '<select id="theme" name="theme">' . LB; if (empty($U['theme'])) { $usertheme = $_CONF['theme']; } else { $usertheme = $U['theme']; } $themeFiles = COM_getThemes(); usort($themeFiles, create_function('$a,$b', 'return strcasecmp($a,$b);')); foreach ($themeFiles as $theme) { $selection .= '<option value="' . $theme . '"'; if ($usertheme == $theme) { $selection .= ' selected="selected"'; } $words = explode('_', $theme); $bwords = array(); foreach ($words as $th) { if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $bwords[] = strtoupper($th[0]) . substr($th, 1); } else { $bwords[] = $th; } } $selection .= '>' . implode(' ', $bwords) . '</option>' . LB; } $selection .= '</select>'; $userform->set_var('theme_selector', $selection); } else { $userform->set_var('theme_selector', $_CONF['theme']); } if ($U['noicons'] == '1') { $userform->set_var('noicons_checked', 'checked="checked"'); } else { $userform->set_var('noicons_checked', ''); } if ($U['noboxes'] == 1) { $userform->set_var('noboxes_checked', 'checked="checked"'); } else { $userform->set_var('noboxes_checked', ''); } $userform->set_var('maxstories_value', $U['maxstories']); // Timezone if (isset($U['tzid'])) { $timezone = $U['tzid']; } else { $timezone = $_CONF['timezone']; } $selection = Date::getTimeZoneDropDown($timezone, array('id' => 'tzid', 'name' => 'tzid')); $userform->set_var('timezone_selector', $selection); $selection = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', $U['dfid']) . '</select>'; $userform->set_var('dateformat_selector', $selection); $search_result_select = '<select name="search_result_format" id="search_result_format">' . LB; foreach ($LANG_configselects['Core'][18] as $name => $type) { $search_result_select .= '<option value="' . $type . '"' . ($U['search_result_format'] == $type ? 'selected="selected"' : '') . '>' . $name . '</option>' . LB; } $search_result_select .= '</select>'; $userform->set_var('search_result_select', $search_result_select); if (!empty($uid) && $uid > 1) { $userform->set_var('plugin_layout_display', PLG_profileEdit($uid, 'layout', 'display')); } // comment preferences block if (!empty($uid) && $uid > 1) { $result = DB_query("SELECT commentmode,commentorder,commentlimit FROM {$_TABLES['usercomment']} WHERE uid = {$uid}"); $C = DB_fetchArray($result); if (empty($C['commentmode'])) { $C['commentmode'] = $_CONF['comment_mode']; } if (empty($C['commentorder'])) { $C['commentorder'] = 0; } if (empty($C['commentlimit'])) { $C['commentlimit'] = 100; } } else { $C['commentmode'] = $_CONF['comment_mode']; $C['commentorder'] = 0; $C['commentlimit'] = 100; } $selection = '<select id="commentmode" name="commentmode">'; $selection .= COM_optionList($_TABLES['commentmodes'], 'mode,name', $C['commentmode']); $selection .= '</select>'; $userform->set_var('displaymode_selector', $selection); $selection = '<select id="commentorder" name="commentorder">'; $selection .= COM_optionList($_TABLES['sortcodes'], 'code,name', $C['commentorder']); $selection .= '</select>'; $userform->set_var('sortorder_selector', $selection); $userform->set_var('commentlimit_value', $U['commentlimit']); if (!empty($uid) && $uid > 1) { $userform->set_var('plugin_layout_comment', PLG_profileEdit($uid, 'layout', 'comment')); $userform->set_var('plugin_layout', PLG_profileEdit($uid, 'layout')); } $retval = $userform->finish($userform->parse('output', 'user')); return $retval; }
$promptadd = isset($_POST['promptadd']) ? COM_applyFilter($_POST['promptadd']) : ''; if (isset($_POST['sel_forum']) && !is_array($_POST['sel_forum'])) { $selected_forum = COM_applyFilter($_POST['sel_forum']); } else { $selected_forum = ''; } if ($promptadd == $LANG_GF93['addmoderator']) { $addmod = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout/admin'); $addmod->set_file(array('moderator' => 'mod_add.thtml')); $addmod->set_var('action_url', $_CONF['site_admin_url'] . '/plugins/forum/mods.php'); $addmod->set_var('imgset', $CONF_FORUM['imgset']); $addmod->set_var('LANG_filtertitle', 'Type'); $addmod->set_var('LANG_ADDMessage', $LANG_GF93['addmessage']); $addmod->set_var('sel_forums', COM_optionList($_TABLES['forum_forums'], 'forum_id,forum_name')); $addmod->set_var('sel_users', COM_optionList($_TABLES['users'], 'uid,username')); $addmod->set_var('sel_groups', COM_optionList($_TABLES['groups'], 'grp_id,grp_name')); $addmod->set_var('LANG_functions', $LANG_GF93['allowedfunctions']); $addmod->set_var('LANG_addmod', $LANG_GF93['addmoderator']); $addmod->set_var('LANG_forum', $LANG_GF01['FORUM']); $addmod->set_var('LANG_user', $LANG_GF01['USER']); $addmod->set_var('LANG_group', $LANG_GF01['GROUP']); $addmod->set_var('LANG_BAN', $LANG_GF93['ModBan']); $addmod->set_var('LANG_EDIT', $LANG_GF93['ModEdit']); $addmod->set_var('LANG_MOVE', $LANG_GF93['ModMove']); $addmod->set_var('LANG_STICK', $LANG_GF93['ModStick']); $addmod->set_var('LANG_DELETE', $LANG_GF01['DELETE']); $addmod->set_var('gltoken_name', CSRF_TOKEN); $addmod->set_var('gltoken', SEC_createToken()); $addmod->parse('output', 'moderator'); $display .= $addmod->finish($addmod->get_var('output')); } else {
/** * Displays the comment form * * @param string $title Title of comment * @param string $comment Text of comment * @param string $sid ID of object comment belongs to * @param int $pid ID of parent comment * @param string $type Type of object comment is posted to * @param string $mode Mode, e.g. 'preview' * @param string $postmode Indicates if comment is plain text or HTML * @return string HTML for comment form * */ function CMT_commentForm($title, $comment, $sid, $pid = '0', $type, $mode, $postmode) { global $_CONF, $_TABLES, $_USER, $LANG03, $LANG12, $LANG_LOGIN, $LANG_ACCESS; $retval = ''; // never trust $uid ... if (empty($_USER['uid'])) { $uid = 1; } else { $uid = $_USER['uid']; } $commentuid = $uid; $table = $_TABLES['comments']; if (($mode == 'edit' || $mode == $LANG03[28]) && isset($_REQUEST['cid'])) { $cid = COM_applyFilter($_REQUEST['cid']); $commentuid = DB_getItem($_TABLES['comments'], 'uid', "cid = '{$cid}'"); } elseif ($mode == 'editsubmission' || $mode == $LANG03[34]) { $cid = COM_applyFilter($_REQUEST['cid']); $commentuid = DB_getItem($_TABLES['commentsubmissions'], 'uid', "cid = '{$cid}'"); $table = $_TABLES['commentsubmissions']; } if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['commentsloginrequired'] == 1)) { $retval .= COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header')); $loginreq = new Template($_CONF['path_layout'] . 'submit'); $loginreq->set_file('loginreq', 'submitloginrequired.thtml'); $loginreq->set_var('xhtml', XHTML); $loginreq->set_var('login_message', $LANG_LOGIN[2]); $loginreq->set_var('site_url', $_CONF['site_url']); $loginreq->set_var('site_admin_url', $_CONF['site_admin_url']); $loginreq->set_var('lang_login', $LANG_LOGIN[3]); $loginreq->set_var('lang_newuser', $LANG_LOGIN[4]); $loginreq->parse('errormsg', 'loginreq'); $retval .= $loginreq->finish($loginreq->get_var('errormsg')); $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); return $retval; } else { COM_clearSpeedlimit($_CONF['commentspeedlimit'], 'comment'); $last = 0; if ($mode != 'edit' && $mode != 'editsubmission' && $mode != $LANG03[28] && $mode != $LANG03[34]) { // not edit mode or preview changes $last = COM_checkSpeedlimit('comment'); } if ($last > 0) { $retval .= COM_startBlock($LANG12[26], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG03[7] . $last . $LANG03[8] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); } else { if ($_CONF['advanced_editor'] == 1 && file_exists($_CONF['path_layout'] . 'comment/commentform_advanced.thtml')) { $postmode = 'html'; } elseif (empty($postmode)) { $postmode = $_CONF['postmode']; } // Note: // $comment / $newcomment is what goes into the preview / is // actually stored in the database -> strip HTML // $commenttext is what the user entered and goes back into the // <textarea> -> don't strip HTML $commenttext = htmlspecialchars(COM_stripslashes($comment)); // Replace $, {, and } with special HTML equivalents $commenttext = str_replace('$', '$', $commenttext); $commenttext = str_replace('{', '{', $commenttext); $commenttext = str_replace('}', '}', $commenttext); $title = COM_checkWords(strip_tags(COM_stripslashes($title))); // $title = str_replace('$','$',$title); done in CMT_getComment $_POST['title'] = $title; $newcomment = $comment; if ($mode == $LANG03[28]) { // for preview $newcomment = CMT_prepareText($comment, $postmode, $type, true, $cid); } elseif ($mode == $LANG03[34]) { $newcomment = CMT_prepareText($comment, $postmode, $type, true); } else { $newcomment = CMT_prepareText($comment, $postmode, $type); } $_POST['comment'] = $newcomment; // Preview mode: if (($mode == $LANG03[14] || $mode == $LANG03[28] || $mode == $LANG03[34]) && !empty($title) && !empty($comment)) { $start = new Template($_CONF['path_layout'] . 'comment'); $start->set_file(array('comment' => 'startcomment.thtml')); $start->set_var('xhtml', XHTML); $start->set_var('site_url', $_CONF['site_url']); $start->set_var('site_admin_url', $_CONF['site_admin_url']); $start->set_var('layout_url', $_CONF['layout_url']); $start->set_var('hide_if_preview', 'style="display:none"'); // Clean up all the vars $A = array(); foreach ($_POST as $key => $value) { if ($key == 'pid' || $key == 'cid') { $A[$key] = COM_applyFilter($_POST[$key], true); } else { if ($key == 'title' || $key == 'comment') { // these have already been filtered above $A[$key] = $_POST[$key]; } else { if ($key == 'username') { $A[$key] = htmlspecialchars(COM_checkWords(strip_tags(COM_stripslashes($_POST[$key])))); } else { $A[$key] = COM_applyFilter($_POST[$key]); } } } } // correct time and username for edit preview if ($mode == $LANG03[28] || $mode == $LANG03[34]) { $A['nice_date'] = DB_getItem($table, 'UNIX_TIMESTAMP(date)', "cid = '{$cid}'"); if ($_USER['uid'] != $commentuid) { $uresult = DB_query("SELECT username, fullname, email, photo FROM {$_TABLES['users']} WHERE uid = {$commentuid}"); $A = array_merge($A, DB_fetchArray($uresult)); } } if (empty($A['username'])) { $A['username'] = DB_getItem($_TABLES['users'], 'username', "uid = {$uid}"); } $thecomments = CMT_getComment($A, 'flat', $type, 'ASC', false, true); $start->set_var('comments', $thecomments); $retval .= COM_startBlock($LANG03[14]) . $start->finish($start->parse('output', 'comment')) . COM_endBlock(); } else { if ($mode == $LANG03[14]) { $retval .= COM_startBlock($LANG03[17], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG03[12] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); $mode = 'error'; } } $comment_template = new Template($_CONF['path_layout'] . 'comment'); if ($_CONF['advanced_editor'] == 1 && file_exists($_CONF['path_layout'] . 'comment/commentform_advanced.thtml')) { $comment_template->set_file('form', 'commentform_advanced.thtml'); } else { $comment_template->set_file('form', 'commentform.thtml'); } $comment_template->set_var('xhtml', XHTML); $comment_template->set_var('site_url', $_CONF['site_url']); $comment_template->set_var('site_admin_url', $_CONF['site_admin_url']); $comment_template->set_var('layout_url', $_CONF['layout_url']); $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[1])); if ($_CONF['show_fullname'] == 1) { $comment_template->set_var('lang_username', $LANG_ACCESS['name']); } else { $comment_template->set_var('lang_username', $LANG03[5]); } $comment_template->set_var('sid', $sid); $comment_template->set_var('pid', $pid); $comment_template->set_var('type', $type); $formurl = $_CONF['site_url'] . '/comment.php'; if ($mode == 'edit' || $mode == $LANG03[28]) { //edit modes $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[32])); $comment_template->set_var('cid', '<input type="hidden" name="cid" value="' . $cid . '"' . XHTML . '>'); } else { if ($mode == 'editsubmission' || $mode == $LANG03[34]) { $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[33])); $comment_template->set_var('cid', '<input type="hidden" name="cid" value="' . $cid . '"' . XHTML . '>'); } else { $comment_template->set_var('start_block_postacomment', COM_startBlock($LANG03[1])); $comment_template->set_var('cid', ''); } } $comment_template->set_var('form_url', $formurl); if (COM_isAnonUser()) { // Anonymous user $comment_template->set_var('uid', 1); if (isset($A['username'])) { $name = $A['username']; // for preview } elseif (isset($_COOKIE[$_CONF['cookie_anon_name']])) { // stored as cookie, name used before $name = htmlspecialchars(COM_checkWords(strip_tags(COM_stripslashes($_COOKIE[$_CONF['cookie_anon_name']])))); } else { $name = COM_getDisplayName(1); // anonymous user } $usernameblock = '<input type="text" name="username" size="16" value="' . $name . '" maxlength="32"' . XHTML . '>'; $comment_template->set_var('username', $usernameblock); $comment_template->set_var('action_url', $_CONF['site_url'] . '/users.php?mode=new'); $comment_template->set_var('lang_logoutorcreateaccount', $LANG03[04]); } else { if ($commentuid != $_USER['uid']) { $uresult = DB_query("SELECT username, fullname FROM {$_TABLES['users']} WHERE uid = {$commentuid}"); list($username, $fullname) = DB_fetchArray($uresult); } else { $username = $_USER['username']; $fullname = $_USER['fullname']; } $comment_template->set_var('gltoken_name', CSRF_TOKEN); $comment_template->set_var('gltoken', SEC_createToken()); $comment_template->set_var('uid', $commentuid); $name = COM_getDisplayName($commentuid, $username, $fullname); $comment_template->set_var('username', $name); $comment_template->set_var('action_url', $_CONF['site_url'] . '/users.php?mode=logout'); $comment_template->set_var('lang_logoutorcreateaccount', $LANG03[03]); } if ($postmode == 'html') { $comment_template->set_var('show_texteditor', 'none'); $comment_template->set_var('show_htmleditor', ''); } else { $comment_template->set_var('show_texteditor', ''); $comment_template->set_var('show_htmleditor', 'none'); } $comment_template->set_var('lang_title', $LANG03[16]); $comment_template->set_var('title', htmlspecialchars($title)); $comment_template->set_var('lang_comment', $LANG03[9]); $comment_template->set_var('comment', $commenttext); $comment_template->set_var('lang_postmode', $LANG03[2]); $comment_template->set_var('postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode)); $comment_template->set_var('allowed_html', COM_allowedHTML($type == 'article' ? 'story.edit' : "{$type}.edit")); $comment_template->set_var('lang_importantstuff', $LANG03[18]); $comment_template->set_var('lang_instr_line1', $LANG03[19]); $comment_template->set_var('lang_instr_line2', $LANG03[20]); $comment_template->set_var('lang_instr_line3', $LANG03[21]); $comment_template->set_var('lang_instr_line4', $LANG03[22]); $comment_template->set_var('lang_instr_line5', $LANG03[23]); if ($mode == 'edit' || $mode == $LANG03[28]) { //editing comment or preview changes $comment_template->set_var('lang_preview', $LANG03[28]); } elseif ($mode == 'editsubmission' || $mode == $LANG03[34]) { $comment_template->set_var('lang_preview', $LANG03[34]); } else { //new comment $comment_template->set_var('lang_preview', $LANG03[14]); } PLG_templateSetVars('comment', $comment_template); if ($mode == $LANG03[28] || $mode == 'edit' && $_CONF['skip_preview'] == 1) { // for editing $comment_template->set_var('save_option', '<input type="submit" name="mode" value="' . $LANG03[29] . '"' . XHTML . '>'); } elseif ($mode == $LANG03[34] || $mode == 'editsubmission' && $_CONF['skip_preview'] == 1) { // editing submission comment $comment_template->set_var('save_option', '<input type="submit" name="mode" value="' . $LANG03[35] . '"' . XHTML . '>'); } elseif ($_CONF['skip_preview'] == 1 || $mode == $LANG03[14]) { $comment_template->set_var('save_option', '<input type="submit" name="mode" value="' . $LANG03[11] . '"' . XHTML . '>'); } if ($_CONF['allow_reply_notifications'] == 1 && $uid != 1 && ($mode == '' || $mode == $LANG03[14] || $mode == 'error')) { $checked = ''; if (isset($_POST['notify'])) { $checked = ' checked="checked"'; } $comment_template->set_var('notification', '<p><input type="checkbox"' . ' name="notify"' . $checked . '>' . $LANG03[36] . '</p>'); } $comment_template->set_var('end_block', COM_endBlock()); $comment_template->parse('output', 'form'); $retval .= $comment_template->finish($comment_template->get_var('output')); } } return $retval; }
/** * Shows story editor * * Displays the story entry form * * @param string $sid ID of story to edit * @param string $mode 'preview', 'edit', 'editsubmission', 'clone' * @param string $errormsg a message to display on top of the page * @return string HTML for story editor * */ function storyeditor($sid = '', $mode = '', $errormsg = '') { global $_CONF, $_TABLES, $_USER, $LANG24, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS, $LANG_DIRECTION, $LANG_MONTH, $LANG_WEEK; $display = ''; if (!isset($_CONF['hour_mode'])) { $_CONF['hour_mode'] = 12; } if (!empty($errormsg)) { $display .= COM_showMessageText($errormsg, $LANG24[25]); } $story = new Story(); if ($mode == 'preview') { // Handle Magic GPC Garbage: while (list($key, $value) = each($_POST)) { if (!is_array($value)) { $_POST[$key] = COM_stripslashes($value); } else { while (list($subkey, $subvalue) = each($value)) { $value[$subkey] = COM_stripslashes($subvalue); } } } $result = $story->loadFromArgsArray($_POST); if ($_CONF['maximagesperarticle'] > 0) { $errors = $story->checkAttachedImages(); if (count($errors) > 0) { $msg = $LANG24[55] . LB . '<ul>' . LB; foreach ($errors as $err) { $msg .= '<li>' . $err . '</li>' . LB; } $msg .= '</ul>' . LB; $display .= COM_showMessageText($msg, $LANG24[54]); } } } else { $result = $story->loadFromDatabase($sid, $mode); } if ($result == STORY_PERMISSION_DENIED || $result == STORY_NO_ACCESS_PARAMS) { $display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied']); COM_accessLog("User {$_USER['username']} tried to illegally access story {$sid}."); return $display; } elseif ($result == STORY_EDIT_DENIED || $result == STORY_EXISTING_NO_EDIT_PERMISSION) { $display .= COM_showMessageText($LANG24[41], $LANG_ACCESS['accessdenied']); $display .= STORY_renderArticle($story, 'p'); COM_accessLog("User {$_USER['username']} tried to illegally edit story {$sid}."); return $display; } elseif ($result == STORY_INVALID_SID) { if ($mode == 'editsubmission') { // that submission doesn't seem to be there any more (may have been // handled by another Admin) - take us back to the moderation page return COM_refresh($_CONF['site_admin_url'] . '/moderation.php'); } else { return COM_refresh($_CONF['site_admin_url'] . '/story.php'); } } elseif ($result == STORY_DUPLICATE_SID) { $display .= COM_showMessageText($LANG24[24]); } // Load HTML templates $story_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/story'); if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) { $story_templates->set_file(array('editor' => 'storyeditor_advanced.thtml')); $advanced_editormode = true; $story_templates->set_var('change_editormode', 'onchange="change_editmode(this);"'); require_once $_CONF['path_system'] . 'classes/navbar.class.php'; $story_templates->set_var('show_preview', 'none'); $story_templates->set_var('lang_expandhelp', $LANG24[67]); $story_templates->set_var('lang_reducehelp', $LANG24[68]); $story_templates->set_var('lang_publishdate', $LANG24[69]); $story_templates->set_var('lang_toolbar', $LANG24[70]); $story_templates->set_var('toolbar1', $LANG24[71]); $story_templates->set_var('toolbar2', $LANG24[72]); $story_templates->set_var('toolbar3', $LANG24[73]); $story_templates->set_var('toolbar4', $LANG24[74]); $story_templates->set_var('toolbar5', $LANG24[75]); if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') { $story_templates->set_var('show_texteditor', 'none'); $story_templates->set_var('show_htmleditor', ''); } else { $story_templates->set_var('show_texteditor', ''); $story_templates->set_var('show_htmleditor', 'none'); } } else { $story_templates->set_file(array('editor' => 'storyeditor.thtml')); $advanced_editormode = false; } $story_templates->set_var('hour_mode', $_CONF['hour_mode']); if ($story->hasContent()) { $previewContent = STORY_renderArticle($story, 'p'); if ($advanced_editormode and $previewContent != '') { $story_templates->set_var('preview_content', $previewContent); } elseif ($previewContent != '') { $display .= COM_startBlock($LANG24[26], '', COM_getBlockTemplate('_admin_block', 'header')); $display .= $previewContent; $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); } } if ($advanced_editormode) { $navbar = new navbar(); if (!empty($previewContent)) { $navbar->add_menuitem($LANG24[79], 'showhideEditorDiv("preview",0);return false;', true); $navbar->add_menuitem($LANG24[80], 'showhideEditorDiv("editor",1);return false;', true); $navbar->add_menuitem($LANG24[81], 'showhideEditorDiv("publish",2);return false;', true); $navbar->add_menuitem($LANG24[82], 'showhideEditorDiv("images",3);return false;', true); $navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",4);return false;', true); $navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",5);return false;', true); $navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",6);return false;', true); } else { $navbar->add_menuitem($LANG24[80], 'showhideEditorDiv("editor",0);return false;', true); $navbar->add_menuitem($LANG24[81], 'showhideEditorDiv("publish",1);return false;', true); $navbar->add_menuitem($LANG24[82], 'showhideEditorDiv("images",2);return false;', true); $navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",3);return false;', true); $navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",4);return false;', true); $navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",5);return false;', true); } if ($mode == 'preview') { $story_templates->set_var('show_preview', ''); $story_templates->set_var('show_htmleditor', 'none'); $story_templates->set_var('show_texteditor', 'none'); $story_templates->set_var('show_submitoptions', 'none'); $navbar->set_selected($LANG24[79]); } else { $navbar->set_selected($LANG24[80]); } $story_templates->set_var('navbar', $navbar->generate()); } $oldsid = $story->EditElements('originalSid'); if (!empty($oldsid) && $mode != 'clone') { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $story_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $story_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); } if ($mode == 'editsubmission' || $story->type == 'submission') { $story_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>'); } $story_templates->set_var('lang_author', $LANG24[7]); $storyauthor = COM_getDisplayName($story->EditElements('uid')); $story_templates->set_var('story_author', $storyauthor); $story_templates->set_var('author', $storyauthor); $story_templates->set_var('story_uid', $story->EditElements('uid')); // user access info $story_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $story_templates->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($story->EditElements('owner_id')); $story_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', 'uid = ' . $story->EditElements('owner_id'))); $story_templates->set_var('owner_name', $ownername); $story_templates->set_var('owner', $ownername); $story_templates->set_var('owner_id', $story->EditElements('owner_id')); $story_templates->set_var('lang_group', $LANG_ACCESS['group']); $story_templates->set_var('group_dropdown', SEC_getGroupDropdown($story->EditElements('group_id'), 3)); $story_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $story_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $story_templates->set_var('permissions_editor', SEC_getPermissionsHTML($story->EditElements('perm_owner'), $story->EditElements('perm_group'), $story->EditElements('perm_members'), $story->EditElements('perm_anon'))); $story_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']); $story_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $curtime = COM_getUserDateTimeFormat($story->EditElements('date')); $story_templates->set_var('lang_date', $LANG24[15]); $story_templates->set_var('publish_second', $story->EditElements('publish_second')); $publish_ampm = ''; $publish_hour = $story->EditElements('publish_hour'); if ($publish_hour >= 12) { if ($publish_hour > 12) { $publish_hour = $publish_hour - 12; } $ampm = 'pm'; } else { $ampm = 'am'; } $ampm_select = COM_getAmPmFormSelection('publish_ampm', $ampm); $story_templates->set_var('publishampm_selection', $ampm_select); $month_options = COM_getMonthFormOptions($story->EditElements('publish_month')); $story_templates->set_var('publish_month_options', $month_options); $day_options = COM_getDayFormOptions($story->EditElements('publish_day')); $story_templates->set_var('publish_day_options', $day_options); $year_options = COM_getYearFormOptions($story->EditElements('publish_year')); $story_templates->set_var('publish_year_options', $year_options); if ($_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($story->EditElements('publish_hour'), 24); } else { $hour_options = COM_getHourFormOptions($publish_hour); } $story_templates->set_var('publish_hour_options', $hour_options); $minute_options = COM_getMinuteFormOptions($story->EditElements('publish_minute')); $story_templates->set_var('publish_minute_options', $minute_options); $story_templates->set_var('publish_date_explanation', $LANG24[46]); $story_templates->set_var('story_unixstamp', $story->EditElements('unixdate')); $story_templates->set_var('expire_second', $story->EditElements('expire_second')); $expire_ampm = ''; $expire_hour = $story->EditElements('expire_hour'); if ($expire_hour >= 12) { if ($expire_hour > 12) { $expire_hour = $expire_hour - 12; } $ampm = 'pm'; } else { $ampm = 'am'; } $ampm_select = COM_getAmPmFormSelection('expire_ampm', $ampm); if (empty($ampm_select)) { // have a hidden field to 24 hour mode to prevent JavaScript errors $ampm_select = '<input type="hidden" name="expire_ampm" value=""' . XHTML . '>'; } $story_templates->set_var('expireampm_selection', $ampm_select); $month_options = COM_getMonthFormOptions($story->EditElements('expire_month')); $story_templates->set_var('expire_month_options', $month_options); $day_options = COM_getDayFormOptions($story->EditElements('expire_day')); $story_templates->set_var('expire_day_options', $day_options); $year_options = COM_getYearFormOptions($story->EditElements('expire_year')); $story_templates->set_var('expire_year_options', $year_options); if ($_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($story->EditElements('expire_hour'), 24); } else { $hour_options = COM_getHourFormOptions($expire_hour); } $story_templates->set_var('expire_hour_options', $hour_options); $minute_options = COM_getMinuteFormOptions($story->EditElements('expire_minute')); $story_templates->set_var('expire_minute_options', $minute_options); $story_templates->set_var('expire_date_explanation', $LANG24[46]); $story_templates->set_var('story_unixstamp', $story->EditElements('expirestamp')); $atopic = DB_getItem($_TABLES['topics'], 'tid', "archive_flag = 1"); $have_archive_topic = empty($atopic) ? false : true; if ($story->EditElements('statuscode') == STORY_ARCHIVE_ON_EXPIRE) { $story_templates->set_var('is_checked2', 'checked="checked"'); $story_templates->set_var('is_checked3', 'checked="checked"'); $js_showarchivedisabled = 'false'; $have_archive_topic = true; // force display of auto archive option } elseif ($story->EditElements('statuscode') == STORY_DELETE_ON_EXPIRE) { $story_templates->set_var('is_checked2', 'checked="checked"'); $story_templates->set_var('is_checked4', 'checked="checked"'); if (!$have_archive_topic) { $story_templates->set_var('is_checked3', 'style="display:none;"'); } $js_showarchivedisabled = 'false'; } else { if (!$have_archive_topic) { $story_templates->set_var('is_checked3', 'style="display:none;"'); } $js_showarchivedisabled = 'true'; } $story_templates->set_var('lang_archivetitle', $LANG24[58]); $story_templates->set_var('lang_option', $LANG24[59]); $story_templates->set_var('lang_enabled', $LANG_ADMIN['enabled']); $story_templates->set_var('lang_story_stats', $LANG24[87]); if ($have_archive_topic) { $story_templates->set_var('lang_optionarchive', $LANG24[61]); } else { $story_templates->set_var('lang_optionarchive', ''); } $story_templates->set_var('lang_optiondelete', $LANG24[62]); $story_templates->set_var('lang_title', $LANG_ADMIN['title']); $story_templates->set_var('story_title', $story->EditElements('title')); $story_templates->set_var('lang_page_title', $LANG_ADMIN['page_title']); $story_templates->set_var('page_title', $story->EditElements('page_title')); $story_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']); $story_templates->set_var('meta_description', $story->EditElements('meta_description')); $story_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']); $story_templates->set_var('meta_keywords', $story->EditElements('meta_keywords')); if ($_CONF['meta_tags'] > 0) { $story_templates->set_var('hide_meta', ''); } else { $story_templates->set_var('hide_meta', ' style="display:none;"'); } $story_templates->set_var('lang_topic', $LANG_ADMIN['topic']); if ($mode == 'preview') { $tlist = TOPIC_getTopicSelectionControl('article', '', false, true, true); } else { $tlist = TOPIC_getTopicSelectionControl('article', $oldsid, false, true, true); } if (empty($tlist)) { $display .= COM_showMessage(101); return $display; } $story_templates->set_var('topic_selection', $tlist); $story_templates->set_var('lang_show_topic_icon', $LANG24[56]); if ($story->EditElements('show_topic_icon') == 1) { $story_templates->set_var('show_topic_icon_checked', 'checked="checked"'); } else { $story_templates->set_var('show_topic_icon_checked', ''); } $story_templates->set_var('lang_cachetime', $LANG24['cache_time']); $story_templates->set_var('lang_cachetime_desc', $LANG24['cache_time_desc']); $story_templates->set_var('cache_time', $story->EditElements('cache_time')); $story_templates->set_var('lang_draft', $LANG24[34]); if ($story->EditElements('draft_flag')) { $story_templates->set_var('is_checked', 'checked="checked"'); } $story_templates->set_var('lang_mode', $LANG24[3]); $story_templates->set_var('status_options', COM_optionList($_TABLES['statuscodes'], 'code,name', $story->EditElements('statuscode'))); $story_templates->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $story->EditElements('commentcode'))); $story_templates->set_var('trackback_options', COM_optionList($_TABLES['trackbackcodes'], 'code,name', $story->EditElements('trackbackcode'))); // comment expire $story_templates->set_var('lang_cmt_disable', $LANG24[63]); if ($story->EditElements('cmt_close')) { $story_templates->set_var('is_checked5', 'checked="checked"'); $js_showcmtclosedisabled = 'false'; } else { $js_showcmtclosedisabled = 'true'; } $month_options = COM_getMonthFormOptions($story->EditElements('cmt_close_month')); $story_templates->set_var('cmt_close_month_options', $month_options); $day_options = COM_getDayFormOptions($story->EditElements('cmt_close_day')); $story_templates->set_var('cmt_close_day_options', $day_options); // ensure that the year dropdown includes the close year $endtm = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y')); $yoffset = date('Y', $endtm) - date('Y'); $close_year = $story->EditElements('cmt_close_year'); if ($yoffset < -1) { $year_options = COM_getYearFormOptions($close_year, $yoffset); } elseif ($yoffset > 5) { $year_options = COM_getYearFormOptions($close_year, -1, $yoffset); } else { $year_options = COM_getYearFormOptions($close_year); } $story_templates->set_var('cmt_close_year_options', $year_options); $cmt_close_ampm = ''; $cmt_close_hour = $story->EditElements('cmt_close_hour'); //correct hour if ($cmt_close_hour >= 12) { if ($cmt_close_hour > 12) { $cmt_close_hour = $cmt_close_hour - 12; } $ampm = 'pm'; } else { $ampm = 'am'; } $ampm_select = COM_getAmPmFormSelection('cmt_close_ampm', $ampm); if (empty($ampm_select)) { // have a hidden field to 24 hour mode to prevent JavaScript errors $ampm_select = '<input type="hidden" name="cmt_close_ampm" value=""' . XHTML . '>'; } $story_templates->set_var('cmt_close_ampm_selection', $ampm_select); if ($_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($story->EditElements('cmt_close_hour'), 24); } else { $hour_options = COM_getHourFormOptions($cmt_close_hour); } $story_templates->set_var('cmt_close_hour_options', $hour_options); $minute_options = COM_getMinuteFormOptions($story->EditElements('cmt_close_minute')); $story_templates->set_var('cmt_close_minute_options', $minute_options); $story_templates->set_var('cmt_close_second', $story->EditElements('cmt_close_second')); if ($_CONF['onlyrootfeatures'] == 1 && SEC_inGroup('Root') or $_CONF['onlyrootfeatures'] !== 1) { $featured_options = "<select name=\"featured\">" . LB . COM_optionList($_TABLES['featurecodes'], 'code,name', $story->EditElements('featured')) . "</select>" . LB; } else { $featured_options = "<input type=\"hidden\" name=\"featured\" value=\"0\"" . XHTML . ">"; } $story_templates->set_var('featured_options', $featured_options); $story_templates->set_var('frontpage_options', COM_optionList($_TABLES['frontpagecodes'], 'code,name', $story->EditElements('frontpage'))); $story_templates->set_var('story_introtext', $story->EditElements('introtext')); $story_templates->set_var('story_bodytext', $story->EditElements('bodytext')); $story_templates->set_var('lang_introtext', $LANG24[16]); $story_templates->set_var('lang_bodytext', $LANG24[17]); $story_templates->set_var('lang_postmode', $LANG24[4]); $story_templates->set_var('lang_publishoptions', $LANG24[76]); $story_templates->set_var('noscript', COM_getNoScript(false, $LANG24[77], sprintf($LANG24[78], $_CONF['site_admin_url'], $sid))); $postmode = $story->EditElements('postmode'); if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) { if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') { $postmode = ''; } } $post_options = COM_optionList($_TABLES['postmodes'], 'code,name', $postmode); $postmode_list = 'plaintext,html'; // If Advanced Mode - add post option and set default if editing story created with Advanced Editor if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) { $postmode_list .= ',adveditor'; if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') { $post_options .= '<option value="adveditor" selected="selected">' . $LANG24[86] . '</option>'; } else { $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>'; } } if ($_CONF['wikitext_editor']) { $postmode_list .= ',wikitext'; if ($story->EditElements('postmode') == 'wikitext') { $post_options .= '<option value="wikitext" selected="selected">' . $LANG24[88] . '</option>'; } else { $post_options .= '<option value="wikitext">' . $LANG24[88] . '</option>'; } } $story_templates->set_var('post_options', $post_options); $postmode_array = explode(',', $postmode_list); $allowed_html = ''; foreach ($postmode_array as $pm) { $allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm); } $allowed_tags = array('code', 'raw'); if ($_CONF['allow_page_breaks'] == 1) { $allowed_tags = array_merge($allowed_tags, array('page_break')); } $allowed_html .= COM_allowedAutotags(false, $allowed_tags); $story_templates->set_var('lang_allowed_html', $allowed_html); $fileinputs = ''; $saved_images = ''; if ($_CONF['maximagesperarticle'] > 0) { $story_templates->set_var('lang_images', $LANG24[47]); $icount = DB_count($_TABLES['article_images'], 'ai_sid', $story->getSid()); if ($icount > 0) { $result_articles = DB_query("SELECT * FROM {$_TABLES['article_images']} WHERE ai_sid = '" . $story->getSid() . "'"); for ($z = 1; $z <= $icount; $z++) { $I = DB_fetchArray($result_articles); $saved_images .= $z . ') ' . COM_createLink($I['ai_filename'], $_CONF['site_url'] . '/images/articles/' . $I['ai_filename']) . ' ' . $LANG_ADMIN['delete'] . ': <input type="checkbox" name="delete[' . $I['ai_img_num'] . ']"' . XHTML . '><br' . XHTML . '>'; } } $newallowed = $_CONF['maximagesperarticle'] - $icount; for ($z = $icount + 1; $z <= $_CONF['maximagesperarticle']; $z++) { $fileinputs .= $z . ') <input type="file" dir="ltr" name="file' . $z . '"' . XHTML . '>'; if ($z < $_CONF['maximagesperarticle']) { $fileinputs .= '<br' . XHTML . '>'; } } $fileinputs .= '<br' . XHTML . '>' . $LANG24[51]; if ($_CONF['allow_user_scaling'] == 1) { $fileinputs .= $LANG24[27]; } $fileinputs .= $LANG24[28] . '<br' . XHTML . '>'; } // Add JavaScript $_SCRIPTS->setJavaScriptFile('story_editor', '/javascript/story_editor.js'); if ($_CONF['titletoid']) { $_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js'); $story_templates->set_var('titletoid', true); } $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js'); // Loads jQuery UI datepicker and timepicker-addon $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider'); // $_SCRIPTS->setJavaScriptLibrary('jquery.ui.button'); $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n'); // $_SCRIPTS->setJavaScriptLibrary('jquery-ui-slideraccess'); $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js'); $langCode = COM_getLangIso639Code(); $toolTip = $MESSAGE[118]; $imgUrl = $_CONF['site_url'] . '/images/calendar.png'; $_SCRIPTS->setJavaScript("jQuery(function () {" . " geeklog.hour_mode = {$_CONF['hour_mode']};" . " geeklog.datetimepicker.set('publish', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . " geeklog.datetimepicker.set('expire', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . " geeklog.datetimepicker.set('cmt_close', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE); // Setup Advanced Editor COM_setupAdvancedEditor('/javascript/storyeditor_adveditor.js'); $story_templates->set_var('saved_images', $saved_images); $story_templates->set_var('image_form_elements', $fileinputs); $story_templates->set_var('lang_hits', $LANG24[18]); $story_templates->set_var('story_hits', $story->EditElements('hits')); $story_templates->set_var('lang_comments', $LANG24[19]); $story_templates->set_var('story_comments', $story->EditElements('comments')); $story_templates->set_var('lang_trackbacks', $LANG24[29]); $story_templates->set_var('story_trackbacks', $story->EditElements('trackbacks')); $story_templates->set_var('lang_emails', $LANG24[39]); $story_templates->set_var('story_emails', $story->EditElements('numemails')); if ($mode == 'clone') { $story_templates->set_var('story_id', COM_makesid()); } else { $story_templates->set_var('story_id', $story->getSid()); $story_templates->set_var('old_story_id', $story->EditElements('originalSid')); } $story_templates->set_var('lang_sid', $LANG24[12]); $story_templates->set_var('lang_save', $LANG_ADMIN['save']); $story_templates->set_var('lang_preview', $LANG_ADMIN['preview']); $story_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); $story_templates->set_var('lang_delete', $LANG_ADMIN['delete']); $story_templates->set_var('gltoken_name', CSRF_TOKEN); $token = SEC_createToken(); $story_templates->set_var('gltoken', $token); $story_templates->parse('output', 'editor'); $display .= COM_startBlock($LANG24[5], '', COM_getBlockTemplate('_admin_block', 'header')); $display .= SEC_getTokenExpiryNotice($token, $LANG24[91]); $display .= $story_templates->finish($story_templates->get_var('output')); $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $display; }
/** * Display the common header for all calendar views. * * @param integer $year Year being displayed (required) * @param integer $month Month being displayed (require) * @param integer $day Day being displayed (required) * @param string $view View type (Optional 'year', 'month', etc.) * @param integer $cat Category (optional) * @param integer $cal Calendar ID (optional) * @param integer $range Range being displayed (optional) * @return string HTML for calendar header */ function EVLIST_calHeader($year, $month, $day, $view = 'month', $cat = 0, $cal = 0, $range = 0) { global $_CONF, $_EV_CONF, $LANG_EVLIST, $LANG_MONTH, $_TABLES; $T = new Template(EVLIST_PI_PATH . '/templates'); $T->set_file('calendar_header', 'calendar_header.thtml'); $today = new Date($_EV_CONF['_today_ts'], $_CONF['timezone']); $thisyear = $today->format('Y', true); $thismonth = $today->format('m', true); $thisday = $today->format('d', true); // Determine if the current user is allowed to add an event, and borrow // some space in $_EV_CONF to store a flag for other functions to use. $isAnon = COM_isAnonUser(); if ($isAnon && $_EV_CONF['can_add'] & EV_ANON_CAN_ADD || $_EV_CONF['can_add'] & EV_USER_CAN_ADD || SEC_hasRights('evlist.admin')) { $_EV_CONF['_can_add'] = 1; } else { $_EV_CONF['_can_add'] = 0; } $cat = (int) $cat; $type_options = COM_optionList($_TABLES['evlist_categories'], 'id,name', $cat, 1, 'status=1'); $range_options = EVLIST_GetOptions($LANG_EVLIST['ranges'], $range); // Figure out the add event link, depending on the view. if ($_EV_CONF['_can_add'] == 1) { $add_event_link = EVLIST_URL . '/event.php'; switch ($view) { case 'day': // Add the current day $T->set_var('addlink_day', $day); case 'week': case 'month': $T->set_var('addlink_month', $month); case 'year': $T->set_var('addlink_year', $year); } } else { $add_event_link = ''; } $T->set_var(array('pi_url' => EVLIST_URL, 'year' => (int) $year, 'month' => (int) $month, 'day' => (int) $day, 'thisyear' => (int) $thisyear, 'thismonth' => (int) $thismonth, 'thisday' => (int) $thisday, 'thisview' => $view, 'add_event_link' => $add_event_link, 'add_event_text' => $LANG_EVLIST['add_event'], 'event_type_select' => $type_options, 'range_options' => $range_options, 'action_url' => EVLIST_URL . '/index.php', 'iso_lang' => EVLIST_getIsoLang(), 'view' => $view, 'curdate' => sprintf("%d-%02d-%02d", $year, $month, $day), 'urlfilt_cal' => $cal, 'urlfilt_cat' => $cat, 'use_json' => $_EV_CONF['cal_tmpl'] == 'json' ? 'true' : '')); $cal_selected = isset($_GET['cal']) ? (int) $_GET['cal'] : 0; $T->set_var('cal_select', COM_optionList($_TABLES['evlist_calendars'], 'cal_id,cal_name', $cal_selected, 1, '1=1 ' . COM_getPermSQL('AND'))); if (isset($_GET['range']) && !empty($_GET['range'])) { $T->set_var('range_url', 'range=' . $_GET['range']); } if ($view == 'detail') { // Set marker to disable category/range dropdowns $T->set_var('showing_detail', 'true'); } if ($view == 'list' || $view == 'detail') { $T->set_var('event_type', $event_type); } else { // Create the jump-to-date selectors $options = ''; for ($i = 1; $i < 32; $i++) { $sel = $i == $day ? EVSELECTED : ''; $options .= "<option value=\"{$i}\" {$sel}>{$i}</option>" . LB; } $T->set_var('day_select', $options); $options = ''; for ($i = 1; $i < 13; $i++) { $sel = $i == $month ? EVSELECTED : ''; $options .= "<option value=\"{$i}\" {$sel}>{$LANG_MONTH[$i]}</option>" . LB; } $T->set_var('month_select', $options); $options = ''; $lastyear = $thisyear + 6; for ($i = $thisyear - 2; $i < $lastyear; $i++) { $sel = $i == $year ? EVSELECTED : ''; $options .= "<option value=\"{$i}\" {$sel}>{$i}</option>" . LB; } $T->set_var('year_select', $options); } $images = array('day', 'week', 'month', 'year', 'list'); $options = ''; foreach ($images as $v) { if ($v == $view) { $sel = EVSELECTED; $T->set_var($v . '_img', $v . '_on.png'); } else { $sel = ''; $T->set_var($v . '_img', $v . '_off.png'); } if ($v != 'list') { $options .= '<option value="' . $v . '" ' . $sel . ' >' . $LANG_EVLIST['periods'][$v] . '</option>' . LB; } } $T->set_var('view_select', $options); $T->parse('output', 'calendar_header'); return $T->finish($T->get_var('output')); }
function MG_editConfig($msgString = '') { global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_DIRECTION, $LANG04; $retval = ''; $T = new Template($_MG_CONF['template_path'] . '/admin'); $T->set_file('admin', 'cfgedit.thtml'); $T->set_var('site_url', $_MG_CONF['site_url']); if ($msgString != '') { $T->set_var('feedback', $msgString); } if (!isset($_MG_CONF['rating_max'])) { $_MG_CONF['rating_max'] = 5; } if (!isset($_MG_CONF['moderation'])) { $_MG_CONF['moderation'] = 0; } // build our graphics package select... $gp_select = "<select name='graphicspackage'>"; $gp_select .= "<option value='0'" . ($_MG_CONF['graphicspackage'] == 0 ? ' selected="selected"' : "") . ">ImageMagick</option>"; $gp_select .= "<option value='1'" . ($_MG_CONF['graphicspackage'] == 1 ? ' selected="selected"' : "") . ">NetPBM</option>"; $gp_select .= "<option value='2'" . ($_MG_CONF['graphicspackage'] == 2 ? ' selected="selected"' : "") . ">GD Libraries</option>"; $gp_select .= "</select>"; $block_select = '<select name="displayblocks">'; $block_select .= '<option value="0"' . ($_MG_CONF['displayblocks'] == 0 ? ' selected="selected"' : "") . '>' . $LANG_MG01['left_blocks_only'] . '</option>'; $block_select .= '<option value="1"' . ($_MG_CONF['displayblocks'] == 1 ? ' selected="selected"' : "") . '>' . $LANG_MG01['right_blocks_only'] . '</option>'; $block_select .= '<option value="2"' . ($_MG_CONF['displayblocks'] == 2 ? ' selected="selected"' : "") . '>' . $LANG_MG01['left_right_blocks'] . '</option>'; $block_select .= '<option value="3"' . ($_MG_CONF['displayblocks'] == 3 ? ' selected="selected"' : "") . '>' . $LANG_MG01['none'] . '</option>'; $block_select .= '</select>'; $dfid_select = '<select name="dfid"><option value="99">' . $LANG_MG00['no_date'] . '</option>' . COM_optionList($_TABLES['dateformats'], 'dfid,description', $_MG_CONF['dfid'], 0) . '</select>'; if (isset($_MG_CONF['index_all']) && $_MG_CONF['index_all'] == 1) { $T->set_var('index_all_yes_checked', ' checked="checked"'); } else { $T->set_var('index_all_no_checked', ' checked="checked"'); } if ($_MG_CONF['loginrequired'] == 1) { $T->set_var('lr_yes_checked', ' checked="checked"'); } else { $T->set_var('lr_no_checked', ' checked="checked"'); } if (isset($_MG_CONF['moderation']) && $_MG_CONF['moderation'] == 1) { $T->set_var('au_yes_checked', ' checked="checked"'); } else { $T->set_var('au_no_checked', ' checked="checked"'); } if ($_MG_CONF['htmlallowed'] == 1) { $T->set_var('ha_yes_checked', ' checked="checked"'); } else { $T->set_var('ha_no_checked', ' checked="checked"'); } if ($_MG_CONF['whatsnew'] == 1) { $T->set_var('wn_yes_checked', ' checked="checked"'); } else { $T->set_var('wn_no_checked', ' checked="checked"'); } if ($_MG_CONF['usage_tracking'] == 1) { $T->set_var('ut_yes_checked', ' checked="checked"'); } else { $T->set_var('ut_no_checked', ' checked="checked"'); } if ($_MG_CONF['preserve_filename'] == 1) { $T->set_var('pf_yes_checked', ' checked="checked"'); } else { $T->set_var('pf_no_checked', ' checked="checked"'); } if ($_MG_CONF['discard_original'] == 1) { $T->set_var('do_yes_checked', ' checked="checked"'); } else { $T->set_var('do_no_checked', ' checked="checked"'); } if ($_MG_CONF['verbose'] == 1) { $T->set_var('verbose_yes_checked', ' checked="checked"'); } else { $T->set_var('verbose_no_checked', ' checked="checked"'); } if ($_MG_CONF['disable_whatsnew_comments'] == 1) { $T->set_var('dwnc_yes_checked', ' checked="checked"'); } else { $T->set_var('dwnc_no_checked', ' checked="checked"'); } if ($_MG_CONF['enable_media_id'] == 1) { $T->set_var('emid_yes_checked', ' checked="checked"'); } else { $T->set_var('emid_no_checked', ' checked="checked"'); } if ($_MG_CONF['full_in_popup'] == 1) { $T->set_var('fip_yes_checked', ' checked="checked"'); } else { $T->set_var('fip_no_checked', ' checked="checked"'); } if ($_MG_CONF['commentbar'] == 1) { $T->set_var('cmtbar_yes_checked', ' checked="checked"'); } else { $T->set_var('cmtbar_no_checked', ' checked="checked"'); } if ($_MG_CONF['profile_hook'] == 1) { $T->set_var('ph_yes_checked', ' checked="checked"'); } else { $T->set_var('ph_no_checked', ' checked="checked"'); } if ($_MG_CONF['subalbum_select'] == 1) { $T->set_var('sa_yes_checked', ' checked="checked"'); } else { $T->set_var('sa_no_checked', ' checked="checked"'); } $T->set_var('wn_length', $_MG_CONF['title_length']); // -- auto tag defaults if ($_MG_CONF['at_border'] == 1) { $T->set_var('at_border_yes_checked', ' checked="checked"'); } else { $T->set_var('at_border_no_checked', ' checked="checked"'); } if ($_MG_CONF['at_autoplay'] == 1) { $T->set_var('at_autoplay_yes_checked', ' checked="checked"'); } else { $T->set_var('at_autoplay_no_checked', ' checked="checked"'); } if ($_MG_CONF['at_enable_link'] == 2) { $T->set_var('at_enable_link_lb_checked', ' checked="checked"'); } elseif ($_MG_CONF['at_enable_link'] == 1) { $T->set_var('at_enable_link_yes_checked', ' checked="checked"'); } else { $T->set_var('at_enable_link_no_checked', ' checked="checked"'); } if ($_MG_CONF['at_showtitle'] == 1) { $T->set_var('at_showtitle_yes_checked', ' checked="checked"'); } else { $T->set_var('at_showtitle_no_checked', ' checked="checked"'); } if ($_MG_CONF['search_enable_views'] == 1) { $T->set_var('search_enable_views_yes_checked', ' checked="checked"'); } else { $T->set_var('search_enable_views_no_checked', ' checked="checked"'); } if ($_MG_CONF['search_enable_rating'] == 1) { $T->set_var('search_enable_rating_yes_checked', ' checked="checked"'); } else { $T->set_var('search_enable_rating_no_checked', ' checked="checked"'); } if ($_MG_CONF['gallery_only'] == 1) { $T->set_var('gallery_only_yes_checked', ' checked="checked"'); } else { $T->set_var('gallery_only_no_checked', ' checked="checked"'); } $search_playback_type = '<select name="search_playback_type">'; $search_playback_type .= '<option value="0"' . ($_MG_CONF['search_playback_type'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['play_in_popup'] . '</option>'; $search_playback_type .= '<option value="1"' . ($_MG_CONF['search_playback_type'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['download_to_local'] . '</option>'; $search_playback_type .= '<option value="2"' . ($_MG_CONF['search_playback_type'] == 2 ? 'selected="selected"' : '') . '>' . $LANG_MG01['play_inline'] . '</option>'; $search_playback_type .= '<option value="3"' . ($_MG_CONF['search_playback_type'] == 3 ? 'selected="selected"' : '') . '>' . $LANG_MG01['use_mms'] . '</option>'; $search_playback_type .= '</select>'; $at_align_select = '<select name="at_align">'; $at_align_select .= '<option value="none"' . ($_MG_CONF['at_align'] == 'none' ? ' selected="selected"' : "") . '>' . $LANG_MG01['none'] . '</option>'; $at_align_select .= '<option value="auto"' . ($_MG_CONF['at_align'] == 'auto' ? ' selected="selected"' : "") . '>' . $LANG_MG01['auto'] . '</option>'; $at_align_select .= '<option value="left"' . ($_MG_CONF['at_align'] == 'left' ? ' selected="selected"' : "") . '>' . $LANG_MG01['left'] . '</option>'; $at_align_select .= '<option value="right"' . ($_MG_CONF['at_align'] == 'right' ? ' selected="selected"' : "") . '>' . $LANG_MG01['right'] . '</option>'; $at_align_select .= '<option value="center"' . ($_MG_CONF['at_align'] == 'center' ? ' selected="selected"' : "") . '>' . $LANG_MG01['center'] . '</option>'; $at_align_select .= '</select>'; $at_src_select = '<select name="at_src">'; $at_src_select .= '<option value="tn"' . ($_MG_CONF['at_src'] == 'tn' ? ' selected="selected"' : "") . '>' . $LANG_MG01['thumbnail'] . '</option>'; $at_src_select .= '<option value="disp"' . ($_MG_CONF['at_src'] == 'disp' ? ' selected="selected"' : "") . '>' . $LANG_MG01['display_image'] . '</option>'; $at_src_select .= '<option value="orig"' . ($_MG_CONF['at_src'] == 'orig' ? ' selected="selected"' : "") . '>' . $LANG_MG01['original_image'] . '</option>'; $at_src_select .= '</select>'; $wn_time_select = '<select name="whatsnew_time">'; $wn_time_select .= '<option value="1"' . ($_MG_CONF['whatsnew_time'] == 1 ? ' selected="selected"' : "") . '>1 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="2"' . ($_MG_CONF['whatsnew_time'] == 2 ? ' selected="selected"' : "") . '>2 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="3"' . ($_MG_CONF['whatsnew_time'] == 3 ? ' selected="selected"' : "") . '>3 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="4"' . ($_MG_CONF['whatsnew_time'] == 4 ? ' selected="selected"' : "") . '>4 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="5"' . ($_MG_CONF['whatsnew_time'] == 5 ? ' selected="selected"' : "") . '>5 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="6"' . ($_MG_CONF['whatsnew_time'] == 6 ? ' selected="selected"' : "") . '>6 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="7"' . ($_MG_CONF['whatsnew_time'] == 7 ? ' selected="selected"' : "") . '>7 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="8"' . ($_MG_CONF['whatsnew_time'] == 8 ? ' selected="selected"' : "") . '>8 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="9"' . ($_MG_CONF['whatsnew_time'] == 9 ? ' selected="selected"' : "") . '>9 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="10"' . ($_MG_CONF['whatsnew_time'] == 10 ? ' selected="selected"' : "") . '>10 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="11"' . ($_MG_CONF['whatsnew_time'] == 11 ? ' selected="selected"' : "") . '>11 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="12"' . ($_MG_CONF['whatsnew_time'] == 12 ? ' selected="selected"' : "") . '>12 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="13"' . ($_MG_CONF['whatsnew_time'] == 13 ? ' selected="selected"' : "") . '>13 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="14"' . ($_MG_CONF['whatsnew_time'] == 14 ? ' selected="selected"' : "") . '>14 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="15"' . ($_MG_CONF['whatsnew_time'] == 15 ? ' selected="selected"' : "") . '>15 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="16"' . ($_MG_CONF['whatsnew_time'] == 16 ? ' selected="selected"' : "") . '>16 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="17"' . ($_MG_CONF['whatsnew_time'] == 17 ? ' selected="selected"' : "") . '>17 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="18"' . ($_MG_CONF['whatsnew_time'] == 18 ? ' selected="selected"' : "") . '>18 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="19"' . ($_MG_CONF['whatsnew_time'] == 19 ? ' selected="selected"' : "") . '>19 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="20"' . ($_MG_CONF['whatsnew_time'] == 20 ? ' selected="selected"' : "") . '>20 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="21"' . ($_MG_CONF['whatsnew_time'] == 21 ? ' selected="selected"' : "") . '>21 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="22"' . ($_MG_CONF['whatsnew_time'] == 22 ? ' selected="selected"' : "") . '>22 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="23"' . ($_MG_CONF['whatsnew_time'] == 23 ? ' selected="selected"' : "") . '>23 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="24"' . ($_MG_CONF['whatsnew_time'] == 24 ? ' selected="selected"' : "") . '>24 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="25"' . ($_MG_CONF['whatsnew_time'] == 25 ? ' selected="selected"' : "") . '>25 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="26"' . ($_MG_CONF['whatsnew_time'] == 26 ? ' selected="selected"' : "") . '>26 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="27"' . ($_MG_CONF['whatsnew_time'] == 27 ? ' selected="selected"' : "") . '>27 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="28"' . ($_MG_CONF['whatsnew_time'] == 28 ? ' selected="selected"' : "") . '>28 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="29"' . ($_MG_CONF['whatsnew_time'] == 29 ? ' selected="selected"' : "") . '>29 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '<option value="30"' . ($_MG_CONF['whatsnew_time'] == 30 ? ' selected="selected"' : "") . '>30 ' . $LANG_MG01['days'] . '</option>'; $wn_time_select .= '</select>'; $rating_select = '<select name="rating_max">'; $rating_select .= '<option value="5"' . ($_MG_CONF['rating_max'] == 5 ? ' selected="selected"' : "") . '>5</option>'; $rating_select .= '<option value="10"' . ($_MG_CONF['rating_max'] == 10 ? ' selected="selected"' : "") . '>10</option>'; $rating_select .= '<option value="15"' . ($_MG_CONF['rating_max'] == 15 ? ' selected="selected"' : "") . '>15</option>'; $rating_select .= '<option value="20"' . ($_MG_CONF['rating_max'] == 20 ? ' selected="selected"' : "") . '>20</option>'; $rating_select .= '</select>'; $gallery_tn_size_select = '<select name="gallery_tn_size">'; $gallery_tn_size_select .= '<option value="0"' . ($_MG_CONF['gallery_tn_size'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['small'] . '</option>'; $gallery_tn_size_select .= '<option value="1"' . ($_MG_CONF['gallery_tn_size'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['medium'] . '</option>'; $gallery_tn_size_select .= '<option value="2"' . ($_MG_CONF['gallery_tn_size'] == 2 ? 'selected="selected"' : '') . '>' . $LANG_MG01['large'] . '</option>'; $gallery_tn_size_select .= '<option value="3"' . ($_MG_CONF['gallery_tn_size'] == 3 ? 'selected="selected"' : '') . '>' . $LANG_MG01['custom'] . '</option>'; $gallery_tn_size_select .= '<option value="4"' . ($_MG_CONF['gallery_tn_size'] == 4 ? 'selected="selected"' : '') . '>' . $LANG_MG01['square'] . '</option>'; $gallery_tn_size_select .= '</select>'; $gallery_tnheight_input = '<input type="text" size="3" name="tnheight" value="' . $_MG_CONF['gallery_tn_height'] . '" />'; $gallery_tnwidth_input = '<input type="text" size="3" name="tnwidth" value="' . $_MG_CONF['gallery_tn_width'] . '" />'; $mp3_select = '<select name="mp3_player">'; $mp3_select .= '<option value="0"' . ($_MG_CONF['mp3_player'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['windows_media_player'] . '</option>'; $mp3_select .= '<option value="1"' . ($_MG_CONF['mp3_player'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['quicktime'] . '</option>'; $mp3_select .= '<option value="2"' . ($_MG_CONF['mp3_player'] == 2 ? 'selected="selected"' : '') . '>' . $LANG_MG01['flashplayer'] . '</option>'; $mp3_select .= '</select>'; $flv_select = '<select name="use_flowplayer">'; $flv_select .= '<option value="0"' . ($_MG_CONF['use_flowplayer'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['mgflv'] . '</option>'; $flv_select .= '<option value="1"' . ($_MG_CONF['use_flowplayer'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['flowplayer'] . '</option>'; $flv_select .= '</select>'; $T->set_var(array('popupfromalbum_selected' => $_MG_CONF['popup_from_album'] ? ' checked="checked"' : '', 'autotag_caption_selected' => $_MG_CONF['autotag_caption'] ? ' checked="checked"' : '', 'up_dr_selected' => $_MG_CONF['up_display_rows_enabled'] ? ' checked="checked"' : '', 'up_dc_selected' => $_MG_CONF['up_display_columns_enabled'] ? ' checked="checked"' : '', 'up_mp3_selected' => $_MG_CONF['up_mp3_player_enabled'] ? ' checked="checked"' : '', 'up_playback_selected' => $_MG_CONF['up_av_playback_enabled'] ? ' checked="checked"' : '', 'up_tn_size_selected' => $_MG_CONF['up_thumbnail_size_enabled'] ? ' checked="checked"' : '', 'jh_selected' => $_MG_CONF['jhead_enabled'] ? ' checked="checked"' : '', 'jt_selected' => $_MG_CONF['jpegtran_enabled'] ? ' checked="checked"' : '', 'zip_selected' => $_MG_CONF['zip_enabled'] ? ' checked="checked"' : '', 'ffmpeg_selected' => $_MG_CONF['ffmpeg_enabled'] ? ' checked="checked"' : '', 'at_align_select' => $at_align_select, 'at_width' => $_MG_CONF['at_width'], 'at_height' => $_MG_CONF['at_height'], 'at_src_select' => $at_src_select, 'at_delay' => $_MG_CONF['at_delay'], 'flv_select' => $flv_select, 'search_playback_type' => $search_playback_type, 'search_columns' => $_MG_CONF['search_columns'], 'search_rows' => $_MG_CONF['search_rows'])); if ($_MG_CONF['up_display_rows_enabled'] == 1) { $T->set_var('up_dr_yes_checked', ' checked="checked"'); } else { $T->set_var('up_dr_no_checked', ' checked="checked"'); } if (ini_get('safe_mode') != 1 && $_MG_CONF['skip_file_find'] == 0) { // don't check in safe mode, the file_exists() will fail if (PHP_OS == "WINNT") { $binary = "/unzip.exe"; } else { $binary = "/unzip"; } clearstatcache(); if (file_exists($_MG_CONF['zip_path'] . $binary)) { // do nothing.. } else { clearstatcache(); $_MG_CONF['zip_path'] = '/usr/bin'; if (file_exists($_MG_CONF['zip_path'] . $binary)) { // do nothing.. } else { clearstatcache(); $_MG_CONF['zip_path'] = '/usr/local/bin'; if (file_exists($_MG_CONF['zip_path'] . $binary)) { // do nothing.. } else { clearstatcache(); $_MG_CONF['zip_path'] = '/usr/X11R6/bin'; if (file_exists($_MG_CONF['zip_path'] . $binary)) { // do nothing.. } } } } if (PHP_OS == "WINNT") { $binary = "/ffmpeg.exe"; } else { $binary = "/ffmpeg"; } clearstatcache(); if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) { // do nothing.. } else { clearstatcache(); $_MG_CONF['ffmpeg_path'] = '/usr/bin'; if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) { // do nothing.. } else { clearstatcache(); $_MG_CONF['ffmpeg_path'] = '/usr/local/bin'; if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) { // do nothing.. } else { clearstatcache(); $_MG_CONF['ffmpeg_path'] = '/usr/X11R6/bin'; if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) { // do nothing.. } } } } } $frames = new mgFrame(); $skins = array(); $skins = $frames->getFrames(); if (!isset($_MG_CONF['random_skin']) || $_MG_CONF['random_skin'] == '') { $_MG_CONF['random_skin'] = 'mgShadow'; } $skin_select = '<select name="skin">'; $rskin_select = '<select name="rskin">'; for ($i = 0; $i < count($skins); $i++) { $skin_select .= '<option value="' . $skins[$i]['dir'] . '"' . ($_MG_CONF['indexskin'] == $skins[$i]['dir'] ? ' selected="selected" ' : '') . '>' . $skins[$i]['name'] . '</option>'; $rskin_select .= '<option value="' . $skins[$i]['dir'] . '"' . ($_MG_CONF['random_skin'] == $skins[$i]['dir'] ? ' selected="selected" ' : '') . '>' . $skins[$i]['name'] . '</option>'; } $skin_select .= '</select>'; $rskin_select .= '</select>'; $themes = array(); $themes = MG_getThemes(); $theme_select = '<select name="theme">'; for ($i = 0; $i < count($themes); $i++) { $theme_select .= '<option value="' . $themes[$i] . '"' . ($_MG_CONF['indextheme'] == $themes[$i] ? ' selected="selected" ' : '') . '>' . $themes[$i] . '</option>'; } $theme_select .= '</select>'; require_once $_CONF['path_system'] . 'classes/navbar.class.php'; $navbar = new navbar(); $navbar->add_menuitem($LANG_MG01['general_options'], 'showhideMGAdminEditorDiv("general",0);return false;', true); $navbar->add_menuitem($LANG_MG01['display_options'], 'showhideMGAdminEditorDiv("display",1);return false;', true); $navbar->add_menuitem($LANG_MG01['batch_options'], 'showhideMGAdminEditorDiv("batch",2);return false;', true); $navbar->add_menuitem($LANG_MG01['up_overrides'], 'showhideMGAdminEditorDiv("userprefs",3);return false;', true); $navbar->add_menuitem($LANG_MG01['graphicspackage_prompt'], 'showhideMGAdminEditorDiv("graphics",4);return false;', true); $navbar->set_selected($LANG_MG01['general_options']); $T->set_var('navbar', $navbar->generate()); $T->set_var(array('no_javascript_warning' => $LANG04[150], 'lang_config_title' => $LANG_MG01['configuration_title'], 'lang_config_help' => $LANG_MG01['configuration_help'], 'lang_config_header' => $LANG_MG01['configuration_header'], 'lang_yes' => $LANG_MG01['yes'], 'lang_no' => $LANG_MG01['no'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'lang_album_columns' => $LANG_MG01['album_display_columns_prompt'], 'lang_album_colums_help' => $LANG_MG01['album_display_columns_help'], 'lang_album_rows' => $LANG_MG01['album_display_rows'], 'lang_subalbum_select' => $LANG_MG01['subalbum_select'], 'lang_loginrequired' => $LANG_MG01['loginrequired_prompt'], 'lang_loginrequired_help' => $LANG_MG01['loginrequired_help'], 'lang_anonymous_uploads' => $LANG_MG01['anonymous_uploads_prompt'], 'lang_anonymous_uploads_help' => $LANG_MG01['anonymous_uploads_help'], 'lang_comments' => $LANG_MG01['comments_prompt'], 'lang_comments_help' => $LANG_MG01['comments_help'], 'lang_graphicspackage' => $LANG_MG01['graphicspackage_prompt'], 'lang_graphicspackage_help' => $LANG_MG01['graphicspackage_help'], 'lang_gp_path' => $LANG_MG01['graphicspackage_path_prompt'], 'lang_gp_path_help' => $LANG_MG01['graphicspackage_path_help'], 'lang_userpref_options' => $LANG_MG01['up_overrides'], 'lang_display_rows_enabled' => $LANG_MG01['up_rows_override'], 'lang_display_columns_enabled' => $LANG_MG01['up_columns_override'], 'lang_mp3_player_enabled' => $LANG_MG01['up_mp3_override'], 'lang_av_playback_enabled' => $LANG_MG01['up_av_override'], 'lang_thumbnail_size_enabled' => $LANG_MG01['up_tn_override'], 'lang_album_skin' => $LANG_MG01['index_album_skin'], 'lang_display_rows' => $LANG_MG01['album_display_rows'], 'album_display_columns' => $_MG_CONF['album_display_columns'], 'album_display_rows' => $_MG_CONF['album_display_rows'], 'loginrequired' => $_MG_CONF['loginrequired'], 'anonymous_uploads' => $_MG_CONF['moderation'], 'graphicspackage' => $gp_select, 'graphicspackage_path' => $_MG_CONF['graphicspackage_path'], 'lang_displayblock' => $LANG_MG01['displayblock_prompt'], 'lang_displayblock_help' => $LANG_MG01['displayblock_help'], 'lang_jhead_enable' => $LANG_MG01['jhead_enable'], 'lang_jh_path' => $LANG_MG01['jhead_path'], 'lang_jpegtran_enable' => $LANG_MG01['jpegtran_enable'], 'lang_ffmpeg_enable' => $LANG_MG01['ffmpeg_enable'], 'lang_jt_path' => $LANG_MG01['jpegtran_path'], 'lang_zip_enable' => $LANG_MG01['zip_enable'], 'lang_zip_path' => $LANG_MG01['zip_path'], 'lang_tmp_path' => $LANG_MG01['tmp_path'], 'lang_ffmpeg_path' => $LANG_MG01['ffmpeg_path'], 'jhead_path' => $_MG_CONF['jhead_path'], 'jpegtran_path' => $_MG_CONF['jpegtran_path'], 'zip_path' => $_MG_CONF['zip_path'], 'tmp_path' => $_MG_CONF['tmp_path'], 'ftp_path' => $_MG_CONF['ftp_path'], 'ffmpeg_path' => $_MG_CONF['ffmpeg_path'], 'displayblock' => $block_select, 'dfidselect' => $dfid_select, 'rating_select' => $rating_select, 'wn_time_select' => $wn_time_select, 'custom_image_height' => $_MG_CONF['custom_image_height'], 'random_width' => $_MG_CONF['random_width'], 'random_skin' => $_MG_CONF['random_skin'], 'custom_image_width' => $_MG_CONF['custom_image_width'], 'refresh_rate' => $_MG_CONF['def_refresh_rate'], 'item_limit' => $_MG_CONF['def_item_limit'], 'time_limit' => $_MG_CONF['def_time_limit'], 'gallery_tn_size_select' => $gallery_tn_size_select, 'gallery_tnheight_input' => $gallery_tnheight_input, 'gallery_tnwidth_input' => $gallery_tnwidth_input, 'jpg_quality' => $_MG_CONF['jpg_quality'], 'tn_jpg_quality' => $_MG_CONF['tn_jpg_quality'], 'orig_jpg_quality' => $_MG_CONF['jpg_orig_quality'], 'truncate_breadcrumb' => $_MG_CONF['truncate_breadcrumb'], 'seperator' => $_MG_CONF['seperator'], 'mp3_select' => $mp3_select, 'skin_select' => $skin_select, 'rskin_select' => $rskin_select, 'theme_select' => $theme_select, 'postcard_retention' => $_MG_CONF['postcard_retention'], 'lang_wn_time' => $LANG_MG01['whatsnew_time'], 'lang_theme_select' => $LANG_MG01['index_theme'], 'lang_gallery_tn_size' => $LANG_MG01['gallery_tn_size'], 'lang_jpg_quality' => $LANG_MG01['jpg_quality'], 'lang_tn_jpg_quality' => $LANG_MG01['tn_jpg_quality'], 'lang_orig_jpg_quality' => $LANG_MG01['orig_jpg_quality'], 'lang_truncate_breadcrumb' => $LANG_MG01['truncate_breadcrumb'], 'lang_seperator' => $LANG_MG01['seperator'], 'lang_mp3_player' => $LANG_MG01['mp3_player'], 'lang_htmlallowed' => $LANG_MG01['htmlallowed'], 'lang_whatsnew' => $LANG_MG01['whatsnew'], 'lang_dfid' => $LANG_MG01['dfid'], 'lang_general_options' => $LANG_MG01['general_options'], 'lang_display_options' => $LANG_MG01['display_options'], 'lang_graphics_options' => $LANG_MG01['graphics_options'], 'lang_usage_tracking' => $LANG_MG01['usage_tracking'], 'lang_gallery_import' => $LANG_MG01['gallery_import'], 'lang_4images_import' => $LANG_MG01['fourimages_import'], 'lang_xppubwiz_install' => $LANG_MG01['xppubwizard_install'], 'lang_logviewer' => $LANG_MG01['log_viewer'], 'lang_preserve_filename' => $LANG_MG01['preserve_filename'], 'lang_discard_originals' => $LANG_MG01['discard_originals'], 'lang_custom_image_height' => $LANG_MG01['custom_image_height'], 'lang_custom_image_width' => $LANG_MG01['custom_image_width'], 'lang_verbose' => $LANG_MG01['verbose'], 'lang_dwnc' => $LANG_MG01['disable_wn_comments'], 'lang_emid' => $LANG_MG01['enable_mid'], 'lang_fip' => $LANG_MG01['full_in_popup'], 'lang_cmtbar' => $LANG_MG01['cmtbar'], 'lang_wn_length' => $LANG_MG01['wn_title_length'], 'lang_batch_options' => $LANG_MG01['batch_options'], 'lang_refresh_rate' => $LANG_MG01['refresh_rate'], 'lang_time_limit' => $LANG_MG01['time_limit'], 'lang_item_limit' => $LANG_MG01['item_limit'], 'lang_ftp_path' => $LANG_MG01['ftp_path'], 'lang_characters' => $LANG_MG01['characters'], 'lang_postcard_retention' => $LANG_MG01['postcard_retention'], 'lang_profile_hook' => $LANG_MG01['profile_hook'], 's_form_action' => $_MG_CONF['admin_url'] . 'cfgedit.php', 'rtl' => $LANG_DIRECTION == "rtl" ? "rtl" : "", 'lang_autotag_caption' => $LANG_MG01['autotag_caption'], 'lang_popup_from_album' => $LANG_MG01['popup_from_album'], 'lang_random_size' => $LANG_MG01['random_size'], 'lang_random_skin' => $LANG_MG01['random_skin'], 'lang_auto_tag_defaults' => $LANG_MG01['auto_tag_defaults'], 'lang_alignment' => $LANG_MG01['alignment'], 'lang_border' => $LANG_MG01['border'], 'lang_width' => $LANG_MG01['width'], 'lang_height' => $LANG_MG01['height'], 'lang_source' => $LANG_MG01['source'], 'lang_autoplay' => $LANG_MG01['autoplay'], 'lang_link_to_media' => $LANG_MG01['link_to_media'], 'lang_ss_delay' => $LANG_MG01['ss_delay'], 'lang_show_titles' => $LANG_MG01['show_titles'], 'lang_flv' => $LANG_MG01['flash_video_player'], 'lang_search_result_options' => $LANG_MG01['search_result_options'], 'lang_search_columns' => $LANG_MG01['search_columns'], 'lang_search_rows' => $LANG_MG01['search_rows'], 'lang_search_av_playback' => $LANG_MG01['search_av_playback'], 'lang_search_views' => $LANG_MG01['search_views'], 'lang_search_rating' => $LANG_MG01['search_rating'], 'lang_gallery_only' => $LANG_MG01['gallery_only'], 'lang_tnheight' => $LANG_MG01['tn_height'], 'lang_tnwidth' => $LANG_MG01['tn_width'], 'lang_index_all' => $LANG_MG01['index_all'], 'gltoken_name' => CSRF_TOKEN, 'gltoken' => SEC_createToken())); $T->parse('output', 'admin'); $retval .= $T->finish($T->get_var('output')); return $retval; }
/** * Creates the edit form * @param integer $id Optional ID, current record used if zero * @return string HTML for edit form */ public function Edit($eid = '', $rp_id = 0, $saveaction = '') { global $_CONF, $_EV_CONF, $_TABLES, $_USER, $LANG_EVLIST, $LANG_ADMIN, $_GROUPS, $LANG_ACCESS, $_SYSTEM; // If an eid is specified and this is an object, then read the // event data- UNLESS a repeat ID is given in which case we're // editing a repeat and already have the info we need. // This probably needs to change, since we should always read event // data during construction. if (!$this->isSubmitter) { // At least submit privilege required COM_404(); } elseif ($eid != '' && $rp_id == 0 && is_object($this)) { // If an id is passed in, then read that record if (!$this->Read($eid)) { return 'Invalid object ID'; } } elseif (isset($_POST['eid']) && !empty($_POST['eid'])) { // Returning to an existing form, probably due to errors $this->SetVars($_POST); // Make sure the current user has access to this event. if (!$this->hasAccess(3)) { COM_404(); } } $T = new Template($_CONF['path'] . 'plugins/evlist/templates/'); if ($_SYSTEM['disable_jquery_slimbox']) { $T->set_file('editor', 'editor.uikit.thtml'); } else { $T->set_file('editor', 'editor.thtml'); } // Basic tabs for editing both events and instances, show up on // all edit forms //$tabs = array('ev_info', 'ev_schedule', 'ev_location', 'ev_contact',); $tabs = array('ev_info', 'ev_location', 'ev_contact'); $rp_id = (int) $rp_id; if ($rp_id > 0) { // Make sure the current user has access to this event. if (!$this->hasAccess(3)) { COM_404(); } if ($saveaction == 'savefuturerepeat') { $alert_msg = EVLIST_alertMessage($LANG_EVLIST['editing_future'], 'warning'); } else { $alert_msg = EVLIST_alertMessage($LANG_EVLIST['editing_instance'], 'info'); } //$T->clear_var('contact_section'); $T->clear_var('category_section'); $T->clear_var('permissions_editor'); // Set the static calendar name for the edit form. Can't // change it for a single instance. $cal_name = DB_getItem($_TABLES['evlist_calendars'], 'cal_name', "cal_id='" . (int) $this->cal_id . "'"); $T->set_var(array('contact_section' => 'true', 'is_repeat' => 'true', 'cal_name' => $cal_name)); // Override our dates & times with those from the repeat. // $rp_id is passed when this is called from class evRepeat. // Maybe that should pass in the repeat's data instead to avoid // another DB lookup. An array of values could be used. $Rep = DB_fetchArray(DB_query("SELECT * \n FROM {$_TABLES['evlist_repeat']}\n WHERE rp_id='{$rp_id}'"), false); if ($Rep) { $this->date_start1 = $Rep['rp_date_start']; $this->date_end1 = $Rep['rp_date_end']; $this->time_start1 = $Rep['rp_time_start1']; $this->time_end1 = $Rep['rp_time_end1']; $this->time_start2 = $Rep['rp_time_start2']; $this->time_end2 = $Rep['rp_time_end2']; } } else { // Editing the main event record if ($this->id != '' && $this->recurring == 1) { $alert_msg = EVLIST_alertMessage($LANG_EVLIST['editing_series'], 'error'); } if ($this->isAdmin) { $tabs[] = 'ev_perms'; // Add permissions tab, event edit only $T->set_var('permissions_editor', 'true'); } $T->set_var(array('contact_section' => 'true', 'category_section' => 'true', 'upcoming_chk' => $this->show_upcoming ? EVCHECKED : '')); } $action_url = EVLIST_URL . '/event.php'; $delaction = 'delevent'; if (isset($_GET['from']) && $_GET['from'] == 'admin') { $cancel_url = EVLIST_ADMIN_URL . '/index.php'; } else { $cancel_url = EVLIST_URL . '/index.php'; } switch ($saveaction) { case 'saverepeat': case 'savefuturerepeat': case 'saveevent': break; case 'moderate': // Approving a submission $saveaction = 'approve'; $delaction = 'disapprove'; $action_url = EVLIST_ADMIN_URL . '/index.php'; $cancel_url = $_CONF['site_admin_url'] . '/moderation.php'; break; default: $saveaction = 'saveevent'; break; } $retval = ''; //$recinterval = ''; $recweekday = ''; $ownerusername = DB_getItem($_TABLES['users'], 'username', "uid='{$this->owner_id}'"); $retval .= COM_startBlock($LANG_EVLIST['event_editor']); $summary = $this->Detail->summary; $full_description = $this->Detail->full_description; $location = $this->Detail->location; if (($this->isAdmin || $_EV_CONF['allow_html'] == '1' && $_USER['uid'] > 1) && $A['postmode'] == 'html') { $postmode = '2'; //html } else { $postmode = '1'; //plaintext $summary = htmlspecialchars(COM_undoClickableLinks(COM_undoSpecialChars($this->Detail->summary))); $full_description = htmlspecialchars(COM_undoClickableLinks(COM_undoSpecialChars($this->Detail->full_description))); $location = htmlspecialchars(COM_undoClickableLinks(COM_undoSpecialChars($this->Detail->location))); } $starthour2 = ''; $startminute2 = ''; $endhour2 = ''; $endminute2 = ''; if ($this->date_end1 == '' || $this->date_end1 == '0000-00-00') { $this->date_end1 = $this->date_start1; } if ($this->date_start1 != '' && $this->date_start1 != '0000-00-00') { list($startmonth1, $startday1, $startyear1, $starthour1, $startminute1) = $this->DateParts($this->date_start1, $this->time_start1); } else { list($startmonth1, $startday1, $startyear1, $starthour1, $startminute1) = $this->DateParts(date('Y-m-d', time()), date('H:i:s', time())); } // The end date can't be before the start date if ($this->date_end1 >= $this->date_start1) { list($endmonth1, $endday1, $endyear1, $endhour1, $endminute1) = $this->DateParts($this->date_end1, $this->time_end1); $days_interval = Date_Calc::dateDiff($endday1, $endmonth1, $endyear1, $startday1, $startmonth1, $startyear1); } else { $days_interval = 0; $endmonth1 = $startmonth1; $endday1 = $startday1; $endyear1 = $startyear1; $endhour1 = $starthour1; $endminute1 = $startminute1; } if ($this->recurring != '1') { $T->set_var(array('recurring_show' => ' style="display:none;"', 'format_opt' => '0')); //for ($i = 1; $i <= 6; $i++) { // $T->set_var('format' . $i . 'show', ' style="display:none;"'); //} } else { $option = empty($this->rec_data['type']) ? '0' : (int) $this->rec_data['type']; $T->set_var(array('recurring_show' => '', 'recurring_checked' => EVCHECKED, 'format_opt' => $option)); } if (isset($this->rec_data['stop']) && !empty($this->rec_data['stop'])) { $T->set_var(array('stopdate' => $this->rec_data['stop'], 'd_stopdate' => EVLIST_formattedDate($this->rec_data['stop']))); } if (!empty($this->rec_data['skip'])) { $T->set_var("skipnext{$this->rec_data['skip']}_checked", EVCHECKED); } if (!empty($this->rec_data['freq'])) { $freq = (int) $this->rec_data['freq']; if ($freq < 1) { $freq = 1; } } else { $freq = 1; } $T->set_var(array('freq_text' => $LANG_EVLIST['rec_periods'][$this->rec_data['type']] . '(s)', 'rec_freq' => $freq)); foreach ($LANG_EVLIST['rec_intervals'] as $key => $str) { $T->set_var('dom_int_txt_' . $key, $str); if (is_array($this->rec_data['interval'])) { if (in_array($key, $this->rec_data['interval'])) { $T->set_var('dom_int_chk_' . $key, EVCHECKED); } } } // Set up the recurring options needed for the current event switch ($option) { case 0: break; case EV_RECUR_MONTHLY: if (is_array($this->rec_data['listdays'])) { foreach ($this->rec_data['listdays'] as $mday) { $T->set_var('mdchk' . $mday, EVCHECKED); } } break; case EV_RECUR_WEEKLY: $T->set_var('listdays_val', COM_stripslashes($rec_data[0])); if (is_array($this->rec_data['listdays']) && !empty($this->rec_data['listdays'])) { foreach ($this->rec_data['listdays'] as $day) { $day = (int) $day; if ($day > 0 && $day < 8) { $T->set_var('daychk' . $day, EVCHECKED); } } } break; case EV_RECUR_DOM: $recweekday = $this->rec_data['weekday']; break; case EV_RECUR_DATES: $T->set_var(array('stopshow' => 'style="display:none;"', 'custom_val' => implode(',', $this->rec_data['custom']))); break; } $start1 = EVLIST_TimeSelect('start1', $this->time_start1); $start2 = EVLIST_TimeSelect('start2', $this->time_start2); $end1 = EVLIST_TimeSelect('end1', $this->time_end1); $end2 = EVLIST_TimeSelect('end2', $this->time_end2); $cal_select = COM_optionList($_TABLES['evlist_calendars'], 'cal_id,cal_name', $this->cal_id, 1, 'cal_status = 1 ' . COM_getPermSQL('AND', 0, 2)); USES_class_navbar(); $navbar = new navbar(); $cnt = 0; foreach ($tabs as $id) { $navbar->add_menuitem($LANG_EVLIST[$id], 'showhideEventDiv("' . $id . '",' . $cnt . ');return false;', true); $cnt++; } $navbar->set_selected($LANG_EVLIST['ev_info']); if ($this->AdminMode) { $action_url .= '?admin=true'; } $T->set_var(array('action_url' => $action_url, 'navbar' => $navbar->generate(), 'alert_msg' => $alert_msg, 'cancel_url' => $cancel_url, 'eid' => $this->id, 'rp_id' => $rp_id, 'title' => $this->Detail->title, 'summary' => $summary, 'description' => $full_description, 'location' => $location, 'status_checked' => $this->status == 1 ? EVCHECKED : '', 'url' => $this->Detail->url, 'street' => $this->Detail->street, 'city' => $this->Detail->city, 'province' => $this->Detail->province, 'country' => $this->Detail->country, 'postal' => $this->Detail->postal, 'contact' => $this->Detail->contact, 'email' => $this->Detail->email, 'phone' => $this->Detail->phone, 'startdate1' => $this->date_start1, 'enddate1' => $this->date_end1, 'd_startdate1' => EVLIST_formattedDate($this->date_start1), 'd_enddate1' => EVLIST_formattedDate($this->date_end1), 'start_hour_options1' => $start1['hour'], 'start_minute_options1' => $start1['minute'], 'startdate1_ampm' => $start1['ampm'], 'end_hour_options1' => $end1['hour'], 'end_minute_options1' => $end1['minute'], 'enddate1_ampm' => $end1['ampm'], 'start_hour_options2' => $start2['hour'], 'start_minute_options2' => $start2['minute'], 'startdate2_ampm' => $start2['ampm'], 'end_hour_options2' => $end2['hour'], 'end_minute_options2' => $end2['minute'], 'enddate2_ampm' => $end2['ampm'], 'recurring_format_options' => EVLIST_GetOptions($LANG_EVLIST['rec_formats'], $option), 'recurring_weekday_options' => EVLIST_GetOptions(Date_Calc::getWeekDays(), $recweekday, 1), 'dailystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['day_by_date'], ''), 'monthlystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year_and_month'], $LANG_EVLIST['if_any']), 'yearlystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year'], $LANG_EVLIST['if_any']), 'listdays_label' => sprintf($LANG_EVLIST['custom_label'], $LANG_EVLIST['days_of_week'], ''), 'listdaystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['date_l'], $LANG_EVLIST['if_any']), 'intervalstop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year_and_month'], $LANG_EVLIST['if_any']), 'custom_label' => sprintf($LANG_EVLIST['custom_label'], $LANG_EVLIST['dates'], ''), 'datestart_note' => $LANG_EVLIST['datestart_note'], 'src' => isset($_GET['src']) && $_GET['src'] == 'a' ? '1' : '0', 'rem_status_checked' => $this->enable_reminders == 1 ? EVCHECKED : '', 'del_button' => $this->id == '' ? '' : 'true', 'saveaction' => $saveaction, 'delaction' => $delaction, 'owner_id' => $this->owner_id, 'enable_reminders' => $_EV_CONF['enable_reminders'], 'iso_lang' => EVLIST_getIsoLang(), 'hour_mode' => $_CONF['hour_mode'], 'days_interval' => $days_interval, 'display_format' => $_CONF['shortdate'], 'ts_start' => strtotime($this->date_start1), 'ts_end' => strtotime($this->date_end1), 'cal_select' => $cal_select, 'contactlink_chk' => $this->options['contactlink'] == 1 ? EVCHECKED : '', 'lat' => $this->Detail->lat, 'lng' => $this->Detail->lng, 'perm_msg' => $LANG_ACCESS['permmsg'], 'last' => $LANG_EVLIST['rec_intervals'][5], 'doc_url' => EVLIST_getDocURL('event.html'), 'mootools' => $_SYSTEM['disable_mootools'] ? '' : 'true')); if ($_EV_CONF['enable_rsvp']) { USES_evlist_class_tickettype(); $TickTypes = evTicketType::GetTicketTypes(); //$T->set_block('editor', 'Tickets', 'tTypes'); $tick_opts = ''; foreach ($TickTypes as $tick_id => $tick_obj) { // Check enabled tickets. Ticket type 1 enabled by default if (isset($this->options['tickets'][$tick_id]) || $tick_id == 1) { $checked = 'checked="checked"'; $fee = (double) $this->options['tickets'][$tick_id]['fee']; } else { $checked = ''; $fee = 0; } $tick_opts .= '<tr><td><input name="tickets[' . $tick_id . ']" type="checkbox" ' . $checked . ' value="' . $tick_id . '" /></td>' . '<td>' . $tick_obj->description . '</td>' . '<td><input type="text" name="tick_fees[' . $tick_id . ']" value="' . $fee . '" size="8" /></td></tr>' . LB; /*$T->set_var(array( 'tick_id' => $tic['id'], 'tick_desc' => $tic['description'], 'tick_fee' => $fee, 'tick_enabled' => $enabled ? 'checked="checked"' : '', ) ) ; //$T->parse('tTypes', 'Tickets', true);*/ } if ($_EV_CONF['rsvp_print'] > 0) { $rsvp_print_chk = 'rsvp_print_chk' . $this->options['rsvp_print']; $rsvp_print = 'true'; } else { $rsvp_print = ''; $rsvp_print_chk = 'no_rsvp_print'; } $T->set_var(array('enable_rsvp' => 'true', 'reg_chk' . $this->options['use_rsvp'] => EVCHECKED, 'rsvp_wait_chk' => $this->options['rsvp_waitlist'] == 1 ? EVCHECKED : '', 'max_rsvp' => $this->options['max_rsvp'], 'max_user_rsvp' => $this->options['max_user_rsvp'], 'rsvp_cutoff' => $this->options['rsvp_cutoff'], 'use_rsvp' => $this->options['use_rsvp'], 'rsvp_waitlist' => $this->options['rsvp_waitlist'], 'tick_opts' => $tick_opts, 'rsvp_print' => $rsvp_print, $rsvp_print_chk => 'checked="checked"')); } // if rsvp_enabled // Split & All-Day settings if ($this->allday == 1) { // allday, can't be split, no times $T->set_var(array('starttime1_show' => 'style="display:none;"', 'endtime1_show' => 'style="display:none;"', 'datetime2_show' => 'style="display:none;"', 'allday_checked' => EVCHECKED, 'split_checked' => '', 'split_show' => 'style="display:none;"')); } elseif ($this->split == '1') { $T->set_var(array('split_checked' => EVCHECKED, 'allday_checked' => '', 'allday_show' => 'style="display:none"')); } else { $T->set_var(array('datetime2_show' => 'style="display:none;"')); } // Category fields. If $_POST['categories'] is set, then this is a // form re-entry due to an error saving. Populate checkboxes from the // submitted form. Include the user-added category, if any. // If not from a form re-entry, get the checked categories from the // evlist_lookup table. if ($_EV_CONF['enable_categories'] == '1') { $cresult = DB_query("SELECT tc.id, tc.name\n FROM {$_TABLES['evlist_categories']} tc \n WHERE tc.status='1' ORDER BY tc.name"); while ($A = DB_fetchArray($cresult, false)) { if (isset($_POST['categories']) && is_array($_POST['categories'])) { // Coming from a form re-entry $chk = in_array($A['id'], $_POST['categories']) ? EVCHECKED : ''; } else { $chk = in_array($A['id'], $this->categories) ? EVCHECKED : ''; } $catlist .= '<input type="checkbox" name="categories[]" ' . 'value="' . $A['id'] . '" ' . $chk . ' />' . ' ' . $A['name'] . ' '; } $T->set_var('catlist', $catlist); if (isset($_POST['newcat'])) { $T->set_var('newcat', $_POST['newcat']); } if ($_USER['uid'] > 1 && $rp_id == 0) { $T->set_var('category_section', 'true'); $T->set_var('add_cat_input', 'true'); } } // Enable the post mode selector if we allow HTML and the user is // logged in, or if this user is an authorized editor if ($this->isAdmin || $_EV_CONF['allow_html'] == '1' && $_USER['uid'] > 1) { $T->set_var(array('postmode_options' => EVLIST_GetOptions($LANG_EVLIST['postmodes'], $postmode), 'allowed_html' => COM_allowedHTML('evlist.submit'))); if ($postmode == 'plaintext') { // plaintext, hide postmode selector $T->set_var('postmode_show', ' style="display:none"'); } $T->parse('event_postmode', 'edit_postmode'); } if ($this->isAdmin) { $T->set_var(array('owner_username' => COM_stripslashes($ownerusername), 'owner_dropdown' => COM_optionList($_TABLES['users'], 'uid,username', $this->owner_id, 1, "uid <> 1"), 'group_dropdown' => SEC_getGroupDropdown($this->group_id, 3))); if ($rp_id == 0) { // can only change permissions on main event $T->set_var('permissions_editor', SEC_getPermissionsHTML($this->perm_owner, $this->perm_group, $this->perm_members, $this->perm_anon)); } } else { $T->set_var('group_id', $this->group_id); } // Latitude & Longitude part of location, if Location plugin is used if ($_EV_CONF['use_locator']) { $T->set_var(array('use_locator' => 'true', 'loc_selection' => GEO_optionList())); } $T->parse('output', 'editor'); $retval .= $T->finish($T->get_var('output')); $retval .= COM_endBlock(); return $retval; }
} } else { $curtopic = ''; $sql = "select tid,sid,title,date,comments from {$_TABLES['stories']}"; $countsql = DB_query("SELECT COUNT(*) FROM {$_TABLES['stories']}"); } list($maxrows) = DB_fetchArray($countsql); $numpages = ceil($maxrows / $show); $offset = ($page - 1) * $show; $sql .= " ORDER BY sid DESC LIMIT {$offset}, {$show}"; $result = DB_query($sql); $numrows = DB_numRows($result); $selectedForum = isset($_POST['selforum']) ? COM_applyFilter($_POST['selforum']) : ''; $p->set_var('action_url', $_CONF['site_admin_url'] . '/plugins/forum/migrate.php'); $p->set_var('filter_topic_selection', _ff_migrate_topicsList($curtopic)); $p->set_var('select_filter_options', COM_optionList($_TABLES['ff_forums'], "forum_id,forum_name", $selectedForum)); $p->set_var('LANG_migrate', $LANG_GF01['MIGRATE_NOW']); $p->set_var('LANG_filterlist', $LANG_GF01['FILTERLIST']); $p->set_var('LANG_selectforum', $LANG_GF01['SELECTFORUM']); $p->set_var('LANG_deleteafter', $LANG_GF01['DELETEAFTER']); $p->set_var('LANG_all', $LANG_GF01['ALL']); $p->set_var('LANG_topic', $LANG_GF01['TOPIC']); $p->set_var('LANG_title', $LANG_GF01['TITLE']); $p->set_var('LANG_date', $LANG_GF01['DATE']); $p->set_var('LANG_comments', $LANG_GF01['COMMENTS']); if ($numrows > 0) { $base_url = $_CONF['site_admin_url'] . '/plugins/forum/migrate.php?seltopic=' . $curtopic; for ($i = 0; $i < $numrows; $i++) { list($topic, $sid, $story, $date, $comments) = DB_fetchArray($result); $p->set_var('sid', $sid); $p->set_var('topic', $topic);
/** * Shows event editor * * @param string $action action we are performing: 'edit', 'clone' or 'moderate' * @param array $A array holding the event's details * @param string $msg an optional error message to display * @return string HTML for event editor or error message * */ function CALENDAR_edit($action, $A, $msg = '') { global $_CONF, $_USER, $_GROUPS, $_TABLES, $_USER, $_CA_CONF, $LANG_CAL_1, $LANG_CAL_ADMIN, $LANG10, $LANG12, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE; USES_lib_admin(); $retval = ''; $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/calendar/index.php', 'text' => $LANG_CAL_ADMIN[40]), array('url' => $_CONF['site_admin_url'] . '/moderation.php', 'text' => $LANG_ADMIN['submissions']), array('url' => $_CONF['site_admin_url'] . '/plugins/calendar/index.php?batchadmin=x', 'text' => $LANG_CAL_ADMIN[38]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home'])); switch ($action) { case 'edit': case 'clone': $blocktitle = $LANG_CAL_ADMIN[1]; // Event Editor $saveoption = $LANG_ADMIN['save']; // Save break; case 'moderate': $blocktitle = $LANG_CAL_ADMIN[37]; // Moderate Event $saveoption = $LANG_ADMIN['moderate']; // Save & Approve break; } if (!empty($msg)) { $retval .= COM_showMessageText($msg, $LANG_CAL_ADMIN[2], true); } $event_templates = new Template($_CONF['path'] . 'plugins/calendar/templates/admin'); $event_templates->set_file('editor', 'eventeditor.thtml'); $event_templates->set_var('lang_allowed_html', COM_allowedHTML(SEC_getUserPermissions(), false, 'calendar', 'description')); $event_templates->set_var('lang_postmode', $LANG_CAL_ADMIN[3]); if (!isset($A['perm_owner'])) { $A['perm_owner'][0] = "0"; } if (!isset($A['perm_group'])) { $A['perm_group'][0] = "0"; } if (!isset($A['perm_members'])) { $A['perm_members'][0] = "0"; } if (!isset($A['perm_anon'])) { $A['perm_anon'][0] = "0"; } if ($action != 'moderate' and !empty($A['eid'])) { // Get what level of access user has to this object $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); if ($access == 0 or $access == 2) { // Uh, oh! User doesn't have access to this object $retval .= COM_showMessageText($LANG_CAL_ADMIN[17], $LANG_ACCESS['accessdenied'], true); COM_accessLog("User {$_USER['username']} tried to illegally submit or edit event {$eid}."); return $retval; } } else { if (!isset($A['owner_id']) || $A['owner_id'] == '') { $A['owner_id'] = $_USER['uid']; } if (isset($_GROUPS['Calendar Admin'])) { $A['group_id'] = $_GROUPS['Calendar Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('calendar.edit'); } SEC_setDefaultPermissions($A, $_CA_CONF['default_permissions']); $access = 3; } if ($action == 'moderate') { $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', 'plaintext')); } else { if (!isset($A['postmode'])) { $A['postmode'] = $_CONF['postmode']; } $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', $A['postmode'])); } $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= ADMIN_createMenu($menu_arr, $LANG_CAL_ADMIN[41], plugin_geticon_calendar()); if (!empty($A['eid'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s/>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $event_templates->set_var('lang_delete_confirm', $MESSAGE[76]); $event_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $event_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); if ($action == 'moderate') { $event_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"/>'); } } else { // new event $A['eid'] = COM_makesid(); $A['status'] = 1; $A['title'] = ''; $A['description'] = ''; $A['url'] = ''; $A['hits'] = 0; // in case a start date/time has been passed from the calendar, // pick it up for the end date/time if (empty($A['dateend'])) { $A['dateend'] = $A['datestart']; } if (empty($A['timeend'])) { $A['timeend'] = $A['timestart']; } $A['event_type'] = ''; $A['location'] = ''; $A['address1'] = ''; $A['address2'] = ''; $A['city'] = ''; $A['state'] = ''; $A['zipcode'] = ''; $A['allday'] = 0; } $event_templates->set_var('event_id', $A['eid']); $event_templates->set_var('lang_eventtitle', $LANG_ADMIN['title']); $A['title'] = str_replace('{', '{', $A['title']); $A['title'] = str_replace('}', '}', $A['title']); $A['title'] = str_replace('"', '"', $A['title']); $event_templates->set_var('event_title', $A['title']); $event_templates->set_var('lang_eventtype', $LANG_CAL_1[37]); $event_templates->set_var('lang_editeventtypes', $LANG12[50]); $event_templates->set_var('type_options', CALENDAR_eventTypeList($A['event_type'])); $event_templates->set_var('status_checked', $A['status'] == 1 ? ' checked="checked"' : ''); $event_templates->set_var('lang_eventurl', $LANG_CAL_ADMIN[4]); $event_templates->set_var('max_url_length', 255); $event_templates->set_var('event_url', $A['url']); $event_templates->set_var('lang_includehttp', $LANG_CAL_ADMIN[9]); $event_templates->set_var('lang_eventstartdate', $LANG_CAL_ADMIN[5]); //$event_templates->set_var('event_startdate', $A['datestart']); $event_templates->set_var('lang_starttime', $LANG_CAL_1[30]); // Combine date/time for easier manipulation $A['datestart'] = trim($A['datestart'] . ' ' . $A['timestart']); if (empty($A['datestart'])) { $start_stamp = time(); } else { $start_stamp = strtotime($A['datestart']); } $A['dateend'] = trim($A['dateend'] . ' ' . $A['timeend']); if (empty($A['dateend'])) { $end_stamp = time(); } else { $end_stamp = strtotime($A['dateend']); } $start_month = date('m', $start_stamp); $start_day = date('d', $start_stamp); $start_year = date('Y', $start_stamp); $end_month = date('m', $end_stamp); $end_day = date('d', $end_stamp); $end_year = date('Y', $end_stamp); $start_hour = date('H', $start_stamp); $start_minute = intval(date('i', $start_stamp) / 15) * 15; if ($start_hour >= 12) { $startampm = 'pm'; } else { $startampm = 'am'; } $start_hour_24 = $start_hour % 24; if ($start_hour > 12) { $start_hour = $start_hour - 12; } else { if ($start_hour == 0) { $start_hour = 12; } } $end_hour = date('H', $end_stamp); $end_minute = intval(date('i', $end_stamp) / 15) * 15; if ($end_hour >= 12) { $endampm = 'pm'; } else { $endampm = 'am'; } $end_hour_24 = $end_hour % 24; if ($end_hour > 12) { $end_hour = $end_hour - 12; } else { if ($end_hour == 0) { $end_hour = 12; } } $month_options = COM_getMonthFormOptions($start_month); $event_templates->set_var('startmonth_options', $month_options); $month_options = COM_getMonthFormOptions($end_month); $event_templates->set_var('endmonth_options', $month_options); $day_options = COM_getDayFormOptions($start_day); $event_templates->set_var('startday_options', $day_options); $day_options = COM_getDayFormOptions($end_day); $event_templates->set_var('endday_options', $day_options); $year_options = COM_getYearFormOptions($start_year); $event_templates->set_var('startyear_options', $year_options); $year_options = COM_getYearFormOptions($end_year); $event_templates->set_var('endyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($start_hour_24, 24); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour_24, 24); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 24); } else { $hour_options = COM_getHourFormOptions($start_hour); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 12); } $event_templates->set_var('startampm_selection', CALENDAR_getAmPmFormSelection('start_ampm', $startampm, 'update_ampm()')); $event_templates->set_var('endampm_selection', CALENDAR_getAmPmFormSelection('end_ampm', $endampm)); $event_templates->set_var('startminute_options', COM_getMinuteFormOptions($start_minute, 15)); $event_templates->set_var('endminute_options', COM_getMinuteFormOptions($end_minute, 15)); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_eventenddate', $LANG_CAL_ADMIN[6]); $event_templates->set_var('event_enddate', $A['dateend']); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_endtime', $LANG_CAL_1[29]); $event_templates->set_var('lang_alldayevent', $LANG_CAL_1[31]); if ($A['allday'] == 1) { $event_templates->set_var('allday_checked', 'checked="checked"'); } $event_templates->set_var('lang_location', $LANG12[51]); $event_templates->set_var('event_location', $A['location']); $event_templates->set_var('lang_addressline1', $LANG12[44]); $event_templates->set_var('event_address1', $A['address1']); $event_templates->set_var('lang_addressline2', $LANG12[45]); $event_templates->set_var('event_address2', $A['address2']); $event_templates->set_var('lang_city', $LANG12[46]); $event_templates->set_var('event_city', $A['city']); $event_templates->set_var('lang_state', $LANG12[47]); $event_templates->set_var('state_options', ''); $event_templates->set_var('event_state', $A['state']); $event_templates->set_var('lang_zipcode', $LANG12[48]); $event_templates->set_var('event_zipcode', $A['zipcode']); $event_templates->set_var('lang_eventlocation', $LANG_CAL_ADMIN[7]); $event_templates->set_var('event_location', $A['location']); $event_templates->set_var('lang_eventdescription', $LANG_CAL_ADMIN[8]); $event_templates->set_var('event_description', $A['description']); $event_templates->set_var('lang_hits', $LANG10[30]); $event_templates->set_var('hits', COM_numberFormat($A['hits'])); $event_templates->set_var('lang_save', $saveoption); $event_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); // user access info $event_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $event_templates->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($A['owner_id']); $event_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}")); $event_templates->set_var('owner_name', $ownername); $event_templates->set_var('owner', $ownername); $event_templates->set_var('owner_id', $A['owner_id']); $event_templates->set_var('lang_group', $LANG_ACCESS['group']); $event_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $event_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $event_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']); $event_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $event_templates->set_var('gltoken_name', CSRF_TOKEN); $event_templates->set_var('gltoken', SEC_createToken()); $event_templates->parse('output', 'editor'); $retval .= $event_templates->finish($event_templates->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }