/** * Standard actualisation stage of pointstore item purchase. * * @return tempcode The UI */ function action_done() { $class = str_replace('hook_pointstore_', '', strtolower(get_class($this))); if (get_option('is_on_' . $class . '_buy') == '0') { return new ocp_tempcode(); } $topic_id = post_param_integer('select_topic_id', -1); if ($topic_id == -1) { $_topic_id = post_param('manual_topic_id'); $topic_id = intval($_topic_id); } $title = get_page_title('TOPIC_PINNING'); // Check points $cost = intval(get_option($class)); $points_left = available_points(get_member()); if ($points_left < $cost && !has_specific_permission(get_member(), 'give_points_self')) { return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left))); } // Actuate $GLOBALS['FORUM_DRIVER']->pin_topic($topic_id); require_code('points2'); charge_member(get_member(), $cost, do_lang('TOPIC_PINNING')); $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'TOPIC_PINNING', 'details' => strval($topic_id), 'details2' => '')); // Show message $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF'); return redirect_screen($title, $url, do_lang_tempcode('ORDER_GENERAL_DONE')); }
/** * Get a do-next manager for bookings. * * @return tempcode Booking do-next manager. */ function booking_do_next() { require_lang('calendar'); require_code('templates_donext'); require_code('fields'); return do_next_manager(get_page_title('BOOKINGS'), comcode_lang_string('DOC_BOOKING'), array(has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('bookable', array('_SELF', array('type' => 'ad'), '_SELF'), do_lang('ADD_BOOKABLE')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('bookable', array('_SELF', array('type' => 'ed'), '_SELF'), do_lang('EDIT_BOOKABLE')) : NULL, has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('supplement', array('_SELF', array('type' => 'av'), '_SELF'), do_lang('ADD_BOOKABLE_SUPPLEMENT')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('supplement', array('_SELF', array('type' => 'ev'), '_SELF'), do_lang('EDIT_BOOKABLE_SUPPLEMENT')) : NULL, has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('blacked', array('_SELF', array('type' => 'ac'), '_SELF'), do_lang('ADD_BOOKABLE_BLACKED')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('blacked', array('_SELF', array('type' => 'ec'), '_SELF'), do_lang('EDIT_BOOKABLE_BLACKED')) : NULL, has_specific_permission(get_member(), 'submit_highrange_content', 'cms_booking') ? array('booking', array('_SELF', array('type' => 'ab'), '_SELF'), do_lang('ADD_BOOKING')) : NULL, has_specific_permission(get_member(), 'edit_highrange_content', 'cms_booking') ? array('booking', array('_SELF', array('type' => 'eb'), '_SELF'), do_lang('EDIT_BOOKING')) : NULL, has_actual_page_access(get_member(), 'calendar') ? array('calendar', array('calendar', array('type' => 'misc', 'view' => 'month'), '_SEARCH'), do_lang('CALENDAR')) : NULL), do_lang('BOOKINGS')); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_javascript('javascript_realtime_rain'); require_javascript('javascript_ajax'); require_javascript('javascript_more'); require_lang('realtime_rain'); require_css('realtime_rain'); $title = get_page_title('REALTIME_RAIN'); if (!has_js()) { // Send them to the page permissions screen $url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF'); require_code('site2'); assign_refresh($url, 5.0); return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_REALTIME'))); } $GLOBALS['TEMPCODE_SETGET']['chrome_frame'] = make_string_tempcode('1'); if (browser_matches('ie6')) { attach_message(do_lang_tempcode('IE_OLD_PLEASE_UPGRADE'), 'warn'); } if (!has_js()) { // Send them to the stats screen $url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF'); require_code('site2'); assign_refresh($url, 5.0); return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_ADVANCED_SCREEN_REALTIME_RAIN'))); } $min_time = $GLOBALS['SITE_DB']->query_value('stats', 'MIN(date_and_time)'); if (is_null($min_time)) { $min_time = time(); } return do_template('REALTIME_RAIN_OVERLAY', array('MIN_TIME' => strval($min_time))); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('leader_board'); require_code('points'); require_css('points'); $title = get_page_title('POINT_LEADERBOARD'); $start_date = intval(get_option('leaderboard_start_date')); $weeks = $GLOBALS['SITE_DB']->query('SELECT DISTINCT date_and_time FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'leader_board WHERE date_and_time>=' . strval($start_date) . ' ORDER BY date_and_time DESC'); if (count($weeks) == 0) { warn_exit(do_lang_tempcode('NO_ENTRIES')); } $first_week = $weeks[count($weeks) - 1]['date_and_time']; $weeks = collapse_1d_complexity('date_and_time', $weeks); $out = new ocp_tempcode(); foreach ($weeks as $week) { $rows = collapse_2d_complexity('lb_member', 'lb_points', $GLOBALS['SITE_DB']->query_select('leader_board', array('lb_member', 'lb_points'), array('date_and_time' => $week))); $week_tpl = new ocp_tempcode(); foreach ($rows as $member => $points) { $points_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $member), get_module_zone('points')); $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member, false, true); $name = $GLOBALS['FORUM_DRIVER']->get_username($member); if (is_null($name)) { $name = do_lang('UNKNOWN'); } $week_tpl->attach(do_template('POINTS_LEADERBOARD_ROW', array('_GUID' => '6d323b4b5abea0e82a14cb4745c4af4f', 'POINTS_URL' => $points_url, 'PROFILE_URL' => $profile_url, 'POINTS' => integer_format($points), 'NAME' => $name, 'ID' => strval($member)))); } $nice_week = intval(($week - $first_week) / (7 * 24 * 60 * 60) + 1); $out->attach(do_template('POINTS_LEADERBOARD_WEEK', array('_GUID' => '3a0f71bf20f9098e5711e85cf25f6549', 'WEEK' => integer_format($nice_week), 'ROWS' => $week_tpl))); } return do_template('POINTS_LEADERBOARD_SCREEN', array('_GUID' => 'bab5f7b661435b83800532d3eebd0d54', 'TITLE' => $title, 'WEEKS' => $out)); }
/** * Get details for an ajax-tree-list of entries for the content covered by this search hook. * * @return array A pair: the hook, and the options */ function ajax_tree() { $catalogue_name = get_param('catalogue_name', ''); if ($catalogue_name == '') { @ob_end_clean(); $tree = nice_get_catalogues(NULL, true); if ($tree->is_empty()) { inform_exit(do_lang_tempcode('NO_ENTRIES')); } require_code('form_templates'); $fields = form_input_list(do_lang_tempcode('NAME'), '', 'catalogue_name', $tree, NULL, true); if (running_script('iframe')) { $post_url = get_self_url_easy(); } else { $post_url = get_self_url(false, false, NULL, false, true); } $submit_name = do_lang_tempcode('PROCEED'); $hidden = build_keep_post_fields(); $title = get_page_title('SEARCH'); $tpl = do_template('FORM_SCREEN', array('_GUID' => 'a2812ac8056903811f444682d45ee448', 'TARGET' => '_self', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => '', 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name)); $echo = globalise($tpl, NULL, '', true); $echo->evaluate_echo(); exit; } return array('choose_catalogue_category', array('catalogue_name' => $catalogue_name)); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('bulkupload'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/bulkuploadassistant'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_comcode'; $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_BULK_UPLOAD'); $title = get_page_title('BULK_UPLOAD'); $parameter = post_param('parameter', ''); require_code('form_templates'); if ($parameter == '') { $post_url = build_url(array('page' => '_SELF'), '_SELF'); $text = paragraph(do_lang_tempcode('BULK_UPLOAD_HELP')); $submit_name = do_lang_tempcode('BULK_UPLOAD'); $fields = form_input_line(do_lang_tempcode('DIRECTORY'), do_lang_tempcode('DIRECTORY_BULK'), 'parameter', 'uploads/attachments/' . date('Y-m-d', utctime_to_usertime()), true); return do_template('FORM_SCREEN', array('_GUID' => '77a2ca460745145d8a1d18cf24971fea', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'TITLE' => $title, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name)); } else { breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('BULK_UPLOAD')))); breadcrumb_set_self(do_lang_tempcode('_RESULTS')); $out = $this->do_dir(get_custom_file_base() . '/' . filter_naughty($parameter, true)); if ($out->is_empty()) { inform_exit(do_lang_tempcode('NO_FILES')); } return do_template('BULK_HELPER_RESULTS_SCREEN', array('_GUID' => '5d373553cf21a58f15006bd4e600a9ee', 'TITLE' => $title, 'RESULTS' => $out)); } }
/** * Standard actualisation stage of pointstore item purchase. * * @return tempcode The UI */ function action_done() { $class = str_replace('hook_pointstore_', '', strtolower(get_class($this))); if (get_option('is_on_' . $class . '_buy') == '0' || get_forum_type() != 'ocf') { return new ocp_tempcode(); } if ($GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_highlighted_name') == 1) { warn_exit(do_lang_tempcode('_ALREADY_HAVE')); } $title = get_page_title('NAME_HIGHLIGHTING'); post_param_integer('confirm'); // To make sure we're not being passed by a GET // Check points $cost = intval(get_option($class)); $points_left = available_points(get_member()); if ($points_left < $cost && !has_specific_permission(get_member(), 'give_points_self')) { return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left))); } // Actuate $GLOBALS['FORUM_DB']->query_update('f_members', array('m_highlighted_name' => 1), array('id' => get_member()), '', 1); require_code('points2'); charge_member(get_member(), $cost, do_lang('NAME_HIGHLIGHTING')); $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'NAME_HIGHLIGHTING', 'details' => '', 'details2' => '')); // Show message $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF'); return redirect_screen($title, $url, do_lang_tempcode('ORDER_GENERAL_DONE')); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('unvalidated'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/unvalidated'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_censor'; $_title = get_page_title('UNVALIDATED_RESOURCES'); $out = new ocp_tempcode(); require_code('form_templates'); $_hooks = find_all_hooks('modules', 'admin_unvalidated'); foreach (array_keys($_hooks) as $hook) { require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook)); $object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true); if (is_null($object)) { continue; } $info = $object->info(); if (is_null($info)) { continue; } $identifier_select = is_array($info['db_identifier']) ? implode(',', $info['db_identifier']) : $info['db_identifier']; $db = array_key_exists('db', $info) ? $info['db'] : $GLOBALS['SITE_DB']; $rows = $db->query('SELECT ' . $identifier_select . (array_key_exists('db_title', $info) ? ',' . $info['db_title'] : '') . ' FROM ' . $db->get_table_prefix() . $info['db_table'] . ' WHERE ' . $info['db_validated'] . '=0', 100); $content = new ocp_tempcode(); foreach ($rows as $row) { if (is_array($info['db_identifier'])) { $id = ''; foreach ($info['db_identifier'] as $_id) { if ($id != '') { $id .= ':'; } $id .= $row[$_id]; } } else { $id = $row[$info['db_identifier']]; } if (array_key_exists('db_title', $info)) { $title = $row[$info['db_title']]; if ($info['db_title_dereference']) { $title = get_translated_text($title, $db); } // May actually be comcode (can't be certain), but in which case it will be shown as source } else { $title = '#' . (is_integer($id) ? strval($id) : $id); } if ($title == '') { $title = '#' . strval($id); } $content->attach(form_input_list_entry(is_integer($id) ? strval($id) : $id, false, strip_comcode($title))); } $post_url = build_url(array('page' => $info['edit_module'], 'type' => $info['edit_type'], 'validated' => 1), get_module_zone($info['edit_module']), NULL, false, true); $fields = form_input_list(do_lang_tempcode('EDIT'), do_lang_tempcode('DESCRIPTION_EDIT'), $info['edit_identifier'], $content); if (!$content->is_empty()) { // Could debate whether to include "'TARGET'=>'_blank',". However it does redirect back, so it's a nice linear process like this. If it was new window it could be more efficient, but also would confuse people with a lot of new windows opening and not closing. $content = do_template('FORM', array('_GUID' => '51dcee39273a0fee29569190344f2e41', 'GET' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('EDIT'), 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => '')); } $out->attach(do_template('UNVALIDATED_SECTION', array('_GUID' => '838240008e190b9cbaa0280fbddd6baf', 'TITLE' => $info['title'], 'CONTENT' => $content))); } return do_template('UNVALIDATED_SCREEN', array('_GUID' => '4e971f1c8851b821af030b5c7bbcb3fb', 'TITLE' => $_title, 'SECTIONS' => $out)); }
function plugin_qblog_recent_convert() { global $vars, $script, $qblog_page_re, $qblog_close; //閉鎖中は何も表示しない if ($qblog_close && !ss_admin_check()) { return ''; } //---- キャッシュのための処理を登録 ----- $qt = get_qt(); if ($qt->create_cache) { $args = func_get_args(); return $qt->get_dynamic_plugin_mark(__FUNCTION__, $args); } //------------------------------------ $display_num = PLUGIN_QBLOG_RECENT_DEFAULT_NUM; if (func_num_args()) { $args = func_get_args(); $display_num = $args[0]; } $recent_file = CACHEQBLOG_DIR . 'qblog_recent.dat'; if (file_exists($recent_file)) { $recent_list = explode("\n", file_get_contents($recent_file)); } else { $recent_list = array(); } //件数を抜く $size = array_shift($recent_list); $list = ''; $list .= '<ul class="qblog_recent">'; foreach ($recent_list as $i => $line) { if ($i >= $display_num) { break; } if (rtrim($line) != '') { $pagename = rtrim($line); $title = get_page_title($pagename); if ($pagename == $title) { if (preg_match($qblog_page_re, $pagename, $mts)) { $blog_date = "{$mts[1]}年{$mts[2]}月{$mts[3]}日"; $title = " No.{$mts[4]}"; } } //! 表示方法 要検討 $list .= '<li><a href="' . $script . '?' . rawurldecode($pagename) . '">' . $blog_date . $title . '</a></li>'; } } $list .= '</ul>'; if (!is_bootstrap_skin()) { $include_bs = ' <link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" /> <script type="text/javascript" src="skin/bootstrap/js/bootstrap.min.js"></script>'; $qt->appendv_once('include_bootstrap_pub', 'beforescript', $include_bs); } //qblog.css を読み込む $head = ' <link rel="stylesheet" href="plugin/qblog/qblog.css" />'; $qt->appendv_once('qblog_beforescript', 'beforescript', $head); return $list; }
/** * Show the current user a message. Function does not return. * * @param tempcode The message to show * @param ID_TEXT Code of message type to show * @set warn inform fatal */ function ocw_refresh_with_message($message, $msg_type = 'inform') { $url = build_url(array('page' => 'ocworld'), '_SELF'); @ob_end_clean(); $title = get_page_title('MESSAGE'); $tpl = redirect_screen($title, $url, $message, false, $msg_type); $echo = globalise($tpl, NULL, '', true); $echo->evaluate_echo(); exit; }
/** * Standard actualisation stage of pointstore item purchase. * * @return tempcode The UI */ function action_done() { $class = str_replace('hook_pointstore_', '', strtolower(get_class($this))); if (get_option('is_on_' . $class . '_buy') == '0') { return new ocp_tempcode(); } $amount = post_param_integer('amount', -1); $title = get_page_title('GAMBLING'); // Check points $cost = intval(get_option('minimum_gamble_amount')); $points_left = available_points(get_member()); $max = min(intval(get_option('maximum_gamble_amount')), $points_left); if (!has_specific_permission(get_member(), 'give_points_self') || $amount < 0) { if ($amount < $cost || $amount > $max) { warn_exit(do_lang_tempcode('INVALID_GAMBLE_AMOUNT')); } if ($points_left < $amount) { return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left))); } } // Calculate $average_gamble_multiplier = floatval(get_option('average_gamble_multiplier')) / 100.0; $maximum_gamble_multiplier = floatval(get_option('maximum_gamble_multiplier')) / 100.0; $above_average = mt_rand(0, 10) < 5; if ($above_average) { // $winnings=round($average_gamble_multiplier*$amount+mt_rand(0,round($maximum_gamble_multiplier*$amount-$average_gamble_multiplier*$amount))); Even distribution is NOT wise $peak = $maximum_gamble_multiplier * $amount; $under = 0.0; $number = intval(round($average_gamble_multiplier * $amount + mt_rand(0, intval(round($maximum_gamble_multiplier * $amount - $average_gamble_multiplier * $amount))))); for ($x = 1; $x < intval($peak); $x++) { $p = $peak * (1.0 / pow(floatval($x) + 0.4, 2.0) - 1.0 / pow($maximum_gamble_multiplier * floatval($amount), 2.0)); // Using a 1/x^2 curve. 0.4 is a bit of a magic number to get the averaging right $under += $p; if ($under > floatval($number)) { break; } } $winnings = intval(round($average_gamble_multiplier * $amount + $x * 1.1)); // 1.1 is a magic number to make it seem a bit fairer } else { $winnings = mt_rand(0, intval(round($average_gamble_multiplier * $amount))); } // Actuate require_code('points2'); charge_member(get_member(), $amount - $winnings, do_lang('GAMBLING')); $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'GAMBLING', 'details' => strval($amount), 'details2' => '')); // Show message if ($winnings > $amount) { $result = do_lang_tempcode('GAMBLE_CONGRATULATIONS', integer_format($winnings - $amount), integer_format($amount)); } else { $result = do_lang_tempcode('GAMBLE_COMMISERATIONS', integer_format($amount - $winnings), integer_format($amount)); } $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF'); return redirect_screen($title, $url, $result); }
/** * Do some tests, to make sure we're happy to continue importing. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from * @return ?tempcode Error/warning UI (NULL: no error/warning) */ function pre_import_tests($db, $table_prefix, $file_base) { $title = get_page_title('IMPORT'); $bad = false; // Check actually is ocPortal DB (ERROR) $test = $db->query_value('zones', 'zone_name'); if (is_null($test)) { return warn_screen($title, do_lang_tempcode('ERROR_NOT_CORRECT_DATABASE')); } // Check version (WARNING) $test = $db->query_value_null_ok('values', 'the_value', array('the_name' => 'version')); if (is_null($test) || intval($test) != ocp_version()) { attach_message(do_lang_tempcode('ERROR_NOT_CORRECT_VERSION'), 'warn'); $bad = true; } // Check actually is ocPortal file path (ERROR) if (!file_exists($file_base . '/info.php') || !file_exists($file_base . '/sources_custom')) { attach_message(do_lang_tempcode('ERROR_NOT_CORRECT_FILES'), 'warn'); if (isset($GLOBALS['FORUM_DB']) && $db->connection_write != $GLOBALS['FORUM_DB']->connection_write && !file_exists($file_base . '/info.php')) { attach_message(do_lang_tempcode('ERROR_NOT_CORRECT_LINKING_POSSIBLY'), 'warn'); } $bad = true; } // Check is on same MSN or is OCF (WARNING) if (file_exists($file_base . '/info.php')) { global $SITE_INFO; $backup_site_info = $SITE_INFO; $SITE_INFO = NULL; @(include $file_base . '/info.php'); if (is_null($SITE_INFO)) { $SITE_INFO = $backup_site_info; attach_message(do_lang_tempcode('ERROR_INACESSIBLE_DIR'), 'warn'); if (isset($GLOBALS['FORUM_DB']) && $db->connection_write != $GLOBALS['FORUM_DB']->connection_write) { attach_message(do_lang_tempcode('ERROR_NOT_CORRECT_LINKING_POSSIBLY'), 'warn'); } $bad = true; } else { $this_site_info = $SITE_INFO; $SITE_INFO = $backup_site_info; if (!array_key_exists('db_forums_host', $SITE_INFO)) { $SITE_INFO['db_forums_host'] = 'localhost'; } $same_forum = $this_site_info['db_forums'] == $SITE_INFO['db_forums'] && $this_site_info['db_forums_host'] == $SITE_INFO['db_forums_host'] && $db->table_prefix; if ($this_site_info['forum_type'] != 'ocf' && !$same_forum) { attach_message(do_lang_tempcode('ERROR_NOT_CORRECT_LINKING'), 'warn'); $bad = true; } } } // Show warning if ($bad) { return do_template('CONFIRM_SCREEN', array('_GUID' => '286928b79830cdff4ac506e4f4f00f3a', 'TITLE' => $title, 'PREVIEW' => do_lang_tempcode('IMPORT_WARNINGS_GIVEN'), 'FIELDS' => build_keep_post_fields(), 'URL' => get_self_url(false, false, array('happy' => 1)))); } return NULL; }
/** * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX. * * @return tempcode The snippet */ function run() { if (get_file_base() != get_custom_file_base()) { warn_exit(do_lang_tempcode('SHARED_INSTALL_PROHIBIT')); } if (has_actual_page_access(get_member(), 'admin_occle')) { require_code('occle'); require_lang('occle'); $title = get_page_title('OCCLE'); return do_template('OCCLE_MAIN', array('COMMANDS' => '', 'SUBMIT_URL' => build_url(array('page' => 'admin_occle'), 'adminzone'), 'PROMPT' => do_lang_tempcode('COMMAND_PROMPT', escape_html($GLOBALS['FORUM_DRIVER']->get_username(get_member()))))); } return new ocp_tempcode(); }
public function __construct() { parent::__construct(); $this->ecshop_init(); // 微信oauth处理 if (method_exists('WechatController', 'do_oauth')) { call_user_func(array('WechatController', 'do_oauth')); } /* 语言包 */ $this->assign('lang', L()); /* 页面标题 */ $page_info = get_page_title(); self::$view->assign('page_title', $page_info['title']); /* 模板赋值 */ assign_template(); }
function plugin_qblog_recent_comments_convert() { global $script, $qblog_date_format, $qblog_close; //閉鎖中は何も表示しない if ($qblog_close && !ss_admin_check()) { return ''; } //---- キャッシュのための処理を登録 ----- $qt = get_qt(); if ($qt->create_cache) { $args = func_get_args(); return $qt->get_dynamic_plugin_mark(__FUNCTION__, $args); } //------------------------------------ $args = func_get_args(); $nodate = in_array('nodate', $args); $datafile = CACHEQBLOG_DIR . 'qblog_recent_comments.dat'; $comment_page_lines = explode("\n", file_get_contents($datafile)); $comment_pages = array(); foreach ($comment_page_lines as $line) { if (trim($line) === '') { continue; } list($time, $pagename) = explode("\t", $line); if (is_page($pagename)) { $comment_pages[$pagename] = $time; } } //calc num show $num = func_num_args() > 0 ? min(func_get_arg(0), PLUGIN_QBLOG_RECENT_COMMENTS_DEFAULT_NUM) : PLUGIN_QBLOG_RECENT_COMMENTS_DEFAULT_NUM; $num = min(count($comment_pages), $num); $html_str = '<ul class="qblog_recent_comments">'; $cnt = 0; foreach ($comment_pages as $pagename => $time) { if ($cnt == PLUGIN_QBLOG_RECENT_COMMENTS_DEFAULT_NUM) { break; } $page_title = get_page_title($pagename); $page_title = ($nodate ? '' : date('m.d', $time) . ' ') . $page_title; $html_str .= '<li><a href="' . $script . '?' . rawurlencode($pagename) . '">' . h($page_title) . '</a></li>' . "\n"; $cnt++; } $html_str .= '</ul>'; return $html_str; }
/** * Render a member profile. * * @param MEMBER The ID of the member who is being viewed * @param ?MEMBER The ID of the member who is doing the viewing (NULL: current member) * @param ?ID_TEXT The username of the member who is being viewed (NULL: work out from member_id_of) * @return tempcode The rendered profile */ function render_profile_tabset($member_id_of, $member_id_viewing = NULL, $username = NULL) { if (is_null($member_id_viewing)) { $member_id_viewing = get_member(); } $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of); if (is_null($username) || is_guest($member_id_of)) { warn_exit(do_lang_tempcode('USER_NO_EXIST')); } $tabs = array(); $hooks = find_all_hooks('systems', 'profiles_tabs'); if (isset($hooks['edit'])) { $hooks = array('edit' => $hooks['edit']) + $hooks; } foreach (array_keys($hooks) as $hook) { require_code('hooks/systems/profiles_tabs/' . $hook); $ob = object_factory('Hook_Profiles_Tabs_' . $hook); if ($ob->is_active($member_id_of, $member_id_viewing)) { $tabs[$hook] = $ob->render_tab($member_id_of, $member_id_viewing, !browser_matches('ie6') && !browser_matches('ie7') && has_js()); } } global $M_SORT_KEY; $M_SORT_KEY = 2; uasort($tabs, 'multi_sort'); require_javascript('javascript_profile'); require_javascript('javascript_ajax'); load_up_all_self_page_permissions($member_id_viewing); if (addon_installed('awards')) { require_code('awards'); $awards = find_awards_for('member', strval($member_id_of)); } else { $awards = array(); } $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of); // Get it again, in case it changed $title = get_page_title('MEMBER_PROFILE', true, array(escape_html($username)), NULL, $awards); $_tabs = array(); $i = 0; foreach ($tabs as $hook => $tab) { $_tabs[] = array('TAB_TITLE' => $tab[0], 'TAB_CODE' => $hook, 'TAB_CONTENT' => $tab[1], 'TAB_FIRST' => $i == 0, 'TAB_LAST' => !array_key_exists($i + 1, $tabs)); $i++; } return do_template('OCF_MEMBER_PROFILE_SCREEN', array('TITLE' => $title, 'TABS' => $_tabs, 'MEMBER_ID' => strval($member_id_of))); }
function plugin_list_array($pages) { $qm = get_qm(); $symbol = ' '; $other = 'zz'; $list = array(); $cnd = 0; //並び替える foreach ($pages as $file => $page) { $pgdata = array(); $pgdata['urlencoded'] = rawurlencode($page); $pgdata['sanitized'] = htmlspecialchars($page, ENT_QUOTES); $pgdata['passage'] = get_pg_passage($page, FALSE); $pgdata['mtime'] = date('Y年m月d日 H時i分s秒', filemtime(get_filename($page))); $pgdata['title'] = get_page_title($page); $pgdata['title'] = $pgdata['title'] == $pgdata['sanitized'] ? '' : '(' . $pgdata['title'] . ')'; $pgdata['filename'] = htmlspecialchars($file); $head = preg_match('/^([A-Za-z])/', $page, $matches) ? $matches[1] : (preg_match('/^([ -~])/', $page, $matches) ? $symbol : $other); $list[$head][$page] = $pgdata; $cnt++; } ksort($list); $tmparr = isset($list[$symbol]) ? $list[$symbol] : null; unset($list[$symbol]); $list[$symbol] = $tmparr; $retlist = array(); foreach ($list as $head => $pages) { if (is_null($pages)) { continue; } ksort($pages); if ($head === $symbol) { $head = $qm->m['func']['list_symbol']; } else { if ($head === $other) { $head = $qm->m['func']['list_other']; } } $retlist[$head] = $pages; } return $retlist; }
/** * Get the form to add a bookmark / set breadcrumbs. * * @param mixed Where the form should go to * @return tempcode The form */ function add_bookmark_form($post_url) { $title = get_page_title('ADD_BOOKMARK'); require_lang('zones'); require_code('character_sets'); $url = base64_decode(get_param('url', '', true)); $url = convert_to_internal_encoding($url, 'UTF-8'); // Note that this is intentionally passed in to not be a short URL $page_link = convert_to_internal_encoding(url_to_pagelink($url, false, false), 'UTF-8'); $default_title = get_param('title', '', true); $default_title = convert_to_internal_encoding($default_title, 'UTF-8'); $default_title = preg_replace('#\\s.\\s' . str_replace('#', '\\#', preg_quote(get_site_name())) . '$#s', '', $default_title); $default_title = preg_replace('#^' . str_replace('#', '\\#', preg_quote(get_site_name())) . '\\s.\\s#s', '', $default_title); $default_title_2 = @preg_replace('#\\s.\\s' . str_replace('#', '\\#', preg_quote(get_site_name())) . '$#su', '', $default_title); $default_title_2 = @preg_replace('#^' . str_replace('#', '\\#', preg_quote(get_site_name())) . '\\s.\\s#su', '', $default_title_2); if ($default_title_2 !== false) { $default_title = $default_title_2; } if (!is_string($default_title)) { $default_title = ''; } require_code('form_templates'); $rows = $GLOBALS['SITE_DB']->query_select('bookmarks', array('DISTINCT b_folder'), array('b_owner' => get_member()), 'ORDER BY b_folder'); $list = new ocp_tempcode(); $list->attach(form_input_list_entry('', false, do_lang_tempcode('NA_EM'))); $list->attach(form_input_list_entry('!', true, do_lang_tempcode('ROOT_EM'))); foreach ($rows as $row) { if ($row['b_folder'] != '') { $list->attach(form_input_list_entry($row['b_folder'])); } } $fields = new ocp_tempcode(); $fields->attach(form_input_list(do_lang_tempcode('OLD_BOOKMARK_FOLDER'), do_lang_tempcode('DESCRIPTION_OLD_BOOKMARK_FOLDER'), 'folder', $list, NULL, false, false)); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('NEW_BOOKMARK_FOLDER')), do_lang_tempcode('DESCRIPTION_NEW_BOOKMARK_FOLDER'), 'folder_new', '', false)); $fields->attach(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'title', $default_title == '' ? '' : substr($default_title, 0, 200), true)); $fields->attach(form_input_line(do_lang_tempcode('PAGE_LINK'), do_lang_tempcode('DESCRIPTION_PAGE_LINK_BOOKMARK'), 'page_link', $page_link, true)); $submit_name = do_lang_tempcode('ADD_BOOKMARK'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_BOOKMARKS')))); $javascript = 'standardAlternateFields(\'folder\',\'folder_new\'); var title=document.getElementById(\'title\'); if (((title.value==\'\') || (title.value==\'0\')) && (window.opener)) title.value=getInnerHTML(window.opener.document.getElementsByTagName(\'title\')[0]); '; return do_template('FORM_SCREEN', array('_GUID' => '7e94bb97008de4fa0fffa2b5f91c95eb', 'TITLE' => $title, 'HIDDEN' => '', 'TEXT' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => $submit_name, 'JAVASCRIPT' => $javascript)); }
/** * Get the tempcode for a do next manager. A do next manager is a series of linked icons that are presented after performing an action. Modules that do not use do-next pages, usually use REFRESH_PAGE's. * * @param ID_TEXT The title of what we are doing (a language string) * @param ?mixed The language code for the docs of the hook defined do-next manager that we're creating OR tempcode for it (NULL: none) * @param ID_TEXT The menu 'type' we are doing (filters out any icons that don't match it) * @param ?string The title to use for the main links (a language string) (NULL: same as title) * @return tempcode The do next manager */ function do_next_manager_hooked($title, $text, $type, $main_title = NULL) { $links = array(); if (is_null($main_title)) { $main_title = $title; } breadcrumb_set_self(do_lang_tempcode($title)); $hooks = find_all_hooks('systems', 'do_next_menus'); foreach (array_keys($hooks) as $hook) { require_code('hooks/systems/do_next_menus/' . filter_naughty_harsh($hook)); $object = object_factory('Hook_do_next_menus_' . filter_naughty_harsh($hook), true); if (is_null($object)) { continue; } $info = $object->run(true); foreach ($info as $i) { if (is_null($i)) { continue; } if ($i[0] == $type) { array_shift($i); $links[] = $i; } } } global $M_SORT_KEY; $M_SORT_KEY = 2; @usort($links, 'multi_sort'); if (!is_null($text)) { if (strpos($text, ' ') === false) { $_text = comcode_lang_string($text); } else { $_text = make_string_tempcode($text); } } else { $_text = new ocp_tempcode(); } return do_next_manager(is_null($text) ? NULL : get_page_title($title), $_text, $links, do_lang($main_title)); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_file_base() != get_custom_file_base()) { warn_exit(do_lang_tempcode('SHARED_INSTALL_PROHIBIT')); } require_lang('menus'); get_page_title('PHP_INFO'); $GLOBALS['SCREEN_TEMPLATE_CALLED'] = ''; $GLOBALS['TITLE_CALLED'] = true; require_lang('menus'); $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_PHP_INFO'); ob_start(); phpinfo(); require_code('xhtml'); $out = xhtmlise_html(ob_get_contents()); ob_end_clean(); $out = preg_replace('#<!DOCTYPE[^>]*>#s', '', preg_replace('#</body[^>]*>#', '', preg_replace('#<body[^>]*>#', '', preg_replace('#</html[^>]*>#', '', preg_replace('#<html[^>]*>#', '', $out))))); $matches = array(); if (preg_match('#<style[^>]*>#', $out, $matches) != 0) { $offset = strpos($out, $matches[0]) + strlen($matches[0]); $end = strpos($out, '</style>', $offset); if ($end !== false) { $style = substr($out, $offset - strlen($matches[0]), $end - $offset + strlen('</style>') + strlen($matches[0])); //$GLOBALS['EXTRA_HEAD']=make_string_tempcode($style); $out = substr($out, 0, $offset) . substr($out, $end); } } $out = preg_replace('#<head[^>]*>.*</head[^>]*>#s', '', $out); $out = str_replace(' width="600"', ' width="100%"', $out); $out = preg_replace('#([^\\s<>"\']{65}&[^;]+;)#', '${1}<br />', $out); $out = preg_replace('#([^\\s<>"\']{95})#', '${1}<br />', $out); $url_parts = parse_url(get_base_url()); $out = str_replace('<img border="0" src="/', '<img border="0" style="padding-top: 20px" src="http://' . escape_html($url_parts['host']) . '/', $out); require_css('phpinfo'); require_code('xhtml'); $ret = make_string_tempcode(xhtmlise_html($out)); return $ret; }
function plugin_related_action() { global $vars, $script, $defaultpage, $whatsnew; $qm = get_qm(); $_page = isset($vars['page']) ? $vars['page'] : ''; if ($_page == '') { $_page = $defaultpage; } // Get related from cache $data = links_get_related_db($_page); if (!empty($data)) { // Hide by array keys (not values) foreach (array_keys($data) as $page) { if ($page == $whatsnew || check_non_list($page)) { unset($data[$page]); } } } // Result $r_word = rawurlencode($_page); $s_word = get_page_title($_page); $msg = $qm->replace('plg_related.title', $s_word); $retval = '<a href="' . $script . '?' . $r_word . '">' . $qm->replace('plg_related.link_back', $s_word) . '</a><br />' . "\n"; if (empty($data)) { $retval .= '<ul><li>' . $qm->m['plg_related']['notfound'] . '</li></ul>' . "\n"; } else { ksort($data); $retval .= '<ul>' . "\n"; foreach ($data as $page => $time) { $r_page = rawurlencode($page); $s_page = get_page_title($page); $passage = get_passage($time); $retval .= ' <li><a href="' . $script . '?' . $r_page . '">' . $s_page . '</a> ' . $passage . '</li>' . "\n"; } $retval .= '</ul>' . "\n"; } return array('msg' => $msg, 'body' => $retval); }
/** * Standard actualisation stage of pointstore item purchase. * * @return tempcode The UI */ function action_done() { $class = str_replace('hook_pointstore_', '', strtolower(get_class($this))); //if (get_option('is_on_'.$class.'_buy')=='0') return new ocp_tempcode(); $amount = post_param_integer('amount', 0); $bank_dividend = intval(get_option('bank_divident')); $title = get_page_title('BANKING'); // Check points $points_left = available_points(get_member()); if (!has_specific_permission(get_member(), 'give_points_self')) { if ($points_left < $amount) { return warn_screen($title, do_lang_tempcode('_CANT_AFFORD_BANK')); } } // Actuate require_code('points2'); charge_member(get_member(), $amount, do_lang('BANKING')); $GLOBALS['SITE_DB']->query_insert('bank', array('add_time' => time(), 'user_id' => get_member(), 'amount' => strval($amount), 'divident' => $bank_dividend)); // Show message $result = do_lang_tempcode('BANKING_CONGRATULATIONS', integer_format($amount), integer_format($bank_dividend)); $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF'); return redirect_screen($title, $url, $result); }
<?php if (!defined('IN_GS')) { die('you cannot load this page directly.'); } include 'header.inc.php'; ?> <div class="grid_12 marco2"> <div class="space40"></div> <div class="grid_12 alpha welcome-content"><h1 style="text-align:left;"><?php get_page_title(); ?> </h1></div> <?php get_page_content(); ?> <div class="grid_9"> <?php if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } get_cat_list($url, $page); ?> </div> <div class="grid_3"></div>
<?php require_code('developer_tools'); destrictify(); require_code('twitter'); require_lang('twitter'); $title = get_page_title('TWITTER_OAUTH'); $api_key = get_option('twitter_api_key', true); $api_secret = get_option('twitter_api_secret', true); if (is_null($api_key)) { require_code('database_action'); add_config_option('TWITTER_API_KEY', 'twitter_api_key', 'line', 'return \'\';', 'FEATURE', 'TWITTER_SYNDICATION'); add_config_option('TWITTER_API_SECRET', 'twitter_api_secret', 'line', 'return \'\';', 'FEATURE', 'TWITTER_SYNDICATION'); $api_key = ''; $api_secret = ''; } if ($api_key == '' || $api_secret == '') { $config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => 'FEATURE', 'redirect' => get_self_url(true)), '_SELF', NULL, false, false, false, 'group_TWITTER_SYNDICATION'); require_code('site2'); assign_refresh($config_url, 0.0); $echo = do_template('REDIRECT_SCREEN', array('URL' => $config_url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('TWITTER_SETUP_FIRST'))); $echo->evaluate_echo(); return; } require_code('hooks/systems/syndication/twitter'); $ob = new Hook_Syndication_twitter(); $result = $ob->auth_set(NULL, get_self_url(false, false, array('oauth_in_progress' => 1))); if ($result) { $out = do_lang_tempcode('TWITTER_OAUTH_SUCCESS'); } else { $out = do_lang_tempcode('SOME_ERRORS_OCCURRED');
/** * Standard stage of pointstore item purchase. * * @return tempcode The UI */ function ___text() { if (get_option('is_on_flagrant_buy') == '0') { return new ocp_tempcode(); } $title = get_page_title('TITLE_NEWTEXT'); // Define variables $member_id = get_member(); $message = post_param('message'); $days = post_param_integer('days'); $points_left = available_points($member_id); // First we need to know the price of the number of days we ordered. After that, compare that price with our users current number of points. $dayprice = intval(get_option('text')); $total = $dayprice * $days; if ($points_left < $total && !has_specific_permission(get_member(), 'give_points_self')) { return warn_screen($title, do_lang_tempcode('FLAGRANT_LACK_POINTS', integer_format($days), integer_format($total), integer_format($points_left))); } // Add this to the database $GLOBALS['SITE_DB']->query_insert('text', array('notes' => '', 'activation_time' => NULL, 'active_now' => 0, 'user_id' => $member_id, 'the_message' => insert_lang_comcode($message, 2), 'days' => $days, 'order_time' => time())); // Mail off the notice require_code('notifications'); $_url = build_url(array('page' => 'admin_flagrant'), 'adminzone', NULL, false, false, true); $manage_url = $_url->evaluate(); dispatch_notification('pointstore_request_flagrant', NULL, do_lang('TITLE_NEWTEXT', NULL, NULL, NULL, get_site_default_lang()), do_lang('MAIL_FLAGRANT_TEXT', $message, comcode_escape($manage_url), NULL, get_site_default_lang())); // Now, deduct the points from our user's account require_code('points2'); charge_member($member_id, $total, do_lang('PURCHASED_FLAGRANT')); $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF'); return redirect_screen($title, $url, do_lang_tempcode('ORDER_FLAGRANT_DONE')); }
function title_tag($title = NULL, $attributes = array()) { $title = $title ? $title : get_page_title(); return content_tag("title", $title, $attributes); }
/** * The actualiser to delete all chat rooms. * * @return tempcode The UI */ function _delete_all() { $delete = post_param_integer('continue_delete', 0); if ($delete != 1) { return $this->misc(); } else { $title = get_page_title('DELETE_ALL_ROOMS'); delete_all_chatrooms(); return $this->do_next_manager($title, do_lang_tempcode('SUCCESS'), NULL); } }
/** * The actualiser to resign from a usergroup. * * @return tempcode The UI */ function resign() { $title = get_page_title('RESIGN_FROM_GROUP'); $id = post_param_integer('id', NULL); if (is_null($id)) { $id = get_param_integer('id'); $post_url = build_url(array('page' => '_SELF', 'type' => get_param('type')), '_SELF', NULL, true); $hidden = form_input_hidden('id', strval($id)); return do_template('YESNO_SCREEN', array('_GUID' => 'd9524899fbc243247a9d253cf93c8aa2', 'TITLE' => $title, 'TEXT' => do_lang_tempcode('Q_SURE'), 'URL' => $post_url, 'HIDDEN' => $hidden)); } ocf_member_leave_group($id, get_member()); $url = build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF'); return redirect_screen($title, $url, do_lang_tempcode('SUCCESS')); }
/** * The UI for a points profile. * * @param MEMBER The ID of the member who is being viewed * @param ?MEMBER The ID of the member who is doing the viewing (NULL: current member) * @return tempcode The UI */ function points_profile($member_id_of, $member_id_viewing) { require_code('points'); require_css('points'); require_lang('points'); require_javascript('javascript_validation'); // Get info about viewing/giving user if (!is_guest($member_id_viewing)) { $viewer_gift_points_available = get_gift_points_to_give($member_id_viewing); } // Get info about viewed user $name = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of); if (is_null($name) || is_guest($member_id_of)) { warn_exit(do_lang_tempcode('USER_NO_EXIST')); } $title = get_page_title('_POINTS', true, array(escape_html($name))); $profile_link = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id_of, false, true); // Show stats about $member_id_of $post_count = $GLOBALS['FORUM_DRIVER']->get_post_count($member_id_of); $_point_info = point_info($member_id_of); $points_gained_given = array_key_exists('points_gained_given', $_point_info) ? $_point_info['points_gained_given'] : 0; $points_gained_rating = array_key_exists('points_gained_rating', $_point_info) ? $_point_info['points_gained_rating'] : 0; $points_gained_voting = array_key_exists('points_gained_voting', $_point_info) ? $_point_info['points_gained_voting'] : 0; $cedi_post_count = array_key_exists('points_gained_seedy', $_point_info) ? $_point_info['points_gained_seedy'] : 0; $chat_post_count = array_key_exists('points_gained_chat', $_point_info) ? $_point_info['points_gained_chat'] : 0; $points_used = points_used($member_id_of); $remaining = available_points($member_id_of); $gift_points_used = get_gift_points_used($member_id_of); //$_point_info['gift_points_used']; $gift_points_available = get_gift_points_to_give($member_id_of); $points_posting = intval(get_option('points_posting')); $points_rating = intval(get_option('points_rating')); $points_voting = intval(get_option('points_voting')); $points_joining = intval(get_option('points_joining')); $points_cedi_posting = intval(get_option('points_cedi', true)); $points_chat_posting = intval(get_option('points_chat', true)); $points_per_day = intval(get_option('points_per_day', true)); $points_per_daily_visit = intval(get_option('points_per_daily_visit', true)); $days_joined = intval(floor(floatval(time() - $GLOBALS['FORUM_DRIVER']->get_member_join_timestamp($member_id_of)) / (60.0 * 60.0 * 24.0))); $points_gained_auto = $points_per_day * $days_joined; $to = points_get_transactions('to', $member_id_of, $member_id_viewing); $from = points_get_transactions('from', $member_id_of, $member_id_viewing); // If we're staff, we can show the charge log too $chargelog_details = new ocp_tempcode(); if (has_specific_permission($member_id_viewing, 'view_charge_log')) { global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'charge_start'; $NON_CANONICAL_PARAMS[] = 'charge_sort'; $start = get_param_integer('charge_start', 0); $max = get_param_integer('charge_max', 10); $sortables = array('date_and_time' => do_lang_tempcode('DATE'), 'amount' => do_lang_tempcode('AMOUNT')); $test = explode(' ', get_param('charge_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'); } $max_rows = $GLOBALS['SITE_DB']->query_value('chargelog', 'COUNT(*)', array('user_id' => $member_id_of)); $rows = $GLOBALS['SITE_DB']->query_select('chargelog c LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND t.id=c.reason', array('*'), array('user_id' => $member_id_of), 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start); $charges = new ocp_tempcode(); $fromname = get_site_name(); $toname = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of); if (is_null($toname)) { $toname = do_lang('UNKNOWN'); } require_code('templates_results_table'); $fields_title = results_field_title(array(do_lang_tempcode('DATE'), do_lang_tempcode('AMOUNT'), do_lang_tempcode('FROM'), do_lang_tempcode('TO'), do_lang_tempcode('REASON')), $sortables, 'charge_sort', $sortable . ' ' . $sort_order); foreach ($rows as $myrow) { $date = get_timezoned_date($myrow['date_and_time']); $amount = $myrow['amount']; if (get_page_name() != 'search' && array_key_exists('text_parsed', $myrow) && !is_null($myrow['text_parsed']) && $myrow['text_parsed'] != '' && $myrow['reason'] != 0) { $reason = new ocp_tempcode(); if (!$reason->from_assembly($myrow['text_parsed'], true)) { $reason = get_translated_tempcode($myrow['reason']); } } else { $reason = get_translated_tempcode($myrow['reason']); } $charges->attach(results_entry(array(escape_html($date), escape_html(integer_format($amount)), escape_html($fromname), escape_html($toname), $reason))); } $chargelog_details = results_table(do_lang_tempcode('CHARGES'), $start, 'charge_start', $max, 'charge_max', $max_rows, $fields_title, $charges, $sortables, $sortable, $sort_order, 'charge_sort', NULL, NULL, NULL, 8, 'fgfdgfdgfdgfdger4gtrhg', false, 'tab__points'); $chargelog_details->attach(do_template('POINTS_CHARGE', array('_GUID' => 'f1e2d45a7d920ab91553a5fd0728a5ad', 'URL' => build_url(array('page' => 'admin_points', 'type' => 'charge', 'redirect' => get_self_url(true)), get_module_zone('admin_points')), 'USER' => strval($member_id_of)))); } // Show giving form if (is_guest($member_id_viewing)) { $give_template = do_lang_tempcode('POINTS_MUST_LOGIN'); } else { $have_negative_gift_points = has_specific_permission($member_id_viewing, 'have_negative_gift_points'); $enough_ok = $viewer_gift_points_available > 0 || $have_negative_gift_points; $give_ok = $member_id_viewing != $member_id_of || has_specific_permission($member_id_viewing, 'give_points_self'); if ($enough_ok && $give_ok) { // Show how many points are available also $give_url = build_url(array('page' => 'points', 'type' => 'give', 'id' => $member_id_of), get_module_zone('points')); $give_template = do_template('POINTS_GIVE', array('_GUID' => 'fa1749d5a803d86b1efbcfde2ad81702', 'GIVE_URL' => $give_url, 'USER' => strval($member_id_of), 'VIEWER_GIFT_POINTS_AVAILABLE' => $have_negative_gift_points ? '' : integer_format($viewer_gift_points_available))); } else { $give_template = do_lang_tempcode('PE_LACKING_GIFT_POINTS'); } if (!$give_ok) { $give_template = new ocp_tempcode(); } if (!has_specific_permission($member_id_of, 'use_points')) { $give_template = new ocp_tempcode(); } } return do_template('POINTS_PROFILE', array('_GUID' => 'f91208ef0f9a1e1a8633ce307a778a8d', 'TITLE' => $title, 'MEMBER' => strval($member_id_of), 'PROFILE_LINK' => $profile_link, 'NAME' => $name, 'POINTS_JOINING' => integer_format($points_joining), 'POST_COUNT' => integer_format($post_count), 'POINTS_POSTING' => integer_format($points_posting), 'MULT_POINTS_POSTING' => integer_format($points_posting * $post_count), 'POINTS_PER_DAY' => integer_format($points_per_day), 'DAYS_JOINED' => integer_format($days_joined), 'MULT_POINTS_PER_DAY' => integer_format($points_per_day * $days_joined), 'POINTS_GAINED_AUTO' => integer_format($points_gained_auto), 'CEDI_POST_COUNT' => integer_format($cedi_post_count), 'POINTS_CEDI_POSTING' => integer_format($points_cedi_posting), 'MULT_POINTS_CEDI_POSTING' => integer_format($cedi_post_count * $points_cedi_posting), 'CHAT_POST_COUNT' => integer_format($chat_post_count), 'POINTS_CHAT_POSTING' => integer_format($points_chat_posting), 'MULT_POINTS_CHAT_POSTING' => integer_format($chat_post_count * $points_chat_posting), 'POINTS_RATING' => integer_format($points_rating), 'POINTS_GAINED_RATING' => integer_format($points_gained_rating), 'MULT_POINTS_RATING' => integer_format($points_rating * $points_gained_rating), 'POINTS_VOTING' => integer_format($points_voting), 'POINTS_GAINED_VOTING' => integer_format($points_gained_voting), 'MULT_POINTS_VOTING' => integer_format($points_voting * $points_gained_voting), 'POINTS_PER_DAILY_VISIT' => integer_format($points_per_daily_visit), 'POINTS_GAINED_GIVEN' => integer_format($points_gained_given), 'POINTS_USED' => integer_format($points_used), 'REMAINING' => integer_format($remaining), 'GIFT_POINTS_USED' => integer_format($gift_points_used), 'GIFT_POINTS_AVAILABLE' => integer_format($gift_points_available), 'TO' => $to, 'FROM' => $from, 'CHARGELOG_DETAILS' => $chargelog_details, 'GIVE' => $give_template)); }
/** * The actualiser for emptying caches. * * @return tempcode The UI */ function do_rebuild() { $hooks = find_all_hooks('modules', 'admin_cleanup'); // Fiddle the order a bit if (array_key_exists('ocf_topics', $hooks)) { unset($hooks['ocf_topics']); $hooks['ocf_topics'] = 'sources_custom'; } if (array_key_exists('ocf', $hooks)) { unset($hooks['ocf']); $hooks['ocf'] = 'sources_custom'; } if (array_key_exists('ocf_members', $hooks)) { unset($hooks['ocf_members']); $hooks['ocf_members'] = 'sources_custom'; } $todo = array(); foreach (array_keys($hooks) as $hook) { if (post_param_integer($hook, 0) == 1) { $todo[] = $hook; } } $messages = ocportal_cleanup($todo); $messages->attach(paragraph(do_lang_tempcode('SUCCESS'))); $title = get_page_title('CLEANUP_TOOLS'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CLEANUP_TOOLS')))); breadcrumb_set_self(do_lang_tempcode('DONE')); return do_template('CLEANUP_COMPLETED_SCREEN', array('_GUID' => '598510a9ad9f01f3c0806319b32b5033', 'TITLE' => $title, 'MESSAGES' => $messages)); }