Ejemplo n.º 1
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));
     }
 }
Ejemplo n.º 2
0
 /**
  * Standard aed_module run_start.
  *
  * @return tempcode		The output of the run
  */
 function run_start()
 {
     $this->extra_donext_whatever_title = do_lang('SECTION_FORUMS');
     $this->extra_donext_whatever = array(array('add_one', array('admin_ocf_forums', array('type' => 'ad'), get_module_zone('admin_ocf_forums'))), array('edit_one', array('admin_ocf_forums', array('type' => 'ed'), get_module_zone('admin_ocf_forums'))));
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/forums';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_forums';
     breadcrumb_set_parents(array(array('_SEARCH:admin_ocf_forums:misc', do_lang_tempcode('SECTION_FORUMS'))));
     $this->add_one_cat_label = do_lang_tempcode('ADD_FORUM_CATEGORY');
     $this->edit_this_cat_label = do_lang_tempcode('EDIT_THIS_FORUM_CATEGORY');
     $this->edit_one_cat_label = do_lang_tempcode('EDIT_FORUM_CATEGORY');
     $this->categories_title = do_lang_tempcode('MODULE_TRANS_NAME_admin_ocf_categories');
     if (get_forum_type() != 'ocf') {
         warn_exit(do_lang_tempcode('NO_OCF'));
     } else {
         ocf_require_all_forum_stuff();
     }
     require_code('ocf_forums_action');
     require_code('ocf_forums_action2');
     require_code('ocf_forums2');
     return new ocp_tempcode();
 }
Ejemplo n.º 3
0
 /**
  * The UI to view details of a gift.
  *
  * @return tempcode		The UI
  */
 function view()
 {
     $id = NULL;
     $name = '';
     $image = '';
     $price = 0;
     $category = '';
     $enabled = do_lang_tempcode('GIFT_DISABLED');
     $id = get_param_integer('id', NULL);
     if ($id !== NULL) {
         $rows = $GLOBALS['SITE_DB']->query_select('ocgifts', array('*'), array('id' => $id));
         if (isset($rows[0]['id']) && $rows[0]['id'] > 0) {
             $id = $rows[0]['id'];
             $name = $rows[0]['name'];
             $image = $rows[0]['image'];
             $price = $rows[0]['price'];
             $category = $rows[0]['category'];
             $enabled = $rows[0]['enabled'] == 1 ? do_lang_tempcode('GIFT_ENABLED') : do_lang_tempcode('GIFT_DISABLED');
         }
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('OCGIFTS_TITLE'))));
     breadcrumb_set_self(do_lang_tempcode('VIEW_GIFT'));
     require_code('templates_view_space');
     return view_space(get_page_title('VIEW_GIFT'), array('NAME' => $name, 'IMAGE' => $image, 'PRICE' => integer_format($price), 'CATEGORY' => $category, 'ENABLED' => $enabled));
 }
Ejemplo n.º 4
0
 /**
  * The actualiser to apply to join a usergroup.
  *
  * @return tempcode		The UI
  */
 function apply()
 {
     $id = post_param_integer('id', NULL);
     if (is_null($id)) {
         $_id = get_param('id');
         if (is_numeric($_id)) {
             $id = intval($_id);
         } else {
             $id = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=g.g_name', 'g.id', array('text_original' => $_id));
             if (is_null($id)) {
                 warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
             }
         }
         if ($id == db_get_first_id()) {
             warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
         }
         $_leader = ocf_get_group_property($id, 'group_leader');
         $free_access = ocf_get_group_property($id, 'open_membership') == 1;
         $name = ocf_get_group_name($id);
         $title = get_page_title('_APPLY_TO_GROUP', true, array(escape_html($name)));
         $post_url = build_url(array('page' => '_SELF', 'type' => get_param('type')), '_SELF', NULL, true);
         $hidden = form_input_hidden('id', strval($id));
         if ($free_access) {
             $text = do_lang_tempcode('ABOUT_TO_APPLY_FREE_ACCESS', escape_html($name));
         } else {
             if (is_null($_leader) || is_null($GLOBALS['FORUM_DRIVER']->get_username($_leader))) {
                 $text = do_lang_tempcode('ABOUT_TO_APPLY_STAFF', escape_html($name), escape_html(get_site_name()));
             } else {
                 $leader_username = $GLOBALS['FORUM_DRIVER']->get_username($_leader);
                 if (is_null($leader_username)) {
                     $leader_username = do_lang('UNKNOWN');
                 }
                 $leader_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($_leader, false, true);
                 $text = do_lang_tempcode('ABOUT_TO_APPLY_LEADER', escape_html($name), escape_html($leader_username), escape_html($leader_url));
             }
         }
         return do_template('YESNO_SCREEN', array('_GUID' => 'ceafde00ade4492c65ed2e6e2309a0e7', 'TITLE' => $title, 'TEXT' => $text, 'URL' => $post_url, 'HIDDEN' => $hidden));
     }
     if ($id == db_get_first_id()) {
         warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
     }
     $_name = $GLOBALS['FORUM_DB']->query_value('f_groups', 'g_name', array('id' => $id));
     $name = get_translated_text($_name, $GLOBALS['FORUM_DB']);
     $title = get_page_title('_APPLY_TO_GROUP', true, array(escape_html($name)));
     $free_access = ocf_get_group_property($id, 'open_membership') == 1;
     if (is_guest()) {
         access_denied('I_ERROR');
     }
     require_code('ocf_groups');
     if (ocf_get_group_property($id, 'open_membership') == 1) {
         return $this->add_to(true, $GLOBALS['FORUM_DRIVER']->get_username(get_member()));
     }
     ocf_member_ask_join_group($id, get_member());
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('USERGROUPS')), array('_SELF:_SELF:view:id=' . strval($id), do_lang_tempcode('USERGROUP', escape_html($name)))));
     $url = build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF');
     return redirect_screen($title, $url, do_lang_tempcode('AWAITING_GROUP_LEADER'));
 }
