Example #1
0
 public function main()
 {
     $auth = Current_User::getAuthorization();
     if (!Current_User::isLogged() || !$auth->local_user) {
         PHPWS_Core::errorPage('403');
     }
     $result = $this->init();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         Layout::add(PHPWS_ControlPanel::display(dgettext('users', 'The is a problem with My Page.')));
         return;
     } elseif (!$result) {
         Layout::add(PHPWS_ControlPanel::display(dgettext('users', 'No modules are registered to My Page.')));
         return;
     }
     $panel = My_Page::cpanel();
     $module = $panel->getCurrentTab();
     if (!$this->moduleIsRegistered($module)) {
         Layout::add(dgettext('users', 'This module is not registered with My Page'));
         return;
     }
     $content = My_Page::userOption($module);
     if (PHPWS_Error::isError($content)) {
         $content = $content->getMessage();
     }
     Layout::add(PHPWS_ControlPanel::display($content));
 }
Example #2
0
 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()));
 }
Example #3
0
 private function display()
 {
     \Layout::addStyle('properties');
     $tpl['TITLE'] = $this->title;
     $tpl['CONTENT'] = $this->content;
     $tpl['MESSAGE'] = $this->message;
     $final_content = \PHPWS_Template::process($tpl, 'properties', 'admin.tpl');
     \Layout::add(\PHPWS_ControlPanel::display($this->panel->display($final_content)));
 }
Example #4
0
 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()));
     }
 }
Example #5
0
 public static function loggedIn()
 {
     $auth = Current_User::getAuthorization();
     $template['GREETING'] = dgettext('users', 'Hello');
     $template['USERNAME'] = Current_User::getUsername();
     $template['DISPLAY_NAME'] = Current_User::getDisplayName();
     $template['PANEL'] = $template['MODULES'] = PHPWS_ControlPanel::panelLink();
     $logout_link = $auth->getLogoutLink();
     $template['ACCOUNT'] = '<a href="index.php?module=users&action=user&tab=my_page">' . dgettext('users', '<span class="glyphicon glyphicon-user"></span> Account') . '</a>';
     if ($logout_link) {
         $template['LOGOUT'] =& $logout_link;
     } else {
         $template['LOGOUT'] = PHPWS_Text::moduleLink(dgettext('users', '<span class="fa fa-sign-out"></span> Log Out'), 'users', array('action' => 'user', 'command' => 'logout'));
     }
     $template['HOME_USER_PANEL'] = $template['HOME'] = PHPWS_Text::moduleLink(dgettext('users', 'Home'));
     $usermenu = PHPWS_User::getUserSetting('user_menu');
     return PHPWS_Template::process($template, 'users', 'usermenus/' . $usermenu);
 }
 public function getHtmlView($data, \Request $request)
 {
     $cmd = $request->shiftCommand();
     if (empty($cmd)) {
         $cmd = 'pager';
     }
     //$this->loadMenu($cmd);
     switch ($cmd) {
         case 'pager':
             $template = $this->pager($request);
             break;
         case 'settings':
             $template = $this->settings($request);
             break;
     }
     $panel = $template->get();
     $view = new \View\HtmlView(\PHPWS_ControlPanel::display($panel));
     return $view;
 }
Example #7
0
 public static function action()
 {
     if (!Current_User::allow('block')) {
         Current_User::disallow();
         return;
     }
     $panel = Block_Admin::cpanel();
     if (isset($_REQUEST['action'])) {
         $action = $_REQUEST['action'];
     } else {
         $tab = $panel->getCurrentTab();
         if (empty($tab)) {
             $action = 'new';
         } else {
             $action =& $tab;
         }
     }
     $content = Block_Admin::route($action);
     $panel->setContent($content);
     $finalPanel = $panel->display();
     Layout::add(PHPWS_ControlPanel::display($finalPanel));
 }
Example #8
0
 /**
  * routes administrative commands
  */
 public function main()
 {
     if (!Current_User::allow('calendar')) {
         Current_User::disallow();
         return;
     }
     $panel = $this->getPanel();
     if (isset($_REQUEST['aop'])) {
         $command = $_REQUEST['aop'];
     } elseif (isset($_REQUEST['tab'])) {
         $command = $_REQUEST['tab'];
     } else {
         $command = $panel->getCurrentTab();
     }
     switch ($command) {
         case 'get_event_json':
             $this->getEventJson();
             break;
         case 'post_event':
             if (!$this->calendar->schedule->checkPermissions(true)) {
                 Current_User::disallow();
             }
             $this->postEvent();
             break;
         case 'schedule_json':
             $this->scheduleJSON(filter_input(INPUT_GET, 'sch_id', FILTER_SANITIZE_NUMBER_INT));
             exit;
             break;
         case 'approval':
             $this->approval();
             break;
         case 'approve_suggestion':
             $this->approveSuggestion($_GET['suggestion_id']);
             PHPWS_Core::goBack();
             break;
         case 'create_event':
             $panel->setCurrentTab('schedules');
             $event = $this->calendar->schedule->loadEvent();
             if ($this->calendar->current_date) {
                 $event->start_time = mktime(12, 0, 0, $this->calendar->int_month, $this->calendar->int_day, $this->calendar->int_year);
                 $event->end_time = mktime(12, 0, 0, $this->calendar->int_month, $this->calendar->int_day, $this->calendar->int_year);
             }
             $this->editEvent($event);
             break;
         case 'create_schedule':
             if (!Current_User::allow('calendar') || !Current_User::allow('calendar', 'edit_public') && !PHPWS_Settings::get('calendar', 'personal_schedules')) {
                 Current_User::disallow();
             }
             $this->calendar->schedule = new Calendar_Schedule();
             $panel->setCurrentTab('schedules');
             $this->editSchedule();
             break;
         case 'blog_event':
             if (PHPWS_Core::moduleExists('blog') && Current_User::allow('blog', 'edit_blog') && $this->calendar->schedule->checkPermissions(true)) {
                 $event = $this->calendar->schedule->loadEvent();
                 $this->blogEvent();
             }
             break;
         case 'post_blog':
             if (PHPWS_Core::moduleExists('blog') && Current_User::allow('blog', 'edit_blog') && $this->calendar->schedule->checkPermissions(true)) {
                 $this->postBlog();
             }
             javascript('close_refresh');
             Layout::nakedDisplay();
             break;
         case 'edit_event':
             $panel->setCurrentTab('schedules');
             if (!$this->calendar->schedule->checkPermissions()) {
                 Current_User::disallow();
             }
             $event = $this->calendar->schedule->loadEvent();
             $this->editEvent($event);
             break;
         case 'delete_event':
             if ($this->calendar->schedule->checkPermissions(true)) {
                 $event = $this->calendar->schedule->loadEvent();
                 $result = $event->delete();
                 if (PHPWS_Error::isError($result)) {
                     PHPWS_Error::log($result);
                 }
             }
             PHPWS_Core::goBack();
             break;
         case 'delete_schedule':
             if (Current_User::authorized('calendar', 'delete_schedule') && Current_User::isUnrestricted('calendar')) {
                 $this->calendar->schedule->delete();
                 $this->sendMessage(dgettext('calendar', 'Schedule deleted.'), 'aop=schedules');
             } else {
                 Current_User::disallow();
             }
             break;
         case 'disapprove_suggestion':
             $this->disapproveSuggestion($_GET['suggestion_id']);
             PHPWS_Core::goBack();
             break;
         case 'edit_schedule':
             if (empty($_REQUEST['sch_id'])) {
                 PHPWS_Core::errorPage('404');
             }
             if (!$this->calendar->schedule->checkPermissions()) {
                 Current_User::disallow();
             }
             $panel->setCurrentTab('schedules');
             $this->editSchedule();
             break;
         case 'make_default_public':
             if (Current_User::isUnrestricted('calendar')) {
                 PHPWS_Settings::set('calendar', 'public_schedule', (int) $_REQUEST['sch_id']);
                 PHPWS_Settings::save('calendar');
                 $this->message = dgettext('calendar', 'Default public schedule set.');
             }
             $this->scheduleListing();
             break;
         case 'post_schedule':
             $this->postSchedule();
             break;
         case 'post_settings':
             if (!Current_User::authorized('calendar', 'settings')) {
                 Current_User::disallow();
             }
             $this->postSettings();
             $this->message = dgettext('calendar', 'Settings saved');
             $this->settings();
             break;
         case 'repeat_event':
             $panel->setCurrentTab('schedules');
             $event = $this->calendar->schedule->loadEvent();
             $this->repeatEvent($event);
             break;
         case 'reset_cache':
             if (!Current_User::allow('calendar')) {
                 Current_User::disallow();
             }
             PHPWS_Cache::remove($_REQUEST['key']);
             PHPWS_Core::goBack();
             break;
         case 'schedules':
             $panel->setCurrentTab('schedules');
             $this->scheduleListing();
             break;
         case 'settings':
             $this->settings();
             break;
         case 'upload_event':
             if (!$this->calendar->schedule->checkPermissions()) {
                 Current_User::disallow();
             }
             $this->uploadEvent();
             break;
         case 'post_upload':
             if (!$this->calendar->schedule->checkPermissions(true)) {
                 Current_User::disallow();
             }
             $this->postUpload();
             break;
     }
     $tpl['CONTENT'] = $this->content;
     $tpl['TITLE'] = $this->title;
     if (is_array($this->message)) {
         $tpl['MESSAGE'] = implode('<br />', $this->message);
     } else {
         $tpl['MESSAGE'] = $this->message;
     }
     // Clears in case of js window opening
     $this->content = $this->title = $this->message = null;
     $final = PHPWS_Template::process($tpl, 'calendar', 'admin/main.tpl');
     if (PHPWS_Calendar::isJS()) {
         Layout::nakedDisplay($final);
     } else {
         $panel->setContent($final);
         Layout::add(PHPWS_ControlPanel::display($panel->display()));
     }
 }
Example #9
0
 public static function main()
 {
     $title = $content = NULL;
     $message = Access::getMessage();
     if (!Current_User::allow('access')) {
         Current_User::disallow();
         exit;
     }
     $panel = Access::cpanel();
     if (isset($_REQUEST['command'])) {
         $command = $_REQUEST['command'];
     } else {
         $command = $panel->getCurrentTab();
     }
     // If the command is empty, that means no tabs were set
     // In this case, an admin with full rights needs to log in
     if (empty($command)) {
         $title = dgettext('access', 'Sorry');
         $content = dgettext('access', 'Access needs a higher administrator\'s attention before you may use it.');
     } else {
         switch ($command) {
             case 'post_admin':
                 Access::saveAdmin();
                 Access::sendMessage(dgettext('access', 'Settings saved.'), 'admin');
                 break;
             case 'restore_default':
                 $source = PHPWS_SOURCE_DIR . 'core/inc/htaccess';
                 $dest = PHPWS_HOME_DIR . '.htaccess';
                 if (copy($source, $dest)) {
                     Access::sendMessage(dgettext('access', 'Default .htaccess file restored.'), 'update');
                 } else {
                     Access::sendMessage(dgettext('access', 'Unable to restore default .htaccess file.'), 'update');
                 }
                 break;
             case 'post_deny_allow':
                 $result = Access::postDenyAllow();
                 if ($result == false) {
                     Access::sendMessage(dgettext('access', 'IP address was not formatted correctly or not allowed.'), 'deny_allow');
                 } elseif (PHPWS_Error::isError($result)) {
                     PHPWS_Error::log($result);
                     Access::sendMessage(dgettext('access', 'An error occurred.') . ' ' . dgettext('access', 'Please check your logs.'), 'deny_allow');
                 }
                 Access::sendMessage(NULL, 'deny_allow');
                 break;
             case 'delete_allow_deny':
                 PHPWS_Core::initModClass('access', 'Allow_Deny.php');
                 $allow_deny = new Access_Allow_Deny($_GET['ad_id']);
                 $allow_deny->delete();
                 Access::sendMessage(dgettext('access', 'IP address deleted.'), 'deny_allow');
                 break;
             case 'deny_allow':
                 PHPWS_Core::initModClass('access', 'Forms.php');
                 $title = dgettext('access', 'Denys and Allows');
                 $content = Access_Forms::denyAllowForm();
                 break;
             case 'delete_shortcut':
                 PHPWS_Core::initModClass('access', 'Shortcut.php');
                 $shortcut = new Access_Shortcut($_REQUEST['shortcut_id']);
                 if (empty($shortcut->_error) && $shortcut->id) {
                     $result = $shortcut->delete();
                     if (PHPWS_Error::isError($result)) {
                         Access::sendMessage(dgettext('access', 'An error occurred when deleting your shortcut.'), 'shortcuts');
                     }
                 }
                 Access::sendMessage(dgettext('access', 'Shortcut deleted'), 'shortcuts');
                 break;
             case 'shortcuts':
                 PHPWS_Core::initModClass('access', 'Forms.php');
                 $title = dgettext('access', 'Shortcuts');
                 $content = Access_Forms::shortcuts();
                 break;
             case 'post_shortcut_list':
                 $message = NULL;
                 $result = Access::postShortcutList();
                 if (PHPWS_Error::isError($result)) {
                     $message = dgettext('access', 'An error occurred.') . ' ' . dgettext('access', 'Please check your logs.');
                 }
                 Access::sendMessage($message, 'shortcuts');
                 break;
             case 'edit_shortcut':
                 PHPWS_Core::initModClass('access', 'Forms.php');
                 echo Access_Forms::shortcut_menu();
                 exit;
                 break;
             case 'post_shortcut':
                 PHPWS_Core::initModClass('access', 'Shortcut.php');
                 $sch_id = filter_input(INPUT_POST, 'sch_id', FILTER_SANITIZE_NUMBER_INT);
                 if ($sch_id) {
                     $shortcut = new Access_Shortcut($sch_id);
                 } else {
                     $shortcut = new Access_Shortcut();
                 }
                 try {
                     $shortcut->postShortcut();
                     $shortcut->save();
                     $json['keyword'] = $shortcut->keyword;
                     $json['error'] = 0;
                 } catch (\Exception $e) {
                     $json['message'] = $e->getMessage();
                     $json['error'] = 1;
                 }
                 echo json_encode($json);
                 exit;
                 break;
             case 'htaccess':
                 if (Current_User::isDeity()) {
                     $title = dgettext('access', 'htaccess');
                     $content = Access::htaccess();
                 } else {
                     Current_User::disallow();
                 }
                 break;
             case 'add_rewritebase':
                 if (Current_User::isDeity()) {
                     Access::addRewriteBase();
                     PHPWS_Core::goBack();
                 } else {
                     Current_User::disallow();
                 }
                 break;
             case 'add_forward':
                 if (Current_User::isDeity()) {
                     Access::addForward();
                     PHPWS_Core::goBack();
                 } else {
                     Current_User::disallow();
                 }
                 break;
             case 'remove_forward':
                 if (Current_User::isDeity()) {
                     Access::removeForward();
                     PHPWS_Core::goBack();
                 } else {
                     Current_User::disallow();
                 }
                 break;
             case 'menu_fix':
                 Access::menuFix();
                 PHPWS_Core::goBack();
                 break;
             case 'page_fix':
                 Access::pageFix();
                 PHPWS_Core::goBack();
                 break;
             case 'autoforward_on':
                 PHPWS_Settings::set('access', 'forward_ids', 1);
                 PHPWS_Settings::save('access');
                 PHPWS_Core::goBack();
                 break;
             case 'autoforward_off':
                 PHPWS_Settings::set('access', 'forward_ids', 0);
                 PHPWS_Settings::save('access');
                 PHPWS_Core::goBack();
                 break;
         }
     }
     $tpl['TITLE'] = $title;
     $tpl['MESSAGE'] = $message;
     $tpl['CONTENT'] = $content;
     $main = PHPWS_Template::process($tpl, 'access', 'main.tpl');
     $panel->setContent($main);
     $finalPanel = $panel->display();
     Layout::add(PHPWS_ControlPanel::display($finalPanel));
 }
