当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP::RedirectLocal方法代码示例

本文整理汇总了PHP中HTTP::RedirectLocal方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::RedirectLocal方法的具体用法?PHP HTTP::RedirectLocal怎么用?PHP HTTP::RedirectLocal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTP的用法示例。


在下文中一共展示了HTTP::RedirectLocal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Logout

 function Logout()
 {
     if (Cookie::Delete('id')) {
         HTTP::RedirectLocal();
         return true;
     } else {
         return false;
     }
 }
开发者ID:etienne,项目名称:jam,代码行数:9,代码来源:User.php

示例2: PagesViewController

 function PagesViewController()
 {
     if ($_GET['m'] == 'updated') {
         HTTP::RedirectLocal('merci');
         return false;
     }
     $this->view['form'] = $this->GetForm();
     $themes = Module::GetNewModule('themes');
     $queryParams = array('fields' => 'titreCourt', 'orderby' => 'sortIndex');
     $themes->FetchItems($queryParams);
     $this->view['themes'] = $themes->items;
 }
开发者ID:noix,项目名称:qsprog,代码行数:12,代码来源:ContributionsModule.php

示例3:

<?php

if ($_GET['m'] == 'updated') {
    HTTP::RedirectLocal('merci');
}
$_JAG['snippets']['titre'] = "Formulaire de participation";
开发者ID:noix,项目名称:programme,代码行数:6,代码来源:init.php

