Example #1
0
function &for_db(&$in, $allowed = false, $escape = true)
{
    if (!is_string($in)) {
        if (is_array($in)) {
            foreach ($in as &$inner) {
                for_db($inner, $allowed, $escape);
            }
        }
        return $in;
    }
    if ($allowed !== false) {
        $in = strip_tags($in, $allowed);
    }
    if (get_magic_quotes_gpc()) {
        $in = stripslashes($in);
    }
    if ($escape) {
        \ui\load_lib('db');
        $in = mysqli_real_escape_string(\ui\db\db(), $in);
    }
    return $in;
}
Example #2
0
<?php

/**
 * user login and authentication management for users from a database
 * Specify the table name in config.php as 'auth_table'=>'table name'
 * Table should have atleast:
 * id
 * email
 * password
 * level
 */
namespace ui\auth;

\ui\load_lib('db');
function &user($field = false, $set_to_this = false)
{
    static $user = false;
    if ($set_to_this !== false) {
        $user = $set_to_this;
        return $user;
    }
    if ($user === false) {
        $user = logged_in();
    }
    if ($field === false) {
        return $user;
    }
    if (isset($user[$field])) {
        return $user[$field];
    }
    $user[$field] = false;
Example #3
0
File: init.php Project: 1upon0/ui
} else {
    \ui\global_var('imported_app', true, 1);
}
\ui\global_var('app_dir', $_APP_DIR, true);
define('IID', substr(md5($_APP_DIR), 0, 8));
//Instance ID, to prevent session variable collisions
\ui\benchmark('Loaded Base UI');
if (DEBUG) {
    error_reporting(E_ALL);
} else {
    error_reporting(0);
}
\ui\benchmark();
include $_APP_DIR . 'inc/autoload.php';
foreach ($autoload['lib'] as $ui_lib) {
    \ui\load_lib($ui_lib);
}
unset($ui_lib);
foreach ($autoload['plugin'] as $ui_plugin) {
    \ui\load_plugin($ui_plugin);
}
unset($ui_plugin);
unset($autoload);
$ctrl = '/' . \ui\global_var('controller');
$offset = strpos($ctrl, '/');
$inc_dir = substr($ctrl, 0, $offset);
$inc_paths = array();
while ($offset !== false) {
    $inc_path = $_APP_DIR . 'app' . $inc_dir . '/_include.php';
    if (file_exists($inc_path)) {
        $inc_paths[] = $inc_path;