コード例 #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
0
ファイル: watch_chatroom.php プロジェクト: erico-deh/ocPortal
 /**
  * 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
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('watch_chatroom', array('h', 'u'), array(true)), '', '');
     } else {
         require_code('chat');
         if (array_key_exists('u', $options) || array_key_exists('unwatch', $options)) {
             delete_value('occle_watched_chatroom');
             $_chatroom = do_lang('SUCCESS');
         } elseif (array_key_exists(0, $parameters)) {
             if (is_numeric($parameters[0])) {
                 $chatroom = $parameters[0];
             } else {
                 $chatroom = get_chatroom_id($parameters[0]);
             }
             if (is_null($chatroom)) {
                 return array('', '', '', do_lang('MISSING_RESOURCE'));
             }
             set_value('occle_watched_chatroom', $chatroom);
             $_chatroom = get_chatroom_name($chatroom);
         } else {
             $_chatroom = get_chatroom_name(intval(get_value('occle_watched_chatroom')), true);
             if (is_null($_chatroom)) {
                 return array('', '', '', do_lang('MISSING_RESOURCE'));
             }
         }
         return array('', '', $_chatroom, '');
     }
 }
コード例 #3
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('type_validation');
     require_lang('phpdoc');
     require_code('php');
     require_css('adminzone');
     disable_php_memory_limit();
     $filename = (array_key_exists('param', $map) ? $map['param'] : 'sources/global2') . '.php';
     if (substr($filename, -8) == '.php.php') {
         $filename = substr($filename, 0, strlen($filename) - 4);
     }
     $full_path = (get_file_base() != '' ? get_file_base() . '/' : '') . filter_naughty($filename);
     if (!file_exists($full_path)) {
         return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $_classes = get_php_file_api($filename);
     $classes = new ocp_tempcode();
     foreach ($_classes as $class) {
         if ($class['name'] == '__global') {
             $class['name'] = do_lang('GLOBAL_FUNCTIONS') . '_' . basename($filename);
         }
         $function_summaries = new ocp_tempcode();
         $functions = new ocp_tempcode();
         foreach ($class['functions'] as $function) {
             $ret = render_php_function($function, $class);
             $functions->attach($ret[0]);
             $function_summaries->attach($ret[1]);
         }
         $classes->attach(do_template('PHP_CLASS', array('_GUID' => '5d58fc42c5fd3a5dd190f3f3699610c2', 'CLASS_NAME' => $class['name'], 'FUNCTION_SUMMARIES' => $function_summaries, 'FUNCTIONS' => $functions)));
     }
     return do_template('PHP_FILE', array('_GUID' => '6f422e6a6e846d49864d7325b212109f', 'FILENAME' => $filename, 'CLASSES' => $classes));
 }
コード例 #4
0
ファイル: main_notes.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('textfiles');
     $file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
     $title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
     $lang_none = array_key_exists('lang_none', $map) ? $map['lang_none'] : '0';
     $scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
     $lang = $lang_none == '1' ? NULL : '';
     $file = filter_naughty($file, true);
     $new = post_param('new', NULL);
     if (!is_null($new)) {
         $hooks = find_all_hooks('blocks', 'main_notes');
         foreach (array_keys($hooks) as $hook) {
             require_code('hooks/blocks/main_notes/' . filter_naughty_harsh($hook));
             $ob = object_factory('Hook_notes_' . filter_naughty_harsh($hook), true);
             if (is_null($ob)) {
                 continue;
             }
             $ob->run($file);
         }
         write_text_file($file, $lang, $new);
         log_it('NOTES', $file);
         attach_message(do_lang_tempcode('SUCCESS'), 'inform');
     }
     $contents = read_text_file($file, $lang, true);
     $post_url = get_self_url();
     $map_comcode = '';
     foreach ($map as $key => $val) {
         $map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
     }
     return do_template('BLOCK_MAIN_NOTES', array('_GUID' => 'f737053505de3bd8ccfe806ec014b8fb', 'TITLE' => $title, 'BLOCK_NAME' => 'main_notes', 'MAP' => $map_comcode, 'CONTENTS' => $contents, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'URL' => $post_url));
 }
コード例 #5
0
ファイル: main_greeting.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     $forum = get_forum_type();
     $out = new ocp_tempcode();
     if ($forum != 'none') {
         // Standard welcome back vs into greeting
         $member = get_member();
         if (is_guest($member)) {
             $redirect = get_self_url(true, true);
             $login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => $redirect), get_module_zone('login'));
             $join_url = $GLOBALS['FORUM_DRIVER']->join_url();
             $join_bits = do_template('JOIN_OR_LOGIN', array('LOGIN_URL' => $login_url, 'JOIN_URL' => $join_url));
             $p = do_lang_tempcode('WELCOME', $join_bits);
             $out->attach(paragraph($p, 'hhrt4dsgdsgd'));
         } else {
             $out->attach(paragraph(do_lang_tempcode('WELCOME_BACK', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member))), 'gfgdf9gjd'));
         }
     }
     $message = get_option('welcome_message');
     if (has_actual_page_access(get_member(), 'admin_config')) {
         if ($message != '') {
             $message .= ' [[page="_SEARCH:admin_config:category:SITE#group_GENERAL"]' . do_lang('EDIT') . '[/page]]';
         }
     }
     $out->attach(comcode_to_tempcode($message, NULL, true));
     return $out;
 }
コード例 #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
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('send_chatmessage', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'send_chatmessage'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'send_chatmessage'));
         }
         require_code('chat');
         if (is_numeric($parameters[0])) {
             $chatroom = $parameters[0];
         } elseif ($parameters[0] == 'first-watched') {
             $_chatroom = get_value('occle_watched_chatroom');
             $chatroom = is_null($_chatroom) ? $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'id', NULL, 'ORDER BY id') : intval($_chatroom);
         } else {
             $chatroom = get_chatroom_id($parameters[0]);
         }
         if (is_null($chatroom)) {
             return array('', '', '', do_lang('MISSING_RESOURCE'));
         }
         chat_post_message($chatroom, $parameters[1], get_option('chat_default_post_font'), get_option('chat_default_post_colour'));
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
コード例 #7
0
ファイル: rm.php プロジェクト: erico-deh/ocPortal
 /**
  * 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  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('rm', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'rm'));
         }
         $success = true;
         foreach ($parameters as $i => $param) {
             $param = $occle_fs->_pwd_to_array($param);
             if (!$occle_fs->_is_file($param)) {
                 $success = false;
                 if ($i == 0 && count($parameters) == 1) {
                     return array('', '', '', do_lang('NOT_A_FILE', strval($i + 1)));
                 }
             }
             $success = $success && $occle_fs->remove_file($param);
         }
     }
     if ($success) {
         return array('', '', do_lang('SUCCESS'), '');
     } else {
         return array('', '', '', do_lang('INCOMPLETE_ERROR'));
     }
 }
コード例 #8
0
ファイル: news.php プロジェクト: erico-deh/ocPortal
 /**
  * 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
  * @param  BINARY				Whether to use full article instead of summary
  * @return array				Tuple of result details
  */
 function run($cutoff_time, $lang, $filter, $in_full = 1)
 {
     if (!addon_installed('news')) {
         return array();
     }
     require_lang('news');
     $new = new ocp_tempcode();
     require_code('ocfiltering');
     $or_list = ocfilter_to_sqlfragment($filter, 'news_category');
     $or_list_2 = ocfilter_to_sqlfragment($filter, 'news_entry_category');
     $rows = $GLOBALS['SITE_DB']->query('SELECT title,news,news_article,id,date_and_time,submitter FROM ' . get_table_prefix() . 'news LEFT JOIN ' . get_table_prefix() . 'news_category_entries ON news_entry=id WHERE validated=1 AND date_and_time>' . strval((int) $cutoff_time) . ' AND ((' . $or_list . ') OR (' . $or_list_2 . ')) ORDER BY date_and_time DESC', 300);
     if (count($rows) == 300) {
         return array();
     }
     $rows = remove_duplicate_rows($rows, 'id');
     foreach ($rows as $row) {
         $_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news'), NULL, false, false, true);
         $url = $_url->evaluate();
         $name = get_translated_text($row['title'], NULL, $lang);
         $description = get_translated_text($row[$in_full == 1 ? 'news_article' : 'news'], NULL, $lang);
         if ($description == '') {
             $description = get_translated_text($row[$in_full == 1 ? 'news' : 'news_article'], NULL, $lang);
         }
         $member_id = is_guest($row['submitter']) ? NULL : strval($row['submitter']);
         $new->attach(do_template('NEWSLETTER_NEW_RESOURCE_FCOMCODE', array('_GUID' => '4eaf5ec00db1f0b89cef5120c2486521', 'MEMBER_ID' => $member_id, 'URL' => $url, 'NAME' => $name, 'DESCRIPTION' => $description)));
     }
     return array($new, do_lang('NEWS', '', '', '', $lang));
 }
