コード例 #1
0
ファイル: Menu.php プロジェクト: HaldunA/phpwebsite
 public static function miniadmin()
 {
     if (!Current_User::allow('menu')) {
         return;
     }
     // Default link. Takes user to menu admin screen
     MiniAdmin::add('menu', \PHPWS_Text::secureLink('<span class="fa fa-cog"></span> Administrate menus', 'menu', array('command' => 'list')));
     $key = \Key::getCurrent();
     $link_list = self::getLinkList();
     if ($key && !$key->isDummy(true)) {
         javascript('jquery');
         \Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'mod/menu/javascript/administrate/minilink.js"></script>');
         $found = false;
         $used_menus = array();
         foreach ($link_list as $link) {
             $menu_id = 0;
             extract($link);
             if ($key_id == $key->id) {
                 if (!in_array($menu_id, $used_menus)) {
                     $used_menus[] = $menu_id;
                     MiniAdmin::add('menu', '<a href="javascript:void(0)" data-key-id="' . $key->id . '" data-menu-id="' . $menu_id . '" id="menu-remove-page"><span class="fa fa-times"></span> ' . t('Remove from %s', $menu_title) . '</a>');
                     $found = true;
                 }
             }
         }
         if (!$found) {
             self::miniadminAddMenu($key);
         }
         self::miniadminPinMenu($key);
         self::miniadminUnpin($key);
     }
 }
コード例 #2
0
 public function show()
 {
     $tpl = array();
     $tpl['LOGOUT_LINK'] = PHPWS_Text::secureLink(_('Log Out'), 'users', array('action' => 'user', 'command' => 'logout'));
     Layout::addPageTitle("Contact");
     return PHPWS_Template::process($tpl, 'hms', 'student/contact_form_thankyou.tpl');
 }
コード例 #3
0
ファイル: Base.php プロジェクト: HaldunA/phpwebsite
 protected function propertiesList($contact_id = null)
 {
     \PHPWS_Core::initModClass('properties', 'Property.php');
     $this->title = 'Property listing';
     $pager = new \DBPager('properties', 'Properties\\Property');
     if ($contact_id) {
         $pager->addWhere('contact_id', $contact_id);
         $data['is_contact'] = 1;
         $page_tags['new'] = \PHPWS_Text::moduleLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('cop' => 'edit_property', 'k' => $this->contact->getKey()), null, null, 'btn btn-success');
     } else {
         $page_tags['new'] = \PHPWS_Text::secureLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('aop' => 'edit_property'), null, null, 'btn btn-success');
     }
     // photo was previously uploaded
     if (!empty($_GET['pid'])) {
         $data['pid'] = $_GET['pid'];
     } else {
         $data['pid'] = 0;
     }
     javascriptMod('properties', 'photo_upload', $data);
     $pager->setSearch('name', 'company_name');
     $pager->addSortHeader('name', 'Name of property');
     $pager->addSortHeader('company_name', 'Management company');
     $pager->addSortHeader('timeout', 'Time until purge');
     $pager->setModule('properties');
     $pager->setTemplate('properties_list.tpl');
     $pager->addRowTags('row_tags', (bool) $contact_id);
     $pager->joinResult('contact_id', 'prop_contacts', 'id', 'company_name', null, true);
     $pager->addPageTags($page_tags);
     $pager->cacheQueries();
     $this->content = $pager->get();
 }
コード例 #4
0
ファイル: Student_UI.php プロジェクト: jlbooker/homestead
 public function show_verify_assignment()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Term.php');
     PHPWS_Core::initModClass('hms', 'HMS_SOAP.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php');
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Movein_Time.php');
     $tpl = array();
     $assignment = HMS_Assignment::get_assignment($_SESSION['asu_username'], $_SESSION['application_term']);
     if ($assignment === NULL || $assignment == FALSE) {
         $tpl['NO_ASSIGNMENT'] = "You do not currently have a housing assignment.";
     } else {
         $tpl['ASSIGNMENT'] = $assignment->where_am_i() . '<br />';
         # Determine the student's type and figure out their movein time
         $type = HMS_SOAP::get_student_type($_SESSION['asu_username'], $_SESSION['application_term']);
         if ($type == TYPE_CONTINUING) {
             $movein_time_id = $assignment->get_rt_movein_time_id();
         } elseif ($type == TYPE_TRANFER) {
             $movein_time_id = $assignment->get_t_movein_time_id();
         } else {
             $movein_time_id = $assignment->get_f_movein_time_id();
         }
         if ($movein_time_id == NULL) {
             $tpl['MOVE_IN_TIME'] = 'To be determined<br />';
         } else {
             $movein_times = HMS_Movein_Time::get_movein_times_array($_SESSION['application_term']);
             $tpl['MOVE_IN_TIME'] = $movein_times[$movein_time_id];
         }
     }
     //get the assignees to the room that the bed that the assignment is in
     $assignees = !is_null($assignment) ? $assignment->get_parent()->get_parent()->get_assignees() : NULL;
     $roommates = array();
     if (!is_null($assignees)) {
         foreach ($assignees as $roommate) {
             if ($roommate->asu_username != $_SESSION['asu_username']) {
                 $roommates[] = $roommate->asu_username;
             }
         }
     }
     if (empty($roommates)) {
         $tpl['roommate'][]['ROOMMATE'] = 'You do not have a roommate.';
     } else {
         foreach ($roommates as $roommate) {
             $tpl['roommate'][]['ROOMMATE'] = '' . HMS_SOAP::get_name($roommate) . ' (<a href="mailto:' . $roommate . '@appstate.edu">' . $roommate . '@appstate.edu</a>)';
         }
     }
     $rlc_assignment = HMS_RLC_Assignment::check_for_assignment($_SESSION['asu_username'], $_SESSION['application_term']);
     if ($rlc_assignment == NULL || $rlc_assignment === FALSE) {
         $tpl['RLC'] = "You have not been accepted to an RLC.";
     } else {
         $rlc_list = HMS_Learning_Community::getRlcList();
         $tpl['RLC'] = 'You have been assigned to the ' . $rlc_list[$rlc_assignment['rlc_id']];
     }
     $tpl['MENU_LINK'] = PHPWS_Text::secureLink('Back to Main Menu', 'hms', array('type' => 'student', 'op' => 'show_main_menu'));
     return PHPWS_Template::process($tpl, 'hms', 'student/verify_assignment.tpl');
 }
コード例 #5
0
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php');
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Movein_Time.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     $tpl = array();
     $assignment = HMS_Assignment::getAssignment($this->student->getUsername(), $this->term);
     if ($assignment === NULL || $assignment == FALSE) {
         $tpl['NO_ASSIGNMENT'] = "You do not currently have a housing assignment.";
     } else {
         $tpl['ASSIGNMENT'] = $assignment->where_am_i() . '<br />';
         # Determine the student's type and figure out their movein time
         $type = $this->student->getType();
         if ($type == TYPE_CONTINUING) {
             $movein_time_id = $assignment->get_rt_movein_time_id();
         } elseif ($type == TYPE_TRANSFER) {
             $movein_time_id = $assignment->get_t_movein_time_id();
         } else {
             $movein_time_id = $assignment->get_f_movein_time_id();
         }
         if ($movein_time_id == NULL) {
             $tpl['MOVE_IN_TIME'] = 'To be determined<br />';
         } else {
             $movein_times = HMS_Movein_Time::get_movein_times_array($this->term);
             $tpl['MOVE_IN_TIME'] = $movein_times[$movein_time_id];
         }
     }
     //get the assignees to the room that the bed that the assignment is in
     $assignees = !is_null($assignment) ? $assignment->get_parent()->get_parent()->get_assignees() : NULL;
     if (!is_null($assignees)) {
         foreach ($assignees as $roommate) {
             if ($roommate->getUsername() != $this->student->getUsername()) {
                 $assignment = HMS_Assignment::getAssignment($roommate->getUsername(), $this->term);
                 $assignment->loadBed();
                 $label = $assignment->_bed->bedroom_label;
                 $tpl['roommate'][]['ROOMMATE'] = $roommate->getFullName() . ' - ' . $label . ' (' . $roommate->getEmailLink() . ')';
             }
         }
     } else {
         $tpl['roommate'] = 'You do not have a roommate';
     }
     $rlc_assignment = HMS_RLC_Assignment::checkForAssignment($this->student->getUsername(), $this->term);
     if ($rlc_assignment == NULL || $rlc_assignment === FALSE) {
         $tpl['RLC'] = "You have not been accepted to an RLC.";
     } else {
         $rlc_list = HMS_Learning_Community::getRlcList();
         $tpl['RLC'] = 'You have been assigned to the ' . $rlc_list[$rlc_assignment['rlc_id']];
     }
     $tpl['MENU_LINK'] = PHPWS_Text::secureLink('Back to Main Menu', 'hms', array('type' => 'student', 'op' => 'show_main_menu'));
     Layout::addPageTitle("Verify Assignment");
     return PHPWS_Template::process($tpl, 'hms', 'student/verify_assignment.tpl');
 }
コード例 #6
0
ファイル: GenericTracker.php プロジェクト: HaldunA/phpwebsite
 public function getPagerTags()
 {
     $template['NAME'] = $this->name;
     $template['TYPE'] = $this->type;
     $template['ACTIVE'] = $this->active ? 'Active' : 'Inactive';
     $template['ACTION'] = 'Herp';
     $actions = array();
     $actions[] = PHPWS_Text::secureLink('Edit', 'analytics', array('command' => 'edit', 'tracker_id' => $this->id));
     $actions[] = PHPWS_Text::secureLink('Delete', 'analytics', array('command' => 'delete', 'tracker_id' => $this->id));
     $template['ACTION'] = implode(' | ', $actions);
     return $template;
 }
