function showtopic($showtopic, $mode = '', $onetwo = 1, $page = 1) { global $CONF_FORUM, $_CONF, $_TABLES, $_USER, $LANG_GF01, $LANG_GF02, $LANG_GF09; global $highlight; global $oldPost; $oldPost = 0; //$mytimer = new timerobject(); //$mytimer->setPercision(2); //$mytimer->startTimer(); //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time1: $intervalTime"); if (!class_exists('StringParser')) { require_once $CONF_FORUM['path_include'] . 'bbcode/stringparser_bbcode.class.php'; } $topictemplate = COM_newTemplate(CTL_plugin_templatePath('forum')); $topictemplate->set_file(array('topictemplate' => 'topic.thtml', 'forum_icons' => 'forum_icons.thtml', 'forum_links' => 'forum_links.thtml')); $topictemplate->set_block('topictemplate', 'block_user_information'); $topictemplate->set_block('topictemplate', 'block_anon_user_information'); $topictemplate->set_block('topictemplate', 'location'); $topictemplate->set_block('topictemplate', 'ip_address'); $topictemplate->set_block('topictemplate', 'anon_ip_address'); $topictemplate->set_block('topictemplate', 'user_signature'); $topictemplate->set_block('topictemplate', 'mod_functions'); $blocks = array('block_user_name', 'block_anon_user_name', 'block_user_information', 'block_anon_user_information', 'user_signature', 'mod_functions'); foreach ($blocks as $block) { $topictemplate->set_block('topictemplate', $block); } $topictemplate->set_block('forum_icons', 'topiclocked_icon'); $topictemplate->set_block('forum_icons', 'mood_icon'); $blocks = array('profile_link', 'pm_link', 'email_link', 'website_link', 'quotetopic_link', 'edittopic_link'); foreach ($blocks as $block) { $topictemplate->set_block('forum_links', $block); } // if preview, only stripslashes is gpc=on, else assume from db so strip if ($mode == 'preview') { $showtopic['subject'] = COM_stripslashes($showtopic['subject']); } else { $showtopic['subject'] = stripslashes($showtopic['subject']); } $min_height = 50; // Base minimum height of topic - will increase if avatar or sig is used $date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']); $sql = "SELECT u.*, ui.location FROM {$_TABLES['users']} u, {$_TABLES['userinfo']} ui \n \t\tWHERE u.uid = ui.uid \n \t\tAND u.uid = '{$showtopic['uid']}'"; $userQuery = DB_query($sql); if ($showtopic['uid'] > 1 and DB_numRows($userQuery) == 1) { $userarray = DB_fetchArray($userQuery); $username = COM_getDisplayName($showtopic['uid']); $userlink = "<a href=\"{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}\" "; $userlink .= "class=\"authorname {$onetwo}\"><b>{$username}</b></a>"; $uservalid = true; $postcount = DB_query("SELECT * FROM {$_TABLES['forum_topic']} WHERE uid='{$showtopic['uid']}'"); $posts = DB_numRows($postcount); // STARS CODE if (SEC_inGroup(1, $showtopic['uid'])) { $user_level = showrank(7, $LANG_GF01['admin']); $user_levelname = $LANG_GF01['admin']; } else { if (forum_modPermission($showtopic['forum'], $showtopic['uid'])) { $user_level = showrank(6, $LANG_GF01['moderator']); $user_levelname = $LANG_GF01['moderator']; } else { if ($posts < $CONF_FORUM['level2']) { $user_level = showrank(1, $CONF_FORUM['level1name']); $user_levelname = $CONF_FORUM['level1name']; } elseif ($posts >= $CONF_FORUM['level2'] && $posts < $CONF_FORUM['level3']) { $user_level = showrank(2, $CONF_FORUM['level2name']); $user_levelname = $CONF_FORUM['level2name']; } elseif ($posts >= $CONF_FORUM['level3'] && $posts < $CONF_FORUM['level4']) { $user_level = showrank(3, $CONF_FORUM['level3name']); $user_levelname = $CONF_FORUM['level3name']; } elseif ($posts >= $CONF_FORUM['level4'] && $posts < $CONF_FORUM['level5']) { $user_level = showrank(4, $CONF_FORUM['level4name']); $user_levelname = $CONF_FORUM['level4name']; } elseif ($posts > $CONF_FORUM['level5']) { $user_level = showrank(5, $CONF_FORUM['level5name']); $user_levelname = $CONF_FORUM['level5name']; } } } // Still allow photo to be showen for users if ($showtopic['uid'] > 1 and ($userarray['photo'] != "" or !empty($_CONF['default_photo']))) { $avatar = USER_getPhoto($showtopic['uid'], '', '', $CONF_FORUM['avatar_width']); $min_height = $min_height + 50; } else { $avatar = ''; } $regdate = $LANG_GF01['REGISTERED'] . ': ' . strftime($_CONF['shortdate'], strtotime($userarray['regdate'])) . '<br' . XHTML . '>'; $numposts = $LANG_GF01['POSTS'] . ': ' . $posts; if (DB_count($_TABLES['sessions'], 'uid', $showtopic['uid']) > 0 and DB_getItem($_TABLES['userprefs'], 'showonline', "uid={$showtopic['uid']}") == 1) { $avatar .= '<br' . XHTML . '>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['ONLINE']; } else { $avatar .= '<br' . XHTML . '>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['OFFLINE']; } if ($userarray['sig'] != '') { $sig = $userarray['sig']; $min_height = $min_height + 30; } else { $sig = ''; } } else { $uservalid = false; $userlink = urldecode($showtopic['name']); } if ($CONF_FORUM['show_moods'] && $showtopic['mood'] != "") { $topictemplate->set_var('moodicon', gf_getImage($showtopic['mood'], 'moods')); $topictemplate->set_var('moodicontext', $showtopic['mood']); $topictemplate->parse('mood_icon', 'mood_icon'); $min_height = $min_height + 30; } else { $topictemplate->set_var('mood_icon', ''); } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time3: $intervalTime"); // Handle Pre ver 2.5 quoting and New Line Formatting - consider adding this to a migrate function if ($CONF_FORUM['pre2.5_mode']) { // try to determine if we have an old post... if (strstr($showtopic['comment'], '<pre class="forumCode">') !== false) { $oldPost = 1; } if (strstr($showtopic['comment'], "[code]<code>") !== false) { $oldPost = 1; } if (strstr($showtopic['comment'], "<pre>") !== false) { $oldPost = 1; } if (stristr($showtopic['comment'], '[code') == false || stristr($showtopic['comment'], '[code]<code>') == true) { if (strstr($showtopic['comment'], "<pre>") !== false) { $oldPost = 1; } $showtopic['comment'] = str_replace('<pre>', '[code]', $showtopic['comment']); $showtopic['comment'] = str_replace('</pre>', '[/code]', $showtopic['comment']); } $showtopic['comment'] = str_ireplace("[code]<code>", '[code]', $showtopic['comment']); $showtopic['comment'] = str_ireplace("</code>[/code]", '[/code]', $showtopic['comment']); $showtopic['comment'] = str_replace(array("<br />\r\n", "<br />\n\r", "<br />\r", "<br />\n", "<br>\r\n", "<br>\n\r", "<br>\r", "<br>\n"), '<br' . XHTML . '>', $showtopic['comment']); $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=\\s(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']); /* Reformat code blocks - version 2.3.3 and prior */ $showtopic['comment'] = str_replace('<pre class="forumCode">', '[code]', $showtopic['comment']); $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']); if ($oldPost) { if (strstr($showtopic['comment'], "\\'") !== false) { $showtopic['comment'] = stripslashes($showtopic['comment']); } } } $showtopic['comment'] = gf_formatTextBlock($showtopic['comment'], $showtopic['postmode'], $mode); $showtopic['subject'] = gf_formatTextBlock($showtopic['subject'], 'text', $mode); if ($CONF_FORUM['show_subject_length'] > 0 and strlen($showtopic['subject']) > $CONF_FORUM['show_subject_length']) { $showtopic['subject'] = COM_truncate("{$showtopic['subject']}", $CONF_FORUM['show_subject_length'], '...'); } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time2: $intervalTime"); if ($mode != 'preview' && $uservalid && !COM_isAnonUser() && $_USER['uid'] == $showtopic['uid']) { /* Check if user can still edit this post - within allowed edit timeframe */ $editAllowed = false; if ($CONF_FORUM['allowed_editwindow'] > 0) { $t1 = $showtopic['date']; $t2 = $CONF_FORUM['allowed_editwindow']; if (time() - $t2 < $t1) { $editAllowed = true; } } else { $editAllowed = true; } if ($editAllowed) { $editlink = "{$_CONF['site_url']}/forum/createtopic.php?method=edit&forum={$showtopic['forum']}&id={$showtopic['id']}&editid={$showtopic['id']}&page={$page}"; $editlinktext = $LANG_GF09['edit']; $topictemplate->set_var('editlink', $editlink); $topictemplate->set_var('editlinktext', $editlinktext); $topictemplate->set_var('LANG_edit', $LANG_GF01['EDITICON']); $topictemplate->parse('edittopic_link', 'edittopic_link'); } } if ($highlight != '') { $showtopic['subject'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['subject']); $showtopic['comment'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['comment']); } if (!isset($showtopic['pid'])) { $showtopic['pid'] = 0; } if ($showtopic['pid'] == 0) { $replytopicid = $showtopic['id']; $is_lockedtopic = $showtopic['locked']; $views = $showtopic['views']; $topictemplate->set_var('read_msg', sprintf($LANG_GF02['msg49'], $views)); if ($is_lockedtopic) { $topictemplate->parse('topiclocked_icon', 'topiclocked_icon'); } } else { $replytopicid = $showtopic['pid']; $is_lockedtopic = DB_getItem($_TABLES['forum_topic'], 'locked', "id={$showtopic['pid']}"); $topictemplate->set_var('read_msg', ''); } if ($CONF_FORUM['allow_user_dateformat']) { $date = COM_getUserDateTimeFormat($showtopic['date']); $topictemplate->set_var('posted_date', $date[0]); } else { $date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']); $topictemplate->set_var('posted_date', $date); } if ($mode != 'preview') { if ($is_lockedtopic == 0) { $is_readonly = DB_getItem($_TABLES['forum_forums'], 'is_readonly', 'forum_id=' . $showtopic['forum']); if ($is_readonly == 0 or forum_modPermission($showtopic['forum'], $_USER['uid'], 'mod_edit')) { $quotelink = "{$_CONF['site_url']}/forum/createtopic.php?method=postreply&forum={$showtopic['forum']}&id={$replytopicid}&quoteid={$showtopic['id']}"; $quotelinktext = $LANG_GF09['quote']; $topictemplate->set_var('quotelink', $quotelink); $topictemplate->set_var('quotelinktext', $quotelinktext); $topictemplate->set_var('LANG_quote', $LANG_GF01['QUOTEICON']); $topictemplate->parse('quotetopic_link', 'quotetopic_link'); } } $topictemplate->set_var('topic_post_id', $showtopic['id']); if ($showtopic['uid'] > 1 && $uservalid) { $profile_link = "{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}"; $profile_linktext = $LANG_GF09['profile']; $topictemplate->set_var('profilelink', $profile_link); $topictemplate->set_var('profilelinktext', $profile_linktext); $topictemplate->set_var('LANG_profile', $LANG_GF01['ProfileLink']); $topictemplate->parse('profile_link', 'profile_link'); if ($CONF_FORUM['use_pm_plugin']) { $pmusernmame = COM_getDisplayName($showtopic['uid']); $pmplugin_link = forumPLG_getPMlink($pmusernmame); if ($pmplugin_link != '') { $pm_link = $pmplugin_link; $pm_linktext = $LANG_GF09['pm']; $topictemplate->set_var('pmlink', $pm_link); $topictemplate->set_var('pmlinktext', $pm_linktext); $topictemplate->set_var('LANG_pm', $LANG_GF01['PMLink']); $topictemplate->parse('pm_link', 'pm_link'); } } } if ($userarray['email'] != '' && $showtopic["uid"] > 1) { $email_link = "{$_CONF['site_url']}/profiles.php?uid={$showtopic['uid']}"; $email_linktext = $LANG_GF09['email']; $topictemplate->set_var('emaillink', $email_link); $topictemplate->set_var('emaillinktext', $email_linktext); $topictemplate->set_var('LANG_email', $LANG_GF01['EmailLink']); $topictemplate->parse('email_link', 'email_link'); } if ($userarray['homepage'] != '') { $homepage = trim($userarray['homepage']); if (strtolower(substr($homepage, 0, 4)) != 'http') { $homepage = 'http://' . $homepage; } $homepagetext = $LANG_GF09['website']; $topictemplate->set_var('websitelink', $homepage); $topictemplate->set_var('websitelinktext', $homepagetext); $topictemplate->set_var('LANG_website', $LANG_GF01['WebsiteLink']); $topictemplate->parse('website_link', 'website_link'); } if ($userarray['location'] != '' && $showtopic["uid"] > 1) { $topictemplate->set_var('user_location', $userarray['location']); $topictemplate->parse('location', 'location'); } } else { if (isset($_GET['onlytopic']) and $_GET['onlytopic'] != 1) { $topictemplate->set_var('posted_date', ''); $topictemplate->set_var('preview_topic_subject', $showtopic['subject']); } else { $topictemplate->set_var('preview_topic_subject', ''); } $topictemplate->set_var('read_msg', ''); $topictemplate->set_var('topiclocked_icon', ''); $topictemplate->set_var('preview_mode', 'none'); } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time4: $intervalTime"); $showtopic['comment'] = str_replace('{', '{', $showtopic['comment']); $showtopic['comment'] = str_replace('}', '}', $showtopic['comment']); // Temporary correspondence. You should cope in more roots. $showtopic['comment'] = str_replace(array("<br />", "<br>"), '<br' . XHTML . '>', $showtopic['comment']); $topictemplate->set_var('layout_url', $CONF_FORUM['layout_url']); $topictemplate->set_var('csscode', $onetwo); $topictemplate->set_var('postmode', $showtopic['postmode']); $topictemplate->set_var('userlink', $userlink); $topictemplate->set_var('lang_forum', $LANG_GF01['FORUM']); $topictemplate->set_var('user_levelname', $user_levelname); $topictemplate->set_var('user_level', $user_level); $topictemplate->set_var('avatar', $avatar); $topictemplate->set_var('regdate', $regdate); $topictemplate->set_var('numposts', $numposts); if (forum_modPermission($showtopic['forum'], $_USER['uid'], 'mod_ban')) { $topictemplate->set_var('ip', $showtopic['ip']); if ($showtopic['uid'] == 1) { $topictemplate->parse('ip_address', 'anon_ip_address'); } else { $topictemplate->parse('ip_address', 'ip_address'); } } else { $topictemplate->set_var('ip_address', ''); } $topictemplate->set_var('imgset', $CONF_FORUM['imgset']); $topictemplate->set_var('topic_subject', $showtopic['subject']); $topictemplate->set_var('LANG_ON2', $LANG_GF01['ON2']); if ($mode != 'preview') { $mod_functions = forum_getmodFunctions($showtopic); if (!empty($mod_functions)) { $topictemplate->set_var('mod_functions', $mod_functions); $topictemplate->parse('mod_functions', 'mod_functions'); } else { $topictemplate->set_var('mod_functions', ''); } } $topictemplate->set_var('topic_comment', $showtopic['comment']); $topictemplate->set_var('comment_minheight', "min-height:{$min_height}px"); if (trim($sig) != '') { $topictemplate->set_var('sig', PLG_replaceTags($sig)); $topictemplate->set_var('show_sig', ''); $topictemplate->parse('user_signature', 'user_signature'); } else { $topictemplate->set_var('sig', ''); $topictemplate->set_var('show_sig', 'none'); $topictemplate->set_var('user_signature', ''); } $topictemplate->set_var('forumid', $showtopic['forum']); $topictemplate->set_var('topic_id', $showtopic['id']); $topictemplate->set_var('member_badge', forumPLG_getMemberBadge($showtopic['uid'])); if ($uservalid) { $topictemplate->parse('user_name', 'block_user_name'); $topictemplate->parse('user_information', 'block_user_information'); } else { $topictemplate->parse('user_name', 'block_anon_user_name'); $topictemplate->parse('user_information', 'block_anon_user_information'); } $topictemplate->parse('output', 'topictemplate'); $retval = $topictemplate->finish($topictemplate->get_var('output')); //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time5: $intervalTime"); return $retval; }
/** * Shows the links editor * * @param string $mode Used to see if we are moderating a link or simply editing one * @param string $lid ID of link to edit * @global array core config vars * @global array core group data * @global array core table data * @global array core user data * @global array links plugin config vars * @global array links plugin lang vars * @global array core lang access vars * @return string HTML for the link editor form * */ function editlink($mode, $lid = '') { global $_CONF, $_GROUPS, $_TABLES, $_USER, $_LI_CONF, $LANG_LINKS_ADMIN, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE; $retval = ''; $link_templates = COM_newTemplate(CTL_plugin_templatePath('links', 'admin')); $link_templates->set_file('editor', 'linkeditor.thtml'); $link_templates->set_var('lang_pagetitle', $LANG_LINKS_ADMIN[28]); $link_templates->set_var('lang_link_list', $LANG_LINKS_ADMIN[53]); $link_templates->set_var('lang_new_link', $LANG_LINKS_ADMIN[51]); $link_templates->set_var('lang_validate_links', $LANG_LINKS_ADMIN[26]); $link_templates->set_var('lang_list_categories', $LANG_LINKS_ADMIN[50]); $link_templates->set_var('lang_new_category', $LANG_LINKS_ADMIN[52]); $link_templates->set_var('lang_admin_home', $LANG_ADMIN['admin_home']); $link_templates->set_var('instructions', $LANG_LINKS_ADMIN[29]); if ($mode != 'editsubmission' and !empty($lid)) { $result = DB_query("SELECT * FROM {$_TABLES['links']} WHERE lid ='{$lid}'"); if (DB_numRows($result) !== 1) { $msg = COM_showMessageText($LANG_LINKS_ADMIN[25], $LANG_LINKS_ADMIN[24]); return $msg; } $A = DB_fetchArray($result); $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) { $retval .= COM_showMessageText($LANG_LINKS_ADMIN[17], $LANG_LINKS_ADMIN[16]); COM_accessLog("User {$_USER['username']} tried to illegally submit or edit link {$lid}."); return $retval; } } else { if ($mode == 'editsubmission') { $result = DB_query("SELECT * FROM {$_TABLES['linksubmission']} WHERE lid = '{$lid}'"); $A = DB_fetchArray($result); } else { $A['lid'] = COM_makesid(); $A['cid'] = ''; $A['url'] = ''; $A['description'] = ''; $A['title'] = ''; $A['owner_id'] = $_USER['uid']; } $A['hits'] = 0; if (isset($_GROUPS['Links Admin'])) { $A['group_id'] = $_GROUPS['Links Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('links.edit'); } SEC_setDefaultPermissions($A, $_LI_CONF['default_permissions']); $access = 3; } $token = SEC_createToken(); $retval .= COM_startBlock($LANG_LINKS_ADMIN[1], '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= SEC_getTokenExpiryNotice($token); $link_templates->set_var('link_id', $A['lid']); if (!empty($lid) && SEC_hasRights('links.edit')) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $link_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $link_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); if ($mode == 'editsubmission') { $link_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>'); } } $link_templates->set_var('lang_linktitle', $LANG_LINKS_ADMIN[3]); $link_templates->set_var('link_title', htmlspecialchars(stripslashes($A['title']))); $link_templates->set_var('lang_linkid', $LANG_LINKS_ADMIN[2]); $link_templates->set_var('lang_linkurl', $LANG_LINKS_ADMIN[4]); $link_templates->set_var('max_url_length', 255); $link_templates->set_var('link_url', $A['url']); $link_templates->set_var('lang_includehttp', $LANG_LINKS_ADMIN[6]); $link_templates->set_var('lang_category', $LANG_LINKS_ADMIN[5]); $othercategory = links_select_box(3, $A['cid']); $link_templates->set_var('category_options', $othercategory); $link_templates->set_var('lang_ifotherspecify', $LANG_LINKS_ADMIN[20]); $link_templates->set_var('category', $othercategory); $link_templates->set_var('lang_linkhits', $LANG_LINKS_ADMIN[8]); $link_templates->set_var('link_hits', $A['hits']); $link_templates->set_var('lang_linkdescription', $LANG_LINKS_ADMIN[9]); $link_templates->set_var('link_description', stripslashes($A['description'])); $allowed = COM_allowedHTML('links.edit') . COM_allowedAutotags(); $link_templates->set_var('lang_allowed_html', $allowed); $link_templates->set_var('lang_save', $LANG_ADMIN['save']); $link_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); // user access info $link_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $link_templates->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($A['owner_id']); $link_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}")); $link_templates->set_var('owner_name', $ownername); $link_templates->set_var('owner', $ownername); $link_templates->set_var('link_ownerid', $A['owner_id']); $link_templates->set_var('lang_group', $LANG_ACCESS['group']); $link_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $link_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $link_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']); $link_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $link_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $link_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $link_templates->set_var('lang_lockmsg', $LANG_ACCESS['permmsg']); $link_templates->set_var('gltoken_name', CSRF_TOKEN); $link_templates->set_var('gltoken', $token); $link_templates->parse('output', 'editor'); $retval .= $link_templates->finish($link_templates->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
// Debug Code to show variables $display .= gf_showVariables(); // Check if the number of records was specified to show - part of page navigation. if ($show == 0 and $CONF_FORUM['show_messages_perpage'] > 0) { $show = $CONF_FORUM['show_messages_perpage']; } elseif ($show == 0) { $show = 20; } // Check if this is the first page. if (empty($page)) { $page = 1; } $display .= COM_startBlock($LANG_GF02['msg193']); $navbar->set_selected($LANG_GF06['5']); $display .= $navbar->generate(); $p = COM_newTemplate(CTL_plugin_templatePath('forum', 'admin')); $p->set_file(array('page' => 'migrate.thtml')); $p->set_block('page', 'report_record'); $p->set_block('page', 'message'); $p->set_block('page', 'no_records_message'); if (!empty($_GET['num_stories']) && !empty($_GET['num_posts'])) { $p->set_var('status_message', sprintf($LANG_GF02['msg192'], $_GET['num_stories'], $_GET['num_posts'])); $p->parse('message', 'message'); } else { $p->set_var('show_message', 'none'); } if (!empty($curtopic) && $curtopic != 'all') { if ($curtopic == "submissions") { $table_name = $_TABLES['storysubmission']; $sql_part0 = "SELECT ta.tid,s.sid,s.title,s.date,0 AS comments "; $sql_part2 = '';
$forumlisting->parse('category_records', 'category_record', true); $forumlisting->parse('forum_records', ''); } } if ($numCategories == 0) { // Do we have any categories defined yet $display .= alertMessage($LANG_GF01['MSG_NO_CAT'], $LANG_GF01['ERROR'], false); } $forumlisting->parse('output', 'forumlisting'); $display .= $forumlisting->finish($forumlisting->get_var('output')); //$exectime = $mytimer->stopTimer(); //COM_errorLog("End of Listing - time:$exectime"); } // Display Forums if ($forum > 0) { $topiclisting = COM_newTemplate(CTL_plugin_templatePath('forum')); $topiclisting->set_file(array('topiclisting' => 'topiclisting.thtml', 'forum_icons' => 'forum_icons.thtml', 'forum_links' => 'forum_links.thtml')); $topiclisting->set_block('topiclisting', 'topic_record'); $topiclisting->set_block('topiclisting', 'no_records_message'); $blocks = array('new_icon', 'quiet_icon', 'active_icon', 'normal_icon', 'normalnew_icon', 'sticky_icon', 'stickynew_icon', 'locked_icon', 'lockednew_icon', 'sort_desc', 'sort_desc_on', 'sort_asc', 'sort_asc_on'); foreach ($blocks as $block) { $topiclisting->set_block('forum_icons', $block); } $blocks = array('newtopic_link', 'subscribeforum_link', 'forummenu_link'); foreach ($blocks as $block) { $topiclisting->set_block('forum_links', $block); } $topiclisting->set_var('imgset', $CONF_FORUM['imgset']); $topiclisting->set_var('layout_url', $CONF_FORUM['layout_url']); $topiclisting->set_var('LANG_HOME', $LANG_GF01['HOMEPAGE']); $topiclisting->set_var('forum_home', $LANG_GF01['INDEXPAGE']);
/** * Create the links list depending on the category given * * @param array $message message(s) to display * @return string the links page * */ function links_list($message) { global $_CONF, $_TABLES, $_LI_CONF, $LANG_LINKS_ADMIN, $LANG_LINKS, $LANG_LINKS_STATS; $cid = $_LI_CONF['root']; $display = ''; if (isset($_GET['category'])) { $cid = strip_tags(COM_stripslashes($_GET['category'])); } elseif (isset($_POST['category'])) { $cid = strip_tags(COM_stripslashes($_POST['category'])); } $cat = DB_escapeString($cid); $page = 0; if (isset($_GET['page'])) { $page = COM_applyFilter($_GET['page'], true); } if ($page == 0) { $page = 1; } if (empty($cid)) { if ($page > 1) { $page_title = sprintf($LANG_LINKS[114] . ' (%d)', $page); } else { $page_title = $LANG_LINKS[114]; } } else { if ($cid == $_LI_CONF['root']) { $category = $LANG_LINKS['root']; } else { $category = DB_getItem($_TABLES['linkcategories'], 'category', "cid = '{$cat}'"); } if ($page > 1) { $page_title = sprintf($LANG_LINKS[114] . ': %s (%d)', $category, $page); } else { $page_title = sprintf($LANG_LINKS[114] . ': %s', $category); } } // Check has access and existent to this category if ($cid != $_LI_CONF['root']) { $result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['linkcategories']} WHERE cid='{$cat}'"); $A = DB_fetchArray($result); if (SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']) < 2) { $display .= COM_showMessage(5, 'links'); $display = COM_createHTMLDocument($display, array('pagetitle' => $page_title)); COM_output($display); exit; } // check existent if (!isset($A['owner_id'])) { $display .= COM_showMessage(16, 'links'); $display = COM_createHTMLDocument($display, array('pagetitle' => $page_title)); COM_output($display); exit; } } if (is_array($message) && !empty($message[0])) { $display .= COM_showMessageText($message[1], $message[0]); } else { if (isset($_REQUEST['msg'])) { $msg = COM_applyFilter($_REQUEST['msg'], true); if ($msg > 0) { $display .= COM_showMessage($msg, 'links'); } } } $linklist = COM_newTemplate(CTL_plugin_templatePath('links')); $linklist->set_file(array('linklist' => 'links.thtml', 'catlinks' => 'categorylinks.thtml', 'link' => 'linkdetails.thtml', 'catnav' => 'categorynavigation.thtml', 'catrow' => 'categoryrow.thtml', 'catcol' => 'categorycol.thtml', 'actcol' => 'categoryactivecol.thtml', 'pagenav' => 'pagenavigation.thtml', 'catdrop' => 'categorydropdown.thtml')); $linklist->set_var('blockheader', COM_startBlock($LANG_LINKS[114])); if ($_LI_CONF['linkcols'] > 0) { // Create breadcrumb trail $linklist->set_var('breadcrumbs', links_breadcrumbs($_LI_CONF['root'], $cid)); // Set dropdown for category jump $linklist->set_var('lang_go', $LANG_LINKS[124]); $linklist->set_var('link_dropdown', links_select_box(2, $cid)); // Show categories $sql = "SELECT cid,pid,category,description FROM {$_TABLES['linkcategories']} WHERE pid='{$cat}'"; $sql .= COM_getLangSQL('cid', 'AND'); $sql .= COM_getPermSQL('AND') . " ORDER BY category"; $result = DB_query($sql); $nrows = DB_numRows($result); if ($nrows > 0) { $linklist->set_var('lang_categories', $LANG_LINKS_ADMIN[14]); for ($i = 1; $i <= $nrows; $i++) { $C = DB_fetchArray($result); // Get number of child links user can see in this category $ccid = DB_escapeString($C['cid']); $result1 = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['links']} WHERE cid='{$ccid}'" . COM_getPermSQL('AND')); $D = DB_fetchArray($result1); // Get number of child categories user can see in this category $result2 = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['linkcategories']} WHERE pid='{$ccid}'" . COM_getPermSQL('AND')); $E = DB_fetchArray($result2); // Format numbers for display $display_count = ''; // don't show zeroes if ($E['count'] > 0) { $display_count = COM_numberFormat($E['count']); } if ($E['count'] > 0 && $D['count'] > 0) { $display_count .= ', '; } if ($D['count'] > 0) { $display_count .= COM_numberFormat($D['count']); } // add brackets if child items exist if ($display_count != '') { $display_count = '(' . $display_count . ')'; } $linklist->set_var('category_name', $C['category']); if ($_LI_CONF['show_category_descriptions']) { $linklist->set_var('category_description', PLG_replaceTags($C['description'])); } else { $linklist->set_var('category_description', ''); } $linklist->set_var('category_link', $_CONF['site_url'] . '/links/index.php?category=' . rawurlencode($C['cid'])); $linklist->set_var('category_count', $display_count); $linklist->set_var('width', floor(100 / $_LI_CONF['linkcols'])); if (!empty($cid) && $cid == $C['cid']) { $linklist->parse('category_col', 'actcol', true); } else { $linklist->parse('category_col', 'catcol', true); } if ($i % $_LI_CONF['linkcols'] == 0) { $linklist->parse('category_row', 'catrow', true); $linklist->set_var('category_col', ''); } } if ($nrows % $_LI_CONF['linkcols'] != 0) { $linklist->parse('category_row', 'catrow', true); } $linklist->parse('category_navigation', 'catnav', true); } else { $linklist->set_var('category_navigation', ''); } } else { $linklist->set_var('category_navigation', ''); } if ($_LI_CONF['linkcols'] == 0) { $linklist->set_var('category_dropdown', ''); } else { $linklist->parse('category_dropdown', 'catdrop', true); } $linklist->set_var('cid', $cid); $linklist->set_var('cid_plain', $cid); $linklist->set_var('cid_encoded', rawurlencode($cid)); $linklist->set_var('lang_addalink', $LANG_LINKS[116]); // Build SQL for links $sql = 'SELECT lid,cid,url,description,title,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon'; $from_where = " FROM {$_TABLES['links']}"; if ($_LI_CONF['linkcols'] > 0) { if (!empty($cid)) { $from_where .= " WHERE cid='" . DB_escapeString($cid) . "'"; } else { $from_where .= " WHERE cid=''"; } $from_where .= COM_getPermSQL('AND'); } else { $from_where .= COM_getPermSQL(); } $order = ' ORDER BY cid ASC,title'; $limit = ''; if ($_LI_CONF['linksperpage'] > 0) { if ($page < 1) { $start = 0; } else { $start = ($page - 1) * $_LI_CONF['linksperpage']; } $limit = ' LIMIT ' . $start . ',' . $_LI_CONF['linksperpage']; } $result = DB_query($sql . $from_where . $order . $limit); $nrows = DB_numRows($result); if ($nrows == 0) { if ($cid == $_LI_CONF['root'] && $page <= 1 && $_LI_CONF['show_top10']) { $result = DB_query("SELECT lid,url,title,description,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['links']} WHERE (hits > 0)" . COM_getPermSQL('AND') . LINKS_getCategorySQL('AND') . " ORDER BY hits DESC LIMIT 10"); $nrows = DB_numRows($result); if ($nrows > 0) { $linklist->set_var('link_details', ''); $linklist->set_var('link_category', $LANG_LINKS_STATS['stats_headline']); for ($i = 0; $i < $nrows; $i++) { $A = DB_fetchArray($result); prepare_link_item($A, $linklist); $linklist->parse('link_details', 'link', true); } $linklist->parse('category_links', 'catlinks', true); } } $linklist->set_var('page_navigation', ''); } else { $currentcid = ''; for ($i = 0; $i < $nrows; $i++) { $A = DB_fetchArray($result); if (strcasecmp($A['cid'], $currentcid) != 0) { // print the category and link if ($i > 0) { $linklist->parse('category_links', 'catlinks', true); $linklist->set_var('link_details', ''); } $currentcid = $A['cid']; $currentcategory = DB_getItem($_TABLES['linkcategories'], 'category', "cid = '" . DB_escapeString($currentcid) . "'"); if ($A['cid'] == $_LI_CONF['root']) { $linklist->set_var('link_category', $LANG_LINKS['root']); } else { $linklist->set_var('link_category', $currentcategory); } } prepare_link_item($A, $linklist); $linklist->parse('link_details', 'link', true); } $linklist->parse('category_links', 'catlinks', true); $result = DB_query('SELECT COUNT(*) AS count ' . $from_where); list($numlinks) = DB_fetchArray($result); $pages = 0; if ($_LI_CONF['linksperpage'] > 0) { $pages = (int) ($numlinks / $_LI_CONF['linksperpage']); if ($numlinks % $_LI_CONF['linksperpage'] > 0) { $pages++; } } if ($pages > 0) { if ($_LI_CONF['linkcols'] > 0 && !empty($currentcid)) { $catlink = '?category=' . rawurlencode($currentcid); } else { $catlink = ''; } $linklist->set_var('page_navigation', COM_printPageNavigation($_CONF['site_url'] . '/links/index.php' . $catlink, $page, $pages)); } else { $linklist->set_var('page_navigation', ''); } } $linklist->set_var('blockfooter', COM_endBlock()); $linklist->parse('output', 'linklist'); $display .= $linklist->finish($linklist->get_var('output')); $display = COM_createHTMLDocument($display, array('pagetitle' => $page_title)); return $display; }
/** * Allows user to edit a personal calendar event * * @param array $A Record to display * @return string HTML for event editor * */ function editpersonalevent($A) { global $_CONF, $_CA_CONF, $LANG_CAL_1; $cal_templates = COM_newTemplate(CTL_plugin_templatePath('calendar')); $cal_templates->set_file('form', 'editpersonalevent.thtml'); $cal_templates->set_var('lang_title', $LANG_CAL_1[28]); $title = stripslashes($A['title']); $title = str_replace('{', '{', $title); $title = str_replace('}', '}', $title); $title = str_replace('"', '"', $title); $cal_templates->set_var('event_title', $title); $cal_templates->set_var('lang_eventtype', $LANG_CAL_1[37]); $type_options = CALENDAR_eventTypeList($A['event_type']); $cal_templates->set_var('type_options', $type_options); // Handle start date/time $cal_templates->set_var('lang_startdate', $LANG_CAL_1[21]); $cal_templates->set_var('lang_starttime', $LANG_CAL_1[30]); $A['startdate'] = $A['datestart'] . ' ' . $A['timestart']; $start_month = date('n', strtotime($A['startdate'])); $month_options = COM_getMonthFormOptions($start_month); $cal_templates->set_var('startmonth_options', $month_options); $start_day = date('j', strtotime($A['startdate'])); $day_options = COM_getDayFormOptions($start_day); $cal_templates->set_var('startday_options', $day_options); $start_year = date('Y', strtotime($A['startdate'])); $year_options = COM_getYearFormOptions($start_year); $cal_templates->set_var('startyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $start_hour = date('H', strtotime($A['startdate'])); $hour_options = COM_getHourFormOptions($start_hour, 24); $cal_templates->set_var('starthour_options', $hour_options); } else { $start_hour = date('g', strtotime($A['startdate'])); $hour_options = COM_getHourFormOptions($start_hour); $cal_templates->set_var('starthour_options', $hour_options); } $startmin = intval(date('i', strtotime($A['startdate'])) / 15) * 15; $cal_templates->set_var('startminute_options', COM_getMinuteFormOptions($startmin, 15)); $ampm = date('a', strtotime($A['startdate'])); $cal_templates->set_var('startampm_selection', COM_getAmPmFormSelection('startampm_selection', $ampm)); // Handle end date/time $cal_templates->set_var('lang_enddate', $LANG_CAL_1[18]); $cal_templates->set_var('lang_endtime', $LANG_CAL_1[29]); $A['enddate'] = $A['dateend'] . ' ' . $A['timeend']; $end_month = date('n', strtotime($A['enddate'])); $month_options = COM_getMonthFormOptions($end_month); $cal_templates->set_var('endmonth_options', $month_options); $end_day = date('j', strtotime($A['enddate'])); $day_options = COM_getDayFormOptions($end_day); $cal_templates->set_var('endday_options', $day_options); $end_year = date('Y', strtotime($A['enddate'])); $year_options = COM_getYearFormOptions($end_year); $cal_templates->set_var('endyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $end_hour = date('H', strtotime($A['enddate'])); $hour_options = COM_getHourFormOptions($end_hour, 24); $cal_templates->set_var('endhour_options', $hour_options); } else { $end_hour = date('g', strtotime($A['enddate'])); $hour_options = COM_getHourFormOptions($end_hour); $cal_templates->set_var('endhour_options', $hour_options); } $endmin = intval(date('i', strtotime($A['enddate'])) / 15) * 15; $cal_templates->set_var('endminute_options', COM_getMinuteFormOptions($endmin, 15)); $ampm = date('a', strtotime($A['enddate'])); $cal_templates->set_var('endampm_selection', COM_getAmPmFormSelection('endampm_selection', $ampm)); $cal_templates->set_var('lang_alldayevent', $LANG_CAL_1[31]); if ($A['allday'] == 1) { $cal_templates->set_var('allday_checked', 'checked="checked"'); } else { $cal_templates->set_var('allday_checked', ''); } $cal_templates->set_var('lang_location', $LANG_CAL_1[39]); $cal_templates->set_var('event_location', stripslashes($A['location'])); $cal_templates->set_var('lang_addressline1', $LANG_CAL_1[32]); $cal_templates->set_var('event_address1', stripslashes($A['address1'])); $cal_templates->set_var('lang_addressline2', $LANG_CAL_1[33]); $cal_templates->set_var('event_address2', stripslashes($A['address2'])); $cal_templates->set_var('lang_city', $LANG_CAL_1[34]); $cal_templates->set_var('event_city', stripslashes($A['city'])); $cal_templates->set_var('lang_state', $LANG_CAL_1[35]); $cal_templates->set_var('state_options', ''); $cal_templates->set_var('event_state', stripslashes($A['state'])); $cal_templates->set_var('lang_zipcode', $LANG_CAL_1[36]); $cal_templates->set_var('event_zipcode', $A['zipcode']); $cal_templates->set_var('lang_link', $LANG_CAL_1[43]); $cal_templates->set_var('event_url', $A['url']); $cal_templates->set_var('lang_description', $LANG_CAL_1[5]); $cal_templates->set_var('event_description', COM_nl2br(stripslashes($A['description']))); $cal_templates->set_var('lang_htmlnotallowed', $LANG_CAL_1[44]); $cal_templates->set_var('lang_submit', $LANG_CAL_1[45]); $cal_templates->set_var('lang_delete', $LANG_CAL_1[51]); $cal_templates->set_var('eid', $A['eid']); $cal_templates->set_var('uid', $A['uid']); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $cal_templates->set_var('hour_mode', 24); } else { $cal_templates->set_var('hour_mode', 12); } $cal_templates->set_var('gltoken_name', CSRF_TOKEN); $cal_templates->set_var('gltoken', SEC_createToken()); return $cal_templates->parse('output', 'form'); }
$report->set_var('post_subject', $P['subject']); $report->set_var('post_end_ahref', '</a>'); $report->set_var('post_date', $postdate[0]); $report->set_var('post_replies', $P['replies']); $report->set_var('post_views', $P['views']); $report->set_var('csscode', $i % 2 + 1); $report->parse('report_record', 'report_record', true); } } $report->parse('output', 'report'); $display .= $report->finish($report->get_var('output')); $display = gf_createHTMLDocument($display); COM_output($display); exit; } else { $report = COM_newTemplate(CTL_plugin_templatePath('forum')); $report->set_file(array('report' => 'reports/memberlist.thtml', 'forum_icons' => 'forum_icons.thtml', 'forum_links' => 'forum_links.thtml')); $report->set_block('report', 'report_record'); $report->set_block('forum_links', 'memberoption_link'); $blocks = array('sort_desc', 'sort_desc_on', 'sort_asc', 'sort_asc_on'); foreach ($blocks as $block) { $report->set_block('forum_icons', $block); } // Check if the number of records was specified to show if (empty($show) and $CONF_FORUM['show_members_perpage'] > 0) { $show = $CONF_FORUM['show_members_perpage']; } elseif (empty($show)) { $show = 20; } // Check if this is the first page. if ($page == 0) {
function f_forumrules() { global $_CONF, $_USER, $LANG_GF01, $LANG_GF02, $CONF_FORUM; $forum_rules = COM_newTemplate(CTL_plugin_templatePath('forum')); $forum_rules->set_file(array('forum_rules' => 'footer/forum_rules.thtml', 'forum_icons' => 'forum_icons.thtml')); $blocks = array('status_yes', 'status_no'); foreach ($blocks as $block) { $forum_rules->set_block('forum_icons', $block); } if ($CONF_FORUM['registered_to_post'] and ($_USER['uid'] < 2 or empty($_USER['uid']))) { $postperm_msg = $LANG_GF01['POST_PERM_MSG2']; $post_perm_image = "status_no"; } else { $postperm_msg = $LANG_GF01['POST_PERM_MSG1']; $post_perm_image = "status_yes"; } if ($CONF_FORUM['allow_html']) { $html_perm_image = "status_yes"; if ($CONF_FORUM['use_glfilter']) { $htmlmsg = $LANG_GF01['HTML_FILTER_MSG']; } else { $htmlmsg = $LANG_GF01['HTML_FULL_MSG']; } } else { $htmlmsg = $LANG_GF01['HTML_MSG']; $html_perm_image = "status_no"; } if ($CONF_FORUM['use_censor']) { $censor_perm_image = "status_yes"; } else { $censor_perm_image = "status_no"; } if ($CONF_FORUM['show_anonymous_posts']) { $anon_perm_image = "status_yes"; } else { $anon_perm_image = "status_no"; } $forum_rules->set_var('imgset', $CONF_FORUM['imgset']); $forum_rules->set_var('LANG_title', $LANG_GF02['msg101']); $forum_rules->set_var('anonymous_msg', $LANG_GF01['ANON_PERM_MSG']); $forum_rules->parse('anon_perm_image', $anon_perm_image); $forum_rules->set_var('postingperm_msg', $postperm_msg); $forum_rules->parse('post_perm_image', $post_perm_image); $forum_rules->set_var('html_msg', $htmlmsg); $forum_rules->parse('html_perm_image', $html_perm_image); $forum_rules->set_var('censor_msg', $LANG_GF01['CENSOR_PERM_MSG']); $forum_rules->parse('censor_perm_image', $censor_perm_image); $forum_rules->parse('output', 'forum_rules'); return $forum_rules->finish($forum_rules->get_var('output')); }
$topic_footer->set_var('newtopiclink', $newtopiclink); $topic_footer->set_var('newtopiclinkimg', gf_getImage('post_newtopic')); $topic_footer->set_var('newtopiclinktext', $newtopiclinktext); $topic_footer->set_var('LANG_newtopic', $LANG_GF01['NEWTOPIC']); $topic_footer->parse('newtopic_link', 'newtopic_link'); if ($viewtopic['locked'] != 1) { $replytopiclink = "{$_CONF['site_url']}/forum/createtopic.php?method=postreply&forum={$forum}&id={$replytopic_id}"; $topic_footer->set_var('replytopiclink', $replytopiclink); $topic_footer->set_var('replytopiclinkimg', gf_getImage('post_reply')); $topic_footer->set_var('replytopiclinktext', $LANG_GF09['replytopic']); $topic_footer->set_var('LANG_reply', $LANG_GF01['POSTREPLY']); $topic_footer->parse('replytopic_link', 'replytopic_link'); } } } else { $topic_footer = COM_newTemplate(CTL_plugin_templatePath('forum')); $topic_footer->set_file(array('topicfooter' => 'topicfooter_preview.thtml')); } $topic_footer->set_var('pagenavigation', $pagenavigation); $topic_footer->set_var('forum_id', $forum); $topic_footer->set_var('imgset', $CONF_FORUM['imgset']); $topic_footer->parse('output', 'topicfooter'); $display .= $topic_footer->finish($topic_footer->get_var('output')); $intervalTime = $mytimer->stopTimer(); //COM_errorLog("End Topic Display Time: $intervalTime"); if ($onlytopic != 1) { $display .= BaseFooter(); $display = gf_createHTMLDocument($display, $subject); } else { // need to call this incase plugin doesnt use script class OR footercode function is used to set required javascript file $display .= PLG_getFooterCode();
break; case 'addentry': $display .= plugin_submit_calendar($mode); $display = COM_createHTMLDocument($display, array('pagetitle' => $pagetitle)); break; case 'savepersonal': if (SEC_checkToken()) { $display = plugin_savesubmission_calendar($_POST); } else { COM_redirect($_CONF['site_url'] . '/calendar/index.php'); } break; default: // month view // Load templates $cal_templates = COM_newTemplate(CTL_plugin_templatePath('calendar')); $cal_templates->set_file(array('calendar' => 'calendar.thtml', 'week' => 'calendarweek.thtml', 'day' => 'calendarday.thtml', 'event' => 'calendarevent.thtml', 'mastercal' => 'mastercalendaroption.thtml', 'personalcal' => 'personalcalendaroption.thtml', 'addevent' => 'addeventoption.thtml')); $cal_templates->set_var('mode', $mode); if ($mode == 'personal') { $cal_templates->set_var('start_block', COM_startBlock($LANG_CAL_2[12])); $cal_templates->set_var('end_block', COM_endBlock()); } else { $cal_templates->set_var('start_block', COM_startBlock($LANG_CAL_2[11])); $cal_templates->set_var('end_block', COM_endBlock()); } $smallcal_prev = getSmallCalendar($prevmonth, $prevyear, $mode); $cal_templates->set_var('previous_months_calendar', $smallcal_prev); $smallcal_next = getSmallCalendar($nextmonth, $nextyear, $mode); $cal_templates->set_var('next_months_calendar', $smallcal_next); $cal_templates->set_var('cal_prevmo_num', $prevmonth); $cal_templates->set_var('cal_prevyr_num', $prevyear);
/** * 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, $_SCRIPTS; $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_showMessageText($LANG25[22], $LANG25[21]); 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 = COM_newTemplate(CTL_plugin_templatePath('polls', 'admin')); $poll_templates->set_file(array('editor' => 'polleditor.thtml', 'question' => 'pollquestions.thtml', 'answer' => 'pollansweroption.thtml')); 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, '')); $poll_templates->set_var('allow_delete', true); $poll_templates->set_var('lang_delete', $LANG_ADMIN['delete']); $poll_templates->set_var('confirm_message', $MESSAGE[76]); } else { $T['pid'] = COM_makeSid(); $T['topic'] = ''; $T['description'] = ''; $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('noscript', COM_getNoScript(false, '')); // Add JavaScript // Hide the Advanced Editor as Javascript is required. If JS is enabled then the JS below will un-hide it $js = 'document.getElementById("advanced_editor").style.display="";'; $_SCRIPTS->setJavaScript($js, true); $_SCRIPTS->setJavaScriptFile('polls_editor', '/polls/polls_editor.js'); $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_topic_description', $LANG25[1003]); $poll_templates->set_var('topic_description', $T['description']); $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']); } if ($_CONF['meta_tags'] > 0 && $_PO_CONF['meta_tags'] > 0) { $poll_templates->set_var('hide_meta', ''); } else { $poll_templates->set_var('hide_meta', ' style="display:none;"'); } $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 ,allow_multipleanswers ,description " . "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]); $poll_templates->set_var('q_idx', $j); $poll_templates->set_var('lang_allow_multipleanswers', $LANG25[1001]); if ($Q['allow_multipleanswers'] == 1) { $poll_templates->set_var('poll_allow_multipleanswers', 'checked="checked"'); } else { $poll_templates->set_var('poll_allow_multipleanswers', ''); } $poll_templates->set_var('lang_questions_description', $LANG25[1002]); $poll_templates->set_var('description', $Q['description']); // 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; }
exit; } elseif ($modfunction == 'banippost' and forum_modPermission($forum, $_USER['uid'], 'mod_ban') and $fortopicid != 0) { $iptobansql = DB_query("SELECT ip FROM {$_TABLES['forum_topic']} WHERE id='{$fortopicid}'"); $forumpostipnum = DB_fetchArray($iptobansql); if ($forumpostipnum['ip'] == '') { $display .= alertMessage($LANG_GF02['msg174']); exit; } $alertmessage = $LANG_GF02['msg68']; $ip_address = $forumpostipnum['ip']; if (!empty($_CONF['ip_lookup'])) { $iplookup = str_replace('*', $ip_address, $_CONF['ip_lookup']); $ip_address = COM_createLink($ip_address, $iplookup); } $alertmessage .= sprintf($LANG_GF02['msg69'], $ip_address); $page = COM_newTemplate(CTL_plugin_templatePath('forum', 'moderator')); $page->set_file(array('page' => 'ban.thtml')); $page->set_var('hostip', $forumpostipnum['ip']); $page->set_var('forum', $forum); $page->set_var('fortopicid', $fortopicid); $page->parse('output', 'page'); $promptform = $page->finish($page->get_var('output')); $display .= alertMessage($alertmessage, $LANG_GF02['msg182'], $promptform); } else { $display .= alertMessage($LANG_GF02['msg71'], $LANG_GF01['WARNING']); } } else { $display .= alertMessage($LANG_GF02['msg72'], $LANG_GF01['ACCESSERROR']); } $display = gf_createHTMLDocument($display); COM_output($display);
$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 { $showforumssql = DB_query("SELECT forum_name,forum_id FROM {$_TABLES['forum_forums']}"); $sel_forums = '<option value="0">' . $LANG_GF93['allforums'] . '</option>'; while ($showforum = DB_fetchArray($showforumssql)) { if ($selected_forum == $showforum['forum_id']) { $sel_forums .= '<option value="' . $showforum['forum_id'] . '" selected="selected">' . $showforum['forum_name'] . '</option>'; } else { $sel_forums .= '<option value="' . $showforum['forum_id'] . '">' . $showforum['forum_name'] . '</option>'; } } $moderators = COM_newTemplate(CTL_plugin_templatePath('forum')); $moderators->set_file(array('moderators' => 'admin/moderators.thtml', 'forum_links' => 'forum_links.thtml')); $moderators->set_block('moderators', 'report_record'); $moderators->set_block('moderators', 'no_records_message'); $moderators->set_block('forum_links', 'trash_link'); $moderators->set_var('action_url', $_CONF['site_admin_url'] . '/plugins/forum/mods.php'); $moderators->set_var('imgset', $CONF_FORUM['imgset']); $moderators->set_var('userfilter', ''); if ($filtermode == 'group') { $moderators->set_var('groupfilter', 'checked="checked"'); $moderators->set_var('LANG_HEADING2', $LANG_GF01['GROUP']); } else { $moderators->set_var('userfilter', 'checked="checked"'); $moderators->set_var('LANG_HEADING2', $LANG_GF01['USER']); } $moderators->set_var('LANG_filtertitle', $LANG_GF93['filtertitle']);
/** * 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; }
/** * 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; }
function links_edit_category($cid, $pid) { global $_CONF, $_TABLES, $_USER, $MESSAGE, $LANG_LINKS_ADMIN, $LANG_ADMIN, $LANG_ACCESS, $_LI_CONF; $retval = ''; $cid = DB_escapeString($cid); if (!empty($pid)) { // have parent id, so making a new subcategory // get parent access rights $result = DB_query("SELECT group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['linkcategories']} WHERE cid='" . DB_escapeString($pid) . "'"); $A = DB_fetchArray($result); $A['owner_id'] = $_USER['uid']; $A['pid'] = $pid; } elseif (!empty($cid)) { // have category id, so editing a category $sql = "SELECT * FROM {$_TABLES['linkcategories']} WHERE cid='{$cid}'" . COM_getPermSQL('AND'); $result = DB_query($sql); $A = DB_fetchArray($result); } else { // nothing, so making a new top-level category // get default access rights $A['group_id'] = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name='Links Admin'"); SEC_setDefaultPermissions($A, $_LI_CONF['category_permissions']); $A['owner_id'] = $_USER['uid']; $A['pid'] = $_LI_CONF['root']; } $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); if ($access < 3) { return COM_showMessage(6, 'links'); } $token = SEC_createToken(); $retval .= COM_startBlock($LANG_LINKS_ADMIN[56], '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= SEC_getTokenExpiryNotice($token); $T = COM_newTemplate(CTL_plugin_templatePath('links', 'admin')); $T->set_file(array('page' => 'categoryeditor.thtml')); $T->set_var('lang_pagetitle', $LANG_LINKS_ADMIN[28]); $T->set_var('lang_link_list', $LANG_LINKS_ADMIN[53]); $T->set_var('lang_new_link', $LANG_LINKS_ADMIN[51]); $T->set_var('lang_validate_links', $LANG_LINKS_ADMIN[26]); $T->set_var('lang_list_categories', $LANG_LINKS_ADMIN[50]); $T->set_var('lang_new_category', $LANG_LINKS_ADMIN[52]); $T->set_var('lang_admin_home', $LANG_ADMIN['admin_home']); $T->set_var('instructions', $LANG_LINKS_ADMIN[29]); $T->set_var('lang_category', $LANG_LINKS_ADMIN[30]); $T->set_var('lang_cid', $LANG_LINKS_ADMIN[32]); $T->set_var('lang_description', $LANG_LINKS_ADMIN[31]); $T->set_var('lang_topic', $LANG_LINKS_ADMIN[33]); $T->set_var('lang_parent', $LANG_LINKS_ADMIN[34]); $T->set_var('lang_save', $LANG_ADMIN['save']); if (!empty($cid)) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $T->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $T->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); $T->set_var('allow_delete', true); $T->set_var('lang_delete', $LANG_ADMIN['delete']); $T->set_var('confirm_message', $MESSAGE[76]); } else { $T->set_var('delete_option', ''); } $T->set_var('lang_cancel', $LANG_ADMIN['cancel']); if (!empty($cid)) { $T->set_var('cid_value', $A['cid']); $T->set_var('old_cid_value', $A['cid']); $T->set_var('category_options', links_select_box(3, $A['pid'])); $T->set_var('category_value', $A['category']); $T->set_var('description_value', $A['description']); } else { $A['cid'] = COM_makeSid(); $T->set_var('cid_value', $A['cid']); $T->set_var('old_cid_value', ''); $T->set_var('category_options', links_select_box(3, $A['pid'])); $T->set_var('category_value', ''); $T->set_var('description_value', ''); } if (!isset($A['tid'])) { $A['tid'] = TOPIC_ALL_OPTION; } /* $topics = COM_topicList('tid,topic', $A['tid'], 1, true); $T->set_var('topic_list', $topics); $alltopics = '<option value="all"'; if ($A['tid'] == 'all') { $alltopics .= ' selected="selected"'; } $alltopics .= '>' . $LANG_LINKS_ADMIN[35] . '</option>' . LB; $T->set_var('topic_selection', '<select name="tid">' . $alltopics . $topics . '</select>'); */ $T->set_var('topic_selection', '<select name="tid" id="tid">' . TOPIC_getTopicListSelect($A['tid'], 2, true) . '</select>'); if (empty($cid)) { $num_links = $LANG_ADMIN['na']; } else { $nresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['links']} WHERE cid='{$cid}'" . COM_getPermSQL('AND')); $N = DB_fetchArray($nresult); $num_links = COM_numberFormat($N['count']); } $T->set_var('lang_num_links', $LANG_LINKS_ADMIN[61]); $T->set_var('num_links', $num_links); // user access info $T->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $T->set_var('lang_owner', $LANG_ACCESS['owner']); $T->set_var('owner_name', COM_getDisplayName($A['owner_id'])); $T->set_var('cat_ownerid', $A['owner_id']); $T->set_var('lang_group', $LANG_ACCESS['group']); $T->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $T->set_var('lang_permissions', $LANG_ACCESS['permissions']); $T->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']); $T->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $T->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $T->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $T->set_var('lang_lockmsg', $LANG_ACCESS['permmsg']); $T->set_var('gltoken_name', CSRF_TOKEN); $T->set_var('gltoken', $token); $T->parse('output', 'page'); $retval .= $T->finish($T->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
} if ($A['notify_once'] == 1) { $notifyonce_yes = 'checked="checked"'; $notifyonce_no = ''; } else { $notifyonce_yes = ''; $notifyonce_no = 'checked="checked"'; } if ($A['showiframe'] == 1) { $showiframe_yes = 'checked="checked"'; $showiframe_no = ''; } else { $showiframe_no = 'checked="checked"'; $showiframe_yes = ''; } $usersettings = COM_newTemplate(CTL_plugin_templatePath('forum', 'userprefs')); $usersettings->set_file(array('usersettings' => 'user_settings.thtml')); $usersettings->set_var('phpself', $_CONF['site_url'] . '/forum/userprefs.php'); $usersettings->set_var('LANG_feature', $LANG_GF01['FEATURE']); $usersettings->set_var('LANG_setting', $LANG_GF01['SETTING']); $usersettings->set_var('LANG_save', $LANG_GF01['SAVE']); $usersettings->set_var('topicsperpage', $A['topicsperpage']); $usersettings->set_var('postsperpage', $A['postsperpage']); $usersettings->set_var('newperpage', $A['newperpage']); $usersettings->set_var('popularperpage', $A['popularperpage']); $usersettings->set_var('popularlimit', $A['popularlimit']); $usersettings->set_var('searchperpage', $A['searchlines']); $usersettings->set_var('membersperpage', $A['membersperpage']); $usersettings->set_var('viewanonposts', $A['viewanonposts']); $usersettings->set_var('viewanonposts_yes', $viewanonposts_yes); $usersettings->set_var('viewanonposts_no', $viewanonposts_no);