当前位置: 首页>>代码示例>>PHP>>正文


PHP IsAdmin函数代码示例

本文整理汇总了PHP中IsAdmin函数的典型用法代码示例。如果您正苦于以下问题:PHP IsAdmin函数的具体用法?PHP IsAdmin怎么用?PHP IsAdmin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IsAdmin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MustBeAdmin

/**
 * print an error and die if the user is not logged in or is not an admin
 * @param string $errortext error text to be printed 
 */
function MustBeAdmin()
{
    MustLogIn();
    if (!IsAdmin()) {
        bw_error("Only for admins!");
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:11,代码来源:rights.php

示例2: startTorrentClient

 /**
  * starts a bittorrent-client
  * @param $torrent name of the torrent
  * @param $interactive (1|0) : is this a interactive startup with dialog ?
  */
 function startTorrentClient($torrent, $interactive)
 {
     // do tornado special-pre-start-checks
     // check to see if the path to the python script is valid
     if (!is_file($this->cfg["btclient_tornado_bin"])) {
         AuditAction($this->cfg["constants"]["error"], "Error  Path for " . $this->cfg["btclient_tornado_bin"] . " is not valid");
         if (IsAdmin()) {
             $this->status = -1;
             header("location: admin.php?op=configSettings");
             return;
         } else {
             $this->status = -1;
             $this->messages .= "<b>Error</b> TorrentFlux settings are not correct (path to python script is not valid) -- please contact an admin.<br>";
             return;
         }
     }
     // prepare starting of client
     parent::prepareStartTorrentClient($torrent, $interactive);
     // prepare succeeded ?
     if ($this->status != 2) {
         $this->status = -1;
         $this->messages .= "<b>Error</b> parent::prepareStartTorrentClient(" . $torrent . "," . $interactive . ") failed<br>";
         return;
     }
     // build the command-string
     $skipHashCheck = "";
     if (!empty($this->skip_hash_check) && getTorrentDataSize($torrent) > 0) {
         $skipHashCheck = " --check_hashes 0";
     }
     $this->command = $this->runtime . " " . $this->sharekill_param . " " . $this->cfg["torrent_file_path"] . $this->alias . ".stat " . $this->owner . " --responsefile '" . $this->cfg["torrent_file_path"] . $this->torrent . "' --display_interval 5 --max_download_rate " . $this->drate . " --max_upload_rate " . $this->rate . " --max_uploads " . $this->maxuploads . " --minport " . $this->port . " --maxport " . $this->maxport . " --rerequest_interval " . $this->rerequest . " --super_seeder " . $this->superseeder . " --max_initiate " . $this->maxcons . $skipHashCheck;
     if (file_exists($this->cfg["torrent_file_path"] . $this->alias . ".prio")) {
         $priolist = explode(',', file_get_contents($this->cfg["torrent_file_path"] . $this->alias . ".prio"));
         $priolist = implode(',', array_slice($priolist, 1, $priolist[0]));
         $this->command .= " --priority " . $priolist;
     }
     $this->command .= " " . $this->cfg["btclient_tornado_options"] . " > /dev/null &";
     if ($this->cfg["AllowQueing"] && $this->queue == "1") {
         //  This file is queued.
     } else {
         // This file is started manually.
         if (!array_key_exists("pythonCmd", $this->cfg)) {
             insertSetting("pythonCmd", "/usr/bin/python");
         }
         if (!array_key_exists("debugTorrents", $this->cfg)) {
             insertSetting("debugTorrents", "0");
         }
         $pyCmd = "";
         if (!$this->cfg["debugTorrents"]) {
             $pyCmd = $this->cfg["pythonCmd"] . " -OO";
         } else {
             $pyCmd = $this->cfg["pythonCmd"];
         }
         $this->command = "cd " . $this->savepath . "; HOME=" . $this->cfg["path"] . "; export HOME;" . $this->umask . " nohup " . $this->nice . $pyCmd . " " . $this->cfg["btclient_tornado_bin"] . " " . $this->command;
     }
     // start the client
     parent::doStartTorrentClient();
 }
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:62,代码来源:ClientHandler.tornado.php

示例3: startTorrentClient

 /**
  * starts a bittorrent-client
  * @param $torrent name of the torrent
  * @param $interactive (1|0) : is this a interactive startup with dialog ?
  */
 function startTorrentClient($torrent, $interactive)
 {
     // do transmission special-pre-start-checks
     // check to see if the path to the transmission-bin is valid
     if (!is_file($this->cfg["btclient_transmission_bin"])) {
         AuditAction($this->cfg["constants"]["error"], "Error Path for " . $this->cfg["btclient_transmission_bin"] . " is not valid");
         $this->status = -1;
         if (IsAdmin()) {
             header("location: admin.php?op=configSettings");
             return;
         } else {
             $this->messages .= "<b>Error</b> TorrentFlux settings are not correct (path to transmission-bin is not valid) -- please contact an admin.<br>";
             return;
         }
     }
     // prepare starting of client
     parent::prepareStartTorrentClient($torrent, $interactive);
     // prepare succeeded ?
     if ($this->status != 2) {
         $this->status = -1;
         $this->messages .= "<b>Error</b> parent::prepareStartTorrentClient(" . $torrent . "," . $interactive . ") failed<br>";
         return;
     }
     // included in transmissioncli
     // quick-hack for transmission--1
     //if ($this->rate == 0)
     //    $this->rate = -1;
     //if ($this->drate == 0)
     //    $this->drate = -1;
     // included in transmissioncli
     // pid-file
     $this->pidFile = "\"" . $this->cfg["torrent_file_path"] . $this->alias . ".stat.pid\"";
     // build the command-string
     $this->command = "-t \"" . $this->cfg["torrent_file_path"] . $this->alias . ".stat\" -w " . $this->owner;
     // "new" transmission-patch has pid-file included
     $this->command .= " -z " . $this->pidFile;
     /* - bsd-workaround */
     $this->command .= " -e 5 -p " . $this->port . " -u " . $this->rate . " -c " . $this->sharekill_param . " -d " . $this->drate;
     $this->command .= " " . $this->cfg["btclient_transmission_options"] . "\"" . $this->cfg["torrent_file_path"] . $this->torrent;
     // standard, no shell trickery ("new" transmission-patch has pid-file included) :
     $this->command .= '" &> /dev/null &';
     /* - bsd-workaround */
     // <begin shell-trickery> to write the pid of the client into the pid-file
     // * b4rt :
     //$this->command .= '" &> /dev/null & echo $! > "'. $this->pidFile .'"';
     // * lord_nor :
     //$this->command .= '" > /dev/null & echo $! & > "'. $this->pidFile .'"'; /* + bsd-workaround */
     // <end shell-trickery>
     if ($this->cfg["AllowQueing"] && $this->queue == "1") {
         //  This file is queued.
     } else {
         // This file is started manually.
         $this->command = "cd " . $this->savepath . "; HOME=" . $this->cfg["path"] . "; export HOME;" . $this->umask . " nohup " . $this->nice . $this->cfg["btclient_transmission_bin"] . " " . $this->command;
     }
     // start the client
     parent::doStartTorrentClient();
 }
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:62,代码来源:ClientHandler.transmission.php

示例4: SetProjectAllow

 public function SetProjectAllow($id, $allow)
 {
     $resultArr = array('status' => false, 'info' => null);
     if (IsAdmin()) {
         if (M('Project')->where('id=%d', $id)->setField('allow', $allow)) {
             $resultArr['status'] = true;
             $resultArr['info'] = "操作成功";
         } else {
             $resultArr['info'] = '系统异常,操作失败';
         }
     } else {
         $resultArr['info'] = '不具有管理员权限';
     }
     echo json_encode($resultArr);
 }
开发者ID:smilecc,项目名称:MakerLab,代码行数:15,代码来源:CheckController.class.php

示例5: detail

 public function detail($id)
 {
     $acDetail = M('Activity')->where('id=%d', $id)->find();
     // 比对活动是否结束
     $now = time();
     $over = strtotime($acDetail['over_time']);
     if ($now > $over) {
         $acDetail['isOver'] = true;
     } else {
         $acDetail['isOver'] = false;
     }
     $this->assign('detail', $acDetail);
     if (IsAdmin()) {
         $formList = M('ActivityFormSign')->where('activity_id=%d', $id)->select();
         $this->assign('formList', $formList);
     }
     $this->display();
 }
开发者ID:smilecc,项目名称:MakerLab,代码行数:18,代码来源:ActivityController.class.php

示例6: CreateJam

function CreateJam($theme, $date, $time)
{
    $jamNumber = intval(GetNextJamNumber());
    $theme = trim($theme);
    $date = trim($date);
    $time = trim($time);
    //Authorize user (logged in)
    if (IsLoggedIn() === false) {
        die("Not logged in.");
    }
    //Authorize user (is admin)
    if (IsAdmin() === false) {
        die("Only admins can create jams.");
    }
    //Validate jam number
    if ($jamNumber <= 0) {
        die("Invalid jam number");
    }
    //Validate theme
    if (strlen($theme) <= 0) {
        die("Invalid theme");
    }
    //Validate date and time and create datetime object
    if (strlen($date) <= 0) {
        die("Invalid date");
    } else {
        if (strlen($time) <= 0) {
            die("Invalid time");
        } else {
            $datetime = strtotime($date . " " . $time);
        }
    }
    $newJam = array();
    $newJam["jam_number"] = $jamNumber;
    $newJam["theme"] = $theme;
    $newJam["date"] = date("d M Y", $datetime);
    $newJam["time"] = date("H:i", $datetime);
    $newJam["start_time"] = date("c", $datetime);
    $newJam["entries"] = array();
    file_put_contents("data/jams/jam_{$jamNumber}.json", json_encode($newJam));
}
开发者ID:pta2002,项目名称:OneHourGameJam,代码行数:41,代码来源:site.php

示例7: my_json_encode

        if ($inlineedit == EDIT_INLINE) {
            if (IsAdmin() || $_SESSION["AccessLevel"] == ACCESS_LEVEL_ADMINGROUP) {
                $lockmessage = $pageObject->lockingObj->GetLockInfo($strTableName, $keys, false, $id);
            } else {
                $lockmessage = $pageObject->lockingObj->LockUser;
            }
            $returnJSON['success'] = false;
            $returnJSON['message'] = $lockmessage;
            $returnJSON['enableCtrls'] = $enableCtrlsForEditing;
            $returnJSON['confirmTime'] = $pageObject->lockingObj->ConfirmTime;
            echo my_json_encode($returnJSON);
            exit;
        }
        $system_attrs = "style='display:block;'";
        $system_message = $pageObject->lockingObj->LockUser;
        if (IsAdmin() || $_SESSION["AccessLevel"] == ACCESS_LEVEL_ADMINGROUP) {
            $rb = $pageObject->lockingObj->GetLockInfo($strTableName, $keys, true, $id);
            if ($rb != "") {
                $system_message = $rb;
            }
        }
    }
}
if ($pageObject->lockingObj && $inlineedit != EDIT_INLINE) {
    $pageObject->body["begin"] .= '<div class="runner-locking" ' . $system_attrs . '>' . $system_message . '</div>';
}
if ($message) {
    $message = "<div class='message " . $mesClass . "'>" . $message . "</div>";
}
// PRG rule, to avoid POSTDATA resend
if ($IsSaved && no_output_done() && $inlineedit == EDIT_SIMPLE) {
开发者ID:aagusti,项目名称:padl-tng,代码行数:31,代码来源:app_modules_edit.php

示例8: checkUserPermissions

 static function checkUserPermissions($table, $permission)
 {
     //	user is logged in
     if (!isLogged() || isLoggedAsGuest()) {
         Security::tryRelogin();
     }
     //	admin area security
     if ($table == ADMIN_USERS) {
         return IsAdmin();
     }
     return CheckTablePermissions($table, $permission);
 }
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:12,代码来源:security.php

示例9: DisplayHead

    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
*/
include_once 'config.php';
include_once 'functions.php';
DisplayHead(_XFER);
if ($cfg['enable_xfer'] == 1) {
    $cfg['xfer_realtime'] = 1;
    getDirList($cfg['torrent_file_path']);
    echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
    if ($cfg['xfer_day']) {
        echo displayXferBar($cfg['xfer_day'], $xfer_total['day']['total'], _XFERTHRU . ' Today:');
    }
    if ($cfg['xfer_week']) {
        echo displayXferBar($cfg['xfer_week'], $xfer_total['week']['total'], _XFERTHRU . ' ' . $cfg['week_start'] . ':');
    }
    $monthStart = strtotime(date('Y-m-') . $cfg['month_start']);
    $monthText = date('j') < $cfg['month_start'] ? date('M�j', strtotime('-1 Day', $monthStart)) : date('M�j', strtotime('+1 Month -1 Day', $monthStart));
    if ($cfg['xfer_month']) {
        echo displayXferBar($cfg['xfer_month'], $xfer_total['month']['total'], _XFERTHRU . ' ' . $monthText . ':');
    }
    if ($cfg['xfer_total']) {
        echo displayXferBar($cfg['xfer_total'], $xfer_total['total']['total'], _TOTALXFER . ':');
    }
    echo '</tr></table>';
    echo '<br>';
    if ($cfg['enable_public_xfer'] == 1 || IsAdmin()) {
        displayXfer();
    }
}
DisplayFoot();
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:31,代码来源:xfer.php

示例10: ew_Info

function ew_Info()
{
    global $Security;
    ew_WritePaths();
    echo "CurrentUserName() = " . CurrentUserName() . "<br>";
    echo "CurrentUserID() = " . CurrentUserID() . "<br>";
    echo "CurrentParentUserID() = " . CurrentParentUserID() . "<br>";
    echo "IsLoggedIn() = " . (IsLoggedIn() ? "TRUE" : "FALSE") . "<br>";
    echo "IsAdmin() = " . (IsAdmin() ? "TRUE" : "FALSE") . "<br>";
    echo "IsSysAdmin() = " . (IsSysAdmin() ? "TRUE" : "FALSE") . "<br>";
    if (isset($Security)) {
        $Security->ShowUserLevelInfo();
    }
}
开发者ID:NaurozAhmad,项目名称:Senho,代码行数:14,代码来源:phpfn12.php

示例11: assignAdmin

 /**
  * Makes assigns for admin 
  *
  */
 function assignAdmin()
 {
     if ($this->isAdminTable()) {
         $this->xt->assign("exitadminarea_link", true);
         $this->xt->assign("exitaalink_attrs", "id=\"exitAdminArea" . $this->id . "\"");
     }
     if ($this->isDynamicPerm && IsAdmin()) {
         $this->xt->assign("adminarea_link", true);
         $this->xt->assign("adminarealink_attrs", "id=\"adminArea" . $this->id . "\"");
     }
 }
开发者ID:aagusti,项目名称:padl-tng,代码行数:15,代码来源:listpage.php

示例12: EditUserPassword

function EditUserPassword($username, $newPassword1, $newPassword2)
{
    global $users, $dbConn;
    //Authorize user (is admin)
    if (IsAdmin() === false) {
        die("Only admins can edit entries.");
    }
    $newPassword1 = trim($newPassword1);
    $newPassword2 = trim($newPassword2);
    if ($newPassword1 != $newPassword2) {
        die("passwords don't match");
    }
    $password = $newPassword1;
    //Check password length
    if (strlen($password) < 8) {
        die("password must be longer than 8 characters");
    }
    //Check that the user exists
    if (!isset($users[$username])) {
        die("User does not exist");
        return;
    }
    //Generate new salt, number of iterations and hashed password.
    $newUserSalt = GenerateSalt();
    $newUserPasswordIterations = intval(rand(10000, 20000));
    $newPasswordHash = HashPassword($password, $newUserSalt, $newUserPasswordIterations);
    $users[$loggedInUser["username"]]["salt"] = $newUserSalt;
    $users[$loggedInUser["username"]]["password_hash"] = $newPasswordHash;
    $users[$loggedInUser["username"]]["password_iterations"] = $newUserPasswordIterations;
    $newUserSaltClean = mysqli_real_escape_string($dbConn, $newUserSalt);
    $newPasswordHashClean = mysqli_real_escape_string($dbConn, $newPasswordHash);
    $newUserPasswordIterationsClean = mysqli_real_escape_string($dbConn, $newUserPasswordIterations);
    $usernameClean = mysqli_real_escape_string($dbConn, $username);
    $sql = "\t\n\t\tUPDATE user\n\t\tSET\n\t\tuser_password_salt = '{$newUserSaltClean}',\n\t\tuser_password_iterations = '{$newUserPasswordIterationsClean}',\n\t\tuser_password_hash = '{$newPasswordHashClean}'\n\t\tWHERE user_username = '{$usernameClean}';\n\t";
    $data = mysqli_query($dbConn, $sql);
    $sql = "";
    LoadUsers();
    $loggedInUser = IsLoggedIn(TRUE);
}
开发者ID:OneHourGameJam,项目名称:OneHourGameJam,代码行数:39,代码来源:authentication.php

示例13: array

     if (!isset($_SESSION['check']['allow_url_fopen'])) {
         $_SESSION['check']['allow_url_fopen'] = 1;
         if (@ini_get('allow_url_fopen') == '0' || strtolower(@ini_get('allow_url_fopen')) == 'off') {
             @error("allow_url_fopen disabled", "index.php?iid=index", "", array("tf-b4rt will not run flawless with this setting", "PHP-setting : allow_url_fopen"));
         }
     }
     // register_globals
     if (!isset($_SESSION['check']['register_globals'])) {
         $_SESSION['check']['register_globals'] = 1;
         if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on') {
             @error("register_globals enabled", "index.php?iid=index", "", array("tf-b4rt may not run flawless with this setting", "PHP-setting : register_globals"));
         }
     }
 }
 // set admin-var
 $cfg['isAdmin'] = IsAdmin();
 // load some settings from users-table
 $sql = "SELECT hide_offline, theme, language_file FROM tf_users WHERE user_id=" . $db->qstr($cfg["user"]);
 $recordset = $db->Execute($sql);
 if ($db->ErrorNo() != 0) {
     dbError($sql);
 }
 list($cfg["hide_offline"], $cfg["theme"], $cfg["language_file"]) = $recordset->FetchRow();
 // Check for valid language file
 if (!ereg('^[^./][^/]*$', $cfg["language_file"])) {
     AuditAction($cfg["constants"]["error"], "LANGUAGE VARIABLE CHANGE ATTEMPT: " . $cfg["language_file"] . " from " . $cfg["user"]);
     $cfg["language_file"] = $cfg["default_language"];
 }
 if (!is_file("inc/language/" . $cfg["language_file"])) {
     $cfg["language_file"] = $cfg["default_language"];
 }
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:31,代码来源:main.internal.php

