本文整理汇总了PHP中query_single_row函数的典型用法代码示例。如果您正苦于以下问题:PHP query_single_row函数的具体用法?PHP query_single_row怎么用?PHP query_single_row使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query_single_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$blocks = query_single_row("SELECT id, `aux`, `data` FROM " . prefix('plugin_storage') . " WHERE `type` = 'defaultCodeblocks'");
if ($blocks) {
$this->codeblocks = $blocks['data'];
} else {
$this->codeblocks = serialize(array());
$sql = 'INSERT INTO ' . prefix('plugin_storage') . ' (`type`,`aux`,`data`) VALUES ("defaultCodeblocks","",' . db_quote($this->codeblocks) . ')';
query($sql);
}
}
示例2: setCurrentNewsPage
static function setCurrentNewsPage()
{
global $_zp_current_zenpage_news, $_zp_page;
if (isset($_zp_current_zenpage_news)) {
$table = prefix('zenpage_news');
$id = $_zp_current_zenpage_news->getID();
$query = "SELECT count(id) ct FROM {$table} where id >= {$id} AND `show`=1";
$result = query_single_row($query);
$count = $result['ct'];
$pageNumber = ceil($count / max(1, getOption("zenpage_articles_per_page")));
$_GET["page"] = $pageNumber;
$_zp_page = $pageNumber;
}
}
示例3: getTitle
function getTitle($table, $row)
{
switch ($table) {
case 'images':
$album = query_single_row('SELECT `folder` FROM ' . prefix('albums') . ' WHERE `id`=' . $row[albumid]);
$title = sprintf(gettext('%1$s: image %2$s'), $album['folder'], $row[$filename]);
break;
case 'albums':
$title = sprintf(gettext('album %s'), $row[$folder]);
break;
case 'news':
case 'pages':
$title = sprintf(gettext('%1$s: %2$s'), $table, $row['titlelink']);
break;
}
return $title;
}
示例4: checkForIp
/**
* Returns true if the IP has voted
*
* @param string $ip the IP address to check
* @param int $id the record ID of the image
* @param string $option 'image' or 'album' depending on the requestor
* @return bool
*/
function checkForIp($ip, $id, $option)
{
global $_rating_current_IPlist;
switch ($option) {
case "image":
$dbtable = prefix('images');
break;
case "album":
$dbtable = prefix('albums');
break;
}
$IPlist = query_single_row("SELECT used_ips FROM {$dbtable} WHERE id= {$id}");
if (is_array($IPlist)) {
if (empty($IPlist['used_ips'])) {
$_rating_current_IPlist = array();
return false;
}
$_rating_current_IPlist = unserialize($IPlist['used_ips']);
return in_array($ip, $_rating_current_IPlist);
} else {
$_rating_current_IPlist = array();
return false;
}
}
示例5: printSlideShow
/**
* Prints the slideshow using the {@link http://http://www.malsup.com/jquery/cycle/ jQuery plugin Cycle}
*
* Two ways to use:
* a) Use on your theme's slideshow.php page and called via printSlideShowLink():
* If called from image.php it starts with that image, called from album.php it starts with the first image (jQuery only)
* To be used on slideshow.php only and called from album.php or image.php.
*
* b) Calling directly via printSlideShow() function (jQuery mode)
* Place the printSlideShow() function where you want the slideshow to appear and set create an album object for $albumobj and if needed an image object for $imageobj.
* The controls are disabled automatically.
*
* NOTE: The jQuery mode does not support movie and audio files anymore. If you need to show them please use the Flash mode.
* Also note that this function is not used for the Colorbox mode!
*
* @param bool $heading set to true (default) to emit the slideshow breadcrumbs in flash mode
* @param bool $speedctl controls whether an option box for controlling transition speed is displayed
* @param obj $albumobj The object of the album to show the slideshow of. If set this overrides the POST data of the printSlideShowLink()
* @param obj $imageobj The object of the image to start the slideshow with. If set this overrides the POST data of the printSlideShowLink(). If not set the slideshow starts with the first image of the album.
* @param int $width The width of the images (jQuery mode). If set this overrides the size the slideshow_width plugin option that otherwise is used.
* @param int $height The heigth of the images (jQuery mode). If set this overrides the size the slideshow_height plugin option that otherwise is used.
* @param bool $crop Set to true if you want images cropped width x height (jQuery mode only)
* @param bool $shuffle Set to true if you want random (shuffled) order
* @param bool $linkslides Set to true if you want the slides to be linked to their image pages (jQuery mode only)
* @param bool $controls Set to true (default) if you want the slideshow controls to be shown (might require theme CSS changes if calling outside the slideshow.php page) (jQuery mode only)
*
*/
function printSlideShow($heading = true, $speedctl = false, $albumobj = NULL, $imageobj = NULL, $width = NULL, $height = NULL, $crop = false, $shuffle = false, $linkslides = false, $controls = true)
{
global $_myFavorites, $_zp_conf_vars;
if (!isset($_POST['albumid']) and !is_object($albumobj)) {
return '<div class="errorbox" id="message"><h2>' . gettext('Invalid linking to the slideshow page.') . '</h2></div>';
}
//getting the image to start with
if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
$imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
// slideshows starts with 0, but zp with 1.
} elseif (is_object($imageobj)) {
$imagenumber = $imageobj->getIndex();
} else {
$imagenumber = 0;
}
// set pagenumber to 0 if not called via POST link
if (isset($_POST['pagenr'])) {
$pagenumber = sanitize_numeric($_POST['pagenr']);
} else {
$pagenumber = 1;
}
// getting the number of images
if (!empty($_POST['numberofimages'])) {
$numberofimages = sanitize_numeric($_POST['numberofimages']);
} elseif (is_object($albumobj)) {
$numberofimages = $albumobj->getNumImages();
} else {
$numberofimages = 0;
}
if ($imagenumber < 2 || $imagenumber > $numberofimages) {
$imagenumber = 0;
}
//getting the album to show
if (!empty($_POST['albumid']) && !is_object($albumobj)) {
$albumid = sanitize_numeric($_POST['albumid']);
} elseif (is_object($albumobj)) {
$albumid = $albumobj->getID();
} else {
$albumid = 0;
}
if (isset($_POST['preserve_search_params'])) {
// search page
$search = new SearchEngine();
$params = sanitize($_POST['preserve_search_params']);
$search->setSearchParams($params);
$searchwords = $search->getSearchWords();
$searchdate = $search->getSearchDate();
$searchfields = $search->getSearchFields(true);
$page = $search->page;
$returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
$albumobj = new AlbumBase(NULL, false);
$albumobj->setTitle(gettext('Search'));
$albumobj->images = $search->getImages(0);
} else {
if (isset($_POST['favorites_page'])) {
$albumobj = $_myFavorites;
$returnpath = $_myFavorites->getLink($pagenumber);
} else {
$albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
$albumobj = newAlbum($albumq['folder']);
if (empty($_POST['imagenumber'])) {
$returnpath = $albumobj->getLink($pagenumber);
} else {
$image = newImage($albumobj, sanitize($_POST['imagefile']));
$returnpath = $image->getLink();
}
}
}
echo slideshow::getShow($heading, $speedctl, $albumobj, $imageobj, $width, $height, $crop, $shuffle, $linkslides, $controls, $returnpath, $imagenumber);
}
示例6: passwordAllowed
static function passwordAllowed($msg, $pwd, $user)
{
if ($id = $user->getID() > 0) {
$store = query_single_row('SELECT * FROM ' . prefix('plugin_storage') . ' WHERE `type`=' . db_quote('user_expiry_usedPasswords') . ' AND `aux`=' . $id);
if ($store) {
$used = getSerializedArray($store['data']);
if (in_array($pwd, $used)) {
if (zp_loggedin(ADMIN_RIGHTS)) {
// persons with ADMIN_RIGHTS get to override this so they can reset a passwrod for a user
unset($used[$pwd]);
} else {
return gettext('You have used that password recently. Please choose a different password.');
}
}
if (count($used) > 9) {
$used = array_slice($used, 1);
}
} else {
$used = array();
}
array_push($used, $pwd);
if ($store) {
query('UPDATE ' . prefix('plugin_storage') . 'SET `data`=' . db_quote(serialize($used)) . ' WHERE `type`=' . db_quote('user_expiry_usedPasswords') . ' AND `aux`=' . $id);
} else {
query('INSERT INTO ' . prefix('plugin_storage') . ' (`type`, `aux`, `data`) VALUES (' . db_quote('user_expiry_usedPasswords') . ',' . $id . ',' . db_quote(serialize($used)) . ')');
}
}
return $msg;
}
示例7: getXSRFToken
$ret = '&return=' . $ret;
}
$metaURL = $redirecturl = '?' . $type . 'refresh=continue&id=' . $imageid . $albumparm . $ret . '&XSRFToken=' . getXSRFToken('refresh');
}
} else {
if ($type !== 'prune&') {
if (!empty($folder)) {
$album = newAlbum($folder);
if (!$album->isMyItem(ALBUM_RIGHTS)) {
if (!zp_apply_filter('admin_managed_albums_access', false, $return)) {
header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php');
exitZP();
}
}
$sql = "SELECT `id` FROM " . prefix('albums') . " WHERE `folder`=" . db_quote($folder);
$row = query_single_row($sql);
$id = $row['id'];
}
if (!empty($id)) {
$imagewhere = "WHERE `albumid`={$id}";
$r = " {$folder}";
$albumwhere = "WHERE `parentid`={$id}";
}
}
if (isset($_REQUEST['return'])) {
$ret = sanitize($_REQUEST['return']);
}
if (!empty($ret)) {
$ret = '&return=' . $ret;
}
$metaURL = $starturl = '?' . $type . 'refresh=start' . $albumparm . '&XSRFToken=' . getXSRFToken('refresh') . $ret;
示例8: RSShitcounter
function RSShitcounter()
{
if (!zp_loggedin() && getOption('feed_hitcounter')) {
$rssuri = getRSSCacheFilename();
$type = 'rsshitcounter';
$checkitem = query_single_row("SELECT `data` FROM " . prefix('plugin_storage') . " WHERE `aux` = " . db_quote($rssuri) . " AND `type` = '" . $type . "'", true);
if ($checkitem) {
$hitcount = $checkitem['data'] + 1;
query("UPDATE " . prefix('plugin_storage') . " SET `data` = " . $hitcount . " WHERE `aux` = " . db_quote($rssuri) . " AND `type` = '" . $type . "'", true);
} else {
query("INSERT INTO " . prefix('plugin_storage') . " (`type`,`aux`,`data`) VALUES ('" . $type . "'," . db_quote($rssuri) . ",1)", true);
}
}
}
示例9: switch
switch ($action) {
case 'albums':
unset($_POST['checkAllAuto']);
foreach ($_POST as $key => $albumid) {
$album = newAlbum(postIndexDecode($key));
$album->setShow(1);
$album->save();
}
$report = 'albums';
break;
case 'images':
foreach ($_POST as $action) {
$i = strrpos($action, '_');
$imageid = sanitize_numeric(substr($action, $i + 1));
$rowi = query_single_row('SELECT * FROM ' . prefix('images') . ' WHERE `id`=' . $imageid);
$rowa = query_single_row('SELECT * FROM ' . prefix('albums') . ' WHERE `id`=' . $rowi['albumid']);
$album = newAlbum($rowa['folder']);
$image = newImage($album, $rowi['filename']);
switch (substr($action, 0, $i)) {
case 'pub':
$image->setShow(1);
$image->save();
break;
case 'del':
$image->remove();
break;
}
}
$report = 'images';
break;
case 'categories':
示例10: header
<?php
/**
* xspf playlist for flv player
*
* @author Malte Müller (acrylian), Stephen Billard (sbillard)
* @version 1.0.5
* @package plugins
*/
header("content-type:text/xml;charset=utf-8");
require_once "../../zp-core/template-functions.php";
$albumid = sanitize_numeric($_GET["albumid"]);
$albumresult = query_single_row("SELECT folder from " . prefix('albums') . " WHERE id = " . $albumid);
$album = new Album(new Gallery(), $albumresult['folder']);
$playlist = $album->getImages();
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo "<title>Sample XSPF Playlist</title>";
echo "<info>http://www.what.de</info>";
echo "<annotation>An example of a playlist with commercial</annotation>";
echo "<trackList>\n";
$imgextensions = array(".jpg", ".jpeg", ".gif", ".png");
foreach ($playlist as $item) {
$image = newImage($album, $item);
$ext = strtolower(strrchr($item, "."));
if ($ext == ".flv" || $ext == ".mp3" || $ext == ".mp4") {
$videoThumb = $image->objectsThumb;
if (!empty($videoThumb)) {
$videoThumb = '../../' . getAlbumFolder('') . $album->name . "/" . $videoThumb;
}
echo "\t<track>\n";
echo "\t\t<title>" . $image->getTitle() . " (" . $ext . ")</title>\n";
示例11: printBarGraph
//.........这里部分代码省略.........
$barsize = round($item['tagcount'] / $maxvalue * $bargraphmaxsize);
} else {
$barsize = 0;
}
$value = $item['tagcount'];
break;
case "newscategories":
if ($maxvalue != 0) {
$barsize = round($item['catcount'] / $maxvalue * $bargraphmaxsize);
} else {
$barsize = 0;
}
$value = $item['catcount'];
break;
}
break;
}
// counter to have a gray background of every second line
if ($countlines === 1) {
$style = " style='background-color: #f4f4f4'";
// a little ugly but the already attached class for the table is so easiest overriden...
$countlines = 0;
} else {
$style = "";
$countlines++;
}
switch ($type) {
case "albums":
$editurl = $webpath . "/admin-edit.php?page=edit&album=" . $name;
$viewurl = WEBPATH . "/index.php?album=" . $name;
$title = get_language_string($item['title']);
break;
case "images":
$getalbumfolder = query_single_row("SELECT title, folder, `show` from " . prefix("albums") . " WHERE id = " . $item['albumid']);
if ($sortorder === "latest") {
$value = "<span";
if ($getalbumfolder['show'] != "1") {
$value = $value . " class='unpublished_item'";
}
$value = $value . ">" . get_language_string($getalbumfolder['title']) . "</span> (" . $getalbumfolder['folder'] . ")";
}
$editurl = $webpath . "/admin-edit.php?page=edit&album=" . $getalbumfolder['folder'] . "&image=" . $item['filename'] . "&tab=imageinfo#IT";
$viewurl = WEBPATH . "/index.php?album=" . $getalbumfolder['folder'] . "&image=" . $name;
$title = get_language_string($item['title']);
break;
case "pages":
$editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?page&titlelink=" . $name;
$viewurl = WEBPATH . "/index.php?p=pages&title=" . $name;
$title = get_language_string($item['title']);
break;
case "news":
$editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?news&titlelink=" . $name;
$viewurl = WEBPATH . "/index.php?p=news&title=" . $name;
$title = get_language_string($item['title']);
break;
case "newscategories":
$editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-categories.php?edit&id=" . $item['id'];
$viewurl = WEBPATH . "/index.php?p=news&category=" . $name;
$title = get_language_string($item['titlelink']);
break;
case "tags":
$editurl = $webpath . "/admin-tags.php";
$viewurl = WEBPATH . "/index.php?p=search&searchfields=tags&words=" . $item['name'];
$title = get_language_string($item['name']);
break;
case "rss":
示例12: printCategoryCheckboxListEntry
/**
* Prints the checkboxes to select and/or show the category of an news article on the edit or add page
*
* @param int $id ID of the news article if the categories an existing articles is assigned to shall be shown, empty if this is a new article to be added.
* @param string $option "all" to show all categories if creating a new article without categories assigned, empty if editing an existing article that already has categories assigned.
*/
function printCategoryCheckboxListEntry($cat, $articleid, $option)
{
$selected = '';
if ($option != "all" && !$cat->transient && !empty($articleid)) {
$cat2news = query_single_row("SELECT cat_id FROM " . prefix('news2cat') . " WHERE news_id = " . $articleid . " AND cat_id = " . $cat->getID());
if ($cat2news['cat_id'] != "") {
$selected = "checked ='checked'";
} else {
$selected = "";
}
}
$catname = $cat->getTitle();
$catlink = $cat->getTitlelink();
if ($cat->isProtected() && GALLERY_SECURITY != 'private') {
$protected = '<img src="' . WEBPATH . '/' . ZENFOLDER . '/images/lock.png" alt="' . gettext('password protected') . '" />';
} else {
$protected = '';
}
$catid = $cat->getID();
echo "<label for='cat" . $catid . "'><input name='cat" . $catid . "' id='cat" . $catid . "' type='checkbox' value='" . $catid . "' " . $selected . " />" . $catname . " " . $protected . "</label>\n";
}
示例13: albumbutton
static function albumbutton($html, $object, $prefix)
{
$html .= '<hr />';
if (query_single_row('SELECT * FROM ' . prefix('plugin_storage') . ' WHERE `type`="cacheManager" LIMIT 1')) {
$disable = '';
$title = gettext('Finds images that have not been cached and creates the cached versions.');
} else {
$disable = ' disabled="disabled"';
$title = gettext("You must first set the plugin options for cached image parameters.");
}
$html .= '<div class="button buttons tooltip" title="' . $title . '"><a href="' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/cacheManager/cacheImages.php?album=' . html_encode($object->name) . '&XSRFToken=' . getXSRFToken('cacheImages') . '"' . $disable . '><img src="images/cache.png" />' . gettext('Cache album images') . '</a><br class="clearall" /></div>';
return $html;
}
示例14: gettext
echo "\n" . '<div id="content">';
if ($page == "editcomment" && isset($_GET['id'])) {
?>
<h1><?php
echo gettext("edit comment");
?>
</h1>
<?php
zp_apply_filter('admin_note', 'comments', 'edit');
?>
<div id="container">
<div class="box" style="padding: 10px">
<?php
$id = sanitize_numeric($_GET['id']);
$commentarr = query_single_row("SELECT * FROM " . prefix('comments') . " WHERE id = {$id} LIMIT 1");
if ($commentarr) {
extract($commentarr);
$commentarr = array_merge($commentarr, getSerializedArray($commentarr['custom_data']));
?>
<form class="dirtylistening" onReset="setClean('form_editcomment');" id="form_editcomment" action="?action=savecomment" method="post" autocomplete="off">
<?php
XSRFToken('savecomment');
?>
<input type="hidden" name="id" value="<?php
echo $id;
?>
" />
<span class="buttons">
<p class="buttons">
<a href="javascript:if(confirm('<?php
示例15: getItemID
/**
* Gets the id of a download item from the database for the download link. For internal use.
* @param string $path Path of the download item (without WEBPATH)
* @return bool|string
*/
static function getItemID($path)
{
$downloaditem = query_single_row("SELECT id, `aux`, `data` FROM " . prefix('plugin_storage') . " WHERE `type` = 'downloadList' AND `aux` = " . db_quote($path));
if ($downloaditem) {
return $downloaditem['id'];
} else {
return false;
}
}