本文整理汇总了PHP中auth类的典型用法代码示例。如果您正苦于以下问题:PHP auth类的具体用法?PHP auth怎么用?PHP auth使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了auth类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show($condition = '')
{
$sql = "SELECT * FROM " . DB_PREFIX . "bill_record WHERE 1 " . $condition;
$q = $this->db->query($sql);
$data = array();
$user_id_array = array();
$user_id = $space = '';
$bill_id = 0;
//目前取记录,根据某个订单的来检索
include_once CUR_CONF_PATH . 'lib/bill.class.php';
$this->bill = new bill();
while ($row = $this->db->fetch_array($q)) {
$checkbool = $row['bill_id'] ? $this->bill->checkLocked($row['bill_id']) : 0;
$row['locked'] = $checkbool ? 1 : 0;
if ($row['user_id']) {
$user_id_array[$row['user_id']] = $row['user_id'];
}
$data[] = $row;
}
if ($user_id_array) {
$user_id = implode(',', $user_id_array);
include_once ROOT_PATH . 'lib/class/auth.class.php';
$auth = new auth();
$tmp = $auth->getMemberById($user_id);
$user_info = array();
foreach ($tmp as $k => $v) {
$user_info[$v['id']] = $v['user_name'];
}
foreach ($data as $k => $v) {
$data[$k]['user_name'] = $user_info[$v['user_id']];
}
}
return $data;
}
示例2: logout
/**
*/
public function logout()
{
if ($access_token = $this->input['access_token']) {
$data['access_token'] = $access_token;
} else {
$this->errorOutput(NO_ACCESS_TOKEN);
}
$Members = new members();
$device_token = $Members->check_device_token(trim($this->input['device_token']));
$udid = $Members->check_udid(trim($this->input['uuid']));
if ($device_token === 0) {
$this->errorOutput(ERROR_DEVICE_TOKEN);
}
if ($udid === 0) {
$this->errorOutput(ERROR_UDID);
}
$auth = new auth();
$logoutInfo = $auth->logout($data);
//会员痕迹
$member_trace_data = array('member_id' => $logoutInfo['user_id'], 'member_name' => $logoutInfo['user_name'], 'content_id' => $logoutInfo['user_id'], 'title' => $logoutInfo['user_name'], 'type' => 'logout', 'op_type' => '退出', 'appid' => $logoutInfo['appid'], 'appname' => $logoutInfo['display_name'], 'create_time' => TIMENOW, 'ip' => hg_getip(), 'device_token' => $device_token, 'udid' => $udid);
$mMember = new member();
$mMember->member_trace_create($member_trace_data);
$_logoutInfo = array('member_id' => $logoutInfo['user_id'], 'member_name' => $logoutInfo['user_name'], 'is_member' => $logoutInfo['is_member'], 'logout' => $logoutInfo['logout']);
$this->addItem($_logoutInfo);
$this->output();
}
示例3: detail
public function detail()
{
$id = $this->input['id'];
if ($id) {
$info = $this->obj->get_db_first($id);
$db_relation = $this->obj->get_relation($id);
}
//获取支持全文检索的应用模块
include_once ROOT_PATH . 'lib/class/auth.class.php';
$auth = new auth();
$app = $auth->get_app('', '', '', 0, 1000, array('use_textsearch' => 1));
if ($app && is_array($app)) {
foreach ($app as $k => $v) {
$appid[] = $v['bundle'];
$module = $auth->get_module('', '', implode(',', $appid), '', 0, 1000);
}
}
$result['info'] = $info;
$result['app'] = $app;
$result['module'] = $module;
$result['db_relation'] = $db_relation;
// print_r($result);exit;
$this->addItem($result);
$this->output();
}
示例4: show
public function show()
{
$uniqueid = '';
$appname = $record = array();
$offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
$count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 1000;
include_once ROOT_PATH . 'lib/class/auth.class.php';
$auth = new auth();
$app = $auth->get_app('', '', '', 0, 1000, array('use_textsearch' => 1));
if ($app && is_array($app)) {
foreach ($app as $k => $v) {
$appid[] = $v['bundle'];
$module = $auth->get_module('', '', implode(',', $appid), '', 0, 1000);
}
}
if (is_array($module)) {
foreach ($module as $k => $v) {
$module_idarr[] = $v['mod_uniqueid'];
}
$all_relation = $this->obj->get_relation_by_m(implode("','", $module_idarr));
// print_r($all_relation);exit;
foreach ($module as $k => $v) {
$server_count[$v['app_uniqueid']][$v['mod_uniqueid']] = count($all_relation[$v['app_uniqueid']][$v['mod_uniqueid']]);
}
}
$result['app'] = $app;
$result['module'] = $module;
$result['server_count'] = $server_count;
$this->addItem($result);
$this->output();
}
示例5: insert
function insert($data, $param)
{
$user = new auth();
for ($i = 0; $i < sizeof($param); $i++) {
$data[$param[$i]] = $user->get($param[$i]);
}
db::dbs($GLOBALS['db_name'])->collection("class_blog")->insert($data);
}
示例6: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$username = request_var('username', '', true);
$email = strtolower(request_var('email', ''));
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_EMAIL_USER');
}
if ($user_row['user_type'] == USER_IGNORE) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] == USER_INACTIVE) {
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
trigger_error('ACCOUNT_DEACTIVATED');
} else {
trigger_error('ACCOUNT_NOT_ACTIVATED');
}
}
// Check users permissions
$auth2 = new auth();
$auth2->acl($user_row);
if (!$auth2->acl_get('u_chgpasswd')) {
trigger_error('NO_AUTH_PASSWORD_REMINDER');
}
$server_url = generate_board_url();
$key_len = 54 - strlen($server_url);
$key_len = max(6, $key_len);
// we want at least 6
$key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len;
// we want at most $config['max_pass_chars']
$user_actkey = substr(gen_rand_string(10), 0, $key_len);
$user_password = gen_rand_string(8);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
$db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('user_activate_passwd', $user_row['user_lang']);
$messenger->to($user_row['user_email'], $user_row['username']);
$messenger->im($user_row['user_jabber'], $user_row['username']);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send($user_row['user_notify_type']);
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
$message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
trigger_error($message);
}
$template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
$this->tpl_name = 'ucp_remind';
$this->page_title = 'UCP_REMIND';
}
示例7: show
public function show()
{
include_once ROOT_PATH . 'lib/class/auth.class.php';
$auth = new auth();
$apps = $auth->get_app($this->settings['stat_app']);
foreach ($apps as $k => $v) {
$m = array('id' => $v['bundle'], "name" => $v['name'], "fid" => $v['bundle'], "depth" => 1, 'is_last' => 1);
$this->addItem($m);
}
$this->output();
}
示例8: save
function save($name, $filename, $param)
{
//no need to check because in no case will they be executed :p
$user = new auth();
for ($i = 0; $i < sizeof($param); $i++) {
$data[$param[$i]] = $user->get($param[$i]);
}
$data["location"] = $filename;
$data["ip"] = $_SERVER['REMOTE_ADDR'];
db::dbs($GLOBALS['db_name'])->collection("class_upload")->insert($data);
move_uploaded_file($_FILES[$name]["tmp_name"], $GLOBALS['path_uploads'] . $filename);
}
示例9: show
public function show($condition = '')
{
$sql = "SELECT * FROM " . DB_PREFIX . "bill WHERE 1 " . $condition;
$q = $this->db->query($sql);
$data = array();
$user_id = $space = '';
$project_id = $space_second = '';
while ($row = $this->db->fetch_array($q)) {
if ($row['user_id']) {
$user_id .= $space . $row['user_id'];
$space = ',';
}
if ($row['project_id']) {
$project_id .= $space_second . $row['project_id'];
$space_second = ',';
}
$row['cost_capital'] = hg_cny($row['cost']);
$row['advice_capital'] = hg_cny($row['advice']);
$data[] = $row;
}
if ($user_id) {
include_once ROOT_PATH . 'lib/class/auth.class.php';
$auth = new auth();
$tmp = $auth->getMemberById($user_id);
$user_info = array();
foreach ($tmp as $k => $v) {
$user_info[$v['id']] = $v['user_name'];
}
}
if ($project_id) {
include_once CUR_CONF_PATH . 'lib/project.class.php';
$project = new project();
$project_info = $tmp = array();
$tmp = $project->show(' AND id IN(' . $project_id . ')');
foreach ($tmp as $k => $v) {
$project_info[$v['id']] = $v['name'];
}
}
foreach ($data as $k => $v) {
if ($user_info) {
$data[$k]['user_name'] = $user_info[$v['user_id']];
}
if ($project_info) {
$data[$k]['project_name'] = $project_info[$v['project_id']];
}
if (!$v['title']) {
$data[$k]['title'] = date('Y-m-d', $v['business_time']) . '-' . $data[$k]['project_name'];
}
}
return $data;
}
示例10: count_files
function count_files($no = 0, $pref = '')
{
// 0:DATA, 1:TB, 2:Referer, 3: DIFF, 4:BKUP, 5:CTR
static $dir = array(DATA_DIR, TRACKBACK_DIR, REFERER_DIR, DIFF_DIR, BACKUP_DIR, COUNTER_DIR);
static $ext = array('.txt', '.txt', '.ref', '.txt', BACKUP_EXT, '.count');
// コンテンツ管理者以上は、全てのファイルを対象にする
if (!auth::check_role('role_adm_contents')) {
$pages = get_existpages($dir[$no], $ext[$no]);
} else {
// 自分が閲覧できるページ数のみ戻す
$pages = auth::get_existpages($dir[$no], $ext[$no]);
}
// 条件なし
if (empty($pref)) {
return count($pages);
}
// 指定文書のカウント
$i = 0;
foreach ($pages as $page) {
if (strpos($page, $pref) === 0) {
$i++;
}
}
return $i;
}
示例11: _show_themed_error_page
/**
* Shows a themed error page.
* @see Kohana_Exception::handle
*/
private static function _show_themed_error_page(Exception $e)
{
// Create a text version of the exception
$error = Kohana_Exception::text($e);
// Add this exception to the log
Kohana_Log::add('error', $error);
// Manually save logs after exceptions
Kohana_Log::save();
if (!headers_sent()) {
if ($e instanceof Kohana_Exception) {
$e->sendHeaders();
} else {
header("HTTP/1.1 500 Internal Server Error");
}
}
$view = new Theme_View("page.html", "other", "error");
if ($e instanceof Kohana_404_Exception) {
$view->page_title = t("Dang... Page not found!");
$view->content = new View("error_404.html");
$user = identity::active_user();
$view->content->is_guest = $user && $user->guest;
if ($view->content->is_guest) {
$view->content->login_form = new View("login_ajax.html");
$view->content->login_form->form = auth::get_login_form("login/auth_html");
// Avoid anti-phishing protection by passing the url as session variable.
Session::instance()->set("continue_url", url::current(true));
}
} else {
$view->page_title = t("Dang... Something went wrong!");
$view->content = new View("error.html");
}
print $view;
}
示例12: plugin_newpage_action
function plugin_newpage_action()
{
global $vars;
$_btn_edit = _('Edit');
$_msg_newpage = _('New page');
// if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
if (auth::check_role('readonly')) {
die_message(_('PKWK_READONLY prohibits editing'));
}
if (auth::is_check_role(PKWK_CREATE_PAGE)) {
die_message(_('PKWK_CREATE_PAGE prohibits editing'));
}
if ($vars['page'] == '') {
$retvars['msg'] = $_msg_newpage;
$retvars['body'] = plugin_newpage_convert();
return $retvars;
} else {
$page = strip_bracket($vars['page']);
if (isset($vars['refer'])) {
$r_page = get_fullname($page, $vars['refer']);
$r_refer = 'refer=' . $vars['refer'];
} else {
$r_page = $page;
$r_refer = '';
}
pkwk_headers_sent();
header('Location: ' . get_page_location_uri($r_page, $r_refer));
exit;
}
}
示例13: plugin_insert_convert
function plugin_insert_convert()
{
global $script, $vars, $digest;
static $numbers = array();
$_btn_insert = _('add');
// if (PKWK_READONLY) return ''; // Show nothing
if (auth::check_role('readonly')) {
return '';
}
// Show nothing
if (!isset($numbers[$vars['page']])) {
$numbers[$vars['page']] = 0;
}
$insert_no = $numbers[$vars['page']]++;
$s_page = htmlspecialchars($vars['page']);
$s_digest = htmlspecialchars($digest);
$s_cols = INSERT_COLS;
$s_rows = INSERT_ROWS;
$string = <<<EOD
<form action="{$script}" method="post">
<div>
<input type="hidden" name="insert_no" value="{$insert_no}" />
<input type="hidden" name="refer" value="{$s_page}" />
<input type="hidden" name="plugin" value="insert" />
<input type="hidden" name="digest" value="{$s_digest}" />
<textarea name="msg" rows="{$s_rows}" cols="{$s_cols}"></textarea><br />
<input type="submit" name="insert" value="{$_btn_insert}" />
</div>
</form>
EOD;
return $string;
}
示例14: plugin_deleted_action
function plugin_deleted_action()
{
global $vars;
$_deleted_plugin_title = _('The list of deleted pages');
$_deleted_plugin_title_withfilename = _('The list of deleted pages (with filename)');
$dir = isset($vars['dir']) ? $vars['dir'] : 'backup';
$withfilename = isset($vars['file']);
$_DIR['diff']['dir'] = DIFF_DIR;
$_DIR['diff']['ext'] = '.txt';
$_DIR['backup']['dir'] = BACKUP_DIR;
$_DIR['backup']['ext'] = BACKUP_EXT;
// .gz or .txt
//$_DIR['cache' ]['dir'] = CACHE_DIR; // No way to delete them via web browser now
//$_DIR['cache' ]['ext'] = '.ref';
//$_DIR['cache' ]['ext'] = '.rel';
if (!isset($_DIR[$dir])) {
return array('msg' => 'Deleted plugin', 'body' => 'No such setting: Choose backup or diff');
}
$deleted_pages = array_diff(auth::get_existpages($_DIR[$dir]['dir'], $_DIR[$dir]['ext']), auth::get_existpages());
if ($withfilename) {
$retval['msg'] = $_deleted_plugin_title_withfilename;
} else {
$retval['msg'] = $_deleted_plugin_title;
}
$retval['body'] = page_list($deleted_pages, $dir, $withfilename);
return $retval;
}
示例15: plugin_ls2_show_lists
function plugin_ls2_show_lists($prefix, &$params)
{
// global $_ls2_err_nopages;
$pages = array();
if ($prefix != '') {
foreach (auth::get_existpages() as $_page) {
if (strpos($_page, $prefix) === 0) {
$pages[] = $_page;
}
}
} else {
$pages = auth::get_existpages();
}
natcasesort($pages);
if ($params['reverse']) {
$pages = array_reverse($pages);
}
foreach ($pages as $page) {
$params['page_ ' . $page] = 0;
}
if (empty($pages)) {
return str_replace('$1', htmlspecialchars($prefix), '<p>' . _("There is no child page in ' \$1'") . '</p>');
} else {
$params['result'] = $params['saved'] = array();
foreach ($pages as $page) {
plugin_ls2_get_headings($page, $params, 1);
}
return join("\n", $params['result']) . join("\n", $params['saved']);
}
}