示例14: xt_displaymenu

 function xt_displaymenu($params)
 {
     global $strTableName, $pageName;
     $menuparams = array();
     foreach ($params as $p) {
         $menuparams[] = $p;
     }
     $menuId = $menuparams[0];
     $ProjectSettings = new ProjectSettings();
     $menuName = $ProjectSettings->getMenuName($this->template_file, $menuId, $menuparams[1]);
     $menuStyle = $ProjectSettings->getMenuStyle($this->template_file, $menuId, $menuparams[1]);
     $isMobyleLayout = isMobile();
     array_shift($menuparams);
     global $pageObject;
     $pageType = "";
     $pageMode = 0;
     $menuNodes = array();
     $isAdminTable = false;
     if (isset($pageObject)) {
         $pageObject->getMenuNodes();
         $pageType = $pageObject->pageType;
         $pageMode = $pageObject->mode;
         $isAdminTable = $pageObject->isAdminTable();
         if ($isAdminTable) {
             $menuName = "adminarea";
         }
         $menuNodes = $pageObject->getMenuNodes($menuName);
     }
     $xt = new Xtempl();
     $xt->assign("menuName", $menuName);
     $xt->assign("menustyle", $menuStyle ? "second" : "main");
     $quickjump = false;
     $horizontal = false;
     if (count($menuparams)) {
         if ($menuparams[0] == "horizontal") {
             $horizontal = true;
         } elseif ($menuparams[0] == "quickjump") {
             $quickjump = true;
         }
     }
     if (!$isAdminTable) {
         if (!$quickjump) {
             if (!$isMobyleLayout) {
                 $xt->assign("simpleTypeMenu", true);
             } else {
                 $xt->assign("treeLikeTypeMenu", true);
             }
         }
         if ($pageType == PAGE_MENU && IsAdmin() && !$isMobyleLayout) {
             $xt->assign("adminarea_link", true);
         }
     } else {
         //Admin Area menu items
         $xt->assign("adminAreaTypeMenu", true);
     }
     // need to predefine vars
     $nullParent = NULL;
     $rootInfoArr = array("id" => 0, "href" => "");
     // create treeMenu instance
     $menuNodesIndex = 0;
     $menuMap = array();
     $menuRoot = new MenuItem($rootInfoArr, $menuNodes, $nullParent, $menuMap);
     // call xtempl assign, set session params
     $menuRoot->setMenuSession();
     $menuRoot->assignMenuAttrsToTempl($xt);
     $menuRoot->setCurrMenuElem($xt);
     $xt->assign("mainmenu_block", true);
     $mainmenu = array();
     if (isEnableSection508()) {
         $mainmenu["begin"] = "<a name=\"skipmenu\"></a>";
     }
     $mainmenu["end"] = '';
     $countLinks = 0;
     $countGroups = 0;
     $showMenuCollapseExpandAll = false;
     foreach ($menuRoot->children as $ind => $val) {
         if ($val->showAsLink) {
             $countLinks++;
         }
         if ($val->showAsGroup) {
             if (count($val->children)) {
                 $showMenuCollapseExpandAll = true;
             }
             $countGroups++;
         }
     }
     $xt->assign("menu_collapse_expand_all", $showMenuCollapseExpandAll);
     if ($pageType == PAGE_MENU || $countLinks > 1 || $countGroups > 0) {
         $xt->assignbyref("mainmenu_block", $mainmenu);
         if ($this->layout->version == 1) {
             $menuName = "old" . $menuName;
         }
         if ($quickjump) {
             $xt->display($menuName . "_" . "mainmenu_quickjump.htm");
         } else {
             if ($horizontal) {
                 $xt->display($menuName . "_" . "mainmenu_horiz.htm");
             } else {
                 if ($isMobyleLayout && $this->layout->version != 1) {
                     $xt->display($menuName . "_" . "mainmenu_m.htm");
//.........这里部分代码省略.........
开发者ID:kcallow,项目名称:MatchMe,代码行数:101,代码来源:xtempl.php

示例15: CheckAdmin

function CheckAdmin()
{
    if (IsAdmin()) {
        return true;
    }
    log_msg("userlib.php->CheckAdmin", "User is not Admin!  Privilege  violation!");
    include "forms/header.php";
    echo '<p class="ErrorMsg"> You do not have privilege to access this page.<p>';
    echo '<br>';
    echo '<a href="welcome.php">Back to Start</a>';
    include "forms/footer.php";
    exit;
}
开发者ID:sshibs,项目名称:EpicRobotzWebsite,代码行数:13,代码来源:userlib.php


注:本文中的IsAdmin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。