| 
 1. 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.
 28.
 29.
 30.
 31.
 32.
 33.
 34.
 35.
 36.
 37.
 38.
 39.
 40.
 41.
 42.
 43.
 44.
 45.
 46.
 47.
 48.
 49.
 50.
 51.
 52.
 53.
 54.
 55.
 56.
 57.
 58.
 59.
 60.
 61.
 62.
 63.
 64.
 65.
 66.
 67.
 68.
 69.
 70.
 71.
 72.
 73.
 74.
 75.
 76.
 77.
 78.
 79.
 80.
 81.
 82.
 83.
 84.
 85.
 86.
 87.
 88.
 89.
 90.
 91.
 92.
 93.
 94.
 95.
 96.
 97.
 98.
 99.
 100.
 101.
 102.
 103.
 104.
 105.
 106.
 107.
 108.
 109.
 110.
 111.
 112.
 113.
 114.
 115.
 116.
 117.
 118.
 119.
 120.
 121.
 122.
 123.
 124.
 125.
 126.
 127.
 128.
 129.
 130.
 131.
 132.
 133.
 134.
 135.
 136.
 137.
 138.
 139.
 140.
 141.
 142.
 143.
 144.
 145.
 146.
 147.
 148.
 149.
 150.
 151.
 152.
 153.
 154.
 155.
 156.
 157.
 158.
 159.
 160.
 161.
 162.
 163.
 164.
 165.
 166.
 167.
 168.
 169.
 170.
 171.
 172.
 173.
 174.
 175.
 176.
 177.
 178.
 179.
 180.
 181.
 182.
 183.
 184.
 185.
 186.
 187.
 188.
 189.
 190.
 191.
 192.
 193.
 194.
 195.
 196.
 197.
 198.
 199.
 200.
 201.
 202.
 203.
 204.
 205.
 206.
 207.
 208.
 209.
 210.
 211.
 212.
 213.
 214.
 215.
 216.
 217.
 218.
 219.
 
 | 1. / 2. / ... 
 <?php// ClanSphere 2010 - www.clansphere.net
 // $Id$
 
 $cs_lang = cs_translate('gallery');
 
 require_once('mods/gallery/functions.php');
 
 $options = cs_sql_option(__FILE__, 'gallery');
 $data = array();
 $data['options'] = $options;
 $rows = $options['rows'];
 $cols_rows = $options['cols'] * $rows;
 $start = empty($_REQUEST['start']) ? 0 : (int)$_REQUEST['start'];
 $folders_id = empty($_REQUEST['folders_id']) ? 0 : (int)$_REQUEST['folders_id'];
 $access_id = $account['access_gallery'];
 
 if (empty($folders_id)) {
 $data['lang']['getmsg'] = cs_getmsg();
 $from = 'gallery';
 $select = 'gallery_time, gallery_name, gallery_titel, ';
 $select .= 'gallery_description, gallery_id, gallery_vote, gallery_count, folders_id';
 $where = "gallery_status = '1' AND gallery_access <= '" . $access_id . "'";
 $order = 'gallery_id DESC';
 $cs_gallery = cs_sql_select(__FILE__, $from, $select, $where, $order, $start, 0);
 $gallery_loop = count($cs_gallery);
 $from = 'folders';
 $select = 'folders_id, sub_id, folders_name, folders_picture, folders_text, folders_position';
 $where = "folders_mod = 'gallery' AND folders_access <= '" . $access_id . "'";
 $order = 'folders_position ASC';
 $folders = cs_sql_select(__FILE__, $from, $select, $where, $order, '', 0);
 $folders_loop = count($folders);
 
 if (empty($folders_loop)) {
 $no_cat['lang']['no_cat'] = $cs_lang['list_no_cat'];
 }
 else {
 $run = 0;
 foreach ($folders as $a) {
 if ($a['sub_id'] == '0') {
 if (empty($a['folders_picture'])) {
 $cs_lap = cs_html_img('symbols/gallery/image.gif');
 }
 else {
 $cs_lap = cs_html_img("uploads/folders/" . $a['folders_picture']);
 }
 $cat[$run]['img'] = cs_link($cs_lap, 'gallery', 'list', 'folders_id=' . $a['folders_id']);
 $more = 'folders_id=' . $a['folders_id'];
 $cat[$run]['folders_name'] = cs_link($a['folders_name'], 'gallery', 'list', $more);
 $cat[$run]['folders_text'] = !empty($a['folders_text']) ? cs_secure($a['folders_text'], 1, 1) : cs_html_br(1);
 $cat_id_a = $a['folders_id'];
 $pic_loop = '0';
 $last_update = '0';
 
 for ($run_2 = 0; $run_2 < $gallery_loop; $run_2++) {
 $gal_cat_id = $cs_gallery[$run_2]['folders_id'];
 if ($cat_id_a == $gal_cat_id) {
 $pic_loop++;
 if ($last_update <= $cs_gallery[$run_2]['gallery_time']) {
 $last_update = $cs_gallery[$run_2]['gallery_time'];
 }
 }
 }
 
 $select = 'sub.sub_id AS sub_id, sub.folders_id AS folders_id, gal.folders_id AS folders_id, gal.gallery_time AS gallery_time';
 $from = 'folders sub INNER JOIN {pre}_gallery gal ON sub.folders_id = gal.folders_id ';
 $where = "sub.sub_id='" . $a['folders_id'] . "'";
 $order = "gallery_id DESC";
 $count = cs_sql_select(__FILE__, $from, $select, $where, 0, 0, 0);
 $count2 = cs_sql_select(__FILE__, $from, $select, $where, $order, 0, 1);
 $plus = count($count);
 
 if ($last_update <= $count2['gallery_time']) {
 $last_update = $count2['gallery_time'];
 }
 if ($pic_loop == 1 or $plus == 1) {
 $cat[$run]['pic_count'] = sprintf($cs_lang['pic_1'], $pic_loop);
 if (!empty($last_update)) {
 $cat[$run]['last_update'] = $cs_lang['pic_akt'] . cs_date('unix', $last_update, 1);
 }
 }
 else {
 $cat[$run]['pic_count'] = sprintf($cs_lang['pic_2'], $pic_loop + $plus);
 if (!empty($last_update)) {
 $cat[$run]['last_update'] = $cs_lang['pic_akt'] . cs_date('unix', $last_update, 1);
 }
 else {
 $cat[$run]['last_update'] = '';
 }
 }
 
 $run++;
 }
 }
 
 // Latest 5 Pictures!
 if (!empty($cs_gallery) and $options['newest_5'] == '1') {
 $cs_gallery = cs_array_sort($cs_gallery, SORT_DESC, 'gallery_time');
 if ($gallery_loop > $rows) {
 $run_to = $rows;
 }
 else {
 $run_to = $gallery_loop;
 }
 if ($run_to == 1) {
 $data['lang']['last_update'] = $cs_lang['newest1'];
 }
 else {
 $data['lang']['last_update'] = sprintf($cs_lang['newest'], $run_to);
 }
 $last_update = '';
 for ($run = 0; $run < $run_to; $run++) {
 $last_update[$run]['img'] = $cs_gallery[$run]['gallery_id'];
 $cs_lap = cs_html_img('symbols/gallery/nowatermark.gif', '100', $options['thumbs']);
 $more = 'where=' . $cs_gallery[$run]['gallery_id'];
 $last_update[$run]['link'] = cs_link($cs_lap, 'gallery', 'com_view', $more);
 }
 $data['last_update'] = !empty($last_update) ? $last_update : '';
 }
 
 $last_update_1['0']['last_update'] = empty($data['last_update']) ? '' : '1';
 $data['last_update_1'] = !empty($last_update_1['0']['last_update']) ? $last_update_1 : '';
 }
 
 $data['tmp']['no_cat'] = empty($no_cat) ? '' : cs_subtemplate(__FILE__, $no_cat, 'usersgallery', 'users_error_1');
 $data['cat'] = !empty($cat) ? $cat : array();
 if (empty($cat)) {
 $data['last_update_1'] = array();
 }
 echo cs_subtemplate(__FILE__, $data, 'gallery', 'list');
 }
 
 if ($folders_id >= 1) {
 $from = 'gallery';
 $select = 'gallery_time, gallery_name, gallery_titel, ';
 $select .= 'gallery_description, gallery_id, gallery_vote, gallery_count, folders_id';
 $where = "gallery_status = 1 AND gallery_access <= '" . $access_id . "'";
 $where .= " AND folders_id = '" . (int)$folders_id . "'";
 switch ($options['list_sort']) {
 case 0:
 $order = 'gallery_id DESC';
 break;
 case 1:
 $order = 'gallery_id ASC';
 break;
 }
 
 $cs_gallery = cs_sql_select(__FILE__, $from, $select, $where, $order, $start, $cols_rows);
 $gallery_loop = count($cs_gallery);
 $gallery_count = cs_sql_count(__FILE__, 'gallery', $where);
 $from = 'folders';
 $select = 'folders_id, sub_id, folders_name, folders_picture, folders_text, folders_access';
 $where = "folders_mod = 'gallery' AND folders_id = '" . $folders_id . "'";
 $folders_current = cs_sql_select(__FILE__, $from, $select, $where);
 
 if ($folders_current['folders_access'] > $access_id) {
 return;
 }
 
 $where = "folders_mod = 'gallery'";
 $folders = cs_sql_select(__FILE__, $from, $select, $where, 0, 0, 0);
 $folders_loop = count($folders);
 $data['link']['gallery'] = cs_link($cs_lang['mod_name'], 'gallery', 'list');
 $data['link']['subfolders'] = make_folders_head($folders, $folders_current['sub_id'], $folders_current['folders_name']);
 $data['data']['folders_name'] = $folders_current['folders_name'];
 
 if (!empty($folders_loop)) {
 $loop = 0;
 for ($run = 0; $run < $folders_loop; $run++) {
 if ($folders[$run]['sub_id'] == $folders_current['folders_id']) {
 if (empty($folders[$run]['folders_picture'])) {
 $cs_lap = cs_html_img('symbols/gallery/image.gif');
 }
 else {
 $cs_lap = cs_html_img("uploads/folders/" . $folders[$run]['folders_picture']);
 }
 
 $more = 'folders_id=' . $folders[$run]['folders_id'];
 $sub_folders[$loop]['folders_img'] = cs_link($cs_lap, 'gallery', 'list', $more);
 $sub_folders[$loop]['folders_name'] = $folders[$run]['folders_name'];
 $loop++;
 }
 }
 
 $data['sub_folders'] = !empty($sub_folders) ? $sub_folders : '';
 }
 
 if (!empty($gallery_loop)) {
 for ($run = 0; $run < $gallery_loop; $run++) {
 $num = $start + $run;
 $img[$run]['img'] = $cs_gallery[$run]['gallery_id'];
 $cs_lap = cs_html_img('symbols/gallery/nowatermark.gif', '100', $options['thumbs']);
 $img[$run]['link'] = cs_link($cs_lap, 'gallery', 'com_view', 'folders_id=' . $folders_id . '&where=' . $cs_gallery[$run]['gallery_id']);
 }
 
 $data['img'] = !empty($img) ? $img : '';
 $data['data']['pages'] = cs_pages('gallery', 'list', $gallery_count, $start, 0, 1, $cols_rows, 0, 'folders_id=' . $folders_id);
 }
 elseif (empty($data['sub_folders'])) {
 $data['img'] = '';
 $data['data']['pages'] = '';
 $empty_cat['lang']['empty_cat'] = $cs_lang['empty_cat'];
 }
 else {
 $data['data']['pages'] = cs_pages('gallery', 'list', 0, 0);
 $data['img'] = '';
 }
 if (empty($empty_cat['lang']['empty_cat']) and !empty($folders_id)) {
 $cat_list_1['0']['cat_list_1'] = '1';
 }
 else {
 $cat_list_1['0']['cat_list_1'] = '';
 }
 
 $data['sub_folders'] = !empty($sub_folders) ? $sub_folders : '';
 $data['tmp']['empty_cat'] = empty($empty_cat) ? '' : cs_subtemplate(__FILE__, $empty_cat, 'usersgallery', 'users_error_2');
 
 echo cs_subtemplate(__FILE__, $data, 'gallery', 'list_folder');
 }
 |