本文整理汇总了PHP中Album::getPublic方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::getPublic方法的具体用法?PHP Album::getPublic怎么用?PHP Album::getPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::getPublic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPublic
public function getPublic($password)
{
# Functions checks if photo or parent album is public
# Returns the following:
# (int) 0 = Photo private and parent album private
# (int) 1 = Album public, but password incorrect
# (int) 2 = Photo public or album public and password correct
# Check dependencies
self::dependencies(isset($this->database, $this->photoIDs));
# Call plugins
$this->plugins(__METHOD__, 0, func_get_args());
# Get photo
$query = Database::prepare($this->database, "SELECT public, album FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
$photos = $this->database->query($query);
$photo = $photos->fetch_object();
# Check if public
if ($photo->public === '1') {
# Photo public
return 2;
} else {
# Check if album public
$album = new Album($this->database, null, null, $photo->album);
$agP = $album->getPublic();
$acP = $album->checkPassword($password);
# Album public and password correct
if ($agP === true && $acP === true) {
return 2;
}
# Album public, but password incorrect
if ($agP === true && $acP === false) {
return 1;
}
}
# Call plugins
$this->plugins(__METHOD__, 1, func_get_args());
# Photo private
return 0;
}
示例2: getPublic
public function getPublic($password)
{
# Check dependencies
self::dependencies(isset($this->database, $this->photoIDs));
# Call plugins
$this->plugins(__METHOD__, 0, func_get_args());
# Get photo
$query = Database::prepare($this->database, "SELECT public, album FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
$photos = $this->database->query($query);
$photo = $photos->fetch_object();
# Check if public
if ($photo->public == 1) {
return true;
} else {
$album = new Album($this->database, null, null, $photo->album);
$acP = $album->checkPassword($password);
$agP = $album->getPublic();
if ($acP === true && $agP === true) {
return true;
}
}
# Call plugins
$this->plugins(__METHOD__, 1, func_get_args());
return false;
}
示例3: getAlbumArchive
private function getAlbumArchive()
{
Module::dependencies(isset($_GET['albumID'], $_GET['password']));
$album = new Album($this->database, $this->plugins, $this->settings, $_GET['albumID']);
if ($album->getPublic() && $album->getDownloadable()) {
# Album Public
if ($album->checkPassword($_GET['password'])) {
$album->getArchive();
} else {
exit('Warning: Wrong password!');
}
} else {
# Album Private
exit('Warning: Album private or not downloadable!');
}
}
示例4: getPublic
public function getPublic($password)
{
Log::notice($this->database, __METHOD__, __LINE__, "Checking public for " . $this->photoIDs);
# Functions checks if photo or parent album is public
# Returns the following:
# (int) 0 = Photo private and parent album private
# (int) 1 = Album public, but password incorrect
# (int) 2 = Photo public or album public and password correct
# Check dependencies
self::dependencies(isset($this->database, $this->photoIDs));
# Call plugins
$this->plugins(__METHOD__, 0, func_get_args());
# Get photo
$stmt = $this->database->prepare("SELECT public, album FROM " . LYCHEE_TABLE_PHOTOS . " WHERE id = ? LIMIT 1");
$result = $stmt->execute(array($this->photoIDs));
$photo = $stmt->fetchObject();
# Check if public
if ($photo->public == 1) {
# Photo public
return 2;
} else {
# Check if album public
$album = new Album($this->database, null, null, $photo->album);
$agP = $album->getPublic();
$acP = $album->checkPassword($password);
# Album public and password correct
if ($agP === true && $acP === true) {
return 2;
}
# Album public, but password incorrect
if ($agP === true && $acP === false) {
return 1;
}
}
# Call plugins
$this->plugins(__METHOD__, 1, func_get_args());
# Photo private
return 0;
}
示例5: getPublic
public function getPublic($password)
{
# Functions checks if photo or parent album is public
# Returns the following:
# (int) 0 = Photo private and parent album private
# (int) 1 = Album public, but password incorrect
# (int) 2 = Photo public or album public and password correct
# Check dependencies
self::dependencies(isset($this->photoIDs));
# Get photo
$sql = "SELECT public, album FROM photos WHERE id = " . pg_escape_literal($this->photoIDs);
$res = pg_query($db, $sql);
$row = pg_fetch_array($res);
# Check if public
if ($row['public'] === '1') {
# Photo public
pg_free_result($res);
return 2;
} else {
# Check if album public
$album = new Album(null, null, $row['album']);
$agP = $album->getPublic();
$acP = $album->checkPassword($password);
# Album public and password correct
if ($agP === true && $acP === true) {
pg_free_result($res);
return 2;
}
# Album public, but password incorrect
if ($agP === true && $acP === false) {
pg_free_result($res);
return 1;
}
}
pg_free_result($res);
# Photo private
return 0;
}