コード例 #7
0
ファイル: Reasons.php プロジェクト: HaldunA/phpwebsite
 public function rowTags()
 {
     $vars['reason_id'] = $this->id;
     $vars['aop'] = 'edit_reason';
     $links[] = PHPWS_Text::secureLink(Icon::show('edit'), 'checkin', $vars);
     $vars['aop'] = 'delete_reason';
     $js['question'] = dgettext('confirm', 'Are you sure you want to delete this reason?.');
     $js['address'] = PHPWS_Text::linkAddress('checkin', $vars, true);
     $js['link'] = Icon::show('delete');
     $links[] = javascript('confirm', $js);
     $tpl['ACTION'] = implode('', $links);
     return $tpl;
 }
コード例 #8
0
 public function show()
 {
     $tpl = array();
     $tpl['VIEW_APPLICATION'] = PHPWS_Text::secureLink(_('View My Application'), 'hms', array('type' => 'student', 'op' => 'view_application'));
     $tpl['MAIN_MENU_LINK'] = PHPWS_Text::secureLink(_('Back to Main Menu'), 'hms', array('type' => 'student', 'op' => 'main'));
     $tpl['LOGOUT_LINK'] = PHPWS_Text::moduleLink(_('Logout'), 'users', array('action' => 'user', 'command' => 'logout'));
     // TODO HMS_Entry_Term is deprecated, use something else
     PHPWS_Core::initModClass('hms', 'HMS_Entry_Term.php');
     if (HMS_Entry_Term::get_entry_semester($_SESSION['asu_username']) == TERM_FALL) {
         $tpl['RLC_LINK'] = PHPWS_Text::secureLink(_('Residential Learning Communities Application'), 'hms', array('type' => 'student', 'op' => 'show_rlc_application_form'));
     }
     Layout::addPageTitle("Thank you");
     return PHPWS_Template::process($tpl, 'hms', 'student/student_application_thankyou.tpl');
 }
コード例 #9
0
ファイル: Feed.php プロジェクト: HaldunA/phpwebsite
 public function pagerTags()
 {
     $vars['command'] = 'reset_feed';
     $vars['feed_id'] = $this->id;
     $links[] = PHPWS_Text::secureLink('<i class="fa fa-refresh" title="' . dgettext('rss', 'Reset') . '"></i>', 'rss', $vars);
     $links[] = '<i data-id="' . $this->id . '" class="edit-feed pointer fa fa-edit" title="' . dgettext('rss', 'Edit the feed') . '"></i>';
     $js['QUESTION'] = dgettext('rss', 'Are you sure you want to delete this RSS feed?');
     $js['ADDRESS'] = sprintf('index.php?module=rss&command=delete_feed&feed_id=%s&authkey=%s', $this->id, Current_User::getAuthKey());
     $js['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('rss', 'Delete feed') . '"></i>';
     $links[] = javascript('confirm', $js);
     $tpl['ACTION'] = implode(' ', $links);
     if ($this->display) {
         $vars['command'] = 'turn_off_display';
         $tpl['DISPLAY'] = PHPWS_Text::secureLink(dgettext('rss', 'Yes'), 'rss', $vars);
     } else {
         $vars['command'] = 'turn_on_display';
         $tpl['DISPLAY'] = PHPWS_Text::secureLink(dgettext('rss', 'No'), 'rss', $vars);
     }
     $hours = floor($this->refresh_time / 3600);
     $remaining = $this->refresh_time - $hours * 3600;
     $minutes = floor($remaining / 60);
     $seconds = $remaining - $minutes * 60;
     $time = NULL;
     if ($seconds) {
         $time = sprintf(dgettext('rss', '%d seconds'), $seconds);
     }
     if ($minutes) {
         if (isset($time)) {
             $time = sprintf(dgettext('rss', '%d minutes, '), $minutes) . $time;
         } else {
             $time = sprintf(dgettext('rss', '%d minutes'), $minutes) . $time;
         }
     }
     if ($hours) {
         if (isset($time)) {
             $time = sprintf(dgettext('rss', '%d hours, '), $hours) . $time;
         } else {
             $time = sprintf(dgettext('rss', '%d hours'), $hours) . $time;
         }
     }
     $refresh_time = sprintf(dgettext('rss', 'Every %s'), $time);
     $shortened_array = parse_url($this->address);
     $shortened = $shortened_array['scheme'] . '://' . $shortened_array['host'];
     $tpl['ADDRESS'] = sprintf('<a href="%s" title="%s">%s</a>', $this->address, $this->address, $shortened);
     $tpl['REFRESH_TIME'] = $refresh_time;
     return $tpl;
 }
コード例 #10
0
 /**
  * Main display method
  */
 public function display()
 {
     javascript('jquery');
     // housekeeping
     if (isset($_SESSION['query'])) {
         unset($_SESSION['query']);
     }
     $tags = array();
     // Total number of internships for Diety users
     if (\Current_User::isDeity()) {
         $tags['GRAND_TOTAL_LABEL'] = _('Total Internships in Database: ');
         $db = new \PHPWS_DB('intern_internship');
         $gt = $db->select('count');
         $tags['GRAND_TOTAL'] = $gt;
     }
     // Example form link
     $tags['EXAMPLE_LINK'] = \PHPWS_Text::secureLink('Example form', 'intern', array('action' => 'example_form'));
     return \PHPWS_Template::process($tags, 'intern', 'menu.tpl');
 }
コード例 #11
0
ファイル: Whatsnew_Forms.php プロジェクト: HaldunA/phpwebsite
 function editSettings()
 {
     $form = new PHPWS_Form('whatsnew_settings');
     $form->addHidden('module', 'whatsnew');
     $form->addHidden('aop', 'post_settings');
     $form->addCheckbox('enable', 1);
     $form->setMatch('enable', PHPWS_Settings::get('whatsnew', 'enable'));
     $form->setLabel('enable', dgettext('whatsnew', 'Enable whatsnew'));
     $form->addCheckbox('homeonly', 1);
     $form->setMatch('homeonly', PHPWS_Settings::get('whatsnew', 'homeonly'));
     $form->setLabel('homeonly', dgettext('whatsnew', 'Show whatsnew sidebox on home page only'));
     $form->addTextField('title', PHPWS_Settings::get('whatsnew', 'title'));
     $form->setLabel('title', dgettext('whatsnew', 'Sidebox title'));
     $form->setSize('title', 30);
     $form->addTextArea('text', PHPWS_Settings::get('whatsnew', 'text'));
     $form->setRows('text', '4');
     $form->setCols('text', '40');
     $form->setLabel('text', dgettext('whatsnew', 'Sidebox text'));
     $form->addTextField('cache_timeout', PHPWS_Settings::get('whatsnew', 'cache_timeout'));
     $form->setLabel('cache_timeout', dgettext('whatsnew', 'Cache duration for whatsnew list (in seconds, 0-7200)'));
     $form->setSize('cache_timeout', 4, 4);
     $form->addTextField('qty_items', PHPWS_Settings::get('whatsnew', 'qty_items'));
     $form->setLabel('qty_items', dgettext('whatsnew', 'Number of recent items to display (0-50)'));
     $form->setSize('qty_items', 4, 4);
     $form->addCheckbox('show_summaries', 1);
     $form->setMatch('show_summaries', PHPWS_Settings::get('whatsnew', 'show_summaries'));
     $form->setLabel('show_summaries', dgettext('whatsnew', 'Show item summaries'));
     $form->addCheckbox('show_dates', 1);
     $form->setMatch('show_dates', PHPWS_Settings::get('whatsnew', 'show_dates'));
     $form->setLabel('show_dates', dgettext('whatsnew', 'Show item update dates'));
     $form->addCheckbox('show_source_modules', 1);
     $form->setMatch('show_source_modules', PHPWS_Settings::get('whatsnew', 'show_source_modules'));
     $form->setLabel('show_source_modules', dgettext('whatsnew', 'Show item source module names'));
     $form->addSubmit('save', dgettext('whatsnew', 'Save settings'));
     $tpl = $form->getTemplate();
     $tpl['SETTINGS_LABEL'] = dgettext('whatsnew', 'General Settings');
     $tpl['FLUSH_LINK'] = PHPWS_Text::secureLink(dgettext('whatsnew', 'Flush cache'), 'whatsnew', array('aop' => 'flush_cache'));
     $tpl['EXCLUDE'] = $this->whatsnew->getKeyMods(unserialize(PHPWS_Settings::get('whatsnew', 'exclude')), 'exclude');
     $tpl['EXCLUDE_LABEL'] = dgettext('whatsnew', 'Select any modules you wish to exclude from your whatsnew box.');
     $this->whatsnew->title = dgettext('whatsnew', 'Settings');
     $this->whatsnew->content = PHPWS_Template::process($tpl, 'whatsnew', 'edit_settings.tpl');
 }
コード例 #12
0
 public static function plug()
 {
     $tpl = array();
     $tpl['HOME_LINK'] = PHPWS_Text::moduleLink('Menu', 'intern');
     $tpl['ADD_LINK'] = PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'edit_internship'));
     $tpl['SEARCH_LINK'] = PHPWS_Text::moduleLink('Search', 'intern', array('action' => 'search'));
     $auth = Current_User::getAuthorization();
     $tpl['USER_FULL_NAME'] = Current_User::getDisplayName();
     $tpl['LOGOUT_URI'] = $auth->logout_link;
     $adminOptions = array();
     // Edit list of majors
     if (Current_User::allow('intern', 'edit_major')) {
         $adminOptions['EDIT_MAJORS_LINK'] = PHPWS_Text::secureLink('Edit Undergraduate Majors', 'intern', array('action' => MAJOR_EDIT));
     }
     // Edit list grad programs
     if (Current_User::allow('intern', 'edit_grad_prog')) {
         $adminOptions['EDIT_GRAD_LINK'] = PHPWS_Text::secureLink('Edit Graduate Programs', 'intern', array('action' => GRAD_PROG_EDIT));
     }
     // Edit departments
     if (Current_User::allow('intern', 'edit_dept')) {
         $adminOptions['EDIT_DEPARTMENTS_LINK'] = PHPWS_Text::secureLink('Edit Departments', 'intern', array('action' => DEPT_EDIT));
     }
     // Edit list of states
     if (Current_User::allow('intern', 'edit_states')) {
         $adminOptions['EDIT_STATES_LINK'] = PHPWS_Text::secureLink('Edit States', 'intern', array('action' => STATE_EDIT));
     }
     if (Current_User::isDeity()) {
         $adminOptions['CONTROL_PANEL'] = PHPWS_Text::secureLink('Control Panel', 'controlpanel');
         $adminOptions['EDIT_ADMINS_LINK'] = PHPWS_Text::secureLink('Edit Administrators', 'intern', array('action' => 'edit_admins'));
     }
     // If any admin options were added, them show the dropdown and merge those
     // links into the main set of template tags
     if (sizeof($adminOptions) > 0) {
         $tpl['ADMIN_OPTIONS'] = '';
         // dummy var to show dropdown menu in template
         $tpl = array_merge($tpl, $adminOptions);
     }
     Layout::plug(PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS');
 }
