diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php index df3af960c..1b0dc873d 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php @@ -1,262 +1,150 @@ - setId($values['PluginId']); - - $this->setPluginName($values['PluginName']); - - $this->setPluginVersion($values['PluginVersion']); - - $this->setPluginPermission($values['PluginPermission']); - - $this->setIsActive($values['IsActive']); - - } - - - + * A constructor. + * Empty constructor + */ + + public function __construct() { + } + + public function set( $values ) { + $this -> setId( $values['Id'] ); + $this -> setPluginName( $values['Name'] ); + $this -> setPluginType( $values['Type'] ); + $this -> setPluginPermission( $values['Permission'] ); + $this -> setPluginStatus( $values['Status'] ); + $this -> setPluginInfo( $values['Info'] ); + } - /** - - * loads the object's attributes. - - */ - - public function load_With_SID( ) { - - $dbl = new DBLayer("lib"); - - $statement = $dbl->executeWithoutParams("SELECT * FROM plugins"); - - $row = $statement->fetch(); - - $this->set($row); - - } - + * loads the object's attributes. + */ + public function load_With_SID() { + $dbl = new DBLayer( "lib" ); + $statement = $dbl -> executeWithoutParams( "SELECT * FROM plugins" ); + $row = $statement -> fetch(); + $this -> set( $row ); + } - + /** + * get plugin id attribute of the object. + * + * @return integer id + */ + public function getId() { + return $this -> Id; + } - /** - - * updates the entry. - - */ - - public function update(){ - - $dbl = new DBLayer("lib"); - - $query = "UPDATE plugins SET PluginPermission= :t, PluginVersion = :q, IsActive = :d WHERE PluginName=:p_n"; - - $values = Array('p_n' => $this->getPluginName(), 't' => $this->getPluginPermission(), 'q' => $this->getPluginVersion(), 'd' => $this->getIsActive()); - - $statement = $dbl->execute($query, $values); - - } - + * get plugin permission attribute of the object. + */ + public function getPluginPermission() { + return $this -> plugin_permission; + } - + /** + * get plugin Type attribute of the object. + */ + public function getPluginType() { + return $this -> plugin_version; + } - - public function getId(){ - - return $this->Id; - - } - - - /** - - * get plugin permission attribute of the object. - - */ - - public function getPluginPermission(){ - - return $this->plugin_permission; - - } - + * get plugin status attribute of the object. + */ + public function getPluginStatus() { + return $this -> plugin_status; + } - /** - - * get plugin version attribute of the object. - - */ - - public function getPluginVersion(){ - - return $this->plugin_version; - - } - + * get plugin name attribute of the object. + */ + public function getPluginName() { + return $this -> plugin_name; + } - /** - - * get plugin is active attribute of the object. - - */ - - public function getIsActive(){ - - return $this->plugin_isactive; - - } - - - + * get plugin info array attribute of the object. + */ + public function getPluginInfo() { + return $this -> plugin_info; + } + /** - - * get plugin name attribute of the object. - - */ - - public function getPluginName(){ - - return $this->plugin_name; - - } - - - + * set plugin id attribute of the object. + * + * @param $s integer id + */ + public function setId( $s ) { + $this -> Id = $s; + } - + /** + * set plugin permission attribute of the object. + * + * @param $t type of the query, set permission + */ + public function setPluginPermission( $t ) { + $this -> plugin_permission = $t; + } - /** - - * set plugin id attribute of the object. - - * @param $s integer id - - */ - - public function setId($s){ - - $this->Id = $s; - - } - - - + * set plugin version attribute of the object. + * + * @param $q string to set plugin version + */ + public function setPluginType( $q ) { + $this -> plugin_version = $q; + } + /** - - * set plugin permission attribute of the object. - - * @param $t type of the query, set permission - - */ - - public function setPluginPermission($t){ - - - - $this->plugin_permission = $t; - - } - + * set plugin status attribute of the object. + * + * @param $d status code type int + */ + public function setPluginStatus( $d ) { + $this -> plugin_status = $d; + } - /** - - * set plugin version attribute of the object. - - * @param $q string to set plugin version - - */ - - public function setPluginVersion($q){ - - $this->plugin_version= $q; - - } - + * get plugin name attribute of the object. + */ + public function getPluginName() { + return $this -> plugin_name; + } - /** - - * set plugin is active attribute of the object. - - * @param $d tinyint to set plugin is active or not . - - */ - - public function setIsActive($d){ - - $this->plugin_isactive= $d; - - } - - - + * set plugin name attribute of the object. + * + * @param $p_n string to set plugin name. + */ + public function setPluginName( $p_n ) { + $this -> plugin_name = $p_n; + } + /** - - * set plugin name attribute of the object. - - * @param $p_n string to set plugin name. - - */ - - public function setPluginName($p_n){ - - $this->plugin_name= $p_n; - - } - + * set plugin info attribute array of the object. + * + * @param $p_n array + */ + public function setPluginInfo( $p_n ) { + $this -> plugin_info = $p_n; + } - -} - - + } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php index 61bdb0278..1118b556f 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php @@ -1,45 +1,39 @@ init(); - print_r(plugin::$plugins);**/ - - $pagination = new Pagination("SELECT * FROM plugins","lib",5,"Plugincache"); - $pageResult['plug']= Gui_Elements::make_table($pagination->getElements() , Array ("getId","getPluginName","getPluginVersion","getPluginPermission","getIsActive"), Array("id","plugin_name","plugin_version","plugin_permission","plugin_isactive")); - $pageResult['links'] = $pagination->getLinks(5); - $pageResult['lastPage'] = $pagination->getLast(); - $pageResult['currentPage'] = $pagination->getCurrent(); + { + if ( Ticket_User :: isMod( unserialize( $_SESSION['ticket_user'] ) ) ) { + + $pagination = new Pagination( "SELECT * FROM plugins", "lib", 5, "Plugincache" ); + $pageResult['plug'] = Gui_Elements :: make_table( $pagination -> getElements(), Array( "getId", "getPluginName", "getPluginType", "getPluginPermission", "getPluginStatus", "getPluginInfo" ), Array( "id", "plugin_name", "plugin_type", "plugin_permission", "plugin_status", "plugin_info" ) ); + $pageResult['links'] = $pagination -> getLinks( 5 ); + $pageResult['lastPage'] = $pagination -> getLast(); + $pageResult['currentPage'] = $pagination -> getCurrent(); - global $INGAME_WEBPATH; - $pageResult['ingame_webpath'] = $INGAME_WEBPATH; + global $INGAME_WEBPATH; + $pageResult['ingame_webpath'] = $INGAME_WEBPATH; - //check if shard is online - try{ - $dbs = new DBLayer("shard"); - $pageResult['shard'] = "online"; - }catch(PDOException $e){ + // check if shard is online + try { + $dbs = new DBLayer( "shard" ); + $pageResult['shard'] = "online"; + } + catch( PDOException $e ) { $pageResult['shard'] = "offline"; - } - return( $pageResult); - }else{ - //ERROR: No access! + } + return( $pageResult ); + } else { + // ERROR: No access! $_SESSION['error_code'] = "403"; - header("Location: index.php?page=error"); - exit; + header( "Location: index.php?page=error" ); + exit; + } + } - -} - -