本文整理汇总了PHP中Kernel::mysqli方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::mysqli方法的具体用法?PHP Kernel::mysqli怎么用?PHP Kernel::mysqli使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel
的用法示例。
在下文中一共展示了Kernel::mysqli方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTimelimit
public static function setTimelimit($timelimit)
{
self::$torrentTimelimit = $timelimit;
$id = Sessionmanager::getUserId();
$unixTime = strtotime($timelimit);
Kernel::mysqli()->query("UPDATE usersetting SET timelimit=FROM_UNIXTIME({$unixTime}) WHERE id={$id}");
}
示例2: query
private static function query($level, $message, $get)
{
if (LOG_SAVELEVEL > $level) {
return;
}
$serverQuery = "INSERT INTO log (message, date, class, method, linenumber, file, username, level)\n\t\t\t\t\t\tVALUES('{$message}', NOW(),'{$get['className']}', '{$get['method']}',\n\t\t\t\t\t\t'{$get['lineNumber']}','{$get['filename']}','{$get['username']}','{$level}')";
Kernel::mysqli()->query($serverQuery);
}
示例3: mysqli
public static function mysqli()
{
if (!isset(Kernel::$mysqli)) {
Kernel::$mysqli = new mysqli(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_DATABASE);
Kernel::$mysqli->set_charset('utf8');
if (Kernel::$mysqli->connect_error) {
Kernel::addInfo(INFOBOX_ERROR, 'MySQLi connection failed.');
}
}
return Kernel::$mysqli;
}
示例4: seekList
public function seekList($page, $count)
{
$seeksResult = Kernel::mysqli()->query('SELECT * FROM seek ORDER BY name');
if (is_object($seeksResult)) {
$listNode = Util::tagToXml('list', $this->rootNode);
while ($seekObj = $seeksResult->fetch_object()) {
Util::objToXml($seekObj, $listNode, 'seek');
}
$seeksResult->close();
}
}
示例5: login
public static function login($username, $password)
{
$username = Kernel::mysqli()->escape_string($username);
$password = Kernel::mysqli()->escape_string($password);
$userQuery = Kernel::mysqli()->query("SELECT id, level FROM user WHERE username='{$username}' AND authkey=SHA('{$password}') ORDER BY ver DESC LIMIT 1");
if ($userQuery->num_rows == 1) {
$userQueryObj = $userQuery->fetch_object();
$userQuery->close();
$_SESSION[Sessionmanager::TYPE_LOGGED] = true;
$_SESSION[Sessionmanager::TYPE_ID] = $userQueryObj->id;
$_SESSION[Sessionmanager::TYPE_USERNAME] = $username;
$_SESSION[Sessionmanager::TYPE_USERLEVEL] = $userQueryObj->level;
Logger::finest('Login.');
return true;
}
$userQuery->close();
Logger::info('Login error.');
return false;
}
示例6: generateAjax
public function generateAjax()
{
$this->template = NULL;
$this->contentType = Kernel::CONTENT_TYPE_JSON;
if (isset($this->url->getPageParams()->getfilesystemusage)) {
$usageResult = Kernel::mysqli()->query('SELECT MAX(free), MAX(total), MAX(used), MIN(free), MIN(total), MIN(used) FROM fsdata');
$usageRow = $usageResult->fetch_row();
$maxFree = $usageRow[0];
$maxTotal = $usageRow[1];
$maxUsed = $usageRow[2];
$minFree = $usageRow[3];
$minTotal = $usageRow[4];
$minUsed = $usageRow[5];
$this->unitIndex = 0;
$this->unitDivider = 1;
while ($minUsed / $this->unitDivider >= 1024) {
$this->unitDivider *= 1024;
$this->unitIndex++;
}
$series = array();
$usage = array();
$fss = explode(',', MONITORED_FILESYSTEMS);
foreach ($fss as $fs) {
$fsdataResult = Kernel::mysqli()->query("SELECT * FROM fsdata WHERE filesystem='{$fs}'");
if (is_object($fsdataResult)) {
$fsData = array();
while ($fsdataObj = $fsdataResult->fetch_object()) {
$fsData[] = array($fsdataObj->date, $fsdataObj->used / $this->unitDivider);
}
$series[] = array('label' => $fs);
$usage[] = $fsData;
$fsdataResult->close();
}
}
$jsonData = array('usage' => $usage, 'series' => $series, 'ylabel' => $this->units[$this->unitIndex], 'ymax' => $maxTotal / $this->unitDivider, 'ymin' => 0.0);
echo json_encode($jsonData);
}
}
示例7: generateAjax
public function generateAjax()
{
$this->template = 'AVM';
if (isset($this->url->getPageParams()->getserielist)) {
$this->template = NULL;
// No xsl transform!
$this->contentType = Kernel::CONTENT_TYPE_JSON;
$serieArray = array(array('id' => '0', 'name' => '-- Select serie'));
$seriesResult = Kernel::mysqli()->query("SELECT a.* FROM serie a WHERE a.ver IN (SELECT MAX(b.ver) FROM serie b WHERE b.id = a.id)");
if (is_object($seriesResult)) {
while ($serieObj = $seriesResult->fetch_object()) {
$serieArray[] = $serieObj;
}
$seriesResult->close();
}
echo json_encode($serieArray);
} else {
if (isset($this->url->getPageParams()->getseasonlist)) {
$this->template = NULL;
// No xsl transform!
$this->contentType = Kernel::CONTENT_TYPE_JSON;
$this->template = null;
if (isset($this->url->getPageParams()->id)) {
$id = Kernel::mysqli()->escape_string($this->url->getPageParams()->id);
$details = $this->getFileDetailsObjFromUrl();
$seasonArray = array();
$seasonsResult = Kernel::mysqli()->query("SELECT a.id, a.season FROM season a WHERE a.ver IN (SELECT MAX(b.ver) FROM season b WHERE b.id = a.id AND serieid = {$id})");
if (is_object($seasonsResult)) {
while ($seasonObj = $seasonsResult->fetch_object()) {
if ($details->season == $seasonObj->season) {
$seasonObj->selected = true;
}
$seasonArray[] = $seasonObj;
}
$seasonsResult->close();
}
echo json_encode($seasonArray);
}
} else {
if (isset($this->url->getPageParams()->addserie)) {
if (!empty($_POST)) {
if (empty($_POST['name'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must enter serie name.');
} else {
if (empty($_POST['year'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must enter serie year.');
} else {
$name = Kernel::mysqli()->escape_string($_POST['name']);
$year = Kernel::mysqli()->escape_string($_POST['year']);
$url = Kernel::mysqli()->escape_string($_POST['url']);
$file = Kernel::mysqli()->escape_string($_POST['file']);
$torrent = Kernel::mysqli()->escape_string($_POST['torrent']);
Kernel::mysqli()->query("INSERT INTO serie (name, year, url, file, torrent)\n\t\t\t\t\t\t\t\t\t\t\tVALUES('{$name}','{$year}','{$url}','{$file}','{$torrent}')");
Kernel::addInfo(Kernel::INFOBOX_OK, "Serie {$name} ({$year}) added!");
}
}
}
} else {
if (isset($this->url->getPageParams()->addseason)) {
if (!empty($_POST)) {
if (empty($_POST['serieid'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must select serie.');
} else {
if (empty($_POST['season'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must enter season number.');
} else {
$serieid = Kernel::mysqli()->escape_string($_POST['serieid']);
$season = Kernel::mysqli()->escape_string($_POST['season']);
$state = Kernel::mysqli()->escape_string($_POST['state']);
$watched = Kernel::mysqli()->escape_string($_POST['watched']);
$file = Kernel::mysqli()->escape_string($_POST['file']);
$torrent = Kernel::mysqli()->escape_string($_POST['torrent']);
Kernel::mysqli()->query("INSERT INTO season (serieid, season, state, watched, file, torrent)\n\t\t\t\t\t\t\t\t\t\t\tVALUES('{$serieid}','{$season}','{$state}','{$watched}','{$file}','{$torrent}')");
Kernel::addInfo(Kernel::INFOBOX_OK, "Season {$season} added!");
}
}
}
} else {
if (isset($this->url->getPageParams()->addepisode)) {
if (!empty($_POST)) {
if (empty($_POST['serieid'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must select serie.');
} else {
if (empty($_POST['seasonid'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must select season.');
} else {
if (empty($_POST['episode'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must enter episode number.');
} else {
if (empty($_POST['title'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must enter title.');
} else {
if (!isset($_POST['format'])) {
Kernel::addInfo(Kernel::INFOBOX_ERROR, 'You must enter format.');
} else {
$serieid = Kernel::mysqli()->escape_string($_POST['serieid']);
$seasonid = Kernel::mysqli()->escape_string($_POST['seasonid']);
$episode = Kernel::mysqli()->escape_string($_POST['episode']);
$title = Kernel::mysqli()->escape_string($_POST['title']);
$format = AVM::$videoFormat[Kernel::mysqli()->escape_string($_POST['format'])];
//.........这里部分代码省略.........
示例8: __construct
public function __construct()
{
foreach ($_POST as $sKey => $sValue) {
$this->{$sKey} = Kernel::mysqli()->real_escape_string($sValue);
}
}
示例9: addTorrent
function addTorrent($storage, $torrent)
{
$storage = Kernel::mysqli()->escape_string($storage);
$torrent = Kernel::mysqli()->escape_string($torrent);
Kernel::mysqli()->query("INSERT INTO unhandled (file, torrent) VALUES('{$storage}','{$torrent}')");
}
示例10: feedList
private function feedList()
{
$feedsResult = Kernel::mysqli()->query('SELECT * FROM feed');
if (is_object($feedsResult)) {
while ($feedObj = $feedsResult->fetch_object()) {
$feed = new Feed($feedObj->data);
foreach ($feed->entries as $entryObj) {
if ($entryObj->publishedDate < strtotime(AVM::$torrentTimelimit)) {
continue;
}
$match = @preg_match(AVM::$torrentFilter, $entryObj->title);
if (empty($match)) {
continue;
}
Util::objToXml($entryObj, $this->listNode, 'feeditem');
}
}
$feedsResult->close();
}
}
示例11: movieList
public function movieList($page, $count)
{
$moviesResult = Kernel::mysqli()->query('SELECT a.* FROM movie a WHERE a.ver IN (SELECT MAX(b.ver) FROM movie b WHERE b.id = a.id) ORDER BY name');
if (is_object($moviesResult)) {
$listNode = Util::tagToXml('list', $this->rootNode);
while ($movieObj = $moviesResult->fetch_object()) {
Util::objToXml($movieObj, $listNode, 'movie');
}
$moviesResult->close();
}
}
示例12: serieList
public function serieList($page, $count)
{
$seriesResult = Kernel::mysqli()->query('SELECT a.* FROM serie a WHERE a.ver IN (SELECT MAX(b.ver) FROM serie b WHERE b.id = a.id) ORDER BY name');
if (is_object($seriesResult)) {
$listNode = Util::tagToXml('list', $this->rootNode);
while ($serieObj = $seriesResult->fetch_object()) {
$serieNode = Util::objToXml($serieObj, $listNode, 'serie');
$seasonsResult = Kernel::mysqli()->query("SELECT a.* FROM season a WHERE a.ver IN (SELECT MAX(b.ver) FROM season b WHERE b.id = a.id AND serieid = {$serieObj->id}) ORDER BY season");
if (is_object($seasonsResult)) {
while ($seasonObj = $seasonsResult->fetch_object()) {
$seasonNode = Util::objToXml($seasonObj, $serieNode, 'season');
$episodesResult = Kernel::mysqli()->query("SELECT a.* FROM episode a WHERE a.ver IN (SELECT MAX(b.ver) FROM episode b WHERE b.id = a.id AND serieid = {$serieObj->id} AND seasonid = {$seasonObj->id}) ORDER BY episode");
if (is_object($episodesResult)) {
while ($episodeObj = $episodesResult->fetch_object()) {
$episodeObj->season = $seasonObj->season;
Util::objToXml($episodeObj, $seasonNode, 'episode');
}
$episodesResult->close();
}
}
$seasonsResult->close();
}
}
$seriesResult->close();
}
}