コード例 #1
0
ファイル: Administrator_0.php プロジェクト: cretzu89/EPESI
 public function admin()
 {
     if ($this->is_back()) {
         if ($this->parent->get_type() == 'Base_Admin') {
             $this->parent->reset();
         } else {
             location(array());
         }
         return;
     }
     $form = $this->init_module(Libs_QuickForm::module_name(), 'Changing template');
     $themes = Base_Theme::list_themes();
     $form->addElement('header', 'install_module_header', __('Themes Administration'));
     $form->addElement('select', 'theme', __('Choose template'), $themes);
     $form->addElement('static', null, '', '<br /><br />');
     $form->addElement('header', 'upload_theme_header', __('Upload template'));
     $form->setDefaults(array('theme' => Variable::get('default_theme')));
     if ($form->validate()) {
         $form->process(array(&$this, 'submit_admin'));
     } else {
         $form->display();
         if (class_exists('ZipArchive')) {
             $this->pack_module(Utils_FileUpload::module_name(), array(array($this, 'upload_template'), __('Upload template')));
             //				Base_ActionBarCommon::add('edit',__('Manage templates'),$this->create_callback_href(array($this,'download_template')));
         }
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
 }
コード例 #2
0
ファイル: soap.php プロジェクト: cretzu89/EPESI
 private function auth($user, $pass)
 {
     $error = '';
     $t = Variable::get('host_ban_time');
     if ($t > 0) {
         $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
         if ($fails >= 3) {
             $error = 'Host banned.';
         }
     }
     if ($error === '') {
         $ret = Base_User_LoginCommon::check_login($user, $pass);
         if (!$ret) {
             $error = 'Login failed.';
             if ($t > 0) {
                 DB::Execute('DELETE FROM user_login_ban WHERE failed_on<=%d', array(time() - $t));
                 DB::Execute('INSERT INTO user_login_ban(failed_on,from_addr) VALUES(%d,%s)', array(time(), $_SERVER['REMOTE_ADDR']));
                 $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
                 if ($fails >= 3) {
                     $error .= ' Host banned.';
                 }
             }
         } else {
             $uid = Base_UserCommon::get_user_id($user);
             Acl::set_user($uid, true);
         }
     }
     return $error;
 }
コード例 #3
0
ファイル: Router.class.php プロジェクト: lixinhan/JiongPHP
 public static function parseBaseUrl()
 {
     switch (Config::get("URL_MODEL")) {
         case 'NORMAL':
             $groupName = ucfirst(Variable::get(Config::get("GROUP_PARAM")));
             $controllerName = ucfirst(Variable::get(Config::get("CONTROLLER_PARAM")));
             $actionName = ucfirst(Variable::get(Config::get("ACTION_PARAM")));
             break;
         case 'PATH_INFO':
             $pathInfo = Variable::server("PATH_INFO");
             if (isset($pathInfo)) {
                 $pathInfo = ltrim($pathInfo, "/");
                 $urlInfo = explode("/", $pathInfo);
                 if (count($urlInfo) >= 3) {
                     foreach ($urlInfo as &$value) {
                         $value = ucfirst($value);
                     }
                     unset($value);
                     list($groupName, $controllerName, $actionName) = $urlInfo;
                 } else {
                     $groupName = isset($urlInfo[0]) ? ucfirst($urlInfo[0]) : "";
                     $controllerName = isset($urlInfo[1]) ? ucfirst($urlInfo[1]) : "";
                     $actionName = isset($urlInfo[2]) ? ucfirst($urlInfo[2]) : "";
                 }
                 break;
             } else {
                 break;
             }
         default:
     }
     define("GROUP_NAME", !empty($groupName) ? $groupName : Config::get("DEFAULT_GROUP"));
     define("CONTROLLER_NAME", !empty($controllerName) ? $controllerName : Config::get("DEFAULT_CONTROLLER"));
     define("ACTION_NAME", !empty($actionName) ? $actionName : Config::get("DEFAULT_ACTION"));
 }
コード例 #4
0
ファイル: version.php プロジェクト: cretzu89/EPESI
function epesi_requires_update()
{
    $ret = null;
    if (class_exists('Variable', false)) {
        $system_version = Variable::get('version');
        $ret = version_compare($system_version, EPESI_VERSION, '<');
    }
    return $ret;
}
コード例 #5
0
ファイル: epesi_init.php プロジェクト: cretzu89/EPESI
 public function add_signature($b)
 {
     $footer = Variable::get('crm_roundcube_global_signature', false);
     if ($b['type'] == 'plain') {
         $b['body'] .= "\r\n" . strip_tags(preg_replace('/<[bh]r\\s*\\/?>/i', "\r\n", $footer));
     } else {
         $b['body'] .= '<br />' . $footer;
     }
     return $b;
 }
コード例 #6
0
ファイル: AclCommon_0.php プロジェクト: cretzu89/EPESI
 /**
  * Returns whether currently logged in user is an administrator.
  * 
  * @return bool true if currently logged in user is an administrator
  */
 public static function i_am_admin()
 {
     static $ret, $user;
     $new_user = self::get_user();
     if (!isset($ret) || $new_user != $user) {
         $user = $new_user;
         $ret = Variable::get('anonymous_setup') || self::get_admin_level() >= 1;
     }
     return $ret;
 }
コード例 #7
0
ファイル: Mail_0.php プロジェクト: cretzu89/EPESI
 /**
  * For internal use only.
  */
 public function admin()
 {
     if ($this->is_back()) {
         $this->parent->reset();
         return;
     }
     $form = $this->init_module(Libs_QuickForm::module_name());
     //defaults
     $defaults = array();
     $defaults['mail_method'] = Variable::get('mail_method');
     $defaults['mail_use_replyto'] = Variable::get('mail_use_replyto');
     $defaults['mail_user'] = Variable::get('mail_user');
     $defaults['mail_from_addr'] = Variable::get('mail_from_addr');
     $defaults['mail_from_name'] = Variable::get('mail_from_name');
     $defaults['mail_host'] = Variable::get('mail_host');
     $defaults['mail_security'] = Variable::get('mail_security', false);
     $defaults['mail_auth'] = Variable::get('mail_auth');
     $defaults['mail_password'] = Variable::get('mail_password');
     $form->setDefaults($defaults);
     //form
     $form->addElement('header', null, __('Mail settings'));
     $form->addElement('select', 'mail_method', __('Choose method'), array('smtp' => __('remote smtp server'), 'mail' => __('local php.ini settings')), 'onChange="' . $form->get_submit_form_js(false) . '"');
     $form->addElement('text', 'mail_from_addr', __('Administrator e-mail address'));
     $form->addRule('mail_from_addr', __('Invalid e-mail address'), 'email');
     $form->addRule('mail_from_addr', __('Field required'), 'required');
     $form->addElement('text', 'mail_from_name', __('Send e-mails from name'));
     $form->addElement('text', 'mail_use_replyto', __('Set "Reply-To" email address'));
     $form->addRule('mail_use_replyto', __('Invalid e-mail address'), 'email');
     $method = $form->getElement('mail_method')->getSelected();
     if ($method[0] == 'smtp') {
         $form->addElement('text', 'mail_host', __('SMTP host address'));
         $form->addRule('mail_host', __('Field required'), 'required');
         $form->addElement('select', 'mail_security', __('Security'), array('' => __('None'), 'ssl' => 'SSL', 'ssl_ssc' => 'SSL (self signed certificate)', 'tls' => 'TLS', 'tls_ssc' => 'TLS (self signed certificate)'));
         $form->addElement('checkbox', 'mail_auth', __('SMTP authorization'), '', 'onChange="' . $form->get_submit_form_js(false) . '"');
         $auth = $form->getElement('mail_auth')->getValue();
         if ($auth) {
             $form->addElement('text', 'mail_user', __('Login'));
             $form->addElement('password', 'mail_password', __('Password'));
         }
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     if (ModuleManager::is_installed('CRM_Contacts') >= 0) {
         $me = CRM_ContactsCommon::get_my_record();
         $email = $me['email'];
         Base_ActionBarCommon::add('search', __('Test'), $this->create_callback_href(array($this, 'test_mail_config'), array($email)), __('E-mail will be sent to %s to test the configuration', array('<b>' . $email . '</b>')));
     }
     if ($form->getSubmitValue('submited') && $form->validate() && $form->process(array(&$this, 'submit_admin'))) {
         Base_StatusBarCommon::message(__('Settings saved'));
     }
     $form->display();
 }
コード例 #8
0
ファイル: ErrorCommon_0.php プロジェクト: 62BRAINS/EPESI
 public function update_observer($type, $message, $errfile, $errline, $errcontext, $backtrace)
 {
     $mail = Variable::get('error_mail');
     if ($mail) {
         $backtrace = htmlspecialchars_decode(str_replace(array('<br />', '&nbsp;'), array("\n", ' '), $backtrace));
         $x = "who=" . Base_AclCommon::get_user() . "\ntype=" . $type . "\nmessage=" . $message . "\nerror file=" . $errfile . "\nerror line=" . $errline . "\n" . $backtrace;
         $d = ModuleManager::get_data_dir('Base/Error') . md5($x) . '.txt';
         file_put_contents($d, $x);
         $url = get_epesi_url();
         Base_MailCommon::send($mail, 'Epesi Error - ' . $url, substr($x, 0, strpos($x, "error backtrace")) . "\n" . $url . '/' . $d, null, null, false, true);
     }
     return true;
 }
コード例 #9
0
ファイル: Attachment_0.php プロジェクト: 62BRAINS/EPESI
	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');
	}
コード例 #10
0
ファイル: FrontPageCommon_0.php プロジェクト: cretzu89/EPESI
 public static function display($header, $content, $info = false)
 {
     $l = Variable::get('logo_file', false);
     if (!$l) {
         $l = Base_ThemeCommon::get_template_file('images/logo-small.png');
     }
     $smarty = Base_ThemeCommon::init_smarty();
     $smarty->assign('header', $header);
     $smarty->assign('contents', $content);
     $smarty->assign('info', $info);
     $smarty->assign('footer', '');
     $smarty->assign('logo', $l);
     $smarty->assign('url', get_epesi_url());
     Base_ThemeCommon::display_smarty($smarty, 'Utils_FrontPage', 'default');
 }
コード例 #11
0
ファイル: Theme_0.php プロジェクト: 62BRAINS/EPESI
 private function load_image_cache()
 {
     if (isset($_SESSION['client']['image_cache'])) {
         return;
     }
     $_SESSION['client']['image_cache'] = true;
     $imgs = array();
     if (Variable::get('preload_image_cache_selected') && file_exists($this->get_data_dir() . 'templates/' . self::$theme . '/__cache.images')) {
         $imgs = explode("\n", file_get_contents($this->get_data_dir() . 'templates/' . self::$theme . '/__cache.images'));
     }
     if (Variable::get('preload_image_cache_default') && self::$theme != 'default' && file_exists($this->get_data_dir() . 'templates/' . 'default/__cache.images')) {
         $imgs = array_merge($imgs, explode("\n", file_get_contents($this->get_data_dir() . 'templates/' . 'default/__cache.images')));
     }
     if (!empty($imgs)) {
         eval_js("var cache = document.createElement('div');" . "cache.style.display='none';" . "document.body.appendChild(cache);" . "var current_image = null;" . "var cache_pause = false;" . "var images_list = Array('" . implode("','", $imgs) . "');" . "cache_images = function() {" . "if(!cache_pause && (current_image==null || current_image.complete)) {" . "current_image = document.createElement('img');" . "current_image.src = images_list.shift();" . "cache.appendChild(current_image);" . "}" . "if(images_list.length)" . "setTimeout('cache_images()',500);" . "};" . "cache_images();", false);
     }
 }
コード例 #12
0
ファイル: Roundcube_0.php プロジェクト: 62BRAINS/EPESI
 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();
 }