Ejemplo n.º 5
0
 /**
  * Standard modular render function for profile tab 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 triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $title = do_lang_tempcode('PROFILE');
     $order = 10;
     $photo_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_url');
     if ($photo_url != '' && addon_installed('ocf_member_photos') && has_specific_permission($member_id_viewing, 'view_member_photos')) {
         require_code('images');
         $photo_thumb_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_thumb_url');
         $photo_thumb_url = ensure_thumbnail($photo_url, $photo_thumb_url, strpos($photo_url, 'uploads/photos') !== false ? 'photos' : 'ocf_photos', 'f_members', $member_id_of, 'm_photo_thumb_url');
         if (url_is_local($photo_url)) {
             $photo_url = get_complex_base_url($photo_url) . '/' . $photo_url;
         }
         if (url_is_local($photo_thumb_url)) {
             $photo_thumb_url = get_complex_base_url($photo_thumb_url) . '/' . $photo_thumb_url;
         }
     } else {
         $photo_url = '';
         $photo_thumb_url = '';
     }
     $avatar_url = $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id_of);
     $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
     // Things staff can do with this user
     $modules = array();
     if (has_specific_permission($member_id_viewing, 'warn_members') && has_actual_page_access($member_id_viewing, 'warnings') && addon_installed('ocf_warnings')) {
         $redir_url = get_self_url(true);
         $modules[] = array('usage', do_lang_tempcode('WARN_MEMBER'), build_url(array('page' => 'warnings', 'type' => 'ad', 'id' => $member_id_of, 'redirect' => $redir_url), get_module_zone('warnings')));
         $modules[] = array('usage', do_lang_tempcode('PUNITIVE_HISTORY'), build_url(array('page' => 'warnings', 'type' => 'history', 'id' => $member_id_of), get_module_zone('warnings')));
     }
     if (has_specific_permission($member_id_viewing, 'view_content_history') && has_actual_page_access($member_id_viewing, 'admin_ocf_history')) {
         $modules[] = !addon_installed('ocf_forum') ? NULL : array('usage', do_lang_tempcode('POST_HISTORY'), build_url(array('page' => 'admin_ocf_history', 'member_id' => $member_id_of), 'adminzone'));
     }
     if (has_actual_page_access($member_id_viewing, 'admin_lookup')) {
         require_lang('submitban');
         $modules[] = array('usage', do_lang_tempcode('INVESTIGATE_USER'), build_url(array('page' => 'admin_lookup', 'param' => $member_id_of), 'adminzone'));
     }
     if (has_actual_page_access($member_id_viewing, 'admin_security')) {
         require_lang('security');
         $modules[] = array('usage', do_lang_tempcode('SECURITY_LOGGING'), build_url(array('page' => 'admin_security', 'member_id' => $member_id_of), 'adminzone'));
     }
     if (addon_installed('actionlog')) {
         if (has_actual_page_access($member_id_viewing, 'admin_actionlog')) {
             require_lang('submitban');
             $modules[] = array('usage', do_lang_tempcode('VIEW_ACTION_LOGS'), build_url(array('page' => 'admin_actionlog', 'type' => 'list', 'id' => $member_id_of), 'adminzone'));
         }
     }
     if (has_actual_page_access($member_id_viewing, 'search') && addon_installed('ocf_forum') && addon_installed('search')) {
         $modules[] = array('content', do_lang_tempcode('SEARCH_POSTS'), build_url(array('page' => 'search', 'type' => 'results', 'id' => 'ocf_posts', 'author' => $username, 'sort' => 'add_date', 'direction' => 'DESC', 'content' => ''), get_module_zone('search')), 'search');
     }
     if (has_actual_page_access($member_id_viewing, 'search') && addon_installed('search')) {
         $modules[] = array('content', do_lang_tempcode('SEARCH'), build_url(array('page' => 'search', 'type' => 'misc', 'author' => $username), get_module_zone('search')), 'search');
     }
     if (addon_installed('authors')) {
         $author = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT author FROM ' . get_table_prefix() . 'authors WHERE (forum_handle=' . strval($member_id_viewing) . ') OR (forum_handle IS NULL AND ' . db_string_equal_to('author', $username) . ')');
         if (has_actual_page_access($member_id_viewing, 'authors') && !is_null($author)) {
             $modules[] = array('content', do_lang_tempcode('AUTHOR'), build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $author), get_module_zone('authors')), 'me');
         }
     }
     require_code('ocf_members2');
     if (!is_guest() && ocf_may_whisper($member_id_of) && has_actual_page_access($member_id_viewing, 'topics') && ocf_may_make_personal_topic() && $member_id_viewing != $member_id_of) {
         $modules[] = !addon_installed('ocf_forum') ? NULL : array('contact', do_lang_tempcode('ADD_PERSONAL_TOPIC'), build_url(array('page' => 'topics', 'type' => 'new_pt', 'id' => $member_id_of), get_module_zone('topics')), 'reply');
     }
     $extra_sections = array();
     $info_details = array();
     $hooks = find_all_hooks('modules', 'members');
     foreach (array_keys($hooks) as $hook) {
         require_code('hooks/modules/members/' . filter_naughty_harsh($hook));
         $object = object_factory('Hook_members_' . filter_naughty_harsh($hook), true);
         if (is_null($object)) {
             continue;
         }
         if (method_exists($object, 'run')) {
             $hook_result = $object->run($member_id_of);
             $modules = array_merge($modules, $hook_result);
         }
         if (method_exists($object, 'get_info_details')) {
             $hook_result = $object->get_info_details($member_id_of);
             $info_details = array_merge($info_details, $hook_result);
         }
         if (method_exists($object, 'get_sections')) {
             $hook_result = $object->get_sections($member_id_of);
             $extra_sections = array_merge($extra_sections, $hook_result);
         }
     }
     if (addon_installed('ocf_contactmember')) {
         if (($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_allow_emails') == 1 || get_option('allow_email_disable') == '0') && $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_email_address') != '' && !is_guest($member_id_of) && has_actual_page_access($member_id_viewing, 'contactmember') && $member_id_viewing != $member_id_of) {
             $redirect = get_self_url(true);
             $modules[] = array('contact', do_lang_tempcode('_EMAIL_MEMBER'), build_url(array('page' => 'contactmember', 'redirect' => $redirect, 'id' => $member_id_of), get_module_zone('contactmember')), 'reply');
         }
     }
     require_lang('menus');
     $sections = array('contact' => do_lang_tempcode('CONTACT'), 'profile' => do_lang_tempcode('EDIT_PROFILE'), 'views' => do_lang_tempcode('ACCOUNT'), 'usage' => do_lang_tempcode('USAGE'), 'content' => do_lang_tempcode('CONTENT'));
     $actions = array();
     global $M_SORT_KEY;
     $M_SORT_KEY = mixed();
     $M_SORT_KEY = 1;
     @uasort($modules, 'multi_sort');
     /* @ is to stop PHP bug warning about altered array contents when Tempcode copies are evaluated internally */
     foreach ($sections as $section_code => $section_title) {
         $links = new ocp_tempcode();
         foreach ($modules as $module) {
             if (count($module) == 3) {
                 list($_section_code, $lang, $url) = $module;
                 $rel = NULL;
             } else {
                 list($_section_code, $lang, $url, $rel) = $module;
             }
             if ($section_code == $_section_code) {
                 $links->attach(do_template('OCF_MEMBER_ACTION', array('_GUID' => '67b2a640a368c6f53f1b1fa10f922fd0', 'ID' => strval($member_id_of), 'URL' => $url, 'LANG' => $lang, 'REL' => $rel)));
             }
         }
         $actions[$section_code] = $links;
     }
     // Custom fields
     $_custom_fields = ocf_get_all_custom_fields_match_member($member_id_of, $member_id_viewing != $member_id_of && !has_specific_permission($member_id_viewing, 'view_any_profile_field') ? 1 : NULL, $member_id_viewing == $member_id_of && !has_specific_permission($member_id_viewing, 'view_any_profile_field') ? 1 : NULL);
     $custom_fields = array();
     require_code('encryption');
     $value = mixed();
     foreach ($_custom_fields as $name => $_value) {
         $value = $_value['RAW'];
         $rendered_value = $_value['RENDERED'];
         $encrypted_value = '';
         if (is_data_encrypted($value)) {
             $encrypted_value = remove_magic_encryption_marker($value);
         } elseif (is_integer($value)) {
             $value = strval($value);
         } elseif (is_float($value)) {
             $value = float_to_raw_string($value);
         }
         if (!is_object($value) && $value != '' || is_object($value) && !$value->is_empty()) {
             $custom_fields[] = array('NAME' => $name, 'RAW_VALUE' => $value, 'VALUE' => $rendered_value, 'ENCRYPTED_VALUE' => $encrypted_value);
             if ($name == do_lang('KEYWORDS')) {
                 $GLOBALS['SEO_KEYWORDS'] = is_object($value) ? $value->evaluate() : $value;
             }
             if ($name == do_lang('DESCRIPTION')) {
                 $GLOBALS['SEO_DESCRIPTION'] = is_object($value) ? $value->evaluate() : $value;
             }
         }
     }
     // Birthday
     $dob = '';
     if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_reveal_age') == 1) {
         $day = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_dob_day');
         $month = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_dob_month');
         $year = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_dob_year');
         if (!is_null($day)) {
             if (@strftime('%Y', @mktime(0, 0, 0, 1, 1, 1963)) != '1963') {
                 $dob = strval($year) . '-' . str_pad(strval($month), 2, '0', STR_PAD_LEFT) . '-' . str_pad(strval($day), 2, '0', STR_PAD_LEFT);
             } else {
                 $dob = get_timezoned_date(mktime(12, 0, 0, $month, $day, $year), false, true, true);
             }
         }
     }
     // Find forum with most posts
     $forums = $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0');
     $best_yet_forum = 0;
     // Initialise to integer type
     $best_yet_forum = NULL;
     $most_active_forum = NULL;
     $_best_yet_forum = $GLOBALS['FORUM_DB']->query_select('f_posts', array('COUNT(*) as cnt', 'p_cache_forum_id'), array('p_poster' => $member_id_of), 'GROUP BY p_cache_forum_id');
     $_best_yet_forum = collapse_2d_complexity('p_cache_forum_id', 'cnt', $_best_yet_forum);
     foreach ($forums as $forum) {
         if (array_key_exists($forum['id'], $_best_yet_forum) && (is_null($best_yet_forum) || $_best_yet_forum[$forum['id']] > $best_yet_forum)) {
             $most_active_forum = has_category_access($member_id_viewing, 'forums', strval($forum['id'])) ? protect_from_escaping(escape_html($forum['f_name'])) : do_lang_tempcode('PROTECTED_FORUM');
             $best_yet_forum = $_best_yet_forum[$forum['id']];
         }
     }
     $post_count = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_cache_num_posts');
     $best_post_fraction = $post_count == 0 ? do_lang_tempcode('NA_EM') : make_string_tempcode(integer_format(100 * $best_yet_forum / $post_count));
     $most_active_forum = is_null($best_yet_forum) ? new ocp_tempcode() : do_lang_tempcode('_MOST_ACTIVE_FORUM', $most_active_forum, make_string_tempcode(integer_format($best_yet_forum)), array($best_post_fraction));
     $time_for_them_raw = tz_time(time(), get_users_timezone($member_id_of));
     $time_for_them = get_timezoned_time(time(), true, $member_id_of);
     $banned = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_is_perm_banned') == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
     $last_submit_time = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_last_submit_time');
     $submit_days_ago = intval(floor(floatval(time() - $last_submit_time) / 60.0 / 60.0 / 24.0));
     require_code('ocf_groups');
     $primary_group_id = ocf_get_member_primary_group($member_id_of);
     $primary_group = ocf_get_group_link($primary_group_id);
     $signature = get_translated_tempcode($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_signature'), $GLOBALS['FORUM_DB']);
     $last_visit_time = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_last_visit_time');
     if (member_is_online($member_id_of)) {
         $online_now = do_lang_tempcode('YES');
         $_online_now = true;
     } else {
         $_online_now = false;
         $minutes_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0));
         $hours_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0 / 60.0));
         $days_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0 / 60.0 / 24.0));
         $months_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0 / 60.0 / 24.0 / 31.0));
         if ($minutes_ago < 180) {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_MINUTES', integer_format($minutes_ago));
         } elseif ($hours_ago < 72) {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_HOURS', integer_format($hours_ago));
         } elseif ($days_ago < 93) {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_DAYS', integer_format($days_ago));
         } else {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_MONTHS', integer_format($months_ago));
         }
     }
     $join_time = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_join_time');
     $days_joined = intval(round((time() - $join_time) / 60 / 60 / 24));
     $total_posts = $GLOBALS['FORUM_DB']->query_value('f_posts', 'COUNT(*)');
     $join_date = $join_time == 0 ? '' : get_timezoned_date($join_time, false);
     $count_posts = do_lang_tempcode('_COUNT_POSTS', integer_format($post_count), float_format(floatval($post_count) / floatval($days_joined == 0 ? 1 : $days_joined)), array(float_format(floatval(100 * $post_count) / floatval($total_posts == 0 ? 1 : $total_posts))));
     $a = $avatar_url == '' ? 0 : ocf_get_member_best_group_property($member_id_of, 'max_avatar_width');
     $b = $photo_thumb_url == '' ? 0 : intval(get_option('thumb_width'));
     $right_margin = max($a, $b) == 0 ? 'auto' : strval(max($a, $b) + 6) . 'px';
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MEMBERS'))));
     if (has_specific_permission($member_id_viewing, 'see_ip')) {
         $ip_address = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_ip_address');
     } else {
         $ip_address = '';
     }
     $secondary_groups = ocf_get_members_groups($member_id_of, true);
     unset($secondary_groups[$primary_group_id]);
     if (count($secondary_groups) > 0) {
         $_secondary_groups = array();
         $all_groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true, false, false, array_keys($secondary_groups), $member_id_of);
         foreach (array_keys($secondary_groups) as $key) {
             $_secondary_groups[$key] = $all_groups[$key];
         }
         $secondary_groups = $_secondary_groups;
     }
     if (addon_installed('points')) {
         require_code('points');
         $count_points = integer_format(total_points($member_id_of));
     } else {
         $count_points = '';
     }
     $user_agent = NULL;
     $operating_system = NULL;
     if (has_specific_permission($member_id_viewing, 'show_user_browsing') && addon_installed('stats')) {
         $last_stats = $GLOBALS['SITE_DB']->query_select('stats', array('browser', 'operating_system'), array('the_user' => $member_id_of), 'ORDER BY date_and_time DESC', 1);
         if (array_key_exists(0, $last_stats)) {
             $user_agent = $last_stats[0]['browser'];
             $operating_system = $last_stats[0]['operating_system'];
         }
     }
     /*if ((get_option('allow_member_integration')!='off') && (get_option('allow_member_integration')!='hidden'))
     		{
     			$remote=$GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of,'m_password_compat_scheme')=='remote';
     		} else */
     $remote = NULL;
     $_on_probation = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_on_probation_until');
     if (is_null($_on_probation) || $_on_probation <= time()) {
         $on_probation = NULL;
     } else {
         $on_probation = strval($_on_probation);
     }
     $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $join_time), 'creator' => $username, 'publisher' => '', 'modified' => '', 'type' => 'Member', 'title' => '', 'identifier' => '_SEARCH:members:view:' . strval($member_id_of), 'description' => '', 'image' => $avatar_url == '' && has_specific_permission($member_id_viewing, 'view_member_photos') ? $photo_url : $avatar_url);
     // Look up member's clubs
     $clubs = array();
     if (addon_installed('ocf_clubs')) {
         $club_ids = $GLOBALS['FORUM_DRIVER']->get_members_groups($member_id_of, true);
         $club_rows = list_to_map('id', $GLOBALS['FORUM_DB']->query_select('f_groups', array('*'), array('g_is_private_club' => 1), '', 200));
         if (count($club_rows) == 200) {
             $club_rows = NULL;
         }
         foreach ($club_ids as $club_id) {
             if (is_null($club_rows)) {
                 $club_rows = list_to_map('id', $GLOBALS['FORUM_DB']->query_select('f_groups', array('*'), array('g_is_private_club' => 1, 'id' => $club_id), '', 200));
                 if (!array_key_exists($club_id, $club_rows)) {
                     continue;
                 }
                 $club_row = $club_rows[$club_id];
                 $club_rows = NULL;
             } else {
                 if (!array_key_exists($club_id, $club_rows)) {
                     continue;
                 }
                 $club_row = $club_rows[$club_id];
             }
             $club_name = get_translated_text($club_row['g_name'], $GLOBALS['FORUM_DB']);
             $club_forum = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums f LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=f.f_description', 'f.id', array('text_original' => do_lang('FORUM_FOR_CLUB', $club_name)));
             $clubs[] = array('CLUB_NAME' => $club_name, 'CLUB_ID' => strval($club_row['id']), 'CLUB_FORUM' => is_null($club_forum) ? '' : strval($club_forum));
         }
     }
     $content = do_template('OCF_MEMBER_PROFILE_ABOUT', array('_GUID' => 'fodfjdsfjsdljfdls', 'CLUBS' => $clubs, 'REMOTE' => $remote, 'RIGHT_MARGIN' => $right_margin, 'AVATAR_WIDTH' => strval($a) . 'px', 'PHOTO_WIDTH' => strval($b) . 'px', 'MOST_ACTIVE_FORUM' => $most_active_forum, 'TIME_FOR_THEM' => $time_for_them, 'TIME_FOR_THEM_RAW' => strval($time_for_them_raw), 'SUBMIT_DAYS_AGO' => integer_format($submit_days_ago), 'SUBMIT_TIME_RAW' => strval($last_submit_time), 'LAST_VISIT_TIME_RAW' => strval($last_visit_time), 'ONLINE_NOW' => $online_now, '_ONLINE_NOW' => $_online_now, 'BANNED' => $banned, 'USER_AGENT' => $user_agent, 'OPERATING_SYSTEM' => $operating_system, 'DOB' => $dob, 'IP_ADDRESS' => $ip_address, 'COUNT_POSTS' => $count_posts, 'COUNT_POINTS' => $count_points, 'PRIMARY_GROUP' => $primary_group, 'PRIMARY_GROUP_ID' => strval($primary_group_id), 'PHOTO_URL' => $photo_url, 'PHOTO_THUMB_URL' => $photo_thumb_url, 'EMAIL_ADDRESS' => $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_email_address'), 'AVATAR_URL' => $avatar_url, 'SIGNATURE' => $signature, 'JOIN_DATE' => $join_date, 'JOIN_DATE_RAW' => strval($join_time), 'CUSTOM_FIELDS' => $custom_fields, 'ACTIONS_contact' => $actions['contact'], 'ACTIONS_profile' => $actions['profile'], 'ACTIONS_views' => $actions['views'], 'ACTIONS_usage' => $actions['usage'], 'ACTIONS_content' => $actions['content'], 'USERNAME' => $username, 'MEMBER_ID' => strval($member_id_of), 'SECONDARY_GROUPS' => $secondary_groups, 'VIEW_PROFILES' => $member_id_viewing == $member_id_of || has_specific_permission($member_id_viewing, 'view_profiles'), 'ON_PROBATION' => $on_probation, 'EXTRA_INFO_DETAILS' => $info_details, 'EXTRA_SECTIONS' => $extra_sections));
     return array($title, $content, $order);
 }
Ejemplo n.º 6
0
 /**
  * Function to display export order list filters
  *
  * @return tempcode	The interface.
  */
 function order_export()
 {
     require_code('shopping');
     require_code('form_templates');
     $title = get_page_title('EXPORT_ORDER_LIST');
     breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('ORDERS')), array('_SELF:_SELF:show_orders', do_lang_tempcode('ORDER_LIST'))));
     $fields = new ocp_tempcode();
     $order_status_list = get_order_status_list();
     $fields->attach(form_input_list(do_lang_tempcode('ORDER_STATUS'), do_lang_tempcode('ORDER_STATUS_FILTER_DESCRIPTION'), 'order_status', $order_status_list, NULL, false, false));
     // Dates
     $start_year = intval(date('Y')) - 1;
     $start_month = intval(date('m'));
     $start_day = intval(date('d'));
     $start_hour = intval(date('H'));
     $start_minute = intval(date('i'));
     $end_year = $start_year + 1;
     $end_month = $start_month;
     $end_day = $start_day;
     $end_hour = $start_hour;
     $end_minute = $start_minute;
     $fields->attach(form_input_date(do_lang_tempcode('ST_START_PERIOD'), do_lang_tempcode('ST_START_PERIOD_DESCRIPTION'), 'start_date', false, false, true, array($start_minute, $start_hour, $start_month, $start_day, $start_year)));
     $fields->attach(form_input_date(do_lang_tempcode('ST_END_PERIOD'), do_lang_tempcode('ST_END_PERIOD_DESCRIPTION'), 'end_date', false, false, true, array($end_minute, $end_hour, $end_month, $end_day, $end_year)));
     return do_template('FORM_SCREEN', array('SKIP_VALIDATION' => true, 'TITLE' => $title, 'SUBMIT_NAME' => do_lang_tempcode('EXPORT_ORDER_LIST'), 'TEXT' => paragraph(do_lang_tempcode('EXPORT_ORDER_LIST_TEXT')), 'URL' => build_url(array('page' => '_SELF', 'type' => '_order_export'), '_SELF'), 'HIDDEN' => '', 'FIELDS' => $fields));
 }
