/** * Callback to add filters on top of the result set * * @param Form */ function filter_regions(&$Form) { load_class('regional/model/_country.class.php', 'Country'); $CountryCache =& get_CountryCache(NT_('All')); $Form->select_country('c', get_param('c'), $CountryCache, T_('Country'), array('allow_none' => true)); $Form->text('s', get_param('s'), 30, T_('Search'), '', 255); }
/** * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX. * * @return tempcode The snippet */ function run() { $type = get_param('type'); if (!has_zone_access(get_member(), 'adminzone')) { return new ocp_tempcode(); } decache('main_staff_checklist'); require_lang('staff_checklist'); switch ($type) { case 'add': $recurinterval = get_param_integer('recurinterval', 0); $task_title = get_param('tasktitle', false, true); $id = $GLOBALS['SITE_DB']->query_insert('customtasks', array('tasktitle' => $task_title, 'datetimeadded' => time(), 'recurinterval' => $recurinterval, 'recurevery' => get_param('recurevery'), 'taskisdone' => NULL), true); require_code('notifications'); $subject = do_lang('CT_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $task_title); $mail = do_lang('CT_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($task_title)); dispatch_notification('checklist_task', NULL, $subject, $mail); return do_template('BLOCK_MAIN_STAFF_CHECKLIST_CUSTOM_TASK', array('TASKTITLE' => comcode_to_tempcode(get_param('tasktitle', false, true)), 'DATETIMEADDED' => display_time_period(time()), 'RECURINTERVAL' => $recurinterval == 0 ? '' : integer_format($recurinterval), 'RECUREVERY' => get_param('recurevery'), 'TASKDONE' => 'not_completed', 'ID' => strval($id))); case 'delete': $GLOBALS['SITE_DB']->query_delete('customtasks', array('id' => get_param_integer('id')), '', 1); break; case 'mark_done': $GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => time()), array('id' => get_param_integer('id')), '', 1); break; case 'mark_undone': $GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => NULL), array('id' => get_param_integer('id')), '', 1); break; } return new ocp_tempcode(); }
function _b_wp_archives_monthly_show($options, $wp_num = '') { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] == 0 ? false : true; $tpl_file = empty($options[2]) ? 'wp_archives_monthly.html' : $options[2]; $sel_value = ''; if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'm', 'string', ''); init_param('GET', 'year', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'day', 'integer', ''); if (strlen(get_param('m')) == 6) { $sel_value = get_param('m'); } else { if (test_param('year') && test_param('monthnum') && !test_param('day')) { $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2); } } } $block['wp_num'] = $wp_num; $block['divid'] = 'wpArchive' . $wp_num; $block['siteurl'] = wp_siteurl(); $block['style'] = block_style_get(false); $block['block_style'] = $block_style; $block['with_count'] = $with_count; $now = current_time('mysql'); $postHandler =& wp_handler('Post'); $criteria =& new CriteriaCompo(new Criteria('post_date', $now, '<')); $criteria->add(new Criteria('post_status', 'publish')); $criteria->setSort('post_date'); $criteria->setOrder('DESC'); $criteria->setGroupby('YEAR(post_date), MONTH(post_date)'); $postObjects =& $postHandler->getObjects($criteria, false, 'DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts'); $block['records'] = array(); if ($postObjects) { foreach ($postObjects as $postObject) { $this_year = $postObject->getExtraVar('year'); $this_month = $postObject->getExtraVar('month'); $_record['url'] = get_month_link($this_year, $this_month); $_record['text'] = format_month($this_year, $GLOBALS['month'][zeroise($this_month, 2)]); if ($with_count) { $_record['count'] = ' (' . $postObject->getExtraVar('posts') . ')'; } else { $_record['count'] = ''; } $_record['select'] = $sel_value == $this_year . zeroise($this_month, 2) ? 'selected="selected"' : ''; $block['records'][] = $_record; } } $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); if (!$_wpTpl->tpl_exists($tpl_file)) { $tpl_file = 'wp_archives_monthly.html'; } $block['content'] = $_wpTpl->fetch($tpl_file); return $block; }
/** * Standard function to create the standardised category tree * * @param ID_TEXT Notification code * @param ?ID_TEXT The ID of where we're looking under (NULL: N/A) * @return array Tree structure */ function create_category_tree($notification_code, $id) { $pagelinks = array(); $notification_category = get_param('id', NULL); $done_in_url = is_null($notification_category); $types = $GLOBALS['SITE_DB']->query_select('chat_buddies', array('member_liked'), array('member_likes' => get_member())); // Only show options for friends to simplify $types2 = $GLOBALS['SITE_DB']->query_select('notifications_enabled', array('l_code_category'), array('l_notification_code' => substr($notification_code, 0, 80), 'l_member_id' => get_member())); // Already monitoring members who may not be friends foreach ($types2 as $type) { $types[] = array('member_liked' => intval($type['l_code_category'])); } foreach ($types as $type) { $username = $GLOBALS['FORUM_DRIVER']->get_username($type['member_liked']); if (!is_null($username)) { $pagelinks[$type['member_liked']] = array('id' => strval($type['member_liked']), 'title' => $username); if (!$done_in_url) { if (strval($type['member_liked']) == $notification_category) { $done_in_url = true; } } } } if (!$done_in_url) { $pagelinks[] = array('id' => $notification_category, 'title' => $GLOBALS['FORUM_DRIVER']->get_username(intval($notification_category))); } global $M_SORT_KEY; $M_SORT_KEY = 'title'; usort($pagelinks, 'multi_sort'); return array_values($pagelinks); }
/** * Backdoor handler. Can only be activated by those with FTP write-access. * * @return MEMBER The member to simulate */ function restricted_manually_enabled_backdoor() { global $IS_A_COOKIE_LOGIN; $IS_A_COOKIE_LOGIN = true; $ks = get_param('keep_su', NULL); if (!is_null($ks)) { $GLOBALS['IS_ACTUALLY_ADMIN'] = true; $su = $GLOBALS['FORUM_DRIVER']->get_member_from_username($ks); if (!is_null($su)) { return $su; } elseif (is_numeric($ks)) { return intval($ks); } } $members = $GLOBALS['FORUM_DRIVER']->member_group_query($GLOBALS['FORUM_DRIVER']->get_super_admin_groups(), 1); if (count($members) != 0) { $ret = $GLOBALS['FORUM_DRIVER']->pname_id($members[key($members)]); $GLOBALS['FORUM_DRIVER']->ocf_flood_control($ret); } else { $ret = $GLOBALS['FORUM_DRIVER']->get_guest_id() + 1; } require_code('users_inactive_occasionals'); create_session($ret, 1); return $ret; }
/** * Standard aed_module table function. * * @param array Details to go to build_url for link to the next screen. * @return array A quartet: The choose table, Whether re-ordering is supported from this screen, Search URL, Archive URL. */ function nice_get_choose_table($url_map) { require_code('templates_results_table'); $current_ordering = get_param('sort', 't_title ASC', true); if (strpos($current_ordering, ' ') === false) { warn_exit(do_lang_tempcode('INTERNAL_ERROR')); } list($sortable, $sort_order) = explode(' ', $current_ordering, 2); $sortables = array('t_title' => do_lang_tempcode('TITLE')); if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) { log_hack_attack_and_exit('ORDERBY_HACK'); } global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'sort'; $header_row = results_field_title(array(do_lang_tempcode('TITLE'), do_lang_tempcode('ACTIONS')), $sortables, 'sort', $sortable . ' ' . $sort_order); $fields = new ocp_tempcode(); require_code('form_templates'); list($rows, $max_rows) = $this->get_entry_rows(false, $current_ordering); foreach ($rows as $row) { $edit_link = build_url($url_map + array('id' => $row['id']), '_SELF'); $fields->attach(results_entry(array($row['t_title'], protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . strval($row['id'])))), true)); } $search_url = NULL; $archive_url = NULL; return array(results_table(do_lang($this->menu_label), get_param_integer('start', 0), 'start', either_param_integer('max', 20), 'max', $max_rows, $header_row, $fields, $sortables, $sortable, $sort_order), false, $search_url, $archive_url); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('bookmarks'); require_code('bookmarks'); require_css('bookmarks'); if (is_guest()) { access_denied('NOT_AS_GUEST'); } // Decide what we're doing $type = get_param('type', 'misc'); if ($type == 'misc') { return $this->manage_bookmarks(); } if ($type == '_manage') { return $this->_manage_bookmarks(); } if ($type == '_edit') { return $this->_edit_bookmark(); } if ($type == 'ad') { return $this->ad(); } if ($type == '_ad') { return $this->_ad(); } return new ocp_tempcode(); }
function MasterObject(&$config) { if (!$config['widget_enable']) { $msg = 'Widget功能没有启用'; if (get_param('in_ajax')) { widget_error($msg); } else { exit($msg); } } $this->Config = $config; $this->Get =& $_GET; $this->Post =& $_POST; $this->Module = get_param('mod'); $this->Code = get_param('code'); $this->DatabaseHandler =& Obj::registry('DatabaseHandler'); $this->MemberHandler = jclass('member'); $this->MemberHandler->init(); if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { widget_error($this->MemberHandler->GetError(), 203); } Obj::register("MemberHandler", $this->MemberHandler); define("FORMHASH", substr(md5(substr(time(), 0, -4) . $this->Config['auth_key']), 0, 16)); if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($this->Post["FORMHASH"] != FORMHASH) { } } }
function DoClean() { $type = get_param('type'); if (!$type) { $this->Messager("请先选择要清理的缓存对象"); } $this->_removeTopicAttach(); $this->_removeTopicLongtext(); $this->_removeVoteImage(); if (in_array('data', $type)) { cache_db('clear'); jtable('failedlogins')->truncate(); DB::query("update " . TABLE_PREFIX . "members set `username`=`uid` WHERE `username`!=`uid` AND `username` REGEXP '^[0-9]*\$'"); } if (in_array('tpl', $type)) { cache_clear(); jconf::set('validate_category', array()); jlogic('credits')->rule_conf(true); } if (in_array('channel', $type)) { jlogic('channel')->update_data(); } if (in_array('album', $type)) { jlogic('image')->update_data(); } $this->Messager("已清空所有缓存"); }
/** * Get a netlink block / direct to a netlink site. * * @param URLPATH The URL we grab our netlink from. If this is not blank, instead of getting a netlink block, we direct to a netlink site. * @return tempcode The netlink block */ function do_netlink($redir_url = '') { header('Content-type: text/plain; charset=' . get_charset()); // If we are redirecting if ($redir_url != '') { if (strpos($redir_url, chr(10)) !== false || strpos($redir_url, chr(13)) !== false) { log_hack_attack_and_exit('HEADER_SPLIT_HACK'); } header('Location: ' . $redir_url); exit; } // Ok we're displaying a netlink, which will be dumped right into the body of the reading site // - this isn't actually a weburl that is actually displayed, its loaded by ocPortal and embedded-inline // For all the names in our network require_code('textfiles'); $lines = explode(chr(10), read_text_file('netlink', NULL, true)); if (count($lines) == 0) { return new ocp_tempcode(); } $content = new ocp_tempcode(); foreach ($lines as $line) { $parts = explode('=', $line, 2); if (count($parts) != 2) { continue; } $name = rtrim($parts[0]); $url = trim($parts[1]); // Are we looking at the source site in the network? $selected = strtolower($url) == strtolower(get_param('source', '')); $content->attach(form_input_list_entry(base64_encode($url), $selected, $name)); } return do_template('NETLINK', array('_GUID' => '180321222dc5dc99a231597c803f0726', 'CONTENT' => $content)); }
/** * Standard modular run function. * * @param array A map of parameters. * @return tempcode The result of execution. */ function run($map) { // The counter we're using $name = array_key_exists('param', $map) ? $map['param'] : ''; if ($name == '-') { $name = get_page_name() . ':' . get_param('type', 'misc') . ':' . get_param('id', ''); } if ($name == '') { $name = 'hits'; } $start = array_key_exists('start', $map) ? intval($map['start']) : 0; // Set it if it's not already $_current_value = get_value($name); if (is_null($_current_value)) { set_value($name, strval($start)); $current_value = $start; } else { $current_value = intval($_current_value); if ($start > $current_value) { $current_value = $start; set_value($name, strval($current_value)); } } // Hit counter? $hit_count = array_key_exists('hit_count', $map) ? intval($map['hit_count']) : 1; if ($hit_count == 1) { update_stat($name, 1); } return do_template('MAIN_COUNT', array('NAME' => $name, 'VALUE' => strval($current_value))); }
public function setOperName($uid, $full) { $parts = explode(' ', $full); $res = 0; $this->select('UPDATE oper.users SET lname = :ln, fname = :fn, pname = :pn WHERE id = :uid', ['uid' => $uid, 'ln' => get_param($parts, 0), 'fn' => get_param($parts, 1), 'pn' => get_param($parts, 2)], $res); return $res > 0; }
/** * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX. * * @return tempcode The snippet */ function run() { if (get_option('is_on_rating') == '0') { return do_lang_tempcode('INTERNAL_ERROR'); } // Has there actually been any rating? if (strtoupper(ocp_srv('REQUEST_METHOD')) == 'POST' || ocp_srv('HTTP_REFERER') == '') { $rating = either_param_integer('rating', NULL); } else { $rating = post_param_integer('rating'); // Will fail } $content_type = get_param('content_type'); $type = get_param('type', ''); $content_id = get_param('id'); $content_url = get_param('content_url', '', true); $content_title = get_param('content_title', '', true); require_code('feedback'); actualise_specific_rating($rating, get_page_name(), get_member(), $content_type, $type, $content_id, $content_url, $content_title); actualise_give_rating_points(); $template = get_param('template', NULL); if ($template !== '') { if (is_null($template)) { $template = 'RATING_BOX'; } return display_rating($content_url, $content_title, $content_type, $content_id, $template); } return do_lang_tempcode('THANKYOU_FOR_RATING_SHORT'); }
function auth_set($member_id, $oauth_url) { require_lang('twitter'); require_code('twitter'); $api_key = get_option('twitter_api_key', true); $api_secret = get_option('twitter_api_secret', true); $twitter = new Twitter($api_key, $api_secret); if (get_param_integer('oauth_in_progress', 0) == 0) { $response = $twitter->oAuthRequestToken($oauth_url->evaluate()); $twitter->oAuthAuthorize($response['oauth_token']); exit; } $response = $twitter->oAuthAccessToken(get_param('oauth_token'), get_param('oauth_verifier')); if (!isset($response['oauth_token'])) { attach_message(do_lang_tempcode('TWITTER_OAUTH_FAIL', escape_html($response['message'])), 'warn'); return false; } $save_to = 'twitter_oauth_token'; if (!is_null($member_id)) { $save_to .= '__' . strval($member_id); } set_long_value($save_to, $response['oauth_token']); $save_to = 'twitter_oauth_token_secret'; if (!is_null($member_id)) { $save_to .= '__' . strval($member_id); } set_long_value($save_to, $response['oauth_token_secret']); return true; }
public function actionIndex() { $this->render('', false); $uid = get_param($this->authdata, 'id'); // Если не авторизованы то идет лесом if (!$uid) { $this->redirect('/login/'); } // иначе получим список доступных ему сайтов, и нарисуем ссылки на них $sites = $this->model->getGrantedSites($uid); $this->render('', false); if (count($sites) === 0) { $this->render('no-sites'); return; } $this->data['siteList'] = ''; $secure = [$uid, date('Y-m-d H:i:s'), get_param($this->authdata, 'fullname')]; foreach ($sites as $item) { $link = get_param($item, 'link'); $name = get_param($item, 'sitename'); $key = get_param($item, 'passkey'); $cipherText = Cipher::encode($secure, $key, true); $cipherText = strtr($cipherText, '+/=', '-,_'); $link .= "auth/openid/"; if (strpos($link, 'oper') !== false) { $link .= 'token/'; } $link .= $cipherText; $this->data['siteList'] .= CHtml::createLink($name, null, ['href' => $link, 'class' => 'list-group-item strong italic']); } $this->render('panel', false); $this->render(''); }
function MasterObject(&$config, $auto_run = false) { if (!$config['wap']) { include ROOT_PATH . 'wap/include/error_wap.php'; exit; } $this->Config = $config; require_once ROOT_PATH . 'wap/include/func/wap_global.func.php'; $this->Get =& $_GET; $this->Post =& $_POST; $this->Module = get_param('mod'); $this->Code = get_param('code'); $this->DatabaseHandler =& Obj::registry('DatabaseHandler'); $this->MemberHandler = jclass('member'); $this->MemberHandler->init(); if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { $member_error = $this->MemberHandler->GetError(); $member_error = array_iconv($this->Config['charset'], 'utf-8', $member_error); $this->Messager($member_error, null); } if (!in_array($this->Module, array('member', 'login', 'other'))) { $visit_rets = $this->MemberHandler->visit(); if ($visit_rets['error']) { $this->Messager(null, 'index.php?mod=login&referer=' . urlencode('index.php?' . $_SERVER['QUERY_STRING'])); } } $this->Title = $this->MemberHandler->CurrentAction['name']; Obj::register("MemberHandler", $this->MemberHandler); if ($this->auto_run || $auto_run) { $this->auto_run(); } }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { global $Messages, $localtimenow; // Group ID param('ivc_grp_ID', 'integer'); param_check_not_empty('ivc_grp_ID', T_('Please select a group')); $this->set_from_Request('grp_ID', 'ivc_grp_ID', true); // Code param('ivc_code', 'string'); param_check_not_empty('ivc_code', T_('You must provide an invitation code!')); param_check_regexp('ivc_code', '#^[A-Za-z0-9\\-_]{3,32}$#', T_('Invitation code must be from 3 to 32 letters, digits or signs "-", "_".')); $this->set_from_Request('code', 'ivc_code'); // Expire date if (param_date('ivc_expire_date', T_('Please enter a valid date.'), true) && param_time('ivc_expire_time')) { // If date and time were both correct we may set the 'expire_ts' value $this->set('expire_ts', form_date(get_param('ivc_expire_date'), get_param('ivc_expire_time'))); } // Source param('ivc_source', 'string'); $this->set_from_Request('source', 'ivc_source', true); if (mysql2timestamp($this->get('expire_ts')) < $localtimenow) { // Display a warning if date is expired $Messages->add($this->ID == 0 ? T_('Note: The newly created invitation code is already expired') : T_('Note: The updated invitation code is already expired'), 'warning'); } return !param_errors_detected(); }
/** * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX. * * @return tempcode The snippet */ function run() { $sup = get_param('block_map_sup', '', true); $_map = get_param('block_map', false, true); if ($sup != '') { $_map .= ',' . $sup; } require_code('blocks'); $map = block_params_str_to_arr($_map); if (!array_key_exists('block', $map)) { return new ocp_tempcode(); } $auth_key = get_param_integer('auth_key'); // Check permissions $test = $GLOBALS['SITE_DB']->query_value_null_ok('temp_block_permissions', 'p_block_constraints', array('p_session_id' => get_session_id(), 'id' => $auth_key)); if (is_null($test) || !block_signature_check(block_params_str_to_arr($test), $map)) { require_lang('permissions'); return paragraph(do_lang_tempcode('ACCESS_DENIED__ACCESS_DENIED', escape_html($map['block']))); } // Cleanup $GLOBALS['SITE_DB']->query('DELETE FROM ' . get_table_prefix() . 'temp_block_permissions WHERE p_time<' . strval(time() - 60 * 60 * intval(get_option('session_expiry_time')))); // Return block snippet global $CSSS, $JAVASCRIPTS; $CSSS = array(); $JAVASCRIPTS = array(); $out = new ocp_tempcode(); $out->attach(symbol_tempcode('CSS_TEMPCODE')); $out->attach(symbol_tempcode('JS_TEMPCODE')); $out->attach(do_block($map['block'], $map)); return $out; }
/** * Redirect the user - transparently, storing a message that will be shown on their destination page. * * @param tempcode Title to display on redirect page * @param mixed Destination URL (may be Tempcode) * @param mixed Message to show (may be Tempcode) * @param boolean For intermediatory hops, don't mark so as to read status messages - save them up for the next hop (which will not be intermediatory) * @param ID_TEXT Code of message type to show * @set warn inform fatal * @return tempcode Redirection message (likely to not actually be seen due to instant redirection) */ function _redirect_screen($title, $url, $text, $intermediatory_hop = false, $msg_type = 'inform') { if (is_object($url)) { $url = $url->evaluate(); } global $FORCE_META_REFRESH, $ATTACHED_MESSAGES_RAW; $special_page_type = get_param('special_page_type', 'view'); if ($special_page_type == 'view' && $GLOBALS['NON_PAGE_SCRIPT'] == 0 && !headers_sent() && !$FORCE_META_REFRESH) { foreach ($ATTACHED_MESSAGES_RAW as $message) { $GLOBALS['SITE_DB']->query_insert('messages_to_render', array('r_session_id' => get_session_id(), 'r_message' => is_object($message[0]) ? $message[0]->evaluate() : escape_html($message[0]), 'r_type' => $message[1], 'r_time' => time())); } $_message = is_object($text) ? $text->evaluate() : escape_html($text); if ($_message != '' && (count($ATTACHED_MESSAGES_RAW) == 0 || $_message != do_lang('SUCCESS') && $_message != do_lang('REDIRECTING'))) { $GLOBALS['SITE_DB']->query_insert('messages_to_render', array('r_session_id' => get_session_id(), 'r_message' => $_message, 'r_type' => $msg_type, 'r_time' => time())); } if (!$intermediatory_hop) { $hash_pos = strpos($url, '#'); if ($hash_pos !== false) { $hash_bit = substr($url, $hash_pos); $url = substr($url, 0, $hash_pos); } else { $hash_bit = ''; } $url .= (strpos($url, '?') === false ? '?' : '&') . 'redirected=1' . $hash_bit; } } require_code('site2'); assign_refresh($url, 0.0); return do_template('REDIRECT_SCREEN', array('_GUID' => '44ce3d1ffc6536b299ed0944e8ca7253', 'URL' => $url, 'TITLE' => $title, 'TEXT' => $text)); }
function _b_wp_calendar_show($option, $wp_num = "") { if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'p', 'integer', ''); init_param('GET', 'm', 'integer', ''); init_param('GET', 'w', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'year', 'integer', ''); if (test_param('p') && !(test_param('m') || test_param('monthnum') || test_param('w'))) { $postHandler =& wp_handler('Post'); $postObject =& $postHandler->get(get_param('p')); if ($postObject) { $GLOBALS['m'] = mysql2date('Ym', $postObject->getVar('post_date')); } } } $block['wp_num'] = $wp_num; $block['divid'] = 'wpCalendar' . $wp_num; $block['style'] = block_style_get(false); $block['calendar'] = get_calendar(1, false); $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); $block['content'] = $_wpTpl->fetch('wp_calendar.html'); return $block; }
/** * Extend breadcrumbs for the Admin Zone (called by breadcrumbs_get_default_stub). * * @param tempcode Reference to the breadcrumbs stub we're assembling */ function adminzone_extend_breadcrumbs(&$stub) { global $BREADCRUMB_SET_PARENTS; if (count($BREADCRUMB_SET_PARENTS) > 0 && !is_object($BREADCRUMB_SET_PARENTS[0][0])) { // Works by finding where our oldest ancestor connects on to the do-next menus, and carries from there list($zone, $attributes, ) = page_link_decode($BREADCRUMB_SET_PARENTS[0][0]); $type = array_key_exists('type', $attributes) ? $attributes['type'] : 'misc'; $page = $attributes['page']; if ($page == '_SELF') { $page = get_page_name(); } if ($zone == '_SEARCH') { $zone = get_module_zone($page); } if ($zone == '_SELF') { $zone = get_zone_name(); } } else { // Works by finding where we connect on to the do-next menus, and carries from there $type = get_param('type', 'misc'); $page = get_page_name(); $zone = get_zone_name(); } if ($page != 'admin' && $page != 'cms') { // Loop over menus, hunting for connection $hooks = find_all_hooks('systems', 'do_next_menus'); $_hooks = array(); $page_looking = $page; $page_looking = preg_replace('#^(cms|admin)\\_#', '', $page_looking); if (array_key_exists($page_looking, $hooks)) { $_hooks[$page_looking] = $hooks[$page_looking]; unset($hooks[$page_looking]); $hooks = array_merge($_hooks, $hooks); } foreach ($hooks as $hook => $sources_dir) { $run_function = extract_module_functions(get_file_base() . '/' . $sources_dir . '/hooks/systems/do_next_menus/' . $hook . '.php', array('run')); if ($run_function[0] !== NULL) { $info = is_array($run_function[0]) ? call_user_func_array($run_function[0][0], $run_function[0][1]) : eval($run_function[0]); foreach ($info as $i) { if ($i === NULL) { continue; } if ($page == $i[2][0] && (!array_key_exists('type', $i[2][1]) && $type == 'misc' || array_key_exists('type', $i[2][1]) && ($type == $i[2][1]['type'] || $i[2][1]['type'] == 'misc')) && $zone == $i[2][2]) { if ($i[0] == 'cms') { $url = build_url(array('page' => 'cms', 'type' => $i[0] == 'cms' ? NULL : $i[0]), 'cms'); } else { $url = build_url(array('page' => 'admin', 'type' => $i[0]), 'adminzone'); } require_lang('menus'); require_lang('security'); $stub->attach(hyperlink($url, do_lang_tempcode(strtoupper($i[0])), false, false, do_lang_tempcode('GO_BACKWARDS_TO', @html_entity_decode(strip_tags(do_lang(strtoupper($i[0]))), ENT_QUOTES, get_charset())))); //if ((!array_key_exists('type',$i[2][1])) || ($type==$i[2][1]['type'])) break; return; } } } } } }
/** * Standard module run function. * * @return tempcode The output of the run */ function run() { $type = get_param('type', 'adverts'); if ($type == 'adverts') { return $this->adverts(); } return new ocp_tempcode(); }
/** * Get special SQL from POSTed parameters for this field. * * @param array The row for the field to input * @param integer We're processing for the ith row * @return ?array Tuple of SQL details (array: extra trans fields to search, array: extra plain fields to search, string: an extra table segment for a join, string: the name of the field to use as a title, if this is the title, extra WHERE clause stuff) (NULL: nothing special) */ function inputted_to_sql_for_search($row, $i) { $param = get_param('option_' . strval($row['id']), ''); if ($param != '') { $param = strval($GLOBALS['FORUM_DRIVER']->get_member_from_username($param)); } return exact_match_sql($row, $i, 'long', $param); }
/** * Callback to make post type name depending on post type id */ function get_name_for_itemtype($ityp_ID, $name) { global $admin_url, $edited_Item, $from_tab; $current = $edited_Item->ityp_ID == $ityp_ID ? ' ' . T_('(current)') : ''; $from_tab_param = empty($from_tab) ? '' : '&from_tab=' . $from_tab; $duplicated_item_param = get_param('p') > 0 ? '&p=' . get_param('p') : ''; return '<strong><a href="' . $admin_url . '?ctrl=items&action=update_type&post_ID=' . $edited_Item->ID . '&ityp_ID=' . $ityp_ID . $from_tab_param . $duplicated_item_param . '&' . url_crumb('item') . '">' . $name . '</a></strong>' . $current; }
/** * Callback to add filters on top of the result set * * @param Form */ function filter_goals(&$Form) { $Form->checkbox_basic_input('final', get_param('final'), T_('Final only') . ' •'); $Form->text('s', get_param('s'), 30, T_('Search'), '', 255); $GoalCategoryCache =& get_GoalCategoryCache(NT_('All')); $GoalCategoryCache->load_all(); $Form->select_input_object('cat', get_param('cat'), $GoalCategoryCache, T_('Category'), array('allow_none' => true)); }
/** * Callback to add filters on top of the result set * * @param Form */ function filter_recipients(&$Form) { global $perm_abuse_management; $Form->text('s', get_param('s'), 20, T_('Search'), '', 255); $Form->text('u', get_param('u'), 10, T_('User'), '', 255); if (!$perm_abuse_management) { $Form->checkbox('show_closed', get_param('show_closed'), T_('Show closed conversations')); } }
public function getPerson($tabnom) { $res = $this->select(' SELECT p.id, p.fullname, g.pwdhash, ifnull(g.deny, 0) deny FROM personal p LEFT JOIN person_grant g ON p.id = g.person_id AND g.deleted = 0 WHERE p.id = :uid AND p.deleted = 0', ['uid' => $tabnom]); return get_param($res, 0); }
/** * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX. * * @return tempcode The snippet */ function run() { $val = get_param('name'); $test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_invites', 'i_email_address', array('i_email_address' => $val, 'i_taken' => 0)); if (!is_null($test)) { return new ocp_tempcode(); } return make_string_tempcode(str_replace(array('‘', '’', '“', '”'), array('"', '"', '"', '"'), html_entity_decode(do_lang('NO_INVITE'), ENT_QUOTES))); }
/** * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX. * * @return tempcode The snippet */ function run() { $val = get_param('name'); $test = $GLOBALS['SITE_DB']->query_value_null_ok('banner_types', 'id', array('id' => $val)); if (is_null($test)) { return new ocp_tempcode(); } return make_string_tempcode(str_replace(array('‘', '’', '“', '”'), array('"', '"', '"', '"'), html_entity_decode(do_lang('ALREADY_EXISTS', escape_html($val)), ENT_QUOTES))); }
/** * Standard modular run function. * * @param array A map of parameters. * @return tempcode The result of execution. */ function run($map) { unset($map); require_all_lang(); require_css('adminzone'); require_code('actionlog'); $start = get_param_integer('sa_start', 0); $max = get_param_integer('sa_max', 10); $sortables = array('date_and_time' => do_lang_tempcode('DATE_TIME'), 'the_type' => do_lang_tempcode('ACTION')); $test = explode(' ', get_param('sa_sort', 'date_and_time DESC'), 2); if (count($test) == 1) { $test[1] = 'DESC'; } list($sortable, $sort_order) = $test; if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) { log_hack_attack_and_exit('ORDERBY_HACK'); } global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'sa_sort'; require_code('templates_results_table'); $fields_title = results_field_title(array(do_lang_tempcode('USERNAME'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('ACTION'), do_lang_tempcode('PARAMETER_A'), do_lang_tempcode('PARAMETER_B')), $sortables, 'sa_sort', $sortable . ' ' . $sort_order); $max_rows = $max; //Don't want to encourage pagination (there's a better module they can go to) $GLOBALS['SITE_DB']->query_value('adminlogs','COUNT(*)'); $rows = $GLOBALS['SITE_DB']->query_select('adminlogs', array('the_type', 'param_a', 'param_b', 'the_user', 'ip', 'date_and_time'), NULL, 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start); $fields = new ocp_tempcode(); foreach ($rows as $myrow) { $username = $GLOBALS['FORUM_DRIVER']->get_username($myrow['the_user']); if (is_null($username)) { $username = do_lang('UNKNOWN'); } $date = get_timezoned_date($myrow['date_and_time']); if (!is_null($myrow['param_a'])) { $a = $myrow['param_a']; } else { $a = ''; } if (!is_null($myrow['param_b'])) { $b = $myrow['param_b']; } else { $b = ''; } require_code('templates_interfaces'); $_a = tpl_crop_text_mouse_over($a, 8); $_b = tpl_crop_text_mouse_over($b, 15); $type_str = do_lang($myrow['the_type'], $_a, $_b, NULL, NULL, false); if (is_null($type_str)) { $type_str = $myrow['the_type']; } $test = actionlog_linkage($myrow['the_type'], $a, $b, $_a, $_b); if (!is_null($test)) { list($_a, $_b) = $test; } $ip = tpl_crop_text_mouse_over($myrow['ip'], 12); $fields->attach(results_entry(array(escape_html($username), escape_html($date), $type_str, $_a, $_b))); } return results_table(do_lang_tempcode('ACTIONS'), $start, 'sa_start', $max, 'sa_max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sa_sort', new ocp_tempcode(), NULL, NULL, 5); }