コード例 #13
0
 public static function user_settings($just_retrieve = false)
 {
     if (!Variable::get('allow_lang_change')) {
         return null;
     }
     if (DEMO_MODE && Base_UserCommon::get_my_user_login() == 'admin') {
         $langs = array('en' => 'en');
     } else {
         $langs = Base_LangCommon::get_installed_langs();
     }
     if ($just_retrieve) {
         $group = $label1 = $label2 = '';
     } else {
         $group = __('Regional Settings');
         $label1 = __('Language');
         $label2 = __('Language you want to use');
     }
     return array($group => array(array('type' => 'header', 'label' => $label1, 'name' => null), array('name' => 'language', 'label' => $label2, 'type' => 'select', 'values' => $langs, 'default' => Variable::get('default_lang'))));
 }
コード例 #14
0
ファイル: Error_0.php プロジェクト: 62BRAINS/EPESI
 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();
     }
 }
コード例 #15
0
ファイル: simple_login.php プロジェクト: cretzu89/EPESI
 static function form()
 {
     try {
         $anonymous = Variable::get('anonymous_setup');
     } catch (NoSuchVariableException $e) {
         $anonymous = true;
     }
     if (!Base_AclCommon::is_user() && Base_User_LoginCommon::is_banned()) {
         return self::t('You have exceeded the number of allowed login attempts.');
     }
     require_once 'modules/Libs/QuickForm/requires.php';
     if (!Base_AclCommon::is_user() && !$anonymous) {
         Base_User_LoginCommon::autologin();
     }
     if (!Base_AclCommon::is_user() && !$anonymous) {
         $get = count($_GET) ? '?' . http_build_query($_GET) : '';
         $form = new HTML_QuickForm('loginform', 'post', $_SERVER['PHP_SELF'] . $get);
         $form->setRequiredNote('<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;">' . self::t('denotes required field') . '</span>');
         $form->addElement('text', 'username', self::t('Username'));
         $form->addRule('username', 'Field required', 'required');
         $form->addElement('password', 'password', self::t('Password'));
         $form->addRule('password', 'Field required', 'required');
         // register and add a rule to check if user is banned
         $form->registerRule('check_user_banned', 'callback', 'rule_login_banned', 'Base_User_LoginCommon');
         $form->addRule('username', self::t('You have exceeded the number of allowed login attempts.'), 'check_user_banned');
         // register and add a rule to check if user and password exists
         $form->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon');
         $form->addRule(array('username', 'password'), self::t('Login or password incorrect'), 'check_login', $form);
         $form->addElement('submit', null, self::t('Login'));
         if ($form->validate()) {
             $user = $form->exportValue('username');
             Base_AclCommon::set_user(Base_UserCommon::get_user_id($user), true);
             // redirect below is used to better browser refresh behavior.
             header('Location: ' . $_SERVER['REQUEST_URI']);
         } else {
             return "<center>" . $form->toHtml() . "</center>";
         }
     }
 }
コード例 #16
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
Utils_CommonDataCommon::extend_array('Contacts/Access', array('employee' => _M('Employee')));
$cmp = Variable::get('main_company', null);
if ($cmp) {
    set_time_limit(0);
    $conts = DB::GetAll('SELECT * FROM contact_data_1 WHERE f_company_name=%d OR f_related_companies ' . DB::like() . ' ' . DB::Concat(DB::qstr('\\_\\_'), DB::qstr($cmp), DB::qstr('\\_\\_')), array($cmp));
    foreach ($conts as $k => $v) {
        $v['access'] = Utils_RecordBrowserCommon::decode_multi($v['f_access']);
        $v['access'][] = 'employee';
        Utils_RecordBrowserCommon::update_record('contact', $v['id'], array('access' => $v['access']));
    }
    Variable::delete('main_company', false);
}
$tab = DB::GetAssoc('SELECT tab, tab FROM recordbrowser_table_properties');
foreach ($tab as $t) {
    DB::Execute('UPDATE ' . $t . '_access_clearance SET clearance=%s WHERE clearance=%s', array('ACCESS:employee', 'EMPLOYEE'));
}
コード例 #17
0
ファイル: update.php プロジェクト: 62BRAINS/EPESI
    protected function load_epesi()
    {
        $this->CLI = (php_sapi_name() == 'cli');
        if ($this->CLI) {
            // allow to define DATA directory for CLI in argument
            if(isset($argv)) {
                define('EPESI_DIR','/');
                if (isset($argv[1])) {
                    define('DATA_DIR', $argv[1]);
                }
            }
        }

        define('CID', false);
        require_once('include.php');
        ModuleManager::load_modules();
        Base_LangCommon::load();

        $this->system_version = Variable::get('version');
        $this->current_version = EPESI_VERSION;
    }
