/** * 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(); }
/** * 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')); }
/** * 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')); }
/** * 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(); }
/** * 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'), ''); } }
/** * 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)); }
/** * 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))); }
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();*/ }
/** * 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')); }
/** * 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; }
/** * 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)); }
/** * 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'))); }
/** * 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; }
/** * 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)); }
/** * 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)); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/emoticons'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_emoticons'; $this->add_one_label = do_lang_tempcode('ADD_EMOTICON'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_EMOTICON'); $this->edit_one_label = do_lang_tempcode('EDIT_EMOTICON'); require_lang('dearchive'); require_code('images'); if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_general_action'); require_code('ocf_general_action2'); if ($type == 'ad') { require_javascript('javascript_ajax'); $script = find_script('snippet'); $this->javascript = "\n\t\t\t\tvar form=document.getElementById('main_form');\n\t\t\t\tform.old_submit=form.onsubmit;\n\t\t\t\tform.onsubmit=function()\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=true;\n\t\t\t\t\t\tvar url='" . addslashes($script) . "?snippet=exists_emoticon&name='+window.encodeURIComponent(form.elements['code'].value);\n\t\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t"; } if ($type == 'misc') { return $this->misc(); } if ($type == 'import') { return $this->import(); } if ($type == '_import') { return $this->_import(); } return new ocp_tempcode(); }
/** * 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; }
/** * Standard modular run function. * * @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option). */ function run() { if (!addon_installed('tickets')) { return array(); } require_lang('tickets'); require_code('tickets'); require_code('tickets2'); $outstanding = 0; $tickets = get_tickets(get_member(), NULL, false, true); if (!is_null($tickets)) { foreach ($tickets as $topic) { if ($topic['closed'] == 0) { $outstanding++; } } } if ($outstanding > 0) { $status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0', array('_GUID' => 'g578142633c6f3d37776e82a869deb91')); } else { $status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1', array('_GUID' => 'h578142633c6f3d37776e82a869deb91')); } $url = build_url(array('page' => 'tickets', 'type' => 'misc'), get_module_zone('tickets')); $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('URL' => $url, 'STATUS' => $status, 'TASK' => do_lang_tempcode('SUPPORT_TICKETS'), 'INFO' => do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($outstanding))))); return array(array($tpl, NULL, $outstanding, NULL)); }
/** * Standard modular run function. * * @param array A map of parameters. * @return tempcode The result of execution. */ function run($map) { require_lang('google_search'); $out = new ocp_tempcode(); //return do_template('BLOCK_MAIN_GOOGLE_SEARCH_REULTS',array('TITLE'=>do_lang_tempcode('BLOCK_GOOGLE_TITLE'),'CONTENT'=>$out)); return do_template('BLOCK_MAIN_GOOGLE_SEARCH_REULTS', array('TITLE' => '', 'CONTENT' => $out)); }
/** * Standard modular run function. * * @param array A map of parameters. * @return tempcode The result of execution. */ function run($map) { require_code('catalogues'); require_lang('catalogues'); require_css('catalogues'); $number = array_key_exists('param', $map) ? intval($map['param']) : 10; $catalogue = array_key_exists('catalogue', $map) ? $map['catalogue'] : 'faqs'; $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('catalogues'); $root = array_key_exists('root', $map) && $map['root'] != '' ? intval($map['root']) : NULL; $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue), '', 1); if (!array_key_exists(0, $catalogues)) { return do_lang_tempcode('MISSING_RESOURCE', escape_html($catalogue)); } $catalogue_row = $catalogues[0]; $entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('c_name' => $catalogue, 'ce_validated' => 1), 'ORDER BY ce_add_date DESC', $number); $tpl_set = $catalogue; $display_type = array_key_exists('display_type', $map) ? intval($map['display_type']) : NULL; list($content, , ) = get_catalogue_category_entry_buildup(db_get_first_id(), $catalogue, $catalogue_row, 'SEARCH', $tpl_set, $number, 0, NULL, $root, $display_type, false, $entries); $catalogue_title = get_translated_text($catalogue_row['c_title']); if ($content->is_empty()) { if (has_actual_page_access(NULL, 'cms_catalogues', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues')) { $submit_url = build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue, 'redirect' => SELF_REDIRECT), get_module_zone('cms_catalogues')); } else { $submit_url = new ocp_tempcode(); } return do_template('BLOCK_NO_ENTRIES', array('HIGH' => false, 'TITLE' => do_lang_tempcode('RECENT', escape_html(integer_format($number)), escape_html($catalogue_title)), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('CATALOGUE_GENERIC_ADD', escape_html($catalogue_title)), 'SUBMIT_URL' => $submit_url)); } return do_template('BLOCK_MAIN_RECENT_CC_ENTRIES', array('_GUID' => 'a57fa1b83d1b6fe3acbceb2b618e6d7f', 'CATALOGUE_TITLE' => $catalogue_title, 'CATALOGUE' => $catalogue, 'CONTENT' => $content, 'NUMBER' => integer_format($number))); }
/** * Standard modular run function. * * @param array A map of parameters. * @return tempcode The result of execution. */ function run($map) { require_lang('chat'); require_css('side_blocks'); $room_id = array_key_exists('param', $map) ? intval($map['param']) : NULL; $num_messages = array_key_exists('max', $map) ? intval($map['max']) : 5; if (is_null($room_id)) { $room_id = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'MIN(id)', array('is_im' => 0)); if (is_null($room_id)) { return new ocp_tempcode(); } } $room_check = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $room_id), '', 1); if (!array_key_exists(0, $room_check)) { return new ocp_tempcode(); } require_code('chat'); if (!check_chatroom_access($room_check[0], true)) { global $DO_NOT_CACHE_THIS; // We don't cache against access, so we have a problem and can't cache $DO_NOT_CACHE_THIS = true; return new ocp_tempcode(); } $content = NULL; if (get_value('no_frames') === '1') { $content = shoutbox_script(true, $room_id, $num_messages); } return do_template('BLOCK_SIDE_SHOUTBOX_IFRAME', array('CONTENT' => $content, 'ROOM_ID' => strval($room_id), 'NUM_MESSAGES' => strval($num_messages))); }
/** * Standard modular run function. * * @param MEMBER The ID of the member we are getting detail hooks for * @return ?tempcode Results (NULL: no action) */ function run($member_id) { global $OCWORLD_MEMBER_CACHE; if (!isset($OCWORLD_MEMBER_CACHE)) { $OCWORLD_MEMBER_CACHE = array(); } if (array_key_exists($member_id, $OCWORLD_MEMBER_CACHE)) { return $OCWORLD_MEMBER_CACHE[$member_id]; } $zone = get_page_zone('ocworld', false); if (is_null($zone)) { return NULL; } if (!has_zone_access(get_member(), $zone)) { return NULL; } $rows = $GLOBALS['SITE_DB']->query_select('w_members m LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'w_realms r ON m.location_realm=r.id', array('*'), array('m.id' => $member_id), '', 1, 0, true); if (!is_null($rows) && array_key_exists(0, $rows)) { $row = $rows[0]; $room = $GLOBALS['SITE_DB']->query_value_null_ok('w_rooms', 'name', array('location_x' => $row['location_x'], 'location_y' => $row['location_y'], 'location_realm' => $row['location_realm'])); if (is_null($room)) { return NULL; } require_lang('ocworld'); $a = do_template('OCF_TOPIC_POST_CUSTOM_FIELD', array('_GUID' => '3d36d5ae8bcb66d59a0676200571fb1a', 'NAME' => do_lang_tempcode('_W_ROOM'), 'VALUE' => do_lang_tempcode('W_ROOM_COORD', escape_html($room), strval($row['location_realm']), array(strval($row['location_x']), strval($row['location_y']))))); $b = do_template('OCF_TOPIC_POST_CUSTOM_FIELD', array('_GUID' => '72c62771f7796d69d1f1a616c2591206', 'NAME' => do_lang_tempcode('_W_REALM'), 'VALUE' => $row['name'])); $a->attach($b); $OCWORLD_MEMBER_CACHE[$member_id] = $a; return $a; } return NULL; }
/** * Standard modular run function. * * @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option). */ function run() { if (!addon_installed('flagrant')) { return array(); } require_lang('flagrant'); $rows = $GLOBALS['SITE_DB']->query_select('text', array('activation_time', 'days'), array('active_now' => 1), '', NULL, NULL, true); if (is_null($rows)) { return array(); } $seconds_due_in = mixed(); if (array_key_exists(0, $rows)) { $activation_time = $rows[0]['activation_time']; $days = $rows[0]['days']; $date = $activation_time + $days * 24 * 60 * 60; $seconds_due_in = $date - time(); $status = $seconds_due_in <= 0 ? 0 : 1; } else { $status = 1; } $_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1'); $url = build_url(array('page' => 'admin_flagrant', 'type' => 'misc'), 'adminzone'); $num_queue = $this->get_num_flagrant_queue(); list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_due_in); $info->attach(do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($num_queue)))); $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '820e0e3cd80754dc7dfd9a0d05a43ec0', 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('CHOOSE_FLAGRANT'), 'INFO' => $info)); return array(array($tpl, $seconds_due_in, NULL, NULL)); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (!addon_installed('downloads')) { return new ocp_tempcode(); } require_lang('downloads'); require_code('downloads_stats'); $bits = new ocp_tempcode(); if (get_option('downloads_show_stats_count_total', true) == '1') { $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'ff2bd884d88ddc8c5a81cff897f99a5a', 'KEY' => do_lang_tempcode('COUNT_TOTAL'), 'VALUE' => integer_format(get_num_archive_downloads())))); } if (get_option('downloads_show_stats_count_archive', true) == '1') { $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => '3d221f2145581a3af51c8948f28b7ac7', 'KEY' => do_lang_tempcode('COUNT_ARCHIVE'), 'VALUE' => get_download_archive_size()))); } if (get_option('downloads_show_stats_count_downloads', true) == '1') { $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => '47c544ef053f9be47e2c48c3a694da1c', 'KEY' => do_lang_tempcode('COUNT_DOWNLOADS'), 'VALUE' => integer_format(get_num_downloads_downloaded())))); } if (get_option('downloads_show_stats_count_bandwidth', true) == '1') { $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'b2589ae83652953ece220267043d75c9', 'KEY' => do_lang_tempcode('COUNT_BANDWIDTH'), 'VALUE' => clean_file_size(get_download_bandwidth())))); } if ($bits->is_empty()) { return new ocp_tempcode(); } $files = do_template('BLOCK_SIDE_STATS_SECTION', array('_GUID' => '99ae3f35b3e5eda18901e97ac385d99c', 'SECTION' => do_lang_tempcode('SECTION_DOWNLOADS'), 'CONTENT' => $bits)); return $files; }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('ecommerce'); require_code('ecommerce'); $type = get_param('type', 'ad'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/invoices'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_ecommerce'; if ($type == 'misc') { return $this->misc(); } if ($type == 'ad') { return $this->ad(); } if ($type == '_ad') { return $this->_ad(); } if ($type == 'outstanding') { return $this->outstanding(); } if ($type == 'undelivered') { return $this->undelivered(); } if ($type == 'delete') { return $this->delete(); } if ($type == 'deliver') { return $this->deliver(); } return new ocp_tempcode(); }
/** * 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')); }
/** * Standard modular run function for search results. * * @param string Search string * @param boolean Whether to only do a META (tags) search * @param ID_TEXT Order direction * @param integer Start position in total results * @param integer Maximum results to return in total * @param boolean Whether only to search titles (as opposed to both titles and content) * @param string Where clause that selects the content according to the main search string (SQL query fragment) (blank: full-text search) * @param SHORT_TEXT Username/Author to match for * @param ?MEMBER Member-ID to match for (NULL: unknown) * @param TIME Cutoff date * @param string The sort type (gets remapped to a field in this function) * @set title add_date * @param integer Limit to this number of results * @param string What kind of boolean search to do * @set or and * @param string Where constraints known by the main search code (SQL query fragment) * @param string Comma-separated list of categories to search under * @param boolean Whether it is a boolean search * @return array List of maps (template, orderer) */ function run($content, $only_search_meta, $direction, $max, $start, $only_titles, $content_where, $author, $author_id, $cutoff, $sort, $limit_to, $boolean_operator, $where_clause, $search_under, $boolean_search) { unset($limit_to); if (get_forum_type() != 'ocf') { return array(); } $remapped_orderer = ''; switch ($sort) { case 'title': $remapped_orderer = 'g_name'; break; } require_lang('ocf'); // Calculate our where clause (search) $sq = build_search_submitter_clauses('g_group_leader', $author_id, $author); if (is_null($sq)) { return array(); } else { $where_clause .= $sq; } $where_clause .= ' AND '; $where_clause .= 'g_hidden=0 AND g_is_private_club=1'; // Calculate and perform query $rows = get_search_rows(NULL, NULL, $content, $boolean_search, $boolean_operator, $only_search_meta, $direction, $max, $start, $only_titles, 'f_groups r', array('!', 'r.g_name', 'r.g_title'), $where_clause, $content_where, $remapped_orderer, 'r.*'); $out = array(); foreach ($rows as $i => $row) { $out[$i]['data'] = $row; unset($rows[$i]); if ($remapped_orderer != '' && array_key_exists($remapped_orderer, $row)) { $out[$i]['orderer'] = $row[$remapped_orderer]; } } return $out; }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_javascript('javascript_realtime_rain'); require_javascript('javascript_ajax'); require_javascript('javascript_more'); require_lang('realtime_rain'); require_css('realtime_rain'); $title = get_page_title('REALTIME_RAIN'); if (!has_js()) { // Send them to the page permissions screen $url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF'); require_code('site2'); assign_refresh($url, 5.0); return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_REALTIME'))); } $GLOBALS['TEMPCODE_SETGET']['chrome_frame'] = make_string_tempcode('1'); if (browser_matches('ie6')) { attach_message(do_lang_tempcode('IE_OLD_PLEASE_UPGRADE'), 'warn'); } if (!has_js()) { // Send them to the stats screen $url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF'); require_code('site2'); assign_refresh($url, 5.0); return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_ADVANCED_SCREEN_REALTIME_RAIN'))); } $min_time = $GLOBALS['SITE_DB']->query_value('stats', 'MIN(date_and_time)'); if (is_null($min_time)) { $min_time = time(); } return do_template('REALTIME_RAIN_OVERLAY', array('MIN_TIME' => strval($min_time))); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('bulkupload'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/bulkuploadassistant'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_comcode'; $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_BULK_UPLOAD'); $title = get_page_title('BULK_UPLOAD'); $parameter = post_param('parameter', ''); require_code('form_templates'); if ($parameter == '') { $post_url = build_url(array('page' => '_SELF'), '_SELF'); $text = paragraph(do_lang_tempcode('BULK_UPLOAD_HELP')); $submit_name = do_lang_tempcode('BULK_UPLOAD'); $fields = form_input_line(do_lang_tempcode('DIRECTORY'), do_lang_tempcode('DIRECTORY_BULK'), 'parameter', 'uploads/attachments/' . date('Y-m-d', utctime_to_usertime()), true); return do_template('FORM_SCREEN', array('_GUID' => '77a2ca460745145d8a1d18cf24971fea', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'TITLE' => $title, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name)); } else { breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('BULK_UPLOAD')))); breadcrumb_set_self(do_lang_tempcode('_RESULTS')); $out = $this->do_dir(get_custom_file_base() . '/' . filter_naughty($parameter, true)); if ($out->is_empty()) { inform_exit(do_lang_tempcode('NO_FILES')); } return do_template('BULK_HELPER_RESULTS_SCREEN', array('_GUID' => '5d373553cf21a58f15006bd4e600a9ee', 'TITLE' => $title, 'RESULTS' => $out)); } }
/** * Standard 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'] = 'videos'; $info['date_field'] = 'add_date'; $info['id_field'] = 'id'; $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_galleries') ? build_url(array('page' => 'cms_galleries', 'type' => 'av'), get_module_zone('cms_galleries')) : new ocp_tempcode(); $info['category_field'] = 'cat'; $info['category_type'] = 'galleries'; $info['parent_spec__table_name'] = 'galleries'; $info['parent_spec__parent_name'] = 'parent_id'; $info['parent_spec__field_name'] = 'name'; $info['parent_field_name'] = 'cat'; $info['submitter_field'] = 'submitter'; $info['id_is_string'] = false; require_lang('galleries'); $info['title'] = do_lang_tempcode('VIDEOS'); $info['validated_field'] = 'validated'; $info['category_is_string'] = true; $info['archive_url'] = build_url(array('page' => 'galleries'), get_module_zone('galleries')); $info['cms_page'] = 'cms_galleries'; $info['where'] = 'cat NOT LIKE \'' . db_encode_like('download\\_%') . '\''; $info['views_field'] = 'video_views'; $info['supports_custom_fields'] = true; return $info; }