Exemplo n.º 1
0
function cache_key()
{
    if ($key = var_get('CACHE_KEY', false)) {
        return $key;
    } else {
        $key = md5(time());
        var_set('CACHE_KEY', $key);
        return $key;
    }
}
Exemplo n.º 2
0
function user_update_0()
{
    //this should be replaced with a user save but that requires a full bootstrap :(
    $sql = "REPLACE INTO `user` (`uid`, `email`, `username`, `password`, `created`, `updated`, `deleted`, `status`, `firstname`, `lastname`, `profile`, `location`, `age`, `picture`, `gender`)\nVALUES\n    (2, '*****@*****.**', 'nodefortytwo', '5133b5ed586f3107c016ab3440d1f251', 1346599169, 1346599169, 0, 1, 'Rick', 'Burgess', '', '4c03d3af187ec9287322b67b', 25, '', 'Male');\n    ";
    db()->query($sql);
    file_init();
    $file = array('name' => 'default-profile.gif', 'tmp_name' => cwd() . '/' . PATH_TO_MODULES . '/user/img/default-profile.gif', 'type' => 'image/gif');
    $f = new File();
    $f->upload($file);
    var_set('DEFAULT_PROFILE_PIC', $f->id);
}
Exemplo n.º 3
0
    // Check to see if a URL was sent in via POST
} else {
    //print_r($_POST); print_r($_GET);
    if (isset($_POST['url']) && ($url = $_POST['url'])) {
        // If URL is set, and it's NOT an array make it an array
        if (!is_array($url)) {
            $url = array($_POST['url']);
        }
    } else {
        $url = "";
    }
}
$show = var_set($_GET['show']);
$action = var_set($_GET['action']);
$filename = var_set($_GET['filename']);
$PHP_SELF = var_set($_SERVER['PHP_SELF']);
// Check to see if they're removing/adding the info tag
if ($action == "add_tag") {
    $ec->add_tag($filename);
    header("Location: {$PHP_SELF}?show={$filename}");
} elseif ($action == "remove_tag") {
    $ec->remove_tag($filename);
    header("Location: {$PHP_SELF}?show={$filename}");
} elseif ($action == "resample") {
    $ec->resample($ec->full_dir . "/" . $filename, 85);
    #$show = $filename;
    $show = "gallery";
} elseif ($action) {
    $ec->error("Unknown action '{$action}'");
}
// Show the gallery
Exemplo n.º 4
0
function phpini_set($name, $value)
{
    var_set('SETTINGS', $name, &$value);
}
Exemplo n.º 5
0
Arquivo: cron.php Projeto: didaah/dida
    }
}
set_time_limit(600);
// 读取任务列表,每次最多 100 条
if ($fetch = db_query('SELECT * FROM {cron} WHERE status = 0 
ORDER BY weight ASC, cid ASC', NULL, array('limit' => 100))) {
    foreach ($fetch as $o) {
        if (!$o->data) {
            continue;
        }
        $data = unserialize($o->data);
        if ($data['includes']) {
            foreach ($data['includes'] as $filepath) {
                include_once $filepath;
            }
        }
        if (function_exists($data['func']) && call_user_func_array($data['func'], $data['args'])) {
            db_exec('UPDATE {cron} SET status = 1 WHERE cid = ?', array($o->cid));
            if ($data['success'] && function_exists($data['success'])) {
                call_user_func_array($data['success'], $data['args']);
            }
        }
    }
}
// 触发 hook_cron()
module_invoke_all('cron', $timestamp);
// 写入运行时间
var_set('cron_last_time', time());
// 写入日志
dd_log('cron', t('system', '成功运行了计划任务'));
echo 'ok!';
Exemplo n.º 6
0
 function valid_admin_login($error_out = 1)
 {
     $un = var_set($_SESSION['username']);
     $pwd = var_set($_SESSION['password']);
     static $pert;
     // This is perturb.org specific code
     if (is_readable("../../perturb.class.php")) {
         require_once "../../perturb.class.php";
         if (!$pert) {
             $pert = new page();
         }
         $user_id = $pert->user_id;
         // If they're logged in from perturb.org they're ok, otherwise make them login here too
         if ($user_id) {
             return $user_id;
         }
     }
     if ($error_out && (!$this->admin_username || !$this->admin_password)) {
         $msg = "Admin Username/Password not set logins are disabled until this is corrected";
         $this->error($msg);
     }
     //print "$un = $this->admin_username<br />\n$pwd = $this->admin_password";
     if (!$un && !$pwd) {
         $ret = 0;
     } elseif ($un == $this->admin_username && $pwd == $this->admin_password) {
         $ret = 1;
     } elseif ($un != $this->admin_username || $pwd != $this->admin_password) {
         $ret = 0;
     } else {
         $ret = 0;
     }
     #print "Admin login returning $ret<br />\n";
     return $ret;
 }