示例4: AdminListViewController

 function AdminListViewController()
 {
     global $_JAM;
     if (!($fields = $this->nestedModule->config['adminListFields'])) {
         foreach ($this->nestedModule->schema as $name => $info) {
             if (!$_JAM->moduleFields[$name] && !$_JAM->versionsSupportFields[$name]) {
                 $fields[] = $name;
             }
         }
     }
     // Add sortIndex field if we require it
     if ($this->nestedModule->config['allowSort']) {
         array_unshift($fields, 'sortIndex');
     }
     // Link will be on first field; we do this before adding sortIndex because we never want the link on sortIndex (FIXME, FAUX)
     $this->nestedModule->view['linkField'] = reset($fields);
     foreach ($fields as $field) {
         if ($relatedArray = $this->nestedModule->GetRelatedArray($field)) {
             $this->nestedModule->view['relatedArrays'][$field] = $relatedArray;
         }
     }
     $queryParams['fields'] = $fields;
     $this->nestedModule->view['tableFields'] = $fields;
     // Determine header strings
     foreach ($fields as $field) {
         // Look for string in module strings
         if (!($string = $this->nestedModule->strings['fields'][$field])) {
             // Look for string in global strings
             if (!($string = $_JAM->strings['fields'][$field])) {
                 // Use raw field name if all else fails
                 $string = $field;
             }
         }
         $this->nestedModule->view['headerStrings'][$field] = $string;
     }
     // Determine sort order
     $requestedSortField = $_GET['s'] ? $_GET['s'] : $this->nestedModule->config['adminListSortBy'];
     if ($this->nestedModule->schema[$requestedSortField] && in_array($requestedSortField, $fields)) {
         $sortField = $requestedSortField;
     } else {
         // If no sorting was requested, use first field
         $sortField = reset($fields);
     }
     // Determine type of sort field
     $this->nestedModule->view['sortFieldType'] = $this->nestedModule->schema[$sortField]['type'];
     // Check whether sorting order should be reversed
     $reverseSort = $_GET['r'] ? 1 : 0;
     // Store sort parameters in template variables
     $this->nestedModule->view['sortField'] = $sortField;
     $this->nestedModule->view['reverseSort'] = $reverseSort;
     // Sort order is reversed for dates
     if ($this->nestedModule->schema[$sortField]['type'] == 'datetime') {
         $reverseSort = (int) (!$reverseSort);
     }
     // Modify query accordingly
     $sortOrder = $reverseSort ? 'DESC' : 'ASC';
     $queryParams['orderby'][] = $sortField . ' ' . $sortOrder;
     // Try to sort by sort index when allowSort is set
     if ($this->nestedModule->config['allowSort'] && $sortField != 'sortIndex') {
         $queryParams['orderby'][] = 'sortIndex ASC';
     }
     // Fetch data
     $this->nestedModule->FetchItems($queryParams);
     if ($this->nestedModule->items) {
         $editLinkPrefix = 'admin/' . $this->nestedModule->name . '?' . ($_GET['s'] ? 's=' . $_GET['s'] . '&amp;' : '') . ($_GET['r'] ? 'r=' . $_GET['r'] . '&amp;' : '') . 'a=edit&amp;id=';
         // Redirect to item if requested
         if ($_GET['prev'] || $_GET['next']) {
             $requestedID = $_GET['prev'] ? $_GET['prev'] : $_GET['next'];
             // Find primary key column name
             if ($this->nestedModule->config['keepVersions']) {
                 $primaryKey = 'master';
             } else {
                 $primaryKey = 'id';
             }
             // Find key for requested item in fetched items array
             foreach ($this->nestedModule->items as $key => $item) {
                 if ($item[$primaryKey] == $requestedID) {
                     $requestedKey = $key;
                     break;
                 }
             }
             // Find ID for requested item
             $previousAndNext = Arrays::GetAdjacentKeys($this->nestedModule->items, $requestedKey);
             if ($_GET['prev']) {
                 $redirectID = $this->nestedModule->items[$previousAndNext[0]][$primaryKey];
             }
             if ($_GET['next']) {
                 $redirectID = $this->nestedModule->items[$previousAndNext[1]][$primaryKey];
             }
             // Redirect to requested item
             if ($redirectID) {
                 // Change "&amp;" to "&"; slightly kludgy
                 $cleanLink = html_entity_decode($editLinkPrefix . $redirectID);
                 // Add mode if one was supplied (kludgy)
                 if ($_GET['mode']) {
                     $cleanLink .= '&mode=' . $_GET['mode'];
                 }
                 HTTP::RedirectLocal($cleanLink);
             }
         }
//.........这里部分代码省略.........
开发者ID:etienne,项目名称:jam,代码行数:101,代码来源:adminModule.php

示例5: FirstRun

 function FirstRun()
 {
     // Load table structure for required tables
     $tables = IniFile::Parse('engine/database/tables.ini', true);
     // Create tables
     foreach ($tables as $name => $schema) {
         if (!Database::CreateTable($name, $schema)) {
             trigger_error("Couldn't create table " . $name, E_USER_ERROR);
         }
     }
     // Manually add admin module to _modules table
     if (Query::TableIsEmpty('_modules')) {
         $adminModule = array('name' => 'admin');
         if (!Database::Insert('_modules', $adminModule)) {
             trigger_error("Couldn't install core modules", E_USER_ERROR);
         }
     }
     // Install required modules
     $requiredModules = array('users', 'files');
     foreach ($requiredModules as $moduleName) {
         $module = Module::GetNewModule($moduleName);
         $module->Install();
     }
     // Add default admin user
     if (Query::TableIsEmpty('users')) {
         $adminUserParams = array('created' => $this->databaseTime, 'login' => 'admin', 'name' => 'Admin', 'password' => 'admin', 'status' => 3);
         if (!Database::Insert('users', $adminUserParams)) {
             trigger_error("Couldn't create admin user", E_USER_ERROR);
         }
     }
     // Add admin path
     $adminModuleId = Query::SingleValue('_modules', 'id', "name = 'admin'");
     if (!Path::Insert('admin', $adminModuleId, false)) {
         trigger_error("Couldn't add admin path", E_USER_ERROR);
     }
     // Redirect to admin interface
     HTTP::RedirectLocal('admin');
 }
开发者ID:etienne,项目名称:jam,代码行数:38,代码来源:Jam.php

示例6: ProcessData


//.........这里部分代码省略.........
                 }
                 // Keep ID of inserted item for path
                 $insertID = Database::GetLastInsertID();
             }
         } else {
             // Special update for tables with multiple versions support
             // Set item as current
             $insertData['current'] = true;
             // If we already have a creation date and one wasn't specified, use that
             if (!$insertData['created'] && $this->item['created']) {
                 $insertData['created'] = $this->item['created'];
             }
             if (!Database::Insert($this->name, $insertData)) {
                 trigger_error("Couldn't insert into module " . $this->name, E_USER_ERROR);
             } else {
                 // Keep ID of inserted item for path
                 $insertID = Database::GetLastInsertID();
                 // $this->postData now represents actual data
                 $this->LoadData($this->postData);
                 // Disable all other items with the same master
                 if ($insertData['master']) {
                     $updateParams['current'] = false;
                     $whereArray = array(array('master = ' . $insertData['master'], 'id = ' . $insertData['master']), 'id != ' . $insertID);
                     $where = Database::GetWhereString($whereArray);
                     if (!Database::Update($this->name, $updateParams, $where)) {
                         trigger_error("Couldn't update module " . $this->name, E_USER_ERROR);
                         return false;
                     }
                 }
             }
         }
     } else {
         // FIXME: Kuldgy. Added to make translations work.
         $insertID = $_GET['item'];
     }
     // Insert localized data
     if ($localizedData) {
         $tableName = $this->name . '_localized';
         $localizedData['item'] = $insertID;
         $localizedData['language'] = $this->postData['language'];
         $where = array('item = ' . $insertID, "language = '" . $localizedData['language'] . "'");
         if (Database::Update($tableName, $localizedData, $where)) {
             // Insert if no rows were affected
             if (Database::GetModifiedRows() == 0) {
                 if (Database::Insert($tableName, $localizedData)) {
                     $success = true;
                 } else {
                     trigger_error("Couldn't insert localized data for module " . $this->name, E_USER_ERROR);
                 }
             } else {
                 $success = true;
             }
             // Put data into module object to reflect changes in the database
             if ($success) {
                 $this->LoadData($localizedData);
             }
         } else {
             trigger_error("Couldn't update localized data for module " . $this->name, E_USER_ERROR);
             return false;
         }
     }
     if ($insertID) {
         // Update path
         $this->UpdatePath($insertID);
         // Get ID for this item
         $id = $_POST['master'] ? $_POST['master'] : $insertID;
         // Delete previous many-to-many relationships
         $where = array('frommodule = ' . $this->moduleID, 'fromid = ' . $insertID);
         if (!Database::DeleteFrom('_relationships', $where)) {
             trigger_error("Couldn't delete previous many-to-many relationships for module " . $this->name, E_USER_ERROR);
         }
         foreach ($this->schema as $name => $info) {
             switch ($info['type']) {
                 case 'multi':
                     // Insert many-to-many relationships
                     foreach ($this->postData[$name] as $targetID) {
                         // Insert each item into _relationships table
                         $targetModuleName = $info['relatedModule'];
                         $targetModuleID = array_search($targetModuleName, $_JAM->installedModules);
                         $params = array('frommodule' => $this->moduleID, 'fromid' => $insertID, 'tomodule' => $targetModuleID, 'toid' => $targetID);
                         if (!Database::Insert('_relationships', $params)) {
                             trigger_error("Couldn't insert many-to-many relationship for module " . $this->name, E_USER_ERROR);
                         }
                     }
                     break;
             }
         }
     }
     if (method_exists($this, 'PostProcessData')) {
         $this->PostProcessData($insertID);
     }
     // Check whether we need to redirect to a specific anchor
     $anchor = $this->config['redirectToAnchor'][$this->parentModule->name];
     // Reload page
     if ($_JAM->rootModuleName == 'admin' || !$this->config['postSubmitRedirect']) {
         HTTP::ReloadCurrentURL('?m=updated' . ($anchor ? '#' . $anchor : ''));
     } else {
         HTTP::RedirectLocal($this->config['postSubmitRedirect']);
     }
 }
