<?php
/*======================================================================================
Module: Articles
======================================================================================*/

// Check authorisation
if (!isset($gCms)) exit;
if ( !$this->CheckPermission('Articles: modify articles') ) exit;
$errors = array();

// Get GET data
$category = preg_replace('/[^0-9a-zA-Z_-]/','',$params['category']);
$articleview = $params['articleview'];

// Set category session
//$_SESSION['Articles_catfilter'] = $category;
for($i=0; $i < count($articleview); $i++) {
    $res = $db->Execute('UPDATE '.cms_db_prefix().'module_articles_articles SET sort_order = '.($i+1).' WHERE entry_id = ?', array($articleview[$i]));
    if(!$res) $errors[] = 'SQL ERROR: ' . $db->ErrorMsg() . '(with ' . $db->sql . ')';
}

// Redirect
//$this->Redirect($id, 'defaultadmin', $returnid, array( 'tabto'=>$tabto ));

// EOF  
exit;