コード例 #18
0
ファイル: LangCommon_0.php プロジェクト: cretzu89/EPESI
 public static function get_lang_code()
 {
     if (defined('FORCE_LANG_CODE')) {
         return FORCE_LANG_CODE;
     }
     if (!isset(self::$lang_code)) {
         if (!Base_AclCommon::is_user() || Base_User_SettingsInstall::is_installed() == false || !Variable::get('allow_lang_change', false)) {
             return Variable::get('default_lang');
         }
         if (class_exists('Base_User_SettingsCommon')) {
             self::$lang_code = Base_User_SettingsCommon::get('Base_Lang_Administrator', 'language');
         }
     }
     return self::$lang_code;
 }
コード例 #19
0
ファイル: MailCommon_0.php プロジェクト: cretzu89/EPESI
 /**
  * Sends an email.
  * 
  * Server settings are stored in epesi variables
  * and can be changed by administrator.
  * 
  * @param string recipent
  * @param string subject
  * @param string email message
  * @param string sender
  * @param string sender's name
  * @return true on success, false otherwise
  */
 public static function send($to, $subject, $body, $from_addr = null, $from_name = null, $html = false, $critical = false, $inline_images = array())
 {
     $mailer = self::new_mailer();
     $mail_use_replyto = Variable::get('mail_use_replyto');
     if (!isset($from_name)) {
         $from_name = Variable::get('mail_from_name');
     }
     if (!isset($from_addr)) {
         $from_addr = Variable::get('mail_from_addr');
         if ($mail_use_replyto && strpos($mail_use_replyto, '@') !== false) {
             $mailer->AddReplyTo($mail_use_replyto, $from_name);
         }
         $mailer->SetFrom($from_addr, $from_name);
     } else {
         $mailer->AddReplyTo($from_addr, $from_name);
         $from_addr = Variable::get('mail_from_addr');
         $mailer->SetFrom($from_addr);
     }
     if (Variable::get('mail_method') == 'smtp') {
         $mailer->IsSMTP();
         $h = explode(':', Variable::get('mail_host'));
         if (count($h) > 1) {
             $mailer->Port = array_pop($h);
         }
         $mailer->Host = implode(':', $h);
         $mailer->Username = Variable::get('mail_user');
         $mailer->Password = Variable::get('mail_password');
         $mailer->SMTPAuth = Variable::get('mail_auth');
         $security = Variable::get('mail_security', false);
         if ($security && preg_match('/^(ssl|tls)\\_ssc$/', $security, $matches)) {
             $security = $matches[1];
             $mailer->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
         }
         $mailer->SMTPSecure = $security;
     } elseif (HOSTING_MODE) {
         if (!$critical) {
             return false;
         }
     }
     if (is_array($to)) {
         foreach ($to as $m) {
             $mailer->AddAddress($m);
         }
     } else {
         $mailer->AddAddress($to);
     }
     $mailer->Subject = $subject;
     if ($html) {
         $mailer->MsgHTML($body);
     } else {
         $mailer->WordWrap = 75;
         $mailer->Body = $body;
     }
     foreach ($inline_images as $cid => $a) {
         $mailer->AddEmbeddedImage($a, $cid, basename($a), 'base64', 'image/' . (preg_match('/\\.je?pg$/i', $a) ? 'jpeg' : (preg_match('/\\.png$/i', $a) ? 'png' : 'gif')));
     }
     $mailer->CharSet = "utf-8";
     $ret = $mailer->Send();
     //		if(!$ret) print($mailer->ErrorInfo.'<br>');
     $mailer->ClearAddresses();
     return $ret;
 }
