예제 #1
1
 /**
  * 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();
 }
예제 #2
1
 /**
  * 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();
 }
예제 #3
0
 /**
  * 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));
 }
예제 #4
0
 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();*/
 }
예제 #5
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     $url = array_key_exists('param', $map) ? $map['param'] : 'http://ocportal.com/backend.php?type=rss&mode=news&filter=16,17,18,19,20';
     // http://channel9.msdn.com/Feeds/RSS/
     require_code('rss');
     $rss = new rss($url);
     if (!is_null($rss->error)) {
         return paragraph($rss->error, 'gfgrtyhyyfhd');
     }
     global $NEWS_CATS;
     $NEWS_CATS = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('nc_owner' => NULL));
     $NEWS_CATS = list_to_map('id', $NEWS_CATS);
     $_postdetailss = array();
     // Now for the actual stream contents
     $max = array_key_exists('max_entries', $map) ? intval($map['max_entries']) : 10;
     $content = new ocp_tempcode();
     foreach ($rss->gleamed_items as $i => $item) {
         if ($i >= $max) {
             break;
         }
         if (array_key_exists('full_url', $item)) {
             $full_url = $item['full_url'];
         } elseif (array_key_exists('guid', $item)) {
             $full_url = $item['guid'];
         } elseif (array_key_exists('comment_url', $item)) {
             $full_url = $item['comment_url'];
         } else {
             $full_url = '';
         }
         $_title = $item['title'];
         $date = array_key_exists('clean_add_date', $item) ? get_timezoned_date($item['clean_add_date']) : array_key_exists('add_date', $item) ? $item['add_date'] : '';
         $_postdetailss[] = array('DATE' => $date, 'FULL_URL' => $full_url, 'NEWS_TITLE' => $_title);
     }
     return do_template('BLOCK_BOTTOM_NEWS', array('_GUID' => '0fc123199c4d4b7af5a26706271b1f4f', 'POSTS' => $_postdetailss));
 }
예제 #6
0
 /**
  * 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'), '');
     }
 }
예제 #7
0
 /**
  * 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');
 }
예제 #8
0
 /**
  * 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)));
 }
/**
 * 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));
}
예제 #10
0
파일: iotd.php 프로젝트: erico-deh/ocPortal
 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     require_code('uploads');
     $urls = get_url('', 'file', 'uploads/iotds', 0, OCP_UPLOAD_IMAGE, true, '', 'file2');
     if ($urls[0] == '') {
         if (!is_null(post_param_integer('id', NULL))) {
             $rows = $GLOBALS['SITE_DB']->query_select('iotds', array('url', 'thumb_url'), array('id' => post_param_integer('id')), '', 1);
             $urls = $rows[0];
             $url = $urls['url'];
             $thumb_url = $urls['thumb_url'];
         } else {
             warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
         }
     } else {
         $url = $urls[0];
         $thumb_url = $urls[1];
     }
     $caption = comcode_to_tempcode(post_param('caption', ''));
     $title = comcode_to_tempcode(post_param('title', ''));
     require_code('images');
     $thumb = do_image_thumb(url_is_local($thumb_url) ? get_custom_base_url() . '/' . $thumb_url : $thumb_url, $caption, true);
     $url = url_is_local($url) ? get_custom_base_url() . '/' . $url : $url;
     $preview = do_template('IOTD', array('ID' => '', 'IMAGE_URL' => $url, 'SUBMITTER' => strval(get_member()), 'VIEW_URL' => $url, 'IMAGE' => $thumb, 'CAPTION' => $title));
     return array($preview, NULL);
 }
예제 #11
0
/**
 * Get a netlink block / direct to a netlink site.
 *
 * @param  URLPATH		The URL we grab our netlink from. If this is not blank, instead of getting a netlink block, we direct to a netlink site.
 * @return tempcode		The netlink block
 */
function do_netlink($redir_url = '')
{
    header('Content-type: text/plain; charset=' . get_charset());
    // If we are redirecting
    if ($redir_url != '') {
        if (strpos($redir_url, chr(10)) !== false || strpos($redir_url, chr(13)) !== false) {
            log_hack_attack_and_exit('HEADER_SPLIT_HACK');
        }
        header('Location: ' . $redir_url);
        exit;
    }
    // Ok we're displaying a netlink, which will be dumped right into the body of the reading site
    //  - this isn't actually a weburl that is actually displayed, its loaded by ocPortal and embedded-inline
    // For all the names in our network
    require_code('textfiles');
    $lines = explode(chr(10), read_text_file('netlink', NULL, true));
    if (count($lines) == 0) {
        return new ocp_tempcode();
    }
    $content = new ocp_tempcode();
    foreach ($lines as $line) {
        $parts = explode('=', $line, 2);
        if (count($parts) != 2) {
            continue;
        }
        $name = rtrim($parts[0]);
        $url = trim($parts[1]);
        // Are we looking at the source site in the network?
        $selected = strtolower($url) == strtolower(get_param('source', ''));
        $content->attach(form_input_list_entry(base64_encode($url), $selected, $name));
    }
    return do_template('NETLINK', array('_GUID' => '180321222dc5dc99a231597c803f0726', 'CONTENT' => $content));
}
예제 #12
0
/**
 * 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');
}
예제 #13
0
 /**
  * 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)));
 }
예제 #14
0
 /**
  * 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));
 }
예제 #15
0
 /**
  * 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));
 }
예제 #16
0
 /**
  * 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'));
 }
예제 #17
0
 /**
  * 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));
 }
예제 #18
0
 /**
  * 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;
 }
예제 #19
0
파일: iotd.php 프로젝트: erico-deh/ocPortal
 function setUp()
 {
     parent::setUp();
     require_code('iotds');
     $this->iotd_id = add_iotd('http://google.com', 'welcome', 'Google', 'images/google.jpg', 0, 0, 0, 0, 'Notes ?', NULL, NULL, 0, NULL, 0, NULL);
     $this->assertTrue('http://google.com' == $GLOBALS['SITE_DB']->query_value('iotd', 'url', array('id' => $this->iotd_id)));
 }
예제 #20
0
 /**
  * Standard modular simple function for ajax-tree hooks. Returns a normal <select> style <option>-list, for fallback purposes
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root) - not always supported
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return tempcode		The nice list
  */
 function simple($id, $options, $it = NULL)
 {
     unset($id);
     unset($options);
     require_code('ocf_forums2');
     return ocf_nice_get_topic_tree(is_null($it) ? NULL : intval($it));
 }