Example #10
0
/**
 *
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function controlpanel_register($module, &$content)
{
    PHPWS_Core::initModClass('controlpanel', 'ControlPanel.php');
    $result = PHPWS_ControlPanel::registerModule($module, $content);
    return $result;
}
Example #11
0
 public function adminMenu()
 {
     if (!Current_User::allow('signup')) {
         Current_User::disallow();
     }
     $this->loadPanel();
     $javascript = false;
     $this->loadMessage();
     $command = $_REQUEST['aop'];
     switch ($command) {
         case 'add_slot_peep':
             $javascript = true;
             $this->loadPeep();
             $this->loadForm('edit_peep');
             break;
         case 'menu':
             if (!isset($_GET['tab'])) {
                 $this->loadForm('list');
             } else {
                 $this->loadForm($_GET['tab']);
             }
             break;
         case 'delete_sheet':
             $this->loadSheet();
             $this->sheet->delete();
             $this->message = dgettext('signup', 'Signup sheet deleted.');
             $this->loadForm('list');
             break;
         case 'edit_sheet':
             $this->loadForm('edit_sheet');
             break;
         case 'edit_slot_peep':
             $javascript = true;
             $this->loadPeep();
             $this->loadForm('edit_peep');
             break;
         case 'edit_slot_popup':
             $javascript = true;
             $this->loadSlot();
             $this->loadForm('edit_slot_popup');
             break;
         case 'edit_peep_popup':
             $javascript = true;
             $this->loadSlot();
             $this->loadForm('edit_peep_popup');
             break;
         case 'print_applicants':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->loadSheet();
             $this->printApplicants();
             exit;
             break;
         case 'email_applicants':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->loadEmail();
             $this->loadSheet();
             $this->loadForm('email_applicants');
             break;
         case 'post_email':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->loadEmail();
             $this->loadSheet();
             if ($this->postEmail()) {
                 $this->sendEmail();
             } else {
                 $this->loadForm('email_applicants');
             }
             break;
         case 'slot_listing':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->loadSheet();
             $this->slotListing();
             exit;
             break;
         case 'csv_applicants':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->loadSheet();
             $this->csvExport();
             exit;
             break;
         case 'send_email':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->sendEmail();
             break;
         case 'edit_slots':
             $this->loadSheet();
             $this->loadForm('edit_slots');
             break;
         case 'search_slot':
             $this->searchSlots();
             break;
         case 'post_peep':
             $javascript = true;
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             if ($this->postPeep()) {
                 // Since added by an admin, automatically registered
                 $this->peep->registered = 1;
                 if (PHPWS_Error::logIfError($this->peep->save())) {
                     $this->forwardMessage(dgettext('signup', 'Error occurred when saving applicant.'));
                 } else {
                     $this->forwardMessage(dgettext('signup', 'Applicant saved successfully.'));
                 }
                 javascript('close_refresh');
                 Layout::nakedDisplay();
             } else {
                 $this->loadForm('edit_peep');
             }
             break;
         case 'post_sheet':
             $this->loadSheet();
             if (!Current_User::authorized('signup', 'edit_sheet', $this->sheet->id, 'sheet')) {
                 Current_User::disallow();
             }
             if ($this->postSheet()) {
                 if (!$this->sheet->id && PHPWS_Core::isPosted()) {
                     $this->message = dgettext('signup', 'Sheet previously posted.');
                     $this->loadForm('edit_sheet');
                 } else {
                     $new_sheet = !$this->sheet->id;
                     if (PHPWS_Error::logIfError($this->sheet->save())) {
                         $this->forwardMessage(dgettext('signup', 'Error occurred when saving sheet.'));
                         PHPWS_Core::reroute('index.php?module=signup&aop=list');
                     } else {
                         $this->forwardMessage(dgettext('signup', 'Sheet saved successfully.'));
                         if ($new_sheet) {
                             PHPWS_Core::reroute('index.php?module=signup&aop=edit_slots&sheet_id=' . $this->sheet->id);
                         } else {
                             $this->loadForm('list');
                         }
                     }
                 }
             } else {
                 $this->loadForm('edit_sheet');
             }
             break;
         case 'post_slot':
             $javascript = true;
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             if ($this->postSlot()) {
                 if (PHPWS_Error::logIfError($this->slot->save())) {
                     $this->forwardMessage(dgettext('signup', 'Error occurred when saving slot.'));
                 } else {
                     $this->forwardMessage(dgettext('signup', 'Slot saved successfully.'));
                 }
                 javascript('close_refresh');
                 Layout::nakedDisplay();
             } else {
                 $this->loadForm('edit_slot_popup');
             }
             break;
         case 'move_peep':
             $this->loadPeep();
             $result = $this->movePeep();
             if (PHPWS_Error::logIfError($result) || !$result) {
                 $this->forwardMessage(dgettext('signup', 'Error occurred when moving applicant. Slot may be full.'));
             }
             PHPWS_Core::goBack();
             break;
         case 'move_top':
             $this->loadSlot();
             $this->slot->moveTop();
             PHPWS_Core::goBack();
             break;
         case 'move_up':
             $this->loadSlot();
             $this->slot->moveUp();
             PHPWS_Core::goBack();
             break;
         case 'move_down':
             $this->loadSlot();
             $this->slot->moveDown();
             PHPWS_Core::goBack();
             break;
         case 'move_bottom':
             $this->loadSlot();
             $this->slot->moveBottom();
             PHPWS_Core::goBack();
             break;
         case 'delete_slot':
             $this->loadSlot();
             $this->deleteSlot();
             break;
         case 'delete_slot_peep':
             $this->loadPeep();
             $this->peep->delete();
             PHPWS_Core::goBack();
             break;
         case 'report':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->loadSheet();
             $this->loadForm('report');
             break;
         case 'alpha_order':
         case 'reset_slot_order':
             if (!Current_User::authorized('signup')) {
                 Current_User::disallow();
             }
             $this->loadSheet();
             $this->resetSlots($command);
             $this->forwardMessage(dgettext('signup', 'Slot order reset.'));
             PHPWS_Core::reroute('index.php?module=signup&sheet_id=' . $this->sheet->id . '&aop=edit_slots&authkey=' . Current_User::getAuthKey());
             break;
     }
     $tpl['TITLE'] = $this->title;
     $tpl['CONTENT'] = $this->content;
     $tpl['MESSAGE'] = $this->message;
     if ($javascript) {
         $fonts = '<link rel="stylesheet" type="text/css" href="' . PHPWS_SOURCE_HTTP . 'themes/bootstrap/font-awesome/css/font-awesome.min.css" />
         <link rel="stylesheet" type="text/css" href="' . PHPWS_SOURCE_HTTP . 'themes/bootstrap/css/bootstrap.min.css" />';
         \Layout::addJSHeader($fonts);
         Layout::nakedDisplay(PHPWS_Template::process($tpl, 'signup', 'main.tpl'));
     } else {
         $this->panel->setContent(PHPWS_Template::process($tpl, 'signup', 'main.tpl'));
         Layout::add(PHPWS_ControlPanel::display($this->panel->display()));
     }
 }
Example #12
0
 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');
                 $content = Blog_Admin::confirmPurge($_POST['purge_date']);
                 break;
             }
             Blog_Admin::postSettings();
             $message = dgettext('blog', 'Blog settings saved.');
         case 'settings':
             if (!Current_User::allow('blog', 'settings')) {
                 Current_User::disallow();
                 return;
             }
             $panel->setCurrentTab('settings');
             $title = dgettext('blog', 'Blog Settings');
             $content = Blog_Form::settings();
             break;
         case 'purge_entries':
             if (Current_User::authorized('blog') && Current_User::isDeity()) {
                 Blog_Admin::purgeEntries($_GET['pd']);
                 $message = dgettext('blog', 'Blog entries purged.');
             }
             $content = Blog_Form::settings();
     }
     Layout::add(PHPWS_ControlPanel::display($panel->display($content, $title, $message)));
 }
Example #13
0
 public static function main()
 {
     $tpl['MESSAGE'] = NULL;
     $message = RSS_Admin::getMessage();
     PHPWS_Core::initModClass('rss', 'Feed.php');
     PHPWS_Core::initModClass('rss', 'Channel.php');
     if (!Current_User::allow('rss')) {
         Current_User::disallow();
     }
     $panel = RSS_Admin::adminPanel();
     if (isset($_REQUEST['command'])) {
         $command = $_REQUEST['command'];
     } elseif (isset($_REQUEST['tab'])) {
         $command = $_REQUEST['tab'];
     } else {
         $command = $panel->getCurrentTab();
     }
     if (isset($_REQUEST['channel_id'])) {
         $channel = new RSS_Channel($_REQUEST['channel_id']);
     } else {
         $channel = new RSS_Channel();
     }
     if (isset($_REQUEST['feed_id'])) {
         $feed = new RSS_Feed($_REQUEST['feed_id']);
     } else {
         $feed = new RSS_Feed();
     }
     switch ($command) {
         case 'channels':
             $tpl = RSS_Admin::channels();
             break;
         case 'settings':
             $tpl = RSS_Admin::settings();
             break;
         case 'save_settings':
             $result = RSS_Admin::save_settings();
             if (!$result) {
                 PHPWS_Settings::save('rss');
                 $result = dgettext('rss', 'Settings saved successfully.');
             }
             $tpl = RSS_Admin::settings();
             $tpl['MESSAGE'] =& $result;
             break;
         case 'feedInfo':
             $feed = new RSS_Feed(filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT));
             echo json_encode($feed);
             exit;
             break;
         case 'save_feed':
             $result = $feed->post();
             if (is_array($result)) {
                 $tpl['CONTENT'] = RSS_Admin::editFeed($feed, true);
                 $tpl['MESSAGE'] = implode('<br />', $result);
             } else {
                 $result = $feed->save();
                 PHPWS_Core::reroute('index.php?module=rss&tab=import');
             }
             break;
         case 'edit_channel':
             $tpl = RSS_Admin::editChannel($channel);
             break;
         case 'post_channel':
             $result = $channel->post();
             if (is_array($result)) {
                 $message = implode('<br />', $result);
                 $tpl = RSS_Admin::editChannel($channel);
             } else {
                 $result = $channel->save();
                 if (PHPWS_Error::isError($result)) {
                     RSS_Admin::sendMessage(dgettext('rss', 'An error occurred when saving your channel.'), 'channels');
                 } else {
                     RSS_Admin::sendMessage(dgettext('rss', 'Channel saved.'), 'channels');
                 }
             }
             break;
         case 'reset_feed':
             $feed->reset();
         case 'import':
             $tpl = RSS_Admin::import();
             break;
         case 'turn_on_display':
             $feed->display = 1;
             $feed->save();
             $tpl = RSS_Admin::import();
             break;
         case 'turn_off_display':
             $feed->display = 0;
             $feed->save();
             $tpl = RSS_Admin::import();
             break;
         case 'add_feed':
             $tpl = RSS_Admin::editFeed($feed);
             Layout::nakedDisplay(PHPWS_Template::process($tpl, 'rss', 'main.tpl'));
             exit;
             break;
         case 'edit_feed':
             $tpl = RSS_Admin::editFeed($feed);
             Layout::nakedDisplay(PHPWS_Template::process($tpl, 'rss', 'main.tpl'));
             exit;
             break;
         case 'delete_feed':
             $feed->delete();
             $tpl = RSS_Admin::import();
             break;
         default:
             PHPWS_Core::errorPage('404');
             break;
     }
     if (!empty($message)) {
         $tpl['MESSAGE'] = $message;
     }
     $content = PHPWS_Template::process($tpl, 'rss', 'main.tpl');
     $panel->setContent($content);
     $content = $panel->display();
     Layout::add(PHPWS_ControlPanel::display($content));
 }
 public static function admin()
 {
     if (!Current_User::allow('layout')) {
         Current_User::disallow();
     }
     PHPWS_Core::initModClass('controlpanel', 'Panel.php');
     $title = $content = null;
     $panel = Layout_Admin::adminPanel();
     if (isset($_REQUEST['command'])) {
         $command = $_REQUEST['command'];
     } else {
         $command = $panel->getCurrentTab();
     }
     switch ($command) {
         case 'arrange':
             $title = dgettext('layout', 'Arrange Layout');
             $content[] = Layout_Admin::arrangeForm();
             break;
         case 'turn_off_box_move':
             Layout::moveBoxes(false);
             PHPWS_Core::goBack();
             break;
         case 'post_style_change':
             $result = Layout_Admin::postStyleChange();
             if (PHPWS_Error::isError($result)) {
                 PHPWS_Error::log($result);
             }
             javascript('close_refresh');
             break;
         case 'reset_boxes':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             Layout::resetDefaultBoxes();
             unset($_SESSION['Layout_Settings']);
             PHPWS_Core::reroute('index.php?module=layout&action=admin&authkey=' . Current_User::getAuthKey());
             break;
         case 'move_boxes_on':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             Layout::moveBoxes(true);
             PHPWS_Core::goBack();
             break;
         case 'move_boxes_off':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             Layout::moveBoxes(false);
             PHPWS_Core::goBack();
             break;
         case 'confirmThemeChange':
             $title = dgettext('layout', 'Themes');
             if (isset($_POST['confirm'])) {
                 Layout_Admin::changeTheme();
                 PHPWS_Core::reroute('index.php?module=layout&action=admin&tab=theme');
                 exit;
             } else {
                 Layout::reset();
             }
             $content[] = Layout_Admin::adminThemes();
             break;
         case 'meta':
             $title = dgettext('layout', 'Edit Meta Tags');
             $content[] = Layout_Admin::metaForm();
             break;
         case 'clear_templates':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             $files = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . 'templates/cache', false, true);
             if (!empty($files) && is_array($files)) {
                 foreach ($files as $fn) {
                     $delete_cache_path = "templates/cache/{$fn}";
                     if (is_file($delete_cache_path)) {
                         unlink('templates/cache/' . $fn);
                     }
                 }
             }
             PHPWS_Core::goBack();
             break;
         case 'clear_cache':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             PHPWS_Cache::clearCache();
             PHPWS_Core::goBack();
             break;
         case 'moveBox':
             $result = Layout_Admin::moveBox();
             PHPWS_Error::logIfError($result);
             javascript('close_refresh');
             Layout::nakedDisplay();
             break;
         case 'postMeta':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             Layout_Admin::postMeta();
             if (isset($_POST['key_id'])) {
                 javascript('close_refresh');
                 Layout::nakedDisplay();
                 exit;
             }
             Layout::reset();
             $title = dgettext('layout', 'Edit Meta Tags');
             $template['MESSAGE'] = dgettext('layout', 'Meta Tags updated.');
             $content[] = Layout_Admin::metaForm();
             break;
         case 'demo_fail':
             unset($_SESSION['Layout_Settings']);
             Layout::checkSettings();
             PHPWS_Core::reroute('index.php?module=layout&amp;action=admin&amp;command=confirmThemeChange');
             break;
         case 'demo_theme':
             $title = dgettext('layout', 'Confirm Theme Change');
             $content[] = dgettext('layout', 'If you are happy with the change, click the appropiate button.');
             $content[] = dgettext('layout', 'Failure to respond in ten seconds, reverts phpWebSite to the default theme.');
             $content[] = Layout_Admin::confirmThemeChange();
             break;
         case 'postTheme':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             if ($_POST['default_theme'] != $_SESSION['Layout_Settings']->current_theme) {
                 Layout::reset($_POST['default_theme']);
                 PHPWS_Core::reroute('index.php?module=layout&action=admin&command=demo_theme&authkey=' . Current_User::getAuthKey());
             } else {
                 PHPWS_Settings::set('layout', 'include_css_order', (int) $_POST['include_css_order']);
                 PHPWS_Settings::save('layout');
                 $title = dgettext('layout', 'Themes');
                 $content[] = Layout_Admin::adminThemes();
             }
             break;
         case 'theme':
             $title = dgettext('layout', 'Themes');
             $content[] = Layout_Admin::adminThemes();
             break;
         case 'js_style_change':
             $content = Layout_Admin::jsStyleChange();
             if (empty($content)) {
                 javascript('close_refresh');
             }
             Layout::nakedDisplay($content, dgettext('layout', 'Change CSS'));
             break;
         case 'page_meta_tags':
             $content = Layout_Admin::pageMetaTags((int) $_REQUEST['key_id']);
             if (empty($content)) {
                 javascript('close_refresh');
             }
             Layout::nakedDisplay($content, dgettext('layout', 'Set meta tags'));
             break;
         case 'move_popup':
             if (!Current_User::authorized('layout')) {
                 Current_User::disallow();
             }
             Layout_Admin::moveBoxMenu();
             break;
     }
     $template['TITLE'] = $title;
     if (isset($content)) {
         $template['CONTENT'] = implode('<br />', $content);
     }
     if (isset($message)) {
         $template['MESSAGE'] = $message;
     }
     $final = PHPWS_Template::process($template, 'layout', 'main.tpl');
     $panel->setContent($final);
     Layout::add(PHPWS_ControlPanel::display($panel->display()));
 }
Example #15
0
 /**
  * Displays the content variable in the control panel
  */
 public function displayPanel()
 {
     $template['TITLE'] = $this->title;
     if ($this->message) {
         if (is_array($this->message)) {
             $template['MESSAGE'] = implode('<br />', $this->message);
         } else {
             $template['MESSAGE'] = $this->message;
         }
     }
     if (is_array($this->content)) {
         $template['CONTENT'] = implode('<br />', $this->content);
     } else {
         $template['CONTENT'] = $this->content;
     }
     $content = PHPWS_Template::process($template, 'branch', 'main.tpl');
     $this->panel->setContent($content);
     Layout::add(PHPWS_ControlPanel::display($this->panel->display()));
 }
