本文整理汇总了PHP中require_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP require_lang函数的具体用法?PHP require_lang怎么用?PHP require_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了require_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
// TODO: Make workflows register itself in the addon registry
//if (!addon_installed('workflows')) return array();
require_lang('workflows');
return array(array('cms', 'workflows', array('admin_workflow', array('type' => 'misc'), get_module_zone('admin_workflow')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('WORKFLOWS'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value('workflow_requirements', 'COUNT(DISTINCT workflow_name)'))))), 'DOC_WORKFLOWS'));
}
示例2: 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)
{
if (!addon_installed('cedi')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'cedi')) {
return NULL;
}
$filters = ocfilter_to_sqlfragment($_filters, 'id', 'seedy_children', 'parent_id', 'parent_id', 'child_id');
$content = new ocp_tempcode();
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'seedy_pages WHERE ' . $filters . ' AND add_date>' . strval((int) $cutoff) . ' ORDER BY add_date DESC', $max);
foreach ($rows as $row) {
$id = strval($row['id']);
if (!has_category_access(get_member(), 'seedy_page', strval($row['id']))) {
continue;
}
$author = '';
$news_date = date($date_string, $row['add_date']);
$edit_date = '';
$news_title = xmlentities(escape_html(get_translated_text($row['title'])));
$_summary = get_translated_tempcode($row['description']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = '';
$category_raw = '';
$view_url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $row['id'] == db_get_first_id() ? NULL : $row['id']), get_module_zone('cedi'), 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)));
}
require_lang('cedi');
return array($content, do_lang('CEDI_PAGES'));
}
示例3: 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();
}
示例4: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_javascript('javascript_translate');
require_code('lang2');
require_code('lang_compile');
require_lang('lang');
$type = get_param('type', 'misc');
if ($type == 'content') {
return $this->interface_content();
}
if ($type == '_content') {
return $this->set_lang_content();
}
if ($type == 'criticise') {
return $this->criticise();
}
if ($type == 'misc') {
return $this->interface_code();
}
if ($type == '_code') {
return $this->set_lang_code();
}
if ($type == '_code2') {
return $this->set_lang_code_2();
}
// This is a lang string setter called from an external source. Strings may be from many different files
if ($type == 'export_po') {
return $this->export_po();
}
return new ocp_tempcode();
}
示例5: 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 (false: error)
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('ban_member', array('h', 'u'), array(true, true)), '', '');
} else {
if (get_forum_type() != 'ocf') {
return array('', '', '', do_lang('NO_OCF'));
}
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'ban_member'));
}
require_code('ocf_members_action');
require_code('ocf_members_action2');
require_lang('ocf');
if (is_numeric($parameters[0])) {
$member_id = $parameters[0];
} else {
$member_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($parameters[0]);
}
if (is_null($member_id)) {
return array('', '', '', do_lang('USER_NO_EXIST'));
}
if (array_key_exists('u', $options) || array_key_exists('unban', $options)) {
ocf_unban_member($member_id);
} else {
ocf_ban_member($member_id);
}
return array('', '', do_lang('SUCCESS'), '');
}
}
示例6: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
global $NON_CANONICAL_PARAMS;
$NON_CANONICAL_PARAMS[] = 'max';
$max = get_param_integer('max', 10);
if ($max < 1) {
$max = 1;
}
$start = get_param_integer('start', 0);
$rows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('*'), array('validated' => 1), 'ORDER BY num_downloads DESC', $max, $start);
$content = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$content->attach(do_template('BLOCK_SEPARATOR'));
}
$content->attach(get_download_html($row, true, true, $zone));
}
$page_num = intval(floor(floatval($start) / floatval($max))) + 1;
$count = $GLOBALS['SITE_DB']->query_value('download_downloads', 'COUNT(*)', array('validated' => 1));
$num_pages = intval(ceil(floatval($count) / floatval($max)));
if ($num_pages == 0) {
$page_num = 0;
}
$previous_url = $start == 0 ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start - $max), '_SELF');
$next_url = $page_num == $num_pages ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start + $max), '_SELF');
$browse = do_template('NEXT_BROWSER_BROWSE_NEXT', array('_GUID' => '15ca70ec400629f67edefa869fb1f1a8', 'NEXT_LINK' => $next_url, 'PREVIOUS_LINK' => $previous_url, 'PAGE_NUM' => integer_format($page_num), 'NUM_PAGES' => integer_format($num_pages)));
return do_template('BLOCK_MAIN_DOWNLOAD_TEASE', array('_GUID' => 'a164e33c0b4ace4bae945c39f2f00ca9', 'CONTENT' => $content, 'BROWSE' => $browse));
}
示例7: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
require_code('ocfiltering');
$number = array_key_exists('param', $map) ? intval($map['param']) : 10;
$filter = array_key_exists('filter', $map) ? $map['filter'] : '*';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
$sql_filter = ocfilter_to_sqlfragment($filter, 'p.category_id', 'download_categories', 'parent_id', 'p.category_id', 'id');
// Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'download_downloads p WHERE validated=1 AND (' . $sql_filter . ') ORDER BY add_date DESC', $number);
$title = do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('SECTION_DOWNLOADS'));
if (array_key_exists('title', $map) && $map['title'] != '') {
$title = protect_from_escaping(escape_html($map['title']));
}
$out = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$out->attach(do_template('BLOCK_SEPARATOR'));
}
$out->attach(get_download_html($row, true, true, $zone));
}
if ($out->is_empty()) {
if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads')) {
$submit_url = build_url(array('page' => 'cms_downloads', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_downloads'));
} else {
$submit_url = new ocp_tempcode();
}
return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '74399763a51102bdd6e6d92c2c11354f', 'HIGH' => false, 'TITLE' => $title, 'MESSAGE' => do_lang_tempcode('NO_DOWNLOADS_YET'), 'ADD_NAME' => do_lang_tempcode('ADD_DOWNLOAD'), 'SUBMIT_URL' => $submit_url));
}
return do_template('BLOCK_MAIN_RECENT_DOWNLOADS', array('_GUID' => '257fa1b83d1b6fe3acbceb2b618e6d7f', 'TITLE' => $title, 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
}
示例8: setUp
function setUp()
{
parent::setUp();
require_code('ecommerce');
require_code('autosave');
require_code('shopping');
require_code('form_templates');
require_lang('ecommerce');
$this->access_mapping = array(db_get_first_id() => 4);
// Creating cms catalogues object
require_code('adminzone/pages/modules/admin_ecommerce.php');
$this->admin_ecom = new Module_admin_ecommerce();
/*require_code('adminzone/pages/modules/admin_shipping.php');
$this->admin_shipping = new Module_admin_shipping();
$this->admin_shipping->run_start('misc');*/
/*require_code('adminzone/pages/modules_custom/admin_credits.php');
$this->admin_credits = new Module_admin_credits();*/
require_code('adminzone/pages/modules/admin_orders.php');
$this->admin_orders = new Module_admin_orders();
$this->admin_orders->run();
$GLOBALS['SITE_DB']->query_insert('shopping_order', array('c_member' => get_member(), 'session_id' => get_session_id(), 'add_date' => time(), 'tot_price' => 0.0, 'order_status' => 'NEW', 'notes' => '', 'transaction_id' => 'ddfsfdsdfsdfs', 'purchase_through' => 'paypal', 'tax_opted_out' => 0));
/*require_code('adminzone/pages/modules/admin_permissions_products.php');
$this->admin_permission_products = new Module_admin_permissions_products();
$this->admin_permission_products->run();*/
}
示例9: 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)
{
if (!addon_installed('galleries')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'galleries')) {
return NULL;
}
$filters_1 = ocfilter_to_sqlfragment($_filters, 'name', 'galleries', 'parent_id', 'name', 'name', false, false);
// Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
$filters = ocfilter_to_sqlfragment($_filters, 'cat', 'galleries', 'parent_id', 'cat', 'name', false, false);
// Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
require_lang('galleries');
$content = new ocp_tempcode();
$_galleries = array();
if ($GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1) < 3000) {
$_galleries = $GLOBALS['SITE_DB']->query('SELECT fullname,name FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1);
foreach ($_galleries as $i => $_gallery) {
$_galleries[$i]['text_original'] = get_translated_text($_gallery['fullname']);
}
}
$galleries = collapse_2d_complexity('name', 'text_original', $_galleries);
$rows1 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'videos WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
$rows2 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'images WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
$rows = array_merge($rows1, $rows2);
foreach ($rows as $row) {
$id = strval($row['id']);
$author = $GLOBALS['FORUM_DRIVER']->get_username($row['submitter']);
if (is_null($author)) {
$author = '';
}
$news_date = date($date_string, $row['add_date']);
$edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']);
$news_title = xmlentities(do_lang('THIS_WITH_SIMPLE', array_key_exists('video_views', $row) ? do_lang('VIDEO') : do_lang('IMAGE'), strval($row['id'])));
$_summary = get_translated_tempcode($row['comments']);
$summary = xmlentities($_summary->evaluate());
$news = '';
if (!array_key_exists($row['cat'], $galleries)) {
$_fullname = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $row['cat']));
if (is_null($_fullname)) {
continue;
}
$galleries[$row['cat']] = get_translated_text($_fullname);
}
$category = $galleries[$row['cat']];
$category_raw = $row['cat'];
$view_url = build_url(array('page' => 'galleries', 'type' => array_key_exists('video_views', $row) ? 'video' : 'image', 'id' => $row['id']), get_module_zone('galleries'), NULL, false, false, true);
if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= '1') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => '65dc0cec8c75f565c58c95fa1667aa1e', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
} else {
$if_comments = new ocp_tempcode();
}
require_code('images');
$enclosure_url = ensure_thumbnail($row['url'], $row['thumb_url'], 'galleries', array_key_exists('video_views', $row) ? 'videos' : 'images', $row['id']);
list($enclosure_length, $enclosure_type) = get_enclosure_details($row['url'], $enclosure_url);
$content->attach(do_template($prefix . 'ENTRY', array('ENCLOSURE_URL' => $enclosure_url, 'ENCLOSURE_LENGTH' => $enclosure_length, 'ENCLOSURE_TYPE' => $enclosure_type, '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)));
}
require_lang('galleries');
return array($content, do_lang('GALLERIES'));
}
示例10: info
/**
* Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
*
* @return ?array Map of award content-type info (NULL: disabled).
*/
function info()
{
$info = array();
$info['connection'] = $GLOBALS['SITE_DB'];
$info['table'] = 'download_downloads';
$info['date_field'] = 'add_date';
$info['id_field'] = 'id';
$info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads') ? build_url(array('page' => 'cms_downloads', 'type' => 'ad'), get_module_zone('cms_downloads')) : new ocp_tempcode();
$info['category_field'] = 'category_id';
$info['category_type'] = 'downloads';
$info['parent_spec__table_name'] = 'download_categories';
$info['parent_spec__parent_name'] = 'parent_id';
$info['parent_spec__field_name'] = 'id';
$info['parent_field_name'] = 'id';
$info['submitter_field'] = 'submitter';
$info['id_is_string'] = false;
require_lang('downloads');
$info['title'] = do_lang_tempcode('SECTION_DOWNLOADS');
$info['validated_field'] = 'validated';
$info['category_is_string'] = false;
$info['archive_url'] = build_url(array('page' => 'downloads'), get_module_zone('downloads'));
$info['cms_page'] = 'cms_downloads';
$info['views_field'] = 'download_views';
$info['supports_custom_fields'] = true;
return $info;
}
示例11: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_lang('staff_checklist');
$newdata = post_param('stafflinksedit', NULL);
if (!is_null($newdata)) {
$items = explode("\n", $newdata);
$GLOBALS['SITE_DB']->query_delete('stafflinks');
foreach ($items as $i) {
$q = trim($i);
if (!empty($q)) {
$bits = explode('=', $q);
if (count($bits) >= 2) {
$last_bit = array_pop($bits);
$bits = array(implode('=', $bits), $last_bit);
$link = $bits[0];
} else {
$link = $q;
}
$link_title = $GLOBALS['SITE_DB']->query_value_null_ok('url_title_cache', 't_title', array('t_url' => $link));
if (is_null($link_title) || substr($link_title, 0, 1) == '!') {
$link_title = '';
$downloaded_at_link = http_download_file($link, 3000, false);
if (is_string($downloaded_at_link)) {
$matches = array();
if (preg_match('#\\s*<title[^>]*\\s*>\\s*(.*)\\s*\\s*<\\s*/title\\s*>#mi', $downloaded_at_link, $matches) != 0) {
require_code('character_sets');
$link_title = trim(str_replace('–', '-', str_replace('—', '-', @html_entity_decode(convert_to_internal_encoding($matches[1]), ENT_QUOTES, get_charset()))));
}
}
$GLOBALS['SITE_DB']->query_insert('url_title_cache', array('t_url' => $link, 't_title' => $link_title), false, true);
// To stop weird race-like conditions
}
if (count($bits) == 2) {
$link_desc = $bits[1];
} else {
$link_desc = $link_title;
}
$GLOBALS['SITE_DB']->query_insert('stafflinks', array('link' => $link, 'link_title' => $link_title, 'link_desc' => $link_desc));
}
}
}
$rows = $GLOBALS['SITE_DB']->query_select('stafflinks', array('*'));
$formattedstafflinks = array();
$unformattedstafflinks = array();
foreach ($rows as $r) {
if ($r['link_title'] == '') {
$r['link_title'] = $r['link_desc'];
}
if (strlen($r['link_title']) > strlen($r['link_desc'])) {
$r['link_title'] = $r['link_desc'];
}
$formattedstafflinks[] = array('URL' => $r['link'], 'TITLE' => $r['link_title'], 'DESC' => $r['link_title'] == $r['link_desc'] ? '' : $r['link_desc']);
$unformattedstafflinks[] = array('LINKS' => $r['link'] . '=' . $r['link_desc']);
}
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_STAFF_LINKS', array('URL' => get_self_url(), 'BLOCK_NAME' => 'main_staff_links', 'MAP' => $map_comcode, 'FORMATTEDLINKS' => $formattedstafflinks, 'UNFORMATTEDLINKS' => $unformattedstafflinks));
}
示例12: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
if (get_forum_type() != 'ocf') {
return new ocp_tempcode();
}
if (is_guest()) {
return new ocp_tempcode();
}
require_css('side_blocks');
ocf_require_all_forum_stuff();
require_code('ocf_notifications');
// Only show what's new in week. Some forums may want to tweak this, but forums themselves only mark unread topics for a week.
$rows = ocf_get_pp_rows();
// if (count($rows)==0) return new ocp_tempcode();
require_lang('ocf');
$out = new ocp_tempcode();
foreach ($rows as $topic) {
$topic_url = build_url(array('page' => 'topicview', 'id' => $topic['id'], 'type' => 'findpost'), get_module_zone('topicview'));
$topic_url->attach('#post_' . strval($topic['id']));
$title = $topic['t_cache_first_title'];
$date = get_timezoned_date($topic['t_cache_last_time'], true);
$username = $topic['t_cache_last_username'];
$member_link = $GLOBALS['OCF_DRIVER']->member_profile_url($topic['t_cache_last_member_id'], false, true);
$num_posts = $topic['t_cache_num_posts'];
$out->attach(do_template('TOPIC_LIST', array('_GUID' => '55ae21a9f8d67ba6237c118a18b9657b', 'USER_LINK' => $member_link, 'TOPIC_LINK' => $topic_url, 'TITLE' => $title, 'DATE' => $date, 'DATE_RAW' => strval($topic['t_cache_last_time']), 'USERNAME' => $username, 'NUM_POSTS' => integer_format($num_posts))));
}
$send_url = build_url(array('page' => 'topics', 'type' => 'new_pt', 'redirect' => SELF_REDIRECT), get_module_zone('topics'));
if (!ocf_may_make_personal_topic()) {
$send_url = new ocp_tempcode();
}
$view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => get_member()), get_module_zone('members'), NULL, true, false, false, 'tab__pts');
return do_template('BLOCK_SIDE_OCF_PERSONAL_TOPICS', array('_GUID' => '9376cd47884a78f3d1914c176b67ee28', 'SEND_URL' => $send_url, 'VIEW_URL' => $view_url, 'CONTENT' => $out, 'FORUM_NAME' => do_lang_tempcode('PERSONAL_TOPICS')));
}
示例13: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
if (!addon_installed('calendar')) {
return new ocp_tempcode();
}
require_lang('calendar');
$bits = new ocp_tempcode();
if (get_option('calendar_show_stats_count_events', true) == '1') {
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS'), 'VALUE' => integer_format($GLOBALS['SITE_DB']->query_value('calendar_events', 'COUNT(*)')))));
}
if (get_option('calendar_show_stats_count_events_this_week', true) == '1') {
require_code('calendar');
$events = calendar_matches($GLOBALS['FORUM_DRIVER']->get_guest_id(), true, utctime_to_usertime(time()), utctime_to_usertime(time() + 60 * 60 * 24 * 7));
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS_THIS_WEEK'), 'VALUE' => integer_format(count($events)))));
}
if (get_option('calendar_show_stats_count_events_this_month', true) == '1') {
require_code('calendar');
$events = calendar_matches($GLOBALS['FORUM_DRIVER']->get_guest_id(), true, utctime_to_usertime(time()), utctime_to_usertime(time() + 60 * 60 * 24 * 31));
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS_THIS_MONTH'), 'VALUE' => integer_format(count($events)))));
}
if (get_option('calendar_show_stats_count_events_this_year', true) == '1') {
require_code('calendar');
$events = calendar_matches($GLOBALS['FORUM_DRIVER']->get_guest_id(), true, utctime_to_usertime(time()), utctime_to_usertime(time() + 60 * 60 * 24 * 365));
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS_THIS_YEAR'), 'VALUE' => integer_format(count($events)))));
}
if ($bits->is_empty()) {
return new ocp_tempcode();
}
$section = do_template('BLOCK_SIDE_STATS_SECTION', array('SECTION' => do_lang_tempcode('CALENDAR'), 'CONTENT' => $bits));
return $section;
}
示例14: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_lang('galleries');
require_code('galleries');
require_css('galleries');
require_css('side_blocks');
$parent_id = array_key_exists('param', $map) ? $map['param'] : 'root';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('galleries');
$show_empty = array_key_exists('show_empty', $map) ? $map['show_empty'] == '1' : false;
$depth = array_key_exists('depth', $map) ? intval($map['depth']) : 0;
// If depth is 1 then we go down 1 level. Only 0 or 1 is supported.
// For all galleries off the root gallery
$query = 'SELECT name,fullname FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'galleries WHERE ' . db_string_equal_to('parent_id', $parent_id) . ' AND name NOT LIKE \'' . db_encode_like('download\\_%') . '\' ORDER BY add_date';
$galleries = $GLOBALS['SITE_DB']->query($query, 300);
if ($depth == 0) {
$content = $this->inside($zone, $galleries, 'BLOCK_SIDE_ROOT_GALLERIES_LINE', $show_empty);
} else {
$content = new ocp_tempcode();
foreach ($galleries as $gallery) {
if ($show_empty || gallery_has_content($gallery['name'])) {
$subgalleries = $GLOBALS['SITE_DB']->query_select('galleries', array('name', 'fullname'), array('parent_id' => $gallery['name']), 'ORDER BY add_date', 300);
$nest = $this->inside($zone, $subgalleries, 'BLOCK_SIDE_ROOT_GALLERIES_LINE_DEPTH', $show_empty);
$caption = get_translated_text($gallery['fullname']);
$content->attach(do_template('BLOCK_SIDE_ROOT_GALLERIES_LINE_CONTAINER', array('_GUID' => 'e50b84369b5e2146c4fab4fddc84bf0a', 'ID' => $gallery['name'], 'CAPTION' => $caption, 'CONTENTS' => $nest)));
}
}
}
$_title = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $parent_id));
if (!is_null($_title)) {
$title = get_translated_text($_title);
} else {
$title = '';
}
return do_template('BLOCK_SIDE_ROOT_GALLERIES', array('_GUID' => 'ed420ce9d1b1dde95eb3fd8473090228', 'TITLE' => $title, 'ID' => $parent_id, 'DEPTH' => $depth != 0, 'CONTENT' => $content));
}
示例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));
}