コード例 #13
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 private function viewReported()
 {
     javascriptMod('properties', 'report');
     javascript('confirm');
     \PHPWS_Core::initModClass('properties', 'Report.php');
     $this->title = 'Reported messages';
     $pager = new \DBPager('prop_report', 'Properties\\Report');
     if (!isset($_SESSION['prop_show_blocked'])) {
         $vars['aop'] = 'show_blocked';
         $tags['BLOCKED'] = \PHPWS_Text::secureLink('Show blocked', 'properties', $vars, null, null, 'btn btn-default');
         $pager->db->addWhere('prop_report.block', 0);
     } else {
         $vars['aop'] = 'hide_blocked';
         $tags['BLOCKED'] = \PHPWS_Text::secureLink('Hide blocked', 'properties', $vars, null, null, 'btn btn-default');
     }
     $pager->addPageTags($tags);
     $pager->addSortHeader('date_sent', 'Date reported');
     $pager->joinResult('message_id', 'prop_messages', 'id', 'body', 'message');
     $pager->db->addJoin('left', 'prop_report', 'prop_messages', 'message_id', 'id');
     $pager->setModule('properties');
     $pager->setTemplate('reported_list.tpl');
     $pager->addRowTags('row');
     $this->content = $pager->get();
 }
コード例 #14
0
ファイル: File_Manager.php プロジェクト: HaldunA/phpwebsite
 /**
  * View of files in current folder
  */
 public function folderContentView()
 {
     javascript('jquery');
     PHPWS_Core::initModClass('filecabinet', 'Image.php');
     javascript('confirm');
     // needed for deletion
     Layout::addStyle('filecabinet');
     if (empty($this->current_folder) || empty($this->folder_type)) {
         javascript('alert', array('content' => dgettext('filecabinet', 'Problem with opening browser page. Closing File Manager window.')));
         javascript('close_refresh', array('timeout' => 3, 'refresh' => 0));
         return;
     }
     $tpl = array();
     $this->folderIcons($tpl);
     if (Current_User::allow('filecabinet', 'edit_folders')) {
         $tpl['FOLDER_TITLE'] = $this->current_folder->editLink('title', $this->current_folder->module_created);
     } else {
         $tpl['FOLDER_TITLE'] =& $this->current_folder->title;
     }
     $img_dir = PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/file_manager/';
     $image_string = '<img src="%s" title="%s" alt="%s" />';
     $link_info = $this->linkInfo();
     switch ($this->folder_type) {
         case IMAGE_FOLDER:
             $js = $link_info;
             $js['authkey'] = Current_User::getAuthKey();
             $js['failure_message'] = dgettext('filecabinet', 'Unable to resize image.');
             $js['confirmation'] = sprintf(dgettext('filecabinet', 'This image is larger than the %s x %s limit. Do you want to resize the image to fit?'), $this->max_width, $this->max_height);
             javascriptMod('filecabinet', 'pick_file', $js);
             $db = new PHPWS_DB('images');
             $class_name = 'PHPWS_Image';
             $file_type = FC_IMAGE;
             $altvars = $link_info;
             // check
             unset($altvars['mw']);
             unset($altvars['mh']);
             unset($altvars['fr']);
             $img1 = 'folder_random.png';
             $img2 = 'thumbnails.png';
             $img3 = 'lightbox.png';
             $img1_alt = dgettext('filecabinet', 'Random image icon');
             $img2_alt = dgettext('filecabinet', 'Thumbnail icon');
             $img3_alt = dgettext('filecabinet', 'Lightbox icon');
             if (!$this->reserved_folder) {
                 if ($this->current_folder->public_folder) {
                     $altvars['id'] = $this->current_folder->id;
                     $altvars['fop'] = 'pick_file';
                     $altvars['file_type'] = FC_IMAGE_RANDOM;
                     $not_allowed = dgettext('filecabinet', 'Action not allowed');
                     if (!$this->lock_type || in_array(FC_IMAGE_RANDOM, $this->lock_type)) {
                         $img1_title = dgettext('filecabinet', 'Show a random image from this folder');
                         $image1 = sprintf($image_string, $img_dir . $img1, $img1_title, $img1_alt);
                         $tpl['ALT1'] = PHPWS_Text::secureLink($image1, 'filecabinet', $altvars);
                         if ($this->file_assoc->file_type == FC_IMAGE_RANDOM && $this->current_folder->id == $this->file_assoc->file_id) {
                             $tpl['ALT_HIGH1'] = ' alt-high';
                         }
                     } else {
                         $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt);
                         $tpl['ALT1'] = $image1;
                         $tpl['ALT_HIGH1'] = ' no-use';
                     }
                     if (!$this->lock_type || in_array(FC_IMAGE_FOLDER, $this->lock_type)) {
                         /** start new * */
                         if ($this->file_assoc->file_type == FC_IMAGE_FOLDER) {
                             $tpl['ALT_HIGH2'] = ' alt-high';
                         }
                         $img2_title = dgettext('filecabinet', 'Show block of thumbnails');
                         $image2 = sprintf($image_string, $img_dir . $img2, $img2_title, $img2_alt);
                         $form = new PHPWS_Form('carousel-options');
                         $form->setMethod('get');
                         $altvars['file_type'] = FC_IMAGE_FOLDER;
                         $form->addHidden($altvars);
                         $form->addHidden('module', 'filecabinet');
                         $form->addRadioAssoc('direction', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical')));
                         $match = $this->file_assoc->vertical;
                         $form->setMatch('direction', $match);
                         $num = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8);
                         $form->addSelect('num_visible', $num);
                         $form->setLabel('num_visible', dgettext('filecabinet', 'Number shown'));
                         $form->setMatch('num_visible', $this->file_assoc->num_visible);
                         $form->addSubmit('go', dgettext('filecabinet', 'Go'));
                         $subtpl = $form->getTemplate();
                         $subtpl['DIRECTION_DESC'] = dgettext('filecabinet', 'Carousel direction');
                         $subtpl['LINK'] = sprintf('<a href="#" onclick="return carousel_pick();">%s</a>', $image2);
                         $subtpl['CANCEL'] = dgettext('filecabinet', 'Cancel');
                         $tpl['ALT2'] = PHPWS_Template::process($subtpl, 'filecabinet', 'file_manager/carousel_pick.tpl');
                     } else {
                         $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt);
                         $tpl['ALT2'] = $image2;
                         $tpl['ALT_HIGH2'] = ' no-use';
                     }
                     if (!$this->lock_type || in_array(FC_IMAGE_LIGHTBOX, $this->lock_type)) {
                         /** start VV * */
                         if ($this->file_assoc->file_type == FC_IMAGE_LIGHTBOX) {
                             $tpl['ALT_HIGH3'] = ' alt-high';
                         }
                         $img3_title = dgettext('filecabinet', 'Show lightbox slideshow');
                         $image3 = sprintf($image_string, $img_dir . $img3, $img3_title, $img3_alt);
                         $altvars['file_type'] = FC_IMAGE_LIGHTBOX;
                         $form = new PHPWS_Form('lightbox-options');
                         $form->setMethod('get');
                         $form->addHidden($altvars);
                         $form->addHidden('module', 'filecabinet');
                         $form->addRadioAssoc('direction', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical')));
                         $match = $this->file_assoc->vertical;
                         $form->setMatch('direction', $match);
                         $num = array(3 => 3, 6 => 6, 9 => 9, 12 => 12, 15 => 15, 18 => 18, 21 => 21, 99 => 'unlimited');
                         $form->addSelect('num_visible', $num);
                         $form->setLabel('num_visible', dgettext('filecabinet', 'Number shown'));
                         $form->setMatch('num_visible', $this->file_assoc->num_visible);
                         $form->addSubmit('go', dgettext('filecabinet', 'Go'));
                         $subtpl = $form->getTemplate();
                         $subtpl['DIRECTION_DESC'] = dgettext('filecabinet', 'Thumbnail direction');
                         $subtpl['LINK'] = sprintf('<a href="#" onclick="return lightbox_pick();">%s</a>', $image3);
                         $subtpl['CANCEL'] = dgettext('filecabinet', 'Cancel');
                         $tpl['ALT3'] = PHPWS_Template::process($subtpl, 'filecabinet', 'file_manager/lightbox_pick.tpl');
                     } else {
                         $image3 = sprintf($image_string, $img_dir . $img3, $not_allowed, $img3_alt);
                         $tpl['ALT3'] = $image3;
                         $tpl['ALT_HIGH3'] = ' no-use';
                     }
                 } else {
                     $not_allowed = dgettext('filecabinet', 'Action not allowed - private folder');
                     $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt);
                     $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt);
                     $image3 = sprintf($image_string, $img_dir . $img3, $not_allowed, $img3_alt);
                     $tpl['ALT1'] = $image1;
                     $tpl['ALT_HIGH1'] = ' no-use';
                     $tpl['ALT2'] = $image2;
                     $tpl['ALT_HIGH2'] = ' no-use';
                     $tpl['ALT3'] = $image3;
                     $tpl['ALT_HIGH3'] = ' no-use';
                 }
             }
             break;
         case DOCUMENT_FOLDER:
             PHPWS_Core::initModClass('filecabinet', 'Document.php');
             $db = new PHPWS_DB('documents');
             $class_name = 'PHPWS_Document';
             $file_type = FC_DOCUMENT;
             $img1 = 'all_files.png';
             $img1_alt = dgettext('filecabinet', 'All files icon');
             if ($this->current_folder->public_folder) {
                 if (!$this->lock_type || in_array(FC_DOCUMENT_FOLDER, $this->lock_type)) {
                     $altvars = $link_info;
                     $altvars['id'] = $this->current_folder->id;
                     $altvars['fop'] = 'pick_file';
                     $altvars['file_type'] = FC_DOCUMENT_FOLDER;
                     $img1_title = dgettext('filecabinet', 'Show all files in the folder');
                     $image1 = sprintf($image_string, $img_dir . $img1, $img1_title, $img1_alt);
                     $tpl['ALT1'] = PHPWS_Text::secureLink($image1, 'filecabinet', $altvars);
                     if ($this->file_assoc->file_type == FC_DOCUMENT_FOLDER && $this->current_folder->id == $this->file_assoc->file_id) {
                         $tpl['ALT_HIGH1'] = ' alt-high';
                     }
                 } else {
                     $not_allowed = dgettext('filecabinet', 'Action not allowed');
                     $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt);
                     $tpl['ALT1'] = $image1;
                     $tpl['ALT_HIGH1'] = ' no-use';
                 }
             } else {
                 $not_allowed = dgettext('filecabinet', 'Action not allowed - private folder');
                 $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt);
                 $tpl['ALT1'] = $image1;
                 $tpl['ALT_HIGH1'] = ' no-use';
             }
             break;
         case MULTIMEDIA_FOLDER:
             $js = $link_info;
             $js['authkey'] = Current_User::getAuthKey();
             $js['failure_message'] = dgettext('filecabinet', 'Unable to resize media.');
             $js['confirmation'] = sprintf(dgettext('filecabinet', 'This media is larger than the %s x %s limit. Do you want to resize the media to fit?'), $this->max_width, $this->max_height);
             javascriptMod('filecabinet', 'pick_file', $js);
             PHPWS_Core::initModClass('filecabinet', 'Multimedia.php');
             $db = new PHPWS_DB('multimedia');
             $class_name = 'PHPWS_Multimedia';
             $file_type = FC_MEDIA;
             //$tpl['ADD_EMBED'] = $this->current_folder->embedLink(true);
             break;
     }
     $db->addWhere('folder_id', $this->current_folder->id);
     $db->addOrder('title');
     $items = $db->getObjects($class_name);
     if ($items) {
         foreach ($items as $item) {
             $stpl = $item->managerTpl($this);
             $tpl['items'][] = $stpl;
         }
     } else {
         $not_allowed = dgettext('filecabinet', 'No files in folder');
         if (isset($tpl['ALT1'])) {
             $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt);
             $tpl['ALT1'] = $image1;
             $tpl['ALT_HIGH1'] = ' no-use';
         }
         if (isset($tpl['ALT2'])) {
             $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt);
             $tpl['ALT2'] = $image2;
             $tpl['ALT_HIGH2'] = ' no-use';
         }
     }
     if (Current_User::allow('filecabinet', 'edit_folders', $this->current_folder->id, 'folder')) {
         if ($this->force_upload_dimensions) {
             $tpl['ADD_FILE'] = $this->current_folder->uploadLink(true, $this->max_width, $this->max_height);
         } else {
             $tpl['ADD_FILE'] = $this->current_folder->uploadLink(true);
         }
     }
     $tpl['CLOSE'] = javascript('close_window');
     return PHPWS_Template::process($tpl, 'filecabinet', 'file_manager/folder_content_view.tpl');
 }
コード例 #15
0
ファイル: WikiManager.php プロジェクト: Jopperi/wiki
 /**
  * Adds wiki links to the MiniAdmin box
  *
  * @author Greg Meiste <*****@*****.**>
  */
 function addToMiniAdmin()
 {
     $admin = dgettext('wiki', 'Admin');
     $image = dgettext('wiki', 'Image upload');
     $linkshere = dgettext('wiki', 'What links here');
     $recentchanges = dgettext('wiki', 'Recent changes');
     $randompage = dgettext('wiki', 'Random page');
     $interwiki = dgettext('wiki', 'Interwiki setup');
     if (isset($_REQUEST['page']) && isset($_REQUEST['page_op']) && $_REQUEST['page_op'] == 'view' && PHPWS_Settings::get('wiki', 'what_links_here')) {
         $links[] = PHPWS_Text::moduleLink($linkshere, 'wiki', array('page' => $_REQUEST['page'], 'page_op' => 'whatlinkshere'));
     }
     if (PHPWS_Settings::get('wiki', 'recent_changes')) {
         $links[] = PHPWS_Text::moduleLink($recentchanges, 'wiki', array('op' => 'recentchanges'));
     }
     if (PHPWS_Settings::get('wiki', 'random_page')) {
         $links[] = PHPWS_Text::moduleLink($randompage, 'wiki', array('op' => 'random'));
     }
     if (PHPWS_Settings::get('wiki', 'allow_image_upload') && Current_User::isLogged() || Current_User::allow('wiki', 'upload_images')) {
         $links[] = PHPWS_Text::secureLink($image, 'wiki', array('op' => 'imageupload'));
     }
     if (Current_User::allow('wiki', 'edit_page') || PHPWS_Settings::get('wiki', 'allow_page_edit') && Current_User::isLogged()) {
         $links[] = PHPWS_Text::secureLink($interwiki, 'wiki', array('op' => 'interwikisetup'));
     }
     if (Current_User::allow('wiki', 'edit_settings')) {
         $links[] = PHPWS_Text::secureLink($admin, 'wiki', array('op' => 'admin'));
     }
     if (isset($links)) {
         /* Clear out any existing links that may be present before adding these */
         $GLOBALS['MiniAdmin']['wiki'] = NULL;
         MiniAdmin::add('wiki', $links);
     }
 }
コード例 #16
0
ファイル: User.php プロジェクト: par-orillonsoft/phpwebsite
 public function resetCacheLink($type, $month, $year, $schedule)
 {
     $vars['aop'] = 'reset_cache';
     $vars['key'] = sprintf('%s_%s_%s_%s', $type, $month, $year, $schedule);
     MiniAdmin::add('calendar', PHPWS_Text::secureLink(dgettext('calendar', 'Reset cache'), 'calendar', $vars));
 }
コード例 #17
0
 /**
  * Returns row tags for waiting list pager
  * @return Array <number, string>
  */
 public function waitingListTags()
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     $student = StudentFactory::getStudentByUsername($this->username, $this->term);
     $tags = array();
     $tags['POSITION'] = $this->getWaitListPosition();
     $tags['NAME'] = $student->getProfileLink();
     $tags['USER'] = $this->username;
     $tags['BANNER_ID'] = $student->getBannerId();
     $tags['CLASS'] = $student->getPrintableClass();
     if (isset($this->cell_phone) && !is_null($this->cell_phone) && $this->cell_phone != '') {
         $tags['PHONE'] = '(' . substr($this->cell_phone, 0, 3) . ')';
         $tags['PHONE'] .= substr($this->cell_phone, 3, 3);
         $tags['PHONE'] .= '-' . substr($this->cell_phone, 6, 4);
     }
     $tags['GENDER'] = $student->getPrintableGender();
     $tags['APP_DATE'] = date("n/j/Y h:ia", $this->getWaitingListDate());
     $assign_link = PHPWS_Text::secureLink('[Assign]', 'hms', array('module' => 'hms', 'action' => 'ShowAssignStudent', 'username' => $this->username));
     $remove_link = PHPWS_Text::secureLink('[Remove]', 'hms', array('module' => 'hms', 'action' => 'WaitingListRemove', 'username' => $this->username));
     $tags['ACTION'] = "{$assign_link} {$remove_link}";
     return $tags;
 }
コード例 #18
0
ファイル: Block_Item.php プロジェクト: HaldunA/phpwebsite
 public function getTpl()
 {
     $vars['block_id'] = $this->getId();
     if (Current_User::allow('block', 'edit_block', $this->id)) {
         $vars['action'] = 'edit';
         $links[] = PHPWS_Text::secureLink(Icon::show('edit', dgettext('block', 'Edit')), 'block', $vars);
         if ($this->allPinned()) {
             $vars['action'] = 'remove';
             $links[] = PHPWS_Text::secureLink("<i class='fa fa-flag' title='" . dgettext('block', 'Remove block from all pages') . "'></i>", 'block', $vars);
         } else {
             $vars['action'] = 'pin_all';
             $links[] = PHPWS_Text::secureLink("<i class='fa fa-flag-o' title='" . dgettext('block', 'Display block on all pages') . "'></i>", 'block', $vars);
         }
         if (Current_User::isUnrestricted('block')) {
             $links[] = Current_User::popupPermission($this->key_id, null, 'icon');
         }
     }
     if (Current_User::allow('block', 'delete_block')) {
         $vars['action'] = 'delete';
         $confirm_vars['QUESTION'] = dgettext('block', 'Are you sure you want to permanently delete this block?');
         $confirm_vars['ADDRESS'] = PHPWS_Text::linkAddress('block', $vars, TRUE);
         $confirm_vars['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('block', 'Delete') . '"></i>';
         $links[] = javascript('confirm', $confirm_vars);
     }
     if (!empty($links)) {
         $template['ACTION'] = implode('', $links);
     } else {
         $template['ACTION'] = ' ';
     }
     if (empty($this->title)) {
         $template['TITLE'] = '<em>' . dgettext('block', 'Untitled') . '</em>';
     }
     if (empty($this->content)) {
         $template['CONTENT'] = '<em>' . dgettext('block', 'Empty') . '</em>';
     } else {
         $template['CONTENT'] = $this->summarize();
     }
     return $template;
 }
コード例 #19
0
ファイル: Channel.php プロジェクト: HaldunA/phpwebsite
 public function getActionLinks()
 {
     $vars['channel_id'] = $this->id;
     $vars['command'] = 'edit_channel';
     $links[] = PHPWS_Text::secureLink(dgettext('rss', 'Edit'), 'rss', $vars);
     return $links;
 }
コード例 #20
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
 public function report()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('signup', 'Peeps.php');
     $pager = new DBPager('signup_peeps', 'Signup_Peep');
     $pager->addWhere('sheet_id', $this->signup->sheet->id);
     $pager->addWhere('registered', 1);
     $pager->setModule('signup');
     $pager->setTemplate('applicants.tpl');
     $pager->addRowTags('rowtags');
     $pager->addSortHeader('phone', dgettext('signup', 'Phone'));
     $pager->addSortHeader('last_name', dgettext('signup', 'Last name'));
     $pager->addSortHeader('first_name', dgettext('signup', 'First name'));
     $pager->addSortHeader('email', dgettext('signup', 'Email'));
     $vars['sheet_id'] = $this->signup->sheet->id;
     $vars['aop'] = 'csv_applicants';
     $page_tags['CSV'] = PHPWS_Text::secureLink(dgettext('signup', 'CSV file'), 'signup', $vars);
     $vars['aop'] = 'slot_listing';
     $js['label'] = dgettext('signup', 'Slot listing');
     $js['menubar'] = 'yes';
     $js['address'] = PHPWS_Text::linkAddress('signup', $vars, true);
     $page_tags['SLOT_LISTING'] = javascript('open_window', $js);
     $vars['aop'] = 'print_applicants';
     if (!empty($pager->search)) {
         if (isset($pager->searchColumn)) {
             $vars['search'] = implode('+', $pager->searchColumn);
         } else {
             $vars['search'] = $pager->search;
         }
     }
     if ($pager->orderby) {
         $vars['orderby'] = $pager->orderby;
         $vars['orderby_dir'] = $pager->orderby_dir;
     }
     $js['label'] = dgettext('signup', 'Print list');
     $js['width'] = '1024';
     $js['height'] = '768';
     $js['menubar'] = 'yes';
     $js['address'] = PHPWS_Text::linkAddress('signup', $vars, true);
     $page_tags['PRINT'] = javascript('open_window', $js);
     $vars['aop'] = 'email_applicants';
     $page_tags['EMAIL'] = PHPWS_Text::secureLink(dgettext('signup', 'Email'), 'signup', $vars, null, "Email all people in the search results");
     $page_tags['EXTRA_LABEL'] = dgettext('signup', 'Extra details');
     // Add a link that takes the user back to the signup sheets page, skipping all the re-sorts
     $vars['aop'] = 'menu';
     $vars['tab'] = 'list';
     $page_tags['BACK'] = PHPWS_Text::secureLink(dgettext('signup', 'Back to Signup Sheets'), 'signup', $vars);
     $pager->addPageTags($page_tags);
     $pager->setSearch('last_name', 'first_name', 'organization');
     $limits[25] = 25;
     $limits[50] = 50;
     $limits[100] = 100;
     $pager->setLimitList($limits);
     $this->signup->title = sprintf(dgettext('signup', '%s Participants'), $this->signup->sheet->title);
     $this->signup->content = $pager->get();
 }
コード例 #21
0
 public static function moveBoxMenu()
 {
     $box = new Layout_Box($_GET['box']);
     $vars['action'] = 'admin';
     $vars['command'] = 'moveBox';
     $vars['box_source'] = $box->id;
     $vars['box_dest'] = 'move_box_top';
     $step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move to top'), 'layout', $vars);
     $vars['box_dest'] = 'move_box_up';
     $step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move up'), 'layout', $vars);
     $vars['box_dest'] = 'move_box_down';
     $step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move down'), 'layout', $vars);
     $vars['box_dest'] = 'move_box_bottom';
     $step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move to bottom'), 'layout', $vars);
     if (Current_User::isDeity() && !$_SESSION['Layout_Settings']->deity_reload) {
         $_SESSION['Layout_Settings']->loadSettings();
     }
     $themeVars = $_SESSION['Layout_Settings']->getAllowedVariables();
     foreach ($themeVars as $var) {
         if ($box->theme_var == $var) {
             continue;
         }
         $vars['box_dest'] = $var;
         $theme_links[] = PHPWS_Text::secureLink(sprintf(dgettext('layout', 'Send to %s'), $var), 'layout', $vars);
     }
     $vars['box_dest'] = 'restore';
     $template['RESTORE'] = PHPWS_Text::secureLink(dgettext('layout', 'Restore to default'), 'layout', $vars);
     $template['STEP_LINKS'] = implode('<br>', $step_links);
     $template['THEME_LINKS'] = implode('<br>', $theme_links);
     $template['CANCEL'] = sprintf('<a href="." onclick="window.close()">%s</a>', dgettext('layout', 'Cancel'));
     $template['TITLE'] = sprintf(dgettext('layout', 'Move box: %s'), $box->content_var);
     $content = PHPWS_Template::process($template, 'layout', 'move_box_select.tpl');
     Layout::nakedDisplay($content);
 }
コード例 #22
0
ファイル: Access.php プロジェクト: HaldunA/phpwebsite
 public static function htaccess()
 {
     $current_directory = dirname($_SERVER['PHP_SELF']);
     $base_needed = false;
     if (!is_file('.htaccess')) {
         $tpl['CURRENT_HTACCESS'] = dgettext('access', 'Your .htaccess file does not exist or is not readable.');
     } else {
         $htaccess_contents = file('.htaccess');
         $tpl['CURRENT_HTACCESS'] = implode('', $htaccess_contents);
         $base = null;
         if (is_writable('.htaccess')) {
             foreach ($htaccess_contents as $val) {
                 if (preg_match('/^rewritebase/i', trim($val))) {
                     $base = trim(str_ireplace('rewritebase', '', $val));
                 }
             }
             if (!$base) {
                 if ($current_directory == '' || $current_directory == '/') {
                     $tpl['BASE_FOUND'] = dgettext('access', 'RewriteBase is not set or needed.');
                 } else {
                     $base_needed = true;
                     $tpl['BASE_FOUND'] = dgettext('access', 'Your RewriteBase is not set but may be needed.');
                 }
             } elseif ($base == $current_directory) {
                 $tpl['BASE_FOUND'] = dgettext('access', 'Current RewriteBase matches installation directory.');
             } else {
                 $base_needed = true;
                 $tpl['BASE_FOUND'] = dgettext('access', 'Current RewriteBase does not match the installation directory.');
             }
         } else {
             $tpl['BASE_FOUND'] = dgettext('access', 'Your .htaccess file is not writable.');
         }
     }
     if ($base_needed) {
         if (is_writable('.htaccess')) {
             $vars['command'] = 'add_rewritebase';
             $tpl['OPTION'] = PHPWS_Text::secureLink(dgettext('access', 'Add RewriteBase'), 'access', $vars);
         } else {
             $tpl['OPTION'] = dgettext('access', 'Your .htaccess file is not writable. A RewriteBase cannot be added.');
         }
     }
     $content = PHPWS_Template::process($tpl, 'access', 'forms/htaccess.tpl');
     return $content;
 }
コード例 #23
0
ファイル: Branch_Admin.php プロジェクト: HaldunA/phpwebsite
 public function install_branch_core()
 {
     PHPWS_Core::initCoreClass('File.php');
     $content = array();
     $this->title = dgettext('branch', 'Install branch core');
     $dsn = $this->getDSN();
     if (empty($dsn)) {
         $this->content[] = dgettext('branch', 'Unable to get database connect information. Please try again.');
         return false;
     }
     if (!PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'admin/', $this->branch->directory . 'admin/')) {
         $this->content[] = dgettext('branch', 'Failed to copy admin file to branch.');
         return false;
     } else {
         $this->content[] = dgettext('branch', 'Copied admin file to branch.');
     }
     if (is_file(PHPWS_SOURCE_DIR . 'core/inc/htaccess')) {
         $this->content[] = dgettext('branch', '.htaccess detected on hub. Attempting to create default file on branch.');
         if (copy(PHPWS_SOURCE_DIR . 'core/inc/htaccess', $this->branch->directory . '.htaccess')) {
             $this->content[] = dgettext('branch', 'Copied successfully.');
         } else {
             $this->content[] = dgettext('branch', 'Unable to copy .htaccess file.');
         }
     }
     if (!PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'secure/', $this->branch->directory . 'secure/')) {
         $this->content[] = dgettext('branch', 'Failed to copy secure directory to branch.');
         return false;
     } else {
         $this->content[] = dgettext('branch', 'Copied secure directory to branch.');
     }
     $stats = sprintf('<?php include \'%sphpws_stats.php\' ?>', PHPWS_SOURCE_DIR);
     $index_file = sprintf('<?php include \'%sindex.php\'; ?>', PHPWS_SOURCE_DIR);
     file_put_contents($this->branch->directory . 'phpws_stats.php', $stats);
     file_put_contents($this->branch->directory . 'index.php', $index_file);
     file_put_contents($this->branch->directory . 'config/.htaccess', 'Deny from all');
     if (!$this->copy_config()) {
         $this->content[] = dgettext('branch', 'Failed to create config.php file in the branch.');
         return false;
     } else {
         $this->content[] = dgettext('branch', 'Config file created successfully.');
     }
     $result = $this->create_core();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         $this->content[] = dgettext('branch', 'Core SQL import failed.');
         return false;
     } else {
         $this->content[] = dgettext('branch', 'Core SQL import successful.');
     }
     $link = dgettext('branch', 'Core installed successfully. Continue to core module installation.');
     $vars['command'] = 'core_module_installation';
     $vars['branch_id'] = $this->branch->id;
     $this->content[] = PHPWS_Text::secureLink($link, 'branch', $vars);
     return true;
 }
コード例 #24
0
ファイル: Form.php プロジェクト: HaldunA/phpwebsite
 public static function listModules($type)
 {
     Layout::addStyle('boost');
     $allow_update = true;
     $core_update_needed = false;
     $dir_content = array();
     if (!PHPWS_Boost::checkDirectories($dir_content)) {
         $tpl['DIRECTORIES'] = implode('<br />', $dir_content);
         $allow_update = false;
     }
     $core_mods = PHPWS_Core::coreModList();
     $installed_mods = PHPWS_Core::installModList();
     $dir_mods = PHPWS_Boost::getAllMods();
     if ($type == 'core_mods') {
         $allowUninstall = false;
         $modList = $core_mods;
         $core_file = new PHPWS_Module('core');
         $core_db = new PHPWS_Module('core', false);
         $template['TITLE'] = $core_db->proper_name;
         $template['VERSION'] = $core_db->version;
         if (isset($_SESSION['Boost_Needs_Update']['core'])) {
             $link_title = $_SESSION['Boost_Needs_Update']['core'];
             if (version_compare($core_file->version, $_SESSION['Boost_Needs_Update']['core'], '<')) {
                 $link_title = sprintf(dgettext('boost', '%s - New'), $link_title);
             }
         } else {
             $link_title = dgettext('boost', 'Check');
         }
         if ($core_file->isAbout()) {
             $address = PHPWS_Text::linkAddress('boost', array('action' => 'aboutView', 'aboutmod' => $core_file->title), true);
             $aboutView = array('label' => dgettext('boost', 'About'), 'address' => $address);
             $template['ABOUT'] = Layout::getJavascript('open_window', $aboutView);
         }
         $link_command['opmod'] = 'core';
         $link_command['action'] = 'check';
         if (ini_get('allow_url_fopen')) {
             $template['LATEST'] = PHPWS_Text::secureLink($link_title, 'boost', $link_command);
         } else {
             $template['LATEST'] = dgettext('boost', 'Check disabled');
         }
         if (version_compare($core_db->version, $core_file->version, '<')) {
             if ($core_file->checkDependency()) {
                 if ($allow_update) {
                     $link_command['action'] = 'update_core';
                     $core_links[] = PHPWS_Text::secureLink(dgettext('boost', 'Update'), 'boost', $link_command);
                 } else {
                     $core_links[] = dgettext('boost', 'Update');
                 }
                 $tpl['WARNING'] = dgettext('boost', 'The Core requires updating! You should do so before any modules.');
                 $core_update_needed = true;
             } else {
                 $link_command['action'] = 'show_dependency';
                 $core_links[] = PHPWS_Text::secureLink(dgettext('boost', 'Missing dependency'), 'boost', $link_command);
             }
             $template['VERSION'] = sprintf('%s &gt; %s', $core_db->version, $core_file->version);
             $template['COMMAND'] = implode(' | ', $core_links);
         } else {
             $template['COMMAND'] = dgettext('boost', 'None');
         }
         $template['ROW'] = 1;
         $tpl['mod-row'][] = $template;
     } else {
         $allowUninstall = true;
         $modList = array_diff($dir_mods, $core_mods);
     }
     $tpl['TITLE_LABEL'] = dgettext('boost', 'Module Title');
     $tpl['COMMAND_LABEL'] = dgettext('boost', 'Commands');
     $tpl['ABOUT_LABEL'] = dgettext('boost', 'More information');
     $tpl['VERSION_LABEL'] = dgettext('boost', 'Current version');
     if ($type == 'core_mods' && Current_User::isDeity() && DEITIES_CAN_UNINSTALL) {
         $tpl['WARNING'] = dgettext('boost', 'WARNING: Only deities can uninstall core modules. Doing so may corrupt your installation!');
     }
     if (empty($modList)) {
         return dgettext('boost', 'No modules available.');
     }
     sort($modList);
     $count = 1;
     foreach ($modList as $title) {
         $links = array();
         $template = $link_command = NULL;
         $link_command['opmod'] = $title;
         $mod = new PHPWS_Module($title);
         if (!$mod->isFullMod()) {
             continue;
         }
         $proper_name = $mod->getProperName();
         if (!isset($proper_name)) {
             $proper_name = $title;
         }
         $template['VERSION'] = $mod->version;
         $template['TITLE'] = $proper_name;
         $template['ROW'] = $count % 2 + 1;
         $version_check = $mod->getVersionHttp();
         if (isset($version_check)) {
             if (isset($_SESSION['Boost_Needs_Update'][$mod->title])) {
                 $link_title = $_SESSION['Boost_Needs_Update'][$mod->title];
                 if (version_compare($mod->version, $_SESSION['Boost_Needs_Update'][$mod->title], '<')) {
                     $link_title = sprintf(dgettext('boost', '%s - New'), $link_title);
                 }
             } else {
                 $link_title = dgettext('boost', 'Check');
             }
             $link_command['action'] = 'check';
             if (ini_get('allow_url_fopen')) {
                 $template['LATEST'] = PHPWS_Text::secureLink($link_title, 'boost', $link_command);
             } else {
                 $template['LATEST'] = dgettext('boost', 'Check disabled');
             }
         }
         if (!$mod->isInstalled()) {
             if ($mod->checkDependency()) {
                 $link_title = dgettext('boost', 'Install');
                 $link_command['action'] = 'install';
             } else {
                 $link_title = dgettext('boost', 'Missing dependency');
                 $link_command['action'] = 'show_dependency';
             }
             if ($GLOBALS['Boost_Ready']) {
                 if (javascriptEnabled()) {
                     $js['width'] = 640;
                     $js['height'] = 480;
                     $js['address'] = PHPWS_Text::linkAddress('boost', $link_command, true);
                     $js['label'] = $link_title;
                     $links[] = javascript('open_window', $js);
                     unset($js);
                 } else {
                     $links[] = PHPWS_Text::secureLink($link_title, 'boost', $link_command);
                 }
             } else {
                 $links[] =& $link_title;
             }
         } else {
             if ($mod->needsUpdate()) {
                 $db_mod = new PHPWS_Module($mod->title, false);
                 $template['VERSION'] = $db_mod->version . ' &gt; ' . $mod->version;
                 if ($mod->checkDependency()) {
                     if ($title == 'boost' && !$core_update_needed) {
                         $tpl['WARNING'] = dgettext('boost', 'Boost requires updating! You should do so before any other module!');
                     }
                     $link_title = dgettext('boost', 'Update');
                     $link_command['action'] = 'update';
                 } else {
                     $link_title = dgettext('boost', 'Missing dependency');
                     $link_command['action'] = 'show_dependency';
                 }
                 if ($allow_update) {
                     $js['width'] = 640;
                     $js['height'] = 480;
                     $js['address'] = PHPWS_Text::linkAddress('boost', $link_command, true);
                     $js['label'] = $link_title;
                     $links[] = javascript('open_window', $js);
                     unset($js);
                 } else {
                     $links[] =& $link_title;
                 }
             }
             if ($type != 'core_mods' || Current_User::isDeity() && DEITIES_CAN_UNINSTALL) {
                 if ($dependents = $mod->isDependedUpon()) {
                     $link_command['action'] = 'show_depended_upon';
                     $depend_warning = sprintf(dgettext('boost', 'This module is depended upon by: %s'), implode(', ', $dependents));
                     $links[] = PHPWS_Text::secureLink(dgettext('boost', 'Depended upon'), 'boost', $link_command, NULL, $depend_warning);
                 } else {
                     $links[] = PHPWS_Boost::uninstallLink($title);
                 }
             }
         }
         if ($mod->isAbout()) {
             $address = PHPWS_Text::linkAddress('boost', array('action' => 'aboutView', 'aboutmod' => $mod->title), true);
             $aboutView = array('label' => dgettext('boost', 'About'), 'address' => $address);
             $template['ABOUT'] = Layout::getJavascript('open_window', $aboutView);
         }
         if (!empty($links)) {
             $template['COMMAND'] = implode(' | ', $links);
         } else {
             $template['COMMAND'] = dgettext('boost', 'None');
         }
         $tpl['mod-row'][] = $template;
         $count++;
     }
     $tpl['OLD_MODS'] = Boost_Form::oldModList();
     if (ini_get('allow_url_fopen')) {
         $tpl['CHECK_FOR_UPDATES'] = PHPWS_Text::secureLink(dgettext('boost', 'Check all'), 'boost', array('action' => 'check_all', 'tab' => $type));
     } else {
         $tpl['CHECK_FOR_UPDATES'] = dgettext('boost', 'Server configuration prevents version checking.');
     }
     $tpl['LATEST_LABEL'] = dgettext('boost', 'Latest version');
     $release_version = PHPWS_Core::releaseVersion();
     $tpl['PHPWS_VERSION'] = $release_version;
     $result = PHPWS_Template::process($tpl, 'boost', 'module_list.tpl');
     return $result;
 }
コード例 #25
0
 public function row_tags()
 {
     $tpl['LAST_NAME'] = sprintf('<a href="mailto:%s">%s, %s <i class="fa fa-envelope-o"></i></a>', $this->email_address, $this->last_name, $this->first_name);
     $tpl['PHONE'] = $this->getPhone();
     $tpl['COMPANY_NAME'] = $this->getCompanyUrl();
     if ($this->active) {
         $admin[] = \PHPWS_Text::secureLink(\Icon::show('active', 'Click to deactivate'), 'properties', array('aop' => 'deactivate_contact', 'cid' => $this->id));
     } else {
         $admin[] = \PHPWS_Text::secureLink(\Icon::show('inactive', 'Click to activate'), 'properties', array('aop' => 'activate_contact', 'cid' => $this->id));
     }
     $admin[] = \PHPWS_Text::secureLink(\Icon::show('add'), 'properties', array('aop' => 'edit_property', 'cid' => $this->id));
     $admin[] = \PHPWS_Text::secureLink(\Icon::show('edit'), 'properties', array('aop' => 'edit_contact', 'cid' => $this->id));
     $js['LINK'] = \Icon::show('delete');
     $js['QUESTION'] = 'Are you sure you want to delete this contact and all their properties?';
     $js['ADDRESS'] = 'index.php?module=properties&aop=delete_contact&cid=' . $this->id . '&authkey=' . \Current_User::getAuthKey();
     $admin[] = javascript('confirm', $js);
     $admin[] = \PHPWS_Text::secureLink(\Icon::show('home', 'Show properties'), 'properties', array('aop' => 'show_properties', 'cid' => $this->id));
     if ($this->last_log) {
         $tpl['LAST_LOG'] = strftime('%x', $this->last_log);
     } else {
         $tpl['LAST_LOG'] = 'Never';
     }
     $tpl['ACTION'] = implode('', $admin);
     return $tpl;
 }
コード例 #26
0
ファイル: Sheet.php プロジェクト: HaldunA/phpwebsite
 public function rowTag()
 {
     $vars['sheet_id'] = $this->id;
     if (Current_User::allow('signup', 'edit_sheet', $this->id, 'sheet')) {
         if (Current_User::isUnrestricted('signup')) {
             $vars['aop'] = 'edit_sheet';
             $links[] = PHPWS_Text::secureLink(\Icon::show('edit', dgettext('signup', 'Edit')), 'signup', $vars);
         }
         $vars['aop'] = 'edit_slots';
         $links[] = PHPWS_Text::secureLink(\Icon::show('th-list', dgettext('signup', 'Slots')), 'signup', $vars);
         if (Current_User::isUnrestricted('signup')) {
             $links[] = Current_User::popupPermission($this->key_id, null, 'icon');
         }
     }
     $vars['aop'] = 'report';
     $links[] = PHPWS_Text::secureLink(\Icon::show('file-text', dgettext('signup', 'Report')), 'signup', $vars);
     if (Current_User::isUnrestricted('signup')) {
         $vars['aop'] = 'delete_sheet';
         $js['ADDRESS'] = PHPWS_Text::linkAddress('signup', $vars, true);
         $js['QUESTION'] = dgettext('signup', 'Are you sure you want to delete this sheet?\\nAll slots and signup information will be permanently removed.');
         $js['LINK'] = \Icon::show('delete');
         $links[] = javascript('confirm', $js);
     }
     $tpl['START_TIME'] = strftime("%D %R", $this->start_time);
     // MM/DD/YY hh:mm 24-hour time format
     $tpl['END_TIME'] = strftime("%D %R", $this->end_time);
     // MM/DD/YY hh:mm 24-hour time format
     $tpl['TITLE'] = $this->viewLink();
     $tpl['ACTION'] = implode('&nbsp;', $links);
     return $tpl;
 }
