/** * Standard modular run function. * * @return tempcode Results */ function run() { if (get_forum_type() != 'ocf') { return new ocp_tempcode(); } else { ocf_require_all_forum_stuff(); } if (function_exists('set_time_limit')) { @set_time_limit(0); } require_code('ocf_posts_action'); require_code('ocf_posts_action2'); // Members $start = 0; do { $members = $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 500, $start); foreach ($members as $member) { ocf_force_update_member_post_count($member['id']); $num_warnings = $GLOBALS['FORUM_DB']->query_value('f_warnings', 'COUNT(*)', array('w_member_id' => $member['id'], 'w_is_warning' => 1)); $GLOBALS['FORUM_DB']->query_update('f_members', array('m_cache_warnings' => $num_warnings), array('id' => $member['id']), '', 1); } $start += 500; } while (array_key_exists(0, $members)); return new ocp_tempcode(); }
/** * Standard modular run function. * * @param array A map of parameters. * @return tempcode The result of execution. */ function run($map) { unset($map); if (get_forum_type() != 'ocf') { return new ocp_tempcode(); } if (is_guest()) { return new ocp_tempcode(); } require_css('side_blocks'); ocf_require_all_forum_stuff(); require_code('ocf_notifications'); // Only show what's new in week. Some forums may want to tweak this, but forums themselves only mark unread topics for a week. $rows = ocf_get_pp_rows(); // if (count($rows)==0) return new ocp_tempcode(); require_lang('ocf'); $out = new ocp_tempcode(); foreach ($rows as $topic) { $topic_url = build_url(array('page' => 'topicview', 'id' => $topic['id'], 'type' => 'findpost'), get_module_zone('topicview')); $topic_url->attach('#post_' . strval($topic['id'])); $title = $topic['t_cache_first_title']; $date = get_timezoned_date($topic['t_cache_last_time'], true); $username = $topic['t_cache_last_username']; $member_link = $GLOBALS['OCF_DRIVER']->member_profile_url($topic['t_cache_last_member_id'], false, true); $num_posts = $topic['t_cache_num_posts']; $out->attach(do_template('TOPIC_LIST', array('_GUID' => '55ae21a9f8d67ba6237c118a18b9657b', 'USER_LINK' => $member_link, 'TOPIC_LINK' => $topic_url, 'TITLE' => $title, 'DATE' => $date, 'DATE_RAW' => strval($topic['t_cache_last_time']), 'USERNAME' => $username, 'NUM_POSTS' => integer_format($num_posts)))); } $send_url = build_url(array('page' => 'topics', 'type' => 'new_pt', 'redirect' => SELF_REDIRECT), get_module_zone('topics')); if (!ocf_may_make_personal_topic()) { $send_url = new ocp_tempcode(); } $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => get_member()), get_module_zone('members'), NULL, true, false, false, 'tab__pts'); return do_template('BLOCK_SIDE_OCF_PERSONAL_TOPICS', array('_GUID' => '9376cd47884a78f3d1914c176b67ee28', 'SEND_URL' => $send_url, 'VIEW_URL' => $view_url, 'CONTENT' => $out, 'FORUM_NAME' => do_lang_tempcode('PERSONAL_TOPICS'))); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/forums'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_forums'; $this->add_one_label = do_lang_tempcode('ADD_FORUM'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_FORUM'); $this->edit_one_label = do_lang_tempcode('EDIT_FORUM'); global $C_TITLE; $C_TITLE = NULL; 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'); require_css('ocf'); load_up_all_module_category_permissions($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'forums'); if ($type == 'misc') { return $this->misc(); } if ($type == 'reorder') { return $this->reorder(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_forumview'); if (is_guest()) { access_denied('NOT_AS_GUEST'); } require_css('ocf'); $type = get_param('type', 'misc'); if ($type == 'misc') { list($title, $content) = $this->new_posts(); } elseif ($type == 'unread') { list($title, $content) = $this->unread_topics(); } elseif ($type == 'recently_read') { list($title, $content) = $this->recently_read(); } else { $title = new ocp_tempcode(); $content = new ocp_tempcode(); } $ret = ocf_wrapper($title, do_template('OCF_VFORUM', array('_GUID' => '8dca548982d65500ab1800ceec2ddc61', 'CONTENT' => $content))); return $ret; }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/emoticons'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_emoticons'; $this->add_one_label = do_lang_tempcode('ADD_EMOTICON'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_EMOTICON'); $this->edit_one_label = do_lang_tempcode('EDIT_EMOTICON'); require_lang('dearchive'); require_code('images'); if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_general_action'); require_code('ocf_general_action2'); if ($type == 'ad') { require_javascript('javascript_ajax'); $script = find_script('snippet'); $this->javascript = "\n\t\t\t\tvar form=document.getElementById('main_form');\n\t\t\t\tform.old_submit=form.onsubmit;\n\t\t\t\tform.onsubmit=function()\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=true;\n\t\t\t\t\t\tvar url='" . addslashes($script) . "?snippet=exists_emoticon&name='+window.encodeURIComponent(form.elements['code'].value);\n\t\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t"; } if ($type == 'misc') { return $this->misc(); } if ($type == 'import') { return $this->import(); } if ($type == '_import') { return $this->_import(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { /*if (get_option('allow_member_integration')=='strict') { $title=get_page_title('_JOIN'); $url='http://ocproducts.com/index.php?page=join'; require_code('site2'); assign_refresh($url,1.0); return do_template('REDIRECT_SCREEN',array('_GUID'=>'8398057d3427d54c105fb9c9ae9d2940','URL'=>$url,'TITLE'=>$title,'NO_COMPLETE'=>true,'TEXT'=>do_lang_tempcode('INT_STRICT',ocp_srv('HTTP_HOST')))); }*/ require_code('ocf_join'); check_joining_allowed(); ocf_require_all_forum_stuff(); $type = get_param('type', 'misc'); if ($type == 'misc') { return get_option('show_first_join_page') != '1' ? $this->step2() : $this->step1(); } if ($type == 'step2') { return $this->step2(); } if ($type == 'step3') { return $this->step3(); } if ($type == 'step4') { return $this->step4(); } return new ocp_tempcode(); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['NO_DB_SCOPE_CHECK'] = true; $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/customprofilefields'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_members'; if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_members_action'); require_code('ocf_members_action2'); require_lang('fields'); require_lang('ocf'); $this->add_one_label = do_lang_tempcode('ADD_CUSTOM_PROFILE_FIELD'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_CUSTOM_PROFILE_FIELD'); $this->edit_one_label = do_lang_tempcode('EDIT_CUSTOM_PROFILE_FIELD'); if ($type == 'misc') { return $this->misc(); } if ($type == 'stats') { return $this->stats(); } if ($type == '_stats') { return $this->_stats(); } return new ocp_tempcode(); }
/** * Add the specified custom field to the forum (some forums implemented this using proper custom profile fields, others through adding a new field). * * @param object Link to the real forum driver * @param string The name of the new custom field * @param integer The length of the new custom field * @param BINARY Whether the field is locked * @param BINARY Whether the field is for viewing * @param BINARY Whether the field is for setting * @param BINARY Whether the field is required * @param string Description * @param string The field type * @param BINARY Whether the field is encrypted * @param ?string Default field value (NULL: standard for field type) * @return boolean Whether the custom field was created successfully */ function _helper_install_create_custom_field($this_ref, $name, $length, $locked = 1, $viewable = 0, $settable = 0, $required = 0, $description = '', $type = 'long_text', $encrypted = 0, $default = NULL) { unset($length); ocf_require_all_forum_stuff(); require_code('ocf_members_action'); $name = 'ocp_' . $name; $id = $this_ref->connection->query_value_null_ok('f_custom_fields f LEFT JOIN ' . $this_ref->connection->get_table_prefix() . 'translate t ON f.cf_name=t.id', 'f.id', array('text_original' => $name)); if (is_null($id)) { if (is_null($default)) { $default = strpos($name, 'points') !== false ? '0' : ''; } $id = ocf_make_custom_field($name, $locked, $description, $default, $viewable, $viewable, $settable, $encrypted, $type, $required); } return !is_null($id); }
/** * Standard modular install function. * * @param ?integer What version we're upgrading from (NULL: new install) * @param ?integer What hack version we're upgrading from (NULL: new-install/not-upgrading-from-a-hacked-version) */ function install($upgrade_from = NULL, $upgrade_from_hack = NULL) { add_config_option('_MESSAGING_FORUM_NAME', 'messaging_forum_name', 'forum', 'return do_lang(\'MESSAGING_FORUM_NAME\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'CONTACT_US_MESSAGING'); if (get_forum_type() == 'ocf' && !running_script('upgrader')) { $moderator_groups = $GLOBALS['FORUM_DRIVER']->get_moderator_groups(); $staff_access = array(); foreach ($moderator_groups as $id) { $staff_access[$id] = 5; } ocf_require_all_forum_stuff(); require_code('ocf_forums_action'); require_code('ocf_forums_action2'); $GLOBALS['OCF_DRIVER'] = $GLOBALS['FORUM_DRIVER']; ocf_make_forum(do_lang('MESSAGING_FORUM_NAME'), '', db_get_first_id() + 1, $staff_access, db_get_first_id()); } }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/addmember'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_members'; if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_members_action'); require_code('ocf_members_action2'); $type = get_param('type', 'misc'); if ($type == 'menu') { return $this->menu(); } if ($type == 'misc') { return $this->step1(); } if ($type == 'step2') { return $this->step2(); } if ($type == 'delurk') { return $this->delurk(); } if ($type == '_delurk') { return $this->_delurk(); } if ($type == '__delurk') { return $this->__delurk(); } if ($type == 'download_csv') { $this->download_csv(); } if ($type == 'import_csv') { return $this->import_csv(); } if ($type == '_import_csv') { return $this->_import_csv(); } if ($type == 'group_member_timeouts') { return $this->group_member_timeouts(); } if ($type == '_group_member_timeouts') { return $this->_group_member_timeouts(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run_start() { require_lang('ecommerce'); require_code('ecommerce'); if (get_value('unofficial_ecommerce') != '1' && count(find_all_hooks('systems', 'ecommerce')) == 8) { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } } $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/ecommerce'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_ecommerce'; $type = get_param('type', 'misc'); $this->add_one_label = do_lang_tempcode('ADD_USERGROUP_SUBSCRIPTION'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_USERGROUP_SUBSCRIPTION'); $this->edit_one_label = do_lang_tempcode('EDIT_USERGROUP_SUBSCRIPTION'); if ($type == 'misc') { return $this->misc(); } if ($type == 'logs') { return $this->logs(); } if ($type == 'ecom_usage') { return $this->usage(); } if ($type == 'cash_flow') { return $this->cash_flow(); } if ($type == 'profit_loss') { return $this->profit_loss(); } //if ($type=='balance_sheet') return $this->balance_sheet(); if ($type == 'trigger') { return $this->trigger(); } if ($type == '_trigger') { return $this->_trigger(); } if (get_forum_type() == 'ocf') { breadcrumb_set_parents(array(array('_SEARCH:admin_ocf_join:menu', do_lang_tempcode('MEMBERS')))); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } $type = get_param('type', 'misc'); if ($type == 'misc') { return $this->step1(); } if ($type == 'step2') { return $this->step2(); } if ($type == 'step3') { return $this->step3(); } return new ocp_tempcode(); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/posttemplates'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_forum_helpdesk'; $this->add_one_label = do_lang_tempcode('ADD_POST_TEMPLATE'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_POST_TEMPLATE'); $this->edit_one_label = do_lang_tempcode('EDIT_POST_TEMPLATE'); if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_general_action'); require_code('ocf_general_action2'); if ($type == 'misc') { return $this->misc(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode Results */ function run() { if (get_forum_type() != 'ocf') { return new ocp_tempcode(); } else { ocf_require_all_forum_stuff(); } if (function_exists('set_time_limit')) { @set_time_limit(0); } // Topics and posts $start = 0; do { $topics = $GLOBALS['FORUM_DB']->query_select('f_topics', array('id', 't_forum_id'), NULL, '', 500, $start); foreach ($topics as $topic) { require_code('ocf_posts_action2'); ocf_force_update_topic_cacheing($topic['id'], NULL, true, true); // NB: p_cache_forum_id must not be intval'd as may be null if (is_null($topic['t_forum_id'])) { $topic['t_forum_id'] = NULL; } $GLOBALS['FORUM_DB']->query('UPDATE ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts SET p_cache_forum_id=' . (is_null($topic['t_forum_id']) ? 'NULL' : strval($topic['t_forum_id'])) . ' WHERE p_topic_id=' . (is_null($topic['id']) ? 'NULL' : strval($topic['id']))); } $start += 500; } while (array_key_exists(0, $topics)); // Polls $start = 0; do { $polls = $GLOBALS['FORUM_DB']->query_select('f_polls', array('id'), NULL, '', 500, $start); foreach ($polls as $poll) { $total_votes = $GLOBALS['FORUM_DB']->query_value('f_poll_votes', 'COUNT(*)', array('pv_poll_id' => $poll['id'])); $GLOBALS['FORUM_DB']->query_update('f_polls', array('po_cache_total_votes' => $total_votes), array('id' => $poll['id']), '', 1); $answers = $GLOBALS['FORUM_DB']->query_select('f_poll_answers', array('id'), array('pa_poll_id' => $poll['id'])); foreach ($answers as $answer) { $votes = $GLOBALS['FORUM_DB']->query_value('f_poll_votes', 'COUNT(*)', array('pv_answer_id' => $answer['id'], 'pv_poll_id' => $poll['id'])); $GLOBALS['FORUM_DB']->query_update('f_poll_answers', array('pa_cache_num_votes' => $votes), array('id' => $answer['id']), '', 1); } } $start += 500; } while (array_key_exists(0, $polls)); return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_css('ocf'); require_code('form_templates'); global $NON_CANONICAL_PARAMS; foreach (array_keys($_GET) as $key) { if (substr($key, 0, 3) == 'kfs' || substr($key, 0, 5) == 'mark_') { $NON_CANONICAL_PARAMS[] = $key; } } $type = get_param('type', 'misc'); $valid_types = array('whisper', 'mark_read', 'mark_read_topic', 'mark_unread_topic', 'delete_topic', '_delete_topic', 'delete_topics', '_delete_topics', 'categorise_pts', '_categorise_pts', 'move_topic', '_move_topic', 'validate_posts', 'delete_posts', '_delete_posts', 'delete_post', '_delete_post', 'move_posts_a', 'move_posts_b', '_move_posts', 'move_topics', '_move_topics', 'new_topic', 'new_post', 'new_pt', '_add_reply', 'toggle_notifications_topic', 'toggle_notifications_forum', 'vote_poll', 'add_poll', '_add_poll', 'edit_poll', '_edit_poll', 'delete_poll', '_delete_poll', 'edit_post', '_edit_post', 'edit_topic', '_edit_topic', 'pin_topic', 'unpin_topic', 'sink_topic', 'unsink_topic', 'cascade_topic', 'uncascade_topic', 'open_topic', 'close_topic', 'validate_post', 'topic_history', 'birthday', 'make_personal', '_make_personal', 'pin_topics', 'unpin_topics', 'sink_topics', 'unsink_topics', 'cascade_topics', 'uncascade_topics', 'open_topics', 'close_topics', 'mark_topics_read', 'mark_topics_unread', '_mass_multimod', 'invite_member', '_invite_member'); if (addon_installed('ocf_reported_posts')) { $valid_types[] = 'report_post'; } if (addon_installed('ocf_multi_moderations')) { $valid_types[] = 'multimod'; $valid_types[] = '_multimod'; } if (in_array($type, $valid_types)) { return ocf_wrapper(new ocp_tempcode(), call_user_func(array($this, $type)), false, false); } if (substr($type, 0, 3) == 'mm_') { return $this->multimod(); } if (substr($type, 0, 4) == 'mmt_') { return $this->mass_multimod(); } if ($type == 'misc') { global $EXTRA_HEAD; $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />'); // XHTMLXHTML warn_exit(do_lang_tempcode('NOTHING_SELECTED')); } return new ocp_tempcode(); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/clubs'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_subcom'; if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_groups_action'); require_code('ocf_forums_action'); require_code('ocf_groups_action2'); require_code('ocf_forums_action2'); $this->add_one_label = do_lang_tempcode('ADD_CLUB'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_CLUB'); $this->edit_one_label = do_lang_tempcode('EDIT_CLUB'); if ($type == 'misc') { return $this->misc(); } return new ocp_tempcode(); }
/** * 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(); }
/** * Standard modular run function. * * @return tempcode Results */ function run() { if (get_forum_type() != 'ocf') { return new ocp_tempcode(); } else { ocf_require_all_forum_stuff(); } if (function_exists('set_time_limit')) { @set_time_limit(0); } // Forums require_code('ocf_posts_action2'); $start = 0; do { $forums = $GLOBALS['FORUM_DB']->query_select('f_forums', array('id'), NULL, '', 100, $start); foreach ($forums as $forum) { ocf_force_update_forum_cacheing($forum['id']); } $start += 100; } while ($forums != array()); return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('mail'); require_lang('comcode'); if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } $type = get_param('type', 'misc'); $member_id = get_param_integer('id'); if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_email_address') == '' || get_option('allow_email_disable') == '1' && $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_allow_emails') == 0 || is_guest($member_id)) { warn_exit(do_lang_tempcode('NO_ACCEPT_EMAILS')); } if ($type == 'misc') { return $this->gui(); } if ($type == 'actual') { return $this->actual(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_css('ocf'); $type = get_param('type', 'misc'); if ($type == 'misc') { return $this->gui(); } if ($type == 'restore') { return $this->restore(); } if ($type == 'revert') { return $this->revert(); } if ($type == 'delete') { return $this->delete(); } return new ocp_tempcode(); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { require_lang('ocf_warnings'); if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_moderation_action'); require_code('ocf_moderation_action2'); if (!ocf_may_warn_members()) { access_denied('SPECIFIC_PERMISSION', 'warn_members'); } if ($type == 'history') { return $this->history(); } if ($type == 'undo_charge') { return $this->undo_charge(); } if ($type == 'undo_probation') { return $this->undo_probation(); } if ($type == 'undo_banned_ip') { return $this->undo_banned_ip(); } if ($type == 'undo_banned_member') { return $this->undo_banned_member(); } if ($type == 'undo_silence_from_topic') { return $this->undo_silence_from_topic(); } if ($type == 'undo_silence_from_forum') { return $this->undo_silence_from_forum(); } return new ocp_tempcode(); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['NO_DB_SCOPE_CHECK'] = true; breadcrumb_set_parents(array(array('_SEARCH:admin_ocf_join:menu', do_lang_tempcode('MEMBERS')))); require_lang('ocf_welcome_emails'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/welcome_emails'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_members'; $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_WELCOME_EMAIL_PREVIEW'); require_code('ocf_general_action'); require_code('ocf_general_action2'); require_lang('ocf_welcome_emails'); ocf_require_all_forum_stuff(); $this->add_one_label = do_lang_tempcode('ADD_WELCOME_EMAIL'); $this->edit_this_label = do_lang_tempcode('EDIT_THIS_WELCOME_EMAIL'); $this->edit_one_label = do_lang_tempcode('EDIT_WELCOME_EMAIL'); if ($type == 'misc') { return $this->misc(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_groups_action'); require_code('ocf_groups_action2'); require_code('ocf_groups2'); $type = get_param('type', 'misc'); if ($type == 'misc') { return $this->directory(); } if ($type == 'view') { return $this->usergroup(); } if ($type == 'resign') { return $this->resign(); } if ($type == 'remove_from') { return $this->remove_from(); } if ($type == 'apply') { return $this->apply(); } if ($type == 'accept') { return $this->accept(); } if ($type == 'validate') { return $this->validate(); } if ($type == 'add_to') { return $this->add_to(); } if ($type == 'decline') { return $this->decline(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_css('ocf'); $type = get_param('type', 'misc'); if ($type == 'misc') { return $this->directory(); } if ($type == 'view') { return $this->profile(); } //if ($type=='remote') return $this->remote(); return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_topicview'); require_css('ocf'); global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'max'; $NON_CANONICAL_PARAMS[] = 'start'; $NON_CANONICAL_PARAMS[] = 'threaded'; $start = get_param_integer('start', 0); $default_max = intval(get_option('forum_posts_per_page')); $max = get_param_integer('max', $default_max); if ($max == 0) { $max = $default_max; } if ($max == 0) { $max = 1; } if ($max > 30 && !has_specific_permission(get_member(), 'remove_page_split')) { $max = $default_max; } $first_unread_id = -1; global $NON_CANONICAL_PARAMS; foreach (array_keys($_GET) as $key) { if (substr($key, 0, 3) == 'kfs') { $NON_CANONICAL_PARAMS[] = $key; } } $type = get_param('type', 'misc'); $id = get_param_integer('id', NULL); if (is_guest() && is_null($id)) { access_denied('NOT_AS_GUEST'); } if ($type == 'findpost') { $post_id = get_param_integer('id'); $redirect = find_post_id_url($post_id); require_code('site2'); assign_refresh($redirect, 0.0); return do_template('REDIRECT_SCREEN', array('_GUID' => '76e6d34c20a4f5284119827e41c7752f', 'URL' => $redirect, 'TITLE' => get_page_title('VIEW_TOPIC'), 'TEXT' => do_lang_tempcode('REDIRECTING'))); } else { if ($type == 'first_unread') { $redirect = find_first_unread_url($id); require_code('site2'); assign_refresh($redirect, 0.0); return do_template('REDIRECT_SCREEN', array('_GUID' => '12c5d16f60e8c4df03536d9a7a932528', 'URL' => $redirect, 'TITLE' => get_page_title('VIEW_TOPIC'), 'TEXT' => do_lang_tempcode('REDIRECTING'))); } } if (!is_null($id)) { $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=ocf_topicview&filter=' . strval($id); } $view_poll_results = get_param_integer('view_poll_results', 0); // Mark as read if (!is_null($id)) { if (!is_guest()) { $GLOBALS['FORUM_DB']->query_delete('f_read_logs', array('l_member_id' => get_member(), 'l_topic_id' => $id), '', 1); $GLOBALS['FORUM_DB']->query_insert('f_read_logs', array('l_member_id' => get_member(), 'l_topic_id' => $id, 'l_time' => time()), false, true); // race condition } $GLOBALS['FORUM_DB']->query('UPDATE ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics SET t_num_views=(t_num_views+1) WHERE id=' . strval((int) $id), 1, NULL, true); } // Load up topic info $topic_info = ocf_read_in_topic($id, $start, $max, $view_poll_results == 1); $GLOBALS['META_DATA'] += $topic_info['meta_data']; global $SEO_TITLE; $SEO_TITLE = do_lang('_VIEW_TOPIC', $topic_info['title']); // Render posts according to whether threaded or not $threaded = $topic_info['is_threaded'] == 1; $may_reply = array_key_exists('may_reply', $topic_info) && ($topic_info['is_open'] || array_key_exists('may_post_closed', $topic_info)); if (!$threaded) { $GLOBALS['META_DATA']['description'] = $topic_info['description']; // Poster detail hooks $hooks = find_all_hooks('modules', 'topicview'); $hook_objects = array(); foreach (array_keys($hooks) as $hook) { require_code('hooks/modules/topicview/' . filter_naughty_harsh($hook)); $object = object_factory('Hook_' . filter_naughty_harsh($hook), true); if (is_null($object)) { continue; } $hook_objects[$hook] = $object; } // Render non-threaded $posts = new ocp_tempcode(); $replied = false; if (is_null($topic_info['forum_id'])) { decache('side_ocf_personal_topics', array(get_member())); decache('_new_pp', array(get_member())); } $second_poster = $topic_info['first_poster']; foreach ($topic_info['posts'] as $array_id => $_postdetails) { if ($array_id == 0) { $description = $topic_info['description']; } else { $description = NULL; } if ($_postdetails['poster'] == get_member()) { $replied = true; } if ($array_id == 1 && $start == 0 || $array_id == 0 && $start != 0) { $second_poster = $_postdetails['poster']; } if (array_key_exists('last_edit_time', $_postdetails)) { $last_edited = do_template('OCF_TOPIC_POST_LAST_EDITED', array('_GUID' => '77a28e8bc3cf2ec2211aafdb5ba192bf', 'LAST_EDIT_DATE_RAW' => is_null($_postdetails['last_edit_time']) ? '' : strval($_postdetails['last_edit_time']), 'LAST_EDIT_DATE' => $_postdetails['last_edit_time_string'], 'LAST_EDIT_PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($_postdetails['last_edit_by'], false, true), 'LAST_EDIT_USERNAME' => $_postdetails['last_edit_by_username'])); } else { $last_edited = new ocp_tempcode(); } $last_edited_raw = array_key_exists('last_edit_time', $_postdetails) ? is_null($_postdetails['last_edit_time']) ? '' : strval($_postdetails['last_edit_time']) : '0'; $is_spacer_post = $_postdetails['is_spacer_post']; // Post buttons $buttons = new ocp_tempcode(); if (!$is_spacer_post) { $buttons = ocf_render_post_buttons($topic_info, $_postdetails, $may_reply); } // Avatar if (array_key_exists('poster_avatar', $_postdetails) && $_postdetails['poster_avatar'] != '') { $post_avatar = do_template('OCF_TOPIC_POST_AVATAR', array('_GUID' => 'd647ada9c11d56eedc0ff7894d33e83c', 'AVATAR' => $_postdetails['poster_avatar'])); } else { $post_avatar = new ocp_tempcode(); } // Rank images $rank_images = new ocp_tempcode(); if (!$is_spacer_post) { $posters_groups = $GLOBALS['FORUM_DRIVER']->get_members_groups($_postdetails['poster'], true); foreach ($posters_groups as $group) { $rank_image = ocf_get_group_property($group, 'rank_image'); $group_leader = ocf_get_group_property($group, 'group_leader'); $group_name = ocf_get_group_name($group); $rank_image_pri_only = ocf_get_group_property($group, 'rank_image_pri_only'); if ($rank_image != '' && ($rank_image_pri_only == 0 || $group == $GLOBALS['FORUM_DRIVER']->get_member_row_field($_postdetails['poster'], 'm_primary_group'))) { $rank_images->attach(do_template('OCF_RANK_IMAGE', array('_GUID' => '0ff7855482b901be95591964d4212c44', 'GROUP_NAME' => $group_name, 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($_postdetails['poster']), 'IMG' => $rank_image, 'IS_LEADER' => $group_leader == $_postdetails['poster']))); } } } // Poster details if (!$is_spacer_post) { if (!is_guest($_postdetails['poster'])) { require_code('ocf_members2'); $poster_details = ocf_show_member_box($_postdetails, false, $hooks, $hook_objects, false); } else { $custom_fields = new ocp_tempcode(); if (array_key_exists('ip_address', $_postdetails)) { $custom_fields->attach(do_template('OCF_TOPIC_POST_CUSTOM_FIELD', array('_GUID' => 'd85be094dff0d039a64120d6f8f381bb', 'NAME' => do_lang_tempcode('IP_ADDRESS'), 'VALUE' => $_postdetails['ip_address']))); $poster_details = do_template('OCF_GUEST_DETAILS', array('_GUID' => 'e43534acaf598008602e8da8f9725f38', 'CUSTOM_FIELDS' => $custom_fields)); } else { $poster_details = new ocp_tempcode(); } } } else { $poster_details = new ocp_tempcode(); } if (!is_guest($_postdetails['poster'])) { $poster = do_template('OCF_POSTER_MEMBER', array('_GUID' => 'dbbed1850b6c01a6c9601d85c6aee43f', 'ONLINE' => member_is_online($_postdetails['poster']), 'ID' => strval($_postdetails['poster']), 'POSTER_DETAILS' => $poster_details, 'PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($_postdetails['poster'], false, true), 'POSTER_USERNAME' => $_postdetails['poster_username'], 'HIGHLIGHT_NAME' => array_key_exists('poster_highlighted_name', $_postdetails) ? strval($_postdetails['poster_highlighted_name']) : NULL)); } else { $ip_link = array_key_exists('ip_address', $_postdetails) && has_actual_page_access(get_member(), 'admin_lookup') ? build_url(array('page' => 'admin_lookup', 'param' => $_postdetails['ip_address']), get_module_zone('admin_lookup')) : new ocp_tempcode(); $poster = do_template('OCF_POSTER_GUEST', array('_GUID' => '36a8e550222cdac5165ef8f722be3def', 'IP_LINK' => $ip_link, 'POSTER_DETAILS' => $poster_details, 'POSTER_USERNAME' => $_postdetails['poster_username'])); } // Signature $signature = new ocp_tempcode(); if (array_key_exists('signature', $_postdetails) && !$_postdetails['signature']->is_empty()) { $signature = $_postdetails['signature']; } $post_title = $_postdetails['title']; $first_unread = $_postdetails['id'] == $first_unread_id || $first_unread_id < 0 && $array_id == count($topic_info['posts']) - 1 ? do_template('OCF_TOPIC_FIRST_UNREAD') : new ocp_tempcode(); $unvalidated = $_postdetails['validated'] == 0 ? do_lang_tempcode('UNVALIDATED') : new ocp_tempcode(); $post_url = $GLOBALS['FORUM_DRIVER']->post_url($_postdetails['id'], is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']), true); if (array_key_exists('intended_solely_for', $_postdetails) && $_postdetails['intended_solely_for'] == get_member()) { decache('side_ocf_personal_topics', array(get_member())); decache('_new_pp', array(get_member())); } $emphasis = ocf_get_post_emphasis($_postdetails); require_code('feedback'); if (!array_key_exists('intended_solely_for', $_postdetails)) { actualise_rating(true, 'post', strval($_postdetails['id']), get_self_url(), $_postdetails['title']); $rating = display_rating(get_self_url(), $_postdetails['title'], 'post', strval($_postdetails['id']), 'RATING_INLINE_DYNAMIC', $_postdetails['poster']); } else { $rating = new ocp_tempcode(); } $rendered_post = do_template('OCF_TOPIC_POST', array('_GUID' => 'sacd09wekfofpw2f', 'ID' => $is_spacer_post ? '' : strval($_postdetails['id']), 'TOPIC_FIRST_POST_ID' => is_null($topic_info['first_post_id']) ? '' : strval($topic_info['first_post_id']), 'TOPIC_FIRST_POSTER' => is_null($topic_info['first_poster']) ? '' : strval($topic_info['first_poster']), 'POST_ID' => $is_spacer_post ? '' : (get_value('seq_post_ids') === '1' ? strval($start + $array_id + 1) : strval($_postdetails['id'])), 'URL' => $post_url, 'CLASS' => $_postdetails['is_emphasised'] ? 'ocf_post_emphasis' : (array_key_exists('intended_solely_for', $_postdetails) ? 'ocf_post_personal' : ''), 'EMPHASIS' => $emphasis, 'FIRST_UNREAD' => $first_unread, 'POSTER_TITLE' => $is_spacer_post ? '' : $_postdetails['poster_title'], 'POST_TITLE' => $post_title, 'POST_DATE_RAW' => strval($_postdetails['time']), 'POST_DATE' => $_postdetails['time_string'], 'POST' => $_postdetails['post'], 'TOPIC_ID' => is_null($id) ? '' : strval($id), 'LAST_EDITED_RAW' => $last_edited_raw, 'LAST_EDITED' => $last_edited, 'POSTER_ID' => strval($_postdetails['poster']), 'POSTER' => $is_spacer_post ? '' : $poster, 'POSTER_DETAILS' => $poster_details, 'POST_AVATAR' => $post_avatar, 'RANK_IMAGES' => $rank_images, 'BUTTONS' => $buttons, 'SIGNATURE' => $signature, 'UNVALIDATED' => $unvalidated, 'DESCRIPTION' => $description, 'RATING' => $rating)); $posts->attach($rendered_post); } $serialized_options = mixed(); $hash = mixed(); } else { require_code('topics'); $threaded_topic_ob = new OCP_Topic(); // Load some settings into the renderer $threaded_topic_ob->first_post_id = $topic_info['first_post_id']; $threaded_topic_ob->topic_description = $topic_info['description']; $threaded_topic_ob->topic_description_link = $topic_info['description_link']; $threaded_topic_ob->topic_title = $topic_info['title']; $threaded_topic_ob->topic_info = $topic_info; // Other settings we need $max_thread_depth = intval(get_option('max_thread_depth')); $num_to_show_limit = get_param_integer('max_comments', intval(get_option('comments_to_show_in_thread'))); // Load posts $threaded_topic_ob->load_from_topic($id, $num_to_show_limit, $start, false, NULL, true); $threaded_topic_ob->is_threaded = true; // Render posts list($posts, $serialized_options, $hash) = $threaded_topic_ob->render_posts($num_to_show_limit, $max_thread_depth, $may_reply, $topic_info['first_poster'], array(), $topic_info['forum_id'], NULL, false); $GLOBALS['META_DATA']['description'] = $threaded_topic_ob->topic_description; // Get other gathered details $replied = $threaded_topic_ob->replied; if (!is_null($threaded_topic_ob->topic_title)) { // Updated topic title $topic_info['title'] = $threaded_topic_ob->topic_title; } $topic_info['max_rows'] = $threaded_topic_ob->total_posts; $second_poster = $GLOBALS['FORUM_DRIVER']->get_guest_id(); // No definitive post orders } // Buttons for topic as whole $button_array = array(); if (!is_null($id)) { if (get_value('no_threaded_buttons') !== '1') { if ($threaded) { $view_as_linear_url = get_self_url(false, false, array('threaded' => 0)); $button_array[] = array('immediate' => true, 'title' => do_lang_tempcode('VIEW_AS_LINEAR'), 'url' => $view_as_linear_url, 'img' => 'linear'); } else { $view_as_threaded_url = get_self_url(false, false, array('threaded' => 1)); $button_array[] = array('immediate' => true, 'title' => do_lang_tempcode('VIEW_AS_THREADED'), 'url' => $view_as_threaded_url, 'img' => 'threaded'); } } if (!is_guest()) { $too_old = $topic_info['last_time'] < time() - 60 * 60 * 24 * intval(get_option('post_history_days')); if (get_value('disable_mark_topic_unread') !== '1' && !$too_old) { $map = array('page' => 'topics', 'type' => 'mark_unread_topic', 'id' => $id); $test = get_param_integer('kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id'])), -1); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $mark_unread_url = build_url($map, get_module_zone('topics')); $button_array[] = array('immediate' => true, 'title' => do_lang_tempcode('MARK_UNREAD'), 'url' => $mark_unread_url, 'img' => 'mark_unread'); } } if ($may_reply && is_null(get_bot_type())) { $reply_prevented = false; // "Staff-only" reply for support tickets if ($GLOBALS['FORUM_DRIVER']->is_staff(get_member()) && addon_installed('tickets')) { require_code('tickets'); if (is_ticket_forum($topic_info['forum_id'])) { if (is_guest($second_poster)) { $reply_prevented = true; } require_lang('tickets'); $map = array('page' => 'topics', 'type' => 'new_post', 'id' => $id, 'intended_solely_for' => $GLOBALS['FORUM_DRIVER']->get_guest_id()); $test = get_param_integer('kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id'])), -1); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $new_post_url = build_url($map, get_module_zone('topics')); $button_array[] = array('immediate' => false, 'rel' => 'add', 'title' => do_lang_tempcode('TICKET_STAFF_ONLY_REPLY'), 'url' => $new_post_url, 'img' => 'staff_only_reply'); } } if (!$reply_prevented) { if ($topic_info['is_threaded'] == 0) { $map = array('page' => 'topics', 'type' => 'new_post', 'id' => $id); $test = get_param_integer('kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id'])), -1); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $new_post_url = build_url($map, get_module_zone('topics')); $button_array[] = array('immediate' => false, 'rel' => 'add', 'title' => do_lang_tempcode($topic_info['is_open'] ? 'REPLY' : 'CLOSED'), 'url' => $new_post_url, 'img' => $topic_info['is_open'] ? 'reply' : 'closed'); } } else { unset($topic_info['may_use_quick_reply']); } } elseif ((is_null($topic_info['forum_id']) || has_specific_permission(get_member(), 'submit_lowrange_content', 'topics', array('forums', $topic_info['forum_id']))) && $topic_info['last_poster'] == get_member() && !is_guest() && ocf_may_edit_post_by(get_member(), $topic_info['forum_id'])) { $map = array('page' => 'topics', 'type' => 'edit_post', 'id' => $topic_info['last_post_id']); $test = get_param_integer('kfs' . strval($topic_info['forum_id']), -1); if ($test != -1 && $test != 0) { $map['kfs' . strval($topic_info['forum_id'])] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $new_post_url = build_url($map, get_module_zone('topics')); $button_array[] = array('immediate' => false, 'rel' => 'edit', 'title' => do_lang_tempcode('LAST_POST'), 'url' => $new_post_url, 'img' => 'amend'); } if (!is_null($topic_info['forum_id'])) { if (get_value('disable_add_topic_btn_in_topic') !== '1') { if (ocf_may_post_topic($topic_info['forum_id'], get_member())) { $new_topic_url = build_url(array('page' => 'topics', 'type' => 'new_topic', 'id' => $topic_info['forum_id']), get_module_zone('topics')); $button_array[] = array('immediate' => false, 'rel' => 'add', 'title' => do_lang_tempcode('ADD_TOPIC'), 'url' => $new_topic_url, 'img' => 'new_topic'); } } } else { $invite_url = build_url(array('page' => 'topics', 'type' => 'invite_member', 'id' => $id), get_module_zone('topics')); $button_array[] = array('immediate' => false, 'title' => do_lang_tempcode('INVITE_MEMBER_TO_PT'), 'url' => $invite_url, 'img' => 'invite_member'); } } $buttons = ocf_screen_button_wrap($button_array); // Poll if (array_key_exists('poll', $topic_info)) { $_poll = $topic_info['poll']; $voted_already = $_poll['voted_already']; $poll_results = array_key_exists(0, $_poll['answers']) && array_key_exists('num_votes', $_poll['answers'][0]); $answers = new ocp_tempcode(); $real_button = false; if ($_poll['is_open']) { if ($poll_results) { $button = new ocp_tempcode(); } elseif ($_poll['requires_reply'] && !$replied) { $button = do_lang_tempcode('POLL_REQUIRES_REPLY'); } else { if (!has_specific_permission(get_member(), 'vote_in_polls') || is_guest()) { $button = do_lang_tempcode('VOTE_DENIED'); } else { if (!is_null($voted_already)) { $button = do_lang_tempcode('NOVOTE'); } else { require_lang('polls'); $map = array('page' => 'topicview', 'id' => $id, 'view_poll_results' => 1, 'start' => $start == 0 ? NULL : $start, 'max' => $max == $default_max ? NULL : $max); $test = get_param_integer('kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id'])), -1); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $results_url = build_url($map, get_module_zone('topics')); $button = do_template('OCF_TOPIC_POLL_BUTTON', array('_GUID' => '94b932fd01028df8f67bb5864d9235f9', 'RESULTS_URL' => $results_url)); $real_button = true; } } } } else { $button = do_lang_tempcode('TOPIC_POLL_CLOSED'); } foreach ($_poll['answers'] as $answer) { if ($poll_results && ($_poll['requires_reply'] == 0 || $replied)) { $num_votes = $answer['num_votes']; $total_votes = $_poll['total_votes']; if ($total_votes != 0) { $width = intval(round(70.0 * floatval($num_votes) / floatval($total_votes))); } else { $width = 0; } $answer_tpl = do_template('OCF_TOPIC_POLL_ANSWER_RESULTS', array('_GUID' => 'b32f4c526e147abf20ca0d668e40d515', 'ID' => strval($_poll['id']), 'NUM_VOTES' => integer_format($num_votes), 'WIDTH' => strval($width), 'ANSWER' => $answer['answer'], 'I' => strval($answer['id']))); } else { $answer_tpl = do_template('OCF_TOPIC_POLL_ANSWER' . ($_poll['maximum_selections'] == 1 ? '_RADIO' : ''), array('REAL_BUTTON' => $real_button, 'ID' => strval($_poll['id']), 'ANSWER' => $answer['answer'], 'I' => strval($answer['id']))); } $answers->attach($answer_tpl); } $map = array('page' => 'topics', 'type' => 'vote_poll', 'id' => $id, 'start' => $start == 0 ? NULL : $start, 'max' => $max == $default_max ? NULL : $max); $test = get_param_integer('kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id'])), -1); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $vote_url = build_url($map, get_module_zone('topics')); if ($_poll['is_private']) { $private = paragraph(do_lang_tempcode('TOPIC_POLL_IS_PRIVATE'), 'dfgsdgdsgs'); } else { $private = new ocp_tempcode(); } if ($_poll['maximum_selections'] > 1) { $num_choices = paragraph($_poll['minimum_selections'] == $_poll['maximum_selections'] ? do_lang_tempcode('POLL_NOT_ENOUGH_ERROR_2', integer_format($_poll['minimum_selections'])) : do_lang_tempcode('POLL_NOT_ENOUGH_ERROR', integer_format($_poll['minimum_selections']), integer_format($_poll['maximum_selections'])), 'dsfsdfsdfs'); } else { $num_choices = new ocp_tempcode(); } $poll = do_template('OCF_TOPIC_POLL' . ($poll_results ? '_VIEW_RESULTS' : ''), array('ID' => strval($_poll['id']), 'NUM_CHOICES' => $num_choices, 'PRIVATE' => $private, 'QUESTION' => $_poll['question'], 'ANSWERS' => $answers, 'REAL_BUTTON' => $real_button, 'BUTTON' => $button, 'VOTE_URL' => $vote_url, 'MINIMUM_SELECTIONS' => integer_format($_poll['minimum_selections']), 'MAXIMUM_SELECTIONS' => integer_format($_poll['maximum_selections']))); } else { $poll = new ocp_tempcode(); } // Forum nav tree if (!is_null($topic_info['forum_id'])) { $tree = ocf_forum_breadcrumbs($topic_info['forum_id'], NULL, NULL, false); } else { $tree = new ocp_tempcode(); $tree->attach(hyperlink(build_url(array('page' => 'members'), get_module_zone('members')), do_lang_tempcode('MEMBERS'), false, false, do_lang_tempcode('GO_BACKWARDS_TO', do_lang_tempcode('MEMBERS')), NULL, NULL, 'up')); $tree->attach(do_template('BREADCRUMB_ESCAPED')); if (has_specific_permission(get_member(), 'view_other_pt')) { $of_member = $topic_info['pt_from'] == get_member() ? $topic_info['pt_from'] : $topic_info['pt_to']; } else { $of_member = get_member(); } $of_username = $GLOBALS['FORUM_DRIVER']->get_username($of_member); if (is_null($of_username)) { $of_username = do_lang('UNKNOWN'); } $personal_topic_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $of_member), get_module_zone('members'), NULL, true, false, false, 'tab__pts'); $tree->attach(hyperlink($personal_topic_url, do_lang_tempcode('MEMBER_PROFILE', escape_html($of_username)), false, false, do_lang_tempcode('GO_BACKWARDS_TO', do_lang_tempcode('MEMBERS')), NULL, NULL, 'up')); } // Quick reply if (array_key_exists('may_use_quick_reply', $topic_info) && $may_reply && !is_null($id)) { $map = array('page' => 'topics', 'type' => '_add_reply', 'topic_id' => $id); $test = get_param_integer('kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id'])), -1); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $_post_url = build_url($map, get_module_zone('topics')); $post_url = $_post_url->evaluate(); $map = array('page' => 'topics', 'type' => 'new_post', 'id' => $id); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $more_url = build_url($map, get_module_zone('topics')); $_postdetails = array_key_exists('first_post', $topic_info) ? get_translated_tempcode($topic_info['first_post'], $GLOBALS['FORUM_DB']) : new ocp_tempcode(); $first_post = $_postdetails; $first_post_url = $GLOBALS['FORUM_DRIVER']->post_url($topic_info['first_post_id'], is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']), true); $display = 'block'; $expand_type = 'contract'; if ($topic_info['max_rows'] > $start + $max) { $display = 'none'; $expand_type = 'expand'; } $em = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser(); require_javascript('javascript_editing'); require_javascript('javascript_validation'); if (addon_installed('captcha')) { require_code('captcha'); $use_captcha = use_captcha(); if ($use_captcha) { generate_captcha(); } } else { $use_captcha = false; } $post_warning = ''; if ($topic_info['is_really_threaded'] == 1) { $post_warning = do_lang('THREADED_REPLY_NOTICE', $post_warning); } $quick_reply = do_template('COMMENTS_POSTING_FORM', array('_GUID' => '4c532620f3eb68d9cc820b18265792d7', 'JOIN_BITS' => '', 'USE_CAPTCHA' => $use_captcha, 'GET_EMAIL' => false, 'EMAIL_OPTIONAL' => true, 'GET_TITLE' => false, 'POST_WARNING' => $post_warning, 'COMMENT_TEXT' => '', 'EM' => $em, 'EXPAND_TYPE' => $expand_type, 'DISPLAY' => $display, 'FIRST_POST_URL' => $first_post_url, 'FIRST_POST' => $first_post, 'MORE_URL' => $more_url, 'COMMENT_URL' => $post_url, 'TITLE' => do_lang_tempcode('QUICK_REPLY'), 'SUBMIT_NAME' => do_lang_tempcode('MAKE_POST'))); } else { $quick_reply = new ocp_tempcode(); } $action_url = build_url(array('page' => 'topics', 'id' => $id), get_module_zone('topics')); if (!is_null($id)) { // Moderation options $moderator_actions = ''; if (is_null($topic_info['forum_id'])) { $moderator_actions .= '<option value="categorise_pts">' . do_lang('_CATEGORISE_PTS') . '</option>'; } if (array_key_exists('may_multi_moderate', $topic_info) && array_key_exists('forum_id', $topic_info)) { $multi_moderations = ocf_list_multi_moderations($topic_info['forum_id']); if (count($multi_moderations) != 0) { $moderator_actions .= '<optgroup label="' . do_lang('MULTI_MODERATIONS') . '">'; foreach ($multi_moderations as $mm_id => $mm_name) { $moderator_actions .= '<option value="mm_' . strval($mm_id) . '">' . $mm_name . '</option>'; } $moderator_actions .= '</optgroup>'; } } if (array_key_exists('may_move_topic', $topic_info)) { $moderator_actions .= '<option value="move_topic">' . do_lang('MOVE_TOPIC') . '</option>'; } if (array_key_exists('may_edit_topic', $topic_info)) { $moderator_actions .= '<option value="edit_topic">' . do_lang('EDIT_TOPIC') . '</option>'; } if (array_key_exists('may_delete_topic', $topic_info)) { $moderator_actions .= '<option value="delete_topic">' . do_lang('DELETE_TOPIC') . '</option>'; } if (array_key_exists('may_pin_topic', $topic_info)) { $moderator_actions .= '<option value="pin_topic">' . do_lang('PIN_TOPIC') . '</option>'; } if (array_key_exists('may_unpin_topic', $topic_info)) { $moderator_actions .= '<option value="unpin_topic">' . do_lang('UNPIN_TOPIC') . '</option>'; } if (array_key_exists('may_sink_topic', $topic_info)) { $moderator_actions .= '<option value="sink_topic">' . do_lang('SINK_TOPIC') . '</option>'; } if (array_key_exists('may_unsink_topic', $topic_info)) { $moderator_actions .= '<option value="unsink_topic">' . do_lang('UNSINK_TOPIC') . '</option>'; } if (array_key_exists('may_cascade_topic', $topic_info)) { $moderator_actions .= '<option value="cascade_topic">' . do_lang('CASCADE_TOPIC') . '</option>'; } if (array_key_exists('may_uncascade_topic', $topic_info)) { $moderator_actions .= '<option value="uncascade_topic">' . do_lang('UNCASCADE_TOPIC') . '</option>'; } if (array_key_exists('may_open_topic', $topic_info)) { $moderator_actions .= '<option value="open_topic">' . do_lang('OPEN_TOPIC') . '</option>'; } if (array_key_exists('may_close_topic', $topic_info)) { $moderator_actions .= '<option value="close_topic">' . do_lang('CLOSE_TOPIC') . '</option>'; } if (array_key_exists('may_edit_poll', $topic_info)) { $moderator_actions .= '<option value="edit_poll">' . do_lang('EDIT_TOPIC_POLL') . '</option>'; } if (array_key_exists('may_delete_poll', $topic_info)) { $moderator_actions .= '<option value="delete_poll">' . do_lang('DELETE_TOPIC_POLL') . '</option>'; } if (array_key_exists('may_attach_poll', $topic_info)) { $moderator_actions .= '<option value="add_poll">' . do_lang('ADD_TOPIC_POLL') . '</option>'; } if (has_specific_permission(get_member(), 'view_content_history') && $GLOBALS['FORUM_DB']->query_value('f_post_history', 'COUNT(*)', array('h_topic_id' => $id)) != 0) { $moderator_actions .= '<option value="topic_history">' . do_lang('POST_HISTORY') . '</option>'; } if (array_key_exists('may_make_personal', $topic_info) && !is_null($topic_info['forum_id'])) { $moderator_actions .= '<option value="make_personal">' . do_lang('MAKE_PERSONAL') . '</option>'; } if ($GLOBALS['XSS_DETECT']) { ocp_mark_as_escaped($moderator_actions); } // Marked post actions $map = array('page' => 'topics', 'id' => $id); $test = get_param_integer('kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id'])), -1); if ($test != -1 && $test != 0) { $map['kfs' . (is_null($topic_info['forum_id']) ? '' : strval($topic_info['forum_id']))] = $test; } $test = get_param_integer('threaded', -1); if ($test != -1) { $map['threaded'] = $test; } $action_url = build_url($map, get_module_zone('topics'), NULL, false, true); $marked_post_actions = ''; if (array_key_exists('may_move_posts', $topic_info)) { $marked_post_actions .= '<option value="move_posts_a">' . do_lang('MERGE_POSTS') . '</option>'; $marked_post_actions .= '<option value="move_posts_b">' . do_lang('SPLIT_POSTS') . '</option>'; } if (array_key_exists('may_delete_posts', $topic_info)) { $marked_post_actions .= '<option value="delete_posts">' . do_lang('DELETE_POSTS') . '</option>'; } if (array_key_exists('may_validate_posts', $topic_info)) { $marked_post_actions .= '<option value="validate_posts">' . do_lang('VALIDATE_POSTS') . '</option>'; } if (get_value('disable_multi_quote') !== '1') { if ($may_reply) { $marked_post_actions .= '<option value="new_post">' . do_lang('QUOTE_POSTS') . '</option>'; } } if ($GLOBALS['XSS_DETECT']) { ocp_mark_as_escaped($marked_post_actions); } } else { $moderator_actions = ''; $marked_post_actions = ''; } $max_rows = $topic_info['max_rows']; if ($max_rows > $max && !$threaded) { require_code('templates_results_browser'); $results_browser = results_browser(do_lang_tempcode('FORUM_POSTS'), $id, $start, 'start', $max, 'max', $max_rows, NULL, 'misc', true, false, 7, array(10, 20, 30)); } else { $results_browser = new ocp_tempcode(); } // Members viewing this topic $members = is_null($id) ? array() : get_members_viewing('topicview', '', strval($id), true); $num_guests = 0; $num_members = 0; if (is_null($members)) { $members_viewing = new ocp_tempcode(); } else { $members_viewing = new ocp_tempcode(); foreach ($members as $member_id => $at_details) { $username = $at_details['mt_cache_username']; if (is_guest($member_id)) { $num_guests++; } else { $num_members++; $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true); $map = array('PROFILE_URL' => $profile_url, 'USERNAME' => $username); if (has_specific_permission(get_member(), 'show_user_browsing') || in_array($at_details['the_page'], array('topics', 'topicview')) && $at_details['the_id'] == strval($id)) { $map['AT'] = escape_html($at_details['the_title']); } $map['COLOUR'] = get_group_colour(ocf_get_member_primary_group($member_id)); $members_viewing->attach(do_template('OCF_USER_MEMBER', $map)); } } if ($members_viewing->is_empty()) { $members_viewing = do_lang_tempcode('NONE_EM'); } } if (!is_null($id)) { breadcrumb_add_segment($tree, do_lang_tempcode(is_null($topic_info['forum_id']) ? 'VIEW_PERSONAL_TOPIC' : 'VIEW_TOPIC')); } if (is_null($id)) { $root_forum_name = $GLOBALS['FORUM_DB']->query_value('f_forums', 'f_name', array('id' => db_get_first_id())); $tree = hyperlink(build_url(array('page' => 'forumview', 'id' => db_get_first_id()), get_module_zone('forumview')), escape_html($root_forum_name), false, false, do_lang('GO_BACKWARDS_TO')); breadcrumb_add_segment($tree, do_lang('INLINE_PERSONAL_POSTS')); } if ($topic_info['validated'] == 0) { $warning_details = do_template('WARNING_TABLE', array('WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT'))); } else { $warning_details = new ocp_tempcode(); } $topic_tpl = do_template('OCF_TOPIC_WRAP', array('_GUID' => 'bb201d5d59559e5e2bd60e7cf2e6f7e9', 'SERIALIZED_OPTIONS' => $serialized_options, 'HASH' => $hash, 'ID' => strval($id), 'TITLE' => $topic_info['title'], 'MAY_DOUBLE_POST' => has_specific_permission(get_member(), 'double_post'), 'LAST_POSTER' => array_key_exists('last_poster', $topic_info) ? is_null($topic_info['last_poster']) ? '' : strval($topic_info['last_poster']) : '', 'WARNING_DETAILS' => $warning_details, 'MAX' => strval($max), 'MAY_CHANGE_MAX' => array_key_exists('may_change_max', $topic_info), 'ACTION_URL' => $action_url, 'NUM_GUESTS' => integer_format($num_guests), 'NUM_MEMBERS' => integer_format($num_members), 'MEMBERS_VIEWING' => $members_viewing, 'RESULTS_BROWSER' => $results_browser, 'MODERATOR_ACTIONS' => $moderator_actions, 'MARKED_POST_ACTIONS' => $marked_post_actions, 'QUICK_REPLY' => $quick_reply, 'TREE' => $tree, 'POLL' => $poll, 'SCREEN_BUTTONS' => $buttons, 'POSTS' => $posts, 'THREADED' => $threaded)); if (is_null($id)) { $title = get_page_title('INLINE_PERSONAL_POSTS'); } else { if (is_null($topic_info['forum_id'])) { $title = get_page_title(do_lang_tempcode('NAMED_PERSONAL_TOPIC', escape_html($topic_info['title'])), false, NULL, do_lang_tempcode('READING_PERSONAL_TOPIC')); } else { if (addon_installed('awards')) { require_code('awards'); $awards = find_awards_for('topic', strval($id)); } else { $awards = array(); } $title = get_page_title(do_lang_tempcode('NAMED_TOPIC', escape_html($topic_info['title'])), false, NULL, NULL, $awards); } } return ocf_wrapper($title, $topic_tpl, true, false, $topic_info['forum_id']); }
/** * Standard aed_module run_start. * * @param ID_TEXT The type of module execution * @return tempcode The output of the run */ function run_start($type) { $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_subcom'; if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_groups_action'); require_code('ocf_forums_action'); require_code('ocf_groups_action2'); require_code('ocf_forums_action2'); if ($type == 'misc') { return $this->misc(); } if ($type == 'view') { return $this->view(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/ldap'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_ldap'; if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_groups_action'); require_code('ocf_groups_action2'); require_lang('ocf'); global $LDAP_CONNECTION; if (is_null($LDAP_CONNECTION)) { warn_exit(do_lang_tempcode('LDAP_DISABLED')); } // Decide what we're doing $type = get_param('type', 'misc'); if ($type == 'misc') { return $this->gui(); } if ($type == 'actual') { return $this->actual(); } return new ocp_tempcode(); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } require_code('ocf_forumview'); global $NON_CANONICAL_PARAMS; foreach (array_keys($_GET) as $key) { if (substr($key, 0, 3) == 'kfs') { $NON_CANONICAL_PARAMS[] = $key; } } $NON_CANONICAL_PARAMS[] = 'order'; $type = get_param('type', 'misc'); $current_filter_cat = get_param('category', ''); $default_max = intval(get_option('forum_topics_per_page')); $max = get_param_integer('max', $default_max); if ($max > 50 && !has_specific_permission(get_member(), 'remove_page_split')) { $max = $default_max; } $root = get_param_integer('keep_forum_root', db_get_first_id()); if ($type == 'pt') { $id = NULL; $start = get_param_integer('start', get_param_integer('kfs', 0)); $of_member_id = get_param_integer('id', get_member()); } else { $id = get_param_integer('id', db_get_first_id()); $start = get_param_integer('start', get_param_integer('kfs' . strval($id), 0)); $of_member_id = NULL; } $test = ocf_render_forumview($id, $current_filter_cat, $max, $start, $root, $of_member_id); if (is_array($test)) { list($content, $ltitle, $tree, $forum_name) = $test; } else { return $test; } if ($type != 'pt') { global $SEO_TITLE; $SEO_TITLE = $forum_name; breadcrumb_add_segment($tree); } if (addon_installed('awards')) { require_code('awards'); $awards = is_null($id) ? array() : find_awards_for('forum', strval($id)); } else { $awards = array(); } $title = get_page_title($ltitle, false, NULL, NULL, $awards); $ret = ocf_wrapper($title, $content, true, $type != 'pt', $id); return $ret; }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } else { ocf_require_all_forum_stuff(); } $title = get_page_title('USERS_ONLINE'); global $EXTRA_HEAD; $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />'); // XHTMLXHTML $count = 0; $members = get_online_members(has_specific_permission(get_member(), 'show_user_browsing'), NULL, $count); if (is_null($members) && has_specific_permission(get_member(), 'show_user_browsing')) { $members = get_online_members(false, NULL, $count); } if (is_null($members)) { warn_exit(do_lang_tempcode('TOO_MANY_USERS_ONLINE')); } $rows = new ocp_tempcode(); $members = array_reverse($members); global $M_SORT_KEY; $M_SORT_KEY = 'last_activity'; usort($members, 'multi_sort'); $members = array_reverse($members); foreach ($members as $row) { $last_activity = $row['last_activity']; $member = $row['the_user']; $name = $row['cache_username']; $location = $row['the_title']; if ($location == '' && $row['the_type'] == 'rss') { $location = 'RSS'; $at_url = make_string_tempcode(find_script('backend')); } elseif ($location == '' && $row['the_page'] == '') { $at_url = new ocp_tempcode(); } else { $map = array('page' => $row['the_page']); if ($row['the_type'] != '') { $map['type'] = $row['the_type']; } if ($row['the_id'] != '') { $map['id'] = $row['the_id']; } $at_url = build_url($map, $row['the_zone']); } $ip = $row['ip']; if (substr($ip, -1) == '*') { if (is_guest($member)) { if (addon_installed('stats')) { $test = $GLOBALS['SITE_DB']->query_value_null_ok('stats', 'ip', array('the_user' => -$row['the_session'])); if (!is_null($test) && $test != '') { $ip = $test; } else { $test = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT ip FROM ' . get_table_prefix() . 'stats WHERE ip LIKE \'' . db_encode_like(str_replace('*', '%', $ip)) . '\' ORDER BY date_and_time DESC'); if (!is_null($test) && $test != '') { $ip = $test; } } } } else { $test = $GLOBALS['FORUM_DRIVER']->get_member_ip($member); if (!is_null($test) && $test != '') { $ip = $test; } } } $link = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($member, false, $name); if ($ip != '') { // CRON? $rows->attach(do_template('OCF_MEMBER_ONLINE_ROW', array('_GUID' => '2573786f3bccf9e613b125befb3730e8', 'IP' => $ip, 'AT_URL' => $at_url, 'LOCATION' => $location, 'MEMBER' => $link, 'TIME' => integer_format(intval((time() - $last_activity) / 60))))); } } return do_template('OCF_MEMBERS_ONLINE_SCREEN', array('_GUID' => '2f63e2926c5a4690d905f97661afe6cc', 'TITLE' => $title, 'ROWS' => $rows)); }
/** * Gets a gallery selection tree list, extending deeper from the given category_id, showing all sub(sub...)galleries. * * @param ?ID_TEXT The gallery we are getting the tree starting from (NULL: root) * @param string The parent tree at this point of the recursion * @param ?array The database row for the $category_id gallery (NULL: get it from the DB) * @param boolean Whether to include video/image statistics in the returned tree * @param ?string A function name to filter galleries with (NULL: no filter) * @param boolean Whether displayed galleries must support images * @param boolean Whether displayed galleries must support videos * @param boolean Whether to NOT show member galleries that do not exist yet * @param boolean Whether to get a list of child galleries (not just direct ones, recursively), instead of just IDs * @param ?integer The number of recursive levels to search (NULL: all) * @param ?MEMBER Member we are filtering for (NULL: not needed) * @param boolean Whether to only show for what may be added to by the current member * @return array The tree structure, or if $use_compound_list, the tree structure built with pairs containing the compound list in addition to the child branches */ function get_gallery_tree($category_id = 'root', $tree = '', $gallery_info = NULL, $do_stats = true, $filter = NULL, $must_accept_images = false, $must_accept_videos = false, $purity = false, $use_compound_list = false, $levels = NULL, $member_id = NULL, $addable_filter = false) { if ($levels == -1) { return $use_compound_list ? array(array(), '') : array(); } if (is_null($category_id)) { $category_id = 'root'; } if (!has_category_access(get_member(), 'galleries', $category_id)) { return $use_compound_list ? array(array(), '') : array(); } // Put our title onto our tree if (is_null($gallery_info)) { $_gallery_info = $GLOBALS['SITE_DB']->query_select('galleries', array('fullname', 'is_member_synched', 'accept_images', 'accept_videos'), array('name' => $category_id), '', 1); if (!array_key_exists(0, $_gallery_info)) { warn_exit(do_lang_tempcode('_MISSING_RESOURCE', escape_html('gallery:' . $category_id))); } $gallery_info = $_gallery_info[0]; } $title = array_key_exists('text_original', $gallery_info) ? $gallery_info['text_original'] : get_translated_text($gallery_info['fullname']); $is_member_synched = $gallery_info['is_member_synched'] == 1; $accept_images = $gallery_info['accept_images'] == 1; $accept_videos = $gallery_info['accept_videos'] == 1; $tree .= $title; $children = array(); $sub = false; $query = 'FROM ' . get_table_prefix() . 'galleries g LEFT JOIN ' . get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND g.fullname=t.id WHERE ' . db_string_equal_to('parent_id', $category_id); if (current(current($GLOBALS['SITE_DB']->query('SELECT COUNT(*) ' . $query))) >= 300) { $rows = $GLOBALS['SITE_DB']->query('SELECT text_original,name,fullname,accept_images,accept_videos,is_member_synched,g.fullname ' . $query . ' ORDER BY add_date', 300); } else { $rows = $GLOBALS['SITE_DB']->query('SELECT text_original,name,fullname,accept_images,accept_videos,is_member_synched,g.fullname ' . $query . ' ORDER BY text_original ASC'); } if ((is_null($filter) || call_user_func_array($filter, array($category_id, $member_id, count($rows)))) && (!$must_accept_images || $accept_images && !$is_member_synched) && (!$must_accept_videos || $accept_videos && !$is_member_synched)) { // We'll be putting all children in this entire tree into a single list $children[0]['id'] = $category_id; $children[0]['tree'] = $tree; $children[0]['title'] = $title; $children[0]['accept_images'] = $gallery_info['accept_images']; $children[0]['accept_videos'] = $gallery_info['accept_videos']; $children[0]['is_member_synched'] = $gallery_info['is_member_synched']; if ($addable_filter) { $children[0]['addable'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_galleries', array('galleries', $category_id)); } if ($do_stats) { $good_row_count = 0; foreach ($rows as $row) { if ((is_null($filter) || call_user_func_array($filter, array($row['name'], $member_id, 1))) && (!$must_accept_images || $row['accept_images'] && $row['is_member_synched'] == 0) && (!$must_accept_videos || $row['accept_videos'] && $row['is_member_synched'] == 0)) { $good_row_count++; } } $children[0]['child_count'] = $good_row_count; if ($good_row_count == 0 && !$purity && $gallery_info['is_member_synched']) { $children[0]['child_count'] = 1; } // XHTMLXHTML $children[0]['video_count'] = $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)', array('cat' => $category_id)); $children[0]['image_count'] = $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)', array('cat' => $category_id)); } $sub = true; } $can_submit = mixed(); // Children of this category $tree .= ' > '; $found_own_gallery = false; $found_member_galleries = array($GLOBALS['FORUM_DRIVER']->get_guest_id() => 1); $compound_list = $category_id . ','; foreach ($rows as $child) { if ($child['name'] == 'root') { continue; } $can_submit = can_submit_to_gallery($child['name']); if ($can_submit === false) { $can_submit = !$addable_filter; } if ($can_submit !== false && $can_submit !== true) { $found_own_gallery = true; $found_member_galleries[$can_submit] = 1; } if ($can_submit !== false && ($levels !== 0 || $use_compound_list)) { $child_id = $child['name']; // $child_title=$child['text_original']; $child_tree = $tree; $child_children = get_gallery_tree($child_id, $child_tree, $child, $do_stats, $filter, $must_accept_images, $must_accept_videos, $purity, $use_compound_list, is_null($levels) ? NULL : $levels - 1, $member_id, $addable_filter); if ($use_compound_list) { list($child_children, $_compound_list) = $child_children; $compound_list .= $_compound_list; } if ($levels !== 0) { $children = array_merge($children, $child_children); } } } if ($sub && array_key_exists(0, $children)) { $children[0]['compound_list'] = $compound_list; } $done_for_all = false; if ($is_member_synched && !$purity && $levels !== 0) { if (has_specific_permission(get_member(), 'can_submit_to_others_categories') && get_forum_type() == 'ocf') { ocf_require_all_forum_stuff(); $members = $GLOBALS['FORUM_DB']->query_select('f_members', array('id', 'm_username', 'm_primary_group'), NULL, 'ORDER BY m_username', 100); if (count($members) != 100) { $done_for_all = true; $group_membership = $GLOBALS['FORUM_DB']->query_select('f_group_members', array('gm_group_id', 'gm_member_id'), array('gm_validated' => 1)); $group_permissions = $GLOBALS['SITE_DB']->query('SELECT group_id,the_page,the_value FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'gsp WHERE ' . db_string_equal_to('specific_permission', 'have_personal_category') . ' AND (' . db_string_equal_to('the_page', '') . ' OR ' . db_string_equal_to('the_page', 'cms_galleries') . ')'); $is_super_admin = $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member()); foreach ($members as $_member) { $member = $_member['id']; $username = $_member['m_username']; $this_category_id = 'member_' . strval($member) . '_' . $category_id; if ($member == get_member()) { $has_permission = true; } else { $a = in_array(array('group_id' => $member['m_primary_group'], 'the_page' => '', 'the_value' => 1), $group_permissions); $b = in_array(array('group_id' => $member['m_primary_group'], 'the_page' => 'cms_galleries', 'the_value' => 0), $group_permissions); $c = in_array(array('group_id' => $member['m_primary_group'], 'the_page' => 'cms_galleries', 'the_value' => 1), $group_permissions); $has_permission = $is_super_admin; if ($a && !$b || $c) { $has_permission = true; } if (!$has_permission) { foreach ($group_membership as $_g) { if ($_g['gm_member_id'] == $member) { $a = in_array(array('group_id' => $_g['gm_group_id'], 'the_page' => '', 'the_value' => 1), $group_permissions); $b = in_array(array('group_id' => $_g['gm_group_id'], 'the_page' => 'cms_galleries', 'the_value' => 0), $group_permissions); $c = in_array(array('group_id' => $_g['gm_group_id'], 'the_page' => 'cms_galleries', 'the_value' => 1), $group_permissions); if ($a && !$b || $c) { $has_permission = true; } break; } } } } if ($has_permission && !array_key_exists($member, $found_member_galleries) && (is_null($filter) || call_user_func_array($filter, array($this_category_id, $member_id, 0)))) { $own_gallery = array(); $own_gallery['id'] = $this_category_id; $this_title = do_lang('NEW_PERSONAL_GALLERY_OF', $username, $title); $own_gallery['tree'] = $tree . $this_title; $own_gallery['video_count'] = 0; $own_gallery['image_count'] = 0; $own_gallery['child_count'] = 0; $own_gallery['title'] = $this_title; $own_gallery['accept_images'] = $gallery_info['accept_images']; $own_gallery['accept_videos'] = $gallery_info['accept_videos']; $own_gallery['is_member_synched'] = 0; $own_gallery['compound_list'] = $compound_list; $own_gallery['addable'] = true; $children[] = $own_gallery; if ($member == get_member()) { $found_own_gallery = true; } } } } } if ((!$done_for_all || !$found_own_gallery) && !array_key_exists(get_member(), $found_member_galleries) && !is_guest() && !$purity && has_specific_permission(get_member(), 'have_personal_category')) { $this_category_id = 'member_' . strval(get_member()) . '_' . $category_id; if (is_null($filter) || call_user_func_array($filter, array($this_category_id, $member_id, 0))) { $own_gallery = array(); $own_gallery['id'] = $this_category_id; $this_title = do_lang('NEW_PERSONAL_GALLERY_OF', $GLOBALS['FORUM_DRIVER']->get_username(get_member()), $title); $own_gallery['tree'] = $tree . $this_title; $own_gallery['video_count'] = 0; $own_gallery['image_count'] = 0; $own_gallery['child_count'] = 0; $own_gallery['title'] = $this_title; $own_gallery['accept_images'] = $gallery_info['accept_images']; $own_gallery['accept_videos'] = $gallery_info['accept_videos']; $own_gallery['is_member_synched'] = 0; $own_gallery['addable'] = true; $own_gallery['compound_list'] = $compound_list; $children[] = $own_gallery; } } } return $use_compound_list ? array($children, $compound_list) : $children; }