Example #16
0
 public static function panelLink($fly_out = false)
 {
     Layout::addStyle('controlpanel', 'panel_link.css');
     $reg_link = PHPWS_Text::quickLink(dgettext('controlpanel', 'Control Panel'), 'controlpanel', array('command' => 'panel_view'));
     if (!$fly_out) {
         return $reg_link->get();
     }
     javascript('jquery');
     javascriptMod('controlpanel', 'subpanel');
     $reg_link->setId('cp-panel-link');
     $all_tabs = PHPWS_ControlPanel::loadTabs();
     $all_links = PHPWS_ControlPanel::getAllLinks(true);
     $tpl = new PHPWS_Template('controlpanel');
     $tpl->setFile('subpanel.tpl');
     $authkey = Current_User::getAuthKey();
     if (!empty($all_links)) {
         foreach ($all_links as $tab => $links) {
             foreach ($links as $link) {
                 $tpl->setCurrentBlock('links');
                 $tpl->setData(array('LINK' => sprintf('<a href="%s&amp;authkey=%s">%s</a>', $link->url, $authkey, str_replace(' ', '&#160;', $link->label))));
                 $tpl->parseCurrentBlock();
             }
             $tab_link = $all_tabs[$tab]->link . '&amp;tab=' . $all_tabs[$tab]->id;
             $tpl->setCurrentBlock('tab');
             $tpl->setData(array('TAB_TITLE' => sprintf('<a href="%s">%s</a>', $tab_link, $all_tabs[$tab]->title)));
             $tpl->parseCurrentBlock();
         }
     }
     $tpl->setCurrentBlock();
     $tpl->setData(array('CP_LINK' => $reg_link->get()));
     $tpl->parseCurrentBlock();
     $submenu = $tpl->get();
     return $submenu;
 }