Ejemplo n.º 7
0
 /**
  * View a single filled-in survey.
  *
  * @return tempcode	The result of execution.
  */
 function __survey_results()
 {
     $title = get_page_title('SURVEY_RESULTS');
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/survey_results';
     require_code('templates_view_space');
     $id = get_param_integer('id');
     // entry ID
     $fields = new ocp_tempcode();
     $rows = $GLOBALS['SITE_DB']->query_select('quiz_entries', array('q_time', 'q_member'), array('id' => $id), '', 1);
     if (!array_key_exists(0, $rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $member_id = $rows[0]['q_member'];
     $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id);
     if (is_null($username)) {
         $username = do_lang('UNKNOWN');
     }
     $date = get_timezoned_date($rows[0]['q_time']);
     $question_rows = $GLOBALS['SITE_DB']->query_select('quiz_questions q LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'quiz_entry_answer a ON q.id=a.q_question', array('q.id', 'q_question_text', 'q_answer', 'q_quiz'), array('q_entry' => $id), 'ORDER BY q.id');
     foreach ($question_rows as $q) {
         $quiz_id = $q['q_quiz'];
         $answer = $q['q_answer'];
         if (is_numeric($answer)) {
             $answer_rows = $GLOBALS['SITE_DB']->query_select('quiz_question_answers', array('q_answer_text'), array('q_question' => $q['id'], 'id' => intval($answer)), 'ORDER BY id');
             if (array_key_exists(0, $answer_rows)) {
                 $answer = get_translated_text($answer_rows[0]['q_answer_text']);
             }
         }
         $fields->attach(view_space_field(get_translated_text($q['q_question_text']), $answer));
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF', do_lang_tempcode('MANAGE_QUIZZES')), array('_SELF:_SELF:_survey_results:id=' . strval($quiz_id), do_lang_tempcode('SURVEY_RESULTS'))));
     breadcrumb_set_self(do_lang_tempcode('RESULT'));
     $member_url = get_base_url();
     if (!is_guest($member_id)) {
         $member_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true);
         if (is_object($member_url)) {
             $member_url = $member_url->evaluate();
         }
     }
     return do_template('VIEW_SPACE_SCREEN', array('_GUID' => '02b4dd6d52feaf3844e631e56395c4da', 'TITLE' => $title, 'TEXT' => do_lang_tempcode('SURVEY_WAS_ENTERED_AS_FOLLOWS', escape_html($username), escape_html($member_url), escape_html($date)), 'FIELDS' => $fields));
 }
Ejemplo n.º 8
0
 /**
  * The UI to translate code.
  *
  * @return tempcode		The UI
  */
 function interface_code()
 {
     $lang = filter_naughty_harsh(get_param('lang', ''));
     $lang_new = get_param('lang_new', $lang);
     if ($lang_new != '') {
         require_code('type_validation');
         if (!is_alphanumeric($lang_new, true)) {
             warn_exit(do_lang_tempcode('BAD_CODENAME'));
         }
         if (strlen($lang_new) > 5) {
             warn_exit(do_lang_tempcode('INVALID_LANG_CODE'));
         }
         $lang = $lang_new;
     }
     if ($lang == '') {
         $title = get_page_title('TRANSLATE_CODE');
         $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_FIND_LANG_STRING_TIP');
         return $this->choose_lang($title, true, true, do_lang_tempcode('CHOOSE_EDIT_LIST_LANG_FILE'));
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CHOOSE'))));
     breadcrumb_set_self(do_lang_tempcode('TRANSLATE_CODE'));
     $base_lang = fallback_lang();
     $map_a = get_file_base() . '/lang/langs.ini';
     $map_b = get_custom_file_base() . '/lang_custom/langs.ini';
     $search = get_param('search', '', true);
     if ($search != '') {
         $title = get_page_title('TRANSLATE_CODE');
         require_code('form_templates');
         $fields = new ocp_tempcode();
         global $LANGUAGE;
         foreach ($LANGUAGE[user_lang()] as $key => $value) {
             if (strpos(strtolower($value), strtolower($search)) !== false) {
                 $fields->attach(form_input_text($key, '', 'l_' . $key, str_replace('\\n', chr(10), $value), false));
             }
         }
         if ($fields->is_empty()) {
             inform_exit(do_lang_tempcode('NO_ENTRIES'));
         }
         $post_url = build_url(array('page' => '_SELF', 'type' => '_code2'), '_SELF');
         $hidden = new ocp_tempcode();
         $hidden->attach(form_input_hidden('redirect', get_self_url(true)));
         $hidden->attach(form_input_hidden('lang', $lang));
         return do_template('FORM_SCREEN', array('_GUID' => '2d7356fd2c4497ceb19450e65331c9c5', 'TITLE' => $title, 'HIDDEN' => $hidden, 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => '', 'SUBMIT_NAME' => do_lang('TRANSLATE_CODE')));
     }
     $lang_file = get_param('lang_file');
     if (!file_exists($map_b)) {
         $map_b = $map_a;
     }
     $map = better_parse_ini_file($map_b);
     $title = get_page_title('_TRANSLATE_CODE', true, array(escape_html($lang_file), escape_html(array_key_exists($lang, $map) ? $map[$lang] : $lang)));
     // Upgrade to custom if not there yet (or maybe we are creating a new lang - same difference)
     $custom_dir = get_custom_file_base() . '/lang_custom/' . $lang;
     if (!file_exists($custom_dir)) {
         require_code('abstract_file_manager');
         force_have_afm_details();
         afm_make_directory('lang_custom/' . $lang, true);
         $cached_dir = get_custom_file_base() . '/lang_cached/' . $lang;
         if (!file_exists($cached_dir)) {
             afm_make_directory('lang_cached/' . $lang, true);
         }
         // Make comcode page dirs
         $zones = find_all_zones();
         foreach ($zones as $zone) {
             $_special_dir = get_custom_file_base() . '/' . $zone . '/pages/comcode_custom/' . $lang;
             if (!file_exists($_special_dir)) {
                 afm_make_directory($zone . ($zone == '' ? '' : '/') . 'pages/comcode_custom/' . $lang, true);
             }
             $_special_dir = get_custom_file_base() . '/' . $zone . '/pages/html_custom/' . $lang;
             if (!file_exists($_special_dir)) {
                 afm_make_directory($zone . ($zone == '' ? '' : '/') . 'pages/html_custom/' . $lang, true);
             }
         }
         // Make templates_cached dirs
         require_code('themes2');
         $themes = find_all_themes();
         foreach (array_keys($themes) as $theme) {
             $_special_dir = get_custom_file_base() . '/themes/' . $theme . '/templates_cached/' . $lang;
             if (!file_exists($_special_dir)) {
                 afm_make_directory('themes/' . $theme . '/templates_cached/' . $lang, true);
             }
         }
     }
     // Get some stuff
     $for_lang = get_lang_file_map($lang, $lang_file);
     $for_base_lang = get_lang_file_map($base_lang, $lang_file, true);
     $descriptions = get_lang_file_descriptions($base_lang, $lang_file);
     // Make our translation page
     $lines = '';
     $intertrans = $this->get_intertran_conv($lang);
     $actions = new ocp_tempcode();
     $next = 0;
     $trans_lot = '';
     $delimit = chr(10) . '=-=-=-=-=-=-=-=-' . chr(10);
     foreach ($for_base_lang as $name => $old) {
         if (array_key_exists($name, $for_lang)) {
             $current = $for_lang[$name];
         } else {
             $current = '';
             //$this->find_lang_matches($old,$lang); Too slow / useless for code translation
         }
         if ($current == '' && strtolower($name) != $name) {
             $trans_lot .= str_replace('\\n', chr(10), str_replace(array('{', '}'), array('(((', ')))'), $old)) . $delimit;
         }
     }
     $translated_stuff = array();
     if ($trans_lot != '' && $intertrans != '') {
         $result = http_download_file('http://translate.google.com/translate_t', NULL, false, false, 'ocPortal', array('text' => $trans_lot, 'langpair' => 'en|' . $intertrans));
         if (!is_null($result)) {
             require_code('character_sets');
             $result = convert_to_internal_encoding($result);
             $matches = array();
             if (preg_match('#<div id=result_box dir="ltr">(.*)</div>#Us', convert_to_internal_encoding($result), $matches) != 0) {
                 $result2 = $matches[1];
                 $result2 = @html_entity_decode($result2, ENT_QUOTES, get_charset());
                 $result2 = preg_replace('#\\s?<br>\\s?#', chr(10), $result2);
                 $result2 = str_replace('> ', '>', str_replace(' <', ' <', str_replace('</ ', '</', str_replace(array('(((', ')))'), array('{', '}'), $result2))));
                 $translated_stuff = explode(trim($delimit), $result2 . chr(10));
             }
         }
     }
     foreach ($for_base_lang + $for_lang as $name => $old) {
         if (array_key_exists($name, $for_lang)) {
             $current = $for_lang[$name];
         } else {
             $current = '';
             //$this->find_lang_matches($old,$lang); Too slow / useless for code translation
         }
         $description = array_key_exists($name, $descriptions) ? $descriptions[$name] : '';
         if ($current == '' && strtolower($name) != $name && array_key_exists($next, $translated_stuff)) {
             $_current = '';
             $translate_auto = trim($translated_stuff[$next]);
             $next++;
         } else {
             $_current = str_replace('\\n', chr(10), $current);
             $translate_auto = NULL;
         }
         if ($_current == '') {
             $_current = str_replace('\\n', chr(10), $old);
         }
         if ($intertrans != '' && get_value('google_translate_api_key') !== NULL) {
             $actions = do_template('TRANSLATE_ACTION', array('_GUID' => '9e9a68cb2c1a1e23a901b84c9af2280b', 'LANG_FROM' => get_site_default_lang(), 'LANG_TO' => $lang, 'NAME' => 'trans_' . $name, 'OLD' => $_current));
         }
         $temp = do_template('TRANSLATE_LINE', array('_GUID' => '9cb331f5852ee043e6ad30b45aedc43b', 'TRANSLATE_AUTO' => $translate_auto, 'DESCRIPTION' => $description, 'NAME' => $name, 'OLD' => str_replace('\\n', chr(10), $old), 'CURRENT' => $_current, 'ACTIONS' => $actions));
         $lines .= $temp->evaluate();
     }
     $url = build_url(array('page' => '_SELF', 'type' => '_code', 'lang_file' => $lang_file, 'lang' => $lang), '_SELF');
     return do_template('TRANSLATE_SCREEN', array('_GUID' => 'b3429f8bd0b4eb79c33709ca43e3207c', 'PAGE' => $lang_file, 'INTERTRANS' => get_value('google_translate_api_key') !== NULL ? $intertrans : '', 'LANG' => $lang, 'LINES' => $lines, 'TITLE' => $title, 'URL' => $url));
 }
Ejemplo n.º 9
0
 /**
  * The actualiser to contact a member.
  *
  * @return tempcode		The UI
  */
 function actual()
 {
     if (addon_installed('captcha')) {
         require_code('captcha');
         enforce_captcha();
     }
     $member_id = get_param_integer('id');
     $email_address = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_email_address');
     if (is_null($email_address)) {
         fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
     }
     $to_name = $GLOBALS['FORUM_DRIVER']->get_username($member_id);
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('EMAIL_MEMBER', escape_html($to_name)))));
     if (is_null($to_name)) {
         warn_exit(do_lang_tempcode('USER_NO_EXIST'));
     }
     $from_email = trim(post_param('email_address'));
     require_code('type_validation');
     if (!is_valid_email_address($from_email)) {
         warn_exit(do_lang_tempcode('INVALID_EMAIL_ADDRESS'));
     }
     $from_name = post_param('name');
     $title = get_page_title('EMAIL_MEMBER', true, array(escape_html($GLOBALS['FORUM_DRIVER']->get_username($member_id))));
     require_code('mail');
     $attachments = array();
     $size_so_far = 0;
     require_code('uploads');
     is_swf_upload(true);
     foreach ($_FILES as $file) {
         if (is_swf_upload() || is_uploaded_file($file['tmp_name'])) {
             $attachments[$file['tmp_name']] = $file['name'];
             $size_so_far += $file['size'];
         } else {
             if (defined('UPLOAD_ERR_NO_FILE') && array_key_exists('error', $file) && $file['error'] != UPLOAD_ERR_NO_FILE) {
                 warn_exit(do_lang_tempcode('ERROR_UPLOADING_ATTACHMENTS'));
             }
         }
     }
     $size = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_max_email_attach_size_mb');
     if ($size_so_far > $size * 1024 * 1024) {
         warn_exit(do_lang_tempcode('EXCEEDED_ATTACHMENT_SIZE', integer_format($size)));
     }
     mail_wrap(do_lang('EMAIL_MEMBER_SUBJECT', get_site_name(), post_param('subject'), NULL, get_lang($member_id)), post_param('message'), array($email_address), $to_name, $from_email, $from_name, 3, $attachments, false, get_member());
     log_it('EMAIL', strval($member_id), $to_name);
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     $url = get_param('redirect');
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
Ejemplo n.º 10
0
 /**
  * The UI to edit a zone.
  *
  * @return tempcode		The UI
  */
 function _edit_zone()
 {
     $title = get_page_title('EDIT_ZONE');
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/zones';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_structure';
     $zone = get_param('id', '');
     // '' needed for short URLs
     if ($zone == '/') {
         $zone = '';
     }
     $rows = $GLOBALS['SITE_DB']->query_select('zones', array('*'), array('zone_name' => $zone), '', 1);
     if (!array_key_exists(0, $rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $row = $rows[0];
     $header_text = get_translated_text($row['zone_header_text']);
     list($fields, $hidden, $javascript) = $this->get_form_fields(false, get_translated_text($row['zone_title']), $row['zone_default_page'], $header_text, $row['zone_theme'], $row['zone_wide'], $row['zone_require_session'], $row['zone_displayed_in_menu'], $zone);
     $hidden->attach(form_input_hidden('zone', $zone));
     $no_delete_zones = get_forum_type() == 'ocf' ? array('', 'adminzone', 'forum') : array('', 'adminzone');
     $no_rename_zones = array('', 'adminzone', 'forum');
     $no_rename = in_array($zone, $no_rename_zones) || get_file_base() != get_custom_file_base();
     if ($no_rename) {
         $hidden->attach(form_input_hidden('new_zone', $zone));
     } else {
         $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS'))));
         $rename_label = 'DESCRIPTION_ZONE_RENAME';
         if (in_array($zone, array('site', 'cms', 'collaboration'))) {
             $rename_label = 'DESCRIPTION_ZONE_RENAME_DEFAULT_ZONE';
         }
         $fields->attach(form_input_codename(do_lang_tempcode('CODENAME'), do_lang_tempcode($rename_label), 'new_zone', $zone, true));
     }
     if (!in_array($zone, $no_delete_zones) && get_file_base() == get_custom_file_base()) {
         if ($no_rename) {
             $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS'))));
         }
         $fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false));
     }
     $map = array('page' => '_SELF', 'type' => '__edit');
     $url = get_param('redirect', NULL);
     if (!is_null($url)) {
         $map['redirect'] = $url;
     }
     $post_url = build_url($map, '_SELF');
     $submit_name = do_lang_tempcode('SAVE');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('ZONES')), array('_SELF:_SELF:edit_zone', do_lang_tempcode('CHOOSE'))));
     return do_template('FORM_SCREEN', array('_GUID' => '54a578646aed86da06f30c459c9586c2', 'JAVASCRIPT' => $javascript, 'HIDDEN' => $hidden, 'SUBMIT_NAME' => $submit_name, 'TITLE' => $title, 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => ''));
 }
