/** * hasAdminBlock * * @access public * @return TRUE on success, FALSE on failure * @deprecated i think this isn't used any more */ function hasAdminBlock() { deprecated("i think this isn't used anymore."); global $gBitUser; // Let's find out if we are have admin perm or a root user $ret = TRUE; if (empty($gBitUser) || $gBitUser->isAdmin()) { $ret = FALSE; } else { // let's try to load up user_id - if successful, we know we have one. $rootUser = new BitPermUser(1); $rootUser->load(); if (!$rootUser->isValid()) { $ret = FALSE; } } return $ret; }
/** * verifyScore Make sure the data is safe to store * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash * * @param array $pParamHash reference to hash of values that will be used to store the score, they will be modified where necessary * @access private * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure */ function verifyScore(&$pParamHash) { // make sure we're loaded up if editing an existing score if ($this->verifyId($this->mScoreId)) { $this->loadScore(); // make sure the score we're editing matches the game type we've loaded if ($this->mScore['game_type'] == $this->mGame->getGameType()) { $this->mErrors['store_score']['game_type'] = "Mismatched game type on existing score."; } } $pParamHash['store_score'] = array('game_type' => $this->mGame->getGameType()); if (!empty($pParamHash['user_id'])) { $user = new BitPermUser($pParamHash["user_id"]); $user->load(TRUE); if ($user->isValid()) { $pParamHash['store_score']['user_id'] = $pParamHash['user_id']; } else { $this->mErrors['user_id'] = tra('Invalid user id'); } } else { $this->mErrors['user_id'] = tra('Invalid user id'); } if (!empty($pParamHash['score'])) { $pParamHash['store_score']['score'] = (int) $pParamHash['score']; } else { $this->mErrors['score'] = tra('No score submitted'); } if (!empty($pParamHash['comment'])) { $pParamHash['store_score']['comment'] = $pParamHash['comment']; } return count($this->mErrors) == 0; }