Ejemplo n.º 1
0
 public function install()
 {
     $ret = DB::CreateTable('user_password', "user_login_id I KEY, password C(256) NOTNULL, mail C(255) NOTNULL", array('constraints' => ', FOREIGN KEY (user_login_id) REFERENCES user_login(id)'));
     if ($ret === false) {
         print 'Invalid SQL query - user_password table install';
         return false;
     }
     $ret = DB::CreateTable('user_autologin', "user_login_id I NOTNULL, autologin_id C(32) NOTNULL, last_log T, description C(64)", array('constraints' => ', FOREIGN KEY (user_login_id) REFERENCES user_login(id)'));
     if ($ret === false) {
         print 'Invalid SQL query - user_autologin table install';
         return false;
     }
     $ret = DB::CreateTable('user_login_ban', "failed_on I4, from_addr C(32)");
     if ($ret === false) {
         print 'Invalid SQL query - user_login_ban table install';
         return false;
     }
     $ret = DB::CreateTable('user_reset_pass', "user_login_id I NOTNULL, hash_id C(32) NOTNULL, created_on T DEFTIMESTAMP", array('constraints' => ', FOREIGN KEY (user_login_id) REFERENCES user_login(id)'));
     if ($ret === false) {
         print 'Invalid SQL query - user_autologin table install';
         return false;
     }
     Variable::set('host_ban_time', 300);
     Variable::set('host_ban_nr_of_tries', 3);
     Variable::set('host_ban_by_login', 0);
     Base_ThemeCommon::install_default_theme(Base_User_LoginInstall::module_name());
     return true;
 }
Ejemplo n.º 2
0
 public function install()
 {
     Base_ThemeCommon::install_default_theme($this->get_type());
     Variable::set('error_mail', '');
     $this->create_data_dir();
     return true;
 }
Ejemplo n.º 3
0
 public function install()
 {
     $ret = true;
     if ($ret) {
         $ret = Variable::set('mail_from_addr', '*****@*****.**');
     }
     if ($ret) {
         $ret = Variable::set('mail_from_name', 'Administrator');
     }
     if ($ret) {
         $ret = Variable::set('mail_use_replyto', '');
     }
     if ($ret) {
         $ret = Variable::set('mail_method', 'mail');
     }
     if ($ret) {
         $ret = Variable::set('mail_user', '');
     }
     if ($ret) {
         $ret = Variable::set('mail_password', '');
     }
     if ($ret) {
         $ret = Variable::set('mail_host', 'smtp.example.com:25');
     }
     if ($ret) {
         $ret = Variable::set('mail_security', '');
     }
     if ($ret) {
         $ret = Variable::set('mail_auth', false);
     }
     Base_ThemeCommon::install_default_theme($this->get_type());
     return $ret;
 }
Ejemplo n.º 4
0
 public function submit_admin($data)
 {
     Variable::set('default_theme', $data['theme']);
     Base_ThemeCommon::create_cache();
     Base_StatusBarCommon::message('Theme changed - reloading page');
     eval_js('setTimeout(\'document.location=\\\'index.php\\\'\',\'3000\')');
     return true;
 }
Ejemplo n.º 5
0
 public function install()
 {
     Variable::set('base_page_title', 'EPESI');
     Variable::set('show_caption_in_title', '1');
     Variable::set('show_module_indicator', '1');
     Variable::set('logo_file', '');
     Variable::set('login_logo_file', '');
     Base_ThemeCommon::install_default_theme(Base_MainModuleIndicatorInstall::module_name());
     $this->create_data_dir();
     return true;
 }
Ejemplo n.º 6
0
 public function install()
 {
     $this->create_data_dir();
     mkdir(DATA_DIR . '/Base_Theme/templates');
     mkdir(DATA_DIR . '/Base_Theme/templates/default');
     mkdir(DATA_DIR . '/Base_Theme/compiled');
     mkdir(DATA_DIR . '/Base_Theme/cache');
     mkdir(DATA_DIR . '/Base_Theme/config');
     $this->install_default_theme_common_files('modules/Base/Theme/', 'images');
     Variable::set('default_theme', 'default');
     return true;
 }
Ejemplo n.º 7
0
 public function install()
 {
     $this->create_data_dir();
     if (!is_dir(DATA_DIR . '/Base_Lang/base')) {
         mkdir(DATA_DIR . '/Base_Lang/base');
     }
     if (!is_dir(DATA_DIR . '/Base_Lang/custom')) {
         mkdir(DATA_DIR . '/Base_Lang/custom');
     }
     ModuleManager::include_common('Base_Lang', 0);
     Base_LangCommon::install_translations(Base_LangInstall::module_name());
     return Variable::set('default_lang', 'en');
 }
