本文整理汇总了PHP中CUser::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::get方法的具体用法?PHP CUser::get怎么用?PHP CUser::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
public static function call($method, $params, $sessionid = null)
{
global $USER_DETAILS;
// List of methods without params
$notifications = array('apiinfo.version' => 1);
//-----
// list of methods which does not require athentication
$without_auth = array('apiinfo.version' => 1);
//-----
if (is_null($params) && !isset($notifications[$method])) {
self::$result = array('error' => ZBX_API_ERROR_PARAMETERS);
return self::$result;
}
list($resource, $action) = explode('.', $method);
if (!isset($without_auth[$method])) {
// Authentication {{{
// compatibility mode
if ($resource == 'user' && $action == 'authenticate') {
$action = 'login';
}
//----------
if (empty($sessionid) && ($resource != 'user' || $action != 'login')) {
self::$result = array('error' => ZBX_API_ERROR_NO_AUTH, 'data' => 'Not authorized');
return self::$result;
} else {
if (!empty($sessionid)) {
if (!CUser::simpleAuth($sessionid)) {
self::$result = array('error' => ZBX_API_ERROR_NO_AUTH, 'data' => 'Not authorized');
return self::$result;
}
$options = array('userids' => $USER_DETAILS['userid'], 'output' => API_OUTPUT_EXTEND, 'get_access' => 1);
$users = CUser::get($options);
$user = reset($users);
if ($user['api_access'] != GROUP_API_ACCESS_ENABLED) {
self::$result = array('error' => ZBX_API_ERROR_NO_AUTH, 'data' => 'No API access');
return self::$result;
}
}
}
// }}} Authentication
}
unset($params['nopermissions']);
if (!method_exists('czbxrpc', $resource)) {
self::$result = array('error' => ZBX_API_ERROR_PARAMETERS, 'data' => 'Resource (' . $resource . ') does not exist');
return self::$result;
}
$class_name = 'C' . $resource;
if (!method_exists($class_name, $action)) {
self::$result = array('error' => ZBX_API_ERROR_PARAMETERS, 'data' => 'Action (' . $action . ') does not exist');
return self::$result;
}
call_user_func(array('czbxrpc', $resource), $action, $params);
if (self::$result !== false || $action == 'exists') {
self::$result = array('result' => self::$result);
} else {
self::$result = reset(CZBXAPI::$error);
}
return self::$result;
}
示例2: event
/**
* Event method
*
* @param string $message Message
* @param int $actor_id Actor id
*
* @return string ACK
*/
function event($message, $actor_id = null)
{
$actor = null;
$sender_soap = new CSenderSOAP();
if ($actor_id) {
$sender_soap->load($actor_id);
} else {
$sender_soap->user_id = CUser::get()->_id;
$sender_soap->loadMatchingObject();
}
if ($sender_soap->_id) {
$actor = $sender_soap;
}
// Dispatch EAI
if (!($acq = CEAIDispatcher::dispatch($message, $actor))) {
return utf8_encode(CEAIDispatcher::$xml_error);
}
return $acq;
}
示例3: range
<?php
/**
* $Id$
*
* @package Mediboard
* @subpackage Cabinet
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CCanDo::checkAdmin();
$hours = range(0, 23);
$intervals = array("05", "10", "15", "20", "30");
$function = new CFunctions();
$function->group_id = CGroups::loadCurrent()->_id;
$functions = $function->loadMatchingList();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("hours", $hours);
$smarty->assign("date", CMbDT::date());
$smarty->assign("intervals", $intervals);
$smarty->assign("debut", CMbDT::date("+ 5 YEAR"));
$smarty->assign("limit", "100");
$smarty->assign("praticiens", CMediusers::get()->loadPraticiens());
$smarty->assign("anesths", CMediusers::get()->loadAnesthesistes());
$smarty->assign("functions_id", $functions);
$smarty->assign("user", CUser::get());
$smarty->display("configure.tpl");
示例4: CUser
<?php
/**
* $Id: vw_functional_perms.php 24154 2014-07-24 14:17:58Z kgrisel $
*
* @package Mediboard
* @subpackage admin
* @version $Revision: 24154 $
* @author SARL OpenXtrem
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
*/
CCanDo::checkEdit();
$user_id = CCanDo::edit() ? CValue::getOrSession("user_id", "default") : null;
$user = CUser::get($user_id);
$prof = $user->profile_id ? CUser::get($user->profile_id) : new CUser();
if ($user_id == "default") {
$user->_id = null;
}
$prefvalues = array("default" => CPreferences::get(null, true), "template" => $user->profile_id ? CPreferences::get($user->profile_id, true) : array(), "user" => $user->_id !== "" ? CPreferences::get($user->_id, true) : array());
// common sera toujours au debut
$prefs = array("common" => array());
// Classement par module et par permission fonctionnelle
CPreferences::loadModules(true);
foreach (CPreferences::$modules as $modname => $prefnames) {
$module = CModule::getActive($modname);
$canRead = $module ? CPermModule::getPermModule($module->_id, PERM_READ, $user_id) : false;
if ($modname == "common" || $user_id == "default" || $canRead) {
$prefs[$modname] = array();
foreach ($prefnames as $prefname) {
$prefs[$modname][$prefname] = array("default" => CMbArray::extract($prefvalues["default"], $prefname), "template" => CMbArray::extract($prefvalues["template"], $prefname), "user" => CMbArray::extract($prefvalues["user"], $prefname));
}
示例5: trim
/**
* $Id$
*
* @category Admin
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
* @link http://www.mediboard.org
*/
$password = trim(CValue::post('password'));
$lock = CValue::post('lock');
if ($lock) {
$_SESSION['locked'] = true;
return;
} else {
if (!$password) {
CAppUI::setMsg("Auth-failed-nopassword", UI_MSG_ERROR);
}
if (!CUser::checkPassword(CUser::get()->user_username, $password)) {
CAppUI::setMsg("Auth-failed-combination", UI_MSG_ERROR);
}
if ($msg = CAppUI::getMsg()) {
echo $msg;
return;
} else {
CAppUI::callbackAjax('Session.unlock');
$_SESSION['locked'] = false;
}
}
示例6:
/**
* $Id: $
*
* @category Admin
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision: 18541 $
* @link http://www.mediboard.org
*/
$old_pwd = CValue::post("old_pwd");
$new_pwd1 = CValue::post("new_pwd1");
$new_pwd2 = CValue::post("new_pwd2");
$callback = CValue::post("callback");
// Vérification du mot de passe actuel de l'utilisateur courant
$user = CUser::checkPassword(CUser::get()->user_username, $old_pwd, true);
// Mot de passe actuel correct
if (!$user->_id) {
CAppUI::stepAjax("CUser-user_password-nomatch", UI_MSG_ERROR);
}
if (!$user->canChangePassword()) {
CAppUI::stepAjax("CUser-password_change_forbidden", UI_MSG_ERROR);
}
$allow_change_password = CAppUI::conf("admin LDAP allow_change_password");
$ldap_linked = $user->isLDAPLinked();
// Si utilisateur associé au LDAP et modif de mot de passe non autorisée: ERROR
if (!$allow_change_password && $ldap_linked) {
CAppUI::stepAjax("CUser_associate-ldap-no-password-change", UI_MSG_ERROR);
}
// Mots de passe différents
if ($new_pwd1 != $new_pwd2) {
示例7: CButton
$filterForm->addItemToBottomRow(new CButton("filter_set", S_FILTER));
$filterForm->addItemToBottomRow($reset);
$alerts_wdgt->addFlicker($filterForm, CProfile::get('web.auditacts.filter.state', 1));
$scroll_div = new CDiv();
$scroll_div->setAttribute('id', 'scrollbar_cntr');
$alerts_wdgt->addFlicker($scroll_div, CProfile::get('web.auditacts.filter.state', 1));
//-------
$table = new CTableInfo(S_NO_ACTIONS_FOUND);
$table->setHeader(array(is_show_all_nodes() ? S_NODES : null, S_TIME, S_TYPE, S_STATUS, S_RETRIES_LEFT, S_RECIPIENTS, S_MESSAGE, S_ERROR));
$effectiveperiod = navigation_bar_calc('web.auditacts.timeline', 0, true);
$bstime = $_REQUEST['stime'];
$from = zbxDateToTime($_REQUEST['stime']);
$till = $from + $effectiveperiod;
$options = array('time_from' => $from, 'time_till' => $till, 'output' => API_OUTPUT_EXTEND, 'select_mediatypes' => API_OUTPUT_EXTEND, 'sortfield' => 'alertid', 'sortorder' => ZBX_SORT_DOWN, 'limit' => $config['search_limit'] + 1);
if ($_REQUEST['alias']) {
$users = CUser::get(array('filter' => array('alias' => $_REQUEST['alias'])));
$options['userids'] = zbx_objectValues($users, 'userid');
}
$alerts = CAlert::get($options);
// get first event for selected filters, to get starttime for timeline bar
unset($options['userids']);
unset($options['time_from']);
unset($options['time_till']);
unset($options['select_mediatypes']);
$options['limit'] = 1;
$options['sortorder'] = ZBX_SORT_UP;
$firstAlert = CAlert::get($options);
$firstAlert = reset($firstAlert);
$starttime = $firstAlert ? $firstAlert['clock'] : time() - 3600;
$paging = getPagingLine($alerts);
foreach ($alerts as $num => $row) {
示例8: CPatient
if ($ex_object->_ref_object->_id) {
$rel_patient = $ex_object->_ref_object->loadRelPatient();
$rel_patient->loadIPP();
} else {
$rel_patient = new CPatient();
if ($preview) {
$rel_patient->_view = "Patient exemple";
$rel_patient->_IPP = "0123456";
$ex_object->_ref_object->_view = CAppUI::tr($ex_object->_ref_object->_class) . " test";
}
}
$ex_object->_rel_patient = $rel_patient;
}
$can_delete = false;
if ($ex_object->_id) {
$can_delete = $ex_object->owner_id == CUser::get()->_id;
}
$can_delete = $can_delete || CModule::getInstalled("forms")->canAdmin();
// Load IPP and NDA
$ref_objects = array($ex_object->_ref_object, $ex_object->_ref_reference_object_1, $ex_object->_ref_reference_object_2);
foreach ($ref_objects as $_object) {
if ($_object instanceof CPatient) {
$_object->loadIPP();
continue;
}
if ($_object instanceof CSejour) {
$_object->loadNDA();
$_object->loadRefCurrAffectation($creation_date);
continue;
}
}
示例9: buildPrefs
/**
* Build preferences for connected user, with the default/profile/user strategy
*
* @return void
*/
static function buildPrefs()
{
// Default
self::loadPrefs();
// Profile
$user = CUser::get();
if ($user->profile_id) {
self::loadPrefs($user->profile_id);
}
// User
self::loadPrefs($user->_id);
}
示例10: array
<?php
/**
* dPboard
*
* @category Board
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version SVN: $Id:$
* @link http://www.mediboard.org
*/
// Récupération des paramètres
$login = CUser::get()->user_username;
$prat_id = CUser::get()->_id;
$url = CAppUI::conf("base_url") . "/index.php?";
$param = array();
$param["m"] = "dPboard";
$param["a"] = "export_ical";
$param["suppressHeaders"] = "1";
$url .= http_build_query($param, null, "&");
// Variables de templates
$smarty = new CSmartyDP();
$smarty->assign("prat_id", $prat_id);
$smarty->assign("login", $login);
$smarty->assign("url", $url);
$smarty->display("vw_agenda.tpl");
示例11: CTransmissionMedicale
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CModule::getCanDo("soins")->needsEdit();
$transmission_id = CValue::get("transmission_id");
$data_id = CValue::get("data_id");
$action_id = CValue::get("action_id");
$result_id = CValue::get("result_id");
$sejour_id = CValue::get("sejour_id");
$object_id = CValue::get("object_id");
$object_class = CValue::get("object_class");
$libelle_ATC = CValue::get("libelle_ATC");
$refreshTrans = CValue::get("refreshTrans", 0);
$update_plan_soin = CValue::get("update_plan_soin", 0);
$user_id = CUser::get()->_id;
$transmission = new CTransmissionMedicale();
if ($transmission_id) {
$transmission->load($transmission_id);
} else {
if ($data_id || $action_id || $result_id) {
$transmission->sejour_id = $sejour_id;
// Multi-transmissions
if ($data_id) {
$trans = new CTransmissionMedicale();
$trans->load($data_id);
$trans->canEdit();
$transmission->_text_data = $trans->text;
$transmission->user_id = $trans->user_id;
$transmission->date = $trans->date;
$transmission->degre = $trans->degre;
示例12: getUserForm
function getUserForm($userid, $profile = 0)
{
global $ZBX_LOCALES;
global $USER_DETAILS;
$config = select_config();
$frm_title = S_USER;
if (isset($userid)) {
/* if(bccomp($userid,$USER_DETAILS['userid'])==0) $profile = 1;*/
$options = array('userids' => $userid, 'output' => API_OUTPUT_EXTEND);
if ($profile) {
$options['nodeids'] = id2nodeid($userid);
}
$users = CUser::get($options);
$user = reset($users);
$frm_title = S_USER . ' "' . $user['alias'] . '"';
}
if (isset($userid) && (!isset($_REQUEST['form_refresh']) || isset($_REQUEST['register']))) {
$alias = $user['alias'];
$name = $user['name'];
$surname = $user['surname'];
$password = null;
$password1 = null;
$password2 = null;
$url = $user['url'];
$autologin = $user['autologin'];
$autologout = $user['autologout'];
$lang = $user['lang'];
$theme = $user['theme'];
$refresh = $user['refresh'];
$rows_per_page = $user['rows_per_page'];
$user_type = $user['type'];
if ($autologout > 0) {
$_REQUEST['autologout'] = $autologout;
}
$user_groups = array();
$user_medias = array();
$options = array('userids' => $userid, 'output' => API_OUTPUT_SHORTEN);
$user_groups = CUserGroup::get($options);
$user_groups = zbx_objectValues($user_groups, 'usrgrpid');
$user_groups = zbx_toHash($user_groups);
$db_medias = DBselect('SELECT m.* FROM media m WHERE m.userid=' . $userid);
while ($db_media = DBfetch($db_medias)) {
$user_medias[] = array('mediaid' => $db_media['mediaid'], 'mediatypeid' => $db_media['mediatypeid'], 'period' => $db_media['period'], 'sendto' => $db_media['sendto'], 'severity' => $db_media['severity'], 'active' => $db_media['active']);
}
$messages = getMessageSettings();
} else {
$alias = get_request('alias', '');
$name = get_request('name', '');
$surname = get_request('surname', '');
$password = null;
$password1 = get_request('password1', '');
$password2 = get_request('password2', '');
$url = get_request('url', '');
$autologin = get_request('autologin', 0);
$autologout = get_request('autologout', 90);
$lang = get_request('lang', 'en_gb');
$theme = get_request('theme', 'default.css');
$refresh = get_request('refresh', 30);
$rows_per_page = get_request('rows_per_page', 50);
$user_type = get_request('user_type', USER_TYPE_ZABBIX_USER);
$user_groups = get_request('user_groups', array());
$change_password = get_request('change_password', null);
$user_medias = get_request('user_medias', array());
$messages = get_request('messages', array());
if (!isset($messages['enabled'])) {
$messages['enabled'] = 0;
}
if (!isset($messages['sounds.recovery'])) {
$messages['sounds.recovery'] = 0;
}
if (!isset($messages['triggers.recovery'])) {
$messages['triggers.recovery'] = 0;
}
if (!isset($messages['triggers.severities'])) {
$messages['triggers.severities'] = array();
}
$pMsgs = getMessageSettings();
$messages = array_merge($pMsgs, $messages);
}
if ($autologin || !isset($_REQUEST['autologout'])) {
$autologout = 0;
} else {
if (isset($_REQUEST['autologout']) && $autologout < 90) {
$autologout = 90;
}
}
$perm_details = get_request('perm_details', 0);
$media_types = array();
$media_type_ids = array();
foreach ($user_medias as $one_media) {
$media_type_ids[$one_media['mediatypeid']] = 1;
}
if (count($media_type_ids) > 0) {
$sql = 'SELECT mt.mediatypeid, mt.description ' . ' FROM media_type mt ' . ' WHERE mt.mediatypeid IN (' . implode(',', array_keys($media_type_ids)) . ')';
$db_media_types = DBselect($sql);
while ($db_media_type = DBfetch($db_media_types)) {
$media_types[$db_media_type['mediatypeid']] = $db_media_type['description'];
}
}
$frmUser = new CFormTable($frm_title);
//.........这里部分代码省略.........
示例13: CUser
<?php
/**
* $Id$
*
* @category Admin
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
* @link http://www.mediboard.org
*/
CCanDo::checkEdit();
// Récuperation de l'utilisateur sélectionné
$user_id = CValue::getOrSession("user_id");
$user = $user_id == "0" ? new CUser() : CUser::get($user_id);
// Récuperation des utilisateurs recherchés
$user_username = CValue::getOrSession("user_username");
$user_last_name = CValue::getOrSession("user_last_name");
$user_first_name = CValue::getOrSession("user_first_name");
$user_type = CValue::getOrSession("user_type");
$template = CValue::getOrSession("template");
// Where clause
$where = null;
if ($user_last_name) {
$where["user_last_name"] = "LIKE '{$user_last_name}%'";
}
if ($user_first_name) {
$where["user_first_name"] = "LIKE '{$user_first_name}%'";
}
if ($user_username) {
示例14: get
/**
* Get Media types data
*
* {@source}
* @access public
* @static
* @since 1.8
* @version 1
*
* @param _array $options
* @param array $options['nodeids'] filter by Node IDs
* @param array $options['mediatypeids'] filter by Mediatype IDs
* @param boolean $options['type'] filter by Mediatype type [ USER_TYPE_ZABBIX_USER: 1, USER_TYPE_ZABBIX_ADMIN: 2, USER_TYPE_SUPER_ADMIN: 3 ]
* @param boolean $options['output'] output only Mediatype IDs if not set.
* @param boolean $options['count'] output only count of objects in result. ( result returned in property 'rowscount' )
* @param string $options['pattern'] filter by Host name containing only give pattern
* @param int $options['limit'] output will be limited to given number
* @param string $options['sortfield'] output will be sorted by given property [ 'mediatypeid', 'alias' ]
* @param string $options['sortorder'] output will be sorted in given order [ 'ASC', 'DESC' ]
* @return array
*/
public static function get($options = array())
{
global $USER_DETAILS;
$result = array();
$nodeCheck = false;
$user_type = $USER_DETAILS['type'];
$userid = $USER_DETAILS['userid'];
$sort_columns = array('mediatypeid');
// allowed columns for sorting
$subselects_allowed_outputs = array(API_OUTPUT_REFER, API_OUTPUT_EXTEND);
// allowed output options for [ select_* ] params
$sql_parts = array('select' => array('media_type' => 'mt.mediatypeid'), 'from' => array('media_type' => 'media_type mt'), 'where' => array(), 'group' => array(), 'order' => array(), 'limit' => null);
$def_options = array('nodeids' => null, 'mediatypeids' => null, 'mediaids' => null, 'userids' => null, 'editable' => null, 'filter' => null, 'search' => null, 'startSearch' => null, 'excludeSearch' => null, 'extendoutput' => null, 'output' => API_OUTPUT_REFER, 'select_users' => null, 'select_medias' => null, 'countOutput' => null, 'groupCount' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null);
$options = zbx_array_merge($def_options, $options);
if (!is_null($options['extendoutput'])) {
$options['output'] = API_OUTPUT_EXTEND;
if (!is_null($options['select_users'])) {
$options['select_users'] = API_OUTPUT_EXTEND;
}
if (!is_null($options['select_medias'])) {
$options['select_medias'] = API_OUTPUT_EXTEND;
}
}
// PERMISSION CHECK
if (USER_TYPE_SUPER_ADMIN == $user_type) {
} else {
if (is_null($options['editable']) && $USER_DETAILS['type'] == USER_TYPE_ZABBIX_ADMIN) {
} else {
if (!is_null($options['editable']) || $USER_DETAILS['type'] != USER_TYPE_SUPER_ADMIN) {
return array();
}
}
}
// nodeids
$nodeids = !is_null($options['nodeids']) ? $options['nodeids'] : get_current_nodeid();
// mediatypeids
if (!is_null($options['mediatypeids'])) {
zbx_value2array($options['mediatypeids']);
$sql_parts['where'][] = DBcondition('mt.mediatypeid', $options['mediatypeids']);
if (!$nodeCheck) {
$nodeCheck = true;
$sql_parts['where'][] = DBin_node('mt.mediatypeid', $nodeids);
}
}
// mediaids
if (!is_null($options['mediaids'])) {
zbx_value2array($options['mediaids']);
if ($options['output'] != API_OUTPUT_SHORTEN) {
$sql_parts['select']['mediaid'] = 'm.mediaid';
}
$sql_parts['from']['medias'] = 'medias m';
$sql_parts['where'][] = DBcondition('m.mediaid', $options['mediaids']);
$sql_parts['where']['mmt'] = 'm.mediatypeid=mt.mediatypeid';
if (!$nodeCheck) {
$nodeCheck = true;
$sql_parts['where'][] = DBin_node('m.mediaid', $nodeids);
}
}
// userids
if (!is_null($options['userids'])) {
zbx_value2array($options['userids']);
if ($options['output'] != API_OUTPUT_SHORTEN) {
$sql_parts['select']['userid'] = 'm.userid';
}
$sql_parts['from']['medias'] = 'medias m';
$sql_parts['where'][] = DBcondition('m.userid', $options['userids']);
$sql_parts['where']['mmt'] = 'm.mediatypeid=mt.mediatypeid';
if (!$nodeCheck) {
$nodeCheck = true;
$sql_parts['where'][] = DBin_node('m.userid', $nodeids);
}
}
// node check !!!!!
// should last, after all ****IDS checks
if (!$nodeCheck) {
$nodeCheck = true;
$sql_parts['where'][] = DBin_node('mt.mediatypeid', $nodeids);
}
// filter
//.........这里部分代码省略.........
示例15: intval
* $Id$
*
* @package Mediboard
* @subpackage System
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CCanDo::checkRead();
// Minute courante
$time = CMbDT::time();
$minute = intval(CMbDT::transform($time, null, "%M"));
$hour = intval(CMbDT::transform($time, null, "%H"));
// Opératue de l'envoi
$user = new CUser();
$user->user_username = CValue::get("username", CUser::get()->user_username);
$user->user_password = CValue::get("password");
if (!$user->user_password) {
CAppUI::stepMessage(UI_MSG_WARNING, "CViewSender-send-no-password");
}
// Chargement des senders
$sender = new CViewSender();
$where = array("active" => "= '1'");
/** @var CViewSender[] $senders */
$senders = $sender->loadList($where, "name");
// Envoi de vues
foreach ($senders as $_sender) {
$_sender->makeUrl($user);
if (!$_sender->getActive($minute, $hour)) {
unset($senders[$_sender->_id]);
continue;