Ejemplo n.º 11
0
 /**
  * The UI to view a security alert.
  *
  * @return tempcode		The UI
  */
 function alert_view()
 {
     $id = get_param_integer('id');
     $rows = $GLOBALS['SITE_DB']->query_select('hackattack', array('*'), array('id' => $id));
     $row = $rows[0];
     $time = get_timezoned_date($row['date_and_time']);
     $title = get_page_title('VIEW_ALERT', true, array(escape_html($time)));
     $lookup_url = build_url(array('page' => 'admin_lookup', 'param' => $row['ip']), '_SELF');
     $member_url = build_url(array('page' => 'admin_lookup', 'param' => $row['the_user']), '_SELF');
     $reason = do_lang($row['reason'], $row['reason_param_a'], $row['reason_param_b']);
     $post = with_whitespace(unixify_line_format($row['data_post']));
     $username = $GLOBALS['FORUM_DRIVER']->get_username($row['the_user']);
     if (is_null($username)) {
         $username = do_lang('UNKNOWN');
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('SECURITY_LOGGING'))));
     return do_template('SECURITY_ALERT_SCREEN', array('_GUID' => '6c5543151af09c79bf204bea5df61dde', 'TITLE' => $title, 'USER_AGENT' => $row['user_agent'], 'REFERER' => $row['referer'], 'USER_OS' => $row['user_os'], 'REASON' => $reason, 'IP' => hyperlink($lookup_url, $row['ip'], false, true), 'USERNAME' => hyperlink($member_url, escape_html($username)), 'POST' => $post, 'URL' => $row['url']));
 }
Ejemplo n.º 12
0
 /**
  * The UI for a chat room.
  *
  * @return tempcode		The UI
  */
 function chat_room()
 {
     require_javascript('javascript_yahoo_2');
     require_javascript('javascript_colour_picker');
     require_javascript('javascript_posting');
     require_css('colour_picker');
     $prefs = @$_COOKIE['ocp_chat_prefs'];
     $prefs = @explode(';', $prefs);
     //$mode=get_param('mode','');
     $room_id = get_param('id');
     $posting_name = do_lang_tempcode('SEND_MESSAGE');
     $cs_post_url = build_url(array('page' => '_SELF', 'type' => 'options', 'id' => $room_id), '_SELF');
     $yourname = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
     $debug = get_param_integer('debug', 0) == 1 ? 'block' : 'none';
     $title = get_page_title('ROOM');
     $seteffectslink = hyperlink(build_url(array('page' => '_SELF', 'type' => 'set_effects'), '_SELF'), do_lang_tempcode('CHAT_SET_EFFECTS'), true);
     $logslink = hyperlink(get_base_url() . '/data_custom/jabber-logs/' . strtolower($room_id) . '@conference.' . get_domain(), 'Chat logs', true);
     $links = array($seteffectslink, $logslink);
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CHAT_LOBBY_END_CHAT'))));
     $messages_php = find_script('messages');
     $password_hash = $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_pass_hash_salted');
     return do_template('CHAT_SCREEN', array('_GUID' => '867a0b050c050c81d33482d131783eb0', 'MESSAGES_PHP' => $messages_php, 'PASSWORD_HASH' => $password_hash, 'CHAT_SOUND' => get_chat_sound_tpl(), 'ROOM_ID' => $room_id, 'DEBUG' => $debug, 'OPTIONS_URL' => $cs_post_url, 'ROOM_NAME' => '', 'YOUR_NAME' => $yourname, 'SUBMIT_VALUE' => $posting_name, 'INTRODUCTION' => '', 'TITLE' => $title, 'LINKS' => $links));
 }
Ejemplo n.º 13
0
 /**
  * The actualiser to import in bulk from an archive file.
  *
  * @return tempcode		The UI
  */
 function _import()
 {
     post_param('test');
     // To pick up on max file size exceeded errors
     require_code('uploads');
     require_code('images');
     is_swf_upload(true);
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('EMOTICONS')), array('_SELF:_SELF:import', do_lang_tempcode('CHOOSE')), array('_SELF:_SELF:import', do_lang_tempcode('IMPORT_EMOTICONS'))));
     foreach ($_FILES as $attach_name => $__file) {
         $tmp_name = $__file['tmp_name'];
         $file = $__file['name'];
         switch (get_file_extension($file)) {
             case 'zip':
                 if (!function_exists('zip_open') && get_option('unzip_cmd') == '') {
                     warn_exit(do_lang_tempcode('ZIP_NOT_ENABLED'));
                 }
                 if (!function_exists('zip_open')) {
                     require_code('m_zip');
                     $mzip = true;
                 } else {
                     $mzip = false;
                 }
                 $myfile = zip_open($tmp_name);
                 if (!is_integer($myfile)) {
                     while (false !== ($entry = zip_read($myfile))) {
                         // Load in file
                         zip_entry_open($myfile, $entry);
                         $_file = zip_entry_name($entry);
                         if (is_image($_file)) {
                             if (file_exists(get_file_base() . '/themes/default/images/emoticons/index.html')) {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/emoticons__' . basename($_file);
                             } else {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/ocf_emoticons__' . basename($_file);
                             }
                             $outfile = @fopen($path, 'wb') or intelligent_write_error($path);
                             $more = mixed();
                             do {
                                 $more = zip_entry_read($entry);
                                 if (fwrite($outfile, $more) < strlen($more)) {
                                     warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
                                 }
                             } while ($more !== false && $more != '');
                             fclose($outfile);
                             fix_permissions($path);
                             sync_file($path);
                             $this->_import_emoticon($path);
                         }
                         zip_entry_close($entry);
                     }
                     zip_close($myfile);
                 } else {
                     require_code('failure');
                     warn_exit(zip_error($myfile, $mzip));
                 }
                 break;
             case 'tar':
                 require_code('tar');
                 $myfile = tar_open($tmp_name, 'rb');
                 if ($myfile !== false) {
                     $directory = tar_get_directory($myfile);
                     foreach ($directory as $entry) {
                         // Load in file
                         $_file = $entry['path'];
                         if (is_image($_file)) {
                             if (file_exists(get_file_base() . '/themes/default/images/emoticons/index.html')) {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/emoticons__' . basename($_file);
                             } else {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/ocf_emoticons__' . basename($_file);
                             }
                             $_in = tar_get_file($myfile, $entry['path'], false, $path);
                             $this->_import_emoticon($path);
                         }
                     }
                     tar_close($myfile);
                 }
                 break;
             default:
                 if (is_image($file)) {
                     $urls = get_url('', $attach_name, 'themes/default/images_custom');
                     $path = $urls[0];
                     $this->_import_emoticon($path);
                 } else {
                     attach_message(do_lang_tempcode('BAD_ARCHIVE_FORMAT'), 'warn');
                 }
         }
     }
     $title = get_page_title('IMPORT_EMOTICONS');
     log_it('IMPORT_EMOTICONS');
     return $this->do_next_manager($title, do_lang_tempcode('SUCCESS'), NULL);
 }
Ejemplo n.º 14
0
 /**
  * The UI to show OCF demographics.
  *
  * @param  object			The stats module object
  * @param  string			The screen type
  * @return tempcode		The UI
  */
 function demographics($ob, $type)
 {
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('SITE_STATISTICS'))));
     require_lang('ocf');
     //This will show a plain bar chart with all the downloads listed
     $title = get_page_title('DEMOGRAPHICS');
     // Handle time range
     if (get_param_integer('dated', 0) == 0) {
         $title = get_page_title('DEMOGRAPHICS');
         return $ob->get_between($title, false, NULL, do_lang_tempcode('DEMOGRAPHICS_STATS_RANGE'));
     }
     $time_start = get_input_date('time_start', true);
     $time_end = get_input_date('time_end', true);
     if (!is_null($time_end)) {
         $time_end += 60 * 60 * 24 - 1;
     }
     // So it is end of day not start
     if (is_null($time_start) && is_null($time_end)) {
         $rows = $GLOBALS['FORUM_DB']->query_select('f_members', array('m_dob_year', 'COUNT(*) AS cnt', NULL, 'GROUP BY m_dob_year'));
     } else {
         if (is_null($time_start)) {
             $time_start = 0;
         }
         if (is_null($time_end)) {
             $time_end = time();
         }
         $title = get_page_title('SECTION_DEMOGRAPHICS_RANGE', true, array(escape_html(get_timezoned_date($time_start, false)), escape_html(get_timezoned_date($time_end, false))));
         $rows = $GLOBALS['FORUM_DB']->query('SELECT m_dob_year,COUNT(*) AS cnt FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_join_time>' . strval($time_start) . ' AND m_join_time<' . strval($time_end) . ' GROUP BY m_dob_year');
     }
     if (count($rows) < 1) {
         return warn_screen($title, do_lang_tempcode('NO_DATA'));
     }
     // Gather data
     $demographics = array();
     $demographics[do_lang('UNKNOWN')] = 0;
     for ($i = 0; $i < 30; $i++) {
         $demographics[strval($i)] = 0;
     }
     for ($i = 30; $i < 100; $i += 5) {
         $demographics[strval($i) . '-' . strval($i + 4)] = 0;
     }
     $demographics['100+'] = 0;
     list($current_day, $current_month, $current_year) = explode(' ', date('j m Y', utctime_to_usertime(time())));
     foreach ($rows as $i => $row) {
         $day = 1;
         $month = 1;
         $year = $row['m_dob_year'];
         if (!is_null($year)) {
             $age = intval($current_year) - $year;
             if ($age < 0) {
                 $age = 0;
             }
             if ($age >= 100) {
                 $age_string = '100+';
             } elseif ($age >= 30) {
                 $age_string = strval(intval($age / 5) * 5) . '-' . strval(intval($age / 5) * 5 + 4);
             } else {
                 $age_string = strval($age);
             }
             $demographics[$age_string] += array_key_exists('cnt', $row) ? $row['cnt'] : 1;
         } else {
             $demographics[do_lang('UNKNOWN')] += array_key_exists('cnt', $row) ? $row['cnt'] : 1;
         }
     }
     $start = 0;
     $max = 1000;
     // Little trick, as we want all to fit
     $sortables = array();
     require_code('templates_results_table');
     $fields_title = results_field_title(array(do_lang_tempcode('AGE'), do_lang_tempcode('COUNT_TOTAL')), $sortables);
     $fields = new ocp_tempcode();
     $i = 0;
     foreach ($demographics as $_age => $value) {
         if (is_integer($_age)) {
             $_age = strval($_age);
         }
         $percent = round(100.0 * floatval($value) / floatval(count($rows)), 2);
         $fields->attach(results_entry(array(escape_html($_age), escape_html(integer_format($value) . ' (' . float_format($percent) . '%)'))));
         $i++;
     }
     $list = results_table(do_lang_tempcode('DEMOGRAPHICS'), $start, 'start', $max, 'max', count($demographics), $fields_title, $fields, $sortables, '', '', 'sort', new ocp_tempcode());
     $output = create_bar_chart($demographics, do_lang('AGE'), do_lang('COUNT_TOTAL'), '', '');
     $ob->save_graph('Global-Demographics', $output);
     $graph = do_template('STATS_GRAPH', array('GRAPH' => get_custom_base_url() . '/data_custom/modules/admin_stats/Global-Demographics.xml', 'TITLE' => do_lang_tempcode('DEMOGRAPHICS'), 'TEXT' => do_lang_tempcode('DESCRIPTION_DEMOGRAPHICS')));
     return do_template('STATS_SCREEN', array('TITLE' => $title, 'NO_CSV' => '1', 'GRAPH' => $graph, 'STATS' => $list));
 }
