コード例 #1
0
ファイル: commonfslib.php プロジェクト: hypervm-ng/hypervm-ng
function lxfile_mkdir($dir)
{
    $dir = expand_real_root($dir);
    if (lxfile_exists($dir)) {
        return true;
    }
    //dprint("Making directory... $dir\n");
    if (WindowsOs()) {
        $dir = preg_replace("/\\//", "\\", $dir);
    }
    log_shell("Making directory {$dir}");
    $ret = mkdir($dir, 0755, true);
    if (!$ret) {
        debugBacktrace();
    }
}
コード例 #2
0
ファイル: sqlite.php プロジェクト: lonelywoolf/hypervm
 function database_query($res, $string)
 {
     //log_log("dbquery", $string);
     if (self::$__database == 'mysql') {
         //print($string . "\n");
         $res = mysql_query($string, $res);
         if (!$res) {
             dprint("Mysql connection broken. Reconnecting..\n");
             debugBacktrace();
             $this->reconnect();
             $res = mysql_query($string, $res);
         }
         dprint(mysql_error());
         return $res;
     } else {
         if (self::$__database == "mssql") {
             return mssql_query($string, $res);
         } else {
             //return $res->query($string);
             $st = $res->prepare($string);
             if ($st) {
                 $v = $st->execute();
             } else {
                 dprint($string);
                 dprintr($res->errorInfo());
             }
             return $st;
         }
     }
 }
コード例 #3
0
ファイル: lib.php プロジェクト: lonelywoolf/hypervm
function if_not_admin_complain_and_exit()
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    if ($login->isLteAdmin()) {
        return;
    }
    print "You are trying to access Protected Area. This incident will be reported\n <br> ";
    debugBacktrace();
    $message = "At " . lxgettime(time()) . " {$login->nname} tried to Access a region that is prohibited for Normal Users\n. Click here to See what this means. http://lxlabs.com/software/{$progname}/docs/security/unauthorized-access/\n";
    send_mail_to_admin("{$progname} Warning: Unauthorized Access by {$login->nname}", $message);
    exit(0);
}
コード例 #4
0
ファイル: lxlib.php プロジェクト: zseand/kloxo
function get_namelist_from_objectlist($ol, $key = null, $val = null)
{
    if (!$ol) {
        return;
    }
    $name = array();
    if (!$key) {
        $key = "nname";
    }
    if ($val === null) {
        $val = $key;
    }
    foreach ($ol as $o) {
        if (!is_object($o)) {
            debugBacktrace();
        }
        $name[$o->{$key}] = $o->display($val);
    }
    return $name;
}
コード例 #5
0
ファイル: lxclass.php プロジェクト: hypervm-ng/hypervm-ng
 protected final function initObjectIfUndef($class)
 {
     $objectname = $class . "_o";
     $this->__object_list = array_push_unique($this->__object_list, $class);
     if (isset($this->{$objectname}) && $this->{$objectname} != NULL) {
         return 0;
     }
     $name = exec_class_method($class, 'initThisObjectRule', $this, $class);
     if ($name) {
         $obj = new $class($this->__masterserver, $this->__readserver, $name);
         $obj->get();
     } else {
         $obj = exec_class_method($class, 'initThisObject', $this, $class);
     }
     // If the object doesn't exist and is newly created, then assign it fully to the current guy. WIhtout this, it becomes impossible to delete the object if it doesn't exist in the db.
     if (!$obj) {
         $obj = new $class($this->__masterserver, $this->__readserver, $name);
         $obj->get();
     }
     // Just forcibly set the syncserver...
     $obj->inheritSyncServer($this);
     if ($obj->dbaction === 'add') {
         $obj->parent_clname = $this->getClName();
         if ($obj->nname !== '__tmp_lx_name__') {
             dprintr("<b> Getobject Created the {$class} {$obj->nname} object fresh in {$this->getClName()} ... </b>");
             debugBacktrace();
         }
         $obj->inheritSyncServer($this);
     }
     if ($obj) {
         $obj->__parent_o = $this;
     }
     $this->{$objectname} = $obj;
 }
コード例 #6
0
ファイル: sqlite.php プロジェクト: hypervm-ng/hypervm-ng
 function database_query($res, $string)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $fdbvar = "__fdb_" . $this->__readserver;
     if (self::$__database == 'mysql') {
         $res = mysqli_query($gbl->{$fdbvar}, $string);
         if (!$res) {
             dprint("MySQL connection is broken. Reconnecting..\n");
             debugBacktrace();
             $this->reconnect();
             $res = mysqli_query($gbl->{$fdbvar}, $string);
         }
         dprint(mysqli_error($gbl->{$fdbvar}));
         return $res;
     } else {
         if (self::$__database == "mssql") {
             return mssql_query($string, $res);
         } else {
             //return $res->query($string);
             $st = $res->prepare($string);
             if ($st) {
                 $v = $st->execute();
             } else {
                 dprint($string);
                 dprintr($res->errorInfo());
             }
             return $st;
         }
     }
 }