本文整理汇总了PHP中Jaws_Header类的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_Header类的具体用法?PHP Jaws_Header怎么用?PHP Jaws_Header使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Jaws_Header类的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: Export
/**
* Export language
*
* @access public
* @return void
*/
function Export()
{
$lang = jaws()->request->fetch('lang', 'get');
require_once PEAR_PATH . 'File/Archive.php';
$tmpDir = sys_get_temp_dir();
$tmpFileName = "{$lang}.tar";
$tmpArchiveName = $tmpDir . DIRECTORY_SEPARATOR . $tmpFileName;
$writerObj = File_Archive::toFiles();
$src = File_Archive::read(JAWS_DATA . "languages/{$lang}", $lang);
$dst = File_Archive::toArchive($tmpArchiveName, $writerObj);
$res = File_Archive::extract($src, $dst);
if (!PEAR::isError($res)) {
return Jaws_Utils::Download($tmpArchiveName, $tmpFileName);
}
Jaws_Header::Referrer();
}
示例8: 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'));
}
示例9: 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);
}
}
示例10: 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'));
}
示例11: SendMessage
/**
* Send a message
*
* @access public
* @return void
*/
function SendMessage()
{
if (!$GLOBALS['app']->Session->Logged()) {
return Jaws_HTTPError::Get(401);
}
$this->gadget->CheckPermission('SendMessage');
$post = jaws()->request->fetch(array('id', 'recipient_users', 'recipient_groups', 'folder', 'subject', 'body', 'attachments:array', 'is_draft:bool'), 'post');
$post['body'] = jaws()->request->strip_crlf($post['body']);
$user = $GLOBALS['app']->Session->GetAttribute('user');
$model = $this->gadget->model->load('Message');
if (empty($post['folder'])) {
$post['folder'] = $post['is_draft'] ? PrivateMessage_Info::PRIVATEMESSAGE_FOLDER_DRAFT : PrivateMessage_Info::PRIVATEMESSAGE_FOLDER_INBOX;
}
$message_id = $model->SendMessage($user, $post);
$url = $this->gadget->urlMap('Messages', array('folder' => PrivateMessage_Info::PRIVATEMESSAGE_FOLDER_INBOX));
if (Jaws_Error::IsError($message_id)) {
$GLOBALS['app']->Session->PushResponse($message_id->getMessage(), 'PrivateMessage.Compose', RESPONSE_ERROR);
} else {
if ($post['is_draft']) {
$GLOBALS['app']->Session->PushResponse(_t('PRIVATEMESSAGE_DRAFT_SAVED'), 'PrivateMessage.Compose', RESPONSE_NOTICE, array('is_draft' => true, 'message_id' => $message_id));
} else {
$GLOBALS['app']->Session->PushResponse(_t('PRIVATEMESSAGE_MESSAGE_SEND'), 'PrivateMessage.Compose', RESPONSE_NOTICE, array('url' => $url));
}
}
Jaws_Header::Location($url, 'PrivateMessage.Compose');
}
示例12: DeleteCategory
/**
* Deletes the given blog category
*
* @access public
*/
function DeleteCategory()
{
$this->gadget->CheckPermission('ManageCategories');
$model = $this->gadget->model->loadAdmin('Categories');
$model->DeleteCategory(jaws()->request->fetch('catid', 'post'));
Jaws_Header::Location(BASE_SCRIPT . '?gadget=Blog&action=ManageCategories');
}
示例13: UpdateContacts
/**
* Updates user contacts information
*
* @access public
* @return void
*/
function UpdateContacts()
{
if (!$GLOBALS['app']->Session->Logged()) {
Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
}
$this->gadget->CheckPermission('EditUserContacts');
$post = jaws()->request->fetch(array('country', 'city', 'address', 'postal_code', 'phone_number', 'mobile_number', 'fax_number'), 'post');
$uModel = $this->gadget->model->load('Contacts');
$result = $uModel->UpdateContacts($GLOBALS['app']->Session->GetAttribute('user'), $post['country'], $post['city'], $post['address'], $post['postal_code'], $post['phone_number'], $post['mobile_number'], $post['fax_number']);
if (Jaws_Error::IsError($result)) {
$GLOBALS['app']->Session->PushResponse($result->GetMessage(), 'Users.Contacts', RESPONSE_ERROR, $post);
} else {
$GLOBALS['app']->Session->PushResponse(_t('USERS_USERS_CONTACTINFO_UPDATED'), 'Users.Contacts');
}
Jaws_Header::Location($this->gadget->urlMap('Contacts'), 'Users.Contacts');
}
示例14: 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);
}
}
示例15: AddEmblem
/**
* Adds a new emblem
*
* @access public
* @see EmblemsModel->AddEmblem()
*/
function AddEmblem()
{
$post = jaws()->request->fetch(array('title', 'url', 'type', 'published'), 'post');
$post['url'] = Jaws_XSS::defilter($post['url']);
$res = Jaws_Utils::UploadFiles($_FILES, JAWS_DATA . 'emblems/', 'jpg,gif,swf,png,jpeg,bmp,svg');
if (Jaws_Error::IsError($res)) {
$GLOBALS['app']->Session->PushLastResponse($res->getMessage(), RESPONSE_ERROR);
} elseif (empty($res)) {
$GLOBALS['app']->Session->PushLastResponse(_t('EMBLEMS_ERROR_NO_IMAGE_UPLOADED'), RESPONSE_ERROR);
} else {
$post['image'] = $res['image'][0]['host_filename'];
$post['published'] = (bool) $post['published'];
$model = $this->gadget->model->loadAdmin('Emblems');
$res = $model->AddEmblem($post);
if (Jaws_Error::IsError($res)) {
Jaws_Utils::delete(JAWS_DATA . 'emblems/' . $post['image']);
$GLOBALS['app']->Session->PushLastResponse(_t('EMBLEMS_ERROR_NOT_ADDED'), RESPONSE_ERROR);
} else {
$GLOBALS['app']->Session->PushLastResponse(_t('EMBLEMS_ADDED'), RESPONSE_NOTICE);
}
}
Jaws_Header::Location(BASE_SCRIPT . '?gadget=Emblems');
}