本文整理汇总了PHP中load::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP load::redirect方法的具体用法?PHP load::redirect怎么用?PHP load::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类load
的用法示例。
在下文中一共展示了load::redirect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Routes requests and sets return data
*/
public function __construct()
{
if (class_exists('mvc')) {
mvc::$view = '#moadmin';
}
$this->mongo['dbs'] = self::$model->listDbs();
if (isset($_GET['db'])) {
if (strpos($_GET['db'], '.') !== false) {
$_GET['db'] = $_GET['newdb'];
}
self::$model->setDb($_GET['db']);
}
if (isset($_POST['limit'])) {
$_SESSION['limit'] = (int) $_POST['limit'];
} else {
if (!isset($_SESSION['limit'])) {
$_SESSION['limit'] = OBJECT_LIMIT;
}
}
if (isset($_FILES['import']) && is_uploaded_file($_FILES['import']['tmp_name']) && isset($_GET['collection'])) {
$data = json_decode(file_get_contents($_FILES['import']['tmp_name']));
self::$model->import($_GET['collection'], $data, $_POST['importmethod']);
}
$action = isset($_GET['action']) ? $_GET['action'] : 'listCollections';
if (isset($_POST['object'])) {
if (self::$model->saveObject($_GET['collection'], $_POST['object'])) {
return $this->_dumpFormVals();
} else {
$action = 'editObject';
$_POST['errors']['object'] = 'Error: object could not be saved - check your array syntax.';
}
} else {
if ($action == 'createCollection') {
self::$model->{$action}($_GET['collection']);
} else {
if ($action == 'renameCollection' && isset($_POST['collectionto']) && $_POST['collectionto'] != $_POST['collectionfrom']) {
self::$model->{$action}($_POST['collectionfrom'], $_POST['collectionto']);
$_GET['collection'] = $_POST['collectionto'];
$action = 'listRows';
}
}
}
if (isset($_GET['sort'])) {
self::$model->sort = array($_GET['sort'] => $_GET['sortdir']);
}
$this->mongo['listCollections'] = self::$model->listCollections();
if ($action == 'editObject') {
$this->mongo[$action] = isset($_GET['_id']) ? self::$model->{$action}($_GET['collection'], $_GET['_id'], $_GET['idtype']) : '';
return;
} else {
if ($action == 'removeObject') {
self::$model->{$action}($_GET['collection'], $_GET['_id'], $_GET['idtype']);
return $this->_dumpFormVals();
} else {
if ($action == 'ensureIndex') {
foreach ($_GET['index'] as $key => $field) {
$indexes[$field] = isset($_GET['isdescending'][$key]) && $_GET['isdescending'][$key] ? -1 : 1;
}
self::$model->{$action}($_GET['collection'], $indexes, $_GET['unique'] == 'Unique' ? array('unique' => true) : array());
$action = 'listCollections';
} else {
if ($action == 'deleteIndex') {
self::$model->{$action}($_GET['collection'], unserialize($_GET['index']));
return $this->_dumpFormVals();
} else {
if ($action == 'getStats') {
$this->mongo[$action] = self::$model->{$action}();
unset($this->mongo['listCollections']);
} else {
if ($action == 'repairDb' || $action == 'getStats') {
$this->mongo[$action] = self::$model->{$action}();
$action = 'listCollections';
} else {
if ($action == 'dropDb') {
self::$model->{$action}();
load::redirect(get::url());
return;
}
}
}
}
}
}
}
if (isset($_GET['collection']) && $action != 'listCollections' && method_exists(self::$model, $action)) {
$this->mongo[$action] = self::$model->{$action}($_GET['collection']);
$this->mongo['count'] = self::$model->count;
$this->mongo['colKeys'] = self::$model->colKeys;
}
if ($action == 'listRows') {
$this->mongo['listIndexes'] = self::$model->listIndexes($_GET['collection']);
} else {
if ($action == 'dropCollection') {
return load::redirect(get::url() . '?db=' . urlencode($_GET['db']));
}
}
}