예제 #1
0
파일: image.php 프로젝트: Ashaan/phpgallery
 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);
 }
예제 #2
0
파일: album.php 프로젝트: Ashaan/phpgallery
 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');
 }
예제 #3
0
 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'];
 }
예제 #4
0
파일: index.php 프로젝트: Ashaan/phpgallery
 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']);
     }
 }