예제 #21
0
 /**
  * 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 for symbol hooks. Searches for tasks to perform.
  *
  * @param  array		Symbol parameters
  * @return string		Result
  */
 function run($param)
 {
     $value = '';
     if (array_key_exists(1, $param)) {
         $map = NULL;
         $entry_id = intval($param[0]);
         $field_id = intval($param[1]);
         static $cache = array();
         if (isset($cache[$entry_id])) {
             $map = $cache[$entry_id];
         } else {
             require_code('catalogues');
             $entry = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('id' => $entry_id), '', 1);
             if (array_key_exists(0, $entry)) {
                 $catalogue = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $entry[0]['c_name']), '', 1);
                 if (array_key_exists(0, $catalogue)) {
                     $map = get_catalogue_entry_map($entry[0], $catalogue[0], 'PAGE', 'DEFAULT', NULL, NULL);
                 }
             }
             $cache[$entry_id] = $map;
         }
         if (!is_null($map)) {
             if (isset($map['FIELD_' . strval($field_id)])) {
                 $value = $map['FIELD_' . strval($field_id)];
             } elseif (isset($map['_FIELD_' . strval($field_id)])) {
                 $value = $map['_FIELD_' . strval($field_id)];
             }
         }
         if (is_object($value)) {
             $value = $value->evaluate();
         }
     }
     return $value;
 }
예제 #23
0
 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     require_code('comcode_add');
     $comcode = _get_preview_environment_comcode(post_param('tag'));
     $temp_tpl = comcode_to_tempcode($comcode[0]);
     return array($temp_tpl, NULL);
 }
예제 #24
0
 /**
  * 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));
     }
 }
예제 #25
0
 /**
  * Standard modular render function for profile tabs edit hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return ?array			A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $title = do_lang_tempcode('DELETE_MEMBER');
     $order = 200;
     // Actualiser
     $delete_account = post_param_integer('delete', 0);
     if ($delete_account == 1) {
         if (is_guest($member_id_of)) {
             warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
         }
         ocf_delete_member($member_id_of);
         inform_exit(do_lang_tempcode('SUCCESS'));
     }
     if ($leave_to_ajax_if_possible) {
         return NULL;
     }
     // UI fields
     $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
     $text = do_lang_tempcode('_DELETE_MEMBER' . ($member_id_of == get_member() ? '_SUICIDAL' : ''), escape_html($username));
     $fields = new ocp_tempcode();
     require_code('form_templates');
     $fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false));
     $javascript = '';
     return array($title, $fields, $text, $javascript, $order);
 }
예제 #26
0
/**
 * 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'));
}
예제 #27
0
 /**
  * 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.
  *
  * @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')));
 }
예제 #29
0
 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     if (!has_specific_permission(get_member(), 'comcode_dangerous')) {
         exit;
     }
     require_code('zones2');
     require_code('zones3');
     $bparameters = '';
     $bparameters_xml = '';
     $block = post_param('block');
     $parameters = get_block_parameters($block);
     $parameters[] = 'failsafe';
     $parameters[] = 'cache';
     $parameters[] = 'quick_cache';
     foreach ($parameters as $parameter) {
         $value = post_param($parameter, NULL);
         if (is_null($value)) {
             if (post_param_integer('tick_on_form__' . $parameter, NULL) === NULL) {
                 continue;
             }
             // If not on form, continue, otherwise must be 0
             $value = '0';
         }
         if ($value != '' && ($parameter != 'failsafe' || $value == '1') && ($parameter != 'cache' || $value != block_cache_default($block)) && ($parameter != 'quick_cache' || $value == '1')) {
             $bparameters .= ' ' . $parameter . '="' . str_replace('"', '\\"', $value) . '"';
             $bparameters_xml = '<blockParam key="' . escape_html($parameter) . '" val="' . escape_html($value) . '" />';
         }
     }
     $comcode = '[block' . $bparameters . ']' . $block . '[/block]';
     $preview = comcode_to_tempcode($comcode);
     return array($preview, NULL);
 }
예제 #30
0
 /**
  * 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;
 }