开发者ID:noix,项目名称:qsprog,代码行数:101,代码来源:Module.php

示例7: trigger_error

        trigger_error("Couldn't create table " . $name, E_USER_ERROR);
    }
}
// Manually add admin module to _modules table
if (Query::TableIsEmpty('_modules')) {
    $adminModule = array('name' => 'admin');
    if (!Database::Insert('_modules', $adminModule)) {
        trigger_error("Couldn't install core modules", E_USER_ERROR);
    }
}
// Install required modules
$requiredModules = array('users', 'files');
foreach ($requiredModules as $moduleName) {
    $module = Module::GetNewModule($moduleName);
    $module->Install();
}
// Add default admin user
if (Query::TableIsEmpty('users')) {
    $adminUserParams = array('created' => $_JAM->databaseTime, 'login' => 'admin', 'name' => 'Admin', 'password' => 'admin', 'status' => 3);
    if (!Database::Insert('users', $adminUserParams)) {
        trigger_error("Couldn't create admin user", E_USER_ERROR);
    }
}
// Add admin path
$adminModuleId = Query::SingleValue('_modules', 'id', "name = 'admin'");
if (!Path::Insert('admin', $adminModuleId, false)) {
    trigger_error("Couldn't add admin path", E_USER_ERROR);
}
// Redirect to admin interface
HTTP::RedirectLocal('admin');
开发者ID:noix,项目名称:programme,代码行数:30,代码来源:firstrun.php

示例8: PagesViewController

 function PagesViewController()
 {
     if ($_GET['m'] == 'updated') {
         HTTP::RedirectLocal('merci');
         return false;
     }
     $this->view['form'] = $this->GetForm();
     // Add perspective specified as GET variable to form values
     $this->view['form']->LoadValue('perspective', $_GET['perspective']);
     $perspectives = Module::GetNewModule('perspectives');
     $queryParams = array('fields' => 'numero');
     $perspectives->FetchItems($queryParams);
     $this->view['perspectives'] = $perspectives->items;
     $themes = Module::GetNewModule('themes');
     $queryParams = array('orderby' => 'sortIndex');
     $themes->FetchItems($queryParams);
     $this->view['themes'] = $themes->items;
 }
开发者ID:noix,项目名称:programme,代码行数:18,代码来源:ContributionsModule.php


注:本文中的HTTP::RedirectLocal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。