--- mambo/branches/4.6/administrator/components/com_categories/admin.categories.php 2006/02/12 23:43:25 262 +++ mambo/branches/4.6/administrator/components/com_categories/admin.categories.php 2007/02/06 06:05:27 964 @@ -1,12 +1,11 @@ section == 'com_newsfeeds') { - $types[] = mosHTML::makeOption( 'newsfeed_category_table', T_('Newsfeed Category Table') ); + $types[] = mosHTML::makeOption( 'newsfeed_category_table', T_('News Feed Category Table') ); } else if ($row->section == 'com_weblinks') { - $types[] = mosHTML::makeOption( 'weblink_category_table', T_('Weblink Category Table') ); + $types[] = mosHTML::makeOption( 'weblink_category_table', T_('Web Link Category Table') ); } else { $types[] = mosHTML::makeOption( 'content_category', T_('Content Category Table') ); $types[] = mosHTML::makeOption( 'content_blog_category', T_('Content Category Blog') ); @@ -556,6 +555,8 @@ $row = new mosCategory( $database ); $row->bind( $_POST ); + // sanitize + $row->id = intval($row->id); $row->checkin(); mosRedirect( 'index2.php?option=com_categories§ion='. $redirect ); } @@ -799,12 +800,12 @@ case 'newsfeed_category_table': $link = 'index.php?option=com_newsfeeds&catid='. $id; - $menutype = T_('Newsfeed Category Table'); + $menutype = T_('News Feed Category Table'); break; case 'weblink_category_table': $link = 'index.php?option=com_weblinks&catid='. $id; - $menutype = T_('Weblink Category Table'); + $menutype = T_('Web Link Category Table'); break; default:; @@ -836,39 +837,26 @@ function saveOrder( &$cid, $section ) { global $database; - - $total = count( $cid ); $order = mosGetParam( $_POST, 'order', array(0) ); $row = new mosCategory( $database ); - $conditions = array(); - + $sections = array(); // update ordering values - for( $i=0; $i < $total; $i++ ) { - $row->load( $cid[$i] ); + foreach ($cid as $i=>$ciditem) { + $row->load( $ciditem ); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "\n"; exit(); - } // if + } // remember to updateOrder this group - $condition = "section='$row->section'"; - $found = false; - foreach ( $conditions as $cond ) - if ($cond[1]==$condition) { - $found = true; - break; - } // if - if (!$found) $conditions[] = array($row->id, $condition); - } // if - } // for - + $sections[$row->section] = $row->id; + } + } // execute updateOrder for each group - foreach ( $conditions as $cond ) { - $row->load( $cond[0] ); - $row->updateOrder( $cond[1] ); + foreach ($sections as $section=>$rowid) { + $row->updateOrder("section='$section'"); } // foreach - $msg = T_('New ordering saved'); mosRedirect( 'index2.php?option=com_categories§ion='. $section, $msg ); } // saveOrder