Example #1
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;
 }
Example #2
0
 public static function check_sending_method($critical = false)
 {
     $msg = false;
     if (Variable::get('mail_method') != 'smtp' && HOSTING_MODE) {
         $msg = __('Mail server configuration error');
     }
     if ($msg) {
         Base_StatusBarCommon::message($msg, 'error');
     }
 }
Example #3
0
 public function validate_with_message($success = '', $failure = '')
 {
     $ret = $this->qf->validate();
     if ($this->qf->isSubmitted()) {
         if ($ret) {
             Base_StatusBarCommon::message($success);
         } else {
             Base_StatusBarCommon::message($failure, 'warning');
         }
     }
     return $ret;
 }
Example #4
0
 public static function change_admin($uid, $admin)
 {
     $c_admin = DB::GetOne('SELECT admin FROM user_login WHERE id=%d', array($uid));
     if ($c_admin == 2 && $admin != 2) {
         $admins = DB::GetOne('SELECT COUNT(id) FROM user_login WHERE admin=2');
         if ($admins <= 1) {
             Base_StatusBarCommon::message('Unable to lower access to the only Super Administrator', 'warning');
             return true;
         }
     }
     return DB::Execute('UPDATE user_login SET admin=%d WHERE id=%d', array($admin, $uid));
 }
Example #5
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');
	}
Example #6
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();
 }
Example #7
0
	public function get_jump_to_id_button() {
        $jump_to_id = DB::GetOne('SELECT jump_to_id FROM recordbrowser_table_properties WHERE tab=%s', array($this->tab));
        if (!$jump_to_id) {
            return '';
        }
		$link = Module::create_href_js(Utils_RecordBrowserCommon::get_record_href_array($this->tab, '__ID__'));
		if (isset($_REQUEST['__jump_to_RB_record'])) Base_StatusBarCommon::message(__('Record not found'), 'warning');
		$link = str_replace('__ID__', '\'+this.value+\'', $link);
		return ' <a '.Utils_TooltipCommon::open_tag_attrs(__('Jump to record by ID')).' href="javascript:void(0);" onclick="jump_to_record_id(\''.$this->tab.'\')"><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','jump_to.png').'"></a><input type="text" id="jump_to_record_input" style="display:none;width:50px;" onkeypress="if(event.keyCode==13)'.$link.'">';
	}
Example #8
0
 public function submit_settings($values)
 {
     $reload = false;
     foreach ($this->settings_fields as $k) {
         $v = isset($values[$k]) ? $values[$k] : 0;
         $x = explode(self::$sep, $k);
         if (count($x) != 2) {
             continue;
         }
         list($module_name, $module_part) = $x;
         //print($module_name.':'.$module_part.'=>'.$v.'<br>');
         if ($this->get_module_variable('admin_settings')) {
             Base_User_SettingsCommon::save_admin($module_name, $module_part, $v);
             continue;
         } else {
             Base_User_SettingsCommon::save($module_name, $module_part, $v);
         }
         //check reload
         $cmr = ModuleManager::call_common_methods('user_settings');
         //already cached output
         if (!$reload && isset($cmr[$module_name])) {
             $menu = $cmr[$module_name];
             if (!is_array($menu)) {
                 continue;
             }
             foreach ($menu as $vv) {
                 if (!is_array($vv)) {
                     continue;
                 }
                 foreach ($vv as $v) {
                     if ($v['type'] == 'group') {
                         foreach ($v['elems'] as $e) {
                             if ($e['name'] == $module_part && isset($e['reload']) && $e['reload'] != 0) {
                                 $reload = true;
                             }
                         }
                     } elseif ($v['name'] == $module_part) {
                         if (isset($v['reload']) && $v['reload'] != 0) {
                             $reload = true;
                         }
                     }
                     if ($reload) {
                         break;
                     }
                 }
             }
         }
     }
     Base_StatusBarCommon::message($reload ? __('Setting saved - reloading page') : __('Setting saved'));
     if ($reload) {
         eval_js('setTimeout(\'document.location=\\\'index.php\\\'\',\'1500\')', false);
     }
     return true;
 }
Example #9
0
 public function simple_install($modules)
 {
     if (DEMO_MODE) {
         Base_StatusBarCommon::message('Feature unavailable in DEMO', 'warning');
         return;
     }
     $module_dirs = $this->get_module_dirs();
     foreach ($modules as $k) {
         ob_start();
         $versions = array_keys($module_dirs[$k]);
         if (!ModuleManager::install($k, max($versions))) {
             $content = "<div class=\"important_notice\">" . ob_get_clean() . '</div>';
             print $content;
             $msg = __('Couldn\'t install the package.') . '<br>' . __('Review error at the top of the page');
             Base_StatusBarCommon::message($msg, 'error');
             return false;
         } else {
             ob_end_clean();
         }
     }
     Base_StatusBarCommon::message('Package installed.');
     $processed = ModuleManager::get_processed_modules();
     $this->set_module_variable('post-install', $processed['install']);
     return false;
 }
Example #10
0
 public function test_mail_config($email)
 {
     ob_start();
     $ret = Base_MailCommon::send($email, __('E-mail configuration test'), __('If you are reading this, it means that your e-mail server configuration at %s is working properly.', array(get_epesi_url())));
     $msg = ob_get_clean();
     if ($msg) {
         print '<span class="important_notice">' . $msg . '</span>';
     }
     if ($ret) {
         Base_StatusBarCommon::message(__('E-mail was sent successfully'));
     } else {
         Base_StatusBarCommon::message(__('An error has occured'), 'error');
     }
     return false;
 }
Example #11
0
    public static function discard_google_docs($note_id) {
        $edit_url = DB::GetOne('SELECT doc_id FROM utils_attachment_googledocs WHERE note_id = %d', array($note_id));
        DB::Execute('DELETE FROM utils_attachment_googledocs WHERE note_id = %d', array($note_id));
        $g_auth = Utils_AttachmentCommon::get_google_auth();
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

        $headers = array(
            "Authorization: GoogleLogin auth=" . $g_auth,
            "If-Match: *",
            "GData-Version: 3.0",
        );
        curl_setopt($curl, CURLOPT_URL, $edit_url);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($curl, CURLOPT_POST, false);
        $response = curl_exec($curl);
        Base_StatusBarCommon::message(__('Changes discarded'));
    }
Example #12
0
 public static function message($text, $type = 'normal')
 {
     self::$message = '<div class="message ' . $type . '">' . $text . '</div>';
 }