<?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/jtabs/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");
  
  $tab = new jTabs();
?>
<?php
  /* Proccess Tabs */
  if (isset($_POST['processTabs'])): 
  $tab->tabid = (isset($_POST['tabid'])) ? $_POST['tabid'] : 0; 
  $tab->processTabs();
  endif;
?>
<?php
  /* Update Tab Order */
  if (isset($_GET['sorttabs'])) :
      $tab->updateOrder();
 endif;
?>
<?php
  /* Delete Tab*/
  if (isset($_POST['deleteTab'])):
  
  $id = sanitize($_POST['deleteTab']);
  $db->delete("mod_tabs", "id='" . (int)$id . "'");
  
  $title = sanitize($_POST['tabtitle']);
  print ($db->affected()) ? $zazavisec->writeLog(MOD_JT_TAB .' <strong>'.$title.'</strong> '._DELETED, "", "no", "module") . $core->msgOk(MOD_JT_TAB .' <strong>'.$title.'</strong> '._DELETED) : $core->msgAlert(_SYSTEM_PROCCESS); 
  endif;
?>