本文整理汇总了PHP中admit函数的典型用法代码示例。如果您正苦于以下问题:PHP admit函数的具体用法?PHP admit怎么用?PHP admit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了admit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct(&$data, $id, $table, $cols = 'cat,access,author')
{
global $db, $lang;
if ($id) {
$this->old = $db->query('SELECT ' . $cols . ' FROM ' . PRE . $table . ' WHERE ID=' . $id)->fetch(2);
$this->old_cat = $this->old ? $this->old['cat'] : null;
} else {
$this->old_cat =& $data['cat'];
}
//ID, dane
$this->id = $id;
$this->data =& $data;
//Dane istniej±?
if ($this->old_cat !== null) {
$db->beginTransaction();
} else {
throw new Exception($lang['noex']);
}
//Prawa do kategorii
if (!admit($this->data['cat'], 'CAT') || $this->data['cat'] != $this->old_cat && !admit($this->old_cat, 'CAT')) {
throw new Exception($lang['nor']);
//Skoñcz
}
//Autor
if (isset($data['author'])) {
$data['author'] = $this->authorID($data['author']);
}
}
示例2: BugRights
function BugRights($x)
{
global $user;
switch ($x) {
case '':
case NULL:
if (admit('BUGS')) {
return true;
}
break;
case 'ALL':
return true;
break;
case 'LOGD':
if (UID) {
return true;
}
break;
default:
if (UID) {
$r = explode(' ', $x);
if (in_array('U:' . UID, $r) || in_array('LV:' . LEVEL, $r)) {
return true;
}
}
}
return false;
}
示例3: tags
function tags($id, $type, $mayTag = false)
{
global $db, $cfg, $view;
$may = admit('TAG');
$url = url('tags/');
$tag = array();
$res = $db->prepare('SELECT tag,num FROM ' . PRE . 'tags WHERE ID=? AND TYPE=? GROUP BY tag ORDER BY tag');
$res->execute(array($id, $type));
foreach ($res as $x) {
$tag[] = array('tag' => $x['tag'], 'url' => $url . $x['tag'], 'num' => $x['num']);
}
if ($tag || $may) {
$view->add('tag', array('tag' => $tag, 'editTags' => $may, 'urls' => "['{$url}','request.php?go=tags&type={$type}&id={$id}']"));
}
}
示例4: header
<?php
if (iCMSa != 1 || !admit('DB')) {
exit;
}
require LANG_DIR . 'admAll.php';
#Page title
$view->title = $lang['dbcopy'];
#Supported databases
switch ($db_db) {
case 'mysql':
$type = 'mysql';
$show = 'SHOW TABLES';
break;
case 'sqlite':
$type = 'sqlite';
$show = 'SELECT name FROM sqlite_master WHERE type="table" ORDER BY name';
break;
default:
$view->info('Cannot parse database type.');
return 1;
}
#Action: tables
if (isset($_POST['tab'])) {
$n = "\n";
@set_time_limit(50);
#Use gzip
if (isset($_POST['gz'])) {
header('Content-type: application/x-gzip');
$ex = '.sql.gz';
} else {
示例5: AND
$cats = 'cat=' . $d;
}
#Subcategories
if ($cat['opt'] & 8) {
$res = $db->query('SELECT ID,name,dsc,nums FROM ' . PRE . 'cats WHERE sc=' . $cat['ID'] . ' AND (access=1 OR access="' . LANG . '") ORDER BY name');
$res->setFetchMode(3);
foreach ($res as $c) {
$sc[] = array('url' => url($c[0]), 'name' => $c[1], 'desc' => $c[2], 'num' => $c[3]);
}
}
#If empty and have privileges
if ($cat['num'] == '0' && empty($sc) && admit($d, 'CAT')) {
header('Location: ' . URL . url('edit/' . $cat['type']));
}
#Prepare template
$data = array('cat' => &$cat, 'edit' => admit('C') ? url('editCat/' . $d, 'ref', 'admin') : null, 'add' => url('edit/' . $cat['type'], 'catid=' . $d), 'list' => url('list/' . $cat['type'] . '/' . $d), 'subcats' => isset($sc) ? $sc : null, 'options' => admit($d, 'CAT'));
#Category path
if ($cat['opt'] & 1 && isset($cfg['catStr'])) {
$view->nav = catPath($d, $cat);
$data['path'] = catPath($d, $cat);
} else {
$view->nav = null;
$data['path'] = null;
}
#Load item list generator - TODO: improve
if ($cat['num']) {
$view->add('cat', $data);
include './mod/cat/' . $cat['type'] . '.php';
} else {
$data['type'] = $lang['cats'];
$data['cats'] = url('cats');
示例6: unset
case '4':
(require './mod/edit/link.php') or $view->set404();
break;
case 'gallery':
(require './mod/edit/photos.php') or $view->set404();
break;
default:
if (file_exists('./mod/edit/' . $TYPE . '.php')) {
(require './mod/edit/' . $TYPE . '.php') or $view->set404();
} else {
return;
}
}
unset($_POST);
return 1;
}
#Tytul
$view->title = $lang['mantxt'];
#Ostatni komentarz
if (admit('CM') && ($c = $db->query('SELECT name,date,text FROM ' . PRE . 'comms ORDER BY ID DESC LIMIT 1')->fetch(3))) {
if (isset($cfg['bbcode'])) {
require_once './lib/bbcode.php';
$c[2] = BBCode($c[2]);
}
$last = array('title' => $c[0], 'date' => genDate($c[1], 1), 'text' => emots($c[2]), 'color' => isset($cfg['colorCode']));
} else {
$last = array();
}
#Wolne strony
$view->add('content', array('comment' => &$last, 'page' => admit('P') ? url('editPage', '', 'admin') : null, 'pages' => admit('P') ? url('pages', '', 'admin') : null));
示例7: switch
<?php
if (iCMSa != 1 || !admit('BUGADM')) {
exit;
}
#Language
if (file_exists('./plugins/bugs/lang/adm' . LANG . '.php')) {
require './plugins/bugs/lang/adm' . LANG . '.php';
} else {
require './plugins/bugs/lang/en.php';
}
#Template folders
$view->dir = './plugins/bugs/style/';
$view->cache = './cache/bugs/';
$view->title = $lang['tracker'];
if (isset($URL[1])) {
switch ($URL[1]) {
case 'sections':
require 'plugins/bugs/admSect.php';
break;
case 'config':
require 'plugins/bugs/admCfg.php';
break;
case 'edit':
require 'plugins/bugs/admEdit.php';
break;
default:
return;
}
} else {
require 'plugins/bugs/admCats.php';
示例8: url
$sort = 'name';
break;
case '5':
$sort = 'rate DESC, ID DESC';
break;
default:
$sort = 'ID DESC';
}
#Zacznij od...
if ($st != 0) {
$st = ($page - 1) * $cfg['inp'];
}
#Odczyt
$res = $db->query('SELECT ID,name,date,th FROM ' . PRE . 'imgs WHERE ' . $cats . ' AND access=1 ORDER BY priority,' . $sort . ' LIMIT ' . $st . ',' . $cfg['inp']);
$res->setFetchMode(3);
$total = 0;
$url = url('img/');
$img = array();
#Lista
foreach ($res as $x) {
$img[] = array('num' => ++$total, 'title' => $x[1], 'src' => $x[3], 'url' => $url . $x[0], 'date' => genDate($x[2]));
}
#Strony
if ($cat['num'] > $total) {
$pages = pages($page, $cat['num'], $cfg['inp'], url($d), 0, '/');
} else {
$pages = null;
}
#Do szablonu
$view->add('cat_images', array('pages' => &$pages, 'image' => &$img, 'add' => admit($d, 'CAT') ? url('edit/3') : null, 'cats' => url(isset($cfg['allCat']) ? 'cats' : 'cats/images'), 'type' => isset($cfg['allCat']) ? $lang['cats'] : $lang['imgs']));
unset($res, $total, $x);
示例9: RenderMenu
<?php
if (iCMSa != 1 || !admit('CFG')) {
exit;
}
#Update links
if (isset($_SESSION['renew'])) {
try {
require './lib/mcache.php';
require './lib/categories.php';
RenderMenu();
Latest();
RSS();
if (function_exists('glob') && ($glob = glob('cache/cat*.php'))) {
foreach ($glob as $x) {
unlink($x);
}
}
unset($_SESSION['renew'], $glob, $x);
include './admin/config.php';
return 1;
} catch (Exception $e) {
$view->info($lang['saved']);
}
}
#Save
if ($_POST) {
$opt = array('url' => $_POST['url'], 'path' => $_POST['path'], 'nice' => (int) $_POST['nice']);
require './lib/config.php';
$f = new Config('db');
try {
示例10: AND
<?php
if (iCMS != 1) {
exit;
}
#Rights
if (admit('BUGS')) {
$rights = 1;
} else {
$rights = 0;
}
#Get issue - FETCH_ASSOC
$bug = $db->query('SELECT b.*, c.name as catName, c.rate FROM ' . PRE . 'bugs b INNER JOIN ' . PRE . 'bugcats c ON b.cat = c.ID WHERE b.ID=' . $id . ' AND (c.see=1 OR c.see="' . LANG . '")')->fetch(2);
#Page title
$view->title = $bug['name'];
#Does not exist
if (!$bug) {
$view->set404();
return;
}
#Not approved
if ($bug['status'] == 5 && $bug['who'] != UID && !$rights) {
header('Location: ' . URL . url('bugs'));
return;
}
#BBCode
if (isset($cfg['bbcode'])) {
require 'lib/bbcode.php';
$bug['text'] = BBCode($bug['text']);
}
#Date, author
示例11: join
$view->info('<ul><li>' . join('</li><li>', $error) . '</li></ul>');
} else {
try {
if ($id) {
$q = $db->prepare('UPDATE ' . PRE . 'users SET login=:login, mail=:mail,
sex=:sex, about=:about, www=:www, city=:city, icq=:icq, skype=:skype,
tlen=:tlen, jabber=:jabber, gg=:gg, photo=:photo WHERE ID=' . $id);
} else {
$u['pass'] = md5($_POST['pass']);
$u['regt'] = $_SERVER['REQUEST_TIME'];
$q = $db->prepare('INSERT INTO ' . PRE . 'users
(login,pass,mail,sex,regt,about,www,city,icq,skype,tlen,jabber,gg,photo) VALUES
(:login,:pass,:mail,:sex,:regt,:about,:www,:city,:icq,:skype,:tlen,:jabber,:gg,:photo)');
}
$q->execute($u);
$view->info($lang['upd'], array(url('user/' . urlencode($u['login'])) => $u['login']));
return 1;
} catch (PDOException $e) {
$view->info($lang['error'] . $e);
}
}
} elseif ($id) {
if (!($u = $db->query('SELECT * FROM ' . PRE . 'users WHERE ID=' . $id)->fetch(2))) {
return;
}
} else {
$u = array('login' => '', 'mail' => '', 'sex' => 1, 'about' => '', 'www' => 'http://', 'city' => '', 'icq' => '', 'skype' => '', 'tlen' => '', 'jabber' => '', 'gg' => '', 'photo' => '');
}
#Prepare template
$view->add('editUser', array('u' => &$u, 'url' => url('editUser/' . $id, '', 'admin'), 'pass' => !$id, 'bbcode' => isset($cfg['bbcode']), 'fileman' => admit('FM')));
示例12: emots
#Page title
$view->title = $news['name'];
#Emoticons
if ($news['opt'] & 2) {
$news['txt'] = emots($news['txt']);
if ($full) {
$full = emots($full);
}
}
#Line breaks
if ($news['opt'] & 1) {
$news['txt'] = nl2br($news['txt']);
if ($full) {
$full = nl2br($full);
}
}
#Date, author
$news['date'] = genDate($news['date'], true);
$news['wrote'] = autor($news['author']);
#Assign to template
$view->add('news', array('news' => &$news, 'full' => &$full, 'path' => catPath($news['cat']), 'edit' => admit($news['cat'], 'CAT') ? url('edit/5/' . $id, 'ref') : false, 'root' => isset($cfg['allCat']) ? $lang['cats'] : $lang['news'], 'cats' => url(isset($cfg['allCat']) ? 'cats' : 'cats/news')));
#Tags
if (isset($cfg['tags'])) {
include './lib/tags.php';
tags($id, 5);
}
#Comments
if (isset($cfg['ncomm']) && $news['catOpt'] & 2) {
require './lib/comm.php';
comments($id, 5);
}
示例13: array
<?php
if (iCMSa != 1 || !admit('U')) {
exit;
}
require LANG_DIR . 'rights.php';
#Get all privileged users - FETCH_NUM
$res = $db->query('SELECT ID,login,lv,adm FROM ' . PRE . 'users WHERE lv>1 OR adm!=""');
$res->setFetchMode(3);
#Info, links
$view->info($lang['iadms'], array(url('editUser', '', 'admin') => $lang['addUser']));
#Page title
$view->title = $lang['admins'];
#Init variables
$num = 0;
$adms = array();
foreach ($res as $adm) {
switch ($adm[2]) {
case '0':
$lv = $lang['locked'];
break;
case '1':
$lv = $lang['user'];
break;
case '2':
$lv = $lang['editor'];
break;
case '3':
$lv = $lang['admin'];
break;
case '4':
示例14: catch
} catch (Exception $e) {
$view->info($e->getMessage());
}
} else {
if ($id) {
$news = $db->query('SELECT n.*,f.text FROM ' . PRE . 'news n LEFT JOIN ' . PRE . 'newstxt f ON n.ID=f.ID WHERE n.ID=' . $id)->fetch(2);
$full =& $news['text'];
#Verify privileges
if (!$news || !admit($news['cat'], 'CAT', $news['author'])) {
return;
}
} else {
$news = array('cat' => $lastCat, 'name' => '', 'txt' => '', 'access' => 1, 'img' => '', 'opt' => 3);
$full = '';
}
}
#Checkbox fields
$news['br'] = $news['opt'] & 1;
$news['emo'] = $news['opt'] & 2;
$news['fn'] = $news['opt'] & 4;
#JavaScript editor
if (isset($cfg['wysiwyg']) && is_dir('plugins/editor')) {
$view->script('plugins/editor/loader.js');
} else {
$view->script(LANG_DIR . 'edit.js');
$view->script('cache/emots.js');
$view->script('lib/editor.js');
}
#Template
$view->add('edit_news', array('news' => &$news, 'full' => &$full, 'id' => $id, 'cats' => Slaves(5, $news['cat']), 'fileman' => admit('FM')));
示例15: isset
}
#Post ID
$id = isset($URL[2]) && is_numeric($URL[2]) ? $URL[2] : 0;
#Page title
$view->title = $id ? $lang['editPost'] : $lang['sign'];
#Skrypty - BBCode
if (isset($cfg['bbcode'])) {
$view->script(LANG_DIR . 'edit.js');
$view->script('cache/emots.js');
$view->script('lib/editor.js');
}
#Błędy
$error = array();
$preview = null;
#Cannot post
if ($id && !admit('GB')) {
$error[] = $lang['mayNot'];
} elseif (!$id) {
if (empty($cfg['gbPost'])) {
$error[] = $lang['disabled'];
} elseif (!UID && $cfg['gbPost'] == 2) {
$error[] = $lang['mustLogin'];
}
}
#CAPTCHA
if (!UID && !empty($cfg['captcha']) && !isset($_SESSION['human'])) {
require './lib/spam.php';
$noSPAM = CAPTCHA();
} else {
$noSPAM = false;
}