Exemple #1
0
 public function get_module_dirs()
 {
     //show uninstalled & installed modules
     $ret = DB::Execute('SELECT * FROM available_modules');
     $module_dirs = array();
     while ($row = $ret->FetchRow()) {
         if (ModuleManager::exists($row['name'])) {
             $module_dirs[$row['name']][$row['vkey']] = $row['version'];
             ModuleManager::include_install($row['name']);
         } else {
             DB::Execute('DELETE FROM available_modules WHERE name=%s and vkey=%d', array($row['name'], $row['vkey']));
         }
     }
     if (empty($module_dirs)) {
         $module_dirs = Base_SetupCommon::refresh_available_modules();
     }
     return $module_dirs;
 }
Exemple #2
0
 private function module_install($class_name)
 {
     if (substr($class_name, -7) != 'Install') {
         return false;
     }
     $module_name = substr($class_name, 0, -7);
     return ModuleManager::include_install($module_name);
 }
Exemple #3
0
Utils_RecordBrowserCommon::add_access('premium_weblink_custom_addon', 'add', 'ADMIN', array('recordset' => ''));
Utils_RecordBrowserCommon::add_access('premium_weblink_custom_addon', 'edit', 'SUPERADMIN');
Utils_RecordBrowserCommon::add_access('premium_weblink_custom_addon', 'delete', 'SUPERADMIN');
Utils_RecordBrowserCommon::add_access('premium_weblink', 'view', 'ACCESS:employee', array());
Utils_RecordBrowserCommon::add_access('premium_weblink', 'add', 'ACCESS:employee', array('link' => ''));
Utils_RecordBrowserCommon::add_access('premium_weblink', 'edit', 'ACCESS:employee', array(), array('date'));
Utils_RecordBrowserCommon::add_access('premium_weblink', 'delete', 'ACCESS:employee');
if (ModuleManager::is_installed('Premium_Weblink') >= 0) {
    DB::Execute('UPDATE premium_weblink_field SET type=%s WHERE field=%s', array('hidden', 'Record Type'));
}
Utils_RecordBrowserCommon::add_access('bugtrack', 'view', 'ACCESS:employee');
Utils_RecordBrowserCommon::add_access('bugtrack', 'add', 'ACCESS:employee');
Utils_RecordBrowserCommon::add_access('bugtrack', 'edit', 'ACCESS:employee');
Utils_RecordBrowserCommon::add_access('bugtrack', 'delete', array('ACCESS:employee', 'ACCESS:manager'));
if (ModuleManager::is_installed('Custom_Prosperix_AccessRestrictions') >= 0) {
    ModuleManager::include_install('Custom_Prosperix_AccessRestrictions');
    $m = new Custom_Prosperix_AccessRestrictionsInstall();
    $m->install();
    $ret = DB::Execute('SELECT * FROM user_login');
    while ($row = $ret->FetchRow()) {
        $aid = get_acl_user_id($row['id']);
        $allow = is_user_in_group($aid, 'Employee Vendor Moderator');
        $allow |= is_user_in_group($aid, 'Administrator');
        $allow |= is_user_in_group($aid, 'Super administrator');
        if ($allow) {
            $r2 = DB::Execute('SELECT * FROM contact_data_1 WHERE f_login=%d', array($row['id']));
            while ($r = $r2->FetchRow()) {
                if (!$r['f_access']) {
                    $gr = '__vendor_manager__';
                } else {
                    $gr = $r['f_access'] . 'vendor_manager__';
Exemple #4
0
 public function body()
 {
     // init lang from install process
     $install_lang_code =& $_GET['install_lang'];
     if (isset($install_lang_code)) {
         // set anonymous setup to true at very first run to allow use admin tools.
         Variable::set('anonymous_setup', true);
         //
         Variable::set('default_lang', $install_lang_code);
         Epesi::redirect('index.php');
         return;
     }
     Base_LangCommon::load();
     $th = $this->init_module('Base/Theme');
     ob_start();
     print '<center>';
     $post_install =& $_SESSION['first-run_post-install'];
     if (!empty($post_install)) {
         foreach ($post_install as $i => $v) {
             $i = str_replace('/', '_', $i);
             ModuleManager::include_install($i);
             $f = array($i . 'Install', 'post_install');
             $fs = array($i . 'Install', 'post_install_process');
             if (!is_callable($f) || !is_callable($fs)) {
                 unset($post_install[$i]);
                 continue;
             }
             $ret = call_user_func($f);
             $form = $this->init_module('Libs/QuickForm', null, $i);
             $form->addElement('header', null, __('Post installation of %s', array(str_replace('_', '/', $i))));
             $form->add_array($ret);
             $form->addElement('submit', null, 'OK');
             if ($form->validate()) {
                 $form->process($fs);
                 unset($post_install[$i]);
             } else {
                 $form->display();
                 break;
             }
         }
         if (ModuleManager::is_installed('Base') >= 0 && empty($post_install)) {
             Variable::set('default_module', 'Base_Box');
             Epesi::redirect();
         }
     }
     if (empty($post_install) && ModuleManager::is_installed('Base') < 0) {
         $wizard = $this->init_module('Utils/Wizard');
         /////////////////////////////////////////////////////////////
         $this->ini = parse_ini_file('modules/FirstRun/distros.ini', true);
         if (count($this->ini) > 1) {
             $f =& $wizard->begin_page();
             $f->addElement('header', null, __('Welcome to EPESI first run wizard'));
             $f->setDefaults(array('setup_type' => key($this->ini)));
             foreach ($this->ini as $name => $pkgs) {
                 switch ($name) {
                     case 'CRM installation':
                         $label = __('CRM installation');
                         break;
                     case 'CRM and Sales Opportunity':
                         $label = __('CRM and Sales Opportunity');
                         break;
                     case 'CRM and Bug Tracker installation':
                         $label = __('CRM and Bug Tracker installation');
                         break;
                     default:
                         $label = $name . ' (* missing translation)';
                         break;
                 }
                 $f->addElement('radio', 'setup_type', '', $label, $name);
             }
             $f->addElement('html', '<tr><td colspan=2><br /><strong>If you are not sure which package to choose select CRM Installation.<br>You can customize your installation later.</strong><br><br></td></tr>');
             $wizard->next_page();
         }
         /////////////////////////////////////////////////////////////////
         $f = $wizard->begin_page('simple_user');
         $f->addElement('header', null, __('Please enter administrator user login and password'));
         $f->addElement('text', 'login', __('Login'));
         $f->addRule('login', __('A username must be between 3 and 32 chars'), 'rangelength', array(3, 32));
         $f->addRule('login', __('Field required'), 'required');
         $f->addElement('text', 'mail', __('E-mail'));
         $f->addRule('mail', __('Field required'), 'required');
         $f->addRule('mail', __('Invalid e-mail address'), 'email');
         $f->addElement('password', 'pass', __('Password'));
         $f->addElement('password', 'pass_c', __('Confirm Password'));
         $f->addRule('pass', __('Field required'), 'required');
         $f->addRule('pass_c', __('Field required'), 'required');
         $f->addRule(array('pass', 'pass_c'), __('Passwords don\'t match'), 'compare');
         $f->addRule('pass', __('Your password must be longer then 5 chars'), 'minlength', 5);
         $wizard->next_page();
         /////////////////////////////////////////////////////
         $f = $wizard->begin_page('simple_mail');
         $f->addElement('header', null, __('Mail settings'));
         $f->addElement('html', '<tr><td colspan=2>' . __('If you are on a hosted server it probably should stay as it is now.') . '</td></tr>');
         $f->addElement('select', 'mail_method', __('Choose method'), array('smtp' => __('remote smtp server'), 'mail' => __('local php.ini settings')));
         $f->setDefaults(array('mail_method' => 'mail'));
         $wizard->next_page(array($this, 'choose_mail_method'));
         //////////////////////
         $f = $wizard->begin_page('simple_mail_smtp');
         $f->addElement('header', null, __('Mail settings'));
         $f->addElement('text', 'mail_host', __('SMTP host address'));
         $f->addRule('mail_host', __('Field required'), 'required');
         $f->addElement('header', null, __('If your server needs authorization...'));
         $f->addElement('text', 'mail_user', __('Login'));
         $f->addElement('password', 'mail_password', __('Password'));
         $wizard->next_page();
         ////////////////////////////////////////////////////////////
         $f = $wizard->begin_page('setup_warning');
         $f->addElement('header', null, __('Warning'));
         $f->addElement('html', '<tr><td colspan=2><br />' . __('Setup will now check for available modules and will install them.') . '<br>' . __('This operation may take several minutes.') . '<br><br></td></tr>');
         $wizard->next_page();
         /////////////////////////////////////////
         $this->display_module($wizard, array(array($this, 'done')));
     }
     print '</center>';
     $th->assign('wizard', ob_get_clean());
     $th->display();
 }