mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
fixed few bugs
This commit is contained in:
parent
75cfa80376
commit
1546cfc57a
5 changed files with 38 additions and 63 deletions
|
@ -173,17 +173,13 @@ class Plugincache {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function rrmdir( $dir ) {
|
public static function rrmdir( $dir ) {
|
||||||
if ( is_dir( $dir ) ) {
|
$result=array_diff(scandir($dir),array('.','..'));
|
||||||
$objects = scandir( $dir );
|
foreach($result as $item)
|
||||||
foreach ( $objects as $object ) {
|
{
|
||||||
if ( $object != "." && $object != ".." ) {
|
if(!@unlink($dir.'/'.$item))
|
||||||
if ( filetype( $dir . "/" . $object ) == "dir" ) rmdir( $dir . "/" . $object );
|
Plugincache::rrmdir($dir.'/'.$item);
|
||||||
else unlink( $dir . "/" . $object );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reset( $objects );
|
|
||||||
return rmdir( $dir );
|
|
||||||
}
|
}
|
||||||
|
return rmdir($dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -289,12 +289,13 @@ class Users{
|
||||||
public static function createUser($values, $user_id){
|
public static function createUser($values, $user_id){
|
||||||
try {
|
try {
|
||||||
//make connection with and put into shard db
|
//make connection with and put into shard db
|
||||||
$values['user_id']= $user_id;
|
|
||||||
$dbs = new DBLayer("shard");
|
$dbs = new DBLayer("shard");
|
||||||
$dbs->insert("user", $values);
|
$dbs->insert("user", $values);
|
||||||
$dbr = new DBLayer("ring");
|
$dbr = new DBLayer("ring");
|
||||||
$values['user_type'] = 'ut_pioneer';
|
$valuesRing['user_id'] =$user_id;
|
||||||
$dbr->insert("ring_users", $values);
|
$valuesRing['user_name'] = $values['Login'];
|
||||||
|
$valuesRing['user_type'] = 'ut_pioneer';
|
||||||
|
$dbr->insert("ring_users", $valuesRing);
|
||||||
ticket_user::createTicketUser( $user_id, 1);
|
ticket_user::createTicketUser( $user_id, 1);
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
@ -303,7 +304,7 @@ class Users{
|
||||||
try {
|
try {
|
||||||
$dbl = new DBLayer("lib");
|
$dbl = new DBLayer("lib");
|
||||||
$dbl->insert("ams_querycache", array("type" => "createUser",
|
$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 );
|
ticket_user::createTicketUser( $user_id , 1 );
|
||||||
return "shardoffline";
|
return "shardoffline";
|
||||||
}catch (PDOException $e) {
|
}catch (PDOException $e) {
|
||||||
|
@ -472,6 +473,3 @@ class Users{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ function delete_plugin() {
|
||||||
if ( is_dir( "$name[FileName]" ) )
|
if ( is_dir( "$name[FileName]" ) )
|
||||||
{
|
{
|
||||||
// removing plugin directory from the code base
|
// removing plugin directory from the code base
|
||||||
if ( rrmdir( "$name[FileName]" ) )
|
if ( Plugincache::rrmdir( "$name[FileName]" ) )
|
||||||
{
|
{
|
||||||
$db -> delete( 'plugins', array( 'id' => $id ), "Id=:id" );
|
$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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`plugins` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`plugins` (
|
||||||
`Id` INT(10) NOT NULL AUTO_INCREMENT,
|
`Id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||||
`FileName VARCHAR(255) NOT NULL,
|
`FileName` VARCHAR(255) NOT NULL,
|
||||||
`Name` VARCHAR(11) NOT NULL,
|
`Name` VARCHAR(11) NOT NULL,
|
||||||
`Type` VARCHAR(12) NOT NULL,
|
`Type` VARCHAR(12) NOT NULL,
|
||||||
`Owner` VARCHAR(25) NOT NULL,
|
`Owner` VARCHAR(25) NOT NULL,
|
||||||
|
@ -196,6 +196,7 @@
|
||||||
PRIMARY KEY (`Id`) )
|
PRIMARY KEY (`Id`) )
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `" . $cfg['db']['lib']['name'] ."`.`updates`
|
-- Table `" . $cfg['db']['lib']['name'] ."`.`updates`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
@ -1772,14 +1773,14 @@
|
||||||
//Now create an admin account!
|
//Now create an admin account!
|
||||||
$hashpass = crypt("admin", Users::generateSALT());
|
$hashpass = crypt("admin", Users::generateSALT());
|
||||||
$params = array(
|
$params = array(
|
||||||
'name' => "admin",
|
'Login' => "admin",
|
||||||
'pass' => $hashpass,
|
'Password' => $hashpass,
|
||||||
'mail' => "admin@admin.com",
|
'Email' => "admin@admin.com",
|
||||||
);
|
);
|
||||||
try{
|
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);
|
$result = Webusers::createUser($params, $user_id);
|
||||||
Users::createPermissions(array($params['name']));
|
Users::createPermissions(array($params['Login']));
|
||||||
$dbl = new DBLayer("lib");
|
$dbl = new DBLayer("lib");
|
||||||
$dbl->execute("UPDATE ticket_user SET Permission = 3 WHERE TUserId = :user_id",array('user_id' => $user_id));
|
$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!";
|
print "The admin account is created, you can login with id: admin, pass: admin!";
|
||||||
|
|
|
@ -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 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 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>
|
<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>
|
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue