本文整理汇总了PHP中get_translated_tempcode函数的典型用法代码示例。如果您正苦于以下问题:PHP get_translated_tempcode函数的具体用法?PHP get_translated_tempcode怎么用?PHP get_translated_tempcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_translated_tempcode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
if (!array_key_exists('param', $map)) {
$map['param'] = '';
}
if (!array_key_exists('extra', $map)) {
$map['extra'] = '';
}
$max = array_key_exists('max', $map) ? intval($map['max']) : 100;
require_code('banners');
$b_type = $map['param'];
$myquery = 'SELECT * FROM ' . get_table_prefix() . 'banners WHERE ((((the_type<>1) OR ((campaign_remaining>0) AND ((expiry_date IS NULL) or (expiry_date>' . strval(time()) . ')))) AND ' . db_string_not_equal_to('name', '') . ')) AND validated=1 AND ' . db_string_equal_to('b_type', $b_type) . ' ORDER BY name';
$banners = $GLOBALS['SITE_DB']->query($myquery, 200);
$assemble = new ocp_tempcode();
if (count($banners) > $max) {
shuffle($banners);
$banners = array_slice($banners, 0, $max);
}
foreach ($banners as $i => $banner) {
$bd = show_banner($banner['name'], $banner['b_title_text'], get_translated_tempcode($banner['caption']), $banner['img_url'], '', $banner['site_url'], $banner['b_type']);
$more_coming = $i < count($banners) - 1;
$assemble->attach(do_template('BLOCK_MAIN_BANNER_WAVE_BWRAP', array('EXTRA' => $map['extra'], 'TYPE' => $map['param'], 'BANNER' => $bd, 'MORE_COMING' => $more_coming)));
}
return do_template('BLOCK_MAIN_BANNER_WAVE', array('EXTRA' => $map['extra'], 'TYPE' => $map['param'], 'ASSEMBLE' => $assemble));
}
示例2: run
/**
* Standard modular run function for award hooks. Renders a content box for an award/randomisation.
*
* @param array The database row for the content
* @param ID_TEXT The zone to display in
* @return tempcode Results
*/
function run($row, $zone)
{
$url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
$title = get_translated_tempcode($row['title']);
$title_plain = get_translated_text($row['title']);
$news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
if (!array_key_exists(0, $news_cat_rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$news_cat_row = $news_cat_rows[0];
$category = get_translated_text($news_cat_row['nc_title']);
$img = find_theme_image($news_cat_row['nc_img']);
if ($row['news_image'] != '') {
$img = $row['news_image'];
if (url_is_local($img)) {
$img = get_base_url() . '/' . $img;
}
}
$news = get_translated_tempcode($row['news']);
if ($news->is_empty()) {
$news = get_translated_tempcode($row['news_article']);
$truncate = true;
} else {
$truncate = false;
}
$author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
$author = $row['author'];
require_css('news');
$seo_bits = seo_meta_get_for('news', strval($row['id']));
$map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
$map['COMMENT_COUNT'] = '1';
}
return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
}
示例3: rules_script
/**
* Pop-up some rules.
*/
function rules_script()
{
$id = get_param_integer('id', NULL);
if (is_null($id)) {
require_code('site');
$output = request_page('rules', true);
$title = do_lang_tempcode('RULES');
} else {
if (!has_category_access(get_member(), 'forums', strval($id))) {
warn_exit(do_lang_tempcode('ACCESS_DENIED'));
}
$forum_rows = $GLOBALS['FORUM_DB']->query_select('f_forums', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $forum_rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$forum_row = $forum_rows[0];
require_lang('ocf');
$question = get_translated_tempcode($forum_row['f_intro_question'], $GLOBALS['FORUM_DB']);
$answer = $forum_row['f_intro_answer'];
$output = do_template('OCF_FORUM_INTRO_QUESTION_POPUP', array('_GUID' => '6f2dc12b616219ff982654b73ef979b2', 'QUESTION' => $question, 'ANSWER' => $answer));
$title = $answer == '' ? do_lang_tempcode('FORUM_RULES') : do_lang_tempcode('INTRO_QUESTION');
}
$tpl = do_template('POPUP_HTML_WRAP', array('_GUID' => '26c4dbc7a4737310f089583f1048cb13', 'TITLE' => $title, 'TARGET' => '_top', 'CONTENT' => $output));
$tpl->evaluate_echo();
}
示例4: 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'));
}
示例5: 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'));
}
示例6: run
/**
* Standard modular run function for award hooks. Renders a content box for an award/randomisation.
*
* @param array The database row for the content
* @param ID_TEXT The zone to display in
* @return tempcode Results
*/
function run($row, $zone)
{
unset($zone);
$view_map = array('page' => 'forumview');
if ($row['id'] != db_get_first_id()) {
$view_map['id'] = $row['id'];
}
$url = build_url($view_map, get_module_zone('forumview'));
return put_in_standard_box(do_template('SIMPLE_PREVIEW_BOX', array('SUMMARY' => get_translated_tempcode($row['f_description'], $GLOBALS['FORUM_DB']), 'URL' => $url)), $row['f_name']);
}
示例7: 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('chat')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'chat')) {
return NULL;
}
$filters = ocfilter_to_sqlfragment($_filters, 'room_id', 'chat_rooms', NULL, 'room_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)
require_code('chat');
$rows = $GLOBALS['SITE_DB']->query('SELECT m.* FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_messages m LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_rooms r ON r.id=m.room_id WHERE r.is_im=0 AND date_and_time>' . strval(time() - $cutoff) . ' AND ' . $filters . ' ORDER BY date_and_time DESC', $max);
$count = $GLOBALS['SITE_DB']->query_value('chat_rooms', 'COUNT(*)', array('is_im' => 0));
$categories = array();
if ($count < 100) {
$_categories = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('is_im' => 0));
foreach ($_categories as $category) {
$categories[$category['id']] = $category;
}
}
$content = new ocp_tempcode();
foreach ($rows as $row) {
if (!array_key_exists($row['room_id'], $categories) && $count >= 100) {
$_categories = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $row['room_id']), '', 1);
if (array_key_exists(0, $_categories)) {
$categories[$row['room_id']] = $_categories[0];
}
}
if (!array_key_exists($row['room_id'], $categories)) {
continue;
}
// Message is in deleted room (although should not exist in DB anymore!)
if (check_chatroom_access($categories[$row['room_id']], true)) {
$id = strval($row['id']);
$author = $GLOBALS['FORUM_DRIVER']->get_username($row['user_id']);
if (is_null($author)) {
$author = '';
}
$news_date = date($date_string, $row['date_and_time']);
$edit_date = '';
$_title = get_translated_tempcode($row['the_message']);
$news_title = xmlentities($_title->evaluate());
$summary = '';
$news = '';
$category = $categories[$row['room_id']]['room_name'];
$category_raw = strval($row['room_id']);
$view_url = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $row['room_id']), get_module_zone('chat'), 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('chat');
return array($content, do_lang('MESSAGES'));
}
示例8: 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('ocf_forum')) {
return NULL;
}
if (get_forum_type() != 'ocf') {
return NULL;
}
if (!has_actual_page_access(get_member(), 'forumview')) {
return NULL;
}
$filters = ocfilter_to_sqlfragment($_filters, 'p_topic_id', 'f_forums', 'f_parent_forum', 'p_cache_forum_id', 'id', true, true, $GLOBALS['FORUM_DB']);
$cutoff = max($cutoff, time() - 60 * 60 * 24 * 60);
if (!is_guest()) {
$filters .= ' AND (p_poster<>' . strval(get_member()) . ')';
}
$rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND p_validated=1 ' : '') . ' AND ' . $filters . ' ORDER BY p_time DESC,id DESC', $max);
$categories = list_to_map('id', $GLOBALS['FORUM_DB']->query('SELECT id,t_cache_first_title,t_pt_from,t_pt_to FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE t_cache_last_time>' . strval((int) $cutoff)));
$content = new ocp_tempcode();
foreach ($rows as $row) {
if (!array_key_exists($row['p_topic_id'], $categories)) {
continue;
}
$category = $categories[$row['p_topic_id']]['t_cache_first_title'];
if ((!is_null($row['p_cache_forum_id']) || $categories[$row['p_topic_id']]['t_pt_from'] == get_member() || $categories[$row['p_topic_id']]['t_pt_to'] == get_member()) && (is_null($row['p_intended_solely_for']) || $row['p_intended_solely_for'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['p_cache_forum_id']))) {
$id = strval($row['id']);
$author = $row['p_poster_name_if_guest'];
$news_date = date($date_string, $row['p_time']);
$edit_date = is_null($row['p_last_edit_time']) ? '' : date($date_string, $row['p_last_edit_time']);
if ($edit_date == $news_date) {
$edit_date = '';
}
$news_title = xmlentities($row['p_title']);
$_summary = get_translated_tempcode($row['p_post'], $GLOBALS['FORUM_DB']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category_raw = strval($row['p_topic_id']);
$view_url = build_url(array('page' => 'topicview', 'type' => 'findpost', 'id' => $row['id']), get_module_zone('forumview'), NULL, false, false, true);
if ($prefix == 'RSS_') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'ed06bc8f174a5427e1789820666fdd81', 'COMMENT_URL' => $view_url, 'ID' => strval($row['p_topic_id'])));
} else {
$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('ocf');
return array($content, do_lang('FORUM_TOPICS'));
}
示例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 (get_forum_type() != 'ocf') {
return NULL;
}
if (is_guest()) {
return NULL;
}
$member_id = get_member();
if (get_forum_type() != 'ocf') {
return NULL;
}
if (!has_actual_page_access($member_id, 'forumview')) {
return NULL;
}
if (is_guest()) {
return NULL;
}
require_code('ocf_notifications');
$rows = ocf_get_pp_rows($max);
$content = new ocp_tempcode();
foreach ($rows as $row) {
$id = strval($row['p_id']);
$author = $row['t_cache_first_username'];
$news_date = date($date_string, $row['t_cache_first_time']);
$edit_date = date($date_string, $row['t_cache_last_time']);
if ($edit_date == $news_date) {
$edit_date = '';
}
$news_title = xmlentities($row['t_cache_first_title']);
$_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = do_lang('NA');
$category_raw = '';
$_view_url = build_url(array('page' => 'topicview', 'id' => $row['t_id']), get_module_zone('forumview'));
$view_url = $_view_url->evaluate();
$view_url .= '#' . strval($row['p_id']);
if ($prefix == 'RSS_') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['p_id'])));
} else {
$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('ocf');
return array($content, do_lang('PERSONAL_TOPICS'));
}
示例10: run
/**
* 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 run($member_id)
{
if (!has_actual_page_access(get_member(), 'cms_booking')) {
return array();
}
require_lang('booking');
require_code('booking');
require_code('booking2');
$zone = get_module_zone('cms_booking');
$request = get_member_booking_request($member_id);
$links = array();
foreach ($request as $i => $r) {
$from = get_timezoned_date(mktime(0, 0, 0, $r['start_month'], $r['start_day'], $r['start_year']), false);
$to = get_timezoned_date(mktime(0, 0, 0, $r['end_month'], $r['end_day'], $r['end_year']), false);
$links[] = array('content', do_lang_tempcode('BOOKING_EDIT', $from, $to, get_translated_tempcode($GLOBALS['SITE_DB']->query_value('bookable', 'title', array('id' => $r['bookable_id'])))), build_url(array('page' => 'cms_booking', 'type' => '_eb', 'id' => strval($member_id) . '_' . strval($i)), $zone));
}
return $links;
}
示例11: 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('ocf_forum')) {
return NULL;
}
if (get_forum_type() != 'ocf') {
return NULL;
}
if (!has_actual_page_access(get_member(), 'forumview')) {
return NULL;
}
$filters = ocfilter_to_sqlfragment($_filters, 't_forum_id', 'f_forums', 'f_parent_forum', 't_forum_id', 'id', true, true, $GLOBALS['FORUM_DB']);
// 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['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE t_cache_last_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' AND ' . $filters . ' ORDER BY t_cache_last_time DESC', $max);
$categories = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0'));
$content = new ocp_tempcode();
foreach ($rows as $row) {
if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) {
$id = strval($row['id']);
$author = $row['t_cache_first_username'];
$news_date = date($date_string, $row['t_cache_first_time']);
$edit_date = date($date_string, $row['t_cache_last_time']);
if ($edit_date == $news_date) {
$edit_date = '';
}
$news_title = xmlentities($row['t_cache_first_title']);
$_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA');
$category_raw = strval($row['t_forum_id']);
$view_url = build_url(array('page' => 'topicview', 'id' => $row['id']), get_module_zone('forumview'), NULL, false, false, true);
if ($prefix == 'RSS_') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'f5dd7ba612b989bba5e2d496da5bf161', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
} else {
$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('ocf');
return array($content, do_lang('SECTION_FORUMS'));
}
示例12: 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 (get_forum_type() != 'ocf') {
return NULL;
}
if (!has_actual_page_access(get_member(), 'forumview')) {
return NULL;
}
if (is_guest()) {
return NULL;
}
$condition = 'l_time<t_cache_last_time OR (l_time IS NULL AND t_cache_last_time>' . strval(time() - 60 * 60 * 24 * intval(get_option('post_history_days'))) . ')';
$query = ' FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics top LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (top.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND top.t_cache_first_post=t.id WHERE (' . $condition . ') AND t_forum_id IS NOT NULL ' . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' ORDER BY t_cache_last_time DESC';
$rows = $GLOBALS['FORUM_DB']->query('SELECT *,top.id AS t_id ' . $query, $max);
$categories = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0'));
$content = new ocp_tempcode();
foreach ($rows as $row) {
if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) {
$id = strval($row['id']);
$author = $row['t_cache_first_username'];
$news_date = date($date_string, $row['t_cache_first_time']);
$edit_date = date($date_string, $row['t_cache_last_time']);
if ($edit_date == $news_date) {
$edit_date = '';
}
$news_title = xmlentities($row['t_cache_first_title']);
$_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA');
$category_raw = strval($row['t_forum_id']);
$view_url = build_url(array('page' => 'topicview', 'id' => $row['t_id']), get_module_zone('topicview'));
if ($prefix == 'RSS_') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['t_id'])));
} else {
$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('ocf');
return array($content, do_lang('TOPICS_UNREAD'));
}
示例13: 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)
{
unset($_filters);
// Not used
if (!addon_installed('polls')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'polls')) {
return NULL;
}
$content = new ocp_tempcode();
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll WHERE add_time>' . strval((int) $cutoff) . ' AND (votes1+votes2+votes3+votes4+votes5+votes6+votes7+votes8+votes9+votes10<>0 OR is_current=1) ORDER BY add_time DESC', $max);
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_time']);
$edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']);
$_news_title = get_translated_tempcode($row['question']);
$news_title = xmlentities($_news_title->evaluate());
$answers = array();
for ($i = 1; $i <= 5; $i++) {
$answers[] = get_translated_tempcode($row['option' . strval($i)]);
}
$_summary = do_template('POLL_RSS_SUMMARY', array('_GUID' => 'db39d44c1fa871122e1ae717e4947244', 'ANSWERS' => $answers));
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = '';
$category_raw = '';
$view_url = build_url(array('page' => 'polls', 'type' => 'view', 'id' => $row['id']), get_module_zone('polls'), 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' => '0a3e8d0b18e619d88f12bc7665fbbbca', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
} else {
$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('polls');
return array($content, do_lang('POLLS'));
}
示例14: get_cedi_page_html
/**
* Get tempcode for a CEDI post 'feature box' for the given row
*
* @param array The database field row of it
* @param ID_TEXT The zone to use
* @param boolean Whether to put it in a box
* @return tempcode A box for it, linking to the full page
*/
function get_cedi_page_html($row, $zone = '_SEARCH', $put_in_box = true)
{
$content = paragraph(get_translated_tempcode($row['description']), 'tyrtfjhggfdf');
$url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $row['id'] == db_get_first_id() ? NULL : $row['id']), $zone);
if ($put_in_box) {
$chain = cedi_derive_chain($row['id']);
$chain = preg_replace('#/[^/]+#', '', $chain);
if ($chain != '') {
$tree = cedi_breadcrumbs($chain, NULL, true);
if (!$tree->is_empty()) {
$content->attach(paragraph(do_lang_tempcode('LOCATED_IN', $tree)));
}
}
}
$preview = do_template('SIMPLE_PREVIEW_BOX', array('SUMMARY' => $content, 'URL' => $url));
if (!$put_in_box) {
return $preview;
}
return put_in_standard_box($preview, do_lang_tempcode('CEDI_PAGE', escape_html(get_translated_text($row['title']))));
}
示例15: 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)
{
unset($_filters);
// Not used
if (!addon_installed('iotds')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'iotds')) {
return NULL;
}
$content = new ocp_tempcode();
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'iotd WHERE add_date>' . strval((int) $cutoff) . ' AND (used=1 OR is_current=1) ORDER BY add_date DESC', $max);
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 = get_translated_tempcode($row['i_title']);
$news_title = xmlentities($_news_title->evaluate());
$_summary = get_translated_tempcode($row['caption']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = '';
$category_raw = '';
$view_url = build_url(array('page' => 'iotds', 'type' => 'view', 'id' => $row['id']), get_module_zone('iotds'), 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' => 'a8ccf291cb27c8ffb34f023416b85664', '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'], 'iotds', 'iotd', $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('iotds');
return array($content, do_lang('IOTDS'));
}