Example #17
0
 public function process()
 {
     if (!Current_User::allow('checkin')) {
         Current_User::disallow();
     }
     if (isset($_REQUEST['aop'])) {
         if ($_REQUEST['aop'] == 'switch') {
             if (Current_User::allow('checkin', 'settings')) {
                 $cmd = 'settings';
             } elseif (Current_User::allow('checkin', 'assign_visitors')) {
                 $cmd = 'assign';
             } else {
                 $cmd = 'waiting';
             }
         } else {
             $cmd = $_REQUEST['aop'];
         }
     } elseif ($_REQUEST['tab']) {
         $cmd = $_REQUEST['tab'];
     } else {
         PHPWS_Core::errorPage('404');
     }
     $js = false;
     $js = isset($_GET['print']);
     switch ($cmd) {
         case 'finish_meeting':
             $this->finishMeeting();
             PHPWS_Core::goBack();
             break;
         case 'start_meeting':
             $this->startMeeting();
             PHPWS_Core::goBack();
             break;
         case 'sendback':
             $this->sendBack();
             PHPWS_Core::goBack();
             break;
         case 'unavailable':
             $this->unavailable();
             PHPWS_Core::goBack();
             break;
         case 'available':
             $this->available();
             PHPWS_Core::goBack();
             break;
         case 'report':
             if (!PHPWS_Settings::get('checkin', 'staff_see_reports') && !Current_User::allow('checkin', 'assign_visitors')) {
                 Current_User::disallow();
             }
             if (isset($_GET['daily_report'])) {
                 $this->dailyReport(isset($_GET['print']));
             } elseif (isset($_GET['summary_report'])) {
                 $this->summaryReport();
             } else {
                 $this->report();
             }
             //$this->report2();
             break;
         case 'daily_report':
             if (!PHPWS_Settings::get('checkin', 'staff_see_reports') && !Current_User::allow('checkin', 'assign_visitors')) {
                 Current_User::disallow();
             }
             break;
         case 'month_report':
             if (!Current_User::allow('checkin', 'assign_visitors')) {
                 Current_User::disallow();
             }
             $this->monthReport(isset($_GET['print']));
             break;
         case 'visitor_report':
             if (!Current_User::allow('checkin', 'assign_visitors')) {
                 Current_User::disallow();
             }
             $this->visitorReport(isset($_GET['print']));
             break;
         case 'reassign':
             // Called via ajax
             if (Current_User::authorized('checkin', 'assign_visitors')) {
                 if (isset($_GET['staff_id']) && $_GET['staff_id'] >= 0 && isset($_GET['visitor_id'])) {
                     $this->loadVisitor($_GET['visitor_id']);
                     $staff_id = $this->visitor->assigned;
                     $db = new PHPWS_DB('checkin_visitor');
                     $db->addValue('assigned', (int) $_GET['staff_id']);
                     $db->addWhere('id', (int) $_GET['visitor_id']);
                     PHPWS_Error::logIfError($db->update());
                     printf('staff_id %s, visitor_id %s', $_GET['staff_id'], $_GET['visitor_id']);
                     $this->loadStaff($staff_id);
                     /*
                      if ($this->staff->status == 3) {
                      $this->staff->status = 0;
                      $this->staff->save();
                      }
                     */
                 }
             }
             exit;
             break;
         case 'move_up':
             if (Current_User::allow('checkin', 'assign_visitors')) {
                 $db = new PHPWS_DB('checkin_staff');
                 $db->moveRow('view_order', 'id', $_GET['staff_id'], 'up');
             }
             PHPWS_Core::goBack();
             break;
         case 'move_down':
             if (Current_User::allow('checkin', 'assign_visitors')) {
                 $db = new PHPWS_DB('checkin_staff');
                 $db->moveRow('view_order', 'id', $_GET['staff_id'], 'down');
             }
             PHPWS_Core::goBack();
             break;
         case 'assign':
             if (Current_User::allow('checkin', 'assign_visitors')) {
                 $this->panel->setCurrentTab('assign');
                 $this->assign();
             }
             break;
         case 'post_note':
             $this->loadVisitor();
             $this->saveNote();
             PHPWS_Core::goBack();
             break;
         case 'hide_panel':
             PHPWS_Cookie::write('checkin_hide_panel', 1);
             PHPWS_Core::goBack();
             break;
         case 'show_panel':
             PHPWS_Cookie::delete('checkin_hide_panel');
             PHPWS_Core::goBack();
             $this->panel->setCurrentTab('assign');
             $this->assign();
             break;
         case 'hide_sidebar':
             PHPWS_Cookie::write('checkin_hide_sidebar', 1);
             PHPWS_Core::goBack();
             $this->panel->setCurrentTab('assign');
             $this->use_sidebar = false;
             $this->assign();
             break;
         case 'show_sidebar':
             PHPWS_Cookie::delete('checkin_hide_sidebar');
             PHPWS_Core::goBack();
             $this->panel->setCurrentTab('assign');
             $this->assign();
             break;
         case 'waiting':
             $this->panel->setCurrentTab('waiting');
             $this->loadCurrentStaff();
             $this->waiting();
             break;
         case 'repeats':
             $this->repeats();
             break;
         case 'small_wait':
             $this->loadCurrentStaff();
             $this->waiting(true);
             $js = true;
             break;
         case 'remove_visitor':
             if (Current_User::allow('checkin', 'remove_visitors')) {
                 $this->removeVisitor();
             }
             PHPWS_Core::goBack();
             break;
         case 'settings':
             if (Current_User::allow('checkin', 'settings')) {
                 $this->panel->setCurrentTab('settings');
                 $this->settings();
             }
             break;
         case 'reasons':
             if (Current_User::allow('checkin', 'settings')) {
                 $this->panel->setCurrentTab('reasons');
                 $this->reasons();
             }
             break;
         case 'post_reason':
             if (Current_User::allow('checkin', 'settings')) {
                 $this->loadReason();
                 if ($this->postReason()) {
                     $this->reason->save();
                     PHPWS_Core::reroute('index.php?module=checkin&tab=reasons');
                 } else {
                     $this->editReason();
                 }
             }
             break;
         case 'staff':
             $this->panel->setCurrentTab('staff');
             $this->staff();
             break;
         case 'edit_staff':
             if (Current_User::allow('checkin', 'settings')) {
                 $this->loadStaff(null, true);
                 $this->editStaff();
             }
             break;
         case 'search_users':
             $this->searchUsers();
             break;
         case 'update_reason':
             if (Current_User::allow('checkin', 'settings')) {
                 if (Current_User::authorized('checkin', 'settings')) {
                     $this->updateReason();
                 }
                 $this->panel->setCurrentTab('settings');
                 $this->settings();
             }
             break;
         case 'post_staff':
             if (!Current_User::authorized('checkin', 'settings')) {
                 Current_User::disallow();
             }
             if ($this->postStaff()) {
                 // save post
                 $this->staff->save();
                 $this->staff->saveReasons();
                 PHPWS_Core::reroute('index.php?module=checkin&tab=staff');
             } else {
                 // post failed
                 $this->loadStaff();
                 $this->editStaff();
             }
             break;
         case 'post_settings':
             // from Checkin_Admin::settings
             if (Current_User::authorized('checkin', 'settings')) {
                 $this->postSettings();
             }
             PHPWS_Core::reroute('index.php?module=checkin&tab=settings');
             break;
         case 'edit_reason':
             $this->loadReason();
             $this->editReason();
             break;
         case 'delete_reason':
             $this->loadReason();
             $this->reason->delete();
             PHPWS_Core::goBack();
             break;
         case 'deactivate_staff':
             PHPWS_Core::initModClass('checkin', 'Staff.php');
             $staff = new Checkin_Staff($_GET['id']);
             $staff->active = 0;
             $staff->save();
             PHPWS_Core::goBack();
             break;
         case 'activate_staff':
             PHPWS_Core::initModClass('checkin', 'Staff.php');
             $staff = new Checkin_Staff($_GET['id']);
             $staff->active = 1;
             $staff->save();
             PHPWS_Core::goBack();
             break;
             // This is for testing purposes and never happens in actual use
         // This is for testing purposes and never happens in actual use
         case 'unassignAll':
             $this->unassignAll();
             break;
             // This is for testing purposes and never happens in actual use
         // This is for testing purposes and never happens in actual use
         case 'auto_assign':
             $this->autoAssign();
             break;
     }
     if (empty($this->content)) {
         $this->content = dgettext('checkin', 'Command not recognized.');
     }
     if ($js) {
         $tpl['TITLE'] =& $this->title;
         $tpl['CONTENT'] =& $this->content;
         $tpl['MESSAGE'] =& $this->message;
         $content = PHPWS_Template::process($tpl, 'checkin', 'main.tpl');
         Layout::nakedDisplay($content, $this->title);
     } else {
         if (is_array($this->message)) {
             $this->message = implode('<br />', $this->message);
         }
         if (!$this->use_sidebar) {
             Layout::collapse();
         }
         if ($this->use_panel) {
             Layout::add(PHPWS_ControlPanel::display($this->panel->display($this->content, $this->title, $this->message)));
         } else {
             $tpl['TITLE'] =& $this->title;
             $tpl['CONTENT'] =& $this->content;
             $tpl['MESSAGE'] =& $this->message;
             Layout::add(PHPWS_Template::process($tpl, 'checkin', 'main.tpl'));
         }
     }
 }
