本文整理汇总了PHP中Jaws_Header::Location方法的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_Header::Location方法的具体用法?PHP Jaws_Header::Location怎么用?PHP Jaws_Header::Location使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jaws_Header
的用法示例。
在下文中一共展示了Jaws_Header::Location方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ManageComments
/**
* Displays blog comments manager
*
* @access public
* @return string XHTML template content
*/
function ManageComments()
{
$this->gadget->CheckPermission('ManageComments');
if (!Jaws_Gadget::IsGadgetInstalled('Comments')) {
Jaws_Header::Location(BASE_SCRIPT . '?gadget=Blog');
}
$cHTML = Jaws_Gadget::getInstance('Comments')->action->loadAdmin('Comments');
return $cHTML->Comments($this->gadget->name, $this->MenuBar('ManageComments'));
}
示例2: Dashboard
/**
* Switch between dashboards
*
* @access public
* @return mixed Redirect if switched successfully otherwise content of 403 html status code
*/
function Dashboard()
{
if (!$GLOBALS['app']->Session->GetPermission('Users', 'AccessDashboard')) {
return Jaws_HTTPError::Get(403);
}
$layoutModel = $this->gadget->model->load('Layout');
$layoutModel->InitialLayout('Index.Dashboard');
Jaws_Header::Location('');
}
示例3: Execute
/**
* Event execute method
*
*/
function Execute($shouter, $code)
{
$reqURL = Jaws_Utils::getRequestURL(true);
$uModel = $this->gadget->model->loadAdmin('ErrorMaps');
$res = $uModel->GetHTTPError($reqURL, $code);
if (!Jaws_Error::IsError($res) && !empty($res) && ($res['code'] == 301 || $res['code'] == 302)) {
Jaws_Header::Location($res['url'], $res['code']);
}
return $res;
}
示例4: Dashboard
/**
* Switch between dashboards
*
* @access public
* @return mixed Redirect if switched successfully otherwise content of 403 html status code
*/
function Dashboard()
{
if (!$GLOBALS['app']->Session->GetPermission('Users', 'AccessDashboard')) {
return Jaws_HTTPError::Get(403);
}
//$user = jaws()->request->fetch('user');
$user = (int) $GLOBALS['app']->Session->GetAttribute('user');
$layoutModel = $this->gadget->model->load('Layout');
$layoutModel->DashboardSwitch($user);
Jaws_Header::Location('');
}
示例5: VCardBuild
/**
* Build and export data with VCard format
*
* @access public
* @return string HTML content with menu and menu items
*/
function VCardBuild()
{
if (!$GLOBALS['app']->Session->Logged()) {
return Jaws_HTTPError::Get(403);
}
require_once JAWS_PATH . 'gadgets/Addressbook/vCard.php';
$model = $this->gadget->model->load('AddressBook');
$agModel = $this->gadget->model->load('AddressBookGroup');
$user = (int) $GLOBALS['app']->Session->GetAttribute('user');
$ids = jaws()->request->fetch('adr:array');
$link = $this->gadget->urlMap('AddressBook', array(), true);
if (empty($ids)) {
Jaws_Header::Location($link);
return false;
}
$addressItems = $model->GetAddresses($ids, $user);
if (Jaws_Error::IsError($addressItems) || empty($addressItems)) {
return Jaws_HTTPError::Get(404);
}
$result = '';
$nVCard = array('LastName', 'FirstName', 'AdditionalNames', 'Prefixes', 'Suffixes');
foreach ($addressItems as $addressItem) {
$vCard = new vCard();
$names = explode(';', $addressItem['name']);
foreach ($names as $key => $name) {
$vCard->n($name, $nVCard[$key]);
}
$vCard->fn($names[3] . (trim($names[3]) == '' ? '' : ' ') . $names[1] . (trim($names[1]) == '' ? '' : ' ') . $names[0]);
$vCard->nickname($addressItem['nickname']);
$vCard->title($addressItem['title']);
$adrGroups = $agModel->GetGroupNames($addressItem['address_id'], $user);
$vCard->categories(implode(',', $adrGroups));
$this->FillVCardTypes($vCard, 'tel', $addressItem['tel_home'], $this->_TelTypes);
$this->FillVCardTypes($vCard, 'tel', $addressItem['tel_work'], $this->_TelTypes);
$this->FillVCardTypes($vCard, 'tel', $addressItem['tel_other'], $this->_TelTypes);
$this->FillVCardTypes($vCard, 'email', $addressItem['email_home'], $this->_EmailTypes);
$this->FillVCardTypes($vCard, 'email', $addressItem['email_work'], $this->_EmailTypes);
$this->FillVCardTypes($vCard, 'email', $addressItem['email_other'], $this->_EmailTypes);
$this->FillVCardTypes($vCard, 'adr', $addressItem['adr_home'], $this->_AdrTypes, '\\n');
$this->FillVCardTypes($vCard, 'adr', $addressItem['adr_work'], $this->_AdrTypes, '\\n');
$this->FillVCardTypes($vCard, 'adr', $addressItem['adr_other'], $this->_AdrTypes, '\\n');
$this->FillVCardTypes($vCard, 'url', $addressItem['url'], null, '\\n');
$vCard->note($addressItem['notes']);
$result = $result . $vCard;
}
header("Content-Disposition: attachment; filename=\"" . 'address.vcf' . "\"");
header("Content-type: application/csv");
header("Content-Length: " . strlen($result));
header("Pragma: no-cache");
header("Expires: 0");
header("Connection: close");
echo $result;
exit;
}
示例6: Link
/**
* Redirect to the URL and increase the clicks by one
*
* @access public
*/
function Link()
{
$lid = jaws()->request->fetch('id', 'get');
$lid = Jaws_XSS::defilter($lid);
$model = $this->gadget->model->load('Links');
$link = $model->GetLink($lid);
if (!Jaws_Error::IsError($link) && !empty($link)) {
$click = $model->Click($link['id']);
if (!Jaws_Error::IsError($click)) {
Jaws_Header::Location($link['url'], null, 301);
}
}
// By default, on the errors stay in the main page
Jaws_Header::Referrer();
}
示例7: CreateNote
/**
* Creates a new note
*
* @access public
* @return array Response array
*/
function CreateNote()
{
$data = jaws()->request->fetch(array('title', 'content'), 'post');
if (empty($data['title']) || empty($data['content'])) {
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_ERROR_INCOMPLETE_DATA'), 'Notepad.Response', RESPONSE_ERROR, $data);
Jaws_Header::Referrer();
}
$model = $this->gadget->model->load('Notepad');
$data['user'] = (int) $GLOBALS['app']->Session->GetAttribute('user');
$data['title'] = Jaws_XSS::defilter($data['title']);
$data['content'] = Jaws_XSS::defilter($data['content']);
$result = $model->Insert($data);
if (Jaws_Error::IsError($result)) {
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_ERROR_NOTE_CREATE'), 'Notepad.Response', RESPONSE_ERROR, $data);
Jaws_Header::Referrer();
}
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_NOTICE_NOTE_CREATED'), 'Notepad.Response');
Jaws_Header::Location($this->gadget->urlMap('Notepad'));
}
示例8: Trackback
/**
* Saves a new trackback if all is ok and sends response
* The function other people send to so our blog gadget
* gets trackbacks
*
* @access public
* @return string trackback xml response
*/
function Trackback()
{
// Based on Wordpress trackback implementation
$tb_msg_error = '<?xml version="1.0" encoding="iso-8859-1"?><response><error>1</error><message>#MESSAGE#</message></response>';
$tb_msg_ok = '<?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error></response>';
$sender = Jaws_Utils::GetRemoteAddress();
$ip = $sender['proxy'] . (!empty($sender['proxy']) ? '-' : '') . $sender['client'];
$post = jaws()->request->fetch(array('title', 'url', 'blog_name', 'excerpt'), 'post');
if (is_null($post['title']) || is_null($post['url']) || is_null($post['blog_name']) || is_null($post['excerpt'])) {
Jaws_Header::Location('');
}
$id = jaws()->request->fetch('id', 'get');
if (is_null($id)) {
$id = jaws()->request->fetch('id', 'post');
if (is_null($id)) {
$id = '';
}
}
$title = urldecode($post['title']);
$url = urldecode($post['url']);
$blogname = urldecode($post['blog_name']);
$excerpt = urldecode($post['excerpt']);
if (trim($id) == '') {
Jaws_Header::Location('');
} elseif (empty($title) && empty($url) && empty($blogname)) {
$url = $this->gadget->urlMap('SingleView', array('id' => $id), true);
Jaws_Header::Location($url);
} elseif ($this->gadget->registry->fetch('trackback') == 'true') {
header('Content-Type: text/xml');
$model = $this->gadget->model->load('Trackbacks');
$trackback = $model->NewTrackback($id, $url, $title, $excerpt, $blogname, $ip);
if (Jaws_Error::IsError($trackback)) {
return str_replace('#MESSAGE#', $trackback->GetMessage(), $tb_msg_error);
}
return $tb_msg_ok;
} else {
header('Content-Type: text/xml');
return str_replace('#MESSAGE#', _t('BLOG_TRACKBACK_DISABLED'), $tb_msg_error);
}
}
示例9: VCardImportFile
/**
* Import data with VCard format from file
*
* @access public
* @return string HTML content with menu and menu items
*/
function VCardImportFile()
{
if (!$GLOBALS['app']->Session->Logged()) {
return Jaws_HTTPError::Get(403);
}
require_once JAWS_PATH . 'gadgets/Addressbook/vCard.php';
if (empty($_FILES) || !is_array($_FILES)) {
$GLOBALS['app']->Session->PushResponse(_t('ADDRESSBOOK_RESULT_ERROR_IMPORT_PLEASE_SELECT_FILE'), 'AddressBook.Import', RESPONSE_ERROR);
Jaws_Header::Location($this->gadget->urlMap('VCardImport'));
}
try {
$vCard = new vCard($_FILES['vcard_file']['tmp_name'], false, array('Collapse' => false));
$model = $this->gadget->model->load('AddressBook');
if (count($vCard) == 0) {
$GLOBALS['app']->Session->PushResponse(_t('ADDRESSBOOK_RESULT_ERROR_VCARD_DATA_NOT_FOUND'), 'AddressBook.Import', RESPONSE_ERROR);
Jaws_Header::Location($this->gadget->urlMap('VCardImport'));
} elseif (count($vCard) == 1) {
$result = $this->PrepareForImport($vCard);
if ($result) {
$adrID = $model->InsertAddress($result);
}
} else {
foreach ($vCard as $Index => $vCardPart) {
$result = $this->PrepareForImport($vCardPart);
if ($result) {
$adrID = $model->InsertAddress($result);
}
}
}
} catch (Exception $e) {
$GLOBALS['app']->Session->PushResponse($e->getMessage(), 'AddressBook.Import', RESPONSE_ERROR);
// TODO: Translate Messages
Jaws_Header::Location($this->gadget->urlMap('VCardImport'));
}
$GLOBALS['app']->Session->PushResponse(_t('ADDRESSBOOK_RESULT_IMPORT_COMPLETED'), 'AddressBook');
Jaws_Header::Location($this->gadget->urlMap('AddressBook'));
}
示例10: Search
/**
* Searches through notes including shared noes from other users
*
* @access public
* @return array Response array
*/
function Search()
{
$post = jaws()->request->fetch(array('filter', 'query', 'page'), 'post');
foreach ($post as $k => $v) {
if ($v === null) {
unset($post[$k]);
}
}
$url = $this->gadget->urlMap('Notepad', $post);
Jaws_Header::Location($url);
/*if (strlen($search['query']) < 2) {
$GLOBALS['app']->Session->PushResponse(
_t('NOTEPAD_ERROR_SHORT_QUERY'),
'Notepad.Response',
RESPONSE_ERROR
);
}*/
}
示例11: Click
/**
* Redirects request to banner's target
*
* @access public
* @return mixed Void if Success, 404 XHTML template content on Failure
*/
function Click()
{
$model = $this->gadget->model->load('Banners');
$id = (int) jaws()->request->fetch('id', 'get');
$banner = $model->GetBanners($id);
if (!Jaws_Error::IsError($banner) && !empty($banner)) {
$click = $model->ClickBanner($banner[0]['id']);
if (!Jaws_Error::IsError($click)) {
$link = $banner[0]['url'];
Jaws_Header::Location($link);
}
} else {
return Jaws_HTTPError::Get(404);
}
}
示例12: UpdateGroup
/**
* Update a user's group
*
* @access public
* @return void
*/
function UpdateGroup()
{
$this->gadget->CheckPermission('ManageUserGroups');
$post = jaws()->request->fetch(array('gid', 'name', 'title', 'description', 'enabled'), 'post');
$selected_members = jaws()->request->fetch('members:array', 'post');
$user = $GLOBALS['app']->Session->GetAttribute('user');
$post['enabled'] = (bool) $post['enabled'];
$jUser = new Jaws_User();
$res = $jUser->UpdateGroup($post['gid'], $post, $user);
$current_members_info = $jUser->GetUsers($post['gid']);
$current_members = array();
foreach ($current_members_info as $member_info) {
$current_members[] = $member_info['id'];
}
$new_member = array_diff($selected_members, $current_members);
if (!Jaws_Error::isError($res) && count($new_member) > 0) {
// TODO: improve performance
foreach ($new_member as $member) {
$res = $jUser->AddUserToGroup($member, $post['gid'], $user);
}
}
$removed_member = array_diff($current_members, $selected_members);
if (!Jaws_Error::isError($res) && count($removed_member) > 0) {
// TODO: improve performance
foreach ($removed_member as $member) {
$res = $jUser->DeleteUserFromGroup($member, $post['gid'], $user);
}
}
if (Jaws_Error::isError($res)) {
$GLOBALS['app']->Session->PushResponse($res->getMessage(), 'Users.Groups', RESPONSE_ERROR);
} elseif ($res == true) {
$GLOBALS['app']->Session->PushResponse(_t('USERS_GROUPS_UPDATED', $post['title']), 'Users.Groups', RESPONSE_NOTICE);
}
Jaws_Header::Location($this->gadget->urlMap('Groups'));
}
示例13: Layout
/**
* Redirect to layout manager
*
* @access public
* @return void
*/
function Layout()
{
Jaws_Header::Location($this->gadget->urlMap('Layout', array()));
}
示例14: Search
/**
* Searches among events
*
* @access public
* @return array Response array
*/
function Search()
{
$post = jaws()->request->fetch(array('query', 'filter', 'start', 'stop', 'page'), 'post');
$GLOBALS['app']->Session->PushSimpleResponse($post, 'Events.Search');
$url = $this->gadget->urlMap('ManageEvents');
Jaws_Header::Location($url);
}
示例15: UpdateNote
/**
* Updates note
*
* @access public
* @return array Response array
*/
function UpdateNote()
{
$data = jaws()->request->fetch(array('id', 'title', 'content'), 'post');
if (empty($data['id']) || empty($data['title']) || empty($data['content'])) {
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_ERROR_INCOMPLETE_DATA'), 'Notepad.Response', RESPONSE_ERROR, $data);
Jaws_Header::Referrer();
}
// Validate note
$model = $this->gadget->model->load('Notepad');
$id = (int) $data['id'];
$user = (int) $GLOBALS['app']->Session->GetAttribute('user');
$note = $model->GetNote($id, $user);
if (Jaws_Error::IsError($note)) {
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_ERROR_RETRIEVING_DATA'), 'Notepad.Response', RESPONSE_ERROR);
Jaws_Header::Referrer();
}
// Verify owner
if ($note['user'] != $user) {
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_ERROR_NO_PERMISSION'), 'Notepad.Response', RESPONSE_ERROR);
Jaws_Header::Referrer();
}
$data['title'] = Jaws_XSS::defilter($data['title']);
$data['content'] = Jaws_XSS::defilter($data['content']);
$result = $model->Update($id, $data);
if (Jaws_Error::IsError($result)) {
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_ERROR_NOTE_UPDATE'), 'Notepad.Response', RESPONSE_ERROR, $data);
Jaws_Header::Referrer();
}
$GLOBALS['app']->Session->PushResponse(_t('NOTEPAD_NOTICE_NOTE_UPDATED'), 'Notepad.Response');
Jaws_Header::Location($this->gadget->urlMap('Notepad'));
}