本文整理汇总了PHP中Acl::get_user方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::get_user方法的具体用法?PHP Acl::get_user怎么用?PHP Acl::get_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::get_user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_tracing_notes
public static function add_tracing_notes($dest_rset, $dest_id, $dest_label, $linkto_rset, $linkto_id, $linkto_label)
{
$after = __('Follow-up after') . ': ';
$follow = __('Follow-up') . ': ';
switch ($dest_rset) {
case 'phonecall':
$fwd_note_path = 'phonecall/' . $dest_id;
$bck_note = $after . '[phone=' . $dest_id . ']' . $dest_label . '[/phone]';
break;
case 'meeting':
$fwd_note_path = 'crm_meeting/' . $dest_id;
$bck_note = $after . '[meeting=' . $dest_id . ']' . $dest_label . '[/meeting]';
break;
case 'task':
$fwd_note_path = 'task/' . $dest_id;
$bck_note = $after . '[task=' . $dest_id . ']' . $dest_label . '[/task]';
break;
}
switch ($linkto_rset) {
case 'phonecall':
$bck_note_path = 'phonecall/' . $linkto_id;
$fwd_note = $follow . '[phone=' . $linkto_id . ']' . $linkto_label . '[/phone]';
break;
case 'meeting':
$bck_note_path = 'crm_meeting/' . $linkto_id;
$fwd_note = $follow . '[meeting=' . $linkto_id . ']' . $linkto_label . '[/meeting]';
break;
case 'task':
$bck_note_path = 'task/' . $linkto_id;
$fwd_note = $follow . '[task=' . $linkto_id . ']' . $linkto_label . '[/task]';
break;
}
Utils_AttachmentCommon::add($fwd_note_path, 0, Acl::get_user(), $fwd_note);
Utils_AttachmentCommon::add($bck_note_path, 0, Acl::get_user(), $bck_note);
}
示例2: get_options
public static function get_options()
{
static $user;
if (isset(self::$options) && $user == Acl::get_user()) {
return self::$options;
}
$user = Acl::get_user();
self::$options = array();
$modules_menu = array();
$menus = Base_MenuCommon::get_menus();
//ksort($menus);
foreach ($menus as $name => $ret) {
if ($name == 'Base_Admin') {
continue;
}
if ($name == Base_Menu_QuickAccessCommon::module_name()) {
continue;
}
Base_MenuCommon::add_default_menu($ret, $name);
$modules_menu = array_merge($modules_menu, self::check_for_links('', $ret, $name));
}
usort($modules_menu, function ($a, $b) {
return strcmp($a['label'], $b['label']);
});
self::$options =& $modules_menu;
return self::$options;
}
示例3: get_trays
public static function get_trays()
{
static $trays;
static $user;
if (!isset($trays) || $user != Acl::get_user()) {
$user = Acl::get_user();
$trays = ModuleManager::call_common_methods('tray', false);
}
return $trays;
}
示例4: applet
public function applet()
{
$query = 'SELECT b.user_login_id, b.start_time, b.end_time, b.ip_address, b.host_name FROM base_login_audit b WHERE b.user_login_id=' . Acl::get_user() . ' ORDER BY b.start_time DESC';
$ret = DB::SelectLimit($query, 1, 1);
if ($row = $ret->FetchRow()) {
$ok1 = $row['ip_address'] == get_client_ip_address();
$ok2 = DB::GetOne('SELECT 1 FROM base_login_audit b WHERE (SELECT MIN(b2.start_time) FROM base_login_audit b2 WHERE b2.ip_address=%s)<b.start_time AND (SELECT MAX(b3.start_time) FROM base_login_audit b3 WHERE b3.ip_address=%s)>b.start_time AND b.ip_address!=%s', array($row['ip_address'], $row['ip_address'], $row['ip_address']));
$ok = $ok1 || $ok2;
print ($ok ? '<div style="padding:7px;">' : '<div style="padding:7px;background-color: red; color:white; font-weight:bold;">') . __('On: %s', array($row['start_time'])) . '<br />' . __('Host name: %s', array($row['host_name'])) . '<br />' . __('IP address: %s', array($row['ip_address'])) . '</div>';
}
}
示例5: send_translation
public static function send_translation($lang, $org, $trans)
{
if (!self::allow_sending()) {
return false;
}
$ip = gethostbyname($_SERVER['SERVER_NAME']);
$r = DB::GetRow('SELECT * FROM base_lang_trans_contrib WHERE user_id=%d', array(Acl::get_user()));
$q = array('first_name' => $r['first_name'], 'last_name' => $r['last_name'], 'lang' => $lang, 'ip' => $ip, 'original' => $org, 'translation' => $trans, 'credits' => $r['credits'], 'credits_website' => $r['credits_website'], 'contact_email' => $r['contact_email']);
$ret = file_get_contents(self::translation_server_url . '/translations.php?' . http_build_query($q));
$success = 'OK;' == $ret;
return $success;
}
示例6: get_menus
public static function get_menus()
{
static $menus;
static $user;
if (!isset($menus) || $user != Acl::get_user()) {
$user = Acl::get_user();
$menus = ModuleManager::call_common_methods('menu', false);
foreach ($menus as $m => $r) {
if (!is_array($r)) {
unset($menus[$m]);
}
}
}
return $menus;
}
示例7: add
public function add($def_date,$timeless=false) {
if($this->is_back()) $this->back_to_calendar();
$qf = $this->init_module('Libs/QuickForm',null,'addf');
$qf->addElement('datepicker','start','Start Date');
$qf->addElement('datepicker','end','End Date');
// $qf->addElement('checkbox','timeless','Timeless'); //always
$qf->addElement('text','title','Title');
$qf->addElement('textarea','description','Description');
$qf->addElement('select','color','Color',array('blue'=>'• Blue', 'red'=>'• Red', 'yellow'=>'• Yellow', 'green'=>'• Green', 'gray' => '• Gray', 'cyan' => '• Cyan', 'magenta' => '• Magenta'));
$qf->setDefaults(array('start'=>$def_date,'end'=>$def_date));
if($qf->validate()) {
$d = $qf->exportValues();
DB::Execute('INSERT INTO tests_calendar_event(start,duration,timeless,title,description,created_on,created_by,color) VALUES(%d,%d,%b,%s,%s,%T,%d,%s)',
array(strtotime($d['start']),strtotime($d['end'])-strtotime($d['start'])+86400,true,$d['title'],$d['description'],time(),Acl::get_user(),$d['color']));
$this->back_to_calendar();
} else {
$qf->display();
Base_ActionBarCommon::add('back',__('Cancel'),$this->create_back_href());
Base_ActionBarCommon::add('save',__('Save'),$qf->get_submit_form_href());
}
}
示例8: get_unread_messages
/**
* @param int $account_id
* @param bool $only_cached If true then only cached response will be retrieved
* @param int $cache_validity_in_minutes Provide 0 or false to force request
*
* @return array|null
* @throws Exception
*/
public static function get_unread_messages($account_id, $only_cached = false, $cache_validity_in_minutes = 3)
{
$return = null;
$rec = Utils_RecordBrowserCommon::get_record('rc_accounts', $account_id);
if ($rec['epesi_user'] !== Acl::get_user()) {
throw new Exception('Invalid account id');
}
$port = $rec['security'] == 'ssl' ? 993 : 143;
$server_str = '{' . $rec['server'] . '/imap/readonly/novalidate-cert' . ($rec['security'] ? '/' . $rec['security'] : '') . ':' . $port . '}';
$cache_key = md5($server_str . ' # ' . $rec['login'] . ' # ' . $rec['password']);
$cache = new FileCache(DATA_DIR . '/cache/roundcube_unread.php');
if ($cache_validity_in_minutes) {
$unread_messages = $cache->get($cache_key);
if ($unread_messages && ($only_cached || $unread_messages['t'] > time() - $cache_validity_in_minutes * 60)) {
$return = $unread_messages['val'];
}
}
if ($return === null && $only_cached === false) {
@set_time_limit(0);
$mailbox = @imap_open(imap_utf7_encode($server_str), imap_utf7_encode($rec['login']), imap_utf7_encode($rec['password']), OP_READONLY || OP_SILENT);
$err = imap_errors();
$unseen = array();
if (!$mailbox || $err) {
$err = __('Connection error') . ": " . implode(', ', $err);
} else {
$uns = @imap_search($mailbox, 'UNSEEN ALL');
if ($uns) {
$l = @imap_fetch_overview($mailbox, implode(',', $uns), 0);
$err = imap_errors();
if (!$l || $err) {
$error_info = $err ? ": " . implode(', ', $err) : "";
$err = __('Error reading messages overview') . $error_info;
} else {
foreach ($l as $msg) {
$from = isset($msg->from) ? imap_utf8($msg->from) : '<unknown>';
$subject = isset($msg->subject) ? imap_utf8($msg->subject) : '<no subject>';
$date = isset($msg->date) ? $msg->date : '';
$unseen[] = array('from' => $from, 'subject' => $subject, 'id' => $msg->uid, 'date' => $date, 'unix_timestamp' => $msg->udate);
}
}
}
}
if (!is_bool($mailbox)) {
imap_close($mailbox);
}
imap_errors();
// called just to clean up errors.
if ($err) {
throw new Exception($err);
} else {
$return = $unseen;
$cache->set($cache_key, array('val' => $return, 't' => time()));
}
}
return $return;
}
示例9: handle_special_field_crit
protected function handle_special_field_crit(Utils_RecordBrowser_CritsSingle $crit)
{
$field = $crit->get_field();
$operator = self::transform_meta_operators_to_sql($crit->get_operator());
$value = $crit->get_value();
$negation = $crit->get_negation();
$special = $field[0] == ':' || $field == 'id';
if ($special) {
$sql = '';
$vals = array();
switch ($field) {
case ':id':
case 'id':
if (!is_array($value)) {
$sql = $this->tab_alias . ".id {$operator} %d";
$vals[] = $value;
} else {
if ($operator != '=' && $operator != '==') {
throw new Exception("Cannot use array values for id field operator '{$operator}'");
}
$clean_vals = array();
foreach ($value as $v) {
if (is_numeric($v)) {
$clean_vals[] = $v;
}
}
if (empty($clean_vals)) {
$sql = 'false';
} else {
$sql = $this->tab_alias . ".id IN (" . implode(',', $clean_vals) . ")";
}
}
if ($negation) {
$sql = "NOT ({$sql})";
}
break;
case ':Fav':
$fav = $value == true;
if ($negation) {
$fav = !$fav;
}
if (!isset($this->applied_joins[$field])) {
$this->final_tab = '(' . $this->final_tab . ') LEFT JOIN ' . $this->tab . '_favorite AS ' . $this->tab_alias . '_fav ON ' . $this->tab_alias . '_fav.' . $this->tab . '_id=' . $this->tab_alias . '.id AND ' . $this->tab_alias . '_fav.user_id=' . Acl::get_user();
$this->applied_joins[$field] = true;
}
$rule = $fav ? 'IS NOT NULL' : 'IS NULL';
$sql = $this->tab_alias . "_fav.fav_id {$rule}";
break;
case ':Sub':
$sub = $value == true;
if ($negation) {
$sub = !$sub;
}
if (!isset($this->applied_joins[$field])) {
$this->final_tab = '(' . $this->final_tab . ') LEFT JOIN utils_watchdog_subscription AS ' . $this->tab_alias . '_sub ON ' . $this->tab_alias . '_sub.internal_id=' . $this->tab_alias . '.id AND ' . $this->tab_alias . '_sub.category_id=' . Utils_WatchdogCommon::get_category_id($this->tab) . ' AND ' . $this->tab_alias . '_sub.user_id=' . Acl::get_user();
$this->applied_joins[$field] = true;
}
$rule = $sub ? 'IS NOT NULL' : 'IS NULL';
$sql = $this->tab_alias . "_sub.internal_id {$rule}";
break;
case ':Recent':
$rec = $value == true;
if ($negation) {
$rec = !$rec;
}
if (!isset($this->applied_joins[$field])) {
$this->final_tab = '(' . $this->final_tab . ') LEFT JOIN ' . $this->tab . '_recent AS ' . $this->tab_alias . '_rec ON ' . $this->tab_alias . '_rec.' . $this->tab . '_id=' . $this->tab_alias . '.id AND ' . $this->tab_alias . '_rec.user_id=' . Acl::get_user();
$this->applied_joins[$field] = true;
}
$rule = $rec ? 'IS NOT NULL' : 'IS NULL';
$sql = $this->tab_alias . "_rec.user_id {$rule}";
break;
case ':Created_on':
$vals[] = Base_RegionalSettingsCommon::reg2time($value, false);
$sql = $this->tab_alias . '.created_on ' . $operator . '%T';
if ($negation) {
$sql = "NOT ({$sql})";
}
break;
case ':Created_by':
if (!is_array($value)) {
$value = array($value);
}
$sql = array();
foreach ($value as $v) {
$vals[] = $v;
$sql[] = $this->tab_alias . '.created_by = %d';
}
$sql = implode(' OR ', $sql);
if ($negation) {
$sql = "NOT ({$sql})";
}
break;
case ':Edited_on':
$inj = $operator . '%T';
$sql = '(((SELECT MAX(edited_on) FROM ' . $this->tab . '_edit_history WHERE ' . $this->tab . '_id=' . $this->tab_alias . '.id) ' . $inj . ') OR ' . '((SELECT MAX(edited_on) FROM ' . $this->tab . '_edit_history WHERE ' . $this->tab . '_id=' . $this->tab_alias . '.id) IS NULL AND created_on ' . $inj . '))';
$timestamp = Base_RegionalSettingsCommon::reg2time($value, false);
if ($negation) {
$sql = "NOT (COALESCE({$sql}, FALSE))";
}
//.........这里部分代码省略.........
示例10: new_record
/**
* Add new record to recordset, when array is supplied and return it's object
* or just returns empty data object to fill it with data and perform save()
* method.
* @param array|null $array_or_null associative array of data to or null.
* @return RBO_Record|null
*/
public function new_record($array_or_null = null)
{
if (is_array($array_or_null)) {
$id = Utils_RecordBrowserCommon::new_record($this->tab, $array_or_null);
if (!is_numeric($id)) {
return null;
}
$array_or_null['id'] = $id;
$array_or_null['created_by'] = Acl::get_user();
$array_or_null[':active'] = true;
return $this->record_to_object($array_or_null);
}
return $this->record_to_object(array());
}
示例11: save
/**
* 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;
}
示例12: account_manager
public function account_manager($pushed_on_top = false)
{
if ($pushed_on_top) {
if ($this->is_back()) {
Base_BoxCommon::pop_main();
return;
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
} else {
Base_ActionBarCommon::add('back', __('Back'), $this->create_main_href('Base_User_Settings'));
}
$this->rb = $this->init_module('Utils/RecordBrowser', 'rc_accounts', 'rc_accounts');
$this->rb->set_defaults(array('epesi_user' => Acl::get_user()));
$order = array(array('login' => 'DESC'), array('epesi_user' => Acl::get_user()), array('epesi_user' => false));
$this->display_module($this->rb, $order);
// other settings
$qf = $this->init_module('Libs/QuickForm');
$qf->addElement('advcheckbox', 'standard_mailto', __("Use standard mailto links"), null, array('onchange' => $qf->get_submit_form_js()));
$use_standard_mailto = CRM_RoundcubeCommon::use_standard_mailto();
$qf->setDefaults(array('standard_mailto' => $use_standard_mailto));
if ($qf->validate()) {
CRM_RoundcubeCommon::set_standard_mailto($qf->exportValue('standard_mailto'));
}
$qf->display_as_row();
}
示例13: display_status
public static function display_status($record, $nolink, $desc)
{
$prefix = 'crm_tasks_leightbox';
$v = $record[$desc['id']];
if (!$v) {
$v = 0;
}
$status = Utils_CommonDataCommon::get_translated_array('CRM/Status');
if ($v >= 3 || $nolink) {
return $status[$v];
}
CRM_FollowupCommon::drawLeightbox($prefix);
if (!Utils_RecordBrowserCommon::get_access('task', 'edit', $record) && !Base_AclCommon::i_am_admin()) {
return $status[$v];
}
if (isset($_REQUEST['form_name']) && $_REQUEST['form_name'] == $prefix . '_follow_up_form' && $_REQUEST['id'] == $record['id']) {
unset($_REQUEST['form_name']);
$v = $_REQUEST['closecancel'];
$action = $_REQUEST['action'];
$note = $_REQUEST['note'];
if ($note) {
if (get_magic_quotes_gpc()) {
$note = stripslashes($note);
}
$note = str_replace("\n", '<br />', $note);
Utils_AttachmentCommon::add('task/' . $record['id'], 0, Acl::get_user(), $note);
}
if ($action == 'set_in_progress') {
$v = 1;
}
Utils_RecordBrowserCommon::update_record('task', $record['id'], array('status' => $v));
if ($action == 'set_in_progress') {
location(array());
}
$values = $record;
$values['date_and_time'] = date('Y-m-d H:i:s');
$values['title'] = __('Follow-up') . ': ' . $values['title'];
$values['status'] = 0;
if ($action != 'none') {
$x = ModuleManager::get_instance('/Base_Box|0');
$values['follow_up'] = array('task', $record['id'], $record['title']);
if ($action == 'new_task') {
$x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, $values), array('task'));
}
if ($action == 'new_meeting') {
$x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('title' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'duration' => 3600, 'status' => 0, 'employees' => $values['employees'], 'customers' => $values['customers'], 'follow_up' => $values['follow_up'])), array('crm_meeting'));
}
if ($action == 'new_phonecall') {
$x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('subject' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date_and_time' => date('Y-m-d H:i:s'), 'employees' => $values['employees'], 'status' => 0, 'customer' => !empty($values['customers']) ? array_pop($values['customers']) : '', 'follow_up' => $values['follow_up'])), array('phonecall'));
}
return false;
}
location(array());
}
if ($v == 0) {
return '<a href="javascript:void(0)" onclick="' . $prefix . '_set_action(\'set_in_progress\');' . $prefix . '_set_id(\'' . $record['id'] . '\');' . $prefix . '_submit_form();">' . $status[$v] . '</a>';
}
return '<a href="javascript:void(0)" class="lbOn" rel="' . $prefix . '_followups_leightbox" onMouseDown="' . $prefix . '_set_id(' . $record['id'] . ');">' . $status[$v] . '</a>';
}
示例14: post_install_process
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')));
}
}
示例15: die
$local = $rec['id'];
$fsid = $file['filestorage_id'];
$crypted = $rec['crypted'];
$meta = Utils_FileStorageCommon::meta($fsid);
require_once 'mime.php';
if (headers_sent()) {
die('Some data has already been output to browser, can\'t send file');
}
$password = '';
if ($crypted) {
$password = $_SESSION['client']['cp' . $rec['id']];
}
$t = time();
$remote_address = get_client_ip_address();
$remote_host = gethostbyaddr($remote_address);
DB::Execute('INSERT INTO utils_attachment_download(attach_file_id,created_by,created_on,download_on,description,ip_address,host_name) VALUES (%d,%d,%T,%T,%s,%s,%s)', array($id, Acl::get_user(), $t, $t, $disposition, $remote_address, $remote_host));
if (isset($_REQUEST['thumbnail'])) {
$o_filename = $meta['file'];
$f_filename = $o_filename . '_thumbnail';
if (!file_exists($f_filename)) {
if (!file_exists($o_filename)) {
die('File doesn\'t exists');
}
$image_info = getimagesize($o_filename);
$image_type = $image_info[2];
$image = false;
switch ($image_type) {
case IMAGETYPE_JPEG:
$image = imagecreatefromjpeg($o_filename);
break;
case IMAGETYPE_GIF: