public function _home() { global $config, $user, $cache; $this->_artist(); if ((_button() && $this->upload()) || (_button('remove') && $this->remove())) { return; } $sql = 'SELECT g.* FROM _artists a, _artists_images g WHERE a.ub = ? AND a.ub = g.ub ORDER BY image ASC'; $result = sql_rowset(sql_filter($sql, $this->object['ub'])); foreach ($result as $i => $row) { if (!$i) _style('gallery'); _style('gallery.row', array( 'ITEM' => $row['image'], 'URL' => s_link('a', $this->object['subdomain'], 4, $row['image'], 'view'), 'U_FOOTER' => s_link('acp', array('artist_gallery', 'a' => $this->object['subdomain'], 'footer' => $row['image'])), 'IMAGE' => $config['artists_url'] . $this->object['ub'] . '/thumbnails/' . $row['image'] . '.jpg', 'RIMAGE' => get_a_imagepath($config['artists_url'] . $this->object['ub'], $row['image'] . '.jpg', w('x1 gallery')), 'WIDTH' => $row['width'], 'HEIGHT' => $row['height'], 'TFOOTER' => $row['image_footer']) ); } return; }
public function _gallery() { if ($this->make) { return ($this->data['images'] > 1); } global $config; $mode = request_var('mode', ''); $download_id = request_var('download_id', 0); if ($mode == 'view') { if (!$download_id) { redirect(s_link('a', $this->data['subdomain'], 'gallery')); } if ($mode == 'view') { $sql = 'SELECT g.*, COUNT(g2.image) AS prev_images FROM _artists_images g, _artists_images g2 WHERE g.ub = ? AND g2.ub = g.ub AND g.image = ? AND g2.image <= ? GROUP BY g.image ORDER BY g.image ASC'; $sql = sql_filter($sql, $this->data['ub'], $download_id, $download_id); } else { $sql = 'SELECT g.* FROM _artists a, _artists_images g WHERE a.ub = ? AND a.ub = g.ub AND g.image = ?'; $sql = sql_filter($sql, $this->data['ub'], $download_id); } if (!$imagedata = sql_fieldrow($sql)) { redirect(s_link('a', $this->data['subdomain'], 'gallery')); } } switch ($mode) { case 'view': default: if ($mode == 'view') { if (!$this->auth['mod']) { $sql = 'UPDATE _artists_images SET views = views + 1 WHERE ub = ? AND image = ?'; sql_query(sql_filter($sql, $this->data['ub'], $imagedata['image'])); } _style('selected', array( 'IMAGE' => $config['artists_url'] . $this->data['ub'] . '/gallery/' . $imagedata['image'] . '.jpg', 'WIDTH' => $imagedata['width'], 'HEIGHT' => $imagedata['height']) ); /*if ($imagedata['allow_dl']) { _style('selected.download', array( 'URL' => s_link('a', $this->data['subdomain'], 'gallery', $imagedata['image'], 'save')) ); }*/ $this->data['images']--; } // // Get thumbnails // $sql_image = ($download_id) ? sql_filter(' AND g.image <> ? ', $download_id) : ''; $sql = 'SELECT g.* FROM _artists a, _artists_images g WHERE a.ub = ' . $this->data['ub'] . ' AND a.ub = g.ub ' . $sql_image . ' ORDER BY image DESC'; if (!$result = sql_rowset(sql_filter($sql, $this->data['ub']))) { redirect(s_link('a', $this->data['subdomain'], 'gallery')); } foreach ($result as $i => $row) { if (!$i) _style('thumbnails'); _style('thumbnails.row', array( 'URL' => s_link('a', $this->data['subdomain'], 'gallery', $row['image'], 'view'), 'IMAGE' => $config['artists_url'] . $this->data['ub'] . '/thumbnails/' . $row['image'] . '.jpg', 'RIMAGE' => get_a_imagepath($config['artists_path'], $config['artists_url'], $this->data['ub'], $row['image'] . '.jpg', w('x1 gallery')), 'WIDTH' => $row['width'], 'HEIGHT' => $row['height'], 'FOOTER' => $row['image_footer']) ); } break; } return; }