Thread: [Phpslash-commit] CVS: phpslash-dev/include/modules/block/blocktypes Block_render_topic.class,1.1.1.
Brought to you by:
joestewart,
nhruby
From: Peter C. <kr...@us...> - 2004-07-07 17:33:30
|
Update of /cvsroot/phpslash/phpslash-dev/include/modules/block/blocktypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16812 Modified Files: Block_render_topic.class Log Message: Tidy up logic - incl move parse_str to top of parse() Index: Block_render_topic.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-dev/include/modules/block/blocktypes/Block_render_topic.class,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Block_render_topic.class 12 Mar 2003 16:12:55 -0000 1.1.1.1 --- Block_render_topic.class 7 Jul 2004 17:33:21 -0000 1.2 *************** *** 34,55 **** function topics( $block_info) { $db = pslNew("slashDB"); $mode = ''; ! $default_template = "topicsblock.tpl"; $site_homesection = 'Home'; ! if( !empty($this->psl['site_homesection'])) { $site_homesection = $this->psl['site_homesection']; } - $options = $block_info["source_url"]; - - parse_str( $options); $template = pslNew("slashTemplate"); $template->debug = 0; ! if( $tpl == '') { $template->set_file( 'template', $default_template); } elseif ( $template->set_file('template' , basename($tpl) . ".tpl" )) { --- 34,56 ---- function topics( $block_info) { + // At top to avoid accidentally overwriting variables + $options = $block_info["source_url"]; + parse_str( $options); + $db = pslNew("slashDB"); $mode = ''; ! $default_template = "topicsblock.tpl"; $site_homesection = 'Home'; ! if( !empty($this->psl['site_homesection'])) { $site_homesection = $this->psl['site_homesection']; } $template = pslNew("slashTemplate"); $template->debug = 0; ! if (empty($tpl)) { $template->set_file( 'template', $default_template); } elseif ( $template->set_file('template' , basename($tpl) . ".tpl" )) { *************** *** 79,91 **** AND psl_section_lut.section_id = '$section_id' "; } elseif ( isset($section)) { ! $q = "SELECT DISTINCT psl_topic.topic_id, psl_topic.topic_name, psl_section_lut.section_id FROM psl_topic "; ! $q .= ",psl_topic_lut, ! psl_section_lut, psl_section ! WHERE psl_topic.topic_id = psl_topic_lut.topic_id AND psl_topic_lut.story_id = psl_section_lut.story_id AND psl_section_lut.section_id = psl_section.section_id --- 80,92 ---- AND psl_section_lut.section_id = '$section_id' "; } elseif ( isset($section)) { ! $q = "SELECT DISTINCT psl_topic.topic_id, psl_topic.topic_name, psl_section_lut.section_id FROM psl_topic "; ! $q .= ",psl_topic_lut, ! psl_section_lut, psl_section ! WHERE psl_topic.topic_id = psl_topic_lut.topic_id AND psl_topic_lut.story_id = psl_section_lut.story_id AND psl_section_lut.section_id = psl_section.section_id *************** *** 95,99 **** $q .= ", psl_topic_lut WHERE psl_topic.topic_id = psl_topic_lut.topic_id \n"; ! } } --- 96,100 ---- $q .= ", psl_topic_lut WHERE psl_topic.topic_id = psl_topic_lut.topic_id \n"; ! } } *************** *** 101,105 **** $db->query($q); ! while ($db->next_record()) { $template->set_var (array ( --- 102,106 ---- $db->query($q); ! while ($db->next_record()) { $template->set_var (array ( *************** *** 107,118 **** 'TOPIC_NAME' => $db->Record['topic_name'] )); ! if ( (!empty($section_id)) AND ( $section != $site_homesection) AND ($ary['section_id'] != $this->psl['home_section_id']) ) { ! $template->set_var (array ( 'TOPIC_ID' => $db->Record['topic_id'] . "&section_id=" . $section_id )); ! } elseif ( ($section != "") AND ( $section != $site_homesection)) { ! $template->set_var (array ( 'TOPIC_ID' => $db->Record['topic_id'] . "&section_id=" . $db->Record['section_id'] --- 108,119 ---- 'TOPIC_NAME' => $db->Record['topic_name'] )); ! if ( (!empty($section_id)) AND ( $section != $site_homesection) AND ($ary['section_id'] != $this->psl['home_section_id']) ) { ! $template->set_var (array ( 'TOPIC_ID' => $db->Record['topic_id'] . "&section_id=" . $section_id )); ! } elseif ( !empty($section) AND ( $section != $site_homesection)) { ! $template->set_var (array ( 'TOPIC_ID' => $db->Record['topic_id'] . "&section_id=" . $db->Record['section_id'] *************** *** 121,125 **** $template->parse ("topic_block", "each_topic", true); } ! $template->set_var(array( 'ROOTDIR' => $this->psl['rooturl'], --- 122,126 ---- $template->parse ("topic_block", "each_topic", true); } ! $template->set_var(array( 'ROOTDIR' => $this->psl['rooturl'], *************** *** 127,137 **** 'MAINPAGE' => $this->psl['mainpage'] )); ! $output = $template->parse('OUT','template'); unset($db); return $output; ! } } ! ! ?> --- 128,137 ---- 'MAINPAGE' => $this->psl['mainpage'] )); ! $output = $template->parse('OUT','template'); unset($db); return $output; ! } } ! ?> \ No newline at end of file |