api_topics_and_posts.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 810 行 · 第 1/2 页
PHP
810 行
// Rebuild //----------------------------------------- if ( ! $this->delay_rebuild ) { $this->tap_rebuild_forum( $this->topic['forum_id'] ); $this->tap_rebuild_stats(); } $this->ipsclass->member = $temp_store; return TRUE; } /*-------------------------------------------------------------------------*/ // Set topic: title /*-------------------------------------------------------------------------*/ /** * Set topic title * * @param string Incoming * @return void */ function set_topic_title( $data ) { $this->topic_title = $data; } /*-------------------------------------------------------------------------*/ // Set topic: desc /*-------------------------------------------------------------------------*/ /** * Set topic description * * @param string Incoming * @return void */ function set_topic_description( $data ) { $this->topic_desc = $data; } /*-------------------------------------------------------------------------*/ // Set topic: state /*-------------------------------------------------------------------------*/ /** * Set topic state * * @param string Incoming * @return void */ function set_topic_state( $data ) { $this->topic_state = $data; } /*-------------------------------------------------------------------------*/ // Set topic: pinned /*-------------------------------------------------------------------------*/ /** * Set topic pinned * * @param string Incoming * @return void */ function set_topic_pinned( $data ) { $this->topic_pinned = intval($data); } /*-------------------------------------------------------------------------*/ // Set topic: invisible /*-------------------------------------------------------------------------*/ /** * Set topic pinned * * @param string Incoming * @return void */ function set_topic_invisible( $data ) { $this->topic_invisible = intval($data); } /*-------------------------------------------------------------------------*/ // Set post content /*-------------------------------------------------------------------------*/ /** * Set the post content * * @param string post content * @return boolean populates $this->post_content */ function set_post_content( $post ) { //------------------------------- // Got anything? //------------------------------- if ( ! $post ) { $this->api_error[] = 'no_post_content'; $this->post_content = ''; return FALSE; } //------------------------------- // Attempt to format //------------------------------- $this->api_tap_load_classes(); $this->parser->parse_smilies = $this->post_settings['show_emoticons']; $this->parser->parse_html = $this->post_settings['parse_html']; $this->parser->parse_bbcode = 1; $this->post_content = $this->parser->pre_db_parse( $this->editor->_rte_html_to_bbcode( $post ) ); return TRUE; } /*-------------------------------------------------------------------------*/ // Set author by user_name /*-------------------------------------------------------------------------*/ /** * Get a member from the DB by username * * @param string user name * @return boolean populates $this->author */ function set_author_by_name( $user_name ) { $this->author = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'members', 'where' => "LOWER(name) = '".$this->ipsclass->DB->add_slashes(strtolower($user_name))."'", 'limit' => array( 0, 1 ) ) ); if ( ! $this->author['id'] ) { $this->api_error[] = 'no_user_found'; $this->author = array(); return FALSE; } return TRUE; } /*-------------------------------------------------------------------------*/ // Set author by id /*-------------------------------------------------------------------------*/ /** * Get a member from the DB by ID * * @param integer User ID * @return boolean populates $this->author */ function set_author_by_id( $id ) { $this->author = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'members', 'where' => "id=".intval($id), 'limit' => array( 0, 1 ) ) ); if ( ! $this->author['id'] ) { $this->api_error[] = 'no_user_found'; $this->author = array(); return FALSE; } return TRUE; } /*-------------------------------------------------------------------------*/ // Set author by display_name /*-------------------------------------------------------------------------*/ /** * Get a member from the DB by display name * * @param string member display name * @return boolean populates $this->author */ function set_author_by_display_name( $display_name ) { $this->author = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'members', 'where' => "LOWER(members_display_name) = '".$this->ipsclass->DB->add_slashes(strtolower($display_name))."'", 'limit' => array( 0, 1 ) ) ); if ( ! $this->author['id'] ) { $this->api_error[] = 'no_user_found'; $this->author = array(); } return TRUE; } /*-------------------------------------------------------------------------*/ // Set topic by id /*-------------------------------------------------------------------------*/ /** * Get a topic from the DB by ID and set the current topic id * * @param integer Topic * @return boolean populates $this->author */ function set_topic_id( $id ) { $this->topic_id = intval($id); //----------------------------------------- // Verify it exists //----------------------------------------- $this->topic = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".intval( $this->topic_id ), 'limit' => array( 0, 1 ) ) ); if ( ! $this->topic['tid'] ) { $this->api_error[] = 'no_topic_found'; $this->topic = array(); return FALSE; } //----------------------------------------- // Set and get forum ID //----------------------------------------- $this->set_forum_id( $this->topic['forum_id'] ); return TRUE; } /*-------------------------------------------------------------------------*/ // Set author by id /*-------------------------------------------------------------------------*/ /** * Get DB info and set forum ID * * @param integer Topic * @return boolean populates $this->author */ function set_forum_id( $id ) { $this->forum_id = intval($id); //----------------------------------------- // Verify it exists //----------------------------------------- $this->forum = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'forums', 'where' => "id=".intval( $this->forum_id ), 'limit' => array( 0, 1 ) ) ); if ( ! $this->forum['id'] ) { $this->api_error[] = 'no_forum_found'; $this->forum = array(); return FALSE; } $perms = unserialize( $this->forum['permission_array'] ); $this->forum['read_perms'] = $perms['read_perms']; $this->forum['reply_perms'] = $perms['reply_perms']; $this->forum['start_perms'] = $perms['start_perms']; $this->forum['upload_perms'] = $perms['upload_perms']; $this->forum['show_perms'] = $perms['show_perms']; return TRUE; } /*-------------------------------------------------------------------------*/ // Rebuild forum stats /*-------------------------------------------------------------------------*/ /** * Rebuilds the forum stats * * @return void */ function tap_rebuild_forum( $forum_id ) { //----------------------------------------- // Load classes... //----------------------------------------- $this->api_tap_load_classes(); //----------------------------------------- // Send to rebuild //----------------------------------------- $this->func_mod->forum_recount( $forum_id ); } /*-------------------------------------------------------------------------*/ // Rebuild stats /*-------------------------------------------------------------------------*/ /** * Rebuilds the global stats * * @return void */ function tap_rebuild_stats() { //----------------------------------------- // Load classes... //----------------------------------------- $this->api_tap_load_classes(); //----------------------------------------- // Send to rebuild //----------------------------------------- $this->func_mod->stats_recount(); } /*-------------------------------------------------------------------------*/ // Add language strings to IPB language system /*-------------------------------------------------------------------------*/ /** * Loads required classes... * * @return void; */ function api_tap_load_classes() { if ( ! $this->classes_loaded ) { //----------------------------------------- // Force RTE editor //----------------------------------------- if ( ! is_object( $this->editor ) ) { require_once( ROOT_PATH."sources/classes/editor/class_editor.php" ); require_once( ROOT_PATH."sources/classes/editor/class_editor_rte.php" ); $this->editor = new class_editor_module(); $this->editor->ipsclass =& $this->ipsclass; } //----------------------------------------- // Load the email libby //----------------------------------------- if( ! is_object( $this->email ) ) { require_once( ROOT_PATH."sources/classes/class_email.php" ); $this->email = new emailer(); $this->email->ipsclass =& $this->ipsclass; $this->email->email_init(); } //----------------------------------------- // Load and config POST class //----------------------------------------- if ( ! is_object( $this->post ) ) { require_once( ROOT_PATH."sources/classes/post/class_post.php" ); $this->post = new class_post(); $this->post->ipsclass =& $this->ipsclass; $this->post->email =& $this->email; //^^ Required for forum tracker } //----------------------------------------- // Load and config the post parser //----------------------------------------- if ( ! is_object( $this->parser ) ) { require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" ); $this->parser = new parse_bbcode(); $this->parser->ipsclass =& $this->ipsclass; $this->parser->allow_update_caches = 0; $this->parser->bypass_badwords = intval($this->ipsclass->member['g_bypass_badwords']); } //-------------------------------------------- // Not loaded the func? //-------------------------------------------- if ( ! is_object( $this->func_mod ) ) { require_once( ROOT_PATH.'sources/lib/func_mod.php' ); $this->func_mod = new func_mod(); $this->func_mod->ipsclass =& $this->ipsclass; } $this->classes_loaded = 1; } } }?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?