コード例 #9
0
ファイル: booking2.php プロジェクト: erico-deh/ocPortal
/**
 * Get a do-next manager for bookings.
 *
 * @return tempcode	Booking do-next manager.
 */
function booking_do_next()
{
    require_lang('calendar');
    require_code('templates_donext');
    require_code('fields');
    return do_next_manager(get_page_title('BOOKINGS'), comcode_lang_string('DOC_BOOKING'), array(has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('bookable', array('_SELF', array('type' => 'ad'), '_SELF'), do_lang('ADD_BOOKABLE')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('bookable', array('_SELF', array('type' => 'ed'), '_SELF'), do_lang('EDIT_BOOKABLE')) : NULL, has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('supplement', array('_SELF', array('type' => 'av'), '_SELF'), do_lang('ADD_BOOKABLE_SUPPLEMENT')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('supplement', array('_SELF', array('type' => 'ev'), '_SELF'), do_lang('EDIT_BOOKABLE_SUPPLEMENT')) : NULL, has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('blacked', array('_SELF', array('type' => 'ac'), '_SELF'), do_lang('ADD_BOOKABLE_BLACKED')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('blacked', array('_SELF', array('type' => 'ec'), '_SELF'), do_lang('EDIT_BOOKABLE_BLACKED')) : NULL, has_specific_permission(get_member(), 'submit_highrange_content', 'cms_booking') ? array('booking', array('_SELF', array('type' => 'ab'), '_SELF'), do_lang('ADD_BOOKING')) : NULL, has_specific_permission(get_member(), 'edit_highrange_content', 'cms_booking') ? array('booking', array('_SELF', array('type' => 'eb'), '_SELF'), do_lang('EDIT_BOOKING')) : NULL, has_actual_page_access(get_member(), 'calendar') ? array('calendar', array('calendar', array('type' => 'misc', 'view' => 'month'), '_SEARCH'), do_lang('CALENDAR')) : NULL), do_lang('BOOKINGS'));
}
コード例 #10
0
ファイル: gifts.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function.
  *
  * @param  MEMBER		The ID of the member we are getting link hooks for
  * @return array		List of tuples for results. Each tuple is: type,title,url
  */
 function get_sections($member_id)
 {
     require_lang('ocgifts');
     $rows = $GLOBALS['SITE_DB']->query_select('members_gifts', array('*'), array('to_user_id' => $member_id), '', NULL, 0, true);
     if (is_null($rows)) {
         return array();
     }
     $gifts = array();
     foreach ($rows as $gift) {
         $gift_info = $GLOBALS['SITE_DB']->query_select('ocgifts', array('*'), array('id' => $gift['gift_id']));
         if (strlen($gift_info[0]['name']) > 0) {
             if ($gift['is_anonymous'] == 0) {
                 $sender_name = $GLOBALS['FORUM_DRIVER']->get_username($gift['from_user_id']);
                 $sender_link = $GLOBALS['FORUM_DRIVER']->member_profile_url($gift['from_user_id']);
                 $gift_explanation = do_lang('GIFT_EXPLANATION1', $sender_name, $gift_info[0]['name'], $sender_link);
             } else {
                 $gift_explanation = do_lang('GIFT_EXPLANATION2', $gift_info[0]['name']);
             }
             $image_url = '';
             if (is_file(get_file_base() . '/' . urldecode($gift_info[0]['image']))) {
                 $image_url = get_custom_base_url() . '/' . $gift_info[0]['image'];
             }
             $gifts[] = array('GIFT_EXPLANATION' => $gift_explanation, 'IMAGE_URL' => $image_url);
         }
     }
     $gifts_block = do_template('OCF_MEMBER_SCREEN_GIFTS_WRAP', array('_GUID' => 'fd4b5344b3b16cdf129e49bae903cbb2', 'GIFTS' => $gifts));
     return array($gifts_block);
 }
コード例 #11
0
ファイル: rmdir.php プロジェクト: erico-deh/ocPortal
 /**
  * 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  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('rmdir', array('h', 'f'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'rmdir'));
         } else {
             $parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
         }
         if (!$occle_fs->_is_dir($parameters[0])) {
             return array('', '', '', do_lang('NOT_A_DIR', '1'));
         }
         if (!array_key_exists('f', $options)) {
             $listing = $occle_fs->listing($parameters[0]);
             if (count($listing[0]) != 0 || count($listing[1]) != 0) {
                 return array('', '', '', do_lang('NOT_EMPTY_FORCE', '1'));
             }
         }
         $success = $occle_fs->remove_directory($parameters[0]);
         if ($success) {
             return array('', '', do_lang('SUCCESS'), '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
     }
 }
コード例 #12
0
ファイル: cat.php プロジェクト: erico-deh/ocPortal
 /**
  * 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  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('cat', array('h'), array('l')), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'cat'));
         }
         $line_numbers = array_key_exists('l', $options);
         $output = '';
         for ($i = 0; $i < count($parameters); $i++) {
             $parameters[$i] = $occle_fs->_pwd_to_array($parameters[$i]);
             if (!$occle_fs->_is_file($parameters[$i])) {
                 return array('', '', '', do_lang('NOT_A_FILE', integer_format($i + 1)));
             }
             $lines = explode(chr(10), $occle_fs->read_file($parameters[$i]));
             foreach ($lines as $j => $line) {
                 if ($line_numbers) {
                     $output .= str_pad(strval($j + 1), strlen(strval(count($lines)))) . '  ';
                 }
                 $output .= $line . chr(10);
             }
         }
         return array('', '', $output, '');
     }
 }
コード例 #13
0
ファイル: polls.php プロジェクト: erico-deh/ocPortal
 /**
  * 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;
 }
コード例 #14
0
ファイル: activities.php プロジェクト: erico-deh/ocPortal
 /**
  * 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'));
 }
コード例 #15
0
ファイル: leader_board.php プロジェクト: erico-deh/ocPortal
 /**
  * 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));
 }
コード例 #16
0
ファイル: find_codes.php プロジェクト: erico-deh/ocPortal
 /**
  * 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
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('find_codes', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'find_codes'));
         }
         $path = get_custom_file_base() . '/sources/';
         $files = array();
         if (is_dir($path)) {
             $dh = opendir($path);
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..') {
                     if (!is_dir($path . $file)) {
                         $contents = file_get_contents($path . $file, FILE_TEXT);
                         if (strpos($contents, $parameters[0]) !== false) {
                             $files[] = $path . $file;
                         }
                     }
                     unset($contents);
                     // Got to be careful with that memory :-(
                 }
             }
             return array('', do_template('OCCLE_FIND_CODES', array('_GUID' => '3374d1a80727aecc271722f2184743d0', 'FILES' => $files)), '', '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
         // Directory doesn't exist
     }
 }
コード例 #17
0
ファイル: permissions2.php プロジェクト: erico-deh/ocPortal
/**
 * Log permission checks to the permission_checks.log file
 *
 * @param  MEMBER         The user checking against
 * @param  ID_TEXT        The function that was called to check a permission
 * @param  array          Parameters to this permission-checking function
 * @param  boolean        Whether the permission was held
 */
function _handle_permission_check_logging($member, $op, $params, $result)
{
    global $PERMISSION_CHECK_LOGGER;
    if ($op == 'has_specific_permission') {
        require_all_lang();
        $params[0] = $params[0] . ' ("' . do_lang('PT_' . $params[0]) . '")';
    }
    $str = $op;
    if (count($params) != 0) {
        $str .= ': ';
        foreach ($params as $i => $p) {
            if ($i != 0) {
                $str .= ',';
            }
            $str .= is_string($p) ? $p : (is_null($p) ? '' : strval($p));
        }
    }
    if ($PERMISSION_CHECK_LOGGER !== false && !$result) {
        fwrite($PERMISSION_CHECK_LOGGER, "\t" . $str);
        $username = $GLOBALS['FORUM_DRIVER']->get_username($member);
        if (is_null($username)) {
            $username = do_lang('UNKNOWN');
        }
        if ($member != get_member()) {
            fwrite($PERMISSION_CHECK_LOGGER, ' -- ' . $username);
        }
        //	fwrite($PERMISSION_CHECK_LOGGER,' --> '.($result?do_lang('YES'):do_lang('NO')).chr(10));
        fwrite($PERMISSION_CHECK_LOGGER, chr(10));
        sync_file(get_custom_file_base() . '/data_custom/permissioncheckslog.php');
    }
    if (function_exists('fb') && get_param_integer('keep_firephp', 0) == 1 && !headers_sent()) {
        fb('Permission check ' . ($result ? 'PASSED' : 'FAILED') . ': ' . $str);
    }
}
コード例 #18
0
ファイル: help.php プロジェクト: erico-deh/ocPortal
 /**
  * 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
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists(0, $parameters)) {
         // Load up the relevant block and grab its help output
         $hooks = find_all_hooks('modules', 'admin_occle_commands');
         $hook_return = NULL;
         foreach (array_keys($hooks) as $hook) {
             if ($hook == $parameters[0]) {
                 require_code('hooks/modules/admin_occle_commands/' . filter_naughty_harsh($hook));
                 $object = object_factory('Hook_' . filter_naughty_harsh($hook), true);
                 if (is_null($object)) {
                     continue;
                 }
                 $hook_return = $object->run(array('help' => NULL), array(), $occle_fs);
                 break;
             }
         }
         if (!is_null($hook_return)) {
             return array($hook_return[0], $hook_return[1], $hook_return[2], $hook_return[3]);
         } else {
             return array('', '', '', do_lang('NO_HELP'));
         }
     } else {
         // Output a standard "how to use Occle" help page
         return array('window.open(unescape("' . urlencode('http://ocportal.com/docs' . strval(ocp_version()) . '/pg/tut_occle') . '"),"occle_window1","");', '', do_lang('SUCCESS'), '');
     }
 }
コード例 #19
0
ファイル: cedi.php プロジェクト: erico-deh/ocPortal
 /**
  * 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'));
 }
コード例 #20
0
ファイル: mv.php プロジェクト: erico-deh/ocPortal
 /**
  * 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  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('mv', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'mv'));
         } else {
             $parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
         }
         if (!array_key_exists(1, $parameters)) {
             $parameters[1] = $occle_fs->print_working_directory(true);
         } else {
             $parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
         }
         if (!$occle_fs->_is_file($parameters[0])) {
             return array('', '', '', do_lang('NOT_A_FILE', '1'));
         }
         if (!$occle_fs->_is_dir($parameters[1])) {
             return array('', '', '', do_lang('NOT_A_DIR', '2'));
         }
         $success = $occle_fs->move_file($parameters[0], $parameters[1]);
         if ($success) {
             return array('', '', do_lang('SUCCESS'), '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
     }
 }
コード例 #21
0
ファイル: chat.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for OcCLE notification hooks.
  *
  * @param  ?integer	The "current" time on which to base queries (NULL: now)
  * @return ~array		Array of section, type and message responses (false: nothing)
  */
 function run($timestamp = NULL)
 {
     if (!addon_installed('chat')) {
         return false;
     }
     if (!is_null(get_value('occle_watched_chatroom'))) {
         require_lang('chat');
         if (is_null($timestamp)) {
             $timestamp = time();
         }
         $room = intval(get_value('occle_watched_chatroom'));
         $room_messages = $GLOBALS['SITE_DB']->query('SELECT COUNT(*) AS cnt FROM ' . get_table_prefix() . 'chat_messages WHERE room_id=' . strval($room) . ' AND date_and_time>=' . strval((int) $timestamp));
         if (!array_key_exists(0, $room_messages)) {
             return false;
         }
         if ($room_messages[0]['cnt'] > 0) {
             $rooms = array();
             $messages = $room_messages[0]['cnt'];
             $room_data = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'room_name', array('id' => $room));
             if (is_null($room_data)) {
                 return false;
             }
             // Selected room deleted
             $rooms[$room_data] = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $room), get_module_zone('chat'));
             return array(do_lang('SECTION_CHAT'), do_lang('NEW_MESSAGES'), do_template('OCCLE_CHAT_NOTIFICATION', array('MESSAGE_COUNT' => integer_format($messages), 'ROOMS' => $rooms)));
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
コード例 #22
0
ファイル: ocf_members.php プロジェクト: erico-deh/ocPortal
 /**
  * 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 (!has_actual_page_access(get_member(), 'members')) {
         return NULL;
     }
     $rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members p WHERE m_join_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND m_validated=1 AND m_validated_email_confirm_code=\'\' ' : '') . ' ORDER BY m_join_time DESC', $max);
     $categories = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         $id = strval($row['id']);
         $author = '';
         $news_date = date($date_string, $row['m_join_time']);
         $edit_date = '';
         $news_title = xmlentities($row['m_username']);
         $summary = '';
         $news = '';
         $category = array_key_exists($row['m_primary_group'], $categories) ? $categories[$row['m_primary_group']] : '';
         $category_raw = strval($row['m_primary_group']);
         $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['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)));
     }
     require_lang('ocf');
     return array($content, do_lang('MEMBERS'));
 }
コード例 #23
0
ファイル: find.php プロジェクト: erico-deh/ocPortal
 /**
  * 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  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('find', array('h', 'p', 'r', 'f', 'd'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'find'));
         }
         if (!(array_key_exists('d', $options) || array_key_exists('directories', $options))) {
             $directories = false;
         } elseif (array_key_exists('d', $options)) {
             $directories = $options['d'] == '1';
         } else {
             $directories = $options['directories'] == '1';
         }
         if (!(array_key_exists('f', $options) || array_key_exists('files', $options))) {
             $files = true;
         } elseif (array_key_exists('f', $options)) {
             $files = $options['f'] == '1';
         } else {
             $files = $options['files'] == '1';
         }
         if (!array_key_exists(1, $parameters)) {
             $parameters[1] = $occle_fs->print_working_directory(true);
         } else {
             $parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
         }
         if (!$occle_fs->_is_dir($parameters[1])) {
             return array('', '', '', do_lang('NOT_A_DIR', '2'));
         }
         $listing = $occle_fs->search($parameters[0], array_key_exists('p', $options) || array_key_exists('preg', $options), array_key_exists('r', $options) || array_key_exists('recursive', $options), $files, $directories, $parameters[1]);
         return array('', do_template('OCCLE_LS', array('DIRECTORY' => $occle_fs->_pwd_to_string($parameters[1]), 'DIRECTORIES' => $listing[0], 'FILES' => $listing[1])), '', '');
     }
 }
コード例 #24
0
 /**
  * Function to find Alexa details of the site.
  *
  * @param  string		The URL of the site which you want to find out information on.)
  * @return array		Returns a triple array with the rank, the amount of links, and the speed of the site.
  */
 function getAlexaRank($url)
 {
     require_lang('staff_checklist');
     require_code('files');
     $p = array();
     $result = http_download_file('http://data.alexa.com/data?cli=10&dat=s&url=' . $url, NULL, false, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1.0);
     if (preg_match('#<POPULARITY [^<>]*TEXT="([0-9]+){1,}"#si', $result, $p) != 0) {
         $rank = integer_format(intval($p[1]));
     } else {
         $rank = do_lang('NA');
     }
     if (preg_match('#<LINKSIN [^<>]*NUM="([0-9]+){1,}"#si', $result, $p) != 0) {
         $links = integer_format(intval($p[1]));
     } else {
         $links = '0';
     }
     if (preg_match('#<SPEED [^<>]*PCT="([0-9]+){1,}"#si', $result, $p) != 0) {
         $speed = 'Top ' . integer_format(100 - intval($p[1])) . '%';
     } else {
         $speed = '?';
     }
     // we would like, but cannot get (without an API key)...
     /*
     			time on site
     			reach (as a percentage)
     			page views
     			audience (i.e. what country views the site most)
     */
     return array($rank, $links, $speed);
 }
コード例 #25
0
/**
 * 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));
}
コード例 #26
0
 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (get_forum_type() != 'ocf') {
         return;
     }
     $time = time();
     $last_time = intval(get_value('last_confirm_reminder_time'));
     if ($last_time > time() - 24 * 60 * 60 * 2) {
         return;
     }
     set_value('last_confirm_reminder_time', strval($time));
     require_code('mail');
     require_lang('ocf');
     $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members WHERE ' . db_string_not_equal_to('m_validated_email_confirm_code', '') . ' AND m_join_time>' . strval($last_time));
     $GLOBALS['NO_DB_SCOPE_CHECK'] = false;
     foreach ($rows as $row) {
         $coppa = get_option('is_on_coppa') == '1' && utctime_to_usertime(time() - mktime(0, 0, 0, $row['m_dob_month'], $row['m_dob_day'], $row['m_dob_year'])) / 31536000.0 < 13.0;
         if (!$coppa) {
             $zone = get_module_zone('join');
             if ($zone != '') {
                 $zone .= '/';
             }
             $url = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4&email=' . rawurlencode($row['m_email_address']) . '&code=' . $row['m_validated_email_confirm_code'];
             $url_simple = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4';
             $message = do_lang('OCF_SIGNUP_TEXT', comcode_escape(get_site_name()), comcode_escape($url), array($url_simple, $row['m_email_address'], strval($row['m_validated_email_confirm_code'])), $row['m_language']);
             mail_wrap(do_lang('CONFIRM_EMAIL_SUBJECT', get_site_name(), NULL, NULL, $row['m_language']), $message, array($row['m_email_address']), $row['m_username']);
         }
     }
 }
コード例 #27
0
ファイル: ban_member.php プロジェクト: erico-deh/ocPortal
 /**
  * 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'), '');
     }
 }
コード例 #28
0
ファイル: grep.php プロジェクト: erico-deh/ocPortal
 /**
  * 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  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('grep', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'grep'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'grep'));
         } else {
             $parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
         }
         if (!$occle_fs->_is_file($parameters[1])) {
             return array('', '', '', do_lang('NOT_A_FILE', '2'));
         }
         $_lines = unixify_line_format($occle_fs->read_file($parameters[1]));
         $lines = explode("\n", $_lines);
         if ($parameters[0] == '' || $parameters[0][0] != '#' && $parameters[0][0] != '/') {
             $parameters[0] = '#' . $parameters[0] . '#';
         }
         $matches = preg_grep($parameters[0], $lines);
         $output = '';
         foreach ($matches as $value) {
             $output .= $value . "\n";
         }
         return array('', '', $output, '');
     }
 }
コード例 #29
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     require_all_lang();
     $blocks = new ocp_tempcode();
     require_code('zones2');
     require_code('zones3');
     $_blocks = find_all_blocks();
     foreach (array_keys($_blocks) as $block) {
         $description = do_lang('BLOCK_' . $block . '_DESCRIPTION', NULL, NULL, NULL, NULL, false);
         if (is_null($description)) {
             continue;
         }
         $use = do_lang('BLOCK_' . $block . '_USE');
         $_parameters = get_block_parameters($block);
         if (!is_array($_parameters)) {
             continue;
         }
         $parameters = new ocp_tempcode();
         foreach ($_parameters as $parameter) {
             $_description = do_lang('BLOCK_' . $block . '_PARAM_' . $parameter, NULL, NULL, NULL, NULL, false);
             if (is_null($_description)) {
                 continue;
             }
             $parameters->attach(do_template('BLOCK_MAIN_BLOCK_HELP_PARAMETER', array('_GUID' => 'f23db88061922a68cc2401256cf69ad3', 'NAME' => $parameter, 'DESCRIPTION' => $_description)));
         }
         $blocks->attach(do_template('BLOCK_MAIN_BLOCK_HELP', array('_GUID' => '00652313faa72feac0a07d77e2dddd84', 'NAME' => $block, 'DESCRIPTION' => $description, 'USE' => $use, 'PARAMETERS' => $parameters)));
     }
     return $blocks;
 }
コード例 #30
0
ファイル: shopping.php プロジェクト: erico-deh/ocPortal
 function setUp()
 {
     parent::setUp();
     require_code('ecommerce');
     require_code('catalogues');
     require_code('catalogues2');
     require_code('shopping');
     require_lang('catalogues');
     require_lang('shopping');
     require_lang('ecommerce');
     if (!is_null($GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'c_name', array('c_name' => 'storetesting' . strval(get_member()))))) {
         actual_delete_catalogue('storetesting' . strval(get_member()));
     }
     $this->access_mapping = array(db_get_first_id() => 4);
     // Creating cms catalogues object
     require_code('cms/pages/modules/cms_catalogues.php');
     $this->cms_cat = new Module_cms_catalogues();
     //Creating Shopping cart object
     require_code('site/pages/modules/shopping.php');
     $this->shopping_cart = new Module_shopping();
     $username = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
     $this->category_id = actual_add_catalogue('storetesting' . strval(get_member()), insert_lang(do_lang('DEFAULT_CATALOGUE_PRODUCTS_TITLE'), 2), '', 0, 1, '', 0, 1);
     $fields = array(array('ECOM_CAT_product_title', 'DESCRIPTION_TITLE', 'short_trans', 1, 1, 1, 1), array('ECOM_CAT_item_code', 'ECOM_CATD_item_code', 'random', 0, 1, 1, 1), array('ECOM_CAT_price_pre_tax', 'ECOM_CATD_price_pre_tax', 'float', 0, 1, 1, 1), array('ECOM_CAT_stock_level', 'ECOM_CATD_stock_level', 'integer', 0, 0, 1, 0), array('ECOM_CAT_stock_level_warn_at', 'ECOM_CATD_stock_level_warn_at', 'integer', 0, 0, 0, 0), array('ECOM_CAT_stock_level_maintain', 'ECOM_CATD_stock_level_maintain', 'tick', 0, 1, 0, 0), array('ECOM_CAT_tax_type', 'ECOM_CATD_tax_type', 'list', 0, 1, 0, 0, "0%|5%|17.5%", 0), array('ECOM_CAT_image', 'ECOM_CATD_image', 'picture', 0, 0, 1, 1), array('ECOM_CAT_weight', 'ECOM_CATD_weight', 'float', 0, 1, 0, 0), array('ECOM_CAT_description', 'DESCRIPTION_DESCRIPTION', 'long_trans', 0, 1, 1, 1));
     foreach ($fields as $i => $field) {
         actual_add_catalogue_field('storetesting' . strval(get_member()), lang_code_to_default_content($field[0], false, 3), lang_code_to_default_content($field[1], true, 3), $field[2] == 'tick' ? 'list' : $field[2], $i, $field[3], $field[5], $field[6], $field[2] == 'tick' ? do_lang('NO') . '|' . do_lang('YES') : (array_key_exists(7, $field) ? $field[7] : ''), $field[4], array_key_exists(5, $field) ? $field[5] : 0, array_key_exists(5, $field) ? $field[5] : 0);
     }
     $catalogue_name = 'storetesting' . strval(get_member());
     //Set Sample post values
     $fields = $GLOBALS['SITE_DB']->query_select('catalogue_fields', array('*'), array('c_name' => $catalogue_name));
     foreach ($fields as $key => $val) {
         $type = $val['cf_type'];
         $id = $val['id'];
         switch ($type) {
             case 'integer':
                 $_POST['field_' . strval($id)] = 4;
                 break;
             case 'short_trans':
                 $_POST['field_' . strval($id)] = 'Test field value';
                 break;
             case 'long_trans':
                 $_POST['field_' . strval($id)] = 'Test field value';
                 break;
             case 'float':
                 $_POST['field_' . strval($id)] = 68.34999999999999;
                 break;
             case 'list':
                 if ($val['cf_order'] = 6) {
                     //Order 6 is tax
                     $_POST['field_' . strval($id)] = 'Arizona=7.8%';
                 } elseif ($val['cf_order'] = 5) {
                     //Order 5 yes keep stock "yes/no"
                     $_POST['field_' . strval($id)] = 'yes';
                 }
                 break;
         }
     }
     $map = $this->cms_cat->get_set_field_map($catalogue_name);
     $this->product_id = actual_add_catalogue_entry($this->category_id, $validated = 0, $notes = 'test note', $allow_rating = 1, $allow_comments = 1, $allow_trackbacks = 1, $map);
 }