本文整理汇总了PHP中admin函数的典型用法代码示例。如果您正苦于以下问题:PHP admin函数的具体用法?PHP admin怎么用?PHP admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: p_quickedit_html
function p_quickedit_html($id)
{
if (admin()) {
return "<a style='z-index:9000' target=_blank href=admin/edit/pages/content/{$id}><img style='z-index:9000' src=images/edit.png></a>";
}
return "";
}
示例2: login
public function login()
{
$login = parent::getLogin();
$password = parent::getPassword();
$identity = new AdminIdentity($login, $password);
$identity->authenticate();
switch ($identity->errorCode) {
case AdminIdentity::ERROR_USERNAME_INVALID:
case AdminIdentity::ERROR_PASSWORD_INVALID:
$this->addError('login', Yii::t('backend', 'Аккаунт не найден.'));
break;
case AdminIdentity::ERROR_STATUS_BANNED:
$this->addError('login', Yii::t('backend', 'Аккаунт забанен.'));
break;
case AdminIdentity::ERROR_STATUS_INACTIVE:
$this->addError('login', Yii::t('backend', 'Аккаунт не активирован.'));
break;
case AdminIdentity::ERROR_STATUS_IP_NO_ACCESS:
$this->addError('login', Yii::t('backend', 'Доступ к аккаунту для вашего IP запрещён.'));
break;
default:
$duration = 3600 * 24 * 7;
// 7 days
admin()->login($identity, $duration);
return TRUE;
}
return FALSE;
}
示例3: page_by_title
function page_by_title($title, $edit = false)
{
$ret = db_fetch_object(db_query("SELECT * FROM pages WHERE short='%s' LIMIT 1", $title));
if ($edit && admin()) {
$ret->content = p_quickedit_html($ret->id) . $ret->content;
}
return $ret->content;
}
示例4: isAdmin
public function isAdmin()
{
if (sys()->isSapcms1()) {
return admin();
} else {
return null;
}
}
示例5: imagenes
function imagenes($print = true)
{
$data = admin(false) . '/assets/images';
if ($print) {
echo $data;
} else {
return $data;
}
}
示例6: store
public function store()
{
$this->validate($this->request(), $rules = array('title' => 'required|max:255', 'description' => 'required', 'content' => 'required|min:10'), $message = ['title.required' => '请填写标题', 'title.max' => '标题太长', 'description.required' => '描述不能为空', 'content.required' => '文章内容不能为空', 'content.min' => '文章内容太短'], $customAttributes = []);
$form = $this->request()->all();
$form['admin_id'] = admin()->admin_id;
if ($model = with(new $this->model())->create($form)) {
return $this->success('添加成功', $model);
}
return $this->error('添加失败');
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
return redirect()->guest('login');
} else {
if (!admin()) {
return redirect()->back();
}
}
return $next($request);
}
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest() || admin()->admin_role != AdminEnum::ROLE_SUPERADMIN) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
abort(404);
}
}
return $next($request);
}
示例9: mcs_CreateAccount
function mcs_CreateAccount($params)
{
$serviceid = $params["serviceid"];
$pid = $params["pid"];
$producttype = $params["producttype"];
$domain = $params["domain"];
$username = $params["username"];
$password = $params["password"];
$clientsdetails = $params["clientsdetails"];
$customfields = $params["customfields"];
$configoptions = $params["configoptions"];
$clientid = $params["userid"];
$configoption1 = $params["configoption1"];
$configoption2 = $params["configoption2"];
$configoption3 = $params["configoption3"];
$configoption4 = $params["configoption4"];
$params["admin"] = admin();
$server = $params["server"];
$serverid = $params["serverid"];
$serverip = $params["serverip"];
$serverusername = $params["serverusername"];
$serverpassword = $params["serverpassword"];
$serveraccesshash = $params["serveraccesshash"];
$serversecure = $params["serversecure"];
$json = json_encode($params);
$json = json_decode($json);
$ip = $json->customfields;
foreach ($ip as $j => $v) {
$ipaddr = $v;
}
$hasil = json_encode(_getclientsproducts($clientid, $serviceid, $pid));
$billingcycle = _get_order_duration_months(json_decode($hasil)->products->product[0]->billingcycle);
$data = array('api_key' => apikey(), 'ip' => $ipaddr, 'pname' => $configoption1, 'billingcycle' => $billingcycle);
$buatorder = Mcs::exec('order', 'addorder', http_build_query($data));
if ($buatorder->result == 'success') {
$result = 'success';
} else {
$result = "error";
}
return $result;
}
示例10: author_delete
function author_delete()
{
require_privs('admin.edit');
$user_id = assert_int(ps('user_id'));
$name = fetch('Realname', 'txp_users', 'user_id', $user_id);
if ($name) {
$rs = safe_delete('txp_users', "user_id = {$user_id}");
if ($rs) {
admin(gTxt('author_deleted', array('{name}' => $name)));
}
}
}
示例11: formAddChannels
function formAddChannels($form, $table, $column)
{
if (getOption('channels')) {
if (admin()) {
$form->set_field(array('name' => 'channels', 'type' => 'checkboxes', 'label' => getString('channels_label'), 'option_title' => 'title' . langExt(), 'options_table' => 'channels', 'linking_table' => $table . '_to_channels', 'object_id' => $column, 'option_id' => 'channel_id', 'default' => 'all'));
} else {
$form->set_field(array('name' => 'channels', 'type' => 'checkboxes', 'label' => getString('channels_label'), 'sql' => 'SELECT id, title' . langExt() . ' FROM channels WHERE is_active = 1 AND is_private = 0 ORDER BY title', 'default' => 'all'));
}
}
}
示例12: showNewsId
function showNewsId($news, $db)
{
foreach ($news as $i => $row) {
if ($i > 0) {
//if repeating news (because of tags)
echo " <a href=\"./?tag=" . $row['tagname'] . "\">#" . $row['tagname'] . "</a>";
} else {
echo "<div class=\"noticia\" id=" . $row['id'] . ">";
if (loggedIn()) {
//favorites
if (hasFavorite($row['id'], $db)) {
echo "<div class=\"del_favorite\" id=\"" . $row['id'] . "\"><img width=\"30px\" src=\"common/star_filled.png\">";
} else {
echo "<div class=\"add_favorite\" id=\"" . $row['id'] . "\"><img width=\"30px\" src=\"common/star_empty.png\">";
}
echo "</div>";
}
echo "<h3>" . stripslashes($row['title']) . "</h3>\n\t\t\t\t<img src=\"http://lorempixel.com/300/200/\" alt=\"300x200\">\t\t\t\t\n\t\t\t\t<div class=\"newsbody\">" . nl2br(stripslashes($row['text'])) . "</div>\n\t\t\t\t<div class=\"newsdetails\">\n\t\t\t\t<br />";
if (!empty($row['url'])) {
//display URL if news is imported
echo "<b>URL original:</b> <a target=\"_blank\" href=\"" . stripslashes($row['url']) . "\">" . $row['url'] . "</a><br>";
}
echo "<b>Submetida por:</b> " . getUserProfileLink($row['posted_by'], $db) . "<br>";
if (!empty($row['imported_by'])) {
echo "<b>Importada por:</b> " . getUserProfileLink($row['imported_by'], $db) . "<br>";
}
echo displayDate($row['date']);
if ($row['tagname'] != "") {
echo "</div><div class=\"newstags\"><a href=\"./?tag=" . stripslashes($row['tagname']) . "\">#" . stripslashes($row['tagname']) . "</a>";
}
//first tag (close news details and start tags div)
}
if (++$i == sizeof($news)) {
//if next row is the end
echo "</div>";
echo "<div class=comment" . $row['id'] . "><h2>Comentários:</h2><div id=comments_server></div>";
echo "</div>";
if (isset($_SESSION['user_id'])) {
echo "<div id=new_comment><textarea id=textarea_new_comment rows=4 placeholder=\"Novo Comentário...\"/></textarea><br><input id=send_comment type=button value=\"Enviar Comentário\"></div>";
}
if (loggedIn() && (editor() || admin())) {
echo "<ul>";
echo "<li><a href=./>Ver Todas</a></li>";
if (loggedIn() && (admin() || editor() && ($_SESSION['username'] == $row['posted_by'] || $_SESSION['username'] == $row['imported_by']))) {
echo "<li><a href=\"editar_noticia.php?id=" . $row['id'] . "\">Editar</a></li><li><a href=\"apagar_noticia.php?id=" . $row['id'] . "\">Apagar</a></li>";
}
echo "<li style=\"border:0;\"></li>";
//display full height <ul>
echo "</ul>";
}
echo "</div>";
}
}
}
示例13: show_admin
function show_admin($dir)
{
// Execute Admin Action
$pwd = ($GLOBALS["permissions"] & 2) == 2;
$admin = ($GLOBALS["permissions"] & 4) == 4;
if (!$GLOBALS["require_login"]) {
show_error($GLOBALS["error_msg"]["miscnofunc"]);
}
if (!$pwd && !$admin) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (isset($GLOBALS['__GET']["action2"])) {
$action2 = $GLOBALS['__GET']["action2"];
} elseif (isset($GLOBALS['__POST']["action2"])) {
$action2 = $GLOBALS['__POST']["action2"];
} else {
$action2 = "";
}
switch ($action2) {
case "chpwd":
changepwd($dir);
break;
case "adduser":
if (!$admin) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
adduser($dir);
break;
case "edituser":
if (!$admin) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
edituser($dir);
break;
case "rmuser":
if (!$admin) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
removeuser($dir);
break;
default:
admin($admin, $dir);
}
}
示例14: standardowy_przycisk
if (zalogowany()) {
echo "<a class='navbar-brand' href='index.php?v=tresc/strona_glowna'><img src='img/logo.png'></a>";
} else {
echo "<a class='navbar-brand' href='index.php'><img src='img/logo.png'></a>";
}
?>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<?php
// jeśli zalogowano, wyświetlamy inne menu
if (zalogowany()) {
standardowy_przycisk("?v=tresc/panele_userow/panel_glowny", "<b>{$_SESSION['imie']} {$_SESSION['nazwisko']}</b>");
// jeśli zalogowano jako admin lub nauczyciel, to wyświetlamy przycisk z zarządzniem kursami
if (admin() || nauczyciel()) {
standardowy_przycisk("?v=tresc/panele_userow/panel_glowny&prawa=tresc/panele_userow/nauczyciel/n_lista_kursow", "Zarządzanie kursami", 0);
} else {
standardowy_przycisk("?v=tresc/u_kursy/lista_kursow_uzytkownika", "Moje kursy");
}
standardowy_przycisk("tresc/logowanie/wyloguj.php?wyloguj=tak", "Wyloguj");
} else {
standardowy_przycisk("?v=tresc/logowanie/logowanie", "Logowanie");
standardowy_przycisk("index.php?v=tresc/rejestracja/rejestracja", "Rejestracja");
}
?>
<!--<li><a href="index.php" class=""></a></li> -->
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
示例15: tumb
if ($_GET['topic']) {
include 'login_status.php';
require_once 'csign.php';
$verified_corner_name = "";
$verified_room = "";
$verified_corner_name_1 = "";
if (login_check($mysqli) == true) {
if (isset($_SESSION['u_ID'], $_SESSION['u_name'], $_SESSION['u_email'], $_SESSION['xploded_u_email'], $_SESSION['login_string'])) {
$u_ID = $_SESSION['u_ID'];
$xploded_u_email = $_SESSION['xploded_u_email'];
$u_email = $_SESSION['u_email'];
$u_name = $_SESSION['u_name'];
$flag_options = "logged";
include 'infogiver.php';
$tumb_array = tumb();
$admin_array = admin("true");
$nav = navbar_info();
}
}
include_once "infogiver.php";
$config['topic_id'] = intval($_GET['topic']);
$config['start'] = -10;
$config['end'] = 0;
if ($topic_array = topic_info_single_non($config)) {
//print_r($topic_array);
} else {
if ($topic_array[0]['topic_id'] == '') {
header("location:404.html");
}
}
}