mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-30 15:45:59 +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
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
|
||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`plugins` (
|
||||
`Id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||
`FileName VARCHAR(255) NOT NULL,
|
||||
`FileName` VARCHAR(255) NOT NULL,
|
||||
`Name` VARCHAR(11) NOT NULL,
|
||||
`Type` VARCHAR(12) NOT NULL,
|
||||
`Owner` VARCHAR(25) NOT NULL,
|
||||
|
@ -196,6 +196,7 @@
|
|||
PRIMARY KEY (`Id`) )
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `" . $cfg['db']['lib']['name'] ."`.`updates`
|
||||
-- -----------------------------------------------------
|
||||
|
@ -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!";
|
||||
|
|
|
@ -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