* */ class extensions extends dbquery { /** * Redefinition of the extensions object constructor : configure the sql argument order by */ function __construct() { // configure the sql argument order by if(isset($_GET['start'])) { $this->the_start = strip_tags($_GET['start']); } else { $this->the_start = 0; } if(isset($_GET['order'])) { $this->orderby = strip_tags($_GET['order']); } else { $this->orderby = "nameasc"; } $this->sqlorderby = ""; if($this->orderby == "nameasc") { $this->sqlorderby = "order by NAME asc"; } if($this->orderby == "namedesc") { $this->sqlorderby = "order by NAME desc"; } if($this->orderby == "pathasc") { $this->sqlorderby = "order by PATH asc"; } if($this->orderby == "pathdesc") { $this->sqlorderby = "order by PATH desc"; } } /** * List all the alphabet letter to view the applications which are starting with the letter * * @param string $page "types" by default */ public function applistletters($page = "extension") { // List all the alphabet letter to view the applications who are starting with the letter if(isset($_GET['show'])) { if($_GET['show'] == "false") { $show = "&show=false"; } else { $show = ""; } } else { $show = ""; } ?>

" class="button" /> '; } ?>

: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z -

connect(); $_SESSION['user']['extension']['NAME'] = $name; $_SESSION['user']['extension']['PATH'] = $path; if( $mode == "add") { if(empty($path) || empty($name)) { $_SESSION['error']=_EMPTY_FIELD; header("location: index.php?page=extensions_add"); exit; } else { $db->query("SELECT * FROM ".$_SESSION['tablename']['ext_applications']." WHERE USER_ID = '".$_SESSION['user']['UserId']."' AND NAME = '".$name."'"); if($db->nb_result() > 0) { $_SESSION['error'] = _APPS.' '.$name.' '._ALREADY_EXISTS; header("location: index.php?page=extensions_add"); exit; } else { require_once("class_history.php"); $ext_history = new history(); for ($i=0; $iquery("SELECT * FROM ".$_SESSION['tablename']['ext_applications']." WHERE USER_ID = '".$_SESSION['user']['UserId']."' AND FORMAT = '".$format[$i]."'"); if ($db->nb_result() > 0) { $_SESSION['error'] = _EXTENSION_ALREADY_EXISTS_FOR; header("location: index.php?page=extension"); exit; } else { $db->query("INSERT INTO `".$_SESSION['tablename']['ext_applications']."` ( `USER_ID` , `FORMAT`,`NAME`, `PATH` ) VALUES ('".$_SESSION['user']['UserId']."', '".$format[$i]."','".$name."','".addslashes($path)."')"); } } if($_SESSION['history']['extensionsadd'] == "true") { $ext_history->add($_SESSION['tablename']['ext_applications'], $name,"ADD", _APPLICATION_ADDED." : ".$name); } $_SESSION['error'] = _APPLICATION_ADDED; $url = "index.php?page=extension"; header("location: ".$url); exit; } } } if( $mode == "up") { for ($i=0; $iquery("SELECT * FROM ".$_SESSION['tablename']['ext_applications']." WHERE USER_ID = '".$_SESSION['user']['UserId']."' AND FORMAT = '".$format[$i]."'"); if($db->nb_result() > 0) { $db->query("DELETE FROM ".$_SESSION['tablename']['ext_applications']." WHERE USER_ID = '".$_SESSION['user']['UserId']."' AND FORMAT = '".$format[$i]."'"); } $db->query("INSERT INTO `".$_SESSION['tablename']['ext_applications']."` ( `USER_ID` , `FORMAT`,`NAME`, `PATH` ) VALUES ('".$_SESSION['user']['UserId']."', '".$format[$i]."','".$name."','".addslashes($path)."')"); } if($_SESSION['history']['extensionsadd'] == "true") { $ext_history->add($_SESSION['tablename']['ext_applications'], $name,"ADD", _APPLICATION_MODIFIED." : ".$name); } $_SESSION['error'] = _APPLICATION_MODIFIED; $url = "index.php?page=extension"; header("location: ".$url); exit; } } /** * Clear the session variables of the model administration * */ private function clearextensioninfos() { // clear the session variable for the models $_SESSION['user']['extension'] = array(); $_SESSION['user']['extension']['NAME'] = ""; $_SESSION['user']['extension']['PATH'] = ""; $_SESSION['user']['extension']['FORMAT'] = array(); } /** * Shows the list of the baskets according to the selected letter. * * @param string $where sorting of the list (empty by default) * @param string $what first letter of the name (empty by default) */ public function appslist($where = "", $what="") { // draw the list $func = new functions(); /* Configuration */ $title = _APPS_LIST; $page_name = "extension"; $page_name_up = "extension_up"; $page_name_del = "extension_del"; $page_name_validate= "extension_allow"; $page_name_ban = "extension_ban"; $table_name = $_SESSION['tablename']['ext_applications']; $nb_show = $_SESSION['config']['nblinetoshow']; if(!empty($what)) { $what = "&what=".$what; } if(!empty($where)) { $where = " where ".$where." AND "; } else { $where = " where "; } /***********************/ $compteur = 0; $this->connect(); $this->query("SELECT DISTINCT NAME FROM ".$table_name); while($nb_res = $this->fetch_object()) { $compteur = $compteur+1; } $nb_total = $compteur; // define the defaults values $nb_pages = ceil($nb_total/$nb_show); $link = "index.php?page=".$page_name."&start=".$this->the_start."&order=".$this->orderby.$what; if($nb_pages > 1) { $next_start = 0; $page_list1 = '

'; $lastpage = 0; for($i = 0;$i <> $nb_pages; $i++) { $page_name = $i + 1; $the_line = $i + 1; if($this->the_start == $next_start) { $page_list1 .= ""; $page_list2 .= ""; } else { $page_list1 .= ""; $page_list2 .= ""; } $next_start = $next_start + $nb_show; $lastpage = $next_start; } $lastpage = $lastpage - $nb_show; $previous = ""; $next = ""; if($this->the_start > 0) { $start_prev = $this->the_start - $nb_show; $previous = ''; } if($this->the_start <> $lastpage) { $start_next = $this->the_start + $nb_show; $next = ''; } $page_list1 = $page_list1.""; $page_list2 = $page_list2.""; if($previous <> '' || $next <> '') { if(empty($previous)) { $previous = " "; } if(empty($next)) { $next = " "; } $page_list1 .= $previous." ".$next.'

'; $page_list2 .= $previous." ".$next.'

'; } } $this->query("select distinct(NAME), PATH from ".$table_name." ".$where." USER_ID = '".$_SESSION['user']['UserId']."' ".$this->sqlorderby." limit ".$this->the_start.",".$nb_show); echo '

'.$title.'

'; $this->applistletters(); echo $page_list1; ?> fetch_object()) { if($color == ' class="col"') { $color = ''; } else { $color = ' class="col"'; } ?> >
NAME; ?> show($line->PATH); ?>
connect(); $db->query("select * from ".$_SESSION['tablename']['ext_applications']." where NAME = '".$id."'"); if($db->nb_result() == 0) { header("location: index.php?page=extension"); $_SESSION['error'] = _APPS.' '._UNKNOWN; exit; } else { while($line = $db->fetch_object()) { $name = $line->NAME; $this->query("delete from ".$_SESSION['tablename']['ext_applications']." where NAME = '".$id."'"); if($_SESSION['history']['extensionsdel']) { require_once("class_history.php"); $users = new history(); $users->add($_SESSION['tablename']['ext_applications'], $id,"DEL",_EXTENSION_DELETION." : ".$name); } } $_SESSION['error'] = _APPS_DELETED; $url = 'index.php?page=extension'; ?> connect(); $db->query("SELECT * FROM ".$_SESSION['tablename']['ext_applications']." WHERE USER_ID = '".$_SESSION['user']['UserId']."' AND NAME = '".$id."' AND PATH = '".stripslashes($path)."'"); $_SESSION['user']['extension'] = array(); $_SESSION['user']['extension']['FORMAT'] = array(); while ($line = $db->fetch_array()) { $_SESSION['user']['extension']['NAME'] = $line[2]; $_SESSION['user']['extension']['PATH'] = stripslashes($line[3]); array_push($_SESSION['user']['extension']['FORMAT'], array("NAME" =>$line[1])); } if(!isset($_SESSION['user']['extension'])) { $this->clearextensioninfos(); } ?>

*

*

*

*