本文整理汇总了PHP中do_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP do_lang函数的具体用法?PHP do_lang怎么用?PHP do_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('watch_chatroom', array('h', 'u'), array(true)), '', '');
} else {
require_code('chat');
if (array_key_exists('u', $options) || array_key_exists('unwatch', $options)) {
delete_value('occle_watched_chatroom');
$_chatroom = do_lang('SUCCESS');
} elseif (array_key_exists(0, $parameters)) {
if (is_numeric($parameters[0])) {
$chatroom = $parameters[0];
} else {
$chatroom = get_chatroom_id($parameters[0]);
}
if (is_null($chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
set_value('occle_watched_chatroom', $chatroom);
$_chatroom = get_chatroom_name($chatroom);
} else {
$_chatroom = get_chatroom_name(intval(get_value('occle_watched_chatroom')), true);
if (is_null($_chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
}
return array('', '', $_chatroom, '');
}
}
示例2: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('textfiles');
$file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
$title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
$lang_none = array_key_exists('lang_none', $map) ? $map['lang_none'] : '0';
$scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
$lang = $lang_none == '1' ? NULL : '';
$file = filter_naughty($file, true);
$new = post_param('new', NULL);
if (!is_null($new)) {
$hooks = find_all_hooks('blocks', 'main_notes');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/blocks/main_notes/' . filter_naughty_harsh($hook));
$ob = object_factory('Hook_notes_' . filter_naughty_harsh($hook), true);
if (is_null($ob)) {
continue;
}
$ob->run($file);
}
write_text_file($file, $lang, $new);
log_it('NOTES', $file);
attach_message(do_lang_tempcode('SUCCESS'), 'inform');
}
$contents = read_text_file($file, $lang, true);
$post_url = get_self_url();
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_NOTES', array('_GUID' => 'f737053505de3bd8ccfe806ec014b8fb', 'TITLE' => $title, 'BLOCK_NAME' => 'main_notes', 'MAP' => $map_comcode, 'CONTENTS' => $contents, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'URL' => $post_url));
}
示例3: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('type_validation');
require_lang('phpdoc');
require_code('php');
require_css('adminzone');
disable_php_memory_limit();
$filename = (array_key_exists('param', $map) ? $map['param'] : 'sources/global2') . '.php';
if (substr($filename, -8) == '.php.php') {
$filename = substr($filename, 0, strlen($filename) - 4);
}
$full_path = (get_file_base() != '' ? get_file_base() . '/' : '') . filter_naughty($filename);
if (!file_exists($full_path)) {
return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
}
$_classes = get_php_file_api($filename);
$classes = new ocp_tempcode();
foreach ($_classes as $class) {
if ($class['name'] == '__global') {
$class['name'] = do_lang('GLOBAL_FUNCTIONS') . '_' . basename($filename);
}
$function_summaries = new ocp_tempcode();
$functions = new ocp_tempcode();
foreach ($class['functions'] as $function) {
$ret = render_php_function($function, $class);
$functions->attach($ret[0]);
$function_summaries->attach($ret[1]);
}
$classes->attach(do_template('PHP_CLASS', array('_GUID' => '5d58fc42c5fd3a5dd190f3f3699610c2', 'CLASS_NAME' => $class['name'], 'FUNCTION_SUMMARIES' => $function_summaries, 'FUNCTIONS' => $functions)));
}
return do_template('PHP_FILE', array('_GUID' => '6f422e6a6e846d49864d7325b212109f', 'FILENAME' => $filename, 'CLASSES' => $classes));
}
示例4: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('send_chatmessage', array('h'), array(true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'send_chatmessage'));
}
if (!array_key_exists(1, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '2', 'send_chatmessage'));
}
require_code('chat');
if (is_numeric($parameters[0])) {
$chatroom = $parameters[0];
} elseif ($parameters[0] == 'first-watched') {
$_chatroom = get_value('occle_watched_chatroom');
$chatroom = is_null($_chatroom) ? $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'id', NULL, 'ORDER BY id') : intval($_chatroom);
} else {
$chatroom = get_chatroom_id($parameters[0]);
}
if (is_null($chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
chat_post_message($chatroom, $parameters[1], get_option('chat_default_post_font'), get_option('chat_default_post_colour'));
return array('', '', do_lang('SUCCESS'), '');
}
}
示例5: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
$forum = get_forum_type();
$out = new ocp_tempcode();
if ($forum != 'none') {
// Standard welcome back vs into greeting
$member = get_member();
if (is_guest($member)) {
$redirect = get_self_url(true, true);
$login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => $redirect), get_module_zone('login'));
$join_url = $GLOBALS['FORUM_DRIVER']->join_url();
$join_bits = do_template('JOIN_OR_LOGIN', array('LOGIN_URL' => $login_url, 'JOIN_URL' => $join_url));
$p = do_lang_tempcode('WELCOME', $join_bits);
$out->attach(paragraph($p, 'hhrt4dsgdsgd'));
} else {
$out->attach(paragraph(do_lang_tempcode('WELCOME_BACK', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member))), 'gfgdf9gjd'));
}
}
$message = get_option('welcome_message');
if (has_actual_page_access(get_member(), 'admin_config')) {
if ($message != '') {
$message .= ' [[page="_SEARCH:admin_config:category:SITE#group_GENERAL"]' . do_lang('EDIT') . '[/page]]';
}
}
$out->attach(comcode_to_tempcode($message, NULL, true));
return $out;
}
示例6: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('rm', array('h'), array(true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'rm'));
}
$success = true;
foreach ($parameters as $i => $param) {
$param = $occle_fs->_pwd_to_array($param);
if (!$occle_fs->_is_file($param)) {
$success = false;
if ($i == 0 && count($parameters) == 1) {
return array('', '', '', do_lang('NOT_A_FILE', strval($i + 1)));
}
}
$success = $success && $occle_fs->remove_file($param);
}
}
if ($success) {
return array('', '', do_lang('SUCCESS'), '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
}
示例7: run
/**
* Standard modular run function for newsletter hooks.
*
* @param TIME The time that the entries found must be newer than
* @param LANGUAGE_NAME The language the entries found must be in
* @param string Category filter to apply
* @param BINARY Whether to use full article instead of summary
* @return array Tuple of result details
*/
function run($cutoff_time, $lang, $filter, $in_full = 1)
{
if (!addon_installed('news')) {
return array();
}
require_lang('news');
$new = new ocp_tempcode();
require_code('ocfiltering');
$or_list = ocfilter_to_sqlfragment($filter, 'news_category');
$or_list_2 = ocfilter_to_sqlfragment($filter, 'news_entry_category');
$rows = $GLOBALS['SITE_DB']->query('SELECT title,news,news_article,id,date_and_time,submitter FROM ' . get_table_prefix() . 'news LEFT JOIN ' . get_table_prefix() . 'news_category_entries ON news_entry=id WHERE validated=1 AND date_and_time>' . strval((int) $cutoff_time) . ' AND ((' . $or_list . ') OR (' . $or_list_2 . ')) ORDER BY date_and_time DESC', 300);
if (count($rows) == 300) {
return array();
}
$rows = remove_duplicate_rows($rows, 'id');
foreach ($rows as $row) {
$_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news'), NULL, false, false, true);
$url = $_url->evaluate();
$name = get_translated_text($row['title'], NULL, $lang);
$description = get_translated_text($row[$in_full == 1 ? 'news_article' : 'news'], NULL, $lang);
if ($description == '') {
$description = get_translated_text($row[$in_full == 1 ? 'news' : 'news_article'], NULL, $lang);
}
$member_id = is_guest($row['submitter']) ? NULL : strval($row['submitter']);
$new->attach(do_template('NEWSLETTER_NEW_RESOURCE_FCOMCODE', array('_GUID' => '4eaf5ec00db1f0b89cef5120c2486521', 'MEMBER_ID' => $member_id, 'URL' => $url, 'NAME' => $name, 'DESCRIPTION' => $description)));
}
return array($new, do_lang('NEWS', '', '', '', $lang));
}
示例8: booking_do_next
/**
* 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'));
}
示例9: get_sections
/**
* Standard modular run function.
*
* @param MEMBER The ID of the member we are getting link hooks for
* @return array List of tuples for results. Each tuple is: type,title,url
*/
function get_sections($member_id)
{
require_lang('ocgifts');
$rows = $GLOBALS['SITE_DB']->query_select('members_gifts', array('*'), array('to_user_id' => $member_id), '', NULL, 0, true);
if (is_null($rows)) {
return array();
}
$gifts = array();
foreach ($rows as $gift) {
$gift_info = $GLOBALS['SITE_DB']->query_select('ocgifts', array('*'), array('id' => $gift['gift_id']));
if (strlen($gift_info[0]['name']) > 0) {
if ($gift['is_anonymous'] == 0) {
$sender_name = $GLOBALS['FORUM_DRIVER']->get_username($gift['from_user_id']);
$sender_link = $GLOBALS['FORUM_DRIVER']->member_profile_url($gift['from_user_id']);
$gift_explanation = do_lang('GIFT_EXPLANATION1', $sender_name, $gift_info[0]['name'], $sender_link);
} else {
$gift_explanation = do_lang('GIFT_EXPLANATION2', $gift_info[0]['name']);
}
$image_url = '';
if (is_file(get_file_base() . '/' . urldecode($gift_info[0]['image']))) {
$image_url = get_custom_base_url() . '/' . $gift_info[0]['image'];
}
$gifts[] = array('GIFT_EXPLANATION' => $gift_explanation, 'IMAGE_URL' => $image_url);
}
}
$gifts_block = do_template('OCF_MEMBER_SCREEN_GIFTS_WRAP', array('_GUID' => 'fd4b5344b3b16cdf129e49bae903cbb2', 'GIFTS' => $gifts));
return array($gifts_block);
}
示例10: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('rmdir', array('h', 'f'), array(true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'rmdir'));
} else {
$parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
}
if (!$occle_fs->_is_dir($parameters[0])) {
return array('', '', '', do_lang('NOT_A_DIR', '1'));
}
if (!array_key_exists('f', $options)) {
$listing = $occle_fs->listing($parameters[0]);
if (count($listing[0]) != 0 || count($listing[1]) != 0) {
return array('', '', '', do_lang('NOT_EMPTY_FORCE', '1'));
}
}
$success = $occle_fs->remove_directory($parameters[0]);
if ($success) {
return array('', '', do_lang('SUCCESS'), '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
}
}
示例11: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
$type = get_param('type');
if (!has_zone_access(get_member(), 'adminzone')) {
return new ocp_tempcode();
}
decache('main_staff_checklist');
require_lang('staff_checklist');
switch ($type) {
case 'add':
$recurinterval = get_param_integer('recurinterval', 0);
$task_title = get_param('tasktitle', false, true);
$id = $GLOBALS['SITE_DB']->query_insert('customtasks', array('tasktitle' => $task_title, 'datetimeadded' => time(), 'recurinterval' => $recurinterval, 'recurevery' => get_param('recurevery'), 'taskisdone' => NULL), true);
require_code('notifications');
$subject = do_lang('CT_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $task_title);
$mail = do_lang('CT_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($task_title));
dispatch_notification('checklist_task', NULL, $subject, $mail);
return do_template('BLOCK_MAIN_STAFF_CHECKLIST_CUSTOM_TASK', array('TASKTITLE' => comcode_to_tempcode(get_param('tasktitle', false, true)), 'DATETIMEADDED' => display_time_period(time()), 'RECURINTERVAL' => $recurinterval == 0 ? '' : integer_format($recurinterval), 'RECUREVERY' => get_param('recurevery'), 'TASKDONE' => 'not_completed', 'ID' => strval($id)));
case 'delete':
$GLOBALS['SITE_DB']->query_delete('customtasks', array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_done':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => time()), array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_undone':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => NULL), array('id' => get_param_integer('id')), '', 1);
break;
}
return new ocp_tempcode();
}
示例12: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('cat', array('h'), array('l')), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'cat'));
}
$line_numbers = array_key_exists('l', $options);
$output = '';
for ($i = 0; $i < count($parameters); $i++) {
$parameters[$i] = $occle_fs->_pwd_to_array($parameters[$i]);
if (!$occle_fs->_is_file($parameters[$i])) {
return array('', '', '', do_lang('NOT_A_FILE', integer_format($i + 1)));
}
$lines = explode(chr(10), $occle_fs->read_file($parameters[$i]));
foreach ($lines as $j => $line) {
if ($line_numbers) {
$output .= str_pad(strval($j + 1), strlen(strval(count($lines)))) . ' ';
}
$output .= $line . chr(10);
}
}
return array('', '', $output, '');
}
}
示例13: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'polls')) {
$rows = $GLOBALS['SITE_DB']->query('SELECT b.option1,b.option2,b.option3,b.option4,b.option5,b.option6,b.option7,b.option8,b.option9,b.option10,b.votes1,b.votes2,b.votes3,b.votes4,b.votes5,b.votes6,b.votes7,b.votes8,b.votes9,b.votes10,b.question,b.id,b.submitter AS member_id,a.date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll a LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll b ON a.date_and_time>b.date_and_time WHERE NOT EXISTS(SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll x WHERE x.id<>a.id AND x.id<>b.id AND x.date_and_time BETWEEN b.date_and_time AND a.date_and_time) AND b.date_and_time IS NOT NULL AND b.date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
require_lang('polls');
$timestamp = $row['timestamp'];
$member_id = $row['member_id'];
$best = NULL;
$best_num = -1;
for ($i = 1; $i <= 10; $i++) {
if ($row['votes' . strval($i)] > $best_num) {
$best = $row['option' . strval($i)];
$best_num = $row['votes' . strval($i)];
}
}
if ($best_num == -1) {
continue;
}
$ticker_text = do_lang('VOTES_ARE_IN', strip_comcode(get_translated_text($row['question'])), strip_comcode(get_translated_text($best)));
$drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'polls', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(get_translated_text($row['question'])), 'IMAGE' => find_theme_image('bigicons/polls'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => build_url(array('page' => 'polls', 'type' => 'view', 'id' => $row[1]['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'poll_' . strval($row['id']));
}
}
return $drops;
}
示例14: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
require_lang('activities');
require_code('activities');
list(, $whereville) = find_activities(get_member(), $_filters == '' ? 'all' : 'some_members', $_filters == '' ? NULL : array_map('intval', explode(',', $_filters)));
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'activities WHERE (' . $whereville . ') AND a_time>' . strval($cutoff) . ' ORDER BY a_time DESC', $max, 0);
$content = new ocp_tempcode();
foreach ($rows as $row) {
$id = strval($row['id']);
$author = $GLOBALS['FORUM_DRIVER']->get_username($row['a_member_id']);
if (is_null($author)) {
$author = do_lang('UNKNOWN');
}
$news_date = date($date_string, $row['a_time']);
$edit_date = '';
list($_title, ) = render_activity($row);
$news_title = xmlentities($_title->evaluate());
$summary = xmlentities('');
$news = '';
$category = '';
$category_raw = '';
$view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['a_member_id']), get_module_zone('members'), NULL, false, false, true);
$if_comments = new ocp_tempcode();
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
}
return array($content, do_lang('ACTIVITIES_TITLE'));
}
示例15: run
/**
* 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));
}