Ejemplo n.º 8
0
	public function admin() {
		if ($this->is_back()) {
			$this->parent->reset();
		}
		Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());

		$google_login = Variable::get('utils_attachments_google_user', false);
		$google_pass = Variable::get('utils_attachments_google_pass', false);

		$form = $this->init_module('Libs_QuickForm');
		$theme = $this->init_module('Base_Theme');

		$form->addElement('header', 'header', __('Google Username and Password'));

		$form->addElement('text', 'google_user', __('Username'));
		$form->addElement('password', 'google_pass', __('Password'));

		$form->setDefaults(array('google_user'=>$google_login));
		$form->setDefaults(array('google_pass'=>$google_pass));

		if ($form->validate()) {
			$vals = $form->exportValues();

			$ok = true;
			if ($vals['google_user']) {
				$g_auth = Utils_AttachmentCommon::get_google_auth($vals['google_user'], $vals['google_pass']);
				if (!$g_auth) $ok = false;
			}

			if ($ok) {
				Variable::set('utils_attachments_google_user', $vals['google_user']);
				Variable::set('utils_attachments_google_pass', $vals['google_pass']);

				Base_StatusBarCommon::message(__('Settings saved'));
			} else {
				Base_StatusBarCommon::message(__('Unable to authenticate'), 'error');
			}
			location(array());
			return;
		}

		$form->assign_theme('form', $theme);

		Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
		Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
		
		Base_ThemeCommon::load_css('Utils_RecordBrowser','View_entry');
		$theme->display('admin');
	}
Ejemplo n.º 9
0
 /**
  *
  * The default may be set to NULL (Text datatype does this) in case default
  * should not be listed
  * @param type $value
  */
 public function setDefault($value)
 {
     if (is_null($value)) {
         if ($this->default instanceof \Variable) {
             $this->default->set(null);
         } else {
             $this->default = null;
         }
     } elseif ($this->default instanceof \Variable) {
         $this->default->set($value);
     } else {
         $this->default = new \Variable\String((string) $value);
     }
     return $this;
 }
Ejemplo n.º 10
0
 public function admin_signature()
 {
     $f = $this->init_module('Libs/QuickForm');
     $f->addElement('header', null, __('Outgoing mail global signature'));
     $fck =& $f->addElement('ckeditor', 'content', __('Content'));
     $fck->setFCKProps('800', '300', true);
     $f->setDefaults(array('content' => Variable::get('crm_roundcube_global_signature', false)));
     Base_ActionBarCommon::add('save', __('Save'), $f->get_submit_form_href());
     if ($f->validate()) {
         $ret = $f->exportValues();
         $content = $ret['content'];
         Variable::set('crm_roundcube_global_signature', $content);
         Base_StatusBarCommon::message(__('Signature saved'));
         $this->parent->reset();
         return;
     }
     $f->display();
 }
Ejemplo n.º 11
0
 public function admin()
 {
     if ($this->is_back()) {
         $this->parent->reset();
     }
     $form = $this->init_module('Libs/QuickForm', 'Errors to mail');
     $form->addElement('text', 'mail', __('Send bugs to'));
     $form->addRule('mail', __('Invalid e-mail address'), 'email');
     $form->addElement('static', '', '', __('Leave empty to disable bug reports.'));
     Base_ActionBarCommon::add('back', __('Cancel'), $this->create_back_href());
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     $form->setDefaults(array('mail' => Variable::get('error_mail')));
     if ($form->validate()) {
         Variable::set('error_mail', $form->exportValue('mail'));
         $this->parent->reset();
     } else {
         $form->display();
     }
 }
Ejemplo n.º 12
0
 public function install()
 {
     $ret = DB::CreateTable('available_modules', 'name C(128), vkey I NOTNULL, version C(64) NOTNULL', array('constraints' => ', PRIMARY KEY(name, vkey)'));
     if ($ret === false) {
         die('Invalid SQL query - Setup module (modules table)');
     }
     $ret = Variable::set('anonymous_setup', true);
     if ($ret === false) {
         print 'Invalid SQL query - Setup module (populating variables)';
         return false;
     }
     $ret = Variable::set('simple_setup', 1);
     if ($ret === false) {
         print 'Invalid SQL query - Setup module (populating variables)';
         return false;
     }
     $this->create_data_dir();
     Base_ThemeCommon::install_default_theme($this->get_type());
     return true;
 }
