* */ /** * Class AdminStatus : Contains all the specific functions of status admin * * @author Claire Figueras * @license GPL * @package Maarch LetterBox 2.0 * @version 2.0 */ class AdminStatus extends dbquery { /** * Redefinition of the LetterBox object constructor */ function __construct() { parent::__construct(); } /** * Return the status data in sessions vars * * @param string $mode add or up */ public function statusinfo($mode) { // return the user information in sessions vars $func = new functions(); $_SESSION['m_admin']['status']['ID'] = $func->wash($_REQUEST['id'], "no", _ID." "); $_SESSION['m_admin']['status']['LABEL'] = $func->wash($_REQUEST['label'], "no", _DESC." ", 'yes', 0, 50); $_SESSION['m_admin']['status']['IS_SYSTEM'] = $func->wash($_REQUEST['is_system'], "no", _IS_SYSTEM." "); $_SESSION['m_admin']['status']['IMG_FILENAME'] = ''; $_SESSION['m_admin']['status']['MODULE'] = 'apps'; $_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] = $func->wash($_REQUEST['can_be_searched'], "no", CAN_BE_SEARCHED." "); $_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] = $func->wash($_REQUEST['can_be_modified'], "no", _CAN_BE_MODIFIED." "); $_SESSION['m_admin']['status']['order'] = $_REQUEST['order']; $_SESSION['m_admin']['status']['order_field'] = $_REQUEST['order_field']; $_SESSION['m_admin']['status']['what'] = $_REQUEST['what']; $_SESSION['m_admin']['status']['start'] = $_REQUEST['start']; } /** * Add ou modify status in the database * * @param string $mode up or add */ public function addupstatus($mode) { // add ou modify users in the database $this->statusinfo($mode); $order = $_SESSION['m_admin']['status']['order']; $order_field = $_SESSION['m_admin']['status']['order_field']; $what = $_SESSION['m_admin']['status']['what']; $start = $_SESSION['m_admin']['status']['start']; if(!empty($_SESSION['error'])) { if($mode == "up") { if(!empty($_SESSION['m_admin']['status']['ID'])) { header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status_up&id=".$_SESSION['m_admin']['status']['ID']."&admin=status"); exit; } else { header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } } if($mode == "add") { header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status_add&admin=status"); exit(); } } else { $this->connect(); if($mode == "add") { $this->query("INSERT INTO ".$_SESSION['tablename']['status']." ( id, label_status, img_filename, is_system, maarch_module, can_be_searched, can_be_modified) VALUES ( '".$this->protect_string_db($_SESSION['m_admin']['status']['ID'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['LABEL'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['IMG_FILENAME'])."','".$this->protect_string_db($_SESSION['m_admin']['status']['IS_SYSTEM'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['MODULE'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_SEARCHED'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_MODIFIED'])."' )"); if($_SESSION['history']['statusadd']) { require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php'); $hist = new history(); $hist->add($_SESSION['tablename']['status'], $this->protect_string_db($_SESSION['m_admin']['status']['ID']),"ADD",_STATUS_ADDED.' : '.$this->protect_string_db($_SESSION['m_admin']['status']['LABEL']), $_SESSION['config']['databasetype']); } $_SESSION['error'] = _STATUS_ADDED.' '.$_SESSION['m_admin']['status']['LABEL']; $this->clearstatusinfos(); header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } elseif($mode == "up") { $this->query("update ".$_SESSION['tablename']['status']." set label_status = '".$this->protect_string_db($_SESSION['m_admin']['status']['LABEL'])."', img_filename = '".$this->protect_string_db($_SESSION['m_admin']['status']['IMG_FILENAME'])."',maarch_module = '".$this->protect_string_db($_SESSION['m_admin']['status']['MODULE'])."', can_be_searched = '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_SEARCHED'])."' , can_be_modified = '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_MODIFIED'])."' where id = '".$_SESSION['m_admin']['status']['ID']."'"); if($_SESSION['history']['statusup']) { require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php'); $hist = new history(); $hist->add($_SESSION['tablename']['status'], $this->protect_string_db($_SESSION['m_admin']['status']['ID']),"UP",_STATUS_MODIFIED.' : '.$this->protect_string_db($_SESSION['m_admin']['status']['LABEL']), $_SESSION['config']['databasetype']); } $_SESSION['error'] = _STATUS_MODIFIED.' : '.$_SESSION['m_admin']['status']['LABEL']; $this->clearstatusinfos(); header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } } } /** * Form to modify a status * * @param $string $mode up or add * @param int $id $id of the status to change */ public function formstatus($mode,$id = "") { $func = new functions(); $state = true; if(!isset($_SESSION['m_admin']['status'])) { $this->clearstatusinfos(); } if( $mode <> "add") { $this->connect(); $this->query("select * from ".$_SESSION['tablename']['status']." where id = '".$id."'"); if($this->nb_result() == 0) { $_SESSION['error'] = _THE_STATUS.' '._ALREADY_EXISTS; $state = false; } else { $_SESSION['m_admin']['status'] = array(); $line = $this->fetch_object(); $_SESSION['m_admin']['status']['ID'] = $line->id; $_SESSION['m_admin']['status']['LABEL'] = $this->show_string($line->label_status); $_SESSION['m_admin']['status']['IS_SYSTEM'] = $this->show_string($line->is_system); $_SESSION['m_admin']['status']['IMG_FILENAME'] = $this->show_string($line->img_filename); $_SESSION['m_admin']['status']['MODULE'] = $this->show_string($line->maarch_module); $_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] = $this->show_string($line->can_be_searched); $_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] = $this->show_string($line->can_be_modified); } } else if($mode == 'add') { $_SESSION['m_admin']['status']['IS_SYSTEM'] = 'N'; $_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] = 'Y'; $_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] = 'Y'; } ?>




"._THE_STATUS." "._UNKOWN."



"; } else { ?>
" class="forms addforms">

/>

checked="checked" /> checked="checked" />

checked="checked" /> checked="checked" />

connect(); $this->query("select id from ".$_SESSION['tablename']['status']." where id = '".$id."'"); if($this->nb_result() == 0) { $_SESSION['error'] = _THE_STATUS.' '._UNKNOWN; header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit; } else { $res = $this->fetch_object(); $label = $res->LABEL; $this->query("delete from ".$_SESSION['tablename']['status']." where id = '".$id."'"); if($_SESSION['history']['statusdel']) { require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php'); $hist = new history(); $hist->add($_SESSION['tablename']['status'], $this->protect_string_db($id),"DEL",_STATUS_DELETED.' : '.$this->protect_string_db($id), $_SESSION['config']['databasetype']); } $_SESSION['error'] = _STATUS_DELETED." ".$id; header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit; } } } } ?>