本文整理汇总了PHP中zula_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP zula_redirect函数的具体用法?PHP zula_redirect怎么用?PHP zula_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zula_redirect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* Magic method allowing for shorter URLs. This attempts
* to install the provided module name.
*
* @param string $name
* @param array $args
* @return string
*/
public function __call($name, array $args)
{
$this->setTitle(t('Module installation'));
$this->setOutputType(self::_OT_CONFIG);
// Get correct module name to install
try {
$name = substr($name, 0, -7);
$module = new Module($name);
$result = $module->install();
if ($result === true) {
$this->_event->success(sprintf('Module "%s" installed successfully, please check permissions', $module->name));
return zula_redirect($this->_router->makeUrl('module_manager', 'permission', $module->name));
} else {
if ($result === false) {
$this->_event->error(sprintf('Module "%s" is not installable', $module->name));
} else {
// Some dependency checks failed
$this->setTitle(t('Module dependencies not satisfied'));
$view = $this->loadView('install/failed.html');
$result['module_name'] = $module->name;
$view->assign($result);
return $view->getOutput();
}
}
} catch (Router_ArgNoExist $e) {
$this->_event->error(t('Please provide a module name to install'));
} catch (Module_NoExist $e) {
$this->_event->error(sprintf(t('Module "%1$s" does not exist'), $name));
}
return zula_redirect($this->_router->makeUrl('module_manager', 'install'));
}
开发者ID:jinshana,项目名称:tangocms,代码行数:39,代码来源:install.php
示例2: indexSection
/**
* Places a vote on a poll if the user has permission
*
* @return bool
*/
public function indexSection()
{
try {
$oid = $this->_input->post('poll/oid');
$option = $this->_model()->getOption($oid);
$poll = $this->_model()->getPoll($option['poll_id']);
// Check user has permission
$aclResource = 'poll-' . $poll['id'];
if (!$this->_acl->resourceExists($aclResource) || !$this->_acl->check($aclResource)) {
throw new Module_NoPermission();
} else {
if ($this->isClosed($poll)) {
$this->_event->error(t('Sorry, the poll is now closed'));
} else {
if ($this->hasUserVoted($this->_model()->getPollVotes($poll['id']))) {
$this->_event->error(t('Sorry, you have already voted'));
} else {
$this->_model()->vote($option['id']);
$this->_event->success(t('Your vote has been placed!'));
}
}
}
return zula_redirect($this->_router->makeUrl('poll', 'view', $poll['id']));
} catch (Input_KeyNoExist $e) {
$this->_event->error(t('No option selected'));
} catch (Poll_OptionNoExist $e) {
$this->_event->error(t('Invalid option selected'));
} catch (Poll_NoExist $e) {
$this->_event->error(t('Poll does not exist'));
}
return zula_redirect($_SESSION['previous_url']);
}
开发者ID:jinshana,项目名称:tangocms,代码行数:37,代码来源:vote.php
示例3: indexSection
/**
* Display some RSS options, and a list of the current feeds
*
* @return string
*/
public function indexSection()
{
if (!$this->_acl->check('rss_edit')) {
throw new Module_NoPermission();
}
$this->setTitle(t('RSS configuration'));
$this->setOutputType(self::_OT_CONFIG);
/**
* Prepare form validation
*/
$form = new View_Form('config/main.html', 'rss');
$form->addElement('rss/global', (bool) $this->_config->get('rss/global_agg_enable'), t('Global aggregation'), new Validator_Bool());
$form->addElement('rss/default', $this->_config->get('rss/default_feed'), t('Default feed'), new Validator_Alphanumeric('_-'));
$form->addElement('rss/items', $this->_config->get('rss/items_per_feed'), t('Number of items'), new Validator_Numeric());
if ($form->hasInput() && $form->isValid()) {
$fd = $form->getValues('rss');
// Check default feed given is valid
if ($fd['default'] != 0 && !in_array($fd['default'], array_keys($this->feeds))) {
$this->_event->error(t('Please select a valid default RSS feed.'));
} else {
$this->_config_sql->update(array('rss/global_agg_enable', 'rss/items_per_feed', 'rss/default_feed'), array($fd['global'], $fd['items'], $fd['default']));
$this->_event->success(t('Updated RSS configuration'));
return zula_redirect($this->_router->makeUrl('rss', 'config'));
}
}
// Add additional data
$form->assign(array('RSS_FEEDS' => $this->feeds));
return $form->getOutput();
}
开发者ID:jinshana,项目名称:tangocms,代码行数:34,代码来源:config.php
示例4: indexSection
/**
* Security check to ensure only those authorized can perform
* the upgrade. This is skiped when using CLI
*
* @return string
*/
public function indexSection()
{
$this->setTitle(t('Security check'));
if ($this->_zula->getMode() == 'cli') {
return zula_redirect($this->_router->makeUrl('upgrade', 'checks'));
} else {
if (!isset($_SESSION['upgradeStage']) || $_SESSION['upgradeStage'] !== 2) {
return zula_redirect($this->_router->makeUrl('upgrade', 'version'));
}
}
if (!empty($_SESSION['securityCode'])) {
// We've got a security code, see if the file exists
$file = $this->_zula->getDir('setup') . '/' . $_SESSION['securityCode'] . '.txt';
if (file_exists($file)) {
unset($_SESSION['securityCode']);
++$_SESSION['upgradeStage'];
return zula_redirect($this->_router->makeUrl('upgrade', 'checks'));
} else {
$this->_event->error(sprintf(t('Verification file "%s" does not exist'), $file));
}
}
if (!isset($_SESSION['securityCode'])) {
$_SESSION['securityCode'] = uniqid('zula_verify_');
}
$view = $this->loadView('security.html');
$view->assign(array('code' => $_SESSION['securityCode']));
return $view->getOutput();
}
开发者ID:jinshana,项目名称:tangocms,代码行数:34,代码来源:security.php
示例5: indexSection
/**
* Shows a list of enabled and disabled sites
*
* @return string
*/
public function indexSection()
{
if (!$this->_acl->check('shareable_manage')) {
throw new Module_NoPermission();
}
$this->setTitle(t('Shareable configuration'));
$this->setOutputType(self::_OT_CONFIG);
// Get sites
$sites = $this->_model()->getSites();
$siteCount = count($sites);
// Build form with validation
$form = new View_form('config/manage.html', 'shareable');
$form->addElement('shareable/order', null, t('Order'), new Validator_Length($siteCount));
$form->addElement('shareable/enabled', null, t('Enabled'), new Validator_Length(0, $siteCount), false);
if ($form->hasInput() && $form->isValid()) {
try {
$enabledSites = $form->getValues('shareable/enabled');
} catch (View_FormValueNoExist $e) {
$enabledSites = array();
}
$editData = array();
foreach ($form->getValues('shareable/order') as $key => $val) {
$editData[$key] = array('order' => abs($val), 'disabled' => !in_array($key, $enabledSites));
}
$this->_model()->edit($editData);
$this->_event->success(t('Updated config'));
return zula_redirect($this->_router->makeUrl('shareable', 'config'));
}
$this->_theme->addJsFile('jQuery/plugins/dnd.js');
$this->addAsset('js/dnd_order.js');
$form->assign(array('sites' => $sites));
return $form->getOutput();
}
开发者ID:jinshana,项目名称:tangocms,代码行数:38,代码来源:config.php
示例6: indexSection
/**
* Posts a new comment for a given request path, if it
* is valid. Once done it will return back to the URL
*
* @return bool|string
*/
public function indexSection()
{
$this->setTitle(t('Post comment'));
if (!$this->_acl->check('comments_post')) {
throw new Module_NoPermission();
}
// Check request path hash
try {
$hashPath = $this->_input->post('comments/hash');
if (isset($_SESSION['mod']['comments'][$hashPath])) {
$requestPath = $_SESSION['mod']['comments'][$hashPath]['path'];
$siteType = $_SESSION['mod']['comments'][$hashPath]['siteType'];
} else {
throw new Exception();
}
} catch (Exception $e) {
if (empty($_SESSION['previous_url'])) {
$_SESSION['previous_url'] = $this->_router->getBaseUrl();
}
$this->_event->error(t('Unable to post comment'));
return zula_redirect($_SESSION['previous_url']);
}
// Build and validate form
$isGuest = $this->_session->isLoggedIn() == false;
$form = new View_form('form.html', 'comments');
$form->antispam(true);
$form->addElement('comments/hash', $hashPath, 'hash path', new Validator_Alphanumeric());
$form->addElement('comments/name', null, t('Name'), new Validator_Length(0, 255), $isGuest);
$form->addElement('comments/website', null, t('Website'), new Validator_Url(false), false);
$form->addElement('comments/body', null, t('Message'), new Validator_Length(10, 4096));
if ($form->hasInput() && $form->isValid()) {
$fd = $form->getValues('comments');
if ($isGuest == false) {
$fd['name'] = '';
# Registered users will have their own details used
}
try {
$commentId = $this->_model()->add($requestPath, $fd['body'], $fd['name'], $fd['website']);
// Redirect back to correct place
if ($siteType != $this->_router->getDefaultSiteType()) {
$requestPath = $siteType . '/' . $requestPath;
}
$url = $this->_router->makeUrl($requestPath);
if ($this->_config->get('comments/moderate')) {
$this->_event->success(t('Comment is now in the moderation queue'));
} else {
$this->_event->success(t('Added new comment'));
$url->fragment('comment-' . $commentId);
}
return zula_redirect($url);
} catch (Exception $e) {
$this->_event->error($e->getMessage());
}
}
$this->_session->storePrevious(false);
# Don't store this URL as previous
return $form->getOutput();
}
开发者ID:jinshana,项目名称:tangocms,代码行数:64,代码来源:post.php
示例7: indexSection
/**
* Displays the upgrade successful message
*
* @return string
*/
public function indexSection()
{
$this->setTitle(t('Upgrade complete!'));
if (!isset($_SESSION['upgradeStage']) || $_SESSION['upgradeStage'] !== 5) {
return zula_redirect($this->_router->makeUrl('upgrade', 'version'));
} else {
$view = $this->loadView('complete.html');
$view->assign(array('project_version' => $_SESSION['project_version']));
return $view->getOutput();
}
}
开发者ID:jinshana,项目名称:tangocms,代码行数:16,代码来源:complete.php
示例8: indexSection
/**
* Shows form for editing an existing comment
*
* @param int $commentId
* @return bool|string
*/
public function indexSection($commentId = null)
{
$this->setTitle(t('Edit comment'));
// Check if we are editing 'inline' or via the main config cntrlr
if ($this->_router->hasArgument('inline') || $this->_input->has('post', 'comments_inline')) {
$editInline = true;
} else {
$editInline = false;
$this->setPageLinks(array(t('Manage comments') => $this->_router->makeUrl('comments', 'config'), t('Settings') => $this->_router->makeUrl('comments', 'config', 'settings')));
}
try {
if ($commentId === null) {
$commentId = $this->_input->post('comments/id');
}
$comment = $this->_model()->getDetails($commentId);
} catch (Comments_NoExist $e) {
$this->_event->error(t('Unable to edit comment as it does not exist'));
$url = $editInline ? $this->_router->getBaseUrl() : $this->_router->makeUrl('comments', 'config');
return zula_redirect($url);
}
if (($comment['user_id'] == Ugmanager::_GUEST_ID || $comment['user_id'] != $this->_session->getUserId()) && !$this->_acl->check('comments_manage')) {
throw new Module_NoPermission();
}
// Build form and validation
$form = new View_form('edit.html', 'comments', false);
$form->addElement('comments/id', $comment['id'], 'ID', new Validator_Int());
$form->addElement('comments/website', $comment['website'], t('Website'), new Validator_Url(false), false);
$form->addElement('comments/body', $comment['body'], t('Message'), new Validator_Length(10, 4096));
if ($form->hasInput() && $form->isValid()) {
$fd = $form->getValues('comments');
unset($fd['id']);
try {
$commentId = $this->_model()->edit($comment['id'], $fd);
$this->_event->success(sprintf(t('Edited comment #%1$d'), $comment['id']));
if ($editInline === false) {
return zula_redirect($this->_router->makeUrl('comments', 'config'));
} else {
if ($this->_router->getSiteType() != $this->_router->getDefaultSiteType()) {
$comment['url'] = $this->_router->getSiteType() . '/' . $comment['url'];
}
return zula_redirect($this->_router->makeUrl($comment['url'])->fragment('comment-' . $comment['id']));
}
} catch (Exception $e) {
$this->_event->error($e->getMessage());
}
}
$form->assign(array('edit_inline' => $editInline));
return $form->getOutput();
}
开发者ID:jinshana,项目名称:tangocms,代码行数:55,代码来源:edit.php
示例9: indexSection
/**
* Displays a simple message saying the installation is complete
*
* @return string
*/
public function indexSection()
{
$this->setTitle(t('Installation complete!'));
if ($this->_zula->getMode() == 'cli') {
$this->_event->success(t('Installation complete'));
return true;
} else {
if (!isset($_SESSION['installStage']) || $_SESSION['installStage'] !== 6) {
return zula_redirect($this->_router->makeUrl('install', 'checks'));
} else {
$view = $this->loadView('complete.html');
return $view->getOutput();
}
}
}
开发者ID:jinshana,项目名称:tangocms,代码行数:20,代码来源:complete.php
示例10: indexSection
/**
* Installs all available modules
*
* @return bool
*/
public function indexSection()
{
$this->setTitle(t('Module installation'));
if ($this->_zula->getMode() != 'cli' && (!isset($_SESSION['installStage']) || $_SESSION['installStage'] !== 4)) {
return zula_redirect($this->_router->makeUrl('install', 'checks'));
}
Module::setDirectory(_REAL_MODULE_DIR);
foreach (Module::getModules(Module::_INSTALLABLE) as $modname) {
$module = new Module($modname);
$module->install();
}
$this->setProjectDefaults();
Module::setDirectory($this->_zula->getDir('modules'));
if (isset($_SESSION['installStage'])) {
++$_SESSION['installStage'];
}
$this->_event->success(t('Installed all available modules'));
return zula_redirect($this->_router->makeUrl('install', 'settings'));
}
开发者ID:jinshana,项目名称:tangocms,代码行数:24,代码来源:modules.php
示例11: indexSection
/**
* Check the environment the installer is running in to
* ensure all required PHP extensions exist and the needed
* files/directories are writable
*
* @return bool|string
*/
public function indexSection()
{
$this->setTitle(t('Pre-installation checks'));
$checks = array('exts' => array('title' => t('Required PHP extensions'), 'passed' => false, 'values' => array('ctype', 'date', 'dom', 'filter', 'hash', 'pdo', 'pdo_mysql', 'pcre', 'session', 'json')), 'optExts' => array('title' => t('Optional PHP extensions'), 'passed' => true, 'values' => array('gd', 'FileInfo')), 'files' => array('title' => t('Writable files'), 'passed' => false, 'values' => array($this->_zula->getDir('config') . '/config.ini.php', $this->_zula->getDir('config') . '/layouts/admin-default.xml', $this->_zula->getDir('config') . '/layouts/main-default.xml', $this->_zula->getDir('config') . '/layouts/fpsc-admin.xml', $this->_zula->getDir('config') . '/layouts/fpsc-main.xml')), 'dirs' => array('title' => t('Writable directories'), 'passed' => false, 'values' => array($this->_zula->getDir('config') . '/layouts', $this->_zula->getDir('logs'), $this->_zula->getDir('tmp'), $this->_zula->getDir('uploads'), $this->_zula->getDir('locale'))));
// Run the various checks
$passed = true;
foreach ($checks as $name => $details) {
$results = array();
foreach ($details['values'] as $val) {
switch ($name) {
case 'exts':
case 'optExts':
$results[$val] = extension_loaded($val);
break;
case 'files':
case 'dirs':
$results[$val] = zula_is_writable($val);
}
}
if ($name != 'optExts' && in_array(false, $results, true)) {
$passed = false;
$checks[$name]['passed'] = false;
} else {
$checks[$name]['passed'] = true;
}
$checks[$name]['values'] = $results;
}
if ($passed) {
if ($this->_zula->getMode() !== 'cli') {
$_SESSION['installStage'] = 2;
}
$this->_event->success(t('Pre-installation checks were successful'));
return zula_redirect($this->_router->makeUrl('install', 'sql'));
} else {
if ($this->_zula->getMode() == 'cli') {
$this->_zula->setExitCode(3);
}
$this->_event->error(t('Sorry, your server environment does not meet our requirements'));
$view = $this->loadView('checks' . ($this->_zula->getMode() == 'cli' ? '-cli.txt' : '.html'));
$view->assign(array('checks' => $checks, 'passed' => $passed));
return $view->getOutput();
}
}
开发者ID:jinshana,项目名称:tangocms,代码行数:50,代码来源:checks.php
示例12: indexSection
/**
* Check if the currently installed version is supported
* by this upgrader
*
* @return bool|string
*/
public function indexSection()
{
$_SESSION['upgradeStage'] = 1;
if (Registry::has('sql') && in_array(_PROJECT_VERSION, $this->supportedVersions)) {
if (isset($_SESSION['upgradeStage'])) {
++$_SESSION['upgradeStage'];
}
$_SESSION['project_version'] = _PROJECT_VERSION;
// Set the event and redirect to next stage
$langStr = t('Found version "%1$s" and will upgrade to "%2$s"');
$this->_event->success(sprintf($langStr, _PROJECT_VERSION, _PROJECT_LATEST_VERSION));
return zula_redirect($this->_router->makeUrl('upgrade', 'security'));
}
$langStr = t('Version %s is not supported by this upgrader');
$this->_event->error(sprintf($langStr, _PROJECT_VERSION));
if ($this->_zula->getMode() == 'cli') {
$this->_zula->setExitCode(3);
return false;
} else {
return zula_redirect($this->_router->makeUrl('index'));
}
}
开发者ID:jinshana,项目名称:tangocms,代码行数:28,代码来源:version.php
示例13: __call
/**
* Displays form for attaching a module to the provied
* layout name.
*
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, $args)
{
$this->setTitle(t('Attach new module'));
$this->setOutputType(self::_OT_CONFIG);
if (!$this->_acl->check('content_layout_attach_module')) {
throw new Module_NoPermission();
}
/**
* Create the layout object and get all sectors from the theme of
* the site type of this layout
*/
$layout = new Layout(substr($name, 0, -7));
$siteType = substr($layout->getName(), 0, strpos($layout->getName(), '-'));
$theme = new Theme($this->_config->get('theme/' . $siteType . '_default'));
// Build the form with validation
$form = new View_form('attach/attach.html', 'content_layout');
$form->action($this->_router->makeUrl('content_layout', 'attach', $layout->getName()));
$form->addElement('content_layout/module', null, t('Module'), new Validator_InArray(Module::getModules()));
$form->addElement('content_layout/sector', null, t('Sector'), new Validator_InArray(array_keys($theme->getSectors())));
if ($form->hasInput() && $form->isValid()) {
$fd = $form->getValues('content_layout');
// Attach the new module to the correct sector
try {
$cntrlrId = $layout->addController($fd['sector'], array('mod' => $fd['module']));
if ($layout->save()) {
$this->_event->success(t('Successfully added module'));
return zula_redirect($this->_router->makeUrl('content_layout', 'edit', $layout->getName(), null, array('id' => $cntrlrId)));
} else {
$this->_event->error(t('Unable to save content layout file'));
}
} catch (Theme_SectorNoExist $e) {
$this->_event->error(sprintf(t('Unable to attach module. Sector "%s" does not exist'), $fd['sector']));
}
}
// Assign additional data
$form->assign(array('SECTORS' => $theme->getSectors(), 'LAYOUT' => $layout->getName()));
return $form->getOutput();
}
开发者ID:jinshana,项目名称:tangocms,代码行数:46,代码来源:attach.php
示例14: indexSection
/**
* Update common basic settings so a user doesn't forget
* to change them after installation.
*
* @return bool|string
*/
public function indexSection()
{
$this->setTitle(t('Basic configuration'));
if ($this->_zula->getMode() != 'cli' && (!isset($_SESSION['installStage']) || $_SESSION['installStage'] !== 5)) {
return zula_redirect($this->_router->makeUrl('install', 'checks'));
}
// Get data from either a form or CLI arguments
if ($this->_zula->getMode() == 'cli') {
$title = $this->_input->cli('t');
$email = $this->_input->cli('e');
$data = array('config' => array('title' => $title), 'mail' => array('outgoing' => $email, 'incoming' => $email));
} else {
$form = new View_form('settings.html', 'install');
$form->addElement('settings/config/title', null, t('Site title'), new Validator_Length(0, 255));
$form->addElement('settings/meta/description', null, t('Meta description'), new Validator_Length(0, 255));
$form->addElement('settings/mail/outgoing', null, t('Outgoing email'), new Validator_Email());
$form->addElement('settings/mail/incoming', null, t('Incoming email'), new Validator_Email());
$form->addElement('settings/mail/subject_prefix', true, t('Email prefix'), new Validator_Bool());
if ($form->hasInput() && $form->isValid()) {
$data = $form->getValues('settings');
} else {
return $form->getOutput();
}
}
foreach ($data as $confRealm => $confValues) {
foreach ($confValues as $key => $val) {
$this->_config_sql->update($confRealm . '/' . $key, $val);
}
}
// Update scheme/protocol that is being used
$this->_config_sql->add('config/protocol', $this->_router->getScheme());
if (isset($_SESSION['installStage'])) {
++$_SESSION['installStage'];
}
$this->_event->success(t('Basic configuration updated'));
return zula_redirect($this->_router->makeUrl('install', 'complete'));
}
开发者ID:jinshana,项目名称:tangocms,代码行数:43,代码来源:settings.php
示例15: __call
/**
* Magic method allows for shorter URL by providing the
* contact form ID
*
* @param string $name
* @param array $args
* @return string|bool
*/
public function __call($name, array $args)
{
if (!$this->inSector('SC')) {
return false;
}
$id = substr($name, 0, -7);
if ($id == 'index') {
// Select the latest contact form and display that
$pdoSt = $this->_sql->query('SELECT identifier FROM {PREFIX}mod_contact
ORDER BY id LIMIT 1');
} else {
// Change the ID into the identifier
$pdoSt = $this->_sql->prepare('SELECT identifier FROM {PREFIX}mod_contact
WHERE id = :id');
$pdoSt->bindValue(':id', $id, PDO::PARAM_INT);
$pdoSt->execute();
}
$identifier = $pdoSt->fetch(PDO::FETCH_COLUMN);
$pdoSt->closeCursor();
if ($identifier == false) {
throw new Module_ControllerNoExist();
}
return zula_redirect($this->_router->makeUrl('contact', 'form', $identifier));
}
开发者ID:jinshana,项目名称:tangocms,代码行数:32,代码来源:index.php
示例16: indexSection
/**
* Add the first user which will be created in the special
* 'root' group.
*
* @return bool|string
*/
public function indexSection()
{
$this->setTitle(t('First user'));
if ($this->_zula->getMode() != 'cli' && (!isset($_SESSION['installStage']) || $_SESSION['installStage'] !== 3)) {
return zula_redirect($this->_router->makeUrl('install', 'checks'));
}
// Get data from either a form or CLI arguments
if ($this->_zula->getMode() == 'cli') {
$data = array('username' => $this->_input->cli('u'), 'password' => $this->_input->cli('p'), 'email' => $this->_input->cli('e'));
} else {
$form = new View_Form('user.html', 'install');
$form->addElement('username', null, t('Username'), array(new Validator_Alphanumeric('_-'), new Validator_Length(2, 32)));
$form->addElement('password', null, t('Password'), array(new Validator_Length(4, 32), new Validator_Confirm('password2', Validator_Confirm::_POST)));
$form->addElement('email', null, t('Email'), array(new Validator_Email(), new Validator_Confirm('email2', Validator_Confirm::_POST)));
if ($form->hasInput() && $form->isValid()) {
$data = $form->getValues();
} else {
return $form->getOutput();
}
}
if (strcasecmp($data['username'], 'guest') === 0) {
$this->_event->error(t('Username of "guest" is invalid'));
if (isset($form)) {
return $form->getOutput();
} else {
$this->_zula->setExitCode(3);
return false;
}
}
$this->_ugmanager->editUser(2, $data);
if (isset($_SESSION['installStage'])) {
++$_SESSION['installStage'];
}
$this->_event->success(t('First user has been created'));
return zula_redirect($this->_router->makeUrl('install', 'modules'));
}
开发者ID:jinshana,项目名称:tangocms,代码行数:42,代码来源:user.php
示例17: indexSection
/**
* Pre-upgrade checks to ensure the environment is how we
* require it.
*
* @return bool|string
*/
public function indexSection()
{
$this->setTitle(t('Pre-upgrade checks'));
if ($this->_zula->getMode() != 'cli' && (!isset($_SESSION['upgradeStage']) || $_SESSION['upgradeStage'] !== 3)) {
return zula_redirect($this->_router->makeUrl('upgrade', 'version'));
}
/**
* All the checks that need to be run, and then actualy run the needed checks
*/
$tests = array('files' => array($this->_zula->getConfigPath() => ''), 'dirs' => array($this->_zula->getDir('config') => ''));
$passed = true;
foreach ($tests as $type => &$items) {
foreach ($items as $itemName => $status) {
$writable = zula_is_writable($itemName);
$items[$itemName] = $writable;
if ($writable === false) {
$passed = false;
}
}
}
if ($passed) {
if (isset($_SESSION['upgradeStage'])) {
++$_SESSION['upgradeStage'];
}
$this->_event->success(t('Pre-upgrade checks were successful'));
return zula_redirect($this->_router->makeUrl('upgrade', 'migrate'));
} else {
if ($this->_zula->getMode() == 'cli') {
$this->_zula->setExitCode(3);
}
$this->_event->error(t('Sorry, your server environment does not meet our requirements'));
$view = $this->loadView('checks' . ($this->_zula->getMode() == 'cli' ? '-cli.txt' : '.html'));
$view->assign(array('file_results' => $tests['files'], 'dir_results' => $tests['dirs'], 'passed' => $passed));
return $view->getOutput();
}
}
开发者ID:jinshana,项目名称:tangocms,代码行数:42,代码来源:checks.php
示例18: hookRouterPreParse
/**
* 'router_pre_parse' Hook
*
* @param string $url
* @return string
*/
public function hookRouterPreParse($url)
{
$resolvedUrl = trim($url, '/ ');
do {
$break = false;
if (isset($this->aliases[$resolvedUrl])) {
$redirect = $this->aliases[$resolvedUrl]['redirect'];
$resolvedUrl = $this->aliases[$resolvedUrl]['url'];
} else {
$break = true;
}
} while ($break === false && $url !== $resolvedUrl);
if (!empty($redirect) && $url != $resolvedUrl) {
if (zula_url_has_scheme($resolvedUrl)) {
$url = $resolvedUrl;
} else {
// Don't use makeFullUrl since that will re-alias this URL!
$url = $this->_router->getBaseUrl();
if ($this->_router->getType() == 'standard') {
$url .= 'index.php?url=';
}
$url .= $resolvedUrl;
}
zula_redirect($url);
die;
# Eww, but needed.
}
return $resolvedUrl;
}
开发者ID:jinshana,项目名称:tangocms,代码行数:35,代码来源:listeners.php
示例19: logoutSection
/**
* Logs the user out and then will zula_redirect back to the
* appropiate page (normally the previous URL) or the
* session index controller
*
* @return void
*/
public function logoutSection()
{
if (empty($_SESSION['previous_url'])) {
$url = $this->_router->makeFullUrl('/');
} else {
$url = $_SESSION['previous_url'];
}
$this->_session->destroy();
return zula_redirect($url);
}
开发者ID:jinshana,项目名称:tangocms,代码行数:17,代码来源:index.php
示例20: settingsSection
/**
* Change settings regarding themeing and style
*
* @return string
*/
public function settingsSection()
{
$this->setTitle(t('Theme settings'));
$this->setOutputType(self::_OT_CONFIG);
// Prepare form validation
$form = new View_Form('settings.html', 'theme');
$form->addElement('theme/allow_user_override', $this->_config->get('theme/allow_user_override'), t('Allow user override'), new Validator_Bool());
if ($form->hasInput() && $form->isValid()) {
$allowOverride = $form->getValues('theme/allow_user_override');
try {
$this->_config_sql->update('theme/allow_user_override', $allowOverride);
} catch (Config_KeyNoExist $e) {
$this->_config_sql->add('theme/allow_user_override', $allowOverride);
}
$this->_event->success(t('Updated theme settings'));
return zula_redirect($this->_router->makeUrl('theme', 'index', 'settings'));
}
return $form->getOutput();
}
开发者ID:jinshana,项目名称:tangocms,代码行数:24,代码来源:index.php
注:本文中的zula_redirect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论