コード例 #20
0
ファイル: RB_permissions2.php プロジェクト: cretzu89/EPESI
    Utils_RecordBrowserCommon::add_access('cades_incidents', 'view', 'ALL', array($field . '[view]' => 'USER'), array('employees', 'notes', 'description', 'witness', 'notified_party', 'action_taken'));
    Utils_RecordBrowserCommon::add_access('cades_incidents', 'edit', 'ALL', array($field . '[edit]' => 'USER'), array($field));
    Utils_RecordBrowserCommon::add_access('cades_incidents', 'add', 'ALL', array('(' . $field => '', '|' . $field . '[add]' => 'USER'));
    Utils_RecordBrowserCommon::add_access('cades_incidents', 'delete', 'ALL', array($field . '[delete]' => 'USER'));
    Utils_RecordBrowserCommon::add_default_access('cades_billing_authorization');
    Utils_RecordBrowserCommon::add_default_access('cades_billing_auth_used');
    Utils_RecordBrowserCommon::add_default_access('premium_schoolregister_att_except');
    Utils_RecordBrowserCommon::add_default_access('cades_billing_auth_rejected');
    Utils_RecordBrowserCommon::add_default_access('cades_billing_auth_bill');
    DB::CreateIndex('prem_school_reg__idx_1', 'premium_schoolregister_lesson_data_1', 'f_date');
    DB::CreateIndex('prem_school_reg__idx_2', 'premium_schoolregister_lesson_data_1', 'f_course');
    DB::CreateIndex('prem_school_reg__idx_3', 'premium_schoolregister_lesson_data_1', 'f_custom_course');
    DB::Execute('UPDATE contact_data_1 SET f_company_name=1, f_related_companies=NULL WHERE f_related_companies=%s AND f_company_name IS NULL', array('__1__'));
}
if (ModuleManager::is_installed('Premium_Warehouse_eCommerce') >= 0) {
    DB::Execute('UPDATE premium_ecommerce_products_field SET type=%s WHERE field=%s OR field=%s', array(Variable::get('ecommerce_item_descriptions') ? 'calculated' : 'hidden', 'Product Name', 'Description'));
    foreach (array('premium_ecommerce_products', 'premium_ecommerce_parameters', 'premium_ecommerce_parameter_groups', 'premium_ecommerce_pages', 'premium_ecommerce_polls', 'premium_ecommerce_boxes', 'premium_ecommerce_3rdp_info') as $t) {
        DB::Execute('UPDATE ' . $t . '_field SET type=%s WHERE field=%s', array('hidden', 'Position'));
    }
}
if (ModuleManager::is_installed('Premium_Warehouse_Items') >= 0) {
    DB::Execute('UPDATE premium_warehouse_items_categories_field SET type=%s WHERE field=%s', array('hidden', 'Position'));
}
if (ModuleManager::is_installed('Premium_Warehouse_Items_Orders') >= 0) {
    Utils_RecordBrowserCommon::field_deny_access('premium_warehouse_items', 'Quantity on Hand', 'edit');
}
Utils_RecordBrowserCommon::add_access('premium_warehouse_items_orders', 'view', 'ACCESS:employee');
Utils_RecordBrowserCommon::add_access('premium_warehouse_items_orders', 'view', 'ALL', array('contact' => 'USER'));
Utils_RecordBrowserCommon::add_access('premium_warehouse_items_orders', 'view', array('ALL', 'ACCESS:manager'), array('company' => 'USER_COMPANY'));
Utils_RecordBrowserCommon::add_access('premium_warehouse_items_orders', 'add', 'ACCESS:employee', array(), array('transaction_type'));
Utils_RecordBrowserCommon::add_access('premium_warehouse_items_orders', 'edit', 'ACCESS:employee', array('employee' => 'USER', '(>=transaction_date' => '-1 week', '|<status' => 20), array('transaction_type', 'warehouse'));
コード例 #21
0
ファイル: EpesiStoreCommon_0.php プロジェクト: cretzu89/EPESI
 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'];
 }