コード例 #27
0
ファイル: Property.php プロジェクト: HaldunA/phpwebsite
 public function view()
 {
     if (empty($this->id)) {
         \Layout::add('<h1>Sorry</h1><p>This property is not in our system. Please return to the <a href="./">property listing page</a> to try again.</p>');
         return;
     }
     $tpl = $this->getBaseTpl();
     $refund = '<span style="font-size : 90%">(Refundable)</span>';
     \PHPWS_Core::initModClass('properties', 'Contact.php');
     $max_width = PANEL_WIDTH;
     $max_height = PANEL_HEIGHT;
     \Layout::addStyle('properties', 'view.css');
     $tpl['NAME'] = $this->viewLink($this->name);
     $photos = $this->getPhotos();
     if ($photos) {
         javascriptMod('properties', 'galleryview', array('panel_width' => $max_width, 'panel_height' => $max_height));
         foreach ($photos as $p) {
             if (is_file($p['path'])) {
                 $dim = getimagesize($p['path']);
                 $width =& $dim[0];
                 $height =& $dim[1];
                 $diff = \PHPWS_File::getDiff($width, $max_width, $height, $max_height);
                 $new_width = round($width * $diff);
                 $new_height = round($height * $diff);
                 if ($new_width > $max_width || $new_height > $max_height) {
                     $diff = \PHPWS_File::getDiff($new_width, $max_width, $new_height, $max_height);
                     $new_width = round($width * $diff);
                     $new_height = round($height * $diff);
                 }
             } else {
                 $p['path'] = PHPWS_SOURCE_HTTP . 'mod/properties/img/no_photo.gif';
                 $p['title'] = 'Photo not found';
                 $new_width = '150px';
                 $new_height = '113px';
             }
             $all[] = sprintf('<li><img src="%s" title="%s" />
         <div class="panel-content lightbox">
         <a class="lightbox" href="%s"><img src="%s" width="%s" height="%s" /></a>
         </div></li>', Photo::thumbnailPath($p['path']), $p['title'], $p['path'], $p['path'], $new_width, $new_height);
         }
         $tpl['PHOTOS'] = implode("\n", $all);
     } else {
         $tpl['NO_PHOTO'] = '<img src="' . PHPWS_SOURCE_HTTP . 'mod/properties/img/no_photo.gif" alt="No photo" title="No photos available" />';
     }
     $contact = new Contact($this->contact_id);
     if (!empty($contact->company_address)) {
         $tpl['COMPANY_ADDRESS'] = $contact->getCompanyAddress();
         $tpl['GOOGLE_COMPANY'] = sprintf('<a target="_blank" href="http://maps.google.com/maps?q=%s">
     <img class="google-map" src="%smod/properties/img/google-pin-red.gif" title="Google maps" target="_blank" /></a>', Property::googleMapUrl($contact->company_address), PHPWS_SOURCE_HTTP);
     }
     $tpl['COMPANY_NAME'] = $contact->getCompanyUrl();
     $tpl['EMAIL'] = $contact->getEmailAddress(true);
     $tpl['PHONE'] = $contact->getPhone();
     $tpl['TIMES_AVAILABLE'] = $contact->getTimesAvailable();
     $tpl['ADDRESS'] = $this->getAddress();
     $tpl['GOOGLE_MAP'] = sprintf('<a target="_blank" href="http://maps.google.com/maps?q=%s">
     <img src="%smod/properties/img/google-pin-red.gif" title="Google maps" target="_blank" /></a>', Property::googleMapUrl($this->address), PHPWS_SOURCE_HTTP);
     $tpl['LEASE_TYPE'] = $this->getLeaseType();
     if ($this->efficiency) {
         $tpl['BEDROOMS'] = 'One room efficiency';
     } else {
         $tpl['BEDROOMS'] = $this->bedroom_no;
     }
     $tpl['BATHROOMS'] = $this->getBathroomNo();
     if ($this->window_number) {
         $tpl['WINDOWS'] = 'Yes';
     } else {
         $tpl['WINDOWS'] = 'No';
     }
     if (!empty($this->admin_fee_amt)) {
         $tpl['ADMIN_FEE'] = '$' . $this->getAdminFeeAmt();
         $tpl['ADMIN_FEE_REFUND'] = $this->admin_fee_refund ? $refund : null;
     }
     if (!empty($this->parking_fee)) {
         $tpl['PARKING_FEE'] = '$' . $this->getParkingFee();
     }
     if (!empty($this->security_amt)) {
         $tpl['SECURITY_AMT'] = '$' . $this->getSecurityAmt();
         $tpl['SECURITY_REFUND'] = $this->security_refund ? $refund : null;
     }
     if (!empty($this->other_fees)) {
         $tpl['OTHER_FEES'] = $this->getOtherFees();
     }
     if (!empty($this->clean_fee_amt)) {
         $tpl['CLEAN_FEE_AMT'] = '$' . $this->getCleanFeeAmt();
         $tpl['CLEAN_FEE_REFUND'] = $this->clean_fee_refund ? $refund : null;
     }
     $tpl['PARKING_PER_UNIT'] = $this->getParkingPerUnit();
     if ($this->pets_allowed) {
         $tpl['PETS_ALLOWED'] = 'Yes';
         $tpl['PET_TYPES'] = $this->getPetType();
         if ($this->pet_deposit) {
             $tpl['PET_DEPOSIT'] = '$' . $this->getPetDeposit() . ' <span style="font-size : 90%">(refundable)</span>';
         } else {
             $tpl['PET_DEPOSIT'] = 'None';
         }
         if ($this->pet_fee) {
             $tpl['PET_FEE'] = '$' . $this->getPetFee() . ' <span style="font-size : 90%">(nonrefundable)</span>';
         } else {
             $tpl['PET_FEE'] = 'None';
         }
     } else {
         $tpl['PETS_ALLOWED'] = 'No';
     }
     $utility_allowance = false;
     $tpl['STUDENT_TYPE'] = $this->getStudentType();
     if ($this->util_water) {
         $utility_allowance = true;
         $tpl['UTIL_WATER'] = $this->getUtilWater();
     }
     if ($this->util_trash) {
         $utility_allowance = true;
         $tpl['UTIL_TRASH'] = $this->getUtilTrash();
     }
     if ($this->util_power) {
         $utility_allowance = true;
         $tpl['UTIL_POWER'] = $this->getUtilPower();
     }
     if ($this->util_fuel) {
         $utility_allowance = true;
         $tpl['UTIL_FUEL'] = $this->getUtilFuel();
     }
     if ($this->util_cable) {
         $utility_allowance = true;
         $tpl['UTIL_CABLE'] = $this->getUtilCable();
     }
     if ($this->util_internet) {
         $utility_allowance = true;
         $tpl['UTIL_INTERNET'] = $this->getUtilInternet();
     }
     if ($this->util_phone) {
         $utility_allowance = true;
         $tpl['UTIL_PHONE'] = $this->getUtilPhone();
     }
     $photo = new Photo();
     $photo->setPropertyId($this->id);
     if (isset($_GET['photo'])) {
         $data['pid'] = $this->id;
     }
     $data['view'] = 1;
     if (\Current_User::allow('properties')) {
         javascriptMod('properties', 'photo_upload', $data);
         $tpl['ADD_PHOTO'] = $photo->uploadNew(false);
         $tpl['EDIT'] = \PHPWS_Text::secureLink('<i class="fa fa-edit"></i> Edit', 'properties', array('aop' => 'edit_property', 'pid' => $this->id), null, null, 'btn btn-default');
         if (!$this->active) {
             $tpl['ACTIVE'] = '<div id="not-active">This property is currently NOT ACTIVE</div>';
         }
     } elseif (isset($_SESSION['Contact_User']->id) && $_SESSION['Contact_User']->id == $this->contact_id) {
         if (!$this->active) {
             $tpl['ACTIVE'] = '<div id="not-active">This property is currently NOT ACTIVE</div>';
         }
         $data['is_contact'] = 1;
         javascriptMod('properties', 'photo_upload', $data);
         $tpl['ADD_PHOTO'] = $photo->uploadNew(false);
         $tpl['EDIT'] = \PHPWS_Text::moduleLink('Edit property', 'properties', array('cop' => 'edit_property', 'pid' => $this->id, 'k' => $_SESSION['Contact_User']->getKey()));
     } elseif (!$this->active) {
         \Layout::add('This property is currently not available');
         return;
     }
     $heat_type = $this->getHeatType();
     if ($heat_type) {
         $tpl['HEAT_TYPE'] = implode(', ', $this->getHeatType());
     }
     $content = \PHPWS_Template::process($tpl, 'properties', 'view.tpl');
     \Layout::add($content);
 }
コード例 #28
0
ファイル: Block_Admin.php プロジェクト: HaldunA/phpwebsite
 public static function blockList()
 {
     Layout::addStyle('block');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pageTags['NEW_BLOCK'] = PHPWS_Text::secureLink(dgettext('block', 'Create new block'), 'block', array('action' => 'new'), null, dgettext('block', 'Create new block'), 'button');
     $pageTags['NEW_BLOCK_URI'] = PHPWS_Text::linkAddress('block', array('action' => 'new'), true);
     $pageTags['CONTENT'] = dgettext('block', 'Content');
     $pageTags['ACTION'] = dgettext('block', 'Action');
     $pager = new DBPager('block', 'Block_Item');
     $pager->setModule('block');
     $pager->setTemplate('list.tpl');
     $pager->addToggle('class="bgcolor1"');
     $pager->addPageTags($pageTags);
     $pager->addRowTags('getTpl');
     $pager->addSortHeader('title', dgettext('block', 'Title'));
     $content = $pager->get();
     return $content;
 }
コード例 #29
0
ファイル: Branch.php プロジェクト: HaldunA/phpwebsite
 /**
  * Returns an associative array for the branch list page
  */
 public function getTpl()
 {
     $tpl['URL'] = $this->getUrl();
     $links[] = PHPWS_Text::secureLink(Icon::show('edit'), 'branch', array('command' => 'edit_branch', 'branch_id' => $this->id));
     $js['question'] = dgettext('branch', 'Removing this branch will make it inaccessible.\\nThe database and files will remain behind.\\nIf you are sure you want to remove the branch, type the branch name:');
     $js['address'] = sprintf('index.php?module=branch&command=remove_branch&branch_id=%s&authkey=%s', $this->id, Current_User::getAuthKey());
     $js['value_name'] = 'branch_name';
     $js['link'] = Icon::show('delete');
     $links[] = javascript('prompt', $js);
     $tpl['DIRECTORY'] = sprintf('<abbr title="%s">%s</abbr>', $this->directory, PHPWS_Text::shortenUrl($this->directory));
     $tpl['ACTION'] = implode(' ', $links);
     return $tpl;
 }
コード例 #30
0
 public static function settings()
 {
     $content = array();
     $form = new PHPWS_Form('user_settings');
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'update_settings');
     $form->addSubmit('submit', dgettext('users', 'Update Settings'));
     $form->addText('site_contact', PHPWS_User::getUserSetting('site_contact'));
     $form->setLabel('site_contact', dgettext('users', 'Site contact email'));
     $form->setSize('site_contact', 40);
     if (Current_User::isDeity()) {
         $signup_modes = array(0, AUTO_SIGNUP, CONFIRM_SIGNUP);
         $signup_labels = array(dgettext('users', 'Not allowed'), dgettext('users', 'Immediate'), dgettext('users', 'Email Verification'));
         $form->addRadio('user_signup', $signup_modes);
         $form->setLabel('user_signup', $signup_labels);
         $form->addTplTag('USER_SIGNUP_LABEL', dgettext('users', 'User Signup Mode'));
         $form->setMatch('user_signup', PHPWS_User::getUserSetting('new_user_method'));
         if (extension_loaded('gd')) {
             $form->addCheckbox('graphic_confirm');
             $form->setLabel('graphic_confirm', dgettext('users', 'New user CAPTCHA confirmation'));
             $form->setMatch('graphic_confirm', PHPWS_User::getUserSetting('graphic_confirm'));
         }
         $included_usermenu = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . 'mod/users/templates/usermenus/', FALSE, TRUE, FALSE, array('tpl'));
         $theme_usermenu = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . Layout::getThemeDir() . 'templates/users/usermenus/', FALSE, TRUE, FALSE, array('tpl'));
         if ($theme_usermenu) {
             $options = array_unique(array_merge($included_usermenu, $theme_usermenu));
         } else {
             $options = $included_usermenu;
         }
         $menu_options = array_combine($options, $options);
         // Replace below with a directory read
         $menu_options['none'] = dgettext('users', 'None');
         $menu_options['css.tpl'] = 'css.tpl';
         $menu_options['Default.tpl'] = 'Default.tpl';
         $menu_options['top.tpl'] = 'top.tpl';
         $form->addSelect('user_menu', $menu_options);
         $form->setMatch('user_menu', PHPWS_User::getUserSetting('user_menu'));
         $form->setLabel('user_menu', dgettext('users', 'User Menu'));
         $form->addCheckBox('show_login', 1);
         $form->setMatch('show_login', PHPWS_Settings::get('users', 'show_login'));
         $form->setLabel('show_login', dgettext('users', 'Show login box'));
         $form->addTplTag('AFFIRM', dgettext('users', 'Yes'));
         $form->addCheckBox('allow_remember', 1);
         $form->setMatch('allow_remember', PHPWS_Settings::get('users', 'allow_remember'));
         $form->setLabel('allow_remember', dgettext('users', 'Allow Remember Me'));
         $form->addRadioAssoc('allow_new_users', array(1 => 'Yes', 0 => 'No'));
         $form->setMatch('allow_new_users', PHPWS_Settings::get('users', 'allow_new_users'));
         $form->addTplTag('ALLOW_NEW_USERS_LABEL', dgettext('users', 'Allow new user creation?'));
     }
     $form->addTextArea('forbidden_usernames', PHPWS_Settings::get('users', 'forbidden_usernames'));
     $form->setLabel('forbidden_usernames', dgettext('users', 'Forbidden usernames (one per line)'));
     $form->addCheckbox('session_warning', 1);
     $form->setMatch('session_warning', PHPWS_Settings::get('users', 'session_warning'));
     $form->setlabel('session_warning', 'Show session warning');
     $template = $form->getTemplate();
     if (Current_User::isDeity()) {
         $vars['action'] = 'admin';
         $vars['command'] = 'check_permission_tables';
         $template['VERIFY_PERMISSIONS'] = PHPWS_Text::secureLink(dgettext('users', 'Register user permissions'), 'users', $vars);
         $template['VERIFY_EXPLAIN'] = dgettext('users', 'Users module will re-register each module\'s permissions.');
     }
     return PHPWS_Template::process($template, 'users', 'forms/settings.tpl');
 }