Ejemplo n.º 13
0
    protected function perform_update_end()
    {
        $this->turn_on_maintenance_mode();

        Base_ThemeCommon::themeup();
        Base_LangCommon::update_translations();
        ModuleManager::create_load_priority_array();

        Variable::set('version', EPESI_VERSION);
        MaintenanceMode::turn_off();
    }
Ejemplo n.º 14
0
 public static function is_update_available($force_check = false)
 {
     $esu = Variable::get('epesi_store_updates', false);
     $today = date('Ymd');
     if ($force_check || !is_array($esu) || $esu['check_day'] != $today) {
         $updates = self::_count_updates_of_downloaded_modules();
         $esu = array('check_day' => $today, 'updates' => $updates);
         Variable::set('epesi_store_updates', $esu);
     }
     return $esu['updates'];
 }
Ejemplo n.º 15
0
 public static function set_store_visibility($enabled)
 {
     Variable::set('base_setup_store_enabled', $enabled ? true : false);
 }
Ejemplo n.º 16
0
 public function submit_admin($data)
 {
     if (DEMO_MODE && Variable::get('default_lang') != $data['lang_code']) {
         print 'You cannot change default language in demo.';
         return false;
     }
     return Variable::set('default_lang', $data['lang_code']) && Variable::set('allow_lang_change', isset($data['allow_lang_change']) && $data['allow_lang_change'] ? 1 : 0);
 }
Ejemplo n.º 17
0
 public function set($value)
 {
     return parent::set($value);
 }