コード例 #22
0
ファイル: LoginCommon_0.php プロジェクト: cretzu89/EPESI
 public static function mobile_login()
 {
     $t = Variable::get('host_ban_time');
     if ($t > 0) {
         $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, get_client_ip_address()));
         if ($fails >= 3) {
             print __('You have exceeded the number of allowed login attempts.') . '<br>';
             print '<a href="' . get_epesi_url() . '">' . __('Host banned. Click here to refresh.') . '</a>';
             return;
         }
     }
     $qf = new HTML_QuickForm('login', 'post', 'mobile.php?' . http_build_query($_GET));
     $qf->addElement('text', 'username', __('Login'));
     $qf->addElement('password', 'password', __('Password'));
     $qf->addElement('submit', 'submit_button', __('Login'));
     $qf->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon');
     $qf->addRule(array('username', 'password'), __('Login or password incorrect'), 'check_login');
     $qf->addRule('username', __('Field required'), 'required');
     $qf->addRule('password', __('Field required'), 'required');
     if ($qf->validate()) {
         self::set_logged($qf->exportValue('username'));
         self::new_autologin_id();
         return false;
     }
     $qf->display();
 }
コード例 #23
0
ファイル: module_manager.php プロジェクト: cretzu89/EPESI
 /**
  * Creates root(first) module instance.
  *
  * Do not use directly.
  */
 public static function create_root()
 {
     ob_start();
     try {
         $default_module = Variable::get('default_module');
         self::$root = ModuleManager::new_instance($default_module, null, '0');
     } catch (Exception $e) {
         self::$root = ModuleManager::new_instance(FIRST_RUN, null, '0');
     }
     $ret = trim(ob_get_contents());
     if (strlen($ret) > 0 || self::$root == null) {
         trigger_error($ret, E_USER_ERROR);
     }
     ob_end_clean();
     return self::$root;
 }