Example #18
0
    case 'update_core':
        $content[] = $backToBoost . '<br />';
        $content[] = Boost_Action::updateModule('core');
        break;
    case 'update':
        $js = javascriptEnabled();
        if (!$js) {
            $content[] = $backToBoost . '<br />';
        } else {
            $content[] = sprintf('<p style="text-align : center"><input type="button" onclick="closeWindow(); return false" value="%s" /></p>', dgettext('boost', 'Close window'));
        }
        $content[] = Boost_Action::updateModule($_REQUEST['opmod']);
        break;
    case 'show_dependency':
        $js = javascriptEnabled();
        $content[] = Boost_Action::showDependency($_REQUEST['opmod']);
        break;
    case 'show_depended_upon':
        $content[] = Boost_Action::showDependedUpon($_REQUEST['opmod']);
        break;
}
// End area switch
if ($js) {
    javascript('close_refresh', array('use_link' => true));
    $content[] = sprintf('<p style="text-align : center"><input type="button" onclick="closeWindow(); return false" value="%s" /></p>', dgettext('boost', 'Close window'));
    Layout::nakedDisplay(implode('', $content));
} else {
    $boostPanel->setContent(implode('', $content));
    $finalContent = $boostPanel->display();
    Layout::add(PHPWS_ControlPanel::display($finalContent));
}
Example #19
0
 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));
 }
