| [ PHPXref.com ] | [ Generated: Sun Jul 20 21:17:54 2008 ] | [ Zoph 0.5.1 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This class corresponds to the album_permissions table which maps a user_id 5 * to a ablum_id + access_level + writable flag. If the user is not an admin, 6 * access to any photo must involve a join with this table to make sure the 7 * user has access to an album that the photo is in. 8 * 9 * This file is part of Zoph. 10 * 11 * Zoph is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * Zoph is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * You should have received a copy of the GNU General Public License 21 * along with Zoph; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 class album_permissions extends zoph_table { 26 27 function album_permissions($uid = -1, $aid = -1) { 28 parent::zoph_table("album_permissions", array("user_id", "album_id"), array("")); 29 $this->set("user_id", $uid); 30 $this->set("album_id", $aid); 31 } 32 33 function insert() { 34 // check if this entry already exists 35 if ($this->lookup()) { 36 return; 37 } 38 39 // insert records for ancestor albums if they don't exist 40 $album = new album($this->get("album_id")); 41 $album->lookup(); 42 43 if ($album->get("parent_album_id") > 0) { 44 $ap = new album_permissions( 45 $this->get("user_id"), $album->get("parent_album_id")); 46 47 $ap->set("access_level", $this->get("access_level")); 48 $ap->set("watermark_level", $this->get("watermark_level")); 49 $ap->set("writable", $this->get("writable")); 50 51 $ap->insert(); 52 } 53 54 parent::insert(1); 55 } 56 57 function delete() { 58 59 // delete records for descendant albums if they exist 60 $album = new album($this->get("album_id")); 61 $album->lookup(); 62 63 $children = $album->get_children(); 64 foreach ($children as $child) { 65 $ap = new album_permissions( 66 $this->get("user_id"), $child->get("album_id")); 67 68 if ($ap->lookup()) { 69 $ap->delete(); 70 } 71 } 72 73 parent::delete(); 74 } 75 76 } 77 78 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |