本文整理汇总了PHP中Current_User::disallow方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::disallow方法的具体用法?PHP Current_User::disallow怎么用?PHP Current_User::disallow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::disallow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin
public function admin()
{
switch ($_REQUEST['iop']) {
case 'delete_image':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadImage(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->image->delete();
PHPWS_Core::goBack();
break;
case 'post_image_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
if (!$this->postImageUpload()) {
\Cabinet::setMessage('Failed to upload image. Check directory permissions.');
}
Layout::nakedDisplay();
//\PHPWS_Core::goBack();
break;
case 'upload_image_form':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadImage(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->edit();
echo Layout::wrap($this->content, 'Image Upload', true);
exit;
}
}
示例2: process
public static function process()
{
if (!Current_User::authorized('analytics')) {
Current_User::disallow();
}
$panel = self::cpanel();
if (isset($_REQUEST['command'])) {
$command = $_REQUEST['command'];
} else {
$command = $panel->getCurrentTab();
}
switch ($command) {
case 'list':
$panel->setContent(self::listTrackers());
break;
case 'new':
$panel->setContent(self::newTracker());
break;
case 'create':
$panel->setContent(self::createTracker());
break;
case 'edit':
$panel->setContent(self::editTracker());
break;
case 'delete':
$panel->setContent(self::deleteTracker());
break;
case 'save_tracker':
$panel->setContent(self::saveTracker());
break;
}
Layout::add(PHPWS_ControlPanel::display($panel->display()));
}
示例3: adminMenu
function adminMenu()
{
if (!Current_User::allow('whatsnew')) {
Current_User::disallow();
}
$this->loadPanel();
$javascript = false;
$this->loadMessage();
switch ($_REQUEST['aop']) {
case 'menu':
if (!isset($_GET['tab'])) {
$this->loadForm('settings');
} else {
$this->loadForm($_GET['tab']);
}
break;
case 'post_settings':
if (!Current_User::authorized('whatsnew')) {
Current_User::disallow();
}
if ($this->postSettings()) {
$this->forwardMessage(dgettext('whatsnew', 'Whatsnew settings saved.'));
PHPWS_Core::reroute('index.php?module=whatsnew&aop=menu');
} else {
$this->loadForm('settings');
}
break;
case 'flush_cache':
if (!Current_User::authorized('whatsnew')) {
Current_User::disallow();
}
if ($this->flushCache()) {
$this->forwardMessage(dgettext('whatsnew', 'Cache flushed.'));
PHPWS_Core::reroute('index.php?module=whatsnew&aop=menu');
} else {
$this->loadForm('settings');
}
break;
}
$tpl['TITLE'] = $this->title;
$tpl['CONTENT'] = $this->content;
$tpl['MESSAGE'] = $this->message;
if ($javascript) {
Layout::nakedDisplay(PHPWS_Template::process($tpl, 'whatsnew', 'main_admin.tpl'));
} else {
$this->panel->setContent(PHPWS_Template::process($tpl, 'whatsnew', 'main_admin.tpl'));
Layout::add(PHPWS_ControlPanel::display($this->panel->display()));
}
}
示例4: admin
public function admin()
{
switch ($_REQUEST['mop']) {
case 'delete_multimedia':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->multimedia->delete();
PHPWS_Core::goBack();
break;
case 'post_multimedia_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->postMultimediaUpload();
\PHPWS_Core::goBack();
break;
case 'upload_multimedia_form':
if (!Current_User::secured('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
if (!$this->multimedia->id) {
$this->multimedia->folder_id = filter_input(INPUT_GET, 'folder_id', FILTER_VALIDATE_INT);
}
$this->edit();
echo json_encode(array('title' => $this->title, 'content' => $this->content));
exit;
case 'edit_rtmp':
if (!Current_User::secured('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->editRTMP();
echo json_encode(array('title' => $this->title, 'content' => $this->content));
exit;
case 'post_rtmp':
if (!Current_User::authorized('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
if (!$this->postRTMP()) {
$this->editRTMP();
}
\PHPWS_Core::goBack();
break;
}
return $this->content;
}
示例5: get
public function get($type)
{
switch ($type) {
case 'new':
if (Current_User::isRestricted('signup')) {
$this->signup->title = dgettext('signup', 'Sorry');
$this->signup->content = dgettext('signup', 'You do not have permission for this action.');
return;
}
case 'edit_sheet':
if (empty($this->signup->sheet)) {
$this->signup->loadSheet();
}
if (!Current_User::allow('signup', 'edit_sheet', $this->signup->sheet->id, 'sheet')) {
Current_User::disallow();
}
$this->editSheet();
break;
case 'list':
$this->signup->panel->setCurrentTab('list');
$this->listSignup();
break;
case 'edit_slots':
$this->editSlots();
break;
case 'edit_peep':
$this->editPeep();
break;
case 'edit_slot_popup':
$this->editSlotPopup();
break;
case 'edit_peep_popup':
$this->editPeepPopup();
break;
case 'user_signup':
$this->userSignup();
break;
case 'report':
$this->report();
break;
case 'email_applicants':
$this->emailApplicants();
break;
}
}
示例6: post
public function post()
{
switch ($_POST['aop']) {
case 'save_property':
if (!\Current_User::authorized('properties')) {
Current_User::disallow('Action not allowed');
}
$this->loadProperty();
if ($this->property->post()) {
try {
$this->property->save();
$this->setCarryMessage('Property saved successfully.');
} catch (\Exception $e) {
$this->setCarryMessage($e->getMessage());
}
\PHPWS_Core::reroute('index.php?module=properties&aop=properties');
} else {
$this->editProperty();
}
break;
case 'save_contact':
if (!\Current_User::authorized('properties')) {
Current_User::disallow();
}
$this->loadContact();
if ($this->contact->post()) {
try {
$this->contact->save();
if (isset($_POST['contact_contact'])) {
$this->emailContact($this->contact->username, $_POST['password'], $_POST['email_address']);
}
$this->setCarryMessage('Contact saved successfully.');
\PHPWS_Core::reroute('index.php?module=properties&aop=contacts');
} catch (\Exception $e) {
$this->setCarryMessage($e->getMessage());
$this->editContact();
}
} else {
$this->editContact();
}
break;
case 'post_photo':
try {
$photo = new Photo();
$photo->post();
$this->setCarryMessage('Photo uploaded');
if (isset($_POST['v'])) {
$property = new Property($photo->pid);
$url = './properties/id/' . $photo->pid . '/photo/1';
} else {
$url = 'index.php?module=properties&aop=properties&pid=' . $photo->pid;
}
\PHPWS_Core::reroute($url);
} catch (\Exception $e) {
$this->setCarryMessage($e->getMessage());
\PHPWS_Core::goBack();
}
break;
case 'post_settings':
if ($this->postSettings()) {
$this->setCarryMessage('Settings updated');
\PHPWS_Core::reroute('index.php?module=properties&aop=settings');
} else {
$this->settingsForm();
}
break;
case 'block_post':
$this->blockPost();
$this->viewReported();
break;
}
$this->display();
}
示例7: admin
public function admin()
{
switch ($_REQUEST['dop']) {
case 'delete_document':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->document->delete();
PHPWS_Core::returnToBookmark();
break;
case 'post_document_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->postDocumentUpload();
javascript('close_refresh');
Layout::nakedDisplay();
//\PHPWS_Core::goBack();
break;
case 'upload_document_form':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadDocument(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->edit();
echo Layout::wrap($this->content, 'Document Upload', true);
exit;
case 'add_access':
if (!Current_User::authorized('filecabinet')) {
Current_User::disallow();
}
$keyword = null;
$this->loadDocument();
// document exists, try making a shortcut
if ($this->document->id) {
PHPWS_Core::initModClass('access', 'Shortcut.php');
$shortcut = new Access_Shortcut();
if (isset($_GET['keyword'])) {
$keyword = $_GET['keyword'];
}
if (empty($keyword)) {
$keyword = $this->document->title;
}
$result = $shortcut->setKeyword($keyword);
$new_keyword = $shortcut->keyword;
// if setKeyword returns a false or error, we have them pick a different name
if (!$result || PHPWS_Error::isError($result)) {
$message = dgettext('filecabinet', 'Access shortcut name already in use. Please enter another.');
$success = false;
} else {
$shortcut->setUrl('filecabinet', $this->document->getViewLink());
$shortcut->save();
$success = true;
$message = '<p>' . dgettext('filecabinet', 'Access shortcut successful!') . '</p>';
$message .= '<a href="' . PHPWS_Core::getHomeHttp() . $shortcut->keyword . '">' . PHPWS_Core::getHomeHttp() . $shortcut->keyword . '</a>';
}
} else {
$message = dgettext('filecabinet', 'File not found');
// not really a success but prevents a repost prompt
$success = true;
}
echo json_encode(array('success' => $success, 'message' => $message, 'keyword' => $new_keyword));
exit;
}
}
示例8: admin
public function admin()
{
if (!Current_User::allow('pagesmith')) {
Current_User::disallow();
}
$this->loadPanel();
$javascript = false;
switch ($_REQUEST['aop']) {
case 'block_info':
$this->getTextBlockData($_GET['bid'], $_GET['pid'], $_GET['section_id']);
exit;
case 'save_block':
$this->saveBlockData($_POST['pid'], $_POST['bid'], $_POST['section_id'], $_POST['content']);
PHPWS_Cache::clearCache();
exit;
case 'get_undo':
$this->getLastUndo($_GET['pid'], $_GET['bid'], $_GET['section_id']);
exit;
case 'menu':
$this->loadForms();
if (!isset($_GET['tab'])) {
$tab = $this->panel->getCurrentTab();
} else {
$tab =& $_GET['tab'];
}
switch ($tab) {
case 'new':
$this->resetUndoSession(0);
$this->clearPageSession();
$this->loadPage();
$this->forms->editPage();
break;
case 'list':
$this->forms->pageList();
break;
case 'settings':
if (!Current_User::allow('pagesmith', null, null, null, true)) {
Current_User::disallow();
}
$this->forms->settings();
break;
}
break;
case 'edit_page':
$this->resetUndoSession(0);
$this->loadPage();
if (!$this->page->id) {
$this->title = dgettext('pagesmith', 'Sorry');
$this->content = dgettext('pagesmith', 'Page not found');
break;
}
$this->loadForms();
if (!Current_User::allow('pagesmith', 'edit_page', $this->page->id)) {
Current_User::disallow();
}
$this->page->loadSections(true);
$this->forms->pageLayout();
break;
case 'pick_template':
$this->resetUndoSession(0);
$this->loadForms();
$this->loadPage();
$this->page->loadTemplate();
$this->page->loadSections(true);
$this->killSaved($this->page->id);
$this->forms->editPage();
break;
case 'delete_page':
if (!Current_User::authorized('pagesmith', 'delete_page')) {
Current_User::disallow();
}
$this->loadPage();
$this->page->delete();
PHPWS_Cache::clearCache();
$this->loadForms();
$this->forms->pageList();
break;
case 'edit_page_header':
$this->loadPage();
$this->loadForms();
$this->forms->editPageHeader();
$javascript = true;
break;
case 'delete_section':
$this->deleteSection($_GET['sec_id']);
exit;
break;
case 'post_header':
$this->postHeader();
break;
case 'post_text':
$this->postText();
break;
case 'post_page':
$result = $this->postPage();
switch ($result) {
case -1:
$this->loadForms();
$this->page->loadSections(true);
$this->forms->editPage();
//.........这里部分代码省略.........
示例9: remove
function remove()
{
if (!(Current_User::authorized('wiki', 'delete_page') && $this->getAllowEdit() && !$this->getVrCurrent())) {
Current_User::disallow(dgettext('wiki', 'User attempted to remove previous page version.'));
return;
}
PHPWS_Core::initModClass('version', 'Version.php');
$version = new Version('wiki_pages', $this->getId());
$version->delete(FALSE);
WikiManager::sendMessage(dgettext('wiki', 'Old revision removed'), array('page' => $this->getTitle(FALSE)), FALSE);
}
示例10: imageUpload
/**
* Image upload
*
* @author Greg Meiste <greg.meiste+github@gmail.com>
*/
function imageUpload()
{
if (!Current_User::authorized('wiki', 'upload_images') && !(PHPWS_Settings::get('wiki', 'allow_image_upload') && Current_User::isLogged())) {
Current_User::disallow(dgettext('wiki', 'User attempted access to image upload.'));
return;
}
PHPWS_Core::initModClass('wiki', 'WikiImage.php');
PHPWS_Core::initCoreClass('DBPager.php');
if (isset($_POST['op']) && $_POST['op'] == 'doimageupload') {
$newImage = new WikiImage();
WikiManager::sendMessage($newImage->save(), 'imageupload');
}
if ($_REQUEST['op'] == 'doimagedelete') {
$delImage = new WikiImage($_REQUEST['id']);
WikiManager::sendMessage($delImage->delete(), 'imageupload');
}
$tags = WikiImage::add();
$tags['BACK'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Wiki'), 'wiki');
$tags['MESSAGE'] = WikiManager::getMessage();
$tags['IMAGE_UPLOAD_LABEL'] = dgettext('wiki', 'Image Upload');
$tags['IMAGE_LIST_LABEL'] = dgettext('wiki', 'Image List');
$tags['USAGE'] = sprintf(dgettext('wiki', 'To include an image in a page, use %s.'), '[[image picture.jpg]]');
$tags['LIST_FILENAME'] = dgettext('wiki', 'Filename');
$tags['LIST_SIZE'] = dgettext('wiki', 'Size');
$tags['LIST_TYPE'] = dgettext('wiki', 'Type');
$tags['LIST_OWNER'] = dgettext('wiki', 'Uploader');
$tags['LIST_CREATED'] = dgettext('wiki', 'Upload Date');
$tags['LIST_ACTIONS'] = dgettext('wiki', 'Actions');
$pager = new DBPager('wiki_images', 'WikiImage');
$pager->setModule('wiki');
$pager->setTemplate('images/admin.tpl');
$pager->addToggle(PHPWS_LIST_TOGGLE_CLASS);
$pager->addPageTags($tags);
$pager->addRowTags('getTpl');
$pager->setSearch('filename', 'summary');
$pager->setDefaultOrder('filename', 'asc');
$pager->setEmptyMessage(dgettext('wiki', 'No images found.'));
$pager->cacheQueries();
$template['TITLE'] = dgettext('wiki', 'Wiki Images');
$template['CONTENT'] = $pager->get();
Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE);
}
示例11: main
public static function main()
{
if (!Current_User::authorized('blog')) {
Current_User::disallow(dgettext('blog', 'User attempted access to Blog administration.'));
return;
}
$title = $content = NULL;
$message = Blog_Admin::getForward();
$panel = Blog_Admin::cpanel();
$panel->enableSecure();
if (isset($_REQUEST['command'])) {
$command = $_REQUEST['command'];
} else {
$command = $panel->getCurrentTab();
}
if (isset($_REQUEST['blog_id'])) {
$blog = new Blog((int) $_REQUEST['blog_id']);
} else {
$blog = new Blog();
}
switch ($command) {
case 'edit':
$panel->setCurrentTab('list');
if (!Current_User::isUser($blog->author_id) && !Current_User::authorized('blog', 'edit_blog', $_REQUEST['blog_id'], 'entry')) {
Current_User::disallow(dgettext('blog', 'User tried to edit a blog.'));
return;
}
$title = dgettext('blog', 'Update Blog Entry');
$content = Blog_Form::edit($blog);
break;
case 'new':
$title = dgettext('blog', 'New Blog Entry');
$content = Blog_Form::edit($blog);
break;
case 'delete':
//Blog_Admin::resetCache();
$result = $blog->delete();
Blog_Admin::setForward(dgettext('blog', 'Blog entry deleted.'), 'list');
break;
case 'list':
$title = dgettext('blog', 'Blog Entries');
$content = Blog_Admin::entry_list();
break;
case 'menu_submit_link':
Menu::pinLink(dgettext('blog', 'Submit entry'), 'index.php?module=blog&action=user&action=submit');
PHPWS_Core::reroute('index.php?module=blog&action=admin&tab=settings&authkey=' . Current_User::getAuthKey());
break;
case 'sticky':
if (!Current_User::isUnrestricted('blog')) {
Current_User::disallow();
}
Blog_Admin::sticky($blog);
PHPWS_Core::goBack();
break;
case 'unsticky':
if (!Current_User::isUnrestricted('blog')) {
Current_User::disallow();
}
Blog_Admin::unsticky($blog);
PHPWS_Core::goBack();
break;
case 'post_entry':
$title = dgettext('blog', 'Blog Archive');
$panel->setCurrentTab('list');
$blog->post_entry();
$link_back = PHPWS_Text::linkAddress('blog', array('action' => 'admin', 'tab' => 'list'), TRUE);
if ($blog->_error) {
if (empty($blog->id)) {
$panel->setCurrentTab('new');
}
$content = Blog_Form::edit($blog);
} else {
if (!isset($_POST['blog_id']) && PHPWS_Core::isPosted()) {
Blog_Admin::setForward(dgettext('blog', 'Entry saved successfully.'), 'list');
}
$result = $blog->save();
//Blog_Admin::resetCache();
if (PHPWS_Error::isError($result)) {
$message = dgettext('blog', 'An error occurred when trying to save your entry. Please check your logs.');
PHPWS_Error::log($result);
Blog_Admin::setForward($message, 'list');
}
if (!$blog->approved) {
Blog_Admin::setForward(dgettext('blog', 'Your entry is being held for approval.'), 'list');
} else {
PHPWS_Core::reroute($blog->getViewLink(true));
}
}
break;
case 'reset_cache':
Blog_Admin::resetCache();
PHPWS_Core::goBack();
break;
case 'post_settings':
if (!Current_User::authorized('blog', 'settings')) {
Current_User::disallow();
return;
}
if (Current_User::isDeity() && isset($_POST['purge_confirm'])) {
$title = dgettext('blog', 'Purge Blog Entries');
//.........这里部分代码省略.........
示例12:
<?php
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
if (!defined('PHPWS_SOURCE_DIR')) {
Error::errorPage(403);
}
if ($_REQUEST['module'] != 'layout' || !isset($_REQUEST['action'])) {
Error::errorPage('404');
}
if ($_REQUEST['action'] == 'ckeditor') {
Layout::ckeditor();
exit;
}
if (!Current_User::allow('layout')) {
Current_User::disallow();
}
PHPWS_Core::initModClass('layout', 'LayoutAdmin.php');
switch ($_REQUEST['action']) {
case 'admin':
Layout_Admin::admin();
break;
default:
PHPWS_Core::errorPage('404');
}
// END action switch
示例13: editFolder
public function editFolder($js)
{
if (!Current_User::allow('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadForms();
if ($this->folder->ftype == IMAGE_FOLDER) {
$this->title = dgettext('filecabinet', 'Update image folder');
} elseif ($this->folder->ftype == DOCUMENT_FOLDER) {
$this->title = dgettext('filecabinet', 'Update document folder');
} else {
$this->title = dgettext('filecabinet', 'Update multimedia folder');
}
$this->content = $this->forms->editFolder($this->folder, $js);
if ($js) {
echo \Layout::wrap($this->content, $this->title, true);
} else {
echo json_encode(array('title' => $this->title, 'content' => $this->content));
}
exit;
}
示例14: main
public static function main()
{
if (!Current_User::allow('search')) {
Current_User::disallow();
}
$panel = Search_Admin::cpanel();
if (isset($_REQUEST['command'])) {
$command = $_REQUEST['command'];
} elseif (isset($_REQUEST['tab'])) {
$command = $_REQUEST['tab'];
} else {
$command = $panel->getCurrentTab();
}
switch ($command) {
case 'delete_keyword':
case 'add_keyword':
case 'remove_searchword':
case 'add_ignore':
if (!Current_User::authorized('search')) {
Current_User::disallow();
}
break;
}
switch ($command) {
case 'keyword':
$template = Search_Admin::keyword();
break;
case 'ignore':
$template = Search_Admin::ignore();
break;
case 'settings':
$template = Search_Admin::settings();
break;
case 'close_admin':
unset($_SESSION['Search_Add_Words']);
unset($_SESSION['Search_Admin']);
PHPWS_Core::goBack();
break;
case 'delete_keyword':
Search_Admin::deleteKeyword();
PHPWS_Core::goBack();
break;
case 'add_parse_word':
if (!isset($_REQUEST['keyword'])) {
PHPWS_Core::goBack();
}
Search_Admin::addParseWord($_REQUEST['keyword']);
Search_Admin::sendMessage(dgettext('search', 'Keywords added to admin menu.'), 'keyword');
break;
case 'drop_keyword':
if (isset($_SESSION['Search_Add_Words'])) {
$array_key = array_search($_REQUEST['kw'], $_SESSION['Search_Add_Words']);
if ($array_key !== FALSE) {
unset($_SESSION['Search_Add_Words'][$array_key]);
}
}
PHPWS_Core::goBack();
break;
case 'add_keyword':
if (!isset($_GET['kw']) || !isset($_GET['key_id'])) {
PHPWS_Core::goBack();
}
Search_Admin::addKeyword($_GET['kw'], $_GET['key_id']);
PHPWS_Core::goBack();
break;
case 'remove_searchword':
if (!isset($_GET['kw']) || !isset($_GET['key_id'])) {
PHPWS_Core::goBack();
}
Search_Admin::removeSearchword($_GET['kw'], $_GET['key_id']);
PHPWS_Core::goBack();
break;
case 'add_ignore':
if (!isset($_GET['keyword'])) {
PHPWS_Core::goBack();
}
Search_Admin::setIgnore($_GET['keyword'], 1);
PHPWS_Core::goBack();
break;
case 'remove_ignore':
if (!isset($_GET['keyword'])) {
PHPWS_Core::goBack();
}
Search_Admin::setIgnore($_GET['keyword'], 0);
PHPWS_Core::goBack();
break;
case 'save_settings':
Search_Admin::saveSettings();
Search_Admin::sendMessage(dgettext('search', 'Settings saved'), 'settings');
break;
}
$template['MESSAGE'] = Search_Admin::getMessage();
$final = PHPWS_Template::process($template, 'search', 'main.tpl');
$panel->setContent($final);
$finalPanel = $panel->display();
Layout::add(PHPWS_ControlPanel::display($finalPanel));
}
示例15: postDenyAllow
public static function postDenyAllow()
{
if (!Current_User::authorized('access', 'admin_options')) {
Current_User::disallow();
exit;
}
PHPWS_Core::initModClass('access', 'Allow_Deny.php');
if (!empty($_POST['allow_deny_enabled'])) {
PHPWS_Settings::set('access', 'allow_deny_enabled', 1);
} else {
PHPWS_Settings::set('access', 'allow_deny_enabled', 0);
}
PHPWS_Settings::save('access');
if (isset($_POST['add_allow_address']) && !empty($_POST['allow_address'])) {
$allow = new Access_Allow_Deny();
$allow->allow_or_deny = 1;
$result = $allow->setIpAddress($_POST['allow_address']);
if (!$result) {
return $result;
}
$allow->active = 1;
return $allow->save();
}
if (isset($_POST['add_deny_address']) && !empty($_POST['deny_address'])) {
$deny = new Access_Allow_Deny();
$deny->allow_or_deny = 0;
$result = $deny->setIpAddress($_POST['deny_address']);
if (!$result) {
return $result;
}
$deny->active = 1;
return $deny->save();
}
if (isset($_POST['allow_action']) && $_POST['allow_action'] != 'none') {
if ($_POST['allow_action'] == 'allow_all') {
if (PHPWS_Settings::get('access', 'allow_all')) {
PHPWS_Settings::set('access', 'allow_all', 0);
} else {
PHPWS_Settings::set('access', 'allow_all', 1);
}
PHPWS_Settings::save('access');
return true;
} elseif (!empty($_POST['allows'])) {
$db = new PHPWS_DB('access_allow_deny');
// just in case something goes wrong
$db->addWhere('allow_or_deny', 1);
$db->addWhere('id', $_POST['allows']);
switch ($_POST['allow_action']) {
case 'active':
$db->addValue('active', 1);
return $db->update();
break;
case 'deactive':
$db->addValue('active', 0);
return $db->update();
break;
case 'delete':
return $db->delete();
break;
}
}
}
if ($_POST['deny_action'] == 'deny_all') {
if (PHPWS_Settings::get('access', 'deny_all')) {
PHPWS_Settings::set('access', 'deny_all', 0);
} else {
PHPWS_Settings::set('access', 'deny_all', 1);
}
PHPWS_Settings::save('access');
return true;
} elseif (!empty($_POST['denys'])) {
$db = new PHPWS_DB('access_allow_deny');
// just in case something goes wrong
$db->addWhere('allow_or_deny', 0);
$db->addWhere('id', $_POST['denys']);
switch ($_POST['deny_action']) {
case 'active':
$db->addValue('active', 1);
return $db->update();
break;
case 'deactive':
$db->addValue('active', 0);
return $db->update();
break;
case 'delete':
return $db->delete();
break;
}
}
return true;
}