本文整理汇总了PHP中results_table函数的典型用法代码示例。如果您正苦于以下问题:PHP results_table函数的具体用法?PHP results_table怎么用?PHP results_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了results_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find_security_alerts
/**
* Get a results table showing security alerts matching WHERE constraints.
*
* @param ?array WHERE constraints (NULL: none)
* @return tempcode The results table
*/
function find_security_alerts($where)
{
// Alerts
$start = get_param_integer('alert_start', 0);
$max = get_param_integer('alert_max', 50);
$sortables = array('date_and_time' => do_lang_tempcode('DATE_TIME'), 'ip' => do_lang_tempcode('IP_ADDRESS'));
$test = explode(' ', get_param('alert_sort', 'date_and_time DESC'));
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[] = 'alert_sort';
$_fields = array(do_lang_tempcode('FROM'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('IP_ADDRESS'), do_lang_tempcode('REASON'));
if (has_js()) {
$_fields[] = new ocp_tempcode();
}
$fields_title = results_field_title($_fields, $sortables, 'alert_sort', $sortable . ' ' . $sort_order);
$max_rows = $GLOBALS['SITE_DB']->query_value('hackattack', 'COUNT(*)', $where);
$rows = $GLOBALS['SITE_DB']->query_select('hackattack', array('*'), $where, 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
$fields = new ocp_tempcode();
foreach ($rows as $row) {
$time = get_timezoned_date($row['date_and_time']);
$lookup_url = build_url(array('page' => 'admin_lookup', 'param' => $row['ip']), '_SELF');
$member_url = build_url(array('page' => 'admin_lookup', 'param' => $row['the_user']), '_SELF');
$full_url = build_url(array('page' => 'admin_security', 'type' => 'view', 'id' => $row['id']), '_SELF');
$reason = do_lang($row['reason'], $row['reason_param_a'], $row['reason_param_b'], NULL, NULL, false);
if (is_null($reason)) {
$reason = $row['reason'];
}
$reason = symbol_truncator(array($reason, '50', '1'), 'left');
$username = $GLOBALS['FORUM_DRIVER']->get_username($row['the_user']);
if (is_null($username)) {
$username = do_lang('UNKNOWN');
}
$_row = array(hyperlink($member_url, escape_html($username)), hyperlink($full_url, escape_html($time)), hyperlink($lookup_url, escape_html($row['ip'])), $reason);
if (has_js()) {
$deletion_tick = do_template('RESULTS_TABLE_TICK', array('ID' => strval($row['id'])));
$_row[] = $deletion_tick;
}
$fields->attach(results_entry($_row));
}
return results_table(do_lang_tempcode('SECURITY_ALERTS'), $start, 'alert_start', $max, 'alert_max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'alert_sort');
}
示例2: nice_get_choose_table
/**
* 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', 'c_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('c_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('EXPANDED_BY_DEFAULT'), 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['c_title'], $row['c_expanded_by_default'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'), 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);
}
示例3: points_get_transactions
/**
* Show the point transactions a member has had.
*
* @param ID_TEXT The type of transactions we are looking for
* @set from to
* @param MEMBER Who we are looking at transactions for
* @param MEMBER Who we are looking at transactions using the account of
* @return tempcode The UI
*/
function points_get_transactions($type, $member_id_of, $member_id_viewing)
{
$where = array('gift_' . $type => $member_id_of);
if ($type == 'from') {
$where['anonymous'] = 0;
}
$start = get_param_integer('gift_start_' . $type, 0);
$max = get_param_integer('gift_max_' . $type, 10);
$sortables = array('date_and_time' => do_lang_tempcode('DATE'), 'amount' => do_lang_tempcode('AMOUNT'));
$test = explode(' ', get_param('gift_sort_' . $type, 'date_and_time DESC'));
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[] = 'gift_sort_' . $type;
$NON_CANONICAL_PARAMS[] = 'gift_start_' . $type;
$max_rows = $GLOBALS['SITE_DB']->query_value('gifts', 'COUNT(*)', $where);
$rows = $GLOBALS['SITE_DB']->query_select('gifts g LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND t.id=g.reason', array('*'), $where, 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
$out = new ocp_tempcode();
$viewing_name = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
if (is_null($viewing_name)) {
$viewing_name = 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, 'gift_sort_' . $type, $sortable . ' ' . $sort_order);
foreach ($rows as $myrow) {
if ($myrow['anonymous'] == 1 && $type == 'from') {
continue;
}
// Their name
$fromname = is_guest($myrow['gift_from']) ? get_site_name() : $GLOBALS['FORUM_DRIVER']->get_username($myrow['gift_from']);
$toname = $GLOBALS['FORUM_DRIVER']->get_username($myrow['gift_to']);
if (is_null($fromname)) {
$fromname = do_lang('UNKNOWN');
}
if ($myrow['anonymous'] == 1 && !is_guest($myrow['gift_from'])) {
if (!has_specific_permission($member_id_viewing, 'trace_anonymous_gifts')) {
$_fromname = do_lang_tempcode('ANON');
} else {
$_fromname = hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_from']), get_module_zone('points')), do_lang_tempcode('ANON'), false, false, escape_html($fromname));
}
} else {
$_fromname = is_guest($myrow['gift_from']) ? make_string_tempcode(escape_html($fromname)) : hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_from']), get_module_zone('points')), escape_html($fromname), false, false, do_lang_tempcode('VIEW_POINTS'));
}
$_toname = hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_to']), get_module_zone('points')), escape_html($toname), false, false, do_lang_tempcode('VIEW_POINTS'));
$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']);
}
$out->attach(results_entry(array(escape_html($date), escape_html(integer_format($amount)), $_fromname, $_toname, $reason)));
}
$out = results_table(do_lang_tempcode('_POINTS', escape_html($viewing_name)), $start, 'gift_start_' . $type, $max, 'gift_max_' . $type, $max_rows, $fields_title, $out, $sortables, $sortable, $sort_order, 'gift_sort_' . $type, NULL, NULL, NULL, 8, 'gfhfghtrhhjghgfhfgf', false, 'tab__points');
if ($type == 'to') {
$title = do_lang_tempcode('POINTS_TO');
} else {
$title = do_lang_tempcode('POINTS_FROM');
}
return do_template('POINTS_TRANSACTIONS_WRAP', array('_GUID' => 'f19e3eedeb0b8bf398251b24e8389723', 'CONTENT' => $out, 'TITLE' => $title));
}
示例4: moderate_chat_room
/**
* The main user interface for moderating a chat room.
*
* @return tempcode The UI.
*/
function moderate_chat_room()
{
$title = get_page_title('CHAT_MOD_PANEL');
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CHOOSE'))));
$room_id = get_param_integer('id');
check_chatroom_access($room_id);
$room_details = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $room_id), '', 1);
if (!array_key_exists(0, $room_details)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$row = $room_details[0];
$has_mod_access = has_specific_permission(get_member(), 'edit_lowrange_content', 'cms_chat', array('chat', $room_id)) || $row['room_owner'] == get_member() && has_specific_permission(get_member(), 'moderate_my_private_rooms');
if (!$has_mod_access) {
access_denied('SPECIFIC_PERMISSION', 'edit_lowrange_content');
}
$start = get_param_integer('start', 0);
$max = get_param_integer('max', 50);
$sortables = array('date_and_time' => do_lang_tempcode('DATE_TIME'), 'user_id' => do_lang_tempcode('MEMBER'));
$test = explode(' ', get_param('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[] = 'sort';
$max_rows = $GLOBALS['SITE_DB']->query_value('chat_messages', 'COUNT(*)', array('room_id' => $room_id));
$rows = $GLOBALS['SITE_DB']->query_select('chat_messages', array('*'), array('room_id' => $room_id), 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
$fields = new ocp_tempcode();
require_code('templates_results_table');
$array = array(do_lang_tempcode('MEMBER'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('MESSAGE'));
if (has_js()) {
$array[] = do_lang_tempcode('DELETE');
}
$fields_title = results_field_title($array, $sortables, 'sort', $sortable . ' ' . $sort_order);
foreach ($rows as $myrow) {
$url = build_url(array('page' => '_SELF', 'type' => 'ed', 'room_id' => $room_id, 'id' => $myrow['id']), '_SELF');
$username = $GLOBALS['FORUM_DRIVER']->get_username($myrow['user_id']);
if (is_null($username)) {
$username = '';
}
//do_lang('UNKNOWN');
$message = get_translated_tempcode($myrow['the_message']);
$link_time = hyperlink($url, escape_html(get_timezoned_date($myrow['date_and_time'])));
$_row = array($GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($GLOBALS['FORUM_DRIVER']->get_member_from_username($username), false, $username), escape_html($link_time), $message);
if (has_js()) {
$deletion_tick = do_template('RESULTS_TABLE_TICK', array('ID' => strval($myrow['id'])));
$_row[] = $deletion_tick;
}
$fields->attach(results_entry($_row));
}
if ($fields->is_empty()) {
if ($start != 0) {
$_GET['start'] = strval(max(0, $start - $max));
return $this->moderate_chat_room();
}
inform_exit(do_lang_tempcode('NO_ENTRIES'));
}
$content = results_table(do_lang_tempcode('MESSAGES'), $start, 'start', $max, 'max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sort');
$mod_link = hyperlink(build_url(array('page' => '_SELF', 'type' => 'delete', 'stage' => 0, 'id' => $room_id), '_SELF'), do_lang_tempcode('DELETE_ALL_MESSAGES'));
$view_link = hyperlink(build_url(array('page' => 'chat', 'type' => 'room', 'id' => $room_id), get_module_zone('chat')), do_lang_tempcode('VIEW'));
$logs_link = hyperlink(build_url(array('page' => 'chat', 'type' => 'download_logs', 'id' => $room_id), get_module_zone('chat')), do_lang_tempcode('CHAT_DOWNLOAD_LOGS'));
$links = array($mod_link, $view_link, $logs_link);
$delete_url = build_url(array('page' => '_SELF', 'type' => 'mass_delete', 'room_id' => $room_id, 'start' => $start, 'max' => $max), '_SELF');
return do_template('CHAT_MODERATE_SCREEN', array('_GUID' => '940de7e8c9a0ac3c575892887c7ef3c0', 'URL' => $delete_url, 'TITLE' => $title, 'INTRODUCTION' => '', 'CONTENT' => $content, 'LINKS' => $links));
}
示例5: _survey_results
/**
* View survey results.
*
* @return tempcode The result of execution.
*/
function _survey_results()
{
$title = get_page_title('SURVEY_RESULTS');
breadcrumb_set_parents(array(array('_SELF:_SELF', do_lang_tempcode('MANAGE_QUIZZES'))));
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/survey_results';
$id = get_param_integer('id');
// quiz ID
$fields = new ocp_tempcode();
require_code('templates_results_table');
require_code('templates_view_space');
// Show summary
$question_rows = $GLOBALS['SITE_DB']->query_select('quiz_questions', array('*'), array('q_quiz' => $id), 'ORDER BY id');
foreach ($question_rows as $q) {
$question = get_translated_text($q['q_question_text']);
$answers = new ocp_tempcode();
$answer_rows = $GLOBALS['SITE_DB']->query_select('quiz_question_answers', array('*'), array('q_question' => $q['id']), 'ORDER BY id');
$all_answers = array();
foreach ($answer_rows as $i => $a) {
$answer = get_translated_text($a['q_answer_text']);
$count = $GLOBALS['SITE_DB']->query_value('quiz_entry_answer', 'COUNT(*)', array('q_answer' => strval($a['id'])));
$all_answers[serialize(array($answer, $i))] = $count;
}
arsort($all_answers);
foreach ($all_answers as $bits => $count) {
list($answer, $i) = unserialize($bits);
$answers->attach(paragraph(do_lang_tempcode('SURVEY_ANSWER_RESULT', escape_html($answer), integer_format($count), integer_format($i + 1))));
}
if ($answers->is_empty()) {
$answers = do_lang_tempcode('FREE_ENTRY_ANSWER');
}
$fields->attach(view_space_field($question, $answers, true));
}
$summary = do_template('VIEW_SPACE', array('_GUID' => '2b0c2ba0070ba810c5e4b5b4aedcb15f', 'WIDTH' => '300', 'FIELDS' => $fields));
// Show results table
$start = get_param_integer('start', 0);
$max = get_param_integer('max', 50);
$sortables = array('q_time' => do_lang_tempcode('DATE'));
$test = explode(' ', get_param('sort', 'q_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[] = 'sort';
$max_rows = $GLOBALS['SITE_DB']->query_value('quiz_entries', 'COUNT(*)', array('q_quiz' => $id));
$rows = $GLOBALS['SITE_DB']->query_select('quiz_entries', array('id', 'q_time', 'q_member'), array('q_quiz' => $id), 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
if (count($rows) == 0) {
return inform_screen($title, do_lang_tempcode('NO_ENTRIES'));
}
$fields = new ocp_tempcode();
$fields_title = results_field_title(array(do_lang_tempcode('DATE'), do_lang_tempcode('USERNAME')), $sortables, 'sort', $sortable . ' ' . $sort_order);
foreach ($rows as $myrow) {
$date_link = hyperlink(build_url(array('page' => '_SELF', 'type' => '__survey_results', 'id' => $myrow['id']), '_SELF'), escape_html(get_timezoned_date($myrow['q_time'])));
$member_link = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($myrow['q_member']);
$fields->attach(results_entry(array($date_link, $member_link), false));
}
if ($fields->is_empty()) {
warn_exit(do_lang_tempcode('NO_ENTRIES'));
}
$results = results_table(do_lang_tempcode('SURVEY_RESULTS'), $start, 'start', $max, 'max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sort');
return do_template('SURVEY_RESULTS_SCREEN', array('_GUID' => '3f38ac1b94fb4de8219b8f7108c7b0a3', 'TITLE' => $title, 'SUMMARY' => $summary, 'RESULTS' => $results));
}
示例6: edit_zone
/**
* The UI to choose a zone to edit.
*
* @param string The follow-on type
* @param ?tempcode The title to use (NULL: the EDIT_ZONE title)
* @return tempcode The UI
*/
function edit_zone($type = '_edit', $title = NULL)
{
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/zones';
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_structure';
if (is_null($title)) {
$title = get_page_title('EDIT_ZONE');
}
$start = get_param_integer('start', 0);
$max = get_param_integer('max', 50);
$_zones = find_all_zones(false, true, false, $start, $max);
$url_map = array('page' => '_SELF', 'type' => $type);
if ($type == '_editor') {
$url_map['wide'] = 1;
}
require_code('templates_results_table');
$current_ordering = 'name ASC';
if (strpos($current_ordering, ' ') === false) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
list($sortable, $sort_order) = explode(' ', $current_ordering, 2);
$sortables = array();
$header_row = results_field_title(array(do_lang_tempcode('NAME'), do_lang_tempcode('TITLE'), do_lang_tempcode('DEFAULT_PAGE'), do_lang_tempcode('THEME'), do_lang_tempcode('DISPLAYED_IN_MENU'), do_lang_tempcode('WIDE'), do_lang_tempcode('REQUIRE_SESSION'), do_lang_tempcode('ACTIONS')), $sortables, 'sort', $sortable . ' ' . $sort_order);
$fields = new ocp_tempcode();
require_code('form_templates');
$max_rows = $GLOBALS['SITE_DB']->query_value('zones', 'COUNT(*)');
foreach ($_zones as $_zone_details) {
list($zone_name, $zone_title, $zone_show_in_menu, $zone_default_page, $remaining_row) = $_zone_details;
$edit_link = build_url($url_map + array('id' => $zone_name), '_SELF');
$fields->attach(results_entry(array(hyperlink(build_url(array('page' => ''), $zone_name), $zone_name == '' ? do_lang_tempcode('NA_EM') : make_string_tempcode(escape_html($zone_name))), $zone_title, $zone_default_page, $remaining_row['zone_theme'] == '-1' ? do_lang_tempcode('NA_EM') : hyperlink(build_url(array('page' => 'admin_themes'), 'adminzone'), escape_html($remaining_row['zone_theme'])), $zone_show_in_menu == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'), $remaining_row['zone_wide'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'), $remaining_row['zone_require_session'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'), protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, $zone_name))), true));
}
$table = results_table(do_lang('ZONES'), get_param_integer('start', 0), 'start', either_param_integer('max', 20), 'max', $max_rows, $header_row, $fields, $sortables, $sortable, $sort_order);
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('ZONES'))));
breadcrumb_set_self(do_lang_tempcode('CHOOSE'));
$text = do_lang_tempcode('CHOOSE_EDIT_LIST');
return do_template('TABLE_TABLE_SCREEN', array('TITLE' => $title, 'TEXT' => $text, 'TABLE' => $table, 'SUBMIT_NAME' => NULL, 'POST_URL' => get_self_url()));
}
示例7: nice_get_choose_table
/**
* Standard aed_module table function.
*
* @param array Details to go to build_url for link to the next screen.
* @return array A pair: The choose table, Whether re-ordering is supported from this screen.
*/
function nice_get_choose_table($url_map)
{
require_code('templates_results_table');
$hr = array();
$hr[] = do_lang_tempcode('TITLE');
if (addon_installed('points')) {
$hr[] = do_lang_tempcode('POINTS');
}
$hr[] = do_lang_tempcode('CONTENT_TYPE');
$hr[] = do_lang_tempcode('USED_PREVIOUSLY');
$hr[] = do_lang_tempcode('ACTIONS');
$current_ordering = get_param('sort', 'a_title ASC');
if (strpos($current_ordering, ' ') === false) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
list($sortable, $sort_order) = explode(' ', $current_ordering, 2);
$sortables = array('a_title' => do_lang_tempcode('TITLE'), 'a_content_type' => do_lang_tempcode('CONTENT_TYPE'));
if (addon_installed('points')) {
$sortables['a_points'] = do_lang_tempcode('POINTS');
}
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($hr, $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');
$fr = array();
$fr[] = protect_from_escaping(hyperlink(build_url(array('page' => 'awards', 'type' => 'award', 'id' => $row['id']), get_module_zone('awards')), get_translated_text($row['a_title']), false, true));
if (addon_installed('points')) {
$fr[] = integer_format($row['a_points']);
}
$hooks = find_all_hooks('systems', 'awards');
$hook_title = do_lang('UNKNOWN');
foreach (array_keys($hooks) as $hook) {
if ($hook == $row['a_content_type']) {
require_code('hooks/systems/awards/' . $hook);
$hook_object = object_factory('Hook_awards_' . $hook, true);
if (is_null($hook_object)) {
continue;
}
$hook_info = $hook_object->info();
if (!is_null($hook_info)) {
$hook_title = $hook_info['title']->evaluate();
}
}
}
$fr[] = $hook_title;
$fr[] = integer_format($GLOBALS['SITE_DB']->query_value('award_archive', 'COUNT(*)', array('a_type_id' => $row['id'])));
$fr[] = protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . strval($row['id'])));
$fields->attach(results_entry($fr, true));
}
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);
}
示例8: page_x_share
/**
* Create a pie chart of the ratios of the specified statistic for the specified page. The chart is saved as an SVG image in /data_custom/admin_stats/, and the tempcode for display of the graph and results table is returned
*
* @param PATH The page path
* @param string The statistic to use
* @param string Language identifier for the graph title
* @param string Language identifier for the graph description
* @param string Language identifier for the list title
* @return array A linear array containing the graph and list tempcode objects, respectively
*/
function page_x_share($page, $type, $graph_title, $graph_description, $list_title)
{
//Return a pie chart with the $type used to view this page
$start = get_param_integer('start_' . $type, 0);
$max = get_param_integer('max_' . $type, 25);
$sortables = array('views' => do_lang_tempcode('_VIEWS'));
list($sortable, $sort_order) = explode(' ', get_param('sort', 'views DESC'), 2);
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';
$where = db_string_equal_to('the_page', $page);
if (substr($page, 0, 6) == 'pages/') {
$where .= ' OR ' . db_string_equal_to('the_page', '/' . $page);
}
// Legacy compatibility
$ip_filter = $GLOBALS['DEBUG_MODE'] ? '' : ' AND ' . db_string_not_equal_to('ip', get_ip_address());
$rows = $GLOBALS['SITE_DB']->query('SELECT id,' . $type . ' FROM ' . get_table_prefix() . 'stats WHERE (' . $where . ')' . $ip_filter, 5000);
if (count($rows) < 1) {
$list = new ocp_tempcode();
$graph = new ocp_tempcode();
return array($graph, $list);
}
$data1 = array();
$degrees = 360 / count($rows);
foreach ($rows as $value) {
//if($value[$type]==0) $value[$type]=do_lang('_UNKNOWN');
if (!array_key_exists($value[$type], $data1)) {
$data1[$value[$type]] = $degrees;
} else {
$data1[$value[$type]] = ($data1[$value[$type]] / $degrees + 1) * $degrees;
}
}
require_code('templates_results_table');
$fields_title = results_field_title(array(do_lang_tempcode($list_title), do_lang_tempcode('COUNT_VIEWS')), $sortables, 'sort', $sortable . ' ' . $sort_order);
$fields = new ocp_tempcode();
$data = array();
$done_total = 0;
//$done=0;
$i = 0;
foreach ($data1 as $key => $value) {
if ($i < $start) {
$i++;
continue;
} elseif ($i >= $start + $max) {
break;
}
if ($key == '') {
$link = do_lang('_UNKNOWN');
} else {
$link = escape_html($key);
}
$fields->attach(results_entry(array($link, escape_html(integer_format($value)))));
//if ($done<20)
//{
$data[$key] = $value * $degrees;
//$done++;
$done_total += $value;
//}
$i++;
}
if (count($rows) > $done_total) {
$data[do_lang('OTHER')] = 360.0 - $done_total * $degrees;
$fields->attach(results_entry(array(do_lang('OTHER'), integer_format(count($rows) - $done_total)), true));
}
if ($sortable == 'views') {
asort($data1);
if ($sort_order == 'DESC') {
$data1 = array_reverse($data1);
}
}
$list = results_table(do_lang_tempcode('PAGES_STATISTICS', escape_html($page)), $start, 'start_' . $type, $max, 'max_' . $type, $i, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sort_' . $type);
$output = create_pie_chart($data);
$this->save_graph(strval($rows[0]['id']) . '-' . $type, $output);
$graph = do_template('STATS_GRAPH', array('GRAPH' => get_custom_base_url() . '/data_custom/modules/admin_stats/' . strval($rows[0]['id']) . '-' . $type . '.xml', 'TITLE' => do_lang_tempcode($graph_title), 'TEXT' => do_lang_tempcode($graph_description)));
return array($graph, $list);
}
示例9: nice_get_choose_table
/**
* 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 (NULL: nothing to select).
*/
function nice_get_choose_table($url_map)
{
require_code('templates_results_table');
$current_ordering = get_param('sort', 'date_and_time DESC');
if (strpos($current_ordering, ' ') === false) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
list($sortable, $sort_order) = explode(' ', $current_ordering, 2);
$sortables = array('title' => do_lang_tempcode('TITLE'), 'date_and_time' => do_lang_tempcode('_ADDED'), 'news_views' => do_lang_tempcode('_VIEWS'));
if (addon_installed('unvalidated')) {
$sortables['validated'] = do_lang_tempcode('VALIDATED');
}
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';
$fh = array();
$fh[] = do_lang_tempcode('TITLE');
$fh[] = do_lang_tempcode('_ADDED');
$fh[] = do_lang_tempcode('_VIEWS');
if (addon_installed('unvalidated')) {
$fh[] = do_lang_tempcode('VALIDATED');
}
$fh[] = do_lang_tempcode('ACTIONS');
$header_row = results_field_title($fh, $sortables, 'sort', $sortable . ' ' . $sort_order);
$fields = new ocp_tempcode();
require_code('form_templates');
$only_owned = has_specific_permission(get_member(), 'edit_midrange_content', 'cms_news') ? NULL : get_member();
list($rows, $max_rows) = $this->get_entry_rows(false, $current_ordering, is_null($only_owned) ? NULL : array('submitter' => $only_owned), false, ' JOIN ' . get_table_prefix() . 'news_categories c ON c.id=r.news_category AND nc_owner IS NOT NULL');
if (count($rows) == 0) {
return NULL;
}
foreach ($rows as $row) {
$edit_link = build_url($url_map + array('id' => $row['id']), '_SELF');
$fr = array();
$fr[] = protect_from_escaping(hyperlink(build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news')), get_translated_text($row['title']), false, true));
$fr[] = get_timezoned_date($row['date_and_time']);
$fr[] = integer_format($row['news_views']);
if (addon_installed('unvalidated')) {
$fr[] = $row['validated'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
}
$fr[] = protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . strval($row['id'])));
$fields->attach(results_entry($fr, true));
}
$search_url = build_url(array('page' => 'search', 'id' => 'news'), get_module_zone('search'));
$archive_url = build_url(array('page' => 'news'), get_module_zone('news'));
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);
}
示例10: group_member_timeouts
/**
* The UI for managing temporary usergroup memberships.
*
* @return tempcode The UI
*/
function group_member_timeouts()
{
$title = get_page_title('GROUP_MEMBER_TIMEOUTS');
if (!cron_installed()) {
attach_message(do_lang_tempcode('CRON_NEEDED_TO_WORK', escape_html(brand_base_url() . '/docs' . strval(ocp_version()) . '/pg/tut_configuration')), 'warn');
}
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/usergroups_temp';
breadcrumb_set_parents(array(array('_SEARCH:admin_ocf_join:menu', do_lang_tempcode('MEMBERS'))));
require_code('form_templates');
require_code('templates_results_table');
$start = get_param_integer('start', 0);
$max = get_param_integer('max', 100);
$max_rows = $GLOBALS[get_forum_type() == 'ocf' ? 'FORUM_DB' : 'SITE_DB']->query_value('f_group_member_timeouts', 'COUNT(*)');
$fields_title = results_field_title(array(do_lang_tempcode('USERNAME'), do_lang_tempcode('_USERGROUP'), do_lang_tempcode('TIME')));
$timeouts = $GLOBALS[get_forum_type() == 'ocf' ? 'FORUM_DB' : 'SITE_DB']->query_select('f_group_member_timeouts', array('member_id', 'group_id', 'timeout'), NULL, '', $max, $start);
$usergroups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list();
$tfields = new ocp_tempcode();
foreach ($timeouts as $timeout) {
$tfields->attach(results_entry(array($GLOBALS['FORUM_DRIVER']->get_username($timeout['member_id']), isset($usergroups[$timeout['group_id']]) ? $usergroups[$timeout['group_id']] : do_lang('UNKNOWN'), display_time_period($timeout['timeout'] - time())), true));
}
$results_table = results_table(do_lang('GROUP_MEMBER_TIMEOUTS'), $start, 'start', $max, 'max', $max_rows, $fields_title, $tfields);
$fields = new ocp_tempcode();
$fields->attach(form_input_username(do_lang_tempcode('USERNAME'), '', 'username', '', true));
$_usergroups = new ocp_tempcode();
foreach ($usergroups as $uid => $name) {
if ($uid != db_get_first_id()) {
$_usergroups->attach(form_input_list_entry($uid, false, $name));
}
}
require_lang('dates');
$fields->attach(form_input_list(do_lang_tempcode('_USERGROUP'), '', 'group_id', $_usergroups, NULL, false, true));
$fields->attach(form_input_integer(do_lang_tempcode('_MINUTES'), do_lang_tempcode('DESCRIPTION_GROUPMT_MINUTES'), 'num_minutes', 60, true));
$post_url = build_url(array('page' => '_SELF', 'type' => '_group_member_timeouts'), '_SELF');
$submit_name = do_lang_tempcode('ADD');
$form = do_template('FORM', array('TABINDEX' => strval(get_form_field_tabindex()), 'HIDDEN' => '', 'TEXT' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => $submit_name));
return do_template('RESULTS_TABLE_SCREEN', array('TITLE' => $title, 'RESULTS_TABLE' => $results_table, 'FORM' => $form));
}
示例11: referrer_report_script
function referrer_report_script($ret = false)
{
$member_id = get_param_integer('member_id', NULL);
if (!has_zone_access(get_member(), 'adminzone') && $member_id !== get_member()) {
access_denied('ZONE_ACCESS', 'adminzone');
}
require_lang('referrals');
$csv = get_param_integer('csv', 0) == 1;
$where = db_string_not_equal_to('i_email_address', '') . ' AND i_inviter<>' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id());
if ($member_id !== NULL) {
$where .= ' AND referrer.id=' . strval($member_id);
}
$max = get_param_integer('max', $csv ? 10000 : 30);
$start = get_param_integer('start', 0);
$data = array();
$table = 'f_invites i LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members referrer ON referrer.id=i_inviter LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members referee ON referee.m_email_address=i_email_address';
$referrals = $GLOBALS['FORUM_DB']->query('SELECT i_time AS time,referrer.id AS referrer_id,referrer.m_username AS referrer,referrer.m_email_address AS referrer_email,referee.id AS referee_id,referee.m_username AS referee,referee.m_email_address AS referee_email,i_taken AS qualified
FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . $table . ' WHERE ' . $where . ' ORDER BY i_time DESC', $max, $start);
$max_rows = $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . $table . ' WHERE ' . $where);
if (count($referrals) == 0) {
inform_exit(do_lang_tempcode('NO_ENTRIES'));
}
foreach ($referrals as $ref) {
$data_row = array();
$data_row[do_lang('DATE_TIME')] = get_timezoned_date($ref['time'], true, true, false, true);
if (is_null($member_id)) {
if ($csv) {
$deleted = true;
$data_row[do_lang('TYPE_REFERRER')] = is_null($ref['referrer']) ? do_lang($deleted ? 'REFEREE_DELETED' : 'REFEREE_NOT_SIGNED_UP') : $ref['referrer'];
} else {
$data_row[do_lang('TYPE_REFERRER')] = is_null($ref['referrer_id']) ? '' : strval($ref['referrer_id']);
}
$data_row[do_lang('TYPE_REFERRER') . ' (' . do_lang('EMAIL_ADDRESS') . ')'] = $ref['referrer_email'];
$data_row[do_lang('QUALIFIED_REFERRER')] = do_lang(referrer_is_qualified($ref['referrer_id']) ? 'YES' : 'NO');
}
$deleted = false;
if (is_null($ref['referee'])) {
$deleted = $ref['qualified'] == 1;
//!is_null($GLOBALS['SITE_DB']->query_value_null_ok('adminlogs','id',array('the_type'=>'DELETE_MEMBER','param_b'=>TODO Unfortunately we can't tell)));
}
if ($csv) {
$data_row[do_lang('REFEREE')] = is_null($ref['referee']) ? do_lang($deleted ? 'REFEREE_DELETED' : 'REFEREE_NOT_SIGNED_UP') : $ref['referee'];
} else {
$data_row[do_lang('REFEREE')] = is_null($ref['referee_id']) ? '' : strval($ref['referee_id']);
}
$data_row[do_lang('REFEREE') . ' (' . do_lang('EMAIL_ADDRESS') . ')'] = is_null($ref['referee_email']) ? '' : $ref['referee_email'];
$data_row[do_lang('QUALIFIED_REFERRAL')] = do_lang($ref['qualified'] == 1 ? 'YES' : 'NO');
$data[] = $data_row;
}
if ($csv) {
require_code('files2');
make_csv($data, (is_null($member_id) ? get_site_name() : $GLOBALS['FORUM_DRIVER']->get_username($member_id)) . ' referrals.csv');
} else {
require_code('templates_results_table');
$fields_title = new ocp_tempcode();
$fields = new ocp_tempcode();
foreach ($data as $i => $data_row) {
if ($i == 0) {
$fields_title->attach(results_field_title(array_keys($data_row)));
}
foreach ($data_row as $key => $val) {
if ($key == do_lang('REFEREE') || $key == do_lang('TYPE_REFERRER')) {
if ($val == '') {
$val = do_lang('UNKNOWN');
} else {
$val = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($val, true);
}
}
$data_row[$key] = escape_html($val);
}
$fields->attach(results_entry($data_row));
}
$table = results_table(do_lang('REFERRALS'), $start, 'start', $max, 'max', $max_rows, $fields_title, $fields);
if ($ret) {
return $table;
}
$title = get_page_title('REFERRALS');
$out = new ocp_tempcode();
$out->attach($title);
$out->attach($table);
$out = globalise($out, NULL, '', true);
$out->evaluate_echo();
}
return NULL;
}
示例12: nice_get_choose_table
/**
* 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');
$default_order = 'g_name ASC';
$current_ordering = get_param('sort', $default_order, true);
$sortables = array('g_name' => do_lang_tempcode('NAME'));
if (strpos($current_ordering, ' ') === false) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
list($sortable, $sort_order) = explode(' ', $current_ordering, 2);
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('NAME'), do_lang_tempcode('OPEN_MEMBERSHIP'), do_lang_tempcode('ACTIONS')), $sortables, 'sort', $sortable . ' ' . $sort_order);
$fields = new ocp_tempcode();
$count = $GLOBALS['FORUM_DB']->query_value('f_groups', 'COUNT(*)', array('g_is_private_club' => 1));
require_code('form_templates');
list($rows, $max_rows) = $this->get_entry_rows(false, $current_ordering, $count > 300 || !has_specific_permission(get_member(), 'control_usergroups') ? array('g_group_leader' => get_member(), 'g_is_private_club' => 1) : array('g_is_private_club' => 1));
foreach ($rows as $row) {
$edit_link = build_url($url_map + array('id' => $row['id']), '_SELF');
$fr = array(protect_from_escaping(ocf_get_group_link($row['id'])), $row['g_open_membership'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'));
$fr[] = protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . strval($row['id'])));
$fields->attach(results_entry($fr, true));
}
$search_url = build_url(array('page' => 'search', 'id' => 'ocf_clubs'), get_module_zone('search'));
$archive_url = build_url(array('page' => 'groups'), get_module_zone('groups'));
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, 'sort'), false, $search_url, $archive_url);
}
示例13: nice_get_choose_table
/**
* Standard aed_module table function.
*
* @param array Details to go to build_url for link to the next screen.
* @return array A pair: The choose table, Whether re-ordering is supported from this screen.
*/
function nice_get_choose_table($url_map)
{
require_code('templates_results_table');
$current_ordering = get_param('sort', 'mm_name ASC');
if (strpos($current_ordering, ' ') === false) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
list($sortable, $sort_order) = explode(' ', $current_ordering, 2);
$sortables = array('mm_name' => do_lang_tempcode('NAME'), 'mm_pin_state' => do_lang_tempcode('PIN_STATE'), 'mm_open_state' => do_lang_tempcode('OPEN_STATE'), 'mm_sink_state' => do_lang_tempcode('SINK_STATE'));
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('NAME'), do_lang_tempcode('DESTINATION'), do_lang_tempcode('PIN_STATE'), do_lang_tempcode('OPEN_STATE'), do_lang_tempcode('SINK_STATE'), 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) {
$pin_state = do_lang_tempcode('NA_EM');
if (!is_null($row['mm_pin_state'])) {
switch ($row['mm_pin_state']) {
case 0:
$pin_state = do_lang_tempcode('UNPIN_TOPIC');
break;
case 1:
$pin_state = do_lang_tempcode('PIN_TOPIC');
break;
}
}
$open_state = do_lang_tempcode('NA_EM');
if (!is_null($row['mm_open_state'])) {
switch ($row['mm_open_state']) {
case 0:
$open_state = do_lang_tempcode('CLOSE_TOPIC');
break;
case 1:
$open_state = do_lang_tempcode('OPEN_TOPIC');
break;
}
}
$sink_state = do_lang_tempcode('NA_EM');
if (!is_null($row['mm_sink_state'])) {
switch ($row['mm_sink_state']) {
case 0:
$sink_state = do_lang_tempcode('SINK_TOPIC');
break;
case 1:
$sink_state = do_lang_tempcode('UNSINK_TOPIC');
break;
}
}
$destination = is_null($row['mm_move_to']) ? NULL : $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_name', array('id' => $row['mm_move_to']));
if (is_null($destination)) {
$destination = do_lang_tempcode('NA_EM');
}
$edit_link = build_url($url_map + array('id' => $row['id']), '_SELF');
$fields->attach(results_entry(array(get_translated_text($row['mm_name'], $GLOBALS['FORUM_DB']), $destination, $pin_state, $open_state, $sink_state, protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . strval($row['id'])))), true));
}
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);
}
示例14: ed
/**
* The UI to choose a page to edit.
*
* @return tempcode The UI
*/
function ed()
{
$title = get_page_title('COMCODE_PAGE_EDIT');
$lang = choose_language($title, true);
if (is_object($lang)) {
return $lang;
}
require_code('form_templates');
$add_new_permission = has_specific_permission(get_member(), 'submit_highrange_content');
if (!$add_new_permission && !has_specific_permission(get_member(), 'edit_highrange_content') && !has_specific_permission(get_member(), 'edit_own_highrange_content')) {
check_edit_permission('high', NULL);
}
$fields = new ocp_tempcode();
if ($add_new_permission) {
$fields->attach(form_input_line(do_lang_tempcode('NEW'), do_lang_tempcode('DESCRIPTION_NEW_COMCODE_PAGE'), 'page_link_2', '', true));
$submit_name = do_lang_tempcode('ADD');
} else {
$submit_name = NULL;
}
$hidden = new ocp_tempcode();
$hidden->attach(form_input_hidden('lang', $lang));
$hidden->attach(form_input_hidden('type', '_ed'));
$hidden->attach(build_keep_form_fields('_SELF'));
$map = array('page' => '_SELF', 'type' => '_ed', 'lang' => $lang);
$post_url = build_url($map, '_SELF', NULL, false, true);
breadcrumb_set_self(do_lang_tempcode('CHOOSE'));
$search_url = build_url(array('page' => 'search', 'id' => 'comcode_pages'), get_module_zone('search'));
$sitemap_zone = get_page_zone('sitemap', false);
if ($sitemap_zone !== NULL) {
$archive_url = build_url(array('page' => 'sitemap'), $sitemap_zone);
} else {
$archive_url = build_url(array('page' => ''), '');
}
$text = paragraph(do_lang_tempcode('CHOOSE_EDIT_LIST_EXTRA', escape_html($search_url->evaluate()), escape_html($archive_url->evaluate())));
if (addon_installed('page_management')) {
if (has_actual_page_access(get_member(), 'admin_sitetree')) {
$page_wizard = build_url(array('page' => 'admin_sitetree', 'type' => 'pagewizard'), get_module_zone('admin_sitetree'));
$site_tree_editor = build_url(array('page' => 'admin_sitetree', 'type' => 'site_tree'), get_module_zone('admin_sitetree'));
attach_message(do_lang_tempcode('SUGGEST_PAGE_WIZARD', escape_html($page_wizard->evaluate()), escape_html($site_tree_editor->evaluate())), 'inform');
}
}
require_code('templates_results_table');
$current_ordering = get_param('sort', 'page_title ASC');
if (strpos($current_ordering, ' ') === false) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
list($sortable, $sort_order) = explode(' ', $current_ordering, 2);
$sortables = array('page_title' => do_lang_tempcode('TITLE'), 'page' => do_lang_tempcode('PAGE'), 'zone_name' => do_lang_tempcode('ZONE'), 'pagelink' => do_lang_tempcode('PAGE_LINK'));
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('PAGE'), do_lang_tempcode('ZONE'), do_lang_tempcode('PAGE_LINK'), do_lang_tempcode('ACTIONS')), $sortables, 'sort', $sortable . ' ' . $sort_order);
$all_zones = find_all_zones(false, true);
$number_pages_parsed_for_titles = 0;
$GLOBALS['NO_QUERY_LIMIT'] = true;
$start = get_param_integer('start', 0);
$max = get_param_integer('max', 50);
$filesarray = $this->get_comcode_files_array($lang);
if (count($filesarray) >= 300) {
$orderer = 'p_add_date ASC';
switch ($sortable) {
case 'page_title':
$orderer = 't.text_original ' . $sort_order;
break;
case 'page':
$orderer = 'c.the_page ' . $sort_order;
break;
case 'zone_name':
$orderer = 'c.the_zone ' . $sort_order;
break;
case 'pagelink':
$orderer = 'c.the_zone ' . $sort_order . ',c.the_page ' . $sort_order;
break;
}
$group_by = '';
if (can_arbitrary_groupby()) {
$group_by = 'GROUP BY c.the_zone,c.the_page';
}
$where_map = '(' . db_string_equal_to('language', $lang) . ' OR language IS NULL)';
if (!has_specific_permission(get_member(), 'edit_highrange_content')) {
$where_map .= ' AND submitter=' . strval(get_member());
}
$ttable = get_table_prefix() . 'comcode_pages c LEFT JOIN ' . get_table_prefix() . 'cached_comcode_pages a ON c.the_page=a.the_page AND c.the_zone=a.the_zone LEFT JOIN ' . get_table_prefix() . 'translate t ON t.id=a.cc_page_title';
$page_rows = $GLOBALS['SITE_DB']->query('SELECT c.*,cc_page_title FROM ' . $ttable . ' WHERE ' . $where_map . $group_by . ' ORDER BY ' . $orderer, $max, $start);
$max_rows = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(DISTINCT c.the_zone,c.the_page) FROM ' . $ttable . ' WHERE ' . $where_map);
$filesarray = array();
foreach ($page_rows as $row) {
$located = _request_page($row['the_page'], $row['the_zone'], NULL, $lang);
if ($located !== false) {
$filesarray[$row['the_zone'] . ':' . $row['the_page']] = array($row['the_zone'] . '/pages/' . strtolower($located[0]) . '/' . $row['the_page'], NULL, $row);
}
}
$found_via_query = true;
//.........这里部分代码省略.........
示例15: nice_get_choose_table
/**
* Standard aed_module table function.
*
* @param array Details to go to build_url for link to the next screen.
* @return array A pair: The choose table, Whether re-ordering is supported from this screen.
*/
function nice_get_choose_table($url_map)
{
require_code('templates_results_table');
$current_ordering = get_param('sort', 'id ASC', true);
list($sortable, $sort_order) = array(substr($current_ordering, 0, strrpos($current_ordering, ' ')), substr($current_ordering, strrpos($current_ordering, ' ') + 1));
$sortables = array('id' => do_lang_tempcode('CODENAME'), 't_is_textual' => do_lang_tempcode('BANNER_IS_TEXTUAL'), 't_image_width' => do_lang_tempcode('WIDTH'), 't_image_height' => do_lang_tempcode('HEIGHT'), 't_max_file_size' => do_lang_tempcode('_FILE_SIZE'), 't_comcode_inline' => do_lang_tempcode('COMCODE_INLINE'));
if (db_has_subqueries($GLOBALS['SITE_DB']->connection_read)) {
$sortables['(SELECT COUNT(*) FROM ' . get_table_prefix() . 'banners WHERE b_type=r.id)'] = do_lang_tempcode('COUNT_TOTAL');
}
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('CODENAME'), do_lang_tempcode('BANNER_IS_TEXTUAL'), do_lang_tempcode('WIDTH'), do_lang_tempcode('HEIGHT'), do_lang_tempcode('_FILE_SIZE'), do_lang_tempcode('COMCODE_INLINE'), do_lang_tempcode('COUNT_TOTAL'), 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');
$total = integer_format($GLOBALS['SITE_DB']->query_value('banners', 'COUNT(*)', array('b_type' => $row['id'])));
$fields->attach(results_entry(array($row['id'] == '' ? do_lang('GENERAL') : $row['id'], $row['t_is_textual'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'), integer_format($row['t_image_width']), integer_format($row['t_image_height']), clean_file_size($row['t_max_file_size'] * 1024), $row['t_comcode_inline'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'), $total, protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . $row['id']))), true));
}
return array(results_table(do_lang($this->menu_label), get_param_integer('start', 0), 'start', get_param_integer('max', 20), 'max', $max_rows, $header_row, $fields, $sortables, $sortable, $sort_order), false);
}