116 $sort_order = ( isset($_GET['order']) && in_array($_GET['order'], array('ASC', 'DESC')) ) ? $_GET['order'] : 'ASC'; |
116 $sort_order = ( isset($_GET['order']) && in_array($_GET['order'], array('ASC', 'DESC')) ) ? $_GET['order'] : 'ASC'; |
117 |
117 |
118 // Determine number of pictures per page |
118 // Determine number of pictures per page |
119 $template->load_theme(); |
119 $template->load_theme(); |
120 |
120 |
121 global $theme; |
|
122 $fn = ENANO_ROOT . '/themes/' . $template->theme . '/theme.cfg'; |
|
123 require( $fn ); |
|
124 if ( isset($theme['snapr_gallery_rows']) ) |
|
125 { |
|
126 $rows_in_browser = intval($theme['snapr_gallery_rows']); |
|
127 if ( empty($rows_in_browser) ) |
|
128 { |
|
129 $rows_in_browser = 5; |
|
130 } |
|
131 } |
|
132 else |
|
133 { |
|
134 $rows_in_browser = 5; |
|
135 } |
|
136 |
|
137 $where = 'WHERE folder_parent IS NULL ' . "\n ORDER BY is_folder DESC, $sort_column $sort_order, img_title ASC"; |
121 $where = 'WHERE folder_parent IS NULL ' . "\n ORDER BY is_folder DESC, $sort_column $sort_order, img_title ASC"; |
138 $parms = $paths->getAllParams(); |
122 $parms = $paths->getAllParams(); |
139 |
123 |
140 $sql = "SELECT img_id, img_title, is_folder FROM ".table_prefix."gallery $where;"; |
124 $sql = "SELECT img_id, img_title, is_folder, 'NULL' AS folder_id FROM ".table_prefix."gallery $where;"; |
141 |
125 |
142 // Breadcrumb browser |
126 // Breadcrumb browser |
143 $breadcrumbs = array(); |
127 $breadcrumbs = array(); |
144 $breadcrumbs[] = '<a href="' . makeUrlNS('Special', 'Gallery') . '">Gallery index</a>'; |
128 $breadcrumbs[] = '<a href="' . makeUrlNS('Special', 'Gallery') . '">Gallery index</a>'; |
145 |
129 |
328 |
312 |
329 if ( $session->user_level >= USER_LEVEL_ADMIN && isset($_POST['create_folder']) ) |
313 if ( $session->user_level >= USER_LEVEL_ADMIN && isset($_POST['create_folder']) ) |
330 { |
314 { |
331 if ( !isset($first_row['folder_id']) ) |
315 if ( !isset($first_row['folder_id']) ) |
332 { |
316 { |
|
317 //die('FALLING<pre>' . print_r($first_row, true) . '</pre>'); |
333 $first_row['folder_id'] =& $first_row['img_id']; |
318 $first_row['folder_id'] =& $first_row['img_id']; |
334 } |
319 } |
335 if ( !isset($first_row['folder_id']) ) |
320 if ( !isset($first_row['folder_id']) ) |
336 { |
321 { |
337 $f_errors[] = 'Internal error getting parent folder ID'; |
322 $f_errors[] = 'Internal error getting parent folder ID'; |