[ create a new paste ] login | about

Link: http://codepad.org/pAJtqdai    [ raw code | output | fork ]

PHP, pasted on Aug 18:
	public function getGallery($id){
		global $db,$config;
		$cachedir	= $this->_getCacheDir($id, 'gallery');
		$title		= $this->get_cache($id, $cachedir);
		if(!$title['title']){
			$t = $db->super_query("SELECT * FROM web_galleries WHERE id='$id'");
			echo "<!--fresh-->";
			$title['url']			= $t['url'];
			$title['title']			= $t['title'];
			$title['studios']		= $t['studios'];
			$title['categories']	= $t['categories'];

			$im = $db->query("SELECT * FROM web_images WHERE gal_id='$id'");
			$dir = _makeDir($id);
			while($img = $db->get_row($im)){
				$title['images'][] = str_replace("./","http://api.hedehodo.com/", $dir['fullpath'].$img['id'].".jpg");
			}
			$title['pornstars_ids']	= $t['pornstars'];

			$p_stars = explode(",",$t['pornstars']);

			$pstar = implode("','",$p_stars);
			$pm = $db->query("SELECT * FROM web_pornstars WHERE id IN ('".$pstar."')");

			while($ps = $db->get_row($pm)){
				$title['pornstars'][]		= $ps['fullname'];
			}
		}
		$this->set_cache ( $id, $title, $cachedir);
		return $title;
	}


Output:
	public function getGallery($id){
		global $db,$config;
		$cachedir	= $this->_getCacheDir($id, 'gallery');
		$title		= $this->get_cache($id, $cachedir);
		if(!$title['title']){
			$t = $db->super_query("SELECT * FROM web_galleries WHERE id='$id'");
			echo "<!--fresh-->";
			$title['url']			= $t['url'];
			$title['title']			= $t['title'];
			$title['studios']		= $t['studios'];
			$title['categories']	= $t['categories'];

			$im = $db->query("SELECT * FROM web_images WHERE gal_id='$id'");
			$dir = _makeDir($id);
			while($img = $db->get_row($im)){
				$title['images'][] = str_replace("./","http://api.hedehodo.com/", $dir['fullpath'].$img['id'].".jpg");
			}
			$title['pornstars_ids']	= $t['pornstars'];

			$p_stars = explode(",",$t['pornstars']);

			$pstar = implode("','",$p_stars);
			$pm = $db->query("SELECT * FROM web_pornstars WHERE id IN ('".$pstar."')");

			while($ps = $db->get_row($pm)){
				$title['pornstars'][]		= $ps['fullname'];
			}
		}
		$this->set_cache ( $id, $title, $cachedir);
		return $title;
	}


Create a new paste based on this one


Comments: