コード例 #1
0
 public static function user_settings()
 {
     if (Base_AclCommon::i_am_user()) {
         return array(__('Account') => 'body');
     }
     return array();
 }
コード例 #2
0
ファイル: Administrator_0.php プロジェクト: cretzu89/EPESI
 public function body()
 {
     if (!Base_AclCommon::i_am_user()) {
         print __('First log in to the system.');
         return;
     }
     $form = $this->init_module(Libs_QuickForm::module_name(), __('Saving settings'));
     //pass
     $form->addElement('header', null, __('Change password'));
     $form->addElement('html', '<tr><td colspan=2>' . __('Leave password boxes empty if you prefer your current password') . '</td></tr>');
     $form->addElement('password', 'new_pass', __('New password'));
     $form->addElement('password', 'new_pass_c', __('Confirm new password'));
     $form->addRule(array('new_pass', 'new_pass_c'), __('Your passwords don\'t match'), 'compare');
     $form->addRule('new_pass', __('Your password must be longer then 5 chars'), 'minlength', 6);
     //mail
     $form->addElement('header', null, __('Change e-mail'));
     $form->addElement('text', 'mail', __('New e-mail address'));
     $form->addRule('mail', __('Field required'), 'required');
     $form->addRule('mail', __('Invalid e-mail address'), 'email');
     //autologin
     $ret = DB::GetAll('SELECT autologin_id,description,last_log FROM user_autologin WHERE user_login_id=%d', array(Acl::get_user()));
     if ($ret) {
         $form->addElement('header', null, __('Delete autologin'));
     }
     foreach ($ret as $row) {
         $form->addElement('checkbox', 'delete_autologin[' . $row['autologin_id'] . ']', $row['description'], Base_RegionalSettingsCommon::time2reg($row['last_log']));
     }
     //confirmation
     $form->addElement('header', null, __('Confirmation'));
     $form->addElement('password', 'old_pass', __('Old password'));
     $form->registerRule('check_old_pass', 'callback', 'check_old_pass', $this);
     $form->addRule('old_pass', __('Old password incorrect'), 'check_old_pass');
     $form->addRule('old_pass', __('Field required'), 'required');
     if (Base_AclCommon::check_permission('Advanced User Settings')) {
         Base_ActionBarCommon::add('back', __('Back'), $this->create_main_href('Base_User_Settings'));
     }
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     #$form->addElement('submit', 'submit_button', __('OK'));
     if ($form->validate_with_message('Setting saved', __('Problem encountered'))) {
         if ($form->process(array(&$this, 'submit_user_preferences'))) {
             if (Base_AclCommon::check_permission('Advanced User Settings')) {
                 Base_BoxCommon::location('Base_User_Settings');
             }
         }
     } else {
         //defaults
         $ret = DB::Execute('SELECT p.mail FROM user_password p  WHERE p.user_login_id=%d', Acl::get_user());
         if ($row = $ret->FetchRow()) {
             $form->setDefaults(array('mail' => $row[0]));
         }
         $form->display();
     }
 }
コード例 #3
0
ファイル: AdminIndex.php プロジェクト: cretzu89/EPESI
 private function create_admin_modules_instances()
 {
     foreach (get_declared_classes() as $class) {
         $rclass = new ReflectionClass($class);
         if ($rclass->isSubclassOf("AdminModule") && !$rclass->isAbstract()) {
             $module = new $class();
             if (Base_AclCommon::i_am_sa() || Base_AclCommon::i_am_admin() && $module->access_admin() || Base_AclCommon::i_am_user() && $module->access_user()) {
                 $this->admin_modules[$class] = $module;
             }
         }
     }
     ksort($this->admin_modules);
 }
コード例 #4
0
 public static function quick_access_menu()
 {
     if (!Base_AclCommon::i_am_user()) {
         return array();
     }
     self::get_options();
     $qa_menu = array('__submenu__' => 1);
     foreach (self::$options as $v) {
         if (Base_User_SettingsCommon::get(Base_Menu_QuickAccessCommon::module_name(), $v['name'] . '_m')) {
             $qa_menu[$v['label']] = $v['link'];
         }
     }
     if ($qa_menu == array('__submenu__' => 1)) {
         return array();
     }
     return array(__('Quick Access') => $qa_menu);
 }
