当前位置: 首页>>代码示例>>PHP>>正文


PHP Base_AclCommon::i_am_sa方法代码示例

本文整理汇总了PHP中Base_AclCommon::i_am_sa方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_AclCommon::i_am_sa方法的具体用法?PHP Base_AclCommon::i_am_sa怎么用?PHP Base_AclCommon::i_am_sa使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Base_AclCommon的用法示例。


在下文中一共展示了Base_AclCommon::i_am_sa方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_admin_modules_instances

 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);
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:13,代码来源:AdminIndex.php

示例2: get_access

 public static function get_access($module, $section = '', $force_check = false)
 {
     if (!$force_check && Base_AclCommon::i_am_sa()) {
         return true;
     }
     static $cache = array();
     if (!isset($cache[$module])) {
         $cache[$module] = array();
         $ret = DB::GetAssoc('SELECT section, allow FROM base_admin_access WHERE module=%s', array($module));
         $defaults = array('' => 1);
         if (class_exists($module . 'Common') && method_exists($module . 'Common', 'admin_access_levels')) {
             $raws = call_user_func(array($module . 'Common', 'admin_access_levels'));
             if ($raws == false) {
                 $defaults[''] = $raws;
             } else {
                 $defaults[''] = 1;
                 if (is_array($raws)) {
                     foreach ($raws as $s => $v) {
                         if (isset($v['default'])) {
                             $defaults[$s] = $v['default'];
                         } else {
                             $defaults[$s] = 0;
                         }
                     }
                 }
             }
         }
         foreach ($defaults as $s => $v) {
             if (isset($ret[$s])) {
                 $cache[$module][$s] = $ret[$s];
             } else {
                 $cache[$module][$s] = $v;
             }
         }
     }
     return $cache[$module][$section];
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:37,代码来源:AdminCommon_0.php

示例3: admin

 public function admin($store = false)
 {
     if (!Base_AclCommon::i_am_sa()) {
         return;
     }
     if ($this->is_back()) {
         $this->parent->reset();
         return;
     }
     if (!$store) {
         Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     }
     if (Base_EssClientCommon::is_no_ssl_allowed()) {
         Base_ActionBarCommon::add('settings', __('SSL settings'), $this->create_callback_href(array('Base_BoxCommon', 'push_module'), array('Base_EssClient', 'no_ssl_settings')));
     }
     if (Base_EssClientCommon::has_license_key() == false) {
         $this->terms_and_conditions();
         Base_EssClientCommon::server(true);
     }
     try {
         if (Base_EssClientCommon::has_license_key()) {
             $data = Base_EssClientCommon::server()->installation_registered_data();
             if ($data) {
                 $data['license_key'] = Base_EssClientCommon::get_license_key();
                 $data['status'] = Base_EssClientCommon::get_installation_status();
                 ///////// Status ////////
                 print '<div class="important_notice">';
                 print '<div style="margin: 5px">' . __('Thank you for registering your EPESI installation.') . '</div>';
                 $status_description = '';
                 $verbose_description = '';
                 if (stripos($data['status'], 'confirmed') !== false || stripos($data['status'], 'validated') !== false) {
                     $status_description = __('registration done');
                     $verbose_description = __('The registration process is complete.');
                 } else {
                     $status_description = __('waiting for e-mail confirmation');
                     $verbose_description = __('You need to verify your e-mail address. An e-mail was sent to the Administrator\'s e-mail address with a link to confirm the e-mail address.');
                 }
                 print '<div class="important_notice_frame"><span style="font-weight:bold;">' . __('License Key') . ': ' . '</span>' . $data['license_key'] . '<br/>';
                 print '<span style="font-weight:bold;">' . __('Status') . ': ' . '</span>' . $status_description . '</div>';
                 print '<div style="margin: 5px">' . $verbose_description . '</div>';
                 print '</div>';
                 Base_ActionBarCommon::add('edit', __('Edit company details'), $this->create_callback_href(array($this, 'register_form'), array($data)));
             } else {
                 $email = Base_EssClientCommon::get_support_email();
                 print '<div class="important_notice">' . __('Your EPESI ID is not recognized by EPESI Store Server. Please contact EPESI team at %s.', array($email)) . '</div>';
                 Base_ActionBarCommon::add('delete', __('Revoke license key'), $this->create_confirm_callback_href(__('Are you sure you want to revoke your EPESI License Key?'), array('Base_EssClientCommon', 'clear_license_key')));
             }
             $url = get_epesi_url() . '/modules/Base/EssClient/tos/tos.php';
             Base_ActionBarCommon::add('search', __('Terms & Conditions'), 'target="_blank" href="' . $url . '"');
             Base_ActionBarCommon::add('settings', __('Edit license key'), $this->create_callback_href(array($this, 'license_key_form')));
         }
     } catch (Exception $e) {
         print '<div class="important_notice">' . __('There was an error while trying to connect to Epesi Store Server. Please try again later.') . '<br>';
         print __('If the problem persists, please contact us at %s', array('<a href="http://forum.epesibim.com/" target="_blank">http://forum.epesibim.com/</a>')) . '<br>';
         print '<br>';
         print __('Error message: ') . '<br>';
         print '<div class="important_notice_frame">' . $e->getMessage();
         print '</div></div>';
         Base_ActionBarCommon::add('retry', __('Retry'), $this->create_href(array()));
         return;
     }
     print Base_EssClientCommon::client_messages_frame();
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:63,代码来源:EssClient_0.php

示例4: login_form

 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>";
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:8,代码来源:update.php

示例5: admin_access

 public static function admin_access()
 {
     $trial = defined('TRIAL_MODE') ? TRIAL_MODE : 0;
     return Base_AclCommon::i_am_sa() && !$trial && !DEMO_MODE;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:5,代码来源:EpesiStoreCommon_0.php

示例6: admin

 public function admin()
 {
     if (!Base_AclCommon::i_am_sa() || $this->is_back()) {
         $this->parent->reset();
         return;
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     $cmr = ModuleManager::call_common_methods('admin_caption');
     foreach ($cmr as $name => $caption) {
         if (!ModuleManager::check_access($name, 'admin') || $name == 'Base_Admin') {
             continue;
         }
         if (!isset($caption)) {
             continue;
         }
         if (!is_array($caption)) {
             $caption = array('label' => $caption);
         }
         if (!isset($caption['section'])) {
             $caption['section'] = __('Misc');
         }
         $mod_ok[$name] = $caption;
     }
     uksort($mod_ok, 'strcasecmp');
     $form = $this->init_module('Libs_QuickForm');
     $buttons = array();
     load_js('modules/Base/Admin/js/main.js');
     foreach ($mod_ok as $name => $caption) {
         if (method_exists($name . 'Common', 'admin_icon')) {
             $icon = call_user_func(array($name . 'Common', 'admin_icon'));
         } else {
             $icon = Base_ThemeCommon::get_template_file($name, 'icon.png');
             if (!file_exists($icon)) {
                 $icon = Base_ThemeCommon::get_template_file('Base_Admin', 'icon.png');
             }
         }
         $button_id = $name . '__button';
         $enable_field = $name . '_enable';
         $sections = array();
         $sections_id = $name . '__sections';
         $enable_default = Base_AdminCommon::get_access($name, '', true);
         $form->addElement('checkbox', $enable_field, $enable_default === null ? __('Access blocked') : __('Allow access'), null, array('onchange' => 'admin_switch_button("' . $button_id . '",this.checked, "' . $sections_id . '");', 'id' => $enable_field, 'style' => $enable_default === null ? 'display:none;' : ''));
         $form->setDefaults(array($enable_field => $enable_default));
         eval_js('admin_switch_button("' . $button_id . '",$("' . $enable_field . '").checked, "' . $sections_id . '", 1);');
         if (class_exists($name . 'Common') && is_callable(array($name . 'Common', 'admin_access_levels'))) {
             $raws = call_user_func(array($name . 'Common', 'admin_access_levels'));
             if (is_array($raws)) {
                 foreach ($raws as $s => $v) {
                     $type = isset($v['values']) ? 'select' : 'checkbox';
                     $vals = isset($v['values']) ? $v['values'] : null;
                     $s_field = $name . '__' . $s . '__switch';
                     $form->addElement($type, $s_field, $v['label'], $vals);
                     $form->setDefaults(array($s_field => Base_AdminCommon::get_access($name, $s, true)));
                     $sections[$s] = $s_field;
                 }
             }
         }
         $buttons[$caption['section']][$name] = array('label' => $caption['label'], 'icon' => $icon, 'id' => $button_id, 'enable_switch' => $enable_field, 'sections_id' => $sections_id, 'sections' => $sections);
     }
     if ($form->validate()) {
         $vals = $form->exportValues();
         DB::Execute('DELETE FROM base_admin_access');
         foreach ($buttons as $section => $bs) {
             foreach ($bs as $name => $b) {
                 DB::Execute('INSERT INTO base_admin_access (module, section, allow) VALUES (%s, %s, %d)', array($name, '', isset($vals[$b['enable_switch']]) && $vals[$b['enable_switch']] ? 1 : 0));
                 foreach ($b['sections'] as $s => $f) {
                     DB::Execute('INSERT INTO base_admin_access (module, section, allow) VALUES (%s, %s, %d)', array($name, $s, isset($vals[$f]) ? $vals[$f] : 0));
                 }
             }
         }
         $this->parent->reset();
         return;
     }
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     $sections = array();
     foreach ($buttons as $section => $b) {
         $sections[$section] = array('header' => $section, 'buttons' => $b);
     }
     $sections = $this->sort_sections($sections);
     $theme = $this->pack_module('Base/Theme');
     $form->assign_theme('form', $theme);
     $theme->assign('header', __('Admin Panel Access'));
     $theme->assign('sections', $sections);
     $theme->display('access_panel');
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:85,代码来源:Admin_0.php

示例7: define

 * @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')) {
    Base_ThemeCommon::create_cache();
开发者ID:cretzu89,项目名称:EPESI,代码行数:31,代码来源:check.php

示例8: submit_contact

 public static function submit_contact($values, $mode)
 {
     switch ($mode) {
         case 'cloning':
             $values['login'] = '';
             return $values;
         case 'display':
             // display copy company data button and do update if needed
             self::copy_company_data_subroutine($values);
             $is_employee = false;
             if (isset($values['related_companies']) && is_array($values['related_companies']) && in_array(CRM_ContactsCommon::get_main_company(), $values['related_companies'])) {
                 $is_employee = true;
             }
             if (isset($values['company_name']) && $values['company_name'] == CRM_ContactsCommon::get_main_company()) {
                 $is_employee = true;
             }
             $me = CRM_ContactsCommon::get_my_record();
             $emp = array($me['id']);
             $cus = array();
             if ($is_employee) {
                 $emp[] = $values['id'];
             } else {
                 $cus[] = 'P:' . $values['id'];
             }
             $ret = array();
             $ret['new'] = array();
             $ret['new']['crm_filter'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('Set CRM Filter')) . ' ' . Module::create_href(array('set_crm_filter' => 1)) . '>F</a>';
             if (isset($_REQUEST['set_crm_filter'])) {
                 CRM_FiltersCommon::set_profile('c' . $values['id']);
             }
             if (ModuleManager::is_installed('CRM/Meeting') !== -1 && Utils_RecordBrowserCommon::get_access('crm_meeting', 'add')) {
                 $ret['new']['event'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Meeting')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('crm_meeting', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Calendar', 'icon-small.png') . '"></a>';
             }
             if (ModuleManager::is_installed('CRM/Tasks') !== -1 && Utils_RecordBrowserCommon::get_access('task', 'add')) {
                 $ret['new']['task'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Task')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('task', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Tasks', 'icon-small.png') . '"></a>';
             }
             if (ModuleManager::is_installed('CRM/PhoneCall') !== -1 && Utils_RecordBrowserCommon::get_access('phonecall', 'add')) {
                 $ret['new']['phonecall'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Phonecall')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('phonecall', array('date_and_time' => date('Y-m-d H:i:s'), 'customer' => 'P:' . $values['id'], 'employees' => $me['id'], 'status' => 0, 'permission' => 0, 'priority' => 1), 'none', false) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_PhoneCall', 'icon-small.png') . '"></a>';
             }
             $ret['new']['note'] = Utils_RecordBrowser::$rb_obj->add_note_button('contact/' . $values['id']);
             return $ret;
         case 'adding':
             $values['permission'] = Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission');
             break;
         case 'add':
             if (isset($values['email']) && $values['email'] == '' && $values['login'] != 0 && $mode == 'add') {
                 $values['email'] = DB::GetOne('SELECT mail FROM user_password WHERE user_login_id=%d', array($values['login']));
             }
         case 'edit':
             if (isset($values['create_company'])) {
                 $comp_id = Utils_RecordBrowserCommon::new_record('company', array('company_name' => $values['create_company_name'], 'address_1' => $values['address_1'], 'address_2' => $values['address_2'], 'country' => $values['country'], 'city' => $values['city'], 'zone' => isset($values['zone']) ? $values['zone'] : '', 'postal_code' => $values['postal_code'], 'phone' => $values['work_phone'], 'fax' => $values['fax'], 'web_address' => $values['web_address'], 'permission' => $values['permission']));
                 if (!isset($values['company_name'])) {
                     $values['company_name'] = null;
                 }
                 if (!isset($values['related_companies'])) {
                     $values['related_companies'] = array();
                 }
                 if (!is_array($values['related_companies'])) {
                     $values['related_companies'] = array($values['related_companies']);
                 }
                 if (!$values['company_name']) {
                     $values['company_name'] = $comp_id;
                 } else {
                     $values['related_companies'][] = $comp_id;
                 }
             }
             if (Base_AclCommon::i_am_admin()) {
                 if ($values['login'] == 'new') {
                     if (!$values['set_password']) {
                         $values['set_password'] = null;
                     }
                     Base_User_LoginCommon::add_user($values['username'], $values['email'], $values['set_password']);
                     $values['login'] = Base_UserCommon::get_user_id($values['username']);
                 } else {
                     if ($values['login']) {
                         Base_User_LoginCommon::change_user_preferences($values['login'], isset($values['email']) ? $values['email'] : '', isset($values['set_password']) ? $values['set_password'] : null);
                         if (isset($values['username']) && $values['username']) {
                             Base_UserCommon::rename_user($values['login'], $values['username']);
                         }
                     }
                 }
                 if (Base_AclCommon::i_am_sa() && $values['login'] && isset($values['admin']) && $values['admin'] !== '') {
                     $old_admin = Base_AclCommon::get_admin_level($values['login']);
                     if ($old_admin != $values['admin']) {
                         $admin_arr = array(0 => 'No', 1 => 'Administrator', 2 => 'Super Administrator');
                         if (Base_UserCommon::change_admin($values['login'], $values['admin']) !== true) {
                             Utils_RecordBrowserCommon::new_record_history('contact', $values['id'], 'Admin set from "' . $admin_arr[$old_admin] . '" to "' . $admin_arr[$values['admin']]);
                         }
                     }
                 }
             }
             unset($values['admin']);
             unset($values['username']);
             unset($values['set_password']);
             unset($values['confirm_password']);
     }
     return $values;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:98,代码来源:ContactsCommon_0.php

示例9: edit_user_form

 public function edit_user_form($edit_id)
 {
     if ($this->is_back()) {
         if ($this->parent->get_type() != 'Base_Admin') {
             $x = ModuleManager::get_instance('/Base_Box|0');
             if (!$x) {
                 trigger_error('There is no base box module instance', E_USER_ERROR);
             }
             $x->pop_main();
         }
         return false;
     }
     $form = $this->init_module(Libs_QuickForm::module_name(), $edit_id >= 0 ? __('Applying changes') : __('Creating new user'));
     //create new user
     $form->addElement('header', null, $edit_id >= 0 ? __('Edit user') : __('Create new user'));
     $form->addElement('hidden', $this->create_unique_key('edit_user'), $edit_id);
     $form->addElement('text', 'username', __('Username'));
     // require a username
     $form->addRule('username', __('A username must be between 3 and 32 chars'), 'rangelength', array(3, 32));
     $form->addRule('username', __('Field required'), 'required');
     $form->addElement('text', 'mail', __('E-mail'));
     $form->addRule('mail', __('Field required'), 'required');
     $form->addRule('mail', __('Invalid e-mail address'), 'email');
     $form->addElement('select', 'admin', __('Administrator'), array(0 => __('No'), 1 => __('Administrator'), 2 => __('Super Administrator')));
     if ($edit_id < 0) {
         $form->addElement('html', '<tr><td colspan=2><b>' . __('If you leave password fields empty random password is automatically generated and e-mailed to the user.') . '</b></td></tr>');
     } else {
         $form->addElement('html', '<tr><td colspan=2><b>' . __('If you leave password fields empty, password is not changed.') . '</b></td></tr>');
     }
     //$form->addElement('header',null,__('If you leave this fields empty, password is not changed.'));
     $form->addElement('password', 'pass', __('Password'));
     $form->addElement('password', 'pass_c', __('Confirm Password'));
     $form->addRule(array('pass', 'pass_c'), __('Passwords don\'t match'), 'compare');
     $form->addRule('pass', __('Your password must be longer then 5 chars'), 'minlength', 5);
     if ($edit_id >= 0) {
         $form->addElement('select', 'active', __('Active'), array(1 => __('Yes'), 0 => __('No')));
         //set defaults
         $ret = DB::Execute('SELECT u.login, p.mail, u.active, u.admin FROM user_login u INNER JOIN user_password p ON (p.user_login_id=u.id) WHERE u.id=%d', $edit_id);
         if ($ret && ($row = $ret->FetchRow())) {
             $form->setDefaults(array('username' => $row['login'], 'mail' => $row['mail'], 'active' => $row['active'], 'admin' => $row['admin']));
         }
     }
     $form->registerRule('check_username', 'callback', 'check_username_free', 'Base_User_LoginCommon');
     $form->addRule(array('username', $this->create_unique_key('edit_user')), __('Username already taken'), 'check_username');
     if ($form->validate()) {
         if ($form->process(array(&$this, 'submit_edit_user_form'))) {
             if ($this->parent->get_type() != 'Base_Admin') {
                 $x = ModuleManager::get_instance('/Base_Box|0');
                 if (!$x) {
                     trigger_error('There is no base box module instance', E_USER_ERROR);
                 }
                 $x->pop_main();
             }
             return false;
         }
     } else {
         $form->display();
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     if (Base_AclCommon::i_am_sa() && $edit_id >= 0) {
         Base_ActionBarCommon::add('settings', __('Log as user'), $this->create_callback_href(array($this, 'log_as_user'), $edit_id));
     }
     return true;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:65,代码来源:Administrator_0.php

示例10: basic_clearance

 public static function basic_clearance($all = false)
 {
     $user_clearance = array(__('All users') => 'ALL');
     if ($all || Base_AclCommon::i_am_admin()) {
         $user_clearance[__('Admin')] = 'ADMIN';
     }
     if ($all || Base_AclCommon::i_am_sa()) {
         $user_clearance[__('Superadmin')] = 'SUPERADMIN';
     }
     return $user_clearance;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:11,代码来源:AclCommon_0.php


注:本文中的Base_AclCommon::i_am_sa方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。