Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

having this problemo .. when itry to make a new topic


Rekomendowane odpowiedzi

Opublikowano

i have this when i try to add a new topic


-------------------- // Load and config the post parser //----------------------------------------- $_load = $this->ipsclass->memory_debug_make_flag(); 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 = 1; $this->parser->bypass_badwords = intval($this->ipsclass->member['g_bypass_badwords']); $this->ipsclass->memory_debug_add( "TOPIC: Loaded han_parse_bbcode.php", $_load ); $poll_answers = unserialize(stripslashes($poll_data['choices'])); reset($poll_answers); //----------------------------------------- // Show poll form //----------------------------------------- $html = $this->ipsclass->compiled_templates['skin_poll']->poll_header($this->topic['tid'], $poll_data['poll_question']); foreach ( $poll_answers as $id => $data ) { //----------------------------------------- // Get the question //----------------------------------------- $question = $data['question']; $choice_html = ""; //----------------------------------------- // Get the choices for this question //----------------------------------------- foreach( $data['choice'] as $choice_id => $text ) { $choice = $text; $votes = intval($data['votes'][ $choice_id ]); //$total_votes += $votes; if ( strlen($choice) < 1 ) { continue; } if ($this->ipsclass->vars['poll_tags']) { $choice = $this->parser->parse_poll_tags($choice); } if( isset($data['multi']) AND $data['multi'] == 1 ) { $choice_html .= $this->ipsclass->compiled_templates['skin_poll']->poll_show_form_choice_multi($choice_id, $votes, $id, $choice); } else { $choice_html .= $this->ipsclass->compiled_templates['skin_poll']->poll_show_form_choice($choice_id, $votes, $id, $choice); } } //----------------------------------------- // Add HTML together //----------------------------------------- $html .= $this->ipsclass->compiled_templates['skin_poll']->poll_show_form_question( $id, $question, $choice_html ); } $html .= $this->ipsclass->compiled_templates['skin_poll']->show_total_votes($total_votes); } $html .= $this->ipsclass->compiled_templates['skin_poll']->poll_footer(); if ( $poll_footer != "" ) { //----------------------------------------- // Already defined.. //----------------------------------------- $html = str_replace( "", $poll_footer, $html ); } else { //----------------------------------------- // Not defined.. //----------------------------------------- if ( $this->ipsclass->vars['allow_result_view'] == 1 ) { if ( $this->ipsclass->input['mode'] == 'show' ) { // We are looking at results.. $html = str_replace( "", $this->ipsclass->compiled_templates['skin_poll']->button_show_voteable(), $html ); } else { $html = str_replace( "", $this->ipsclass->compiled_templates['skin_poll']->button_show_results(), $html ); $html = str_replace( "", $this->ipsclass->compiled_templates['skin_poll']->button_vote(), $html ); } } else { //----------------------------------------- // Do not allow result viewing //----------------------------------------- $html = str_replace( "", $this->ipsclass->compiled_templates['skin_poll']->button_vote(), $html ); $html = str_replace( "", $this->ipsclass->compiled_templates['skin_poll']->button_null_vote(), $html ); } } $this->ipsclass->vars['max_images'] = $tmp_max_images; return $html; } /*-------------------------------------------------------------------------*/ // Build topic permissions /*-------------------------------------------------------------------------*/ function build_permissions() { //----------------------------------------- // Polls //----------------------------------------- $this->can_vote = intval( $this->ipsclass->member['g_vote_polls'] ); //----------------------------------------- // Topic rating: Rating //----------------------------------------- if ( $this->ipsclass->member['id'] ) { $this->can_rate = intval( $this->ipsclass->member['g_topic_rate_setting'] ); } else { $this->can_rate = 0; } } /*-------------------------------------------------------------------------*/ // Add vote to rating /*-------------------------------------------------------------------------*/ function topic_add_vote_to_rating() { //----------------------------------------- // INIT //----------------------------------------- $topic_id = intval($this->ipsclass->input['t']); $rating_id = intval($this->ipsclass->input['rating']); $vote_cast = array(); $this->ipsclass->load_language('lang_topic'); //----------------------------------------- // Permissions check //----------------------------------------- if ( ! $this->forum['forum_allow_rating'] ) { $this->can_rate = 0; } if ( ! $this->can_rate ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'topic_rate_no_perm') ); } //----------------------------------------- // Make sure we have a valid poll id //----------------------------------------- if ( ! $topic_id ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') ); } //----------------------------------------- // No topic? //----------------------------------------- if ( ! $this->topic['tid'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'topic_rate_no_perm') ); } //----------------------------------------- // Locked topic? //----------------------------------------- if ( $this->topic['state'] != 'open' ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'locked_topic') ); } //----------------------------------------- // Sneaky members rating topic more than 5? //----------------------------------------- if( $rating_id > 5 ) { $rating_id = 5; } if( $rating_id < 0 ) { $rating_id = 0; } //----------------------------------------- // Have we rated before? //----------------------------------------- $rating = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$this->topic['tid']} and rating_member_id=".$this->ipsclass->member['id'] ) ); //----------------------------------------- // Already rated? //----------------------------------------- if ( $rating['rating_id'] ) { //----------------------------------------- // Do we allow re-ratings? //----------------------------------------- if ( $this->ipsclass->member['g_topic_rate_setting'] == 2 ) { if ( $rating_id != $rating['rating_value'] ) { $new_rating = $rating_id - $rating['rating_value']; $this->ipsclass->DB->do_update( 'topic_ratings', array( 'rating_value' => $rating_id ), 'rating_id='.$rating['rating_id'] ); $this->ipsclass->DB->do_update( 'topics', array( 'topic_rating_total' => intval($this->topic['topic_rating_total']) + $new_rating ), 'tid='.$this->topic['tid'] ); } $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['topic_rating_changed'] , "showtopic={$this->topic['tid']}&st={$this->ipsclass->input['st']}" ); } else { $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['topic_rated_already'] , "showtopic={$this->topic['tid']}&st={$this->ipsclass->input['st']}" ); exit(); } } //----------------------------------------- // NEW RATING! //----------------------------------------- else { $this->ipsclass->DB->do_insert( 'topic_ratings', array( 'rating_tid' => $this->topic['tid'], 'rating_member_id' => $this->ipsclass->member['id'], 'rating_value' => $rating_id, 'rating_ip_address' => $this->ipsclass->ip_address ) ); $this->ipsclass->DB->do_update( 'topics', array( 'topic_rating_hits' => intval($this->topic['topic_rating_hits']) + 1, 'topic_rating_total' => intval($this->topic['topic_rating_total']) + $rating_id ), 'tid='.$this->topic['tid'] ); } $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['topic_rating_done'] , "showtopic={$this->topic['tid']}&st={$this->ipsclass->input['st']}" ); } /*-------------------------------------------------------------------------*/ // Add vote to poll /*-------------------------------------------------------------------------*/ function topic_add_vote_to_poll() { //----------------------------------------- // INIT //----------------------------------------- $topic_id = intval($this->ipsclass->input['t']); $vote_cast = array(); $this->ipsclass->load_language('lang_topic'); //----------------------------------------- // Permissions check //----------------------------------------- if ( ! $this->can_vote ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_reply_polls') ); } //----------------------------------------- // Make sure we have a valid poll id //----------------------------------------- if ( ! $topic_id ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') ); } //----------------------------------------- // Load the topic and poll //----------------------------------------- $this->ipsclass->DB->cache_add_query( 'poll_get_poll_with_topic', array( 'tid' => $topic_id ) ); $this->ipsclass->DB->cache_exec_query(); $this->topic = $this->ipsclass->DB->fetch_row(); //----------------------------------------- // No topic? //----------------------------------------- if ( ! $this->topic['tid'] ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'poll_none_found') ); } //----------------------------------------- // Locked topic? //----------------------------------------- if ( $this->topic['state'] != 'open' ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'locked_topic') ); } //----------------------------------------- // Have reply permissions?? //----------------------------------------- if ( $this->ipsclass->check_perms( $this->ipsclass->cache['forum_cache'][ $this->topic['forum_id'] ]['reply_perms'] ) == FALSE ) { $this->ipsclass->Error( array( 'LEVEL' => '1', 'MSG' => 'no_replies') ); } //----------------------------------------- // Have we voted before? //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => 'member_id', 'from' => 'voters', 'where' => "tid={$this->topic['tid']} and member_id=".$this->ipsclass->member['id'] ) ); $this->ipsclass->DB->simple_exec(); if ( $this->ipsclass->DB->get_num_rows() ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'poll_you_voted') ); } //----------------------------------------- // Sort out the new array //----------------------------------------- $this->ipsclass->input['nullvote'] = isset($this->ipsclass->input['nullvote']) ? $this->ipsclass->input['nullvote'] : 0; if ( !$this->ipsclass->input['nullvote'] ) { //----------------------------------------- // First, which choices and ID did we choose? // Single option poll... //----------------------------------------- if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) ) { foreach( $_POST['choice'] as $question_id => $choice_id ) { if ( ! $question_id or ! isset($choice_id) ) { continue; } $vote_cast[ $question_id ][] = $choice_id; } } //----------------------------------------- // Multi vote poll //----------------------------------------- foreach( $this->ipsclass->input as $k => $v ) { if( preg_match( "#^choice_(\d+)_(\d+)$#", $k, $matches ) ) { if( $this->ipsclass->input[$k] == 1 ) { $vote_cast[ $matches[1] ][] = $matches[2]; } } } //----------------------------------------- // Unparse the choices //----------------------------------------- $poll_answers = unserialize( stripslashes( $this->topic['choices'] ) ); reset($poll_answers); //----------------------------------------- // Got enough votes? //----------------------------------------- if ( count( $vote_cast ) < count( $poll_answers ) ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_vote') ); } //----------------------------------------- // Add voter //----------------------------------------- $this->ipsclass->DB->do_insert( 'voters', array( 'member_id' => $this->ipsclass->member['id'], 'ip_address' => $this->ipsclass->ip_address, 'tid' => $this->topic['tid'], 'forum_id' => $this->topic['forum_id'], 'vote_date' => time(), ) ); //----------------------------------------- // Loop //----------------------------------------- foreach ( $vote_cast as $question_id => $choice_array ) { foreach( $choice_array as $choice_id ) { $poll_answers[ $question_id ]['votes'][ $choice_id ]++; if ( $poll_answers[ $question_id ]['votes'][ $choice_id ] < 1 ) { $poll_answers[ $question_id ]['votes'][ $choice_id ] = 1; } } } //----------------------------------------- // Save... //----------------------------------------- $this->topic['choices'] = addslashes( serialize( $poll_answers ) ); $this->ipsclass->DB->simple_exec_query( array( 'update' => 'polls', 'set' => "votes=votes+1,choices='{$this->topic['choices']}'", 'where' => "pid={$this->topic['poll_id']}" ) ); //----------------------------------------- // Go bump in the night? //----------------------------------------- if ($this->topic['allow_pollbump']) { $this->topic['last_vote'] = time(); $this->topic['last_post'] = time(); $this->ipsclass->DB->do_update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid='.$this->topic['tid'] ); } else { $this->topic['last_vote'] = time(); $this->ipsclass->DB->do_update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid='.$this->topic['tid'] ); } } else { //----------------------------------------- // Add null vote //----------------------------------------- $this->ipsclass->DB->do_insert( 'voters', array( 'member_id' => $this->ipsclass->member['id'], 'ip_address' => $this->ipsclass->ip_address, 'tid' => $this->topic['tid'], 'forum_id' => $this->topic['forum_id'], 'vote_date' => time(), ) ); } $lang = $this->ipsclass->input['nullvote'] ? $this->ipsclass->lang['poll_viewing_results'] : $this->ipsclass->lang['poll_vote_added']; $this->ipsclass->print->redirect_screen( $lang , "showtopic={$this->topic['tid']}&st={$this->ipsclass->input['st']}" ); } /*-------------------------------------------------------------------------*/ // Return last post /*-------------------------------------------------------------------------*/ function return_last_post() { $st = 0; $mode = $this->ipsclass->my_getcookie( 'topicmode' ); $pre = $mode != 'threaded' ? 'st' : 'start'; if( $mode == 'threaded' ) { $this->ipsclass->vars['display_max_posts'] = $this->ipsclass->vars['threaded_per_page']; $this->ipsclass->input['st'] = $this->ipsclass->input['start']; } if ($this->topic['posts']) { if ( (($this->topic['posts'] + 1) % $this->ipsclass->vars['display_max_posts']) == 0 ) { $pages = ($this->topic['posts'] + 1) / $this->ipsclass->vars['display_max_posts']; } else { $number = ( ($this->topic['posts'] + 1) / $this->ipsclass->vars['display_max_posts'] ); $pages = ceil( $number); } $st = ($pages - 1) * $this->ipsclass->vars['display_max_posts']; if( $this->ipsclass->vars['post_order_sort'] == 'desc' ) { $st = (ceil(($this->topic['posts']/$this->ipsclass->vars['display_max_posts'])) - $pages) * $this->ipsclass->vars['display_max_posts']; } } $query_extra = $this->ipsclass->member['is_mod'] ? '' : ' AND queued=0'; $this->ipsclass->DB->simple_construct( array( 'select' => 'pid', 'from' => 'posts', 'where' => "topic_id=".$this->topic['tid'] . $query_extra, 'order' => $this->ipsclass->vars['post_order_column'].' DESC', 'limit' => array( 0,1 ) ) ); $this->ipsclass->DB->simple_exec(); $post = $this->ipsclass->DB->fetch_row(); $this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']."&pid={$post['pid']}&{$pre}={$st}&"."#entry".$post['pid']); } /*-------------------------------------------------------------------------*/ // INIT, innit? IS IT? /*-------------------------------------------------------------------------*/ function topic_init( $load_modules=0 ) { //----------------------------------------- // Memory... //----------------------------------------- $_before = $this->ipsclass->memory_debug_make_flag(); //----------------------------------------- // Compile the language file //----------------------------------------- $this->ipsclass->load_language('lang_topic'); $this->ipsclass->load_language('lang_editors'); $this->ipsclass->load_template('skin_topic'); //----------------------------------------- // Custom Profile fields //----------------------------------------- /*if ( $this->ipsclass->vars['custom_profile_topic'] == 1 or $load_modules ) { require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' ); $this->custom_fields = new custom_fields( $this->ipsclass->DB ); $this->custom_fields->member_id = $this->ipsclass->member['id']; $this->custom_fields->cache_data = $this->ipsclass->cache['profilefields']; $this->custom_fields->admin = intval($this->ipsclass->member['g_access_cp']); $this->custom_fields->supmod = intval($this->ipsclass->member['g_is_supmod']); }*/ //----------------------------------------- // Get all the member groups and // member title info //----------------------------------------- if ( ! is_array( $this->ipsclass->cache['ranks'] ) ) { $this->ipsclass->cache['ranks'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'id, title, pips, posts', 'from' => 'titles', 'order' => "posts DESC", ) ); $this->ipsclass->DB->simple_exec(); while ($i = $this->ipsclass->DB->fetch_row()) { $this->ipsclass->cache['ranks'][ $i['id'] ] = array( 'TITLE' => $i['title'], 'PIPS' => $i['pips'], 'POSTS' => $i['posts'], ); } $this->ipsclass->update_cache( array( 'name' => 'ranks', 'array' => 1, 'deletefirst' => 1 ) ); } //----------------------------------------- // Memory debug //----------------------------------------- $this->ipsclass->memory_debug_add( 'TOPIC: Classes loaded (topics.php::topic_init)', $_before ); } /*-------------------------------------------------------------------------*/ // MAIN init /*-------------------------------------------------------------------------*/ function init($topic="") { $this->md5_check = $this->ipsclass->return_md5_check(); if ( ! is_array($topic) ) { //----------------------------------------- // Check the input //----------------------------------------- $this->ipsclass->input['t'] = intval($this->ipsclass->input['t']); if ( $this->ipsclass->input['t'] < 0 ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') ); } //----------------------------------------- // Get the forum info based on the forum ID, // get the category name, ID, and get the topic details //----------------------------------------- if ( !isset( $this->ipsclass->topic_cache['tid']) OR !$this->ipsclass->topic_cache['tid'] ) { $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".$this->ipsclass->input['t'], ) ); $this->ipsclass->DB->simple_exec(); $this->topic = $this->ipsclass->DB->fetch_row(); } else { $this->topic = $this->ipsclass->topic_cache; } } else { $this->topic = $topic; } $this->topic['forum_id'] = isset($this->topic['forum_id']) ? $this->topic['forum_id'] : 0; $this->forum = $this->ipsclass->forums->forum_by_id[ $this->topic['forum_id'] ]; $this->ipsclass->input['f'] = $this->forum['id']; //----------------------------------------- // Error out if we can not find the forum //----------------------------------------- if ( ! $this->forum['id'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'is_broken_link') ); } //----------------------------------------- // Error out if we can not find the topic //----------------------------------------- if ( ! $this->topic['tid'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'is_broken_link') ); } //----------------------------------------- // Error out if the topic is not approved //----------------------------------------- if ( ! $this->ipsclass->can_queue_posts($this->forum['id']) ) { if ($this->topic['approved'] != 1) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') ); } } $this->ipsclass->forums->forums_check_access( $this->forum['id'], 1, 'topic' ); //----------------------------------------- // Unserialize the read array and parse into // array //----------------------------------------- if ( $read = $this->ipsclass->my_getcookie('topicsread') ) { if( $read != "-1" ) { $this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) ); } else { $this->read_array = array(); } } $this->last_read_tid = isset($this->read_array[$this->topic['tid']]) ? $this->read_array[$this->topic['tid']] : 0; //----------------------------------------- // Are we actually a moderator for this forum? //----------------------------------------- if ( ! $this->ipsclass->member['g_is_supmod'] AND ! $this->ipsclass->member['g_access_cp'] ) { if ( !isset($this->ipsclass->member['_moderator'][ $this->forum['id'] ]) OR !is_array( $this->ipsclass->member['_moderator'][ $this->forum['id'] ] ) ) { $this->ipsclass->member['is_mod'] = 0; } } } /*-------------------------------------------------------------------------*/ // Topic set up ya'll /*-------------------------------------------------------------------------*/ function topic_set_up() { //----------------------------------------- // INIT //----------------------------------------- $this->ipsclass->input['show'] = isset($this->ipsclass->input['show']) ? intval( $this->ipsclass->input['show'] ) : 0; $this->ipsclass->input['st'] = intval( $this->ipsclass->input['st'] ); $this->topic_init(); //----------------------------------------- // Memory... //----------------------------------------- $_before = $this->ipsclass->memory_debug_make_flag(); $this->base_url = $this->ipsclass->base_url; $this->forum['JUMP'] = $this->ipsclass->build_forum_jump(); $this->first = intval($this->ipsclass->input['st']) > 0 ? intval($this->ipsclass->input['st']) : 0; $this->ipsclass->input['view'] = isset($this->ipsclass->input['view']) ? $this->ipsclass->input['view'] : NULL; //----------------------------------------- // Check viewing permissions, private forums, // password forums, etc //----------------------------------------- if ( ( ! $this->ipsclass->member['g_other_topics'] ) AND ( $this->topic['starter_id'] != $this->ipsclass->member['id'] ) ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_view_topic') ); } //----------------------------------------- // Update the topic views counter //----------------------------------------- if ( ! $this->ipsclass->input['view'] AND $this->topic['state'] != 'link' ) { if ( $this->ipsclass->vars['update_topic_views_immediately'] ) { $this->ipsclass->DB->simple_construct( array( 'update' => 'topics', 'set' => 'views=views+1', 'where' => "tid=".$this->topic['tid'], #'lowpro' => 1, ) ); $this->ipsclass->DB->simple_shutdown_exec(); } else { $this->ipsclass->DB->do_shutdown_insert( 'topic_views', array( 'views_tid' => $this->topic['tid'] ) ); } } //----------------------------------------- // Need to update this topic? //----------------------------------------- if ( $this->topic['state'] == 'open' ) { if( !$this->topic['topic_open_time'] OR $this->topic['topic_open_time'] < $this->topic['topic_close_time'] ) { if ( $this->topic['topic_close_time'] AND ( $this->topic['topic_close_time'] <= time() AND ( time() >= $this->topic['topic_open_time'] OR !$this->topic['topic_open_time'] ) ) ) { $this->topic['state'] = 'closed'; $this->ipsclass->DB->do_shutdown_update( 'topics', array( 'state' => 'closed' ), 'tid='.$this->topic['tid'] ); } } else if( $this->topic['topic_open_time'] OR $this->topic['topic_open_time'] > $this->topic['topic_close_time'] ) { if ( $this->topic['topic_close_time'] AND ( $this->topic['topic_close_time'] <= time() AND time() <= $this->topic['topic_open_time'] ) ) { $this->topic['state'] = 'closed'; $this->ipsclass->DB->do_shutdown_update( 'topics', array( 'state' => 'closed' ), 'tid='.$this->topic['tid'] ); } } } else if ( $this->topic['state'] == 'closed' ) { if( !$this->topic['topic_close_time'] OR $this->topic['topic_close_time'] < $this->topic['topic_open_time'] ) { if ( $this->topic['topic_open_time'] AND ( $this->topic['topic_open_time'] <= time() AND ( time() >= $this->topic['topic_close_time'] OR !$this->topic['topic_close_time'] ) ) ) { $this->topic['state'] = 'open'; $this->ipsclass->DB->do_shutdown_update( 'topics', array( 'state' => 'open' ), 'tid='.$this->topic['tid'] ); } } else if( $this->topic['topic_close_time'] OR $this->topic['topic_close_time'] > $this->topic['topic_open_time'] ) { if ( $this->topic['topic_open_time'] AND ( $this->topic['topic_open_time'] <= time() AND time() <= $this->topic['topic_close_time'] ) ) { $this->topic['state'] = 'open'; $this->ipsclass->DB->do_shutdown_update( 'topics', array( 'state' => 'open' ), 'tid='.$this->topic['tid'] ); } } } //----------------------------------------- // Current topic rating value //----------------------------------------- $this->topic['_rate_show'] = 0; $this->topic['_rate_int'] = 0; $this->topic['_rate_img'] = ''; if ( $this->topic['state'] != 'open' ) { $this->topic['_allow_rate'] = 0; } else { $this->topic['_allow_rate'] = $this->can_rate; } if ( $this->forum['forum_allow_rating'] ) { $rating = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$this->topic['tid']} and rating_member_id=".$this->ipsclass->member['id'] ) ); if ( $rating['rating_value'] AND $this->ipsclass->member['g_topic_rate_setting'] != 2 ) { $this->topic['_allow_rate'] = 0; } $this->topic['_rate_img'] = $this->ipsclass->compiled_templates['skin_topic']->topic_rating_image( 0 ); $this->topic['_rating_value'] = $rating['rating_value'] ? $rating['rating_value'] : $this->ipsclass->lang['you_have_not_rated']; if ( $this->topic['topic_rating_total'] ) { $this->topic['_rate_int'] = round( $this->topic['topic_rating_total'] / $this->topic['topic_rating_hits'] ); } //----------------------------------------- // Show image? //----------------------------------------- if ( ( $this->topic['topic_rating_hits'] >= $this->ipsclass->vars['topic_rating_needed'] ) AND ( $this->topic['_rate_int'] ) ) { $this->topic['_rate_img'] = $this->ipsclass->compiled_templates['skin_topic']->topic_rating_image($this->topic['_rate_int'] ); $this->topic['_rate_show'] = 1; } } else { $this->topic['_allow_rate'] = 0; } //----------------------------------------- // Update the topic read cookie / counters //----------------------------------------- if ( !$this->ipsclass->input['view'] ) { $this->read_array[ $this->topic['tid'] ] = time(); $this->ipsclass->my_setcookie('topicsread', serialize($this->read_array), -1 ); } if ( $this->ipsclass->vars['db_topic_read_cutoff'] AND $this->ipsclass->member['id'] ) { $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topic_markers', 'where' => "marker_forum_id=".$this->forum['id']." AND marker_member_id=".$this->ipsclass->member['id'], ) ); $this->ipsclass->DB->simple_exec(); $this->db_row = $this->ipsclass->DB->fetch_row(); $this->my_topics_read = unserialize($this->db_row['marker_topics_read'] ); $time_check = ((isset($this->my_topics_read[ $this->topic['tid'] ]) AND $this->my_topics_read[ $this->topic['tid'] ]) > $this->db_row['marker_last_cleared']) ? $this->my_topics_read[ $this->topic['tid'] ] : $this->db_row['marker_last_cleared']; $save_array = array(); $read_topics_tid = array( 0 => $this->topic['tid'] ); $time_check = $time_check > $this->ipsclass->member['members_markers']['board'] ? $time_check : $this->ipsclass->member['members_markers']['board']; //----------------------------------------- // Work out topics we've read and that haven't // been updated //----------------------------------------- if ( is_array( $this->my_topics_read ) ) { foreach( $this->my_topics_read as $tid => $date ) { if ( $date > $this->db_row['marker_last_cleared'] ) { $read_topics_tid[] = $tid; } } } //----------------------------------------- // New post since last read / not read? // Yes: Update. No: Ignore //----------------------------------------- if ( ( $this->ipsclass->input['view'] != 'getnewpost' ) AND ( ( $time_check <= $this->topic['last_post'] ) OR ( $this->forum['forum_last_deletion'] > $this->db_row['marker_last_update'] ) ) ) { $save_array['marker_unread'] = $this->db_row['marker_unread'] - 1; $save_array['marker_last_cleared'] = $this->db_row['marker_last_cleared']; $db_time = $this->db_row['marker_last_cleared'] > $this->ipsclass->member['members_markers']['board'] ? $this->db_row['marker_last_cleared'] : $this->ipsclass->member['members_markers']['board']; $this->my_topics_read[ $this->topic['tid'] ] = time(); $read_topics_tid[] = $this->topic['tid']; //----------------------------------------- // All read? Recount and check //----------------------------------------- if ( $save_array['marker_unread'] <= 0 ) { $approved = $this->ipsclass->member['is_mod'] ? ' AND approved IN (0,1) ' : ' AND approved=1 '; $count = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'COUNT(*) as cnt, MIN(last_post) as min_last_post', 'from' => 'topics', 'where' => "forum_id={$this->forum['id']} {$approved} AND tid NOT IN(0,".implode(",",$read_topics_tid).") AND last_post > ".intval($db_time) ) ); $save_array['marker_unread'] = intval($count['cnt']); if ( $save_array['marker_unread'] > 0 AND ( is_array( $this->my_topics_read ) and count( $this->my_topics_read ) ) ) { $this->ipsclass->vars['db_topic_read_cutoff'] = $count['min_last_post'] - 1; $this->my_topics_read = array_filter( $this->my_topics_read, array( 'ipsclass', "array_filter_clean_read_topics" ) ); $save_array['marker_topics_read'] = serialize( $this->my_topics_read ); } //----------------------------------------- // Else, mark as read //----------------------------------------- else { $save_array['marker_topics_read'] = serialize( array() ); $save_array['marker_last_cleared'] = time(); $save_array['marker_unread'] = 0; } } else { $save_array['marker_topics_read'] = serialize($this->my_topics_read); } //----------------------------------------- // Update this topic... //----------------------------------------- $save_array['marker_last_update'] = time(); $save_array['marker_member_id'] = $this->ipsclass->member['id']; $save_array['marker_forum_id'] = $this->forum['id']; $save_array['marker_last_cleared'] = intval($save_array['marker_last_cleared']); $this->ipsclass->DB->do_replace_into( 'topic_markers', $save_array, array('marker_member_id','marker_forum_id'), TRUE ); } } //----------------------------------------- // Clean up //----------------------------------------- unset( $save_array, $read_topics_tid ); //----------------------------------------- // If this forum is a link, then // redirect them to the new location //----------------------------------------- if ( $this->topic['state'] == 'link' ) { $f_stuff = explode("&", $this->topic['moved_to']); $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['topic_moved'], "showtopic={$f_stuff[0]}" ); } //----------------------------------------- // If this is a sub forum, we need to get // the cat details, and parent details //----------------------------------------- $this->nav = $this->ipsclass->forums->forums_breadcrumb_nav( $this->forum['id'] ); //----------------------------------------- // Are we a moderator? //----------------------------------------- if ( ($this->ipsclass->member['id']) and ($this->ipsclass->member['g_is_supmod'] != 1) ) { $other_mgroups = array(); if( $this->ipsclass->member['mgroup_others'] ) { $other_mgroups = explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) ); } $other_mgroups[] = $this->ipsclass->member['mgroup']; $mgroups = implode( ",", $other_mgroups ); $this->ipsclass->DB->cache_add_query('topics_check_for_mod', array( 'fid' => $this->forum['id'], 'mid' => $this->ipsclass->member['id'], 'gid' => $mgroups ) ); $this->ipsclass->DB->simple_exec(); $this->moderator = $this->ipsclass->DB->fetch_row(); } $this->mod_action = array( 'CLOSE_TOPIC' => '00', 'OPEN_TOPIC' => '01', 'MOVE_TOPIC' => '02', 'DELETE_TOPIC' => '03', 'EDIT_TOPIC' => '05', 'PIN_TOPIC' => '15', 'UNPIN_TOPIC' => '16', 'UNSUBBIT' => '30', 'MERGE_TOPIC' => '60', 'TOPIC_HISTORY' => '90', ); //----------------------------------------- // Hi! Light? //----------------------------------------- $hl = (isset($this->ipsclass->input['hl']) AND $this->ipsclass->input['hl']) ? '&hl='.$this->ipsclass->input['hl'] : ''; //----------------------------------------- // If we can see queued topics, add count //----------------------------------------- if ( $this->ipsclass->can_queue_posts($this->forum['id']) ) { if( $this->ipsclass->input['modfilter'] == 'invisible_posts' ) { $this->topic['posts'] = intval( $this->topic['topic_queuedposts'] ); } else { $this->topic['posts'] += intval( $this->topic['topic_queuedposts'] ); } } //----------------------------------------- // Generate the forum page span links //----------------------------------------- $this->topic['SHOW_PAGES'] = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => ($this->topic['posts']+1), 'PER_PAGE' => $this->ipsclass->vars['display_max_posts'], 'CUR_ST_VAL' => $this->first, 'L_SINGLE' => "", 'BASE_URL' => $this->base_url."showtopic=".$this->topic['tid'].$hl, ) ); if ( ($this->topic['posts'] + 1) > $this->ipsclass->vars['display_max_posts']) { $this->topic['go_new'] = $this->ipsclass->compiled_templates['skin_topic']->golastpost_link($this->forum['id'], $this->topic['tid'] ); } //----------------------------------------- // Fix up some of the words //----------------------------------------- $this->topic['TOPIC_START_DATE'] = $this->ipsclass->get_date( $this->topic['start_date'], 'LONG' ); $this->ipsclass->lang['topic_stats'] = str_replace( "<#START#>", $this->topic['TOPIC_START_DATE'], $this->ipsclass->lang['topic_stats']); $this->ipsclass->lang['topic_stats'] = str_replace( "<#POSTS#>", $this->topic['posts'] , $this->ipsclass->lang['topic_stats']); if ($this->topic['description']) { $this->topic['description'] = ', '.$this->topic['description']; } //----------------------------------------- // Multi Quoting? //----------------------------------------- $this->qpids = $this->ipsclass->my_getcookie('mqtids'); //----------------------------------------- // Multi PIDS? //----------------------------------------- $this->ipsclass->input['selectedpids'] = $this->ipsclass->my_getcookie('modpids'); $this->ipsclass->input['selectedpidcount'] = 0; $this->ipsclass->my_setcookie('modpids', '', 0); $this->ipsclass->memory_debug_add( "TOPIC: topics.php::topic_set_up", $_before ); } } ?>_links .= $this->append_link($key); } } else if ( isset($this->moderator[ strtolower($key) ]) AND $this->moderator[ strtolower($key) ] ) { $mod_links .= $this->append_link($key); } // What if member is a mod, but doesn't have these perms as a mod? elseif ($key == 'OPEN_TOPIC' or $key == 'CLOSE_TOPIC') { if ($this->ipsclass->member['g_open_close_posts']) { $mod_links .= $this->append_link($key); } } elseif ($key == 'DELETE_TOPIC') { if ($this->ipsclass->member['g_delete_own_topics']) { $mod_links .= $this->append_link($key); } } } elseif ($key == 'OPEN_TOPIC' or $key == 'CLOSE_TOPIC') { if ($this->ipsclass->member['g_open_close_posts']) { $mod_links .= $this->append_link($key); } } elseif ($key == 'DELETE_TOPIC') { if ($this->ipsclass->member['g_delete_own_topics']) { $mod_links .= $this->append_link($key); } } } if ($this->ipsclass->member['g_access_cp'] == 1) { $mod_links .= $this->append_link('TOPIC_HISTORY'); } if ($mod_links != "") { return $this->ipsclass->compiled_templates['skin_topic']->Mod_Panel($mod_links, $this->forum['id'], $this->topic['tid'], $this->md5_check); } else { return ""; } } /*-------------------------------------------------------------------------*/ // Append mod links /*-------------------------------------------------------------------------*/ function append_link( $key="" ) { if ($key == "") return ""; if ($this->topic['state'] == 'open' and $key == 'OPEN_TOPIC') return ""; if ($this->topic['state'] == 'closed' and $key == 'CLOSE_TOPIC') return ""; if ($this->topic['state'] == 'moved' and ($key == 'CLOSE_TOPIC' or $key == 'MOVE_TOPIC')) return ""; if ($this->topic['pinned'] == 1 and $key == 'PIN_TOPIC') return ""; if ($this->topic['pinned'] == 0 and $key == 'UNPIN_TOPIC') return ""; ++$this->colspan; return $this->ipsclass->compiled_templates['skin_topic']->mod_wrapper($this->mod_action[$key], $this->ipsclass->lang[ $key ]); } /*-------------------------------------------------------------------------*/ // Process and parse the poll /*-------------------------------------------------------------------------*/ function parse_poll() { $html = ""; $check = 0; $poll_footer = ""; $this->ipsclass->load_template('skin_poll'); //----------------------------------------- // Get the poll information... //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'polls', 'where' => "tid=".$this->topic['tid'] ) ); $this->ipsclass->DB->simple_exec(); $poll_data = $this->ipsclass->DB->fetch_row(); //----------------------------------------- // check we have a poll //----------------------------------------- if ( ! $poll_data['pid'] ) { return; } //----------------------------------------- // Do we have a poll question? //----------------------------------------- if ( ! $poll_data['poll_question'] ) { $poll_data['poll_question'] = $this->topic['title']; } //----------------------------------------- // Poll only? //----------------------------------------- if( $poll_data['poll_only'] == 1 ) { $this->poll_only = 1; } //----------------------------------------- // Show the poll //----------------------------------------- $member_voted = 0; $total_votes = 0; //----------------------------------------- // Have we voted in this poll? //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => 'member_id', 'from' => 'voters', 'where' => "tid=".$this->topic['tid'] ) ); $this->ipsclass->DB->simple_exec(); while( $voter = $this->ipsclass->DB->fetch_row() ) { $total_votes++; if( $voter['member_id'] == $this->ipsclass->member['id'] ) { $member_voted = 1; } } //----------------------------------------- // Can we vote again? //----------------------------------------- if ( $member_voted ) { $check = 1; $poll_footer = $this->ipsclass->lang['poll_you_voted']; } if ( ($poll_data['starter_id'] == $this->ipsclass->member['id']) and ($this->ipsclass->vars['allow_creator_vote'] != 1) ) { $check = 1; $poll_footer = $this->ipsclass->lang['poll_you_created']; } if ( ! $this->ipsclass->member['id'] ) { if ( !$this->ipsclass->vars['allow_result_view'] ) { $check = 2; } else { $check = 1; } $poll_footer = $this->ipsclass->lang['poll_no_guests']; } //----------------------------------------- // is the topic locked? //----------------------------------------- if ( $this->topic['state'] == 'closed' ) { $check = 1; $poll_footer = ' '; } //----------------------------------------- // Can we see the poll before voting? //----------------------------------------- if ( $this->ipsclass->vars['allow_result_view'] == 1 ) { if ( $this->ipsclass->input['mode'] == 'show' ) { $check = 1; $poll_footer = ""; } } //----------------------------------------- // Stop the parser killing images // 'cos there are too many //----------------------------------------- $tmp_max_images = $this->ipsclass->vars['max_images']; $this->ipsclass->vars['max_images'] = 0; if ( $check == 1 ) { if( !is_object( $this->parser ) ) { //----------------------------------------- // Load and config the post parser //----------------------------------------- $_load = $this->ipsclass->memory_debug_make_flag(); 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 = 1; $this->parser->bypass_badwords = intval($this->ipsclass->member['g_bypass_badwords']); $this->ipsclass->memory_debug_add( "TOPIC: Loaded han_parse_bbcode.php", $_load ); } //----------------------------------------- // Show the results //----------------------------------------- $html = $this->ipsclass->compiled_templates['skin_poll']->poll_header( $this->topic['tid'], $poll_data['poll_question'] ); $poll_answers = unserialize(stripslashes($poll_data['choices'])); reset($poll_answers); foreach ( $poll_answers as $id => $data ) { //----------------------------------------- // Get the question //----------------------------------------- $question = $data['question']; $choice_html = ""; $tv_poll = 0; # Get total votes for this question foreach( $poll_answers[ $id ]['votes'] as $number) { $tv_poll += intval( $number ); } //----------------------------------------- // Get the choices for this question //----------------------------------------- foreach( $data['choice'] as $choice_id => $text ) { $choice = $text; # Get total votes for this question -> choice $votes = intval($data['votes'][ $choice_id ]); if ( strlen($choice) < 1 ) { continue; } if ( $this->ipsclass->vars['poll_tags'] ) { $choice = $this->parser->parse_poll_tags($choice); } $percent = $votes == 0 ? 0 : $votes / $tv_poll * 100; $percent = sprintf( '%.2f' , $percent ); $width = $percent > 0 ? intval($percent * 2) : 0; $choice_html .= $this->ipsclass->compiled_templates['skin_poll']->poll_show_rendered_choice($choice_id, $votes, $id, $choice, $percent, $width); } //----------------------------------------- // Add HTML together //----------------------------------------- $html .= $this->ipsclass->compiled_templates['skin_poll']->poll_show_rendered_question( $id, $question, $choice_html ); } $html .= $this->ipsclass->compiled_templates['skin_poll']->show_total_votes($total_votes); } else if ( $check == 2 ) { // Guest viewing poll results, but show results before voting is not allowed $html = $this->ipsclass->compiled_templates['skin_poll']->poll_header($this->topic['tid'], $poll_data['poll_question']); $html .= $this->ipsclass->compiled_templates['skin_poll']->poll_show_no_guest_view( ); $html .= $this->ipsclass->compiled_templates['skin_poll']->show_total_votes($total_votes); } else { //---------------------

Fatal error: Class 'topics' not found in C:\..\forums\index.php on line 555

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.