コード例 #5
0
ファイル: update.php プロジェクト: 62BRAINS/EPESI
 protected function login_form()
 {
     if (Base_AclCommon::i_am_user() && !Base_AclCommon::i_am_sa()) {
         Base_User_LoginCommon::logout();
     }
     $form = SimpleLogin::form();
     return "<p>$form</p>";
 }
コード例 #6
0
ファイル: Comment_0.php プロジェクト: cretzu89/EPESI
 private function prepare_comment(&$comments, $row, $tab = 0)
 {
     $row['text'] = str_replace("\n", '<br>', htmlspecialchars($row['text']));
     if (Base_AclCommon::i_am_user()) {
         if ($this->mod) {
             $delete = '<a ' . $this->create_confirm_callback_href(__('Are you sure you want to delete this post?'), array('Utils_CommentCommon', 'delete_post'), $row['id']) . '>' . __('Delete') . '</a>';
             $rep_count = DB::GetOne('SELECT COUNT(*) FROM comment_report WHERE id=%d', $row['id']);
             if (!$rep_count) {
                 $report = '';
             } else {
                 $report = __('Reported %d time(s)', $rep_count);
             }
         } else {
             if ($this->report) {
                 $rep_count = DB::GetOne('SELECT COUNT(*) FROM comment_report WHERE id=%d AND user_login_id=%d', array($row['id'], Acl::get_user()));
                 if ($rep_count == 0) {
                     $report = '<a ' . $this->create_unique_href(array('report' => $row['id'])) . '>' . __('Report') . '</a>';
                 } else {
                     $report = __('Post reported');
                 }
             }
         }
     }
     $reply_vars = array('answer' => $row['id']);
     if (!$this->reply_on_comment_page) {
         $reply_vars['action'] = 'post_reply';
     }
     if ($this->tree_structure && $this->reply) {
         $reply_link = '<a ' . $this->create_unique_href($reply_vars) . '>' . __('Reply') . '</a>';
     } else {
         $reply_link = null;
     }
     $comments[] = array('text' => $row['text'], 'user' => $row['login'], 'date' => date('G:i, d M Y', strtotime($row['created_on'])), 'report' => isset($report) ? $report : null, 'delete' => isset($delete) ? $delete : null, 'reply' => $reply_link, 'tabs' => $tab);
     if ($row['parent'] != -1) {
         $recordSet = DB::Execute('SELECT c.id, c.text, ul.login, c.created_on FROM comment AS c LEFT JOIN user_login AS ul ON (c.user_login_id = ul.id) WHERE parent = %d ORDER BY created_on', $row['id']);
         while (!$recordSet->EOF) {
             $row = $recordSet->FetchRow();
             $this->prepare_comment($comments, $row, $tab + 1);
         }
     }
 }
コード例 #7
0
ファイル: check.php プロジェクト: cretzu89/EPESI
 * @version 1.0
 * @copyright Copyright &copy; 2007, Telaxus LLC
 * @license MIT
 * @package epesi-base
 */
$fullscreen = !defined("_VALID_ACCESS");
!$fullscreen || define("_VALID_ACCESS", true);
define('CID', false);
require_once 'include/data_dir.php';
$config = file_exists(DATA_DIR . '/config.php');
if ($config) {
    include_once 'include.php';
    ModuleManager::load_modules();
}
if ($config && class_exists('Base_AclCommon')) {
    if (Base_AclCommon::i_am_user()) {
        if (!Base_AclCommon::i_am_sa()) {
            die('Only super admin can access this page');
        }
    } else {
        $auth = SimpleLogin::form();
        if ($auth) {
            print $auth;
            die;
        }
    }
}
if (class_exists('Base_LangCommon')) {
    Base_LangCommon::update_translations();
}
if (class_exists('Base_ThemeCommon')) {