Ejemplo n.º 15
0
 /**
  * The actualiser for a gift point transaction.
  *
  * @return tempcode		The UI
  */
 function do_give()
 {
     $member_id_of = get_param_integer('id');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('USER_POINT_FIND')), array('_SELF:_SELF:member:id=' . strval($member_id_of), do_lang_tempcode('_POINTS', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member_id_of))))));
     $title = get_page_title('POINTS');
     $trans_type = post_param('trans_type', 'gift');
     $amount = post_param_integer('amount');
     $reason = post_param('reason');
     $worked = false;
     $member_id_viewing = get_member();
     if ($member_id_of == $member_id_viewing && !has_specific_permission($member_id_viewing, 'give_points_self')) {
         $message = do_lang_tempcode('PE_SELF');
     } elseif (is_guest($member_id_viewing)) {
         $message = do_lang_tempcode('MUST_LOGIN');
     } else {
         if ($trans_type == 'gift') {
             $anonymous = post_param_integer('anonymous', 0);
             $viewer_gift_points_available = get_gift_points_to_give($member_id_viewing);
             //$viewer_gift_points_used=get_gift_points_used($member_id_viewing);
             if ($viewer_gift_points_available < $amount && !has_specific_permission($member_id_viewing, 'have_negative_gift_points')) {
                 $message = do_lang_tempcode('PE_LACKING_GIFT_POINTS');
             } elseif ($amount < 0 && !has_specific_permission($member_id_viewing, 'give_negative_points')) {
                 $message = do_lang_tempcode('PE_NEGATIVE_GIFT');
             } elseif ($reason == '') {
                 $message = do_lang_tempcode('IMPROPERLY_FILLED_IN');
             } else {
                 // Write transfer
                 require_code('points2');
                 give_points($amount, $member_id_of, $member_id_viewing, $reason, $anonymous == 1);
                 // Randomised gifts
                 if (mt_rand(0, 4) == 1) {
                     $message = do_lang_tempcode('PR_LUCKY');
                     $_current_gift = point_info($member_id_viewing);
                     $current_gift = array_key_exists('points_gained_given', $_current_gift) ? $_current_gift['points_gained_given'] : 0;
                     $GLOBALS['FORUM_DRIVER']->set_custom_field($member_id_viewing, 'points_gained_given', $current_gift + 25);
                     // TODO: 25 should be a config option
                 } else {
                     $message = do_lang_tempcode('PR_NORMAL');
                 }
                 $worked = true;
             }
         }
         if ($trans_type == 'refund') {
             $trans_type = 'charge';
             $amount = -$amount;
         }
         if ($trans_type == 'charge') {
             if (has_actual_page_access($member_id_viewing, 'adminzone')) {
                 require_code('points2');
                 charge_member($member_id_of, $amount, $reason);
                 $left = available_points($member_id_of);
                 $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
                 if (is_null($username)) {
                     $username = do_lang('UNKNOWN');
                 }
                 $message = do_lang_tempcode('USER_HAS_BEEN_CHARGED', escape_html($username), escape_html(integer_format($amount)), escape_html(integer_format($left)));
                 $worked = true;
             } else {
                 access_denied('I_ERROR');
             }
         }
     }
     if ($worked) {
         // Show it worked / Refresh
         $url = build_url(array('page' => '_SELF', 'type' => 'member', 'id' => $member_id_of), '_SELF');
         return redirect_screen($title, $url, $message);
     } else {
         return warn_screen($title, $message);
     }
 }
Ejemplo n.º 16
0
 /**
  * The actualiser for deleting a folder.
  *
  * @return tempcode	The UI.
  */
 function module_do_delete_folder()
 {
     $title = get_page_title('FILEDUMP_DELETE_FOLDER');
     $file = filter_naughty(get_param('file'));
     $place = filter_naughty(get_param('place'));
     breadcrumb_set_parents(array(array('_SELF:_SELF', do_lang_tempcode('FILE_DUMP'))));
     if (post_param_integer('confirmed', 0) != 1) {
         $url = get_self_url();
         $text = do_lang_tempcode('CONFIRM_DELETE', $file);
         breadcrumb_set_self(do_lang_tempcode('CONFIRM'));
         $hidden = build_keep_post_fields();
         $hidden->attach(form_input_hidden('confirmed', '1'));
         return do_template('CONFIRM_SCREEN', array('_GUID' => '55cd4cafa3bf8285028da9862508d811', 'TITLE' => $title, 'FIELDS' => $hidden, 'PREVIEW' => $text, 'URL' => $url));
     }
     $ret = @rmdir(get_custom_file_base() . '/uploads/filedump' . $place . $file);
     sync_file('uploads/filedump/' . $place . $file);
     if ($ret) {
         $return_url = build_url(array('page' => '_SELF', 'type' => 'misc', 'place' => $place), '_SELF');
         log_it('FILEDUMP_DELETE_FOLDER', $file, $place);
         return redirect_screen($title, $return_url, do_lang_tempcode('SUCCESS'));
     } else {
         warn_exit(do_lang_tempcode('FOLDER_DELETE_ERROR'));
     }
     return new ocp_tempcode();
 }
Ejemplo n.º 17
0
 /**
  * The UI to view a past newsletter.
  *
  * @return tempcode		The UI
  */
 function view()
 {
     $id = get_param_integer('id');
     $rows = $GLOBALS['SITE_DB']->query_select('newsletter_archive', array('*'), array('id' => $id));
     $time = get_timezoned_date($rows[0]['date_and_time']);
     $subject = $rows[0]['subject'];
     $message = $rows[0]['newsletter'];
     $language = $rows[0]['language'];
     $level = $rows[0]['importance_level'];
     /*require_code('lang2');
     		$language=lookup_language_full_name($rows[0]['language']);*/
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_NEWSLETTER')), array('_SELF:_SELF:archive', do_lang_tempcode('NEWSLETTER_ARCHIVE'))));
     breadcrumb_set_self($subject);
     require_code('templates_view_space');
     return view_space(get_page_title('NEWSLETTER'), array('DATE_TIME' => $time, 'LANGUAGE' => $language, 'SUBSCRIPTION_LEVEL' => integer_format($level), 'SUBJECT' => $subject, 'MESSAGE' => comcode_to_tempcode($message)));
 }
Ejemplo n.º 18
0
/**
 * Display a catalogue entry
 *
 * @param  AUTO_LINK		Entry ID
 * @param  boolean		Whether to skip rendering a title
 * @return tempcode		Tempcode interface to display an entry
 */
function render_catalogue_entry_screen($id, $no_title = false)
{
    require_code('feedback');
    if (addon_installed('ecommerce')) {
        require_code('ecommerce');
    }
    require_code('images');
    require_css('catalogues');
    require_lang('catalogues');
    $entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('id' => $id), '', 1);
    if (!array_key_exists(0, $entries)) {
        return warn_screen(get_page_title('CATALOGUES'), do_lang_tempcode('MISSING_RESOURCE'));
    }
    $entry = $entries[0];
    $categories = $GLOBALS['SITE_DB']->query_select('catalogue_categories', array('*'), array('id' => $entry['cc_id']), '', 1);
    if (!array_key_exists(0, $categories)) {
        warn_exit(do_lang_tempcode('CAT_NOT_FOUND', strval($entry['cc_id'])));
    }
    $category = $categories[0];
    $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=catalogues&filter=' . strval($entry['cc_id']);
    $catalogue_name = $category['c_name'];
    $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue_name), '', 1);
    if (!array_key_exists(0, $catalogues)) {
        warn_exit(do_lang_tempcode('CATALOGUE_NOT_FOUND', $catalogue_name));
    }
    $catalogue = $catalogues[0];
    // Permission for here?
    if (!has_category_access(get_member(), 'catalogues_catalogue', $catalogue_name)) {
        access_denied('CATALOGUE_ACCESS');
    }
    if (get_value('disable_cat_cat_perms') !== '1' && !has_category_access(get_member(), 'catalogues_category', strval($entry['cc_id']))) {
        access_denied('CATEGORY_ACCESS');
    }
    $ecommerce = is_ecommerce_catalogue($catalogue_name);
    if ($ecommerce) {
        $tpl_set = 'products';
    } else {
        $tpl_set = $catalogue_name;
    }
    $root = get_param_integer('root', NULL);
    $map = get_catalogue_entry_map($entry, $catalogue, 'PAGE', $tpl_set, $root, NULL, NULL, true, true);
    if (get_db_type() != 'xml') {
        $entry['ce_views']++;
        $GLOBALS['SITE_DB']->query_update('catalogue_entries', array('ce_views' => $entry['ce_views']), array('id' => $id), '', 1, NULL, false, true);
    }
    // Validation
    if ($entry['ce_validated'] == 0) {
        if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
            access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
        }
        $map['WARNINGS'] = do_template('WARNING_TABLE', array('_GUID' => 'bf604859a572ca53e969bec3d91f9cfb', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
    } else {
        $map['WARNINGS'] = '';
    }
    //Finding any hook exists for this product--------------------
    if (addon_installed('ecommerce')) {
        $object = find_product(strval($id));
        if (is_object($object) && method_exists($object, 'get_custom_product_map_fields')) {
            $object->get_custom_product_map_fields($id, $map);
        }
    }
    //------------------------------------------------------------
    $map['ENTRY'] = do_template('CATALOGUE_' . $tpl_set . '_ENTRY', $map, NULL, false, 'CATALOGUE_DEFAULT_ENTRY');
    $map['ADD_DATE'] = get_timezoned_date($entry['ce_add_date']);
    $map['ADD_DATE_RAW'] = strval($entry['ce_add_date']);
    $map['EDIT_DATE'] = is_null($entry['ce_edit_date']) ? '' : get_timezoned_date($entry['ce_edit_date']);
    $map['EDIT_DATE_RAW'] = is_null($entry['ce_edit_date']) ? '' : strval($entry['ce_edit_date']);
    $map['VIEWS'] = integer_format($entry['ce_views']);
    $title_to_use = do_lang_tempcode($catalogue_name . '__CATALOGUE_ENTRY', $map['FIELD_0']);
    $title_to_use_2 = do_lang($catalogue_name . '__CATALOGUE_ENTRY', $map['FIELD_0_PLAIN'], NULL, NULL, NULL, false);
    if (is_null($title_to_use_2)) {
        $title_to_use = do_lang_tempcode('DEFAULT__CATALOGUE_ENTRY', $map['FIELD_0']);
        $title_to_use_2 = do_lang('DEFAULT__CATALOGUE_ENTRY', $map['FIELD_0_PLAIN']);
    }
    if ($no_title) {
        $map['TITLE'] = new ocp_tempcode();
    } else {
        if (addon_installed('awards')) {
            require_code('awards');
            $awards = find_awards_for('catalogue_entry', strval($id));
        } else {
            $awards = array();
        }
        $map['TITLE'] = get_page_title($title_to_use, false, NULL, NULL, $awards);
    }
    $map['SUBMITTER'] = strval($entry['ce_submitter']);
    require_code('seo2');
    if (is_object($title_to_use_2)) {
        $title_to_use_2 = $title_to_use_2->evaluate();
    }
    seo_meta_load_for('catalogue_entry', strval($id), strip_tags($title_to_use_2));
    if ($map['TREE'] === '') {
        $map['TREE'] = new ocp_tempcode();
        $url = build_url(array('page' => '_SELF', 'type' => 'index', 'id' => $catalogue_name), '_SELF');
        $map['TREE']->attach(hyperlink($url, escape_html(get_translated_text($catalogue['c_title'])), false, false, do_lang('INDEX')));
        $map['TREE']->attach(do_template('BREADCRUMB_ESCAPED'));
        $url = build_url(array('page' => '_SELF', 'type' => 'category', 'id' => $category['id']), '_SELF');
        $map['TREE']->attach(hyperlink($url, escape_html(get_translated_text($category['cc_title'])), false, false, do_lang('GO_BACKWARDS_TO', get_translated_text($category['cc_title'])), NULL, NULL, 'up'));
    }
    $map['CATEGORY_TITLE'] = get_translated_text($category['cc_title']);
    $map['CAT'] = strval($entry['cc_id']);
    $map['TAGS'] = get_loaded_tags('catalogue_entries');
    breadcrumb_add_segment($map['TREE'], $title_to_use);
    if (is_null($root)) {
        breadcrumb_set_parents(array(array('_SELF:_SELF:misc' . ($ecommerce ? ':ecommerce=1' : ''), do_lang('CATALOGUES'))));
    }
    $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $entry['ce_add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($entry['ce_submitter']), 'publisher' => '', 'modified' => is_null($entry['ce_edit_date']) ? '' : date('Y-m-d', $entry['ce_edit_date']), 'type' => get_translated_text($catalogue['c_title']) . ' entry', 'title' => comcode_escape($title_to_use_2), 'identifier' => '_SEARCH:catalogues:entry:' . strval($id), 'description' => '');
    return do_template('CATALOGUE_' . $tpl_set . '_ENTRY_SCREEN', $map, NULL, false, 'CATALOGUE_DEFAULT_ENTRY_SCREEN');
}
Ejemplo n.º 19
0
 /**
  * Standard modular UI/actualiser to edit an entry.
  *
  * @return tempcode	The UI
  */
 function __ed()
 {
     $id = mixed();
     // Define type as mixed
     $id = $this->non_integer_id ? get_param('id', false, true) : strval(get_param_integer('id'));
     $doing = 'EDIT_' . $this->lang_type;
     if ($this->catalogue && get_param('catalogue_name', '') != '') {
         $catalogue_title = get_translated_text($GLOBALS['SITE_DB']->query_value('catalogues', 'c_title', array('c_name' => get_param('catalogue_name'))));
         if ($this->type_code == 'd') {
             $doing = do_lang('CATALOGUE_GENERIC_EDIT', escape_html($catalogue_title));
         } elseif ($this->type_code == 'c') {
             $doing = do_lang('CATALOGUE_GENERIC_EDIT_CATEGORY', escape_html($catalogue_title));
         }
     }
     $title = get_page_title($doing);
     if ($this->second_stage_preview && get_param_integer('preview', 0) == 1) {
         return $this->preview_intercept($title);
     }
     if (method_exists($this, 'get_submitter')) {
         list($submitter, $date_and_time) = $this->get_submitter($id);
         if (!is_null($date_and_time) && addon_installed('points')) {
             $reverse = post_param_integer('reverse_point_transaction', 0);
             if ($reverse == 1) {
                 $points_test = $GLOBALS['SITE_DB']->query_select('gifts', array('*'), array('date_and_time' => $date_and_time, 'gift_to' => $submitter, 'gift_from' => $GLOBALS['FORUM_DRIVER']->get_guest_id()));
                 if (array_key_exists(0, $points_test)) {
                     $amount = $points_test[0]['amount'];
                     $sender_id = $points_test[0]['gift_from'];
                     $recipient_id = $points_test[0]['gift_to'];
                     $GLOBALS['SITE_DB']->query_delete('gifts', array('id' => $points_test[0]['id']), '', 1);
                     if (!is_guest($sender_id)) {
                         $_sender_gift_points_used = point_info($sender_id);
                         $sender_gift_points_used = array_key_exists('gift_points_used', $_sender_gift_points_used) ? $_sender_gift_points_used['gift_points_used'] : 0;
                         $GLOBALS['FORUM_DRIVER']->set_custom_field($sender_id, 'gift_points_used', strval($sender_gift_points_used - $amount));
                     }
                     require_code('points');
                     $temp_points = point_info($recipient_id);
                     $GLOBALS['FORUM_DRIVER']->set_custom_field($recipient_id, 'points_gained_given', strval((array_key_exists('points_gained_given', $temp_points) ? $temp_points['points_gained_given'] : 0) - $amount));
                 }
             }
         }
     } else {
         $submitter = NULL;
     }
     breadcrumb_set_parents(array_merge($GLOBALS['BREADCRUMB_SET_PARENTS'], array(array('_SELF:_SELF:_e' . $this->type_code . ':' . $id, strpos($doing, ' ') !== false ? protect_from_escaping($doing) : do_lang_tempcode($doing)))));
     $delete = post_param_integer('delete', 0);
     if ($delete == 1 || $delete == 2) {
         if (!is_null($this->permissions_require)) {
             check_delete_permission($this->permissions_require, $submitter, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? NULL : $this->get_cat($id), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? NULL : $this->get_cat_b($id)), $this->permission_page_name);
         }
         $doing = 'DELETE_' . $this->lang_type;
         if ($this->catalogue && get_param('catalogue_name', '') != '') {
             $catalogue_title = get_translated_text($GLOBALS['SITE_DB']->query_value('catalogues', 'c_title', array('c_name' => get_param('catalogue_name'))));
             if ($this->type_code == 'd') {
                 $doing = do_lang('CATALOGUE_GENERIC_DELETE', escape_html($catalogue_title));
             } elseif ($this->type_code == 'c') {
                 $doing = do_lang('CATALOGUE_GENERIC_DELETE_CATEGORY', escape_html($catalogue_title));
             }
         }
         $title = get_page_title($doing);
         $test = $this->handle_confirmations($title);
         if (!is_null($test)) {
             return $test;
         }
         $this->delete_actualisation($id);
         // Delete custom fields
         if ($this->has_tied_catalogue()) {
             require_code('fields');
             delete_form_custom_fields($this->award_type, $id);
         }
         /*if ((!is_null($this->redirect_type)) || ((!is_null(get_param('redirect',NULL)))))		No - resource is gone now, and redirect would almost certainly try to take us back there
         		{
         			$url=(($this->redirect_type=='!') || (is_null($this->redirect_type)))?get_param('redirect'):build_url(array('page'=>'_SELF','type'=>$this->redirect_type),'_SELF');
         			return redirect_screen($title,$url,do_lang_tempcode('SUCCESS'));
         		}*/
         clear_ocp_autosave();
         $description = is_null($this->do_next_description) ? do_lang_tempcode('SUCCESS') : $this->do_next_description;
         return $this->do_next_manager($title, $description, NULL);
     } else {
         if (!is_null($this->permissions_require)) {
             check_edit_permission($this->permissions_require, $submitter, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? NULL : $this->get_cat($id), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? NULL : $this->get_cat_b($id)), $this->permission_page_name);
         }
         $test = $this->handle_confirmations($title);
         if (!is_null($test)) {
             return $test;
         }
         if ($this->user_facing && !is_null($this->permissions_require) && array_key_exists('validated', $_POST)) {
             if (!has_specific_permission(get_member(), 'bypass_validation_' . $this->permissions_require . 'range_content', $this->permission_page_name, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? '' : post_param($this->permissions_cat_name), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? '' : post_param($this->permissions_cat_name_b)))) {
                 $_POST['validated'] = '0';
             }
         }
         if (!is_null($this->upload)) {
             require_code('uploads');
         }
         $description = $this->edit_actualisation($id);
         if (!is_null($this->new_id)) {
             $id = $this->new_id;
         }
         // Save custom fields
         if ($this->has_tied_catalogue()) {
             require_code('fields');
             save_form_custom_fields($this->award_type, $id);
         }
         if ($this->output_of_action_is_confirmation && !is_null($description)) {
             return $description;
         }
         if (is_null($description)) {
             $description = do_lang_tempcode('SUCCESS');
         }
         if (addon_installed('awards')) {
             if (!is_null($this->award_type)) {
                 require_code('awards');
                 handle_award_setting($this->award_type, $id);
             }
         }
         if ($this->user_facing) {
             if ($this->check_validation && post_param_integer('validated', 0) == 0) {
                 require_code('submit');
                 if ($this->send_validation_request) {
                     $edit_url = build_url(array('page' => '_SELF', 'type' => '_e' . $this->type_code, 'id' => $id, 'validated' => 1), '_SELF', NULL, false, false, true);
                     if (addon_installed('unvalidated')) {
                         send_validation_request($doing, $this->table, $this->non_integer_id, $id, $edit_url);
                     }
                 }
                 $description->attach(paragraph(do_lang_tempcode('SUBMIT_UNVALIDATED')));
             }
         }
     }
     if (!is_null($this->redirect_type) || !is_null(get_param('redirect', NULL))) {
         $url = $this->redirect_type == '!' || is_null($this->redirect_type) ? make_string_tempcode(get_param('redirect')) : build_url(array('page' => '_SELF', 'type' => $this->redirect_type), '_SELF');
         return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
     }
     clear_ocp_autosave();
     decache('main_awards');
     return $this->do_next_manager($title, $description, $id);
 }
