Пример #1
0
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
 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
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
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
 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
 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;
         }
     }
 }