public static function menu() { if (!Acl::is_user() || !Base_AclCommon::check_permission('Fax - Browse')) { return array(); } return array(_M('CRM') => array('__submenu__' => 1, _M('Fax') => array())); }
public static function user_settings() { if (Acl::is_user()) { return array(__('Calendar') => array(array('name' => 'first_day_of_week', 'label' => __('First day of week'), 'type' => 'select', 'values' => array(0 => __('Sunday'), 1 => __('Monday'), 2 => __('Tuesday'), 3 => __('Wednesday'), 4 => __('Thursday'), 5 => __('Friday'), 6 => __('Saturday')), 'default' => 0))); } return array(); }
public static function user_settings() { if (Acl::is_user()) { $methods = array('none' => __('None'), 'callto' => __('Skype and other "callto" protocol applications')) + ModuleManager::call_common_methods('dialer_description'); return array(__('Dialing') => array(array('name' => 'method', 'label' => __('Dialing Method'), 'type' => 'select', 'values' => $methods, 'default' => 'none')), __('Misc') => array(array('name' => 'default_record_permission', 'label' => __('Default Records Permission'), 'type' => 'select', 'default' => 0, 'values' => Utils_CommonDataCommon::get_translated_array('CRM/Access', false)))); } return array(); }
public static function user_settings() { if (Acl::is_user()) { $info = '%D - ' . __('Date') . '<br>%T - ' . __('Time') . '<br>%U - ' . __('User'); $help = ' <img src="' . Base_ThemeCommon::get_icon('info') . '" ' . Utils_TooltipCommon::open_tag_attrs($info, false) . '/>'; return array(__('Notes') => array(array('name' => 'editor', 'label' => __('Editor'), 'type' => 'select', 'default' => 0, 'values' => array(__('Simple'), __('Advanced'))), array('name' => 'edited_on_format', 'label' => __('Edited on format') . $help, 'type' => 'text', 'default' => '%D<br><br>%T<br><br>%U'))); } return array(); }
public static function init() { if ((!isset($_SESSION['base_login_audit']) || !isset($_SESSION['base_login_audit_user']) || $_SESSION['base_login_audit_user'] != Acl::get_user()) && Acl::is_user()) { $now = time(); $remote_address = get_client_ip_address(); $remote_host = gethostbyaddr($remote_address); DB::Execute('INSERT INTO base_login_audit(user_login_id,start_time,end_time,ip_address,host_name) VALUES(%d,%T,%T,%s,%s)', array(Acl::get_user(), $now, $now, $remote_address, $remote_host)); $_SESSION['base_login_audit'] = DB::Insert_ID('base_login_audit', 'id'); $_SESSION['base_login_audit_user'] = Acl::get_user(); } }
public static function user_settings() { self::get_options(); $ret_opts = array(); foreach (self::$options as $opt) { unset($opt['link']); $name = $opt['name']; unset($opt['name']); $opt = array_merge($opt, array('type' => 'bool', 'reload' => true, 'default' => 0)); $ret_opts[] = array('type' => 'group', 'label' => $opt['label'], 'elems' => array(array_merge($opt, array('values' => '', 'name' => $name . '_m')), array_merge($opt, array('values' => '', 'name' => $name . '_d')), array_merge($opt, array('values' => __('Menu') . ' • ' . __('Dashboard') . ' • ' . __('Launchpad'), 'name' => $name . '_l')))); } //trigger_error(print_r($ret_opts,true)); if (Acl::is_user()) { return array(__('Quick Access') => $ret_opts); } return array(); }
<?php /** * Popup message to the user * @author pbukowski@telaxus.com * @copyright pbukowski@telaxus.com * @license MIT * @version 1.0 * @package epesi-Utils * @subpackage Messenger */ header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // date in the past define('CID', false); //define('READ_ONLY_SESSION',true); require_once '../../../include.php'; ModuleManager::load_modules(); if (!Acl::is_user() || !isset($_REQUEST['id'])) { return; } Utils_MessengerCommon::turn_off($_REQUEST['id']); //DB::Execute('UPDATE utils_messenger_users SET done=1,done_on=%T WHERE user_login_id=%d AND message_id=%d',array(time(),Acl::get_user(),$_REQUEST['id']));
public static function get_lang_code() { if (defined('FORCE_LANG_CODE')) { return FORCE_LANG_CODE; } if (!isset(self::$lang_code)) { if (!Acl::is_user() || ModuleManager::is_installed('Base/User/Settings') == -1 || !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; }
public static function mobile_menu() { if (Acl::is_user()) { return array(__('Logout') => array('func' => 'logout', 'weight' => 100)); } return array(__('Login') => 'mobile_login'); }
public static function body_access() { return Acl::is_user(); }
$def = array('default' => __('default server time (%s minutes)', array($time / 60))); if ($time < 1800) { $def['1800'] = __('30 minutes'); } if ($time < 3600) { $def['3600'] = __('1 hour'); } if ($time < 7200) { $def['7200'] = __('2 hours'); } if ($time < 14400) { $def['14400'] = __('4 hours'); } if ($time < 28800) { $def['28800'] = __('8 hours'); } return array(__('Misc') => array(array('name' => 'time', 'label' => __('Keep session at least'), 'type' => 'select', 'values' => $def, 'default' => 28800, 'reload' => true))); } } load_js('modules/Tools/SessionKeeper/sk.js'); $sys_time = ini_get("session.gc_maxlifetime"); $interval = $sys_time / 3; if (Acl::is_user()) { $time = Base_User_SettingsCommon::get('Tools/SessionKeeper', 'time'); if ($time == 'default') { $time = $sys_time; } eval_js_once('SessionKeeper.maxtime=' . $time . ';' . 'SessionKeeper.interval=' . $interval . ';' . 'SessionKeeper.load()'); } else { eval_js_once('SessionKeeper.maxtime=201600;' . 'SessionKeeper.interval=' . $interval . ';' . 'SessionKeeper.load()'); }
public static function post_install_process($val) { $comp_id = Utils_RecordBrowserCommon::new_record('company', array('company_name' => $val['cname'], 'short_name' => isset($val['sname']) ? $val['sname'] : '', 'address_1' => isset($val['address1']) ? $val['address1'] : '', 'address_2' => isset($val['address2']) ? $val['address2'] : '', 'country' => isset($val['country']) ? $val['country'] : '', 'zone' => isset($val['state']) ? $val['state'] : '', 'city' => isset($val['city']) ? $val['city'] : '', 'postal_code' => isset($val['postal']) ? $val['postal'] : '', 'phone' => isset($val['phone']) ? $val['phone'] : '', 'fax' => isset($val['fax']) ? $val['fax'] : '', 'permission' => '0', 'web_address' => isset($val['web']) ? $val['web'] : '', 'group' => array('other'))); if (Acl::is_user()) { $mail = DB::GetOne('SELECT up.mail FROM user_password up WHERE up.user_login_id=%d', array(Acl::get_user())); Utils_RecordBrowserCommon::new_record('contact', array('first_name' => $val['fname'], 'last_name' => $val['lname'], 'address_1' => isset($val['address1']) ? $val['address1'] : '', 'address_2' => isset($val['address2']) ? $val['address2'] : '', 'country' => isset($val['country']) ? $val['country'] : '', 'zone' => isset($val['state']) ? $val['state'] : '', 'city' => isset($val['city']) ? $val['city'] : '', 'postal_code' => isset($val['postal']) ? $val['postal'] : '', 'work_phone' => isset($val['phone']) ? $val['phone'] : '', 'fax' => isset($val['fax']) ? $val['fax'] : '', 'web_address' => isset($val['web']) ? $val['web'] : '', 'company_name' => $comp_id, 'login' => Acl::get_user(), 'permission' => '0', 'email' => $mail, 'group' => array('office', 'field'))); } }
public function main_page() { if (!Acl::is_user()) { print 'Log in to change your settings.'; } $modules = array(); $admin_settings = $this->get_module_variable('admin_settings'); $us = ModuleManager::call_common_methods('user_settings'); foreach ($us as $name => $menu) { if (!is_array($menu)) { continue; } foreach ($menu as $k => $v) { $display = false; if (is_array($v)) { foreach ($v as $k2 => $m2) { if (isset($m2['type']) && $m2['type'] != 'hidden') { $display = true; break; } if ($display) { break; } } } else { $display = true; } if (!$display) { continue; } if (isset($modules[$k])) { if (!is_string($v) && !isset($modules[$k]['external'])) { $modules[$k]['module_names'][] = $name; } else { trigger_error('You cannot override this key: ' . $k, E_USER_ERROR); } } else { if (!is_string($v)) { $modules[$k] = array('action' => $this->create_unique_href(array('settings_branch' => $k)), 'module_names' => array($name)); } elseif (!$admin_settings) { $modules[$k] = array('action' => $this->create_main_href($name, $v), 'module_names' => array($name), 'external' => true); } } } } ksort($modules); $buttons = array(); foreach ($modules as $caption => $arg) { $icon = null; sort($arg['module_names']); foreach ($arg['module_names'] as $m) { $f = array($m . 'Common', 'user_settings_icon'); if (is_callable($f)) { $ret = call_user_func($f); if (is_array($ret)) { if (isset($ret[$caption])) { $icon = $ret[$caption]; break; } } elseif (is_string($ret)) { $icon = $ret; break; } } } if (!$icon) { foreach ($arg['module_names'] as $m) { $new = Base_ThemeCommon::get_template_file($m, 'icon.png'); if ($new) { $icon = $new; } } } $buttons[] = array('link' => '<a ' . $arg['action'] . '>' . $caption . '</a>', 'module' => $arg['module_names'], 'icon' => $icon); } $theme = $this->pack_module('Base/Theme'); $theme->assign('header', __('User Settings')); $theme->assign('buttons', $buttons); $theme->display(); }
/** * Returns user setting. * If user is logged in, returns user prefered setting, * otherwise returns default value. * * @param string module name * @param string variable name * @return mixed user value */ public static function get($module, $name, $user = null) { if (!Acl::is_user()) { return null; } if (!is_numeric($user) && $user !== null) { return null; } if ($user === null) { $user = Acl::get_user(); } $module = str_replace('/', '_', $module); if (!isset(self::$user_variables[$user])) { self::$user_variables[$user] = array(); $ret = DB::Execute('SELECT variable, value, module FROM base_user_settings WHERE user_login_id=%d', array($user)); while ($row = $ret->FetchRow()) { $val = @unserialize($row['value']); if ($val !== false || $val === serialize(false)) { self::$user_variables[$user][$row['module']][$row['variable']] = $val; } } } if (isset(self::$user_variables[$user][$module][$name])) { return self::$user_variables[$user][$module][$name]; } return self::$user_variables[$user][$module][$name] = self::get_admin($module, $name); }
public static function mobile_menu() { if (!Acl::is_user()) { return array(); } return array(__('Tray') => array('func' => 'mobile_tray', 'color' => 'blue')); }
} public static function get_my_user_login() { static $x; if (!isset($x)) { if (Acl::is_user()) { $x = self::get_user_login(Acl::get_user()); } else { $x = false; } } return $x;
public static function set_tz() { if (Acl::is_user()) { self::$curr_tz = date_default_timezone_get(); date_default_timezone_set(Base_User_SettingsCommon::get('Base_RegionalSettings', 'tz')); } }
<?php /** * @author Arkadiusz Bisaga <*****@*****.**> * @copyright Copyright © 2008, Telaxus LLC * @license Commercial * @version 1.0 * @package epesi-utils * @subpackage recordbrowser */ if (!isset($_POST['tab']) || !isset($_POST['value']) || !isset($_POST['cid'])) die('Invalid request: '.print_r($_POST,true)); define('JS_OUTPUT',1); define('CID',$_POST['cid']); define('READ_ONLY_SESSION',true); require_once('../../../include.php'); ModuleManager::load_modules(); if (!Acl::is_user()) die(''); $tab = json_decode($_POST['tab']); $value = json_decode($_POST['value']); if (!is_numeric($value) || !is_string($tab)) die('Invalid request'); Base_User_SettingsCommon::save('Utils/RecordBrowser',$tab.'_show_filters', $value); ?>
public function body($tpl = null) { //check bans if (!Acl::is_user() && Base_User_LoginCommon::is_banned()) { 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; } //if logged $this->theme->assign('is_logged_in', Acl::is_user()); $this->theme->assign('is_demo', DEMO_MODE); if (SUGGEST_DONATION) { $this->theme->assign('donation_note', __('If you find our software useful, please support us by making a %s.', array('<a href="http://epe.si/cost" target="_blank">' . __('donation') . '</a>')) . '<br>' . __('Your funding will help to ensure continued development of this project.')); } if (Acl::is_user()) { if ($this->get_unique_href_variable('logout')) { Base_User_LoginCommon::logout(); eval_js('document.location=\'index.php\';', false); } else { $this->theme->assign('logged_as', '<div class="logged_as">' . __('Logged as %s', array('</br><b class="green">' . Base_UserCommon::get_my_user_login() . '</b>')) . '</div>'); $this->theme->assign('logout', '<div class="logout_css3_box"><a class="logout_icon" ' . $this->create_unique_href(array('logout' => 1)) . '>' . __('Logout') . '<div class="logout_icon_img"></div></a></div>'); $this->theme->display(); } return; } if ($this->is_back()) { $this->unset_module_variable('mail_recover_pass'); } //if recover pass if ($this->get_module_variable_or_unique_href_variable('mail_recover_pass') == '1') { $this->recover_pass(); return; } if (isset($_REQUEST['password_recovered'])) { $this->theme->assign('message', __('An e-mail with a new password has been sent.') . '<br><a href="' . get_epesi_url() . '">' . __('Login') . '</a>'); $this->theme->display(); return; } if ($this->autologin()) { return; } //else just login form $form = $this->init_module('Libs/QuickForm', __('Logging in')); $form->addElement('header', 'login_header', __('Login')); if (DEMO_MODE) { global $demo_users; $form->addElement('select', 'username', __('Username'), $demo_users, array('id' => 'username', 'onChange' => 'this.form.elements["password"].value=this.options[this.selectedIndex].value;')); $form->addElement('hidden', 'password', key($demo_users)); } else { $form->addElement('text', 'username', __('Username'), array('id' => 'username')); $form->addElement('password', 'password', __('Password')); } // Display warning about storing a cookie if (Base_User_LoginCommon::is_autologin_forbidden() == false) { $warning = __('Keep this box unchecked if using a public computer'); $form->addElement('static', 'warning', null, $warning); $form->addElement('checkbox', 'autologin', '', __('Remember me')); } $form->addElement('static', 'recover_password', null, '<a ' . $this->create_unique_href(array('mail_recover_pass' => 1)) . '>' . __('Recover password') . '</a>'); $form->addElement('submit', 'submit_button', __('Login'), array('class' => 'submit')); // 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', __('You have exceeded the number of allowed login attempts for this username. Try again later.'), 'check_user_banned'); // register and add a rule to check if a username and password is ok $form->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon'); $form->addRule(array('username', 'password'), __('Login or password incorrect'), 'check_login'); $form->addRule('username', __('Field required'), 'required'); $form->addRule('password', __('Field required'), 'required'); if ($form->isSubmitted() && $form->validate()) { $user = $form->exportValue('username'); Base_User_LoginCommon::set_logged($user); if (Base_User_LoginCommon::is_autologin_forbidden() == false) { $autologin = $form->exportValue('autologin'); if ($autologin) { Base_User_LoginCommon::new_autologin_id(); } } location(array()); } else { $form->assign_theme('form', $this->theme); $this->theme->assign('mode', 'login'); $logo = $this->init_module('Base/MainModuleIndicator'); $logo->set_inline_display(); $this->theme->assign('logo', $this->get_html_of_module($logo, null, 'login_logo')); ob_start(); if (!$tpl) { $this->theme->set_inline_display(); $this->theme->display(); eval_js("focus_by_id('username')"); } else { Base_ThemeCommon::display_smarty($this->theme->get_smarty(), $tpl[0], $tpl[1]); } $ret = ob_get_clean(); if (stripos($ret, '<a href="http://www.telaxus.com">Telaxus LLC</a>') === false || stripos($ret, '<a href="http://epe.si/"><img src="images/epesi-powered.png" alt="EPESI powered" /></a>') === false) { trigger_error('Epesi terms of use have been violated', E_USER_ERROR); } print $ret; } }
public static function mobile_menu() { if (Acl::is_user()) { return array(__('Calendar') => array('func' => 'mobile_agenda', 'color' => 'green')); } }
<?php /** * * @author Arkadiusz Bisaga <*****@*****.**> * @copyright Copyright © 2008, Telaxus LLC * @license MIT * @version 1.0 * @package epesi-utils * @subpackage Watchdog */ if (!isset($_POST['key']) || !isset($_POST['cid']) || !is_numeric($_POST['cid'])) { die('alert(\'Invalid request\')'); } define('CID', $_POST['cid']); define('READ_ONLY_SESSION', true); require_once '../../../include.php'; ModuleManager::load_modules(); if (!Acl::is_user()) { die('Unauthorized access'); } list($cat_id, $id) = explode('__', $_POST['key']); if (!is_numeric($cat_id) || !is_numeric($id)) { die('Invalid use'); } Utils_WatchdogCommon::notified($cat_id, $id);
/** * Sets user setting to given value for currently logged in user. * Returns false if no user is logged in. * * @param string module name * @param string variable name * @param mixed value * @return bool true on success, false otherwise */ public static function save($module, $name, $value, $user = null) { if (!Acl::is_user()) { return false; } //if ($value === null) $value = 0; $module = str_replace('/', '_', $module); $def = self::get_admin($module, $name); // if (!isset($def)) return false; if (!Acl::is_user()) { return null; } if ($user === null) { $user = Acl::get_user(); } if ($value == $def) { DB::Execute('DELETE FROM base_user_settings WHERE user_login_id=%d AND module=%s AND variable=%s', array(Acl::get_user(), $module, $name)); if (isset(self::$user_variables[$user])) { unset(self::$user_variables[$user][$module][$name]); } } else { if (isset(self::$user_variables[$user])) { self::$user_variables[$user][$module][$name] = $value; } $value = serialize($value); $val = DB::GetOne('SELECT value FROM base_user_settings WHERE user_login_id=%d AND module=%s AND variable=%s', array(Acl::get_user(), $module, $name)); if ($val === false || $val === null) { DB::Execute('INSERT INTO base_user_settings VALUES (%d,%s,%s,%s)', array(Acl::get_user(), $module, $name, $value)); } else { DB::Execute('UPDATE base_user_settings SET value=%s WHERE user_login_id=%d AND module=%s AND variable=%s', array($value, Acl::get_user(), $module, $name)); } } return true; }
public function body() { if (!Acl::is_user()) { return; } $th = $this->init_module('Base/Theme'); eval_js_once('crm_filters_deactivate = function(){leightbox_deactivate(\'crm_filters\');}'); $th->assign('my', '<a ' . $this->create_callback_href(array('CRM_FiltersCommon', 'set_profile'), 'my') . ' id="crm_filters_my">' . __('My records') . '</a>'); eval_js('Event.observe(\'crm_filters_my\',\'click\', crm_filters_deactivate)'); /*$th->assign('all','<a '.$this->create_callback_href(array('CRM_FiltersCommon','set_profile'),'all').' id="crm_filters_all">'.__('All records').'</a>'); eval_js('Event.observe(\'crm_filters_all\',\'click\', crm_filters_deactivate)');*/ $th->assign('manage', '<a ' . $this->create_callback_href(array($this, 'manage_filters')) . ' id="crm_filters_manage">' . __('Manage presets') . '</a>'); eval_js('Event.observe(\'crm_filters_manage\',\'click\', crm_filters_deactivate)'); $ret = DB::Execute('SELECT id,name,description FROM crm_filters_group WHERE user_login_id=%d', array(Acl::get_user())); $filters = array(); while ($row = $ret->FetchRow()) { $filters[] = array('title' => $row['name'], 'description' => '', 'open' => '<a ' . Utils_TooltipCommon::open_tag_attrs($row['description'], false) . ' ' . $this->create_callback_href(array('CRM_FiltersCommon', 'set_profile'), $row['id']) . ' id="crm_filters_' . $row['id'] . '">', 'close' => '</a>'); eval_js('Event.observe(\'crm_filters_' . $row['id'] . '\',\'click\', crm_filters_deactivate)'); } $th->assign('filters', $filters); $qf = $this->init_module('Libs/QuickForm'); $fcallback = array('CRM_ContactsCommon', 'contact_format_no_company'); $recent_crits = array(); if (!Base_User_SettingsCommon::get('CRM_Contacts', 'show_all_contacts_in_filters')) { $recent_crits = array('(company_name' => CRM_ContactsCommon::get_main_company(), '|related_companies' => array(CRM_ContactsCommon::get_main_company())); } if (Base_User_SettingsCommon::get('CRM_Contacts', 'show_only_users_in_filters')) { $recent_crits['!login'] = ''; } $contacts = CRM_ContactsCommon::get_contacts($recent_crits, array(), array(), 15); $cont = array(); foreach ($contacts as $v) { $cont[$v['id']] = call_user_func($fcallback, $v, true); } asort($cont); $crits = array(); if (!Base_User_SettingsCommon::get('CRM_Contacts', 'show_all_contacts_in_filters')) { $crits = array('(company_name' => CRM_ContactsCommon::get_main_company(), '|related_companies' => array(CRM_ContactsCommon::get_main_company())); } $qf->addElement('autoselect', 'crm_filter_contact', __('Records of'), $cont, array(array('CRM_ContactsCommon', 'autoselect_contact_suggestbox'), array($crits, $fcallback, false)), $fcallback); if (isset($_SESSION['client']['filter_' . Acl::get_user()]['value'])) { $qf->setDefaults(array('crm_filter_contact' => explode(',', $_SESSION['client']['filter_' . Acl::get_user()]['value']))); } $qf->addElement('submit', 'submit', __('Show'), array('onclick' => 'crm_filters_deactivate()')); if ($qf->validate()) { $c = $qf->exportValue('crm_filter_contact'); CRM_FiltersCommon::set_profile('c' . $c); location(array()); } $th->assign('saved_filters', __('Saved Presets')); $qf->assign_theme('contacts', $th); //$th->assign('contacts',$qf->toHtml()); ob_start(); $th->display(); $profiles_out = ob_get_clean(); Libs_LeightboxCommon::display('crm_filters', $profiles_out, __('Perspective'), true); if (!isset($_SESSION['client']['filter_' . Acl::get_user()]['desc'])) { CRM_FiltersCommon::set_profile('my'); } //Base_ActionBarCommon::add('folder',__('Filters'),'class="lbOn" rel="crm_filters"',$this->get_module_variable('profile_desc',__('My records'))); if (isset($_REQUEST['__location'])) { $in_use = CRM_FiltersCommon::$in_use === $_REQUEST['__location']; } else { $in_use = CRM_FiltersCommon::$in_use; } print '<a class="lbOn' . ($in_use ? '' : ' disabled') . ' button" rel="crm_filters">' . __('Perspective') . ': ' . '<b>' . $_SESSION['client']['filter_' . Acl::get_user()]['desc'] . '</b><div class="filter_icon_img"></div></a>'; }
public static function mobile_menu() { if (!Acl::is_user()) { return array(); } return array(__('Contacts') => array('func' => 'mobile_contacts', 'color' => 'red'), __('Companies') => array('func' => 'mobile_companies', 'color' => 'black')); }