fixed few bugs
--HG-- branch : Gsoc14-ryzomAppImprovements
This commit is contained in:
parent
11a3df1aaa
commit
4c0d3e53fc
5 changed files with 38 additions and 63 deletions
|
@ -173,17 +173,13 @@ class Plugincache {
|
|||
* @return boolean
|
||||
*/
|
||||
public static function rrmdir( $dir ) {
|
||||
if ( is_dir( $dir ) ) {
|
||||
$objects = scandir( $dir );
|
||||
foreach ( $objects as $object ) {
|
||||
if ( $object != "." && $object != ".." ) {
|
||||
if ( filetype( $dir . "/" . $object ) == "dir" ) rmdir( $dir . "/" . $object );
|
||||
else unlink( $dir . "/" . $object );
|
||||
}
|
||||
}
|
||||
reset( $objects );
|
||||
return rmdir( $dir );
|
||||
}
|
||||
$result=array_diff(scandir($dir),array('.','..'));
|
||||
foreach($result as $item)
|
||||
{
|
||||
if(!@unlink($dir.'/'.$item))
|
||||
Plugincache::rrmdir($dir.'/'.$item);
|
||||
}
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,4 +263,4 @@ class Plugincache {
|
|||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,12 +289,13 @@ class Users{
|
|||
public static function createUser($values, $user_id){
|
||||
try {
|
||||
//make connection with and put into shard db
|
||||
$values['user_id']= $user_id;
|
||||
$dbs = new DBLayer("shard");
|
||||
$dbs->insert("user", $values);
|
||||
$dbr = new DBLayer("ring");
|
||||
$values['user_type'] = 'ut_pioneer';
|
||||
$dbr->insert("ring_users", $values);
|
||||
$valuesRing['user_id'] =$user_id;
|
||||
$valuesRing['user_name'] = $values['Login'];
|
||||
$valuesRing['user_type'] = 'ut_pioneer';
|
||||
$dbr->insert("ring_users", $valuesRing);
|
||||
ticket_user::createTicketUser( $user_id, 1);
|
||||
return "ok";
|
||||
}
|
||||
|
@ -303,7 +304,7 @@ class Users{
|
|||
try {
|
||||
$dbl = new DBLayer("lib");
|
||||
$dbl->insert("ams_querycache", array("type" => "createUser",
|
||||
"query" => json_encode(array($values["name"],$values["pass"],$values["mail"])), "db" => "shard"));
|
||||
"query" => json_encode(array($values["Login"],$values["Password"],$values["Email"])), "db" => "shard"));
|
||||
ticket_user::createTicketUser( $user_id , 1 );
|
||||
return "shardoffline";
|
||||
}catch (PDOException $e) {
|
||||
|
@ -472,6 +473,3 @@ class Users{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ function delete_plugin() {
|
|||
if ( is_dir( "$name[FileName]" ) )
|
||||
{
|
||||
// removing plugin directory from the code base
|
||||
if ( rrmdir( "$name[FileName]" ) )
|
||||
if ( Plugincache::rrmdir( "$name[FileName]" ) )
|
||||
{
|
||||
$db -> delete( 'plugins', array( 'id' => $id ), "Id=:id" );
|
||||
|
||||
|
@ -45,24 +45,3 @@ function delete_plugin() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to remove a non empty directory
|
||||
*
|
||||
* @param $dir directory address
|
||||
* @return boolean
|
||||
*/
|
||||
function rrmdir( $dir ) {
|
||||
if ( is_dir( $dir ) ) {
|
||||
$objects = scandir( $dir );
|
||||
foreach ( $objects as $object ) {
|
||||
if ( $object != "." && $object != ".." ) {
|
||||
if ( filetype( $dir . "/" . $object ) == "dir" ) rmdir( $dir . "/" . $object );
|
||||
else unlink( $dir . "/" . $object );
|
||||
}
|
||||
}
|
||||
reset( $objects );
|
||||
return rmdir( $dir );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,37 +184,38 @@
|
|||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`plugins` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`plugins` (
|
||||
`Id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||
`FileName VARCHAR(255) NOT NULL,
|
||||
`Id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||
`FileName` VARCHAR(255) NOT NULL,
|
||||
`Name` VARCHAR(11) NOT NULL,
|
||||
`Type` VARCHAR(12) NOT NULL,
|
||||
`Owner` VARCHAR(25) NOT NULL,
|
||||
`Permission` VARCHAR(5) NOT NULL,
|
||||
`Status` INT(11) NOT NULL DEFAULT 0,
|
||||
`Weight` INT(11) NOT NULL DEFAULT 0,
|
||||
`Info` TEXT NULL DEFAULT NULL,
|
||||
`Info` TEXT NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`Id`) )
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `" . $cfg['db']['lib']['name'] ."`.`updates`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`updates` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`updates` (
|
||||
`s.no` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`PluginId` int(10) DEFAULT NULL,
|
||||
`UpdatePath` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`UpdateInfo` text COLLATE utf8_unicode_ci,
|
||||
PRIMARY KEY (`s.no`),
|
||||
KEY `PluginId` (`PluginId`))
|
||||
ENGINE=InnoDB;
|
||||
`s.no` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`PluginId` int(10) DEFAULT NULL,
|
||||
`UpdatePath` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`UpdateInfo` text COLLATE utf8_unicode_ci,
|
||||
PRIMARY KEY (`s.no`),
|
||||
KEY `PluginId` (`PluginId`))
|
||||
ENGINE=InnoDB;
|
||||
|
||||
-- -----------------------------------------
|
||||
-- Constraints for table `updates`
|
||||
-- -----------------------------------------
|
||||
ALTER TABLE `" . $cfg['db']['lib']['name'] ."`.`updates`
|
||||
ADD CONSTRAINT `updates_ibfk_1` FOREIGN KEY (`PluginId`) REFERENCES `plugins` (`Id`);
|
||||
-- -----------------------------------------
|
||||
-- Constraints for table `updates`
|
||||
-- -----------------------------------------
|
||||
ALTER TABLE `" . $cfg['db']['lib']['name'] ."`.`updates`
|
||||
ADD CONSTRAINT `updates_ibfk_1` FOREIGN KEY (`PluginId`) REFERENCES `plugins` (`Id`);
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
|
@ -1772,14 +1773,14 @@
|
|||
//Now create an admin account!
|
||||
$hashpass = crypt("admin", Users::generateSALT());
|
||||
$params = array(
|
||||
'name' => "admin",
|
||||
'pass' => $hashpass,
|
||||
'mail' => "admin@admin.com",
|
||||
'Login' => "admin",
|
||||
'Password' => $hashpass,
|
||||
'Email' => "admin@admin.com",
|
||||
);
|
||||
try{
|
||||
$user_id = WebUsers::createWebuser($params['name'], $params['pass'],$params['mail']);
|
||||
$user_id = WebUsers::createWebuser($params['Login'], $params['Password'],$params['Email']);
|
||||
$result = Webusers::createUser($params, $user_id);
|
||||
Users::createPermissions(array($params['name']));
|
||||
Users::createPermissions(array($params['Login']));
|
||||
$dbl = new DBLayer("lib");
|
||||
$dbl->execute("UPDATE ticket_user SET Permission = 3 WHERE TUserId = :user_id",array('user_id' => $user_id));
|
||||
print "The admin account is created, you can login with id: admin, pass: admin!";
|
||||
|
@ -1802,5 +1803,5 @@
|
|||
print "There was an error while installing";
|
||||
print_r($e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li>
|
||||
<li class="nav-header hidden-tablet">Actions</li>
|
||||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=createticket"><i class="icon-pencil"></i><span class="hidden-tablet">Create New Ticket</span></a></li>
|
||||
{if isset($hook_info)} {foreach from=$hook_info item=element}<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=layout_plugin&&name={$element.menu_display}"><i class="icon-th-list"></i><span class="hidden-tablet"> {$element.menu_display}</span></a></li>{/foreach}{/if}
|
||||
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>
|
||||
{/block}
|
||||
|
||||
|
|
Loading…
Reference in a new issue