本文整理汇总了PHP中album类的典型用法代码示例。如果您正苦于以下问题:PHP album类的具体用法?PHP album怎么用?PHP album使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了album类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: insert
function insert()
{
global $database_table_prefix;
if (!empty($this->artist)) {
$result = mysql_query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `" . $database_table_prefix . "artist`\n\t\t\t\tWHERE `name` = '" . addslashes($this->artist) . "'\n\t\t\t") or die(mysql_error());
if (mysql_num_rows($result) == 0) {
$artist = new artist();
$artist->name = $this->artist;
$artist->insert();
$this->artist_id = $artist->id;
} else {
while ($data = mysql_fetch_object($result)) {
$this->artist_id = $data->id;
}
}
}
if (!empty($this->album)) {
$result = mysql_query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `" . $database_table_prefix . "album`\n\t\t\t\tWHERE `name` = '" . addslashes($this->album) . "'\n\t\t\t\tAND `artist` = '" . addslashes($this->artist_id) . "'\n\t\t\t") or die(mysql_error());
if (mysql_num_rows($result) == 0) {
$album = new album();
$album->name = $this->album;
$album->artist = $this->artist_id;
$album->insert();
$this->album_id = $album->id;
} else {
while ($data = mysql_fetch_object($result)) {
$this->album_id = $data->id;
}
}
}
$result = mysql_query("\n\t\t\tINSERT \n\t\t\tINTO `" . $database_table_prefix . "song`\n\t\t\t( `name`\n\t\t\t, `rating`\n\t\t\t, `play_count`\n\t\t\t, `artist`\n\t\t\t, `album`\n\t\t\t)\n\t\t\tVALUES \n\t\t\t( '" . addslashes($this->name) . "'\n\t\t\t, '" . addslashes($this->rating) . "'\n\t\t\t, '" . addslashes($this->play_count) . "'\n\t\t\t, '" . addslashes($this->artist_id) . "'\n\t\t\t, '" . addslashes($this->album_id) . "'\n\t\t\t)\n\t\t") or die(mysql_error());
$this->id = mysql_insert_id();
}
开发者ID:bajmhunter,项目名称:iTunes-Stats,代码行数:33,代码来源:objects.inc.php
示例2: comGetImage
function comGetImage()
{
if (isset($this->data['page']) && isset($this->data['count'])) {
$listMedia = $this->album->getMedia($this->data['id'], null, $this->data['page'], $this->data['count']);
} else {
$listMedia = $this->album->getMedia($this->data['id']);
$this->data['page'] = 1;
$this->data['count'] = count($listMedia);
}
$xml = '<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
<INFO>
<COMMAND>' . $this->command . '</COMMAND>
<ID>' . $this->data['id'] . '</ID>
<PAGE>' . $this->data['page'] . '</PAGE>
<COUNT>' . $this->data['count'] . '</COUNT>
</INFO>
<DATA>';
foreach ($listMedia as $value) {
$mime = explode('/', $value['mime']);
$xml .= '
<IMAGE>
<ID>' . $value['id'] . '</ID>
<ALBUM>' . $value['aid'] . '</ALBUM>
<TITLE>' . $value['title'] . '</TITLE>
<DESCRIPTION>' . $value['desc'] . '</DESCRIPTION>
<WIDTH>' . $value['width'] . '</WIDTH>
<HEIGHT>' . $value['height'] . '</HEIGHT>
<DURATION>' . $value['duration'] . '</DURATION>
<SIZE>' . $value['size'] . '</SIZE>
<DATE>' . $value['firstdate'] . '</DATE>
<MIME>
<GROUP>' . $mime[0] . '</GROUP>
<TYPE>' . $mime[1] . '</TYPE>
</MIME>
<USER>
<ID>' . $value['uid'] . '</ID>
<NAME>' . $value['username'] . '</NAME>
<FIRSTNAME></FIRSTNAME>
<LASTNAME></LASTNAME>
</USER>
</IMAGE>
';
}
$xml .= '
</DATA>
</RESPONSE>';
$xml = preg_replace('/(\\s*)(.*)\\n/', "\\2\n", $xml);
$xml = preg_replace('/>(\\s*)\\n(\\s*)</', "><", $xml);
$this->html = $xml;
}
开发者ID:Ashaan,项目名称:phpgallery,代码行数:51,代码来源:ajax.php
示例3: initialize
protected function initialize()
{
$this->album = album::getInstance();
if ($this->data['id'] == '-1') {
$this->imageinfo = array('name' => 'album.png');
$session = session::getInstance();
$this->pathname = LOCAL_PATH . LOCAL_DIR . 'theme/' . $session->getData('theme') . '/image/';
} else {
$this->imageinfo = $this->album->getMediaInfo($this->data['id']);
$this->pathname = LOCAL_PATH . LOCAL_DIR . 'data/' . $this->imageinfo['path'] . '/';
}
if (!$this->imageinfo) {
$this->error('4', 'album inexistant');
}
$this->width = isset($this->data['w']) ? $this->data['w'] : false;
$this->height = isset($this->data['h']) ? $this->data['h'] : false;
$this->mask = isset($this->data['m']) ? $this->data['m'] : false;
$this->trans = isset($this->data['t']) ? $this->data['t'] : false;
$this->pathcache = LOCAL_PATH . LOCAL_DIR . 'cache/';
$this->filecache = $this->getCacheName();
$this->filename = $this->imageinfo['name'];
$mime = parse_ini_file('include/mime.ini');
$this->mime = $mime[strtolower(substr($this->imageinfo['name'], strrpos($this->imageinfo['name'], '.') + 1, strlen($this->imageinfo['name'])))];
if (!$this->mime) {
return false;
}
$this->type = explode('/', $this->mime);
}
开发者ID:Ashaan,项目名称:phpgallery,代码行数:28,代码来源:image.php
示例4: getInstance
public static function getInstance()
{
if (is_null(album::$instance)) {
album::$instance = new album();
}
return album::$instance;
}
开发者ID:Ashaan,项目名称:phpgallery,代码行数:7,代码来源:album.php
示例5: resize_url_test
public function resize_url_test()
{
$rand = rand();
$root = ORM::factory("item", 1);
$album = album::create($root, $rand, $rand, $rand);
$photo = photo::create($album, MODPATH . "gallery/tests/test.jpg", "{$rand}.jpg", $rand, $rand);
$this->assert_equal("http://./var/resizes/{$rand}/{$rand}.jpg", $photo->resize_url());
}
开发者ID:xafr,项目名称:gallery3,代码行数:8,代码来源:Photo_Helper_Test.php
示例6: create_photo_creates_reasonable_slug_test
public function create_photo_creates_reasonable_slug_test()
{
$rand = rand();
$root = ORM::factory("item", 1);
$album = album::create($root, $rand, $rand, $rand);
$photo = photo::create($album, MODPATH . "gallery/tests/test.jpg", "This (is) my file%name.jpg", $rand, $rand);
$this->assert_equal("This-is-my-file-name", $photo->slug);
}
开发者ID:scarygary,项目名称:gallery3,代码行数:8,代码来源:Photo_Helper_Test.php
示例7: getAlbum
/**
**/
function getAlbum($id)
{
$result = array();
$sql = " SELECT SQL_NO_CACHE * FROM Album WHERE IDAlbum = :id ";
$params = array(":id" => $id);
$sth = $this->db->prepare($sql);
$sth->execute($params);
if ($sth->rowCount() == 1) {
$response = $sth->fetch(PDO::FETCH_OBJ);
$album = new album();
//-----
$album->init($response->IDAlbum, $response->Title, $response->Cover, $response->Artist);
$album->setTracks($this->getAlbumTracks($response->IDAlbum));
array_push($result, $album);
}
return $result;
}
开发者ID:artz20,项目名称:playlists-par-deezer,代码行数:19,代码来源:WebPlayerDB.class.php
示例8: initialize
public function initialize()
{
$this->template = template::getInstance();
$this->session = session::getInstance();
$this->album = album::getInstance();
$this->template->add(array('album'));
$this->id = $this->session->getData('album', 'id');
$this->page = $this->session->getData('album', 'page');
}
开发者ID:Ashaan,项目名称:phpgallery,代码行数:9,代码来源:album.php
示例9: deleting_an_item_deletes_its_comments_too_test
public function deleting_an_item_deletes_its_comments_too_test()
{
$rand = rand();
$album = album::create(ORM::factory("item", 1), "test_{$rand}", "test_{$rand}");
$comment = comment::create($album, identity::guest(), "text_{$rand}", "name_{$rand}", "email_{$rand}", "url_{$rand}");
$album->delete();
$deleted_comment = ORM::factory("comment", $comment->id);
$this->assert_false($deleted_comment->loaded);
}
开发者ID:ChrisRut,项目名称:gallery3,代码行数:9,代码来源:Comment_Event_Test.php
示例10: _get_form
private function _get_form()
{
$form = new Forge("admin/default_sort", "", "post", array("id" => "g-admin-default_sort-form"));
$group = $form->group("sort_order")->label(t("Sort Order"));
$group->dropdown("sort_column")->id(t("sort_column"))->label(t("Sort by"))->options(array_merge(array("none" => t("None")), album::get_sort_order_options()))->selected(module::get_var("default_sort", "default_sort_column", "none"));
$group->dropdown("sort_direction")->id(t("sort_direction"))->label(t("Sort by"))->options(array("none" => t("None"), "ASC" => t("Ascending"), "DESC" => t("Descending")))->selected(module::get_var("default_sort", "default_sort_direction", "none"));
$form->submit("submit")->value(t("Save"));
return $form;
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:9,代码来源:admin_default_sort.php
示例11: add_from_server
static function add_from_server($task)
{
$context = unserialize($task->context);
try {
$paths = array_keys(unserialize(module::get_var("server_add", "authorized_paths")));
$path = $paths[$context["next_path"]];
if (!empty($context["files"][$path])) {
$file = $context["files"][$path][$context["position"]];
$parent = ORM::factory("item", $file["parent_id"]);
access::required("server_add", $parent);
access::required("add", $parent);
if (!$parent->is_album()) {
throw new Exception("@todo BAD_ALBUM");
}
$name = $file["name"];
if ($file["type"] == "album") {
$album = ORM::factory("item")->where("name", $name)->where("parent_id", $parent->id)->find();
if (!$album->loaded) {
$album = album::create($parent, $name, $name, null, user::active()->id);
}
// Now that we have a new album. Go through the remaining files to import and change the
// parent_id of any file that has the same relative path as this album's path.
$album_path = "{$file['path']}/{$name}";
for ($idx = $context["position"] + 1; $idx < count($context["files"][$path]); $idx++) {
if (strpos($context["files"][$path][$idx]["path"], $album_path) === 0) {
$context["files"][$path][$idx]["parent_id"] = $album->id;
}
}
} else {
$extension = strtolower(substr(strrchr($name, '.'), 1));
$source_path = "{$path}{$file['path']}/{$name}";
if (in_array($extension, array("flv", "mp4"))) {
$movie = movie::create($parent, $source_path, $name, $name, null, user::active()->id);
} else {
$photo = photo::create($parent, $source_path, $name, $name, null, user::active()->id);
}
}
$context["counter"]++;
if (++$context["position"] >= count($context["files"][$path])) {
$context["next_path"]++;
$context["position"] = 0;
}
} else {
$context["next_path"]++;
}
} catch (Exception $e) {
$context["errors"][$path] = $e->getMessage();
}
$task->context = serialize($context);
$task->state = "success";
$task->percent_complete = $context["counter"] / (double) $context["total"] * 100;
$task->done = $context["counter"] == (double) $context["total"];
}
开发者ID:xafr,项目名称:gallery3,代码行数:53,代码来源:server_add_task.php
示例12: create_album_silently_trims_trailing_periods_test
public function create_album_silently_trims_trailing_periods_test()
{
$rand = rand();
$root = ORM::factory("item", 1);
try {
$album = album::create($root, $rand . "..", $rand, $rand);
} catch (Exception $e) {
$this->assert_equal("@todo NAME_CANNOT_END_IN_PERIOD", $e->getMessage());
return;
}
$this->assert_true(false, "Shouldn't create an album with trailing . in the name");
}
开发者ID:xafr,项目名称:gallery3,代码行数:12,代码来源:Album_Helper_Test.php
示例13: viewable_test
public function viewable_test()
{
$root = ORM::factory("item", 1);
$album = album::create($root, rand(), rand(), rand());
$item = self::_create_random_item($album);
identity::set_active_user(identity::guest());
// We can see the item when permissions are granted
access::allow(identity::everybody(), "view", $album);
$this->assert_equal(1, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
// We can't see the item when permissions are denied
access::deny(identity::everybody(), "view", $album);
$this->assert_equal(0, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
}
开发者ID:viosca,项目名称:gallery3,代码行数:13,代码来源:Item_Helper_Test.php
示例14: cant_view_comments_for_unviewable_items_test
public function cant_view_comments_for_unviewable_items_test()
{
$root = ORM::factory("item", 1);
$album = album::create($root, rand(), rand(), rand());
$comment = comment::create($album, user::guest(), "text", "name", "email", "url");
user::set_active(user::guest());
// We can see the comment when permissions are granted on the album
access::allow(group::everybody(), "view", $album);
$this->assert_equal(1, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
// We can't see the comment when permissions are denied on the album
access::deny(group::everybody(), "view", $album);
$this->assert_equal(0, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
}
开发者ID:Okat,项目名称:gallery3,代码行数:13,代码来源:Comment_Model_Test.php
示例15: setup
public function setup()
{
$this->_server = $_SERVER;
$root = ORM::factory("item", 1);
$this->_album = album::create($root, rand(), "test album");
access::deny(identity::everybody(), "view_full", $this->_album);
access::deny(identity::registered_users(), "view_full", $this->_album);
$rand = rand();
$this->_item = photo::create($this->_album, MODPATH . "gallery/tests/test.jpg", "{$rand}.jpg", $rand, $rand);
$this->_proxy = ORM::factory("digibug_proxy");
$this->_proxy->uuid = md5(rand());
$this->_proxy->item_id = $this->_item->id;
$this->_proxy->save();
}
开发者ID:viosca,项目名称:gallery3,代码行数:14,代码来源:Digibug_Controller_Test.php
示例16: initialize
protected function initialize()
{
if (!isset($this->data['type']) || !isset($this->data['version'])) {
$this->error('2', 'Paramettre manquant');
}
$this->album = album::getInstance();
$this->albuminfo = $this->album->getInfo($this->data['id']);
if (!$this->albuminfo) {
$this->error('4', 'album inexistant');
}
$this->pathcache = LOCAL_PATH . LOCAL_DIR . 'cache/';
$this->pathname = LOCAL_PATH . LOCAL_DIR . 'data/';
$this->filecache = 'a' . $this->data['id'] . '_' . $this->data['version'] . '.' . $this->data['type'];
}
开发者ID:Ashaan,项目名称:phpgallery,代码行数:14,代码来源:archive.php
示例17: change_album_no_csrf_fails_test
public function change_album_no_csrf_fails_test()
{
$controller = new Albums_Controller();
$root = ORM::factory("item", 1);
$this->_album = album::create($root, "test", "test", "test");
$_POST["name"] = "new name";
$_POST["title"] = "new title";
$_POST["description"] = "new description";
access::allow(group::everybody(), "edit", $root);
try {
$controller->_update($this->_album);
$this->assert_true(false, "This should fail");
} catch (Exception $e) {
// pass
}
}
开发者ID:Okat,项目名称:gallery3,代码行数:16,代码来源:Albums_Controller_Test.php
示例18: move_to_test
public function move_to_test()
{
$root = ORM::factory("item", 1);
$album1 = album::create($root, "move_to_test_1", "move_to_test_1");
$album1_1 = album::create($album1, "move_to_test_1_1", "move_to_test_1_1");
$album1_2 = album::create($album1, "move_to_test_1_2", "move_to_test_1_2");
$album1_1_1 = album::create($album1_1, "move_to_test_1_1_1", "move_to_test_1_1_1");
$album1_1_2 = album::create($album1_1, "move_to_test_1_1_2", "move_to_test_1_1_2");
$album1_2->reload();
$album1_1_1->reload();
$album1_1_1->move_to($album1_2);
$album1_1->reload();
$album1_2->reload();
$this->assert_equal(3, $album1_1->right - $album1_1->left);
$this->assert_equal(3, $album1_2->right - $album1_2->left);
$this->assert_equal(array($album1_1_2->id => "move_to_test_1_1_2"), $album1_1->children()->select_list());
$this->assert_equal(array($album1_1_1->id => "move_to_test_1_1_1"), $album1_2->children()->select_list());
}
开发者ID:xafr,项目名称:gallery3,代码行数:18,代码来源:ORM_MPTT_Test.php
示例19: create_tag_test
public function create_tag_test()
{
$rand = rand();
$root = ORM::factory("item", 1);
$album = album::create($root, $rand, $rand, $rand);
$tag1 = "tag1";
tag::add($album, $tag1);
$tag = ORM::factory("tag")->where("name", $tag1)->find();
$this->assert_true(1, $tag->count);
// Make sure adding the tag again doesn't increase the count
tag::add($album, $tag1);
$tag = ORM::factory("tag")->where("name", $tag1)->find();
$this->assert_true(1, $tag->count);
$rand = rand();
$album = album::create($root, $rand, $rand, $rand);
tag::add($album, $tag1);
$tag = ORM::factory("tag")->where("name", $tag1)->find();
$this->assert_true(2, $tag->count);
}
开发者ID:xafr,项目名称:gallery3,代码行数:19,代码来源:Tag_Test.php
示例20: loadParam
private function loadParam()
{
$param = $_GET;
if (isset($param['p'])) {
$data = unserialize(base64_decode($param['p']));
foreach ($data as $name => $value) {
$param[$name] = $value;
}
}
$session = session::getInstance();
$album = album::getInstance();
if (isset($param['theme'])) {
$session->setData('theme', $param['theme']);
}
if (isset($param['template'])) {
$session->setData('template', $param['template']);
}
if (isset($param['template']) || isset($param['theme'])) {
$session->save();
header('location: http://' . LOCAL_URL . LOCAL_DIR);
echo 1;
}
if (isset($param['mode']) && isset($param['id'])) {
if ($session->getData($param['mode'], 'id') != $param['id']) {
if ($param['mode'] == 'album') {
$parent = $this->album->getParent($session->getData('album', 'id'));
$parent2 = $this->album->getParent($session->getData('album', 'lastId'));
if (!in_array($param['id'], $parent) && !in_array($param['id'], $parent2)) {
$session->setData('album', 'lastId', $param['id']);
}
}
$session->setData($param['mode'], 'page', 1);
$session->setData($param['mode'], 'id', $param['id']);
}
}
if (isset($param['mode']) && $param['mode'] != $session->getData('mode')) {
$session->setData('mode', $param['mode']);
}
if (isset($param['page'])) {
$session->setData($session->getData('mode'), 'page', $param['page']);
}
}
开发者ID:Ashaan,项目名称:phpgallery,代码行数:42,代码来源:index.php
注:本文中的album类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论