本文整理汇总了PHP中require_code函数的典型用法代码示例。如果您正苦于以下问题:PHP require_code函数的具体用法?PHP require_code怎么用?PHP require_code使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了require_code函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function.
*
* @return tempcode Results
*/
function run()
{
if (get_forum_type() != 'ocf') {
return new ocp_tempcode();
} else {
ocf_require_all_forum_stuff();
}
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
require_code('ocf_posts_action');
require_code('ocf_posts_action2');
// Members
$start = 0;
do {
$members = $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 500, $start);
foreach ($members as $member) {
ocf_force_update_member_post_count($member['id']);
$num_warnings = $GLOBALS['FORUM_DB']->query_value('f_warnings', 'COUNT(*)', array('w_member_id' => $member['id'], 'w_is_warning' => 1));
$GLOBALS['FORUM_DB']->query_update('f_members', array('m_cache_warnings' => $num_warnings), array('id' => $member['id']), '', 1);
}
$start += 500;
} while (array_key_exists(0, $members));
return new ocp_tempcode();
}
示例2: get_chmod_array
/**
* Get the list of files that need CHmodding for write access.
*
* @return array The list of files
*/
function get_chmod_array()
{
global $LANG;
// if ((function_exists('ocp_enterprise')) && (ocp_enterprise()))
// {
$extra_files = array('collaboration/pages/html_custom', 'collaboration/pages/html_custom/' . $LANG, 'collaboration/pages/comcode_custom', 'collaboration/pages/comcode_custom/' . $LANG);
// } else $extra_files=array();
if (function_exists('find_all_hooks')) {
$hooks = find_all_hooks('systems', 'addon_registry');
$hook_keys = array_keys($hooks);
foreach ($hook_keys as $hook) {
//require_code('hooks/systems/addon_registry/'.filter_naughty_harsh($hook));
//$object=object_factory('Hook_addon_registry_'.filter_naughty_harsh($hook));
//$extra_files=array_merge($extra_files,$object->get_chmod_array());
// Save memory compared to above commented code...
$path = get_custom_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
if (!file_exists($path)) {
$path = get_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
}
$matches = array();
if (preg_match('#function get_chmod_array\\(\\)\\s*\\{([^\\}]*)\\}#', file_get_contents($path), $matches) != 0) {
if (!defined('HIPHOP_PHP')) {
$extra_files = array_merge($extra_files, eval($matches[1]));
} else {
require_code('hooks/systems/addon_registry/' . $hook);
$hook = object_factory('Hook_addon_registry_' . $hook);
$extra_files = array_merge($extra_files, $hook->get_chmod_array());
}
}
}
}
return array_merge($extra_files, array('safe_mode_temp', 'persistant_cache', 'data_custom/modules/admin_backup', 'data_custom/modules/chat', 'data_custom/fields.xml', 'data_custom/breadcrumbs.xml', 'data_custom/modules/admin_stats', 'data_custom/spelling/write.log', 'data_custom/spelling/output.log', 'data_custom/spelling/personal_dicts', 'themes/map.ini', 'text_custom', 'text_custom/' . $LANG, 'data_custom/modules/chat/chat_last_msg.dat', 'data_custom/modules/chat/chat_last_event.dat', 'lang_cached', 'lang_cached/' . $LANG, 'lang_custom', 'lang_custom/' . $LANG, 'data_custom/errorlog.php', 'ocp_sitemap.xml', 'data_custom/permissioncheckslog.php', 'pages/html_custom', 'site/pages/html_custom', 'docs/pages/html_custom', 'adminzone/pages/html_custom', 'forum/pages/html_custom', 'cms/pages/html_custom', 'pages/html_custom/' . $LANG, 'site/pages/html_custom/' . $LANG, 'docs/pages/html_custom/' . $LANG, 'adminzone/pages/html_custom/' . $LANG, 'forum/pages/html_custom/' . $LANG, 'cms/pages/html_custom/' . $LANG, 'pages/comcode_custom', 'site/pages/comcode_custom', 'docs/pages/comcode_custom', 'adminzone/pages/comcode_custom', 'forum/pages/comcode_custom', 'cms/pages/comcode_custom', 'pages/comcode_custom/' . $LANG, 'site/pages/comcode_custom/' . $LANG, 'docs/pages/comcode_custom/' . $LANG, 'adminzone/pages/comcode_custom/' . $LANG, 'forum/pages/comcode_custom/' . $LANG, 'cms/pages/comcode_custom/' . $LANG, 'themes/default/css_custom', 'themes/default/images_custom', 'themes/default/templates_custom', 'themes/default/templates_cached', 'themes/default/templates_cached/' . $LANG, 'themes/default/theme.ini', 'uploads/incoming', 'uploads/website_specific', 'uploads/personal_sound_effects', 'uploads/banners', 'uploads/downloads', 'uploads/galleries', 'uploads/watermarks', 'uploads/grepimages', 'uploads/galleries_thumbs', 'uploads/iotds', 'uploads/iotds_thumbs', 'uploads/catalogues', 'uploads/attachments', 'uploads/attachments_thumbs', 'uploads/auto_thumbs', 'uploads/ocf_avatars', 'uploads/ocf_cpf_upload', 'uploads/ocf_photos', 'uploads/ocf_photos_thumbs', 'uploads/filedump', 'info.php', 'exports/backups', 'exports/file_backups', 'exports/mods', 'imports/mods', 'site/pages/html_custom/' . $LANG . '/download_tree_made.htm', 'site/pages/html_custom/' . $LANG . '/cedi_tree_made.htm'));
}
示例3: run
/**
* 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));
}
}
示例4: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
if (get_option('is_on_rating') == '0') {
return do_lang_tempcode('INTERNAL_ERROR');
}
// Has there actually been any rating?
if (strtoupper(ocp_srv('REQUEST_METHOD')) == 'POST' || ocp_srv('HTTP_REFERER') == '') {
$rating = either_param_integer('rating', NULL);
} else {
$rating = post_param_integer('rating');
// Will fail
}
$content_type = get_param('content_type');
$type = get_param('type', '');
$content_id = get_param('id');
$content_url = get_param('content_url', '', true);
$content_title = get_param('content_title', '', true);
require_code('feedback');
actualise_specific_rating($rating, get_page_name(), get_member(), $content_type, $type, $content_id, $content_url, $content_title);
actualise_give_rating_points();
$template = get_param('template', NULL);
if ($template !== '') {
if (is_null($template)) {
$template = 'RATING_BOX';
}
return display_rating($content_url, $content_title, $content_type, $content_id, $template);
}
return do_lang_tempcode('THANKYOU_FOR_RATING_SHORT');
}
示例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: _redirect_screen
/**
* Redirect the user - transparently, storing a message that will be shown on their destination page.
*
* @param tempcode Title to display on redirect page
* @param mixed Destination URL (may be Tempcode)
* @param mixed Message to show (may be Tempcode)
* @param boolean For intermediatory hops, don't mark so as to read status messages - save them up for the next hop (which will not be intermediatory)
* @param ID_TEXT Code of message type to show
* @set warn inform fatal
* @return tempcode Redirection message (likely to not actually be seen due to instant redirection)
*/
function _redirect_screen($title, $url, $text, $intermediatory_hop = false, $msg_type = 'inform')
{
if (is_object($url)) {
$url = $url->evaluate();
}
global $FORCE_META_REFRESH, $ATTACHED_MESSAGES_RAW;
$special_page_type = get_param('special_page_type', 'view');
if ($special_page_type == 'view' && $GLOBALS['NON_PAGE_SCRIPT'] == 0 && !headers_sent() && !$FORCE_META_REFRESH) {
foreach ($ATTACHED_MESSAGES_RAW as $message) {
$GLOBALS['SITE_DB']->query_insert('messages_to_render', array('r_session_id' => get_session_id(), 'r_message' => is_object($message[0]) ? $message[0]->evaluate() : escape_html($message[0]), 'r_type' => $message[1], 'r_time' => time()));
}
$_message = is_object($text) ? $text->evaluate() : escape_html($text);
if ($_message != '' && (count($ATTACHED_MESSAGES_RAW) == 0 || $_message != do_lang('SUCCESS') && $_message != do_lang('REDIRECTING'))) {
$GLOBALS['SITE_DB']->query_insert('messages_to_render', array('r_session_id' => get_session_id(), 'r_message' => $_message, 'r_type' => $msg_type, 'r_time' => time()));
}
if (!$intermediatory_hop) {
$hash_pos = strpos($url, '#');
if ($hash_pos !== false) {
$hash_bit = substr($url, $hash_pos);
$url = substr($url, 0, $hash_pos);
} else {
$hash_bit = '';
}
$url .= (strpos($url, '?') === false ? '?' : '&') . 'redirected=1' . $hash_bit;
}
}
require_code('site2');
assign_refresh($url, 0.0);
return do_template('REDIRECT_SCREEN', array('_GUID' => '44ce3d1ffc6536b299ed0944e8ca7253', 'URL' => $url, 'TITLE' => $title, 'TEXT' => $text));
}
示例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: 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));
}
示例9: run
/**
* 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)));
}
示例10: chat_poller
/**
* Function to quickly (efficiently) check to see if there's been any chat activity.
*/
function chat_poller()
{
$message_id = get_param_integer('message_id', -1);
$event_id = get_param_integer('event_id', -1);
if (file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.dat') && filemtime(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.dat') > time() - 3 && ($message_id != -1 && file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_msg.dat') && intval(file_get_contents(get_custom_file_base() . '/data_custom/modules/chat/chat_last_msg.dat', FILE_TEXT)) <= $message_id) && ($event_id != -1 && file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_event.dat') && intval(file_get_contents(get_custom_file_base() . '/data_custom/modules/chat/chat_last_event.dat', FILE_TEXT)) <= $event_id)) {
load_user_stuff();
require_code('zones');
// Zone is needed because zones are where all ocPortal pages reside
require_code('config');
// Config is needed for much active stuff
require_code('users');
// Users are important due to permissions
$room_id = get_param_integer('room_id', -1);
require_code('chat');
chat_room_prune($room_id);
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header('Content-Type: application/xml');
$output = '<?xml version="1.0" encoding="' . get_charset() . '" ?' . '>
<response>
<result>
<chat_null>' . strval($room_id) . '</chat_null>
</result>
</response>';
exit($output);
}
touch(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.dat');
}
示例11: run
/**
* 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));
}
示例12: run
/**
* Standard modular run function for newsletter hooks.
*
* @param TIME The time that the entries found must be newer than
* @param LANGUAGE_NAME The language the entries found must be in
* @param string Category filter to apply
* @return array Tuple of result details
*/
function run($cutoff_time, $lang, $filter)
{
$new = new ocp_tempcode();
require_code('ocfiltering');
if ($filter == '') {
$filter = ',';
}
// Just welcome zone
$or_list = ocfilter_to_sqlfragment($filter, 'b.the_zone', NULL, NULL, NULL, NULL, false);
$_rows = $GLOBALS['SITE_DB']->query('SELECT a.* FROM ' . get_table_prefix() . 'cached_comcode_pages a JOIN ' . get_table_prefix() . 'comcode_pages b ON a.the_page=b.the_page AND a.the_zone=b.the_zone WHERE p_add_date>' . strval($cutoff_time) . ' AND (' . $or_list . ')', 300);
if (count($_rows) == 300) {
return array();
}
$rows = array();
foreach ($_rows as $row) {
$rows[$row['the_zone'] . ':' . $row['the_page']] = $row;
}
$_rows2 = $GLOBALS['SITE_DB']->query_select('seo_meta', array('*'), array('meta_for_type' => 'comcode_page'));
$rows2 = array();
foreach ($_rows2 as $row) {
$rows2[$row['meta_for_id']] = $row;
}
$zones = explode(',', $filter);
//find_all_zones();
foreach ($zones as $zone) {
if ($zone == 'cms') {
continue;
}
if ($zone == 'adminzone') {
continue;
}
$pages = find_all_pages($zone, 'comcode_custom/' . get_site_default_lang(), 'txt', false, $cutoff_time);
foreach (array_keys($pages) as $page) {
if (!is_string($page)) {
$page = strval($page);
}
// PHP can be weird when things like '404' are put in arrays
if (substr($page, 0, 6) == 'panel_') {
continue;
}
$id = $zone . ':' . $page;
$_url = build_url(array('page' => $page), $zone, NULL, false, false, true);
$url = $_url->evaluate();
$name = ucfirst(str_replace('_', ' ', $page));
if (array_key_exists($id, $rows)) {
$_name = get_translated_text($rows[$id]['cc_page_title'], NULL, NULL, true);
if (!is_null($_name)) {
$name = $_name;
}
}
$description = '';
$member_id = NULL;
if (array_key_exists($id, $rows2)) {
$description = get_translated_text($rows2[$id]['meta_description']);
}
$new->attach(do_template('NEWSLETTER_NEW_RESOURCE_FCOMCODE', array('_GUID' => '67f165847dacd54d2965686d561b57ee', 'MEMBER_ID' => $member_id, 'URL' => $url, 'NAME' => $name, 'DESCRIPTION' => $description)));
}
}
return array($new, do_lang('PAGES', '', '', '', $lang));
}
示例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)
{
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'));
}
示例14: 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();*/
}
示例15: 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')));
}