Example #20
0
    /**
     * Controller of user requests. Based on the command request variable
     * defaults to my_page
     */
    public static function userAction()
    {
        $auth = Current_User::getAuthorization();
        $content = $title = null;
        if (isset($_REQUEST['command'])) {
            $command = $_REQUEST['command'];
        } else {
            $command = 'my_page';
        }
        switch ($command) {
            case 'login':
                if (!Current_User::isLogged() && isset($_POST['phpws_username']) && isset($_POST['phpws_password'])) {
                    $result = Current_User::loginUser($_POST['phpws_username'], $_POST['phpws_password']);
                    // here
                    if (!$result) {
                        $title = dgettext('users', 'Login page');
                        $message = dgettext('users', 'Username and password combination not found.');
                        $content = User_Form::loginPage();
                    } elseif (PHPWS_Error::isError($result)) {
                        if (preg_match('/L\\d/', $result->code)) {
                            $title = dgettext('users', 'Sorry');
                            $content = $result->getMessage();
                            $content .= ' ' . sprintf('<a href="mailto:%s">%s</a>', PHPWS_User::getUserSetting('site_contact'), dgettext('users', 'Contact the site administrator'));
                        } else {
                            PHPWS_Error::log($result);
                            $message = dgettext('users', 'A problem occurred when accessing user information. Please try again later.');
                        }
                    } else {
                        Current_User::getLogin();
                        PHPWS_Core::returnToBookmark();
                    }
                } else {
                    PHPWS_Core::errorPage('403');
                }
                break;
                // This is used by auth scripts if they need to return the user to
                // where they left off after redirection to another site for SSO
            // This is used by auth scripts if they need to return the user to
            // where they left off after redirection to another site for SSO
            case 'return_bookmark':
                PHPWS_Core::popUrlHistory();
                break;
                // reset user password
            // reset user password
            case 'rp':
                $user_id = User_Action::checkResetPassword();
                if ($user_id) {
                    $title = dgettext('users', 'Reset my password');
                    $content = User_Form::resetPassword($user_id, $_GET['auth']);
                } else {
                    $title = dgettext('users', 'Sorry');
                    $content = dgettext('users', 'Your password request was not found or timed out. Please apply again.');
                }
                break;
            case 'my_page':
                if ($auth->local_user) {
                    PHPWS_Core::initModClass('users', 'My_Page.php');
                    $my_page = new My_Page();
                    $my_page->main();
                } else {
                    Layout::add(PHPWS_ControlPanel::display(dgettext('users', 'My Page unavailable to remote users.'), 'my_page'));
                }
                break;
            case 'signup_user':
                $title = dgettext('users', 'New Account Sign-up');
                if (Current_User::isLogged()) {
                    $content = dgettext('users', 'You already have an account.');
                    break;
                }
                $user = new PHPWS_User();
                if (PHPWS_User::getUserSetting('new_user_method') == 0) {
                    $content = dgettext('users', 'Sorry, we are not accepting new users at this time.');
                    break;
                }
                $content = User_Form::signup_form($user);
                break;
            case 'submit_new_user':
                $title = dgettext('users', 'New Account Sign-up');
                $user_method = PHPWS_User::getUserSetting('new_user_method');
                if ($user_method == 0) {
                    Current_User::disallow(dgettext('users', 'New user signup not allowed.'));
                    return;
                }
                $user = new PHPWS_User();
                $result = User_Action::postNewUser($user);
                if (is_array($result)) {
                    $content = User_Form::signup_form($user, $result);
                } else {
                    $content = User_Action::successfulSignup($user);
                }
                break;
            case 'logout':
                $auth = Current_User::getAuthorization();
                $auth->logout();
                PHPWS_Core::killAllSessions();
                PHPWS_Core::reroute('index.php?module=users&action=reset');
                break;
            case 'login_page':
                if (Current_User::isLogged()) {
                    PHPWS_Core::home();
                }
                $title = dgettext('users', 'Login Page');
                $content = User_Form::loginPage();
                break;
            case 'confirm_user':
                if (Current_User::isLogged()) {
                    PHPWS_Core::home();
                }
                if (User_Action::confirmUser()) {
                    $title = dgettext('users', 'Welcome!');
                    $content = dgettext('users', 'Your account has been successfully activated. Please log in.');
                } else {
                    $title = dgettext('users', 'Sorry');
                    $content = dgettext('users', 'This authentication does not exist.<br />
 If you did not log in within the time frame specified in your email, please apply for another account.');
                }
                User_Action::cleanUpConfirm();
                break;
            case 'forgot_password':
                if (Current_User::isLogged()) {
                    PHPWS_Core::home();
                }
                $title = dgettext('users', 'Forgot Password');
                $content = User_Form::forgotForm();
                break;
            case 'post_forgot':
                $title = dgettext('users', 'Forgot Password');
                if (ALLOW_CAPTCHA) {
                    PHPWS_Core::initCoreClass('Captcha.php');
                    if (!Captcha::verify()) {
                        $content = dgettext('users', 'Captcha information was incorrect.');
                        $content .= User_Form::forgotForm();
                    } else {
                        if (!User_Action::postForgot($content)) {
                            $content .= User_Form::forgotForm();
                        }
                    }
                } elseif (!User_Action::postForgot($content)) {
                    $content .= User_Form::forgotForm();
                }
                break;
            case 'reset_pw':
                $pw_result = User_Action::finishResetPW();
                switch ($pw_result) {
                    case PHPWS_Error::isError($pw_result):
                        $title = dgettext('users', 'Reset my password');
                        $content = dgettext('users', 'Passwords were not acceptable for the following reason:');
                        $content .= '<br />' . $pw_result->getmessage() . '<br />';
                        $content .= User_Form::resetPassword($_POST['user_id'], $_POST['authhash']);
                        break;
                    case 0:
                        $title = dgettext('users', 'Sorry');
                        $content = dgettext('users', 'A problem occurred when trying to update your password. Please try again later.');
                        break;
                    case 1:
                        PHPWS_Core::home();
                        break;
                }
                break;
            default:
                PHPWS_Core::errorPage('404');
                break;
        }
        if (isset($message)) {
            $tag['MESSAGE'] = $message;
        }
        if (isset($title)) {
            $tag['TITLE'] = $title;
        }
        if (isset($content)) {
            $tag['CONTENT'] = $content;
        }
        if (isset($tag)) {
            $final = PHPWS_Template::process($tag, 'users', 'user_main.tpl');
            Layout::add($final);
        }
    }
 protected function getHtmlView($data, \Request $request)
 {
     $content = \systemsinventory\Factory\ContactInfo::form($request, 'view_system');
     $view = new \View\HtmlView(\PHPWS_ControlPanel::display($content));
     return $view;
 }
Example #22
0
 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();
                     break;
                 case 0:
                     $this->message = dgettext('pagesmith', 'Not enough content to create a page.');
                     $this->loadForms();
                     $this->page->loadSections(true);
                     $this->forms->editPage();
                     break;
                 case 1:
                     $this->killSaved($this->page->id);
                     PHPWS_Cache::clearCache();
                     PHPWS_Core::reroute($this->page->url());
                     break;
             }
             break;
         case 'front_page_toggle':
             $db = \Database::newDB();
             $db->addTable('ps_page')->addValue('front_page', 0);
             $db->update();
             $this->loadPage();
             $this->page->front_page = (bool) $_GET['fp'];
             $this->page->save();
             PHPWS_Cache::clearCache();
             $this->removeFromMenu();
             $this->loadForms();
             $this->forms->pageList();
             break;
         case 'shorten_links':
             if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
                 Current_User::disallow();
             }
             $this->shortenLinks();
             PHPWS_Core::goBack();
             break;
         case 'lengthen_links':
             if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
                 Current_User::disallow();
             }
             $this->lengthenLinks();
             PHPWS_Core::goBack();
             break;
         case 'post_settings':
             if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
                 Current_User::disallow();
             }
             $this->postSettings();
             $this->message = dgettext('pagesmith', 'Settings saved');
             $this->loadForms();
             $this->forms->settings();
             break;
         default:
             PHPWS_Core::errorPage('404');
             break;
     }
     if ($javascript) {
         $tpl['TITLE'] = $this->title;
         $tpl['CONTENT'] = $this->content;
         $tpl['MESSAGE'] = $this->message;
         Layout::nakedDisplay(PHPWS_Template::process($tpl, 'pagesmith', 'admin_main.tpl'));
     } else {
         Layout::add(PHPWS_ControlPanel::display($this->panel->display($this->content, $this->title, $this->message)));
     }
 }
Example #23
0
 /**
  * Handles admin functions outside of file manager.
  * Expects an 'aop' command.
  */
 public function admin()
 {
     $javascript = false;
     // if true, sends to nakedDisplay
     $this->loadPanel();
     if (isset($_REQUEST['aop'])) {
         $aop = $_REQUEST['aop'];
     } else {
         $aop = $this->panel->getCurrentTab();
     }
     if (!Current_User::isLogged()) {
         Current_User::disallow();
         return;
     }
     if ($aop != 'edit_image' && $aop != 'get_images' && !Current_User::allow('filecabinet')) {
         Current_User::disallow();
         return;
     }
     // Requires an unrestricted user
     switch ($aop) {
         case 'delete_folder':
         case 'unpin':
             if (Current_User::isRestricted('filecabinet')) {
                 Current_User::disallow();
             }
     }
     switch ($aop) {
         case 'image':
             $this->panel->setCurrentTab('image');
             $this->title = dgettext('filecabinet', 'Image folders');
             $this->loadForms();
             $this->forms->getFolders(IMAGE_FOLDER);
             break;
         case 'multimedia':
             $this->panel->setCurrentTab('multimedia');
             $this->title = dgettext('filecabinet', 'Multimedia folders');
             $this->loadForms();
             $this->forms->getFolders(MULTIMEDIA_FOLDER);
             break;
         case 'add_folder':
             if (!Current_User::allow('filecabinet', 'edit_folders', null, null, true)) {
                 Current_User::disallow();
             }
             $javascript = true;
             $this->loadFolder();
             $this->addFolder();
             break;
         case 'classify':
             if (!Current_User::isDeity()) {
                 Current_User::errorPage();
             }
             $this->loadForms();
             $this->forms->classifyFileList();
             break;
         case 'classify_action':
             if (!Current_User::isDeity() || !Current_User::verifyAuthKey()) {
                 Current_User::errorPage();
             }
             $this->classifyAction();
             break;
         case 'classify_file':
             if (!Current_User::isDeity() || !Current_User::verifyAuthKey()) {
                 Current_User::disallow();
             }
             $this->loadForms();
             if (!empty($_POST['file_list'])) {
                 $this->forms->classifyFile($_POST['file_list']);
             } elseif (isset($_GET['file'])) {
                 $this->forms->classifyFile($_GET['file']);
             } else {
                 $this->forms->classifyFileList();
             }
             break;
         case 'post_classifications':
             if (!Current_User::isDeity()) {
                 Current_User::errorPage();
             }
             $result = $this->classifyFiles();
             if (is_array($result)) {
                 $this->message = implode('<br />', $result);
             }
             $this->loadForms();
             $this->forms->classifyFileList();
             break;
         case 'unpin':
             if (!Current_User::authorized('filecabinet')) {
                 Current_User::disallow();
             }
             Cabinet::unpinFolder();
             PHPWS_Core::goBack();
             break;
         case 'pin_form':
             $javascript = true;
             @($key_id = (int) $_GET['key_id']);
             if (!$key_id) {
                 javascript('close_refresh', array('refresh' => 0));
                 break;
             }
             $this->loadForms();
             $this->forms->pinFolder($key_id);
             break;
         case 'delete_folder':
             if (!Current_User::authorized('filecabinet', 'delete_folders', null, null, true)) {
                 Current_User::disallow();
             }
             $this->loadFolder();
             $this->folder->delete();
             PHPWS_Core::goBack();
             break;
         case 'delete_incoming':
             if (!Current_User::isDeity()) {
                 Current_User::errorPage();
             }
             $this->deleteIncoming();
             $this->loadForms();
             $this->forms->classifyFileList();
             break;
         case 'document':
             $this->panel->setCurrentTab('document');
             $this->title = dgettext('filecabinet', 'Document folders');
             $this->loadForms();
             $this->forms->getFolders(DOCUMENT_FOLDER);
             break;
         case 'edit_folder_modal':
             $javascript = true;
             $this->loadFolder();
             // permission check in function below
             $this->editFolder(false);
             break;
         case 'edit_folder':
             $javascript = true;
             $this->loadFolder();
             // permission check in function below
             $this->editFolder(true);
             break;
         case 'change_tn':
             $javascript = true;
             $this->changeTN();
             break;
         case 'post_thumbnail':
             $javascript = true;
             if ($this->postTN()) {
                 javascript('close_refresh');
             } else {
                 $this->message = dgettext('filecabinet', 'Could not save thumbnail image.');
                 $this->changeTN();
             }
             break;
         case 'post_folder':
             if (!Current_User::authorized('filecabinet', 'edit_folders')) {
                 Current_User::disallow();
             }
             $this->loadFolder();
             if ($this->folder->post()) {
                 if (!$this->folder->save()) {
                     self::setMessage(dgettext('filecabinet', 'Failed to create folder. Please check your logs.'));
                 }
             } else {
                 self::setMessage(dgettext('filecabinet', 'Failed to create folder. Please check your logs.'));
             }
             if (filter_input(INPUT_POST, 'js') == 1) {
                 javascript('close_refresh');
             } else {
                 PHPWS_Core::goBack();
             }
             break;
         case 'post_allowed_files':
             if (!Current_User::isDeity()) {
                 Current_User::disallow();
             }
             $this->loadForms();
             $this->forms->postAllowedFiles();
             $this->message = dgettext('filecabinet', 'File types saved.');
             $this->title = dgettext('filecabinet', 'Allowed file types');
             $this->content = $this->forms->fileTypes();
             break;
         case 'save_settings':
             if (!Current_User::isDeity()) {
                 Current_User::disallow();
             }
             $this->loadForms();
             $result = $this->forms->saveSettings();
             if (is_array($result)) {
                 $this->message = implode('<br />', $result);
             } else {
                 $this->message = dgettext('filecabinet', 'Settings saved.');
             }
         case 'settings':
             if (!Current_User::isDeity()) {
                 Current_User::disallow();
             }
             $this->loadForms();
             $this->title = dgettext('filecabinet', 'Settings');
             $this->content = $this->forms->settings();
             break;
         case 'view_folder':
             $this->viewFolder();
             break;
         case 'file_types':
             if (!Current_User::isDeity()) {
                 Current_User::disallow();
             }
             $this->loadForms();
             $this->title = dgettext('filecabinet', 'Allowed file types');
             $this->content = $this->forms->fileTypes();
             break;
         case 'fix_document_dir':
             if (!Current_User::isDeity() || !Current_User::verifyAuthKey()) {
                 Current_User::disallow();
             }
             if (strtolower($_GET['confirm']) == 'yes') {
                 $this->fixDocumentDirectories();
             }
             PHPWS_Core::reroute('index.php?module=filecabinet&tab=settings');
     }
     $template['TITLE'] =& $this->title;
     $template['MESSAGE'] =& $this->message;
     $template['CONTENT'] =& $this->content;
     if ($javascript) {
         $main = PHPWS_Template::process($template, 'filecabinet', 'javascript.tpl');
         Layout::nakedDisplay($main);
     } else {
         $main = PHPWS_Template::process($template, 'filecabinet', 'main.tpl');
         $this->panel->setContent($main);
         $finalPanel = $this->panel->display();
         Layout::add(PHPWS_ControlPanel::display($finalPanel));
     }
 }