Ejemplo n.º 20
0
 /**
  * The actualiser for setting up account confirmation.
  *
  * @return tempcode		The UI
  */
 function step4()
 {
     $title = get_page_title('_JOIN');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('_JOIN'))));
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     // Check confirm code correct
     $_code = get_param('code', '-1');
     // -1 allowed because people often seem to mess the e-mail link up
     $code = intval($_code);
     if ($code <= 0) {
         require_code('form_templates');
         $fields = new ocp_tempcode();
         $fields->attach(form_input_email(do_lang_tempcode('EMAIL_ADDRESS'), '', 'email', '', true));
         $fields->attach(form_input_integer(do_lang_tempcode('CODE'), '', 'code', NULL, true));
         $submit_name = do_lang_tempcode('PROCEED');
         return do_template('FORM_SCREEN', array('_GUID' => 'e2c8c3762a308ac7489ec3fb32cc0cf8', 'TITLE' => $title, 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'URL' => get_self_url(false, false, NULL, false, true), 'FIELDS' => $fields, 'TEXT' => do_lang_tempcode('MISSING_CONFIRM_CODE'), 'SUBMIT_NAME' => $submit_name));
     }
     $rows = $GLOBALS['FORUM_DB']->query_select('f_members', array('id', 'm_validated'), array('m_validated_email_confirm_code' => strval($code), 'm_email_address' => trim(get_param('email'))));
     if (!array_key_exists(0, $rows)) {
         $rows = $GLOBALS['FORUM_DB']->query_select('f_members', array('id', 'm_validated'), array('m_validated_email_confirm_code' => '', 'm_email_address' => trim(get_param('email'))));
         if (!array_key_exists(0, $rows)) {
             warn_exit(do_lang_tempcode('INCORRECT_CONFIRM_CODE'));
         } else {
             $redirect = get_param('redirect', '');
             $map = array('page' => 'login', 'type' => 'misc');
             if ($redirect != '') {
                 $map['redirect'] = $redirect;
             }
             $url = build_url($map, get_module_zone('login'));
             return redirect_screen($title, $url, do_lang_tempcode('ALREADY_CONFIRMED_THIS'));
         }
     }
     $id = $rows[0]['id'];
     $validated = $rows[0]['m_validated'];
     // Activate user
     $GLOBALS['FORUM_DB']->query_update('f_members', array('m_validated_email_confirm_code' => ''), array('id' => $id), '', 1);
     if ($validated == 0) {
         return inform_screen($title, do_lang_tempcode('AWAITING_MEMBER_VALIDATION'));
     }
     // Alert user to situation
     $redirect = get_param('redirect', '');
     $map = array('page' => 'login', 'type' => 'misc');
     if ($redirect != '') {
         $map['redirect'] = $redirect;
     }
     $url = build_url($map, get_module_zone('login'));
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESSFUL_CONFIRM'));
 }
 /**
  * Show value statistics for a custom profile field (show).
  *
  * @return tempcode		The statistics
  */
 function _stats()
 {
     $title = get_page_title('CUSTOM_PROFILE_FIELD_STATS');
     breadcrumb_set_parents(array());
     $f_name = 'field_' . strval(get_param_integer('id'));
     $_a = get_input_date('start');
     $a = is_null($_a) ? '1=1' : 'm_join_time>' . strval((int) $_a);
     $_b = get_input_date('end');
     $b = is_null($_b) ? '1=1' : 'm_join_time<' . strval((int) $_b);
     $members_in_range = $GLOBALS['FORUM_DB']->query('SELECT ' . $f_name . ',COUNT(' . $f_name . ') AS cnt FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members m LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_member_custom_fields f ON m.id=f.mf_member_id WHERE ' . $a . ' AND ' . $b . ' GROUP BY ' . $f_name . ' ORDER BY cnt', 300);
     if (count($members_in_range) == 300) {
         attach_message(do_lang_tempcode('TOO_MUCH_CHOOSE__TOP_ONLY', escape_html(integer_format(300))), 'warn');
     }
     $lines = new ocp_tempcode();
     foreach ($members_in_range as $row) {
         if (!is_null($row[$f_name])) {
             $val = $row[$f_name];
             if ($val == STRING_MAGIC_NULL) {
                 continue;
             }
             $lines->attach(do_template('OCF_CPF_STATS_LINE', array('CNT' => integer_format($row['cnt']), 'VAL' => is_integer($val) ? integer_format($val) : $val)));
         }
     }
     if ($lines->is_empty()) {
         warn_exit(do_lang_tempcode('NO_DATA'));
     }
     return do_template('OCF_CPF_STATS_SCREEN', array('_GUID' => 'bb7be7acf936cd008e16bd515f7f39ac', 'TITLE' => $title, 'STATS' => $lines));
 }
