<?php
  /**
   * Copyright 2011 Zazavi - http://www.zazavi.com
   * Zazavi is free software released under the terms of the GNU General Public License.
   * You should have received a copy of the license.  If not, see <http://www.gnu.org/licenses/>.
   */
  define("_VALID_PHP", true);
  
  require_once("../../init.php");
  if (!$user->is_Admin())
      redirect_to("../../login.php");

$filename = $_SERVER['DOCUMENT_ROOT'] . "/admin/modules/newsslider/lang/" . $core->language . ".lang.php";
 
 if (file_exists($filename)) {
 require_once("lang/" . $core->language . ".lang.php");
 } else {
 require_once("lang/en.lang.php");
 }
 
  require_once("admin_class.php");
  
  $slider = new newsSlider();
?>
<?php
  /* Process News*/
  if (isset($_POST['processNews'])):
  $slider->sliderid = (isset($_POST['sliderid'])) ? $_POST['sliderid'] : 0; 
  $slider->processNews();
  endif;
?>
<?php
  /* Update News Order */
  if (isset($_GET['sortnews'])) :
      $slider->updateOrder();
 endif;
?>
<?php
  /* Delete News Item*/
  if (isset($_POST['deleteNews'])):
  
  $id = sanitize($_POST['deleteNews']);
  $db->delete("mod_newsslider", "id='" . (int)$id . "'");
  
  $title = sanitize($_POST['newstitle']);
  print ($db->affected()) ? $zazavisec->writeLog(MOD_NS_ITEM .' <strong>'.$title.'</strong> '._DELETED, "", "no", "module") . $core->msgOk(MOD_NS_ITEM .' <strong>'.$title.'</strong> '._DELETED) : $core->msgAlert(_SYSTEM_PROCCESS); 
  endif;
?>