コード例 #24
0
ファイル: Administrator_0.php プロジェクト: 62BRAINS/EPESI
 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);
 }
コード例 #25
0
 public function login_logo()
 {
     $t = $this->pack_module('Base/Theme');
     $l = Variable::get('login_logo_file');
     if ($l && file_exists($l)) {
         $l .= '?' . filemtime($l);
     }
     $t->assign('logo', $l);
     $t->display('login-logo');
 }
コード例 #26
0
<?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);
}
コード例 #27
0
ファイル: AttachmentCommon_0.php プロジェクト: 62BRAINS/EPESI
    public static function get_file_leightbox($row, & $view_link = '') {
        static $th;
        if(!isset($th)) $th = Base_ThemeCommon::init_smarty();

        if($row['original']==='') return '';

        $links = array();

        $lid = 'get_file_'.md5(serialize($row));
        if(isset($_GET['save_google_docs']) && $_GET['save_google_docs']==$lid) {
            self::save_google_docs($row['id']);
        }
        if(isset($_GET['discard_google_docs']) && $_GET['discard_google_docs']==$lid) {
            self::discard_google_docs($row['id']);
        }

        $close_leightbox_js = 'leightbox_deactivate(\''.$lid.'\');';
        if (Variable::get('utils_attachments_google_user',false) && preg_match('/\.(xlsx?|docx?|txt|odt|ods|csv)$/i',$row['original'])) {
            $label = __('Open with Google Docs');
            $label = explode(' ', $label);
            $mid = floor(count($label) / 2);
            $label = implode('&nbsp;', array_slice($label, 0, $mid)).' '.implode('&nbsp;', array_slice($label, $mid));
            $script = 'get_google_docs';
            $onclick = '$(\'attachment_save_options_'.$row['id'].'\').style.display=\'\';$(\'attachment_download_options_'.$row['id'].'\').hide();';
            $th->assign('save_options_id','attachment_save_options_'.$row['id']);
            $links['save'] = '<a href="javascript:void(0);" onclick="'.$close_leightbox_js.Module::create_href_js(array('save_google_docs'=>$lid)).'">'.__('Save Changes').'</a><br>';
            $links['discard'] ='<a href="javascript:void(0);" onclick="'.$close_leightbox_js.Module::create_href_js(array('discard_google_docs'=>$lid)).'">'.__('Discard Changes').'</a><br>';
        } else {
            $label = __('View');
            $th->assign('save_options_id','');
            $script = 'get';
            $onclick = $close_leightbox_js;
        }
        $th->assign('download_options_id','attachment_download_options_'.$row['id']);

        $view_link = 'modules/Utils/Attachment/'.$script.'.php?'.http_build_query(array('id'=>$row['id'],'cid'=>CID,'view'=>1));
        $links['view'] = '<a href="'.$view_link.'" target="_blank" onClick="'.$onclick.'">'.$label.'</a><br>';
        $links['download'] = '<a href="modules/Utils/Attachment/get.php?'.http_build_query(array('id'=>$row['id'],'cid'=>CID)).'" onClick="leightbox_deactivate(\''.$lid.'\')">'.__('Download').'</a><br>';

        load_js('modules/Utils/Attachment/remote.js');
        if(!$row['crypted']) {
            $links['link'] = '<a href="javascript:void(0)" onClick="utils_attachment_get_link('.$row['id'].', '.CID.',\'get link\');leightbox_deactivate(\''.$lid.'\')">'.__('Get link').'</a><br>';
        }
        $th->assign('filename',$row['original']);
        $f_filename = DATA_DIR.'/Utils_Attachment/'.$row['aid'].'/'.$row['id'];
        if(!file_exists($f_filename)) return 'missing file: '.$f_filename;
        $th->assign('file_size',__('File size: %s',array(filesize_hr($f_filename))));

        $th->assign('labels',array(
            'filename'=>__('Filename'),
            'file_size'=>__('File size')
        ));

        foreach($links as $key=>&$l) {
            $th->assign($key,$l);
            $l = Base_ThemeCommon::parse_links($key, $l);
        }
        $th->assign('__link',$links);

        $custom_getters = array();
        if(!$row['crypted']) {
            $getters = ModuleManager::call_common_methods('attachment_getters');
            foreach($getters as $mod=>$arr) {
                if (is_array($arr))
                    foreach($arr as $caption=>$func) {
                        $cus_id = md5($mod.$caption.serialize($func));
                        if(isset($_GET['utils_attachment_custom_getter']) && $_GET['utils_attachment_custom_getter']==$cus_id)
                            call_user_func_array(array($mod.'Common',$func['func']),array($f_filename,$row['original'],$row['id']));
                        $custom_getters[] = array('open'=>'<a href="javascript:void(0)" onClick="'.Epesi::escapeJS(Module::create_href_js(array('utils_attachment_custom_getter'=>$cus_id)),true,false).';leightbox_deactivate(\''.$lid.'\')">','close'=>'</a>','text'=>$caption,'icon'=>$func['icon']);
                    }
            }
        }
        $th->assign('custom_getters',$custom_getters);

        ob_start();
        Base_ThemeCommon::display_smarty($th,'Utils_Attachment','download');
        $c = ob_get_clean();

        Libs_LeightboxCommon::display($lid,$c,__('Attachment'));
        return Libs_LeightboxCommon::get_open_href($lid);
    }