Ejemplo n.º 22
0
 /**
  * The UI to edit a configuration page.
  *
  * @return tempcode		The UI
  */
 function config_category()
 {
     require_javascript('javascript_validation');
     /*$GLOBALS['HELPER_PANEL_PIC']='pagepics/config';
     		$GLOBALS['HELPER_PANEL_TUTORIAL']='tut_adv_configuration';*/
     $page = get_param('id');
     $title = get_page_title(do_lang_tempcode('CONFIG_CATEGORY_' . $page), false);
     $post_url = build_url(array('page' => '_SELF', 'type' => 'set', 'id' => $page, 'redirect' => get_param('redirect', NULL)), '_SELF');
     $category_description = do_lang_tempcode('CONFIG_CATEGORY_DESCRIPTION__' . $page);
     $rows = $GLOBALS['SITE_DB']->query_select('config', array('*'), array('the_page' => $page));
     // Addin special ones
     if ($page == 'SITE') {
         $rows[] = array('the_name' => 'timezone', 'human_name' => 'TIME_ZONE', 'config_value' => '', 'the_type' => 'special', 'eval' => '', 'the_page' => 'SITE', 'section' => 'GENERAL', 'explanation' => '', 'shared_hosting_restricted' => 0);
     }
     /*global $M_SORT_KEY;	This is a lame sort - it doesn't preserve internal order
     		$M_SORT_KEY='section';
     		usort($rows,'multi_sort');*/
     // Better sort
     $all_known_groups = array();
     foreach ($rows as $myrow) {
         $_group = do_lang($myrow['section'], NULL, NULL, NULL, NULL, false);
         if (is_null($_group)) {
             $_group = $myrow['section'];
         }
         $_group = strtolower(trim(preg_replace('#(&.*;)|[^\\w\\d\\s]#U', '', $_group)));
         if (array_key_exists($_group, $all_known_groups) && $all_known_groups[$_group] != $myrow['section']) {
             $_group = 'std_' . $myrow['section'];
         }
         // If cat names translate to same things or are in non-latin characters like Cyrillic
         $all_known_groups[$_group] = $myrow['section'];
     }
     $old_rows = $rows;
     $rows = array();
     ksort($all_known_groups);
     foreach ($all_known_groups as $group_codename) {
         foreach ($old_rows as $myrow) {
             if ($myrow['section'] == $group_codename) {
                 $rows[] = $myrow;
             }
         }
     }
     // Move advanced group options to the end
     $rows2 = array();
     foreach ($rows as $i => $row) {
         if ($row['section'] == 'ADVANCED') {
             $rows2[] = $row;
             unset($rows[$i]);
         }
     }
     $rows = array_merge($rows, $rows2);
     // UI hooks
     $ui_hooks = find_all_hooks('modules', 'admin_config');
     $upload_max_filesize = ini_get('upload_max_filesize') == '0' ? do_lang('NA') : clean_file_size(php_return_bytes(ini_get('upload_max_filesize')));
     $post_max_size = ini_get('post_max_size') == '0' ? do_lang('NA') : clean_file_size(php_return_bytes(ini_get('post_max_size')));
     $groups = new ocp_tempcode();
     require_code('form_templates');
     $current_group = '';
     $out = '';
     $_groups = array();
     foreach ($rows as $myrow) {
         if ($myrow['eval'] != '' && $myrow['the_name'] != 'detect_lang_forum') {
             if (defined('HIPHOP_PHP')) {
                 require_code('hooks/systems/config_default/' . $myrow['the_name']);
                 $hook = object_factory('Hook_config_default_' . $myrow['the_name']);
                 if (is_null($hook->get_default())) {
                     continue;
                 }
             } else {
                 $GLOBALS['REQUIRE_LANG_LOOP'] = 10;
                 // LEGACY Workaround for corrupt webhost installers
                 if (is_null(@eval($myrow['eval'] . ';'))) {
                     continue;
                 }
                 // @'d in case default is corrupt, don't want it to give errors forever
                 $GLOBALS['REQUIRE_LANG_LOOP'] = 0;
                 // LEGACY
             }
         }
         $_group = do_lang($myrow['section'], NULL, NULL, NULL, NULL, false);
         $name = do_lang($myrow['human_name'], NULL, NULL, NULL, NULL, false);
         $_group_tempcode = is_null($_group) ? make_string_tempcode($myrow['section']) : do_lang_tempcode($myrow['section']);
         $name_tempcode = is_null($name) ? make_string_tempcode($myrow['human_name']) : do_lang_tempcode($myrow['human_name']);
         if (get_forum_type() == 'ocf' && $myrow['explanation'] == 'CONFIG_OPTION_forum_in_portal') {
             $exp_string = $myrow['explanation'] . '__ocf';
         } else {
             $exp_string = $myrow['explanation'];
         }
         $_explanation = do_lang($exp_string, NULL, NULL, NULL, NULL, false);
         if (is_null($_explanation)) {
             $_explanation = do_lang('CONFIG_GROUP_DEFAULT_DESCRIP_' . $myrow['section'], NULL, NULL, NULL, NULL, false);
             if (is_null($_explanation)) {
                 $explanation = new ocp_tempcode();
             } else {
                 $explanation = do_lang_tempcode('CONFIG_GROUP_DEFAULT_DESCRIP_' . $myrow['section']);
             }
         } else {
             $explanation = do_lang_tempcode($exp_string);
         }
         if ($myrow['shared_hosting_restricted'] == 1 && !is_null($GLOBALS['CURRENT_SHARE_USER'])) {
             continue;
         }
         if ($myrow['section'] != $current_group && $current_group != '') {
             $_current_group = do_lang_tempcode($current_group);
             $_group_description = do_lang('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize), NULL, NULL, false);
             if (is_null($_group_description)) {
                 $group_description = new ocp_tempcode();
             } else {
                 $group_description = do_lang_tempcode('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize));
             }
             $group = do_template('CONFIG_GROUP', array('_GUID' => 'af4c31daa1bc39714ab83b11bd6d3e51', 'GROUP_DESCRIPTION' => $group_description, 'GROUP_NAME' => $current_group, 'GROUP' => $out, 'CURRENT_GROUP' => $_current_group));
             $groups->attach($group->evaluate());
             $out = '';
         }
         $_groups[$myrow['section']] = $_group_tempcode;
         switch ($myrow['the_type']) {
             case 'special':
                 switch ($myrow['the_name']) {
                     case 'timezone':
                         $list = '';
                         $timezone = get_site_timezone();
                         foreach (get_timezone_list() as $_timezone => $timezone_nice) {
                             $list .= static_evaluate_tempcode(form_input_list_entry($_timezone, $_timezone == $timezone, $timezone_nice));
                         }
                         $out .= static_evaluate_tempcode(form_input_list(do_lang_tempcode('TIME_ZONE'), do_lang_tempcode('DESCRIPTION_TIMEZONE_SITE'), 'timezone', make_string_tempcode($list)));
                         break;
                     default:
                         require_code('hooks/modules/admin_config/' . filter_naughty_harsh($myrow['the_name']));
                         $hook_ob = object_factory('Hook_admin_config_' . filter_naughty_harsh($myrow['the_name']));
                         $out .= static_evaluate_tempcode($hook_ob->run($myrow));
                         break;
                 }
                 break;
             case 'integer':
                 $out .= static_evaluate_tempcode(form_input_integer($name_tempcode, $explanation, $myrow['the_name'], intval(get_option($myrow['the_name'])), false));
                 break;
             case 'line':
                 if (strpos($myrow['the_name'], 'colour') !== false && substr(get_option($myrow['the_name']), 0, 1) == '#') {
                     $out .= static_evaluate_tempcode(form_input_colour($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true));
                 } elseif ($myrow['the_name'] == 'currency') {
                     $list = '';
                     require_code('currency');
                     $currencies = array_keys(get_currency_map());
                     foreach ($currencies as $currency) {
                         $list .= static_evaluate_tempcode(form_input_list_entry($currency, $currency == get_option($myrow['the_name'])));
                     }
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list)));
                 } elseif ($myrow['the_name'] == 'payment_gateway') {
                     $list = '';
                     $all_via = find_all_hooks('systems', 'ecommerce_via');
                     foreach (array_keys($all_via) as $via) {
                         $list .= static_evaluate_tempcode(form_input_list_entry($via, $via == get_option($myrow['the_name'])));
                     }
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list)));
                 } else {
                     /*if (strpos($myrow['the_name'],'password')!==false)  password fields can't take defaults
                     			$out.=static_evaluate_tempcode(form_input_password($name_tempcode,$explanation,$myrow['the_name'],get_option($myrow['the_name']),false));
                     		else
                     			*/
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
             case 'list':
                 $list = '';
                 $_value = get_option($myrow['the_name']);
                 $values = explode('|', $myrow['c_data']);
                 foreach ($values as $value) {
                     $_option_text = do_lang('CONFIG_OPTION_' . $myrow['the_name'] . '_VALUE_' . $value, NULL, NULL, NULL, NULL, false);
                     if (!is_null($_option_text)) {
                         $option_text = do_lang_tempcode('CONFIG_OPTION_' . $myrow['the_name'] . '_VALUE_' . $value);
                     } else {
                         $option_text = make_string_tempcode($value);
                     }
                     $list .= static_evaluate_tempcode(form_input_list_entry($value, $_value == $value, $option_text));
                 }
                 $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list), NULL, false, false));
                 break;
             case 'transline':
                 $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 break;
             case 'text':
                 $out .= static_evaluate_tempcode(form_input_text($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true));
                 break;
             case 'transtext':
                 $out .= static_evaluate_tempcode(form_input_text($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true));
                 break;
             case 'float':
                 $out .= static_evaluate_tempcode(form_input_float($name_tempcode, $explanation, $myrow['the_name'], floatval(get_option($myrow['the_name'])), false));
                 break;
             case 'tick':
                 $out .= static_evaluate_tempcode(form_input_tick($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']) == '1'));
                 break;
             case 'date':
                 $out .= static_evaluate_tempcode(form_input_date($name_tempcode, $explanation, $myrow['the_name'], false, false, false, intval(get_option($myrow['the_name'])), 40, intval(date('Y')) - 20, NULL, false));
                 break;
             case 'forum':
             case '?forum':
                 if (get_forum_type() == 'ocf' && addon_installed('ocf_forum')) {
                     $current_setting = get_option($myrow['the_name']);
                     if (!is_numeric($current_setting)) {
                         $_current_setting = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'id', array('f_name' => $current_setting));
                         if (is_null($_current_setting)) {
                             if ($myrow['the_type'] == '?forum') {
                                 $current_setting = NULL;
                             } else {
                                 $current_setting = strval(db_get_first_id());
                                 attach_message(do_lang_tempcode('FORUM_CURRENTLY_UNSET', $name_tempcode), 'notice');
                             }
                         } else {
                             $current_setting = strval($_current_setting);
                         }
                     }
                     $out .= static_evaluate_tempcode(form_input_tree_list($name_tempcode, $explanation, $myrow['the_name'], NULL, 'choose_forum', array(), false, $current_setting));
                 } else {
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
             case 'category':
                 if (get_forum_type() == 'ocf') {
                     $tmp_value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_categories', 'id', array('c_title' => get_option($myrow['the_name'])));
                     require_code('ocf_forums2');
                     $_list = ocf_nice_get_categories(NULL, $tmp_value);
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], $_list));
                 } else {
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
             case 'usergroup':
                 if (get_forum_type() == 'ocf') {
                     $tmp_value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=g.g_name', 'g.id', array('text_original' => get_option($myrow['the_name'])));
                     require_code('ocf_groups');
                     $_list = ocf_nice_get_usergroups($tmp_value);
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], $_list));
                 } else {
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
         }
         $current_group = $myrow['section'];
     }
     if ($out != '') {
         $_group_description = do_lang('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize), NULL, NULL, false);
         if (is_null($_group_description)) {
             $group_description = new ocp_tempcode();
         } else {
             $group_description = do_lang_tempcode('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize));
         }
         $group = do_template('CONFIG_GROUP', array('_GUID' => '84c0db86002a33a383a7c2e195dd3913', 'GROUP_DESCRIPTION' => $group_description, 'GROUP_NAME' => $current_group, 'GROUP' => $out, 'CURRENT_GROUP' => $_group_tempcode));
         $groups->attach($group->evaluate());
     }
     list($warning_details, $ping_url) = handle_conflict_resolution();
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CONFIGURATION'))));
     breadcrumb_set_self(do_lang_tempcode('CONFIG_CATEGORY_' . $page));
     return do_template('CONFIG_CATEGORY_SCREEN', array('_GUID' => 'd01b28b71c38bbb52b6aaf877c7f7b0e', 'CATEGORY_DESCRIPTION' => $category_description, '_GROUPS' => $_groups, 'PING_URL' => $ping_url, 'WARNING_DETAILS' => $warning_details, 'TITLE' => $title, 'URL' => $post_url, 'GROUPS' => $groups, 'SUBMIT_NAME' => do_lang_tempcode('SAVE')));
 }
Ejemplo n.º 23
0
 /**
  * Actualiser to deliver an invoice.
  *
  * @return tempcode	The result.
  */
 function deliver()
 {
     $title = get_page_title('MARK_AS_DELIVERED');
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('INVOICES')), array('_SELF:_SELF:undelivered', do_lang_tempcode('UNDELIVERED_INVOICES'))));
     $GLOBALS['SITE_DB']->query_update('invoices', array('i_state' => 'delivered'), array('id' => get_param_integer('id')), '', 1);
     $url = build_url(array('page' => '_SELF', 'type' => 'undelivered'), '_SELF');
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
Ejemplo n.º 24
0
 /**
  * The UI for deleting all the messages in a room.
  *
  * @return tempcode	The UI.
  */
 function chat_delete_all_messages()
 {
     $title = get_page_title('DELETE_ALL_MESSAGES');
     $id = get_param_integer('id');
     check_chatroom_access($id);
     $room_details = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $id), '', 1);
     if (!array_key_exists(0, $room_details)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $row = $room_details[0];
     $has_mod_access = has_specific_permission(get_member(), 'edit_lowrange_content', 'cms_chat', array('chat', $id)) || $row['room_owner'] == get_member() && has_specific_permission(get_member(), 'moderate_my_private_rooms');
     if (!$has_mod_access) {
         access_denied('SPECIFIC_PERMISSION', 'edit_lowrange_content');
     }
     $fields = new ocp_tempcode();
     require_code('form_templates');
     $fields->attach(form_input_tick(do_lang_tempcode('PROCEED'), do_lang_tempcode('Q_SURE'), 'continue_delete', false));
     $text = paragraph(do_lang_tempcode('CONFIRM_DELETE_ALL_MESSAGES', escape_html(get_chatroom_name($id))));
     $post_url = build_url(array('page' => '_SELF', 'type' => '_delete', 'id' => $id), '_SELF');
     $submit_name = do_lang_tempcode('DELETE');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CHOOSE')), array('_SELF:_SELF:room:id=' . strval($id), do_lang_tempcode('CHAT_MOD_PANEL'))));
     return do_template('FORM_SCREEN', array('_GUID' => '31b488e5d4ff52ffd5e097876c0b13c7', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'TITLE' => $title, 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'TEXT' => $text));
 }
Ejemplo n.º 25
0
 /**
  * The UI to view an IOTD.
  *
  * @return tempcode		The UI
  */
 function view()
 {
     $title = get_page_title('IOTD');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('IOTD_ARCHIVE'))));
     $id = get_param_integer('id');
     $rows = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('id' => $id), '', 1);
     if (!array_key_exists(0, $rows)) {
         return warn_screen($title, do_lang_tempcode('MISSING_RESOURCE'));
     }
     $myrow = $rows[0];
     list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], is_null($myrow['date_and_time']) && $myrow['used'] == 0 ? 0 : 1, $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['i_title']), get_value('comment_forum__iotds'));
     $date_raw = strval($myrow['date_and_time']);
     $add_date_raw = strval($myrow['add_date']);
     $edit_date_raw = is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']);
     $date = get_timezoned_date($myrow['date_and_time']);
     $add_date = get_timezoned_date($myrow['add_date']);
     $edit_date = get_timezoned_date($myrow['edit_date']);
     // Views
     if (get_db_type() != 'xml') {
         $myrow['iotd_views']++;
         $GLOBALS['SITE_DB']->query_update('iotd', array('iotd_views' => $myrow['iotd_views']), array('id' => $id), '', 1, NULL, false, true);
     }
     if (has_actual_page_access(NULL, 'cms_iotds', NULL, NULL) && has_edit_permission('high', get_member(), $myrow['submitter'], 'cms_iotds')) {
         $edit_url = build_url(array('page' => 'cms_iotds', 'type' => '_ed', 'id' => $id), get_module_zone('cms_iotds'));
     } else {
         $edit_url = new ocp_tempcode();
     }
     $url = $myrow['url'];
     if (url_is_local($url)) {
         $url = get_custom_base_url() . '/' . $url;
     }
     $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Poll', 'title' => get_translated_text($myrow['i_title']), 'identifier' => '_SEARCH:iotds:view:' . strval($id), 'description' => '', 'image' => $url);
     return do_template('IOTD_VIEW_SCREEN', array('_GUID' => 'f508d483459b88fab44cd8b9f4db780b', 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'I_TITLE' => get_translated_tempcode($myrow['i_title']), 'CAPTION' => get_translated_tempcode($myrow['caption']), 'DATE_RAW' => $date_raw, 'ADD_DATE_RAW' => $add_date_raw, 'EDIT_DATE_RAW' => $edit_date_raw, 'DATE' => $date, 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'VIEWS' => integer_format($myrow['iotd_views']), 'TRACKBACK_DETAILS' => $trackback_details, 'RATING_DETAILS' => $rating_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'URL' => $url));
 }
Ejemplo n.º 26
0
 /**
  * The actualiser for logging in.
  *
  * @return tempcode	The UI.
  */
 function login_after()
 {
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('_LOGIN'))));
     $username = trim(post_param('login_username'));
     $feedback = $GLOBALS['FORUM_DRIVER']->forum_authorise_login($username, NULL, apply_forum_driver_md5_variant(trim(post_param('password')), $username), trim(post_param('password')));
     $id = $feedback['id'];
     if (!is_null($id)) {
         $title = get_page_title('LOGGED_IN');
         $url = enforce_sessioned_url(either_param('redirect'));
         //set_session_id(get_session_id()); // Just in case something earlier set it to a pre-logged-in one     Not needed
         if (count($_POST) <= 4) {
             require_code('site2');
             assign_refresh($url, 0.0);
             $post = new ocp_tempcode();
             $refresh = new ocp_tempcode();
         } else {
             $post = build_keep_post_fields(array('redirect', 'redirect_passon'));
             $redirect_passon = post_param('redirect_passon', NULL);
             if (!is_null($redirect_passon)) {
                 $post->attach(form_input_hidden('redirect', $redirect_passon));
             }
             $refresh = do_template('JS_REFRESH', array('_GUID' => 'c7d2f9e7a2cc637f3cf9ac4d1cf97eca', 'FORM_NAME' => 'redir_form'));
         }
         decache('side_users_online');
         return do_template('LOGIN_REDIRECT_SCREEN', array('_GUID' => '82e056de9150bbed185120eac3571f40', 'REFRESH' => $refresh, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('_LOGIN_TEXT'), 'URL' => $url, 'POST' => $post));
     } else {
         get_page_title('USER_LOGIN_ERROR');
         $text = $feedback['error'];
         attach_message($text, 'warn');
         if (get_forum_type() == 'ocf') {
             require_lang('ocf');
             $forgotten_link = build_url(array('page' => 'lostpassword'), get_module_zone('lostpassword'));
             $extra = do_lang_tempcode('IF_FORGOTTEN_PASSWORD', escape_html($forgotten_link->evaluate()));
             attach_message($extra, 'inform');
         }
         return $this->login_before();
     }
 }
Ejemplo n.º 27
0
 /**
  * The actualiser for emptying caches.
  *
  * @return tempcode		The UI
  */
 function do_rebuild()
 {
     $hooks = find_all_hooks('modules', 'admin_cleanup');
     // Fiddle the order a bit
     if (array_key_exists('ocf_topics', $hooks)) {
         unset($hooks['ocf_topics']);
         $hooks['ocf_topics'] = 'sources_custom';
     }
     if (array_key_exists('ocf', $hooks)) {
         unset($hooks['ocf']);
         $hooks['ocf'] = 'sources_custom';
     }
     if (array_key_exists('ocf_members', $hooks)) {
         unset($hooks['ocf_members']);
         $hooks['ocf_members'] = 'sources_custom';
     }
     $todo = array();
     foreach (array_keys($hooks) as $hook) {
         if (post_param_integer($hook, 0) == 1) {
             $todo[] = $hook;
         }
     }
     $messages = ocportal_cleanup($todo);
     $messages->attach(paragraph(do_lang_tempcode('SUCCESS')));
     $title = get_page_title('CLEANUP_TOOLS');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CLEANUP_TOOLS'))));
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     return do_template('CLEANUP_COMPLETED_SCREEN', array('_GUID' => '598510a9ad9f01f3c0806319b32b5033', 'TITLE' => $title, 'MESSAGES' => $messages));
 }
Ejemplo n.º 28
0
 function view()
 {
     $id = NULL;
     $name = '';
     $image = '';
     $cure = '';
     $cure_price = 0;
     $immunization = '';
     $immunization_price = 0;
     $spread_rate = 0;
     $points_per_spread = 10;
     $enabled = do_lang_tempcode('DISEASE_DISABLED');
     $id = get_param_integer('id', 0);
     if ($id > 0) {
         $rows = $GLOBALS['SITE_DB']->query_select('diseases', array('*'), array('id' => $id));
         if (isset($rows[0]['id']) && $rows[0]['id'] > 0) {
             $id = $rows[0]['id'];
             $name = $rows[0]['name'];
             $image = $rows[0]['image'];
             $cure = $rows[0]['cure'];
             $cure_price = $rows[0]['cure_price'];
             $immunization = $rows[0]['immunisation'];
             $immunization_price = $rows[0]['immunisation_price'];
             $spread_rate = $rows[0]['spread_rate'];
             $points_per_spread = $rows[0]['points_per_spread'];
             $enabled = $rows[0]['enabled'] == 1 ? do_lang_tempcode('DISEASE_ENABLED') : do_lang_tempcode('DISEASE_DISABLED');
         }
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('OCDEADPEOPLE_TITLE'))));
     breadcrumb_set_self(do_lang_tempcode('VIEW_DISEASE'));
     require_code('templates_view_space');
     return view_space(get_page_title('VIEW_DISEASE'), array('NAME' => $name, 'IMAGE' => $image, 'CURE' => $cure, 'CURE_PRICE' => integer_format($cure_price), 'IMMUNIZATION' => $immunization, 'IMMUNIZATION_PRICE' => integer_format($immunization_price), 'SPREAD_RATE' => integer_format($spread_rate), 'POINTS_PER_SPREAD' => integer_format($points_per_spread), 'ENABLED' => $enabled));
 }
Ejemplo n.º 29
0
 /**
  * The actualiser for recommending the site.
  *
  * @return tempcode	The UI.
  */
 function actual()
 {
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('RECOMMEND_SITE'))));
     $name = post_param('name');
     $message = post_param('message');
     $recommender_email_address = post_param('recommender_email_address');
     $invite = false;
     if (addon_installed('captcha')) {
         require_code('captcha');
         enforce_captcha();
     }
     require_code('type_validation');
     $email_adrs_to_send = array();
     $names_to_send = array();
     foreach ($_POST as $key => $email_address) {
         if (substr($key, 0, 14) != 'email_address_') {
             continue;
         }
         if ($email_address == '') {
             continue;
         }
         if (get_magic_quotes_gpc()) {
             $email_address = stripslashes($email_address);
         }
         if (!is_valid_email_address($email_address)) {
             attach_message(do_lang_tempcode('INVALID_EMAIL_ADDRESS'), 'warn');
             return $this->gui();
         } else {
             $email_adrs_to_send[] = $email_address;
             $names_to_send[] = $email_address;
         }
         if (is_guest()) {
             break;
         }
     }
     $adrbook_emails = array();
     $adrbook_names = array();
     $adrbook_use_these = array();
     foreach ($_POST as $key => $email_address) {
         if (preg_match('#details_email_|details_name_|^use_details_#', $key) == 0) {
             continue;
         }
         if (preg_match('#details_email_#', $key) != 0) {
             if (get_magic_quotes_gpc()) {
                 $email_address = stripslashes($email_address);
             }
             if (is_valid_email_address($email_address)) {
                 $curr_num = intval(preg_replace('#details_email_#', '', $key));
                 $adrbook_emails[$curr_num] = $email_address;
             }
         }
         if (preg_match('#details_name_#', $key)) {
             $curr_num = intval(preg_replace('#details_name_#', '', $key));
             $adrbook_names[$curr_num] = $email_address;
         }
         if (preg_match('#^use_details_#', $key)) {
             $curr_num = intval(preg_replace('#use_details_#', '', $key));
             $adrbook_use_these[$curr_num] = $curr_num;
         }
     }
     //add emails from address book file
     foreach ($adrbook_use_these as $key => $value) {
         $cur_email = array_key_exists($key, $adrbook_emails) && strlen($adrbook_emails[$key]) > 0 ? $adrbook_emails[$key] : '';
         $cur_name = array_key_exists($key, $adrbook_names) && strlen($adrbook_names[$key]) > 0 ? $adrbook_names[$key] : '';
         if (strlen($cur_email) > 0) {
             $email_adrs_to_send[] = $cur_email;
             $names_to_send[] = strlen($cur_name) > 0 ? $cur_name : $cur_email;
         }
     }
     if (count($email_adrs_to_send) == 0) {
         warn_exit(do_lang_tempcode('ERROR_NO_CONTACTS_SELECTED'));
     }
     foreach ($email_adrs_to_send as $key => $email_address) {
         if (get_magic_quotes_gpc()) {
             $email_address = stripslashes($email_address);
         }
         if (post_param_integer('wrap_message', 0) == 1) {
             $title = get_page_title('_RECOMMEND_SITE', true, array(escape_html(get_site_name())));
             $referring_username = is_guest() ? NULL : get_member();
             $_url = post_param_integer('invite', 0) == 1 ? build_url(array('page' => 'join', 'email_address' => $email_address, 'keep_referrer' => $referring_username), get_module_zone('join')) : build_url(array('page' => '', 'keep_referrer' => $referring_username), '');
             $url = $_url->evaluate();
             $join_url = $GLOBALS['FORUM_DRIVER']->join_url();
             $_message = do_lang(post_param_integer('invite', 0) == 1 ? 'INVITE_MEMBER_MESSAGE' : 'RECOMMEND_MEMBER_MESSAGE', $name, $url, array(get_site_name(), $join_url)) . $message;
         } else {
             $title = get_page_title('RECOMMEND_LINK');
             $_message = $message;
         }
         if (may_use_invites() && get_forum_type() == 'ocf' && !is_guest() && post_param_integer('invite', 0) == 1) {
             $invites = get_num_invites(get_member());
             if ($invites > 0) {
                 send_recommendation_email($name, $email_address, $_message, true, $recommender_email_address, post_param('subject', NULL), $names_to_send[$key]);
                 $GLOBALS['FORUM_DB']->query_insert('f_invites', array('i_inviter' => get_member(), 'i_email_address' => $email_address, 'i_time' => time(), 'i_taken' => 0));
                 $invite = true;
             }
         } elseif (get_option('is_on_invites') == '0' && get_forum_type() == 'ocf') {
             $GLOBALS['FORUM_DB']->query_insert('f_invites', array('i_inviter' => get_member(), 'i_email_address' => $email_address, 'i_time' => time(), 'i_taken' => 0));
         }
         if (!$invite) {
             send_recommendation_email($name, $email_address, $_message, false, $recommender_email_address, post_param('subject', NULL), $names_to_send[$key]);
         }
     }
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     return inform_screen($title, do_lang_tempcode('RECOMMENDATION_MADE'));
 }
Ejemplo n.º 30
0
 /**
  * Sort out breadcrumbing for a forum/topic/additional combination.
  *
  * @param  AUTO_LINK		The forum for breadcrumbing
  * @param  AUTO_LINK		The topic for breadcrumbing
  * @param  string			The topic title
  * @param  string			The action currently being done
  */
 function handle_topic_breadcrumbs($forum_id, $topic_id, $topic_title, $doing)
 {
     if (is_null($forum_id)) {
         breadcrumb_set_parents(array(array('_SEARCH:forumview:pt', do_lang_tempcode('PERSONAL_TOPICS')), array('_SEARCH:topicview:id=' . strval($topic_id), $topic_title)));
     } else {
         $tree = ocf_forum_breadcrumbs($forum_id, NULL, NULL, false);
         breadcrumb_add_segment($tree, array(array('_SEARCH:topicview:id=' . strval($topic_id), $topic_title), array('', $doing)));
     }
 }