Example #24
0
 protected function getHtmlView($data, \Request $request)
 {
     $content = Factory::form($request, 'contact_info');
     $view = new \View\HtmlView(\PHPWS_ControlPanel::display($content));
     return $view;
 }
Example #25
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function controlpanel_unregister($module, &$content)
{
    PHPWS_Core::initModClass('controlpanel', 'ControlPanel.php');
    return PHPWS_ControlPanel::unregisterModule($module, $content);
}
Example #26
0
 * @author Jeremy Booker <jbooker at tux dot appstate dot edu>
 */
if (!defined('PHPWS_SOURCE_DIR')) {
    include '../../core/conf/404.html';
    exit;
}
// Include some things we're probably going to always need
PHPWS_Core::initModClass('addthis', 'Settings.php');
PHPWS_Core::initModClass('addthis', 'SettingsView.php');
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'SaveSettings') {
    // save the settings
    $settings = addthis\Settings::getInstance();
    $settingList = $settings->getAll();
    $inputSettings = $_POST['enabled_check'];
    foreach ($settingList as $key => $value) {
        if (isset($inputSettings[$key])) {
            $settings->set($key, 1);
        } else {
            $settings->set($key, 0);
        }
    }
    // redirect to the 'show settings' page, with a success message
    header('HTTP/1.1 303 See Other');
    header("Location: index.php?module=addthis&action=ShowSettings");
    exit;
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ShowSettings') {
    // Create the settings view
    $settingsView = new addthis\SettingsView(addthis\Settings::getInstance());
    \Layout::add(\PHPWS_ControlPanel::display($settingsView->show()));
}
Example #27
0
<?php

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
if (!defined('PHPWS_SOURCE_DIR')) {
    include '../../core/conf/404.html';
    exit;
}
if ($_SESSION['User']->isLogged()) {
    Layout::add(PHPWS_ControlPanel::display());
}
Example #28
0
 public function main()
 {
     $request = \Server::getCurrentRequest();
     $title = $content = $message = NULL;
     PHPWS_Core::initModClass('menu', 'Menu_Item.php');
     if (!Current_User::allow('menu')) {
         Current_User::disallow(dgettext('menu', 'User attempted access to Menu administration.'));
         return;
     }
     if (isset($_REQUEST['command'])) {
         $command = $_REQUEST['command'];
     } else {
         $command = 'list';
     }
     // This is the AJAX switch. Byproduct of old module design :(
     switch ($command) {
         case 'adminlinks':
             $this->adminLinks($request);
             exit;
         case 'delete_link':
             $this->deleteLink($request);
             exit;
         case 'key_select':
             $this->keySelect();
             exit;
         case 'post_link':
             $this->postLink($request);
             exit;
         case 'move_link':
             $this->moveLink($request);
             exit;
         case 'move_menu':
             $this->moveMenu($request);
             exit;
         case 'menu_options':
             $this->menuOptions($request);
             exit;
         case 'move_under':
             $this->moveUnder($request);
             exit;
         case 'transfer_link':
             $this->transferLink($request);
             exit;
         case 'add_key_link':
             $this->addKeyLink($request);
             exit;
         case 'remove_key_link':
             $this->removeKeyLink($request);
             exit;
         case 'delete_menu':
             $this->deleteMenu($request);
             exit;
         case 'post_menu':
             $this->postMenu($request);
             \PHPWS_Core::goBack();
             exit;
         case 'pin_menu':
             $this->pinMenu($request);
             exit;
         case 'unpin_menu':
             $this->unpinMenu($request);
             exit;
         case 'change_display_type':
             $this->changeDisplayType($request);
             exit;
         case 'menu_data':
             $this->menuData($request);
             exit;
         case 'pin_all':
             $this->menuPinAll($request);
             exit;
         case 'clear_image':
             $this->clearImage($request);
             exit;
         case 'update_character_limit':
             $this->updateCharacterLimit($request);
             exit;
         case 'new_link_menu':
             $this->updateNewLink($request);
             exit;
         case 'link_icons':
             $this->updateLinkIcons($request);
             exit;
         case 'force_shortcut':
             $this->forceShortcut();
             exit;
     }
     // This is the display switch or the HTML view switch
     switch ($command) {
         case 'list':
             $title = 'Menus';
             $content = $this->menuList();
             break;
         case 'reset_menu':
             if (!\Current_User::isDeity() && !\Current_User::authorized('menu')) {
                 throw new \Http\MethodNotAllowedException();
             }
             $this->resetMenu();
             PHPWS_Core::goBack();
             exit;
         default:
             throw new \Http\MethodNotAllowedException();
     }
     $tpl['title'] = $title;
     $tpl['content'] = $content;
     if (!empty($message)) {
         $tpl['message'] = $message;
     }
     $template = new \Template($tpl);
     $template->setModuleTemplate('menu', 'admin/main.html');
     Layout::add(PHPWS_ControlPanel::display($template->get()));
 }