コード例 #28
0
ファイル: update.php プロジェクト: cretzu89/EPESI
 protected function load_epesi()
 {
     $this->CLI = php_sapi_name() == 'cli';
     if ($this->CLI) {
         global $argv;
         // allow to define DATA directory for CLI in argument
         if (isset($argv)) {
             define('EPESI_DIR', '/');
             foreach (array_slice($argv, 1) as $x) {
                 if ($x == '-f') {
                     $this->cli_force_update = true;
                 } elseif ($x == '-b') {
                     $this->cli_create_backup = true;
                 } else {
                     define('DATA_DIR', $x);
                 }
             }
         }
     }
     define('CID', false);
     require_once 'include.php';
     require_once 'include/backups.php';
     ModuleManager::load_modules();
     Base_LangCommon::load();
     $this->system_version = Variable::get('version');
     $this->current_version = EPESI_VERSION;
     $this->current_revision = EPESI_REVISION;
 }
コード例 #29
0
ファイル: EssClientCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function is_no_ssl_allowed()
 {
     return Variable::get('ess_no_ssl', false);
 }
コード例 #30
0
ファイル: ThemeCommon_0.php プロジェクト: 62BRAINS/EPESI
 /**
  * For internal use only.
  */
 public static function create_cache()
 {
     //css
     $themes_dir = DATA_DIR . '/Base_Theme/templates/';
     $def_theme = Variable::get('default_theme');
     $tdir = $themes_dir . $def_theme . '/';
     copy('modules/Base/Theme/css.php', $themes_dir . 'default/__css.php');
     if ($def_theme != 'default') {
         copy('modules/Base/Theme/css.php', $tdir . '/__css.php');
     }
     //images
     self::create_images_cache();
 }