Ejemplo n.º 18
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
Variable::set('mail_use_replyto', 1);
Ejemplo n.º 19
0
 public static function is_banned($login = null, $current_time = null)
 {
     $time_seconds = Variable::get('host_ban_time');
     $tries = Variable::get('host_ban_nr_of_tries', false);
     if ($tries === '') {
         // default value when there is no such variable
         $tries = 3;
         Variable::set('host_ban_nr_of_tries', $tries);
     }
     // Some kind of hack. We are using md5 hash of user login and IP address
     // like address to match host + username. We can because md5 is 32 char.
     // long as from_addr field
     $ip = get_client_ip_address();
     $param = $login ? md5($login . $ip) : $ip;
     // Hidden feature to allow login only from desired IP
     // TODO: add GUI
     // Example:
     // $allowed_ip = array('user_1' => array('1.2.3.4', '5.6.7.8'), 'user_2' => array('2.3.4.5', '3.4.5.6'));
     // Variable::set('allowed_ip_login', $allowed_ip);
     $allowed_ip = Variable::get('allowed_ip_login', false);
     if ($allowed_ip) {
         // use '' key to match all users
         if (isset($allowed_ip[''])) {
             $login = '';
         }
         if (isset($allowed_ip[$login])) {
             if (!in_array($ip, $allowed_ip[$login])) {
                 return true;
             }
             // is banned
         }
     }
     // allow to inject time parameter
     if (!$current_time) {
         $current_time = time();
     }
     if ($tries > 0 && $time_seconds > 0) {
         $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array($current_time - $time_seconds, $param));
         if ($fails >= $tries) {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 20
0
 public function submit_logo($file, $oryg, $vars)
 {
     if ($oryg) {
         $reqs = array();
         if (!preg_match('/\\.(jpg|jpeg|gif|png|bmp)$/i', $oryg, $reqs)) {
             print '<a href="#">' . __('Uploaded file is not valid image - JPG, GIF, PNG and BMP files are supported. Click here to proceed with another file.') . '</a>';
             return;
         }
         $old = Variable::get($vars['type'] . 'logo_file');
         @unlink($old);
         $l = $this->get_data_dir() . $vars['type'] . 'logo.' . $reqs[1];
         Variable::set($vars['type'] . 'logo_file', $l);
         rename($file, $l);
         location(array());
     }
 }
Ejemplo n.º 21
0
 public function install()
 {
     $this->create_data_dir();
     // create htaccess to prevent logs to be available on the internet
     $htaccess = $this->get_data_dir() . '.htaccess';
     $f = fopen($htaccess, 'w');
     if ($f === false) {
         print "Cannot create .htaccess file ({$htaccess}). " . "Your Roundcube logs may be available on the internet!";
     } else {
         fwrite($f, "deny from all\n");
         fclose($f);
     }
     Base_ThemeCommon::install_default_theme($this->get_type());
     $this->drop_all_rc_tables();
     if (DB::is_mysql()) {
         $f = file_get_contents('modules/CRM/Roundcube/RC/SQL/mysql.initial.sql');
     } else {
         $f = file_get_contents('modules/CRM/Roundcube/RC/SQL/postgres.initial.sql');
     }
     foreach (explode(';', $f) as $q) {
         $q = trim($q);
         if (!$q) {
             continue;
         }
         DB::Execute($q);
     }
     Utils_CommonDataCommon::new_array('CRM/Roundcube/Security', array('tls' => _M('TLS'), 'ssl' => _M('SSL')), true, true);
     //addons table
     $fields = array(array('name' => _M('Recordset'), 'type' => 'text', 'param' => 64, 'display_callback' => array($this->get_type() . 'Common', 'display_recordset'), 'QFfield_callback' => array($this->get_type() . 'Common', 'QFfield_recordset'), 'required' => true, 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('rc_related', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_related', _M('Mail Related Recordsets'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_related', array('CRM_RoundcubeCommon', 'processing_related'));
     Utils_RecordBrowserCommon::add_access('rc_related', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_related', 'add', 'ADMIN');
     Utils_RecordBrowserCommon::add_access('rc_related', 'edit', 'SUPERADMIN');
     Utils_RecordBrowserCommon::add_access('rc_related', 'delete', 'SUPERADMIN');
     Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'company'));
     Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'contact'));
     //accounts table
     $fields = array(array('name' => _M('EPESI User'), 'type' => 'integer', 'extra' => false, 'visible' => true, 'required' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_epesi_user'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_epesi_user')), array('name' => _M('Email'), 'type' => 'text', 'extra' => false, 'visible' => true, 'required' => true, 'param' => 128), array('name' => _M('Account Name'), 'type' => 'text', 'extra' => false, 'visible' => true, 'required' => true, 'param' => 32, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_account_name')), array('name' => _M('Server'), 'type' => 'text', 'extra' => false, 'visible' => true, 'param' => '255', 'required' => true), array('name' => _M('Login'), 'type' => 'text', 'required' => true, 'param' => '255', 'extra' => false, 'visible' => true), array('name' => _M('Password'), 'type' => 'text', 'required' => true, 'extra' => false, 'param' => '255', 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_password'), 'display_callback' => array('CRM_RoundcubeCommon', 'display_password')), array('name' => _M('Security'), 'type' => 'commondata', 'param' => array('CRM/Roundcube/Security'), 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_security')), array('name' => _M('SMTP Server'), 'type' => 'text', 'extra' => false, 'visible' => false, 'param' => '255', 'required' => true), array('name' => _M('SMTP Auth'), 'type' => 'checkbox', 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_auth')), array('name' => _M('SMTP Login'), 'type' => 'text', 'required' => false, 'param' => '255', 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_login')), array('name' => _M('SMTP Password'), 'type' => 'text', 'extra' => false, 'param' => '255', 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_password'), 'display_callback' => array('CRM_RoundcubeCommon', 'display_password')), array('name' => _M('SMTP Security'), 'type' => 'commondata', 'param' => array('CRM/Roundcube/Security'), 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_security')), array('name' => _M('Default Account'), 'type' => 'checkbox', 'extra' => false, 'visible' => true, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_default_account')), array('name' => _M('Advanced'), 'type' => 'page_split'), array('name' => _M('Archive on sending'), 'type' => 'checkbox', 'extra' => true, 'visible' => false), array('name' => _M('Use EPESI Archive directories'), 'type' => 'checkbox', 'extra' => true, 'visible' => false), array('name' => _M('IMAP Root'), 'type' => 'text', 'param' => 32, 'extra' => true, 'visible' => false), array('name' => _M('IMAP Delimiter'), 'type' => 'text', 'param' => 8, 'extra' => true, 'visible' => false));
     Utils_RecordBrowserCommon::install_new_recordset('rc_accounts', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_accounts', _M('Mail accounts'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_accounts', array('CRM_RoundcubeCommon', 'submit_account'));
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'param' => '256', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_subject')), array('name' => _M('Count'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_thread_count'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_thread_count')), array('name' => _M('Contacts'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => false, 'visible' => true), array('name' => _M('First Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Last Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Attachments'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_thread_attachments'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_thread_attachments')));
     Utils_RecordBrowserCommon::install_new_recordset('rc_mail_threads', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_mail_threads', _M('Mail Thread'));
     Utils_RecordBrowserCommon::new_addon('rc_mail_threads', 'CRM/Roundcube', 'thread_addon', _M('E-mails'));
     Utils_RecordBrowserCommon::set_search('rc_mail_threads', 2, -1);
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'param' => '256', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_subject')), array('name' => _M('Contacts'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => false, 'visible' => true), array('name' => _M('Employee'), 'type' => 'crm_contact', 'param' => array('field_type' => 'select'), 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Related'), 'type' => 'multiselect', 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_related'), 'param' => '__RECORDSETS__::;CRM_RoundcubeCommon::related_crits', 'extra' => false, 'required' => false, 'visible' => true), array('name' => _M('Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Attachments'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_attachments'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_attachments')), array('name' => _M('Headers Data'), 'type' => 'long text', 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('Body'), 'type' => 'long text', 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_body')), array('name' => _M('From'), 'type' => 'text', 'param' => 128, 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('To'), 'type' => 'text', 'param' => 4096, 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('Thread'), 'type' => 'select', 'param' => 'rc_mail_threads::Count', 'extra' => false, 'visible' => false, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_mail_thread'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_mail_thread')), array('name' => _M('Message ID'), 'type' => 'text', 'param' => 128, 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_hidden')), array('name' => _M('References'), 'type' => 'text', 'param' => 4096 * 4, 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_hidden')));
     Utils_RecordBrowserCommon::install_new_recordset('rc_mails', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_mails', _M('Mails'));
     Utils_RecordBrowserCommon::set_tpl('rc_mails', Base_ThemeCommon::get_template_filename('CRM/Roundcube', 'mails'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_mails', array('CRM_RoundcubeCommon', 'submit_mail'));
     Utils_RecordBrowserCommon::set_search('rc_mails', 2, -1);
     DB::CreateIndex('rc_mails_thread_idx', 'rc_mails_data_1', 'f_thread');
     DB::CreateIndex('rc_mails_msgid_idx', 'rc_mails_data_1', 'f_message_id');
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'mail_body_addon', _M('Body'));
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'attachments_addon', _M('Attachments'));
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'mail_headers_addon', _M('Headers'));
     @DB::DropTable('rc_mails_attachments');
     DB::CreateTable('rc_mails_attachments', '
         mail_id I4 NOTNULL,
         type C(32),
         name C(255),
         mime_id C(32),
         attachment I1 DEFAULT 1', array('constraints' => ', FOREIGN KEY (mail_id) REFERENCES rc_mails_data_1(ID)'));
     DB::CreateTable('rc_mails_attachments_download', '
         mail_id I4 NOTNULL,
         hash C(32),
         created_on T DEFTIMESTAMP', array('constraints' => ', FOREIGN KEY (mail_id) REFERENCES rc_mails_data_1(ID)'));
     Utils_RecordBrowserCommon::new_addon('contact', 'CRM/Roundcube', 'addon', _M('E-mails'));
     Utils_RecordBrowserCommon::new_addon('company', 'CRM/Roundcube', 'addon', _M('E-mails'));
     $fields = array(array('name' => _M('Record Type'), 'type' => 'hidden', 'param' => Utils_RecordBrowserCommon::actual_db_type('text', 64), 'required' => false, 'visible' => false, 'filter' => true, 'extra' => false), array('name' => _M('Record ID'), 'type' => 'hidden', 'param' => Utils_RecordBrowserCommon::actual_db_type('integer'), 'filter' => false, 'required' => false, 'extra' => false, 'visible' => false), array('name' => _M('Nickname'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_nickname')), array('name' => _M('Email'), 'type' => 'email', 'required' => true, 'param' => array('unique' => true), 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('rc_multiple_emails', $fields);
     Utils_RecordBrowserCommon::set_favorites('rc_multiple_emails', true);
     Utils_RecordBrowserCommon::set_caption('rc_multiple_emails', _M('Mail addresses'));
     Utils_RecordBrowserCommon::set_icon('rc_multiple_emails', Base_ThemeCommon::get_template_filename('CRM/Roundcube', 'icon.png'));
     Utils_RecordBrowserCommon::set_search('rc_multiple_emails', 2, 0);
     Utils_RecordBrowserCommon::new_addon('contact', 'CRM/Roundcube', 'mail_addresses_addon', _M('E-mail addresses'));
     Utils_RecordBrowserCommon::new_addon('company', 'CRM/Roundcube', 'mail_addresses_addon', _M('E-mail addresses'));
     Variable::set('crm_roundcube_global_signature', "Message sent with EPESI - managing business your way!<br /><a href=\"http://epe.si\">http://epe.si</a>");
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'view', 'ACCESS:employee', array('epesi_user' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'edit', 'ACCESS:employee', array(), array('epesi_user'));
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'delete', 'ACCESS:employee', array('epesi_user' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('rc_mails', 'view', 'ACCESS:employee', array(), array('headers_data'));
     Utils_RecordBrowserCommon::add_access('rc_mails', 'delete', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_mails', 'edit', 'ACCESS:employee', array(), array('subject', 'employee', 'date', 'headers_data', 'body', 'from', 'to', 'thread', 'message_id', 'references'));
     Utils_RecordBrowserCommon::add_access('rc_mail_threads', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_mail_threads', 'delete', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'edit', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'delete', 'ACCESS:employee');
     return true;
 }
Ejemplo n.º 22
0
 /**
  * If value is a string, this set will try to unserialize it
  * @param array|string $value
  */
 public function set($value)
 {
     if (!is_array($value) && is_string($value)) {
         if (preg_match('/^a:\\d{1,}:/', $value)) {
             $value = unserialize($value);
         }
     }
     parent::set($value);
 }
Ejemplo n.º 23
0
 public function install()
 {
     DB::CreateTable('base_lang_trans_contrib', 'id I4 AUTO KEY,' . 'user_id I4,' . 'allow I1,' . 'first_name C(64),' . 'last_name C(64),' . 'credits I1,' . 'credits_website C(128),' . 'contact_email C(128)', array());
     Base_ThemeCommon::install_default_theme($this->get_type());
     return Variable::set('allow_lang_change', true);
 }
Ejemplo n.º 24
0
 public static function set_no_ssl_allow($allow = true)
 {
     Variable::set('ess_no_ssl', $allow);
 }
Ejemplo n.º 25
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (Variable::get('utils_attachments_google_user', false) == '') {
    Variable::set('utils_attachments_google_user', '');
    Variable::set('utils_attachments_google_pass', '');
}
@DB::CreateTable('utils_attachment_googledocs', '
	id I4 AUTO KEY NOTNULL,
	note_id I4 NOTNULL,
	view_link C(255),
	doc_id C(128)', array('constraints' => ''));
Ejemplo n.º 26
0
 public function done($d)
 {
     @set_time_limit(0);
     if (count($this->ini) == 1) {
         $pkgs = reset($this->ini);
         $pkgs = $pkgs['package'];
     } else {
         $pkgs = isset($this->ini[$d[0]['setup_type']]['package']) ? $this->ini[$d[0]['setup_type']]['package'] : array();
     }
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': installing "Base" ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     if (!ModuleManager::install('Base', null, false)) {
         print 'Unable to install Base module pack.';
         return false;
     }
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': creating admin user ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     if (!Base_UserCommon::add_user($d['simple_user']['login'])) {
         print 'Unable to create user';
         return false;
     }
     $user_id = Base_UserCommon::get_user_id($d['simple_user']['login']);
     if ($user_id === false) {
         print 'Unable to get admin user id';
         return false;
     }
     if (!DB::Execute('INSERT INTO user_password(user_login_id,password,mail) VALUES(%d,%s, %s)', array($user_id, md5($d['simple_user']['pass']), $d['simple_user']['mail']))) {
         print 'Unable to set user password';
         return false;
     }
     if (!Base_UserCommon::change_admin($user_id, 2)) {
         print 'Unable to update admin account data (groups).';
         return false;
     }
     Acl::set_user($user_id, true);
     Variable::set('anonymous_setup', false);
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': setting mail server ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     $method = $d['simple_mail']['mail_method'];
     Variable::set('mail_method', $method);
     Variable::set('mail_from_addr', $d['simple_user']['mail']);
     Variable::set('mail_from_name', $d['simple_user']['login']);
     if ($method == 'smtp') {
         Variable::set('mail_host', $d['simple_mail_smtp']['mail_host']);
         if ($d['simple_mail_smtp']['mail_user'] !== '' && $d['simple_mail_smtp']['mail_user'] !== '') {
             $auth = true;
         } else {
             $auth = false;
         }
         Variable::set('mail_auth', $auth);
         if ($auth) {
             Variable::set('mail_user', $d['simple_mail_smtp']['mail_user']);
             Variable::set('mail_password', $d['simple_mail_smtp']['mail_password']);
         }
     }
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Installing modules ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     foreach ($pkgs as $p) {
         if (!is_dir('modules/' . $p)) {
             continue;
         }
         $t2 = microtime(true);
         error_log(' * ' . date('Y-m-d H:i:s') . ' - ' . $p . ' (', 3, DATA_DIR . '/firstrun.log');
         if (!ModuleManager::install(str_replace('/', '_', $p), null, false)) {
             print '<b>Unable to install ' . str_replace('_', '/', $p) . ' module.</b>';
         }
         error_log(microtime(true) - $t2 . "s)\n", 3, DATA_DIR . '/firstrun.log');
     }
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Refreshing cache of modules ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     ModuleManager::create_load_priority_array();
     Base_SetupCommon::refresh_available_modules();
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Creating cache of template files ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     Base_ThemeCommon::create_cache();
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Updating translation files ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     Base_LangCommon::update_translations();
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $processed = ModuleManager::get_processed_modules();
     $_SESSION['first-run_post-install'] = $processed['install'];
     location();
 }
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$keys = Variable::get('license_key', false);
if (is_array($keys) && array_key_exists("https://ess.epesibim.com/", $keys)) {
    $keys["https://ess.epe.si/"] = $keys["https://ess.epesibim.com/"];
    unset($keys["https://ess.epesibim.com/"]);
    Variable::set('license_key', $keys);
}
Ejemplo n.º 28
0
 /**
  * For internal use only.
  */
 public function submit_admin($data)
 {
     $method = $data['mail_method'];
     Variable::set('mail_method', $method);
     Variable::set('mail_from_addr', $data['mail_from_addr']);
     Variable::set('mail_from_name', $data['mail_from_name']);
     Variable::set('mail_use_replyto', $data['mail_use_replyto']);
     if ($method == 'smtp') {
         Variable::set('mail_host', $data['mail_host']);
         $auth = isset($data['mail_auth']) && $data['mail_auth'];
         Variable::set('mail_auth', $auth);
         if ($auth) {
             Variable::set('mail_user', $data['mail_user']);
             Variable::set('mail_password', $data['mail_password']);
         }
         $security = isset($data['mail_security']) ? $data['mail_security'] : '';
         Variable::set('mail_security', $security);
     }
     return true;
 }
Ejemplo n.º 29
0
	public function install() {
		$ret = true;
        Utils_RecordBrowserCommon::uninstall_recordset('utils_attachment');
        $fields = array(
            array(
                'name' => _M('Edited on'),
                'type' => 'timestamp',
                'extra'=>false,
                'visible'=>true,
                'required' => false,
                'display_callback'=>array('Utils_AttachmentCommon','display_date'),
                'QFfield_callback'=>array('Utils_AttachmentCommon','QFfield_date')
            ),
            array(
                'name' => _M('Title'),
                'type' => 'text',
                'param' => 255,
                'required' => false, 'extra' => false, 'visible' => false
            ),
            array('name' => _M('Note'),
                'type' => 'long text',
                'required' => false,
                'extra' => false,
                'visible'=>true,
                'display_callback'=>array('Utils_AttachmentCommon','display_note'),
                'QFfield_callback'=>array('Utils_AttachmentCommon','QFfield_note'),
            ),
            array('name' => _M('Permission'),
                'type' => 'commondata',
                'required' => true,
                'param' => array('order_by_key' => true, 'CRM/Access'),
                'extra' => false),
            array('name' => _M('Sticky'),
                'type' => 'checkbox',
                'visible' => true,
                'extra' => false),
            array('name' => _M('Crypted'),
                'type' => 'checkbox',
                'extra' => false,
                'QFfield_callback'=>array('Utils_AttachmentCommon','QFfield_crypted')),
            array('name' => _M('Attached to'),
                'type' => 'calculated',
                'extra' => false,
                'display_callback'=>array('Utils_AttachmentCommon','display_attached_to')),
        );
        Utils_RecordBrowserCommon::install_new_recordset('utils_attachment',$fields);
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'view', 'ACCESS:employee', array('(!permission'=>2, '|:Created_by'=>'USER_ID'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', 'ACCESS:employee', array(':Created_by'=>'USER_ID'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', array('ACCESS:employee','ACCESS:manager'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'add', 'ACCESS:employee',array(),array('edited_on'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'edit', 'ACCESS:employee', array('(permission'=>0, '|:Created_by'=>'USER_ID'),array('edited_on'));
        Utils_RecordBrowserCommon::register_processing_callback('utils_attachment',array('Utils_AttachmentCommon','submit_attachment'));
        Utils_RecordBrowserCommon::set_tpl('utils_attachment', Base_ThemeCommon::get_template_filename('Utils/Attachment', 'View_entry'));
        Utils_RecordBrowserCommon::enable_watchdog('utils_attachment', array('Utils_AttachmentCommon','watchdog_label'));
        Utils_RecordBrowserCommon::set_caption('utils_attachment', _M('Note'));
        Utils_RecordBrowserCommon::set_description_callback('utils_attachment', array('Utils_AttachmentCommon','description_callback'));
        Utils_RecordBrowserCommon::set_jump_to_id('utils_attachment', false);
        Utils_RecordBrowserCommon::set_search('utils_attachment',1,0);

        $ret &= DB::CreateTable('utils_attachment_local','
			local C(255) NOTNULL,
			attachment I4 NOTNULL,
			func C(255),
			args C(255)',
            array('constraints'=>', FOREIGN KEY (attachment) REFERENCES utils_attachment_data_1(ID)'));
        if(!$ret){
            print('Unable to create table utils_attachment_local.<br>');
            return false;
        }
        DB::CreateIndex('utils_attachment_local__idx', 'utils_attachment_local', 'local');

		$ret &= DB::CreateTable('utils_attachment_file','
			id I4 AUTO KEY NOTNULL,
			attach_id I4 NOTNULL,
			original C(255) NOTNULL,
			created_by I4,
			created_on T DEFTIMESTAMP,
			deleted I1 NOTNULL DEFAULT 0',
			array('constraints'=>', FOREIGN KEY (created_by) REFERENCES user_login(ID), FOREIGN KEY (attach_id) REFERENCES utils_attachment_data_1(id)'));
		if(!$ret){
			print('Unable to create table utils_attachment_file.<br>');
			return false;
		}
        DB::CreateIndex('attach_id_idx','utils_attachment_file','attach_id');
		$ret &= DB::CreateTable('utils_attachment_download','
			id I4 AUTO KEY NOTNULL,
			attach_file_id I4 NOTNULL,
			created_by I4,
			created_on T,
			expires_on T,
			remote I1 DEFAULT 0,
			download_on T DEFTIMESTAMP,
			ip_address C(32),
			host_name C(64),
			description C(128),
			token C(32)',
			array('constraints'=>', FOREIGN KEY (created_by) REFERENCES user_login(ID), FOREIGN KEY (attach_file_id) REFERENCES utils_attachment_file(id)'));
		if(!$ret){
			print('Unable to create table utils_attachment_download.<br>');
			return false;
		}
		$ret &= DB::CreateTable('utils_attachment_clipboard','
			id I4 AUTO KEY NOTNULL,
			filename C(255),
			created_by I4,
			created_on T DEFTIMESTAMP',
			array('constraints'=>''));

		$this->create_data_dir();
		file_put_contents($this->get_data_dir().'.htaccess','deny from all');
		Base_ThemeCommon::install_default_theme($this->get_type());
		
		DB::CreateTable('utils_attachment_googledocs','
			id I4 AUTO KEY NOTNULL,
			note_id I4 NOTNULL,
			view_link C(255),
			doc_id C(128)',
			array('constraints'=>''));
		
		Base_AclCommon::add_permission(_M('Attachments - view full download history'), array('ACCESS:employee'));

		Variable::set('utils_attachments_google_user', '');
		Variable::set('utils_attachments_google_pass', '');
		return $ret;
	}
Ejemplo n.º 30
0
 private function banning_form()
 {
     if (!Base_AdminCommon::get_access($this->get_type(), 'manage_ban')) {
         return;
     }
     $qf = $this->init_module(Libs_QuickForm::module_name(), null, 'ban');
     $qf->addElement('select', 'forbid_autologin', __('Forbid Remember Me'), array("0" => __('No'), "1" => __('Yes')), array('onChange' => $qf->get_submit_form_js()));
     $qf->addElement('select', 'bantype', __('Ban by'), array("0" => __('IP Address'), "1" => "User login from specific IP address"), array('onChange' => $qf->get_submit_form_js()));
     $qf->addElement('select', 'bantries', __('Number of failed logins to ban'), array(0 => __('Disable ban'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 10 => 10), array('onChange' => $qf->get_submit_form_js()));
     $qf->addElement('select', 'bantime', __('Ban time after  failed logins'), array(10 => __('10 seconds'), 30 => __('30 seconds'), 60 => __('1 minute'), 180 => __('3 minutes'), 300 => __('5 minutes'), 900 => __('15 minutes'), 1800 => __('30 minutes'), 3600 => __('1 hour'), 3600 * 6 => __('6 hours'), 3600 * 24 => __('1 day')), array('onChange' => $qf->get_submit_form_js()));
     $qf->setDefaults(array('forbid_autologin' => Variable::get('forbid_autologin', false), 'bantype' => Variable::get('host_ban_by_login', false), 'bantries' => Variable::get('host_ban_nr_of_tries'), 'bantime' => Variable::get('host_ban_time')));
     if ($qf->validate()) {
         $values = $qf->exportValues();
         Variable::set('forbid_autologin', $values['forbid_autologin']);
         Variable::set('host_ban_by_login', $values['bantype']);
         Variable::set('host_ban_nr_of_tries', $values['bantries']);
         Variable::set('host_ban_time', $values['bantime']);
     }
     if (Variable::get('host_ban_nr_of_tries') == 0) {
         $qf->getElement('bantime')->setAttribute('disabled', 'disabled');
     }
     $qf->display_as_row();
 }