@@ -146,8 +146,7 @@  | 
                                                    ||
| 146 | 146 | |
| 147 | 147 | $event['additional_sql_data'] = $additional_sql_data;  | 
                                                        
| 148 | 148 | unset($exif);  | 
                                                        
| 149 | - }  | 
                                                        |
| 150 | - else  | 
                                                        |
| 149 | + } else  | 
                                                        |
| 151 | 150 |  		{ | 
                                                        
| 152 | 151 | $additional_sql_data = $event['additional_sql_data'];  | 
                                                        
| 153 | 152 | $additional_sql_data['image_exif_data'] = '';  | 
                                                        
@@ -54,16 +54,16 @@  | 
                                                    ||
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
| 56 | 56 | /**  | 
                                                        
| 57 | - * Constructor  | 
                                                        |
| 58 | - * NOTE: The parameters of this method must match in order and type with  | 
                                                        |
| 59 | - * the dependencies defined in the services.yml file for this service.  | 
                                                        |
| 60 | - *  | 
                                                        |
| 61 | - * @param \phpbb\user $user User object  | 
                                                        |
| 62 | - * @param \phpbbgallery\core\config $gallery_config Core gallery config object  | 
                                                        |
| 63 | - * @param \phpbbgallery\core\auth\auth $gallery_auth Core gallery auth object  | 
                                                        |
| 64 | - * @param \phpbbgallery\core\url $gallery_url Core gallery url object  | 
                                                        |
| 65 | - * @param \phpbbgallery\core\user $gallery_user Core gallery user wrapper  | 
                                                        |
| 66 | - */  | 
                                                        |
| 57 | + * Constructor  | 
                                                        |
| 58 | + * NOTE: The parameters of this method must match in order and type with  | 
                                                        |
| 59 | + * the dependencies defined in the services.yml file for this service.  | 
                                                        |
| 60 | + *  | 
                                                        |
| 61 | + * @param \phpbb\user $user User object  | 
                                                        |
| 62 | + * @param \phpbbgallery\core\config $gallery_config Core gallery config object  | 
                                                        |
| 63 | + * @param \phpbbgallery\core\auth\auth $gallery_auth Core gallery auth object  | 
                                                        |
| 64 | + * @param \phpbbgallery\core\url $gallery_url Core gallery url object  | 
                                                        |
| 65 | + * @param \phpbbgallery\core\user $gallery_user Core gallery user wrapper  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | 67 | |
| 68 | 68 | public function __construct(\phpbb\user $user, \phpbbgallery\core\config $gallery_config, \phpbbgallery\core\auth\auth $gallery_auth, \phpbbgallery\core\url $gallery_url, \phpbbgallery\core\user $gallery_user)  | 
                                                        
| 69 | 69 |  	{ | 
                                                        
@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 | $this->user = $user;  | 
                                                        
| 71 | 71 | $this->gallery_config = $gallery_config;  | 
                                                        
| 72 | 72 | $this->gallery_auth = $gallery_auth;  | 
                                                        
| 73 | - $this->gallery_url = $gallery_url;  | 
                                                        |
| 73 | + $this->gallery_url = $gallery_url;  | 
                                                        |
| 74 | 74 | $this->gallery_user = $gallery_user;  | 
                                                        
| 75 | 75 | }  | 
                                                        
| 76 | 76 | |
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 |  			{ | 
                                                        
| 84 | 84 |  				$this->user->add_lang_ext('phpbbgallery/exif', 'info_exif'); | 
                                                        
| 85 | 85 | |
| 86 | -				$return_ary['vars']['IMAGE_SETTINGS']['disp_exifdata'] = array('lang' => 'DISP_EXIF_DATA',		'validate' => 'bool',	'type' => 'radio:yes_no'); | 
                                                        |
| 86 | +				$return_ary['vars']['IMAGE_SETTINGS']['disp_exifdata'] = array('lang' => 'DISP_EXIF_DATA', 'validate' => 'bool', 'type' => 'radio:yes_no'); | 
                                                        |
| 87 | 87 | $event['return_ary'] = $return_ary;  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | 89 | }  | 
                                                        
@@ -140,10 +140,10 @@ discard block  | 
                                                    ||
| 140 | 140 | }  | 
                                                        
| 141 | 141 | |
| 142 | 142 | /**  | 
                                                        
| 143 | - * Delete reports for given report_ids  | 
                                                        |
| 144 | - *  | 
                                                        |
| 145 | - * @param mixed $report_ids Array or integer with report_id.  | 
                                                        |
| 146 | - */  | 
                                                        |
| 143 | + * Delete reports for given report_ids  | 
                                                        |
| 144 | + *  | 
                                                        |
| 145 | + * @param mixed $report_ids Array or integer with report_id.  | 
                                                        |
| 146 | + */  | 
                                                        |
| 147 | 147 | public function delete($report_ids)  | 
                                                        
| 148 | 148 |  	{ | 
                                                        
| 149 | 149 | $report_ids = self::cast_mixed_int2array($report_ids);  | 
                                                        
@@ -163,10 +163,10 @@ discard block  | 
                                                    ||
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | /**  | 
                                                        
| 166 | - * Delete reports for given image_ids  | 
                                                        |
| 167 | - *  | 
                                                        |
| 168 | - * @param mixed $image_ids Array or integer with image_id.  | 
                                                        |
| 169 | - */  | 
                                                        |
| 166 | + * Delete reports for given image_ids  | 
                                                        |
| 167 | + *  | 
                                                        |
| 168 | + * @param mixed $image_ids Array or integer with image_id.  | 
                                                        |
| 169 | + */  | 
                                                        |
| 170 | 170 | public function delete_images($image_ids)  | 
                                                        
| 171 | 171 |  	{ | 
                                                        
| 172 | 172 | $image_ids = self::cast_mixed_int2array($image_ids);  | 
                                                        
@@ -194,10 +194,10 @@ discard block  | 
                                                    ||
| 194 | 194 | |
| 195 | 195 | |
| 196 | 196 | /**  | 
                                                        
| 197 | - * Delete reports for given album_ids  | 
                                                        |
| 198 | - *  | 
                                                        |
| 199 | - * @param mixed $album_ids Array or integer with album_id.  | 
                                                        |
| 200 | - */  | 
                                                        |
| 197 | + * Delete reports for given album_ids  | 
                                                        |
| 198 | + *  | 
                                                        |
| 199 | + * @param mixed $album_ids Array or integer with album_id.  | 
                                                        |
| 200 | + */  | 
                                                        |
| 201 | 201 | public function delete_albums($album_ids)  | 
                                                        
| 202 | 202 |  	{ | 
                                                        
| 203 | 203 | $album_ids = self::cast_mixed_int2array($album_ids);  | 
                                                        
@@ -249,8 +249,7 @@ discard block  | 
                                                    ||
| 249 | 249 |  			{ | 
                                                        
| 250 | 250 | $mod_array[] = 0;  | 
                                                        
| 251 | 251 | }  | 
                                                        
| 252 | - }  | 
                                                        |
| 253 | - else  | 
                                                        |
| 252 | + } else  | 
                                                        |
| 254 | 253 |  		{ | 
                                                        
| 255 | 254 | $mod_array = array($album);  | 
                                                        
| 256 | 255 | }  | 
                                                        
@@ -340,8 +339,7 @@ discard block  | 
                                                    ||
| 340 | 339 | $this->template->assign_vars(array(  | 
                                                        
| 341 | 340 |  				'TOTAL_PAGES'				=> $this->language->lang('PAGE_TITLE_NUMBER', $page + 1), | 
                                                        
| 342 | 341 | ));  | 
                                                        
| 343 | - }  | 
                                                        |
| 344 | - else  | 
                                                        |
| 342 | + } else  | 
                                                        |
| 345 | 343 |  		{ | 
                                                        
| 346 | 344 | $this->pagination->generate_template_pagination(array(  | 
                                                        
| 347 | 345 | 'routes' => array(  | 
                                                        
@@ -396,8 +394,7 @@ discard block  | 
                                                    ||
| 396 | 394 | if (is_array($ids))  | 
                                                        
| 397 | 395 |  		{ | 
                                                        
| 398 | 396 |  			return array_map('intval', $ids); | 
                                                        
| 399 | - }  | 
                                                        |
| 400 | - else  | 
                                                        |
| 397 | + } else  | 
                                                        |
| 401 | 398 |  		{ | 
                                                        
| 402 | 399 | return array((int) $ids);  | 
                                                        
| 403 | 400 | }  | 
                                                        
@@ -64,7 +64,7 @@ discard block  | 
                                                    ||
| 64 | 64 | protected $reports_table;  | 
                                                        
| 65 | 65 | |
| 66 | 66 | public function __construct(\phpbbgallery\core\log $gallery_log, \phpbbgallery\core\auth\auth $gallery_auth, \phpbb\user $user,  | 
                                                        
| 67 | - \phpbb\language\language $language, \phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader,  | 
                                                        |
| 67 | + \phpbb\language\language $language, \phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader,  | 
                                                        |
| 68 | 68 | \phpbbgallery\core\album\album $album, \phpbb\template\template $template, \phpbb\controller\helper $helper,  | 
                                                        
| 69 | 69 | \phpbbgallery\core\config $gallery_config, \phpbb\pagination $pagination, \phpbbgallery\core\notification\helper $notification_helper,  | 
                                                        
| 70 | 70 | $images_table, $reports_table)  | 
                                                        
@@ -363,7 +363,7 @@ discard block  | 
                                                    ||
| 363 | 363 | 'REPORT_TIME' => $this->user->format_date($VAR['report_time']),  | 
                                                        
| 364 | 364 | ));  | 
                                                        
| 365 | 365 | unset($album_tmp);  | 
                                                        
| 366 | - $reported_images_count ++;  | 
                                                        |
| 366 | + $reported_images_count++;  | 
                                                        |
| 367 | 367 | }  | 
                                                        
| 368 | 368 | $this->template->assign_vars(array(  | 
                                                        
| 369 | 369 |  			'TOTAL_IMAGES_REPORTED' => $status == 1 ? $this->language->lang('WAITING_REPORTED_IMAGE', (int) $count) : $this->language->lang('WAITING_REPORTED_DONE', (int) $count), | 
                                                        
@@ -279,7 +279,7 @@ discard block  | 
                                                    ||
| 279 | 279 | include_once($this->root_path . 'includes/message_parser.' . $this->php_ext);  | 
                                                        
| 280 | 280 | }  | 
                                                        
| 281 | 281 | $message_parser = new \parse_message();  | 
                                                        
| 282 | - $message_parser->message = utf8_normalize_nfc($this->get_description());  | 
                                                        |
| 282 | + $message_parser->message = utf8_normalize_nfc($this->get_description());  | 
                                                        |
| 283 | 283 | if ($message_parser->message)  | 
                                                        
| 284 | 284 |  		{ | 
                                                        
| 285 | 285 | $message_parser->parse(true, true, true, true, false, true, true, true);  | 
                                                        
@@ -334,7 +334,7 @@ discard block  | 
                                                    ||
| 334 | 334 | |
| 335 | 335 | $sql_ary = array_merge($sql_ary, $additional_sql_data);  | 
                                                        
| 336 | 336 | |
| 337 | - $sql = 'UPDATE ' . $this->images_table. '  | 
                                                        |
| 337 | + $sql = 'UPDATE ' . $this->images_table . '  | 
                                                        |
| 338 | 338 |  			SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' | 
                                                        
| 339 | 339 | WHERE image_id = ' . (int) $image_id;  | 
                                                        
| 340 | 340 | $this->db->sql_query($sql);  | 
                                                        
@@ -452,7 +452,7 @@ discard block  | 
                                                    ||
| 452 | 452 | // Rotate the image  | 
                                                        
| 453 | 453 |  		if ($this->gallery_config->get('allow_rotate') && $this->get_rotating()) | 
                                                        
| 454 | 454 |  		{ | 
                                                        
| 455 | -			$this->tools->rotate_image($this->get_rotating(),$this->gallery_config->get('allow_resize')); | 
                                                        |
| 455 | +			$this->tools->rotate_image($this->get_rotating(), $this->gallery_config->get('allow_resize')); | 
                                                        |
| 456 | 456 | if ($this->tools->rotated)  | 
                                                        
| 457 | 457 |  			{ | 
                                                        
| 458 | 458 |  				$this->tools->write_image($this->tools->image_source, $this->gallery_config->get('jpg_quality'), true); | 
                                                        
@@ -144,8 +144,7 @@ discard block  | 
                                                    ||
| 144 | 144 |  			{ | 
                                                        
| 145 | 145 | $this->zip_file = $this->file;  | 
                                                        
| 146 | 146 | $this->upload_zip();  | 
                                                        
| 147 | - }  | 
                                                        |
| 148 | - else  | 
                                                        |
| 147 | + } else  | 
                                                        |
| 149 | 148 |  			{ | 
                                                        
| 150 | 149 | $image_id = $this->prepare_file();  | 
                                                        
| 151 | 150 | if ($image_id)  | 
                                                        
@@ -210,8 +209,7 @@ discard block  | 
                                                    ||
| 210 | 209 | if (is_dir($current_dir . $file))  | 
                                                        
| 211 | 210 |  			{ | 
                                                        
| 212 | 211 | $this->read_zip_folder($current_dir . $file . '/');  | 
                                                        
| 213 | - }  | 
                                                        |
| 214 | - else if (in_array(utf8_substr(strtolower($file), utf8_strrpos($file, '.') + 1), self::get_allowed_types(false, true)))  | 
                                                        |
| 212 | + } else if (in_array(utf8_substr(strtolower($file), utf8_strrpos($file, '.') + 1), self::get_allowed_types(false, true)))  | 
                                                        |
| 215 | 213 |  			{ | 
                                                        
| 216 | 214 | if (!$this->file_limit || ($this->uploaded_files < $this->file_limit))  | 
                                                        
| 217 | 215 |  				{ | 
                                                        
@@ -231,23 +229,20 @@ discard block  | 
                                                    ||
| 231 | 229 |  					{ | 
                                                        
| 232 | 230 | $this->uploaded_files++;  | 
                                                        
| 233 | 231 | $this->images[] = (int) $image_id;  | 
                                                        
| 234 | - }  | 
                                                        |
| 235 | - else  | 
                                                        |
| 232 | + } else  | 
                                                        |
| 236 | 233 |  					{ | 
                                                        
| 237 | 234 | if ($this->file->error)  | 
                                                        
| 238 | 235 |  						{ | 
                                                        
| 239 | 236 |  							$this->new_error($this->language->lang('UPLOAD_ERROR', $this->file->get('uploadname'), implode('<br />» ', $this->file->error))); | 
                                                        
| 240 | 237 | }  | 
                                                        
| 241 | 238 | }  | 
                                                        
| 242 | - }  | 
                                                        |
| 243 | - else  | 
                                                        |
| 239 | + } else  | 
                                                        |
| 244 | 240 |  				{ | 
                                                        
| 245 | 241 | $this->quota_error();  | 
                                                        
| 246 | 242 | @unlink($current_dir . $file);  | 
                                                        
| 247 | 243 | }  | 
                                                        
| 248 | 244 | |
| 249 | - }  | 
                                                        |
| 250 | - else  | 
                                                        |
| 245 | + } else  | 
                                                        |
| 251 | 246 |  			{ | 
                                                        
| 252 | 247 | @unlink($current_dir . $file);  | 
                                                        
| 253 | 248 | }  | 
                                                        
@@ -356,8 +351,7 @@ discard block  | 
                                                    ||
| 356 | 351 |  		{ | 
                                                        
| 357 | 352 |  			$this->file->clean_filename('unique_ext'); | 
                                                        
| 358 | 353 |  			$this->file->move_file(substr($this->gallery_url->path('upload'), 0, -1), false, false, CHMOD_ALL); | 
                                                        
| 359 | - }  | 
                                                        |
| 360 | - else  | 
                                                        |
| 354 | + } else  | 
                                                        |
| 361 | 355 |  		{ | 
                                                        
| 362 | 356 | // Okay, this looks hacky, but what we do here is, we store the directory name in the filename.  | 
                                                        
| 363 | 357 | // However phpBB strips directories form the filename, when moving, so we need to specify that again.  | 
                                                        
@@ -411,8 +405,7 @@ discard block  | 
                                                    ||
| 411 | 405 | //$this->file->height = $this->tools->image_size['height'];  | 
                                                        
| 412 | 406 | //$this->file->width = $this->tools->image_size['width'];  | 
                                                        
| 413 | 407 | }  | 
                                                        
| 414 | - }  | 
                                                        |
| 415 | - else  | 
                                                        |
| 408 | + } else  | 
                                                        |
| 416 | 409 |  			{ | 
                                                        
| 417 | 410 | $this->file->remove();  | 
                                                        
| 418 | 411 |  				$this->new_error($this->language->lang('UPLOAD_ERROR', $this->file->get('uploadname'), $this->language->lang('UPLOAD_IMAGE_SIZE_TOO_BIG'))); | 
                                                        
@@ -15,94 +15,94 @@ discard block  | 
                                                    ||
| 15 | 15 | class upload  | 
                                                        
| 16 | 16 |  { | 
                                                        
| 17 | 17 | /**  | 
                                                        
| 18 | - * @var \phpbb\user  | 
                                                        |
| 19 | - */  | 
                                                        |
| 18 | + * @var \phpbb\user  | 
                                                        |
| 19 | + */  | 
                                                        |
| 20 | 20 | protected $user;  | 
                                                        
| 21 | 21 | |
| 22 | 22 | /**  | 
                                                        
| 23 | - * @var \phpbb\language\language  | 
                                                        |
| 24 | - */  | 
                                                        |
| 23 | + * @var \phpbb\language\language  | 
                                                        |
| 24 | + */  | 
                                                        |
| 25 | 25 | protected $language;  | 
                                                        
| 26 | 26 | |
| 27 | 27 | /**  | 
                                                        
| 28 | - * @var \phpbb\db\driver\driver_interface  | 
                                                        |
| 29 | - */  | 
                                                        |
| 28 | + * @var \phpbb\db\driver\driver_interface  | 
                                                        |
| 29 | + */  | 
                                                        |
| 30 | 30 | protected $db;  | 
                                                        
| 31 | 31 | |
| 32 | 32 | /**  | 
                                                        
| 33 | - * @var \phpbb\event\dispatcher_interface  | 
                                                        |
| 34 | - */  | 
                                                        |
| 33 | + * @var \phpbb\event\dispatcher_interface  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | 35 | protected $phpbb_dispatcher;  | 
                                                        
| 36 | 36 | |
| 37 | 37 | /**  | 
                                                        
| 38 | - * @var \phpbb\request\request  | 
                                                        |
| 39 | - */  | 
                                                        |
| 38 | + * @var \phpbb\request\request  | 
                                                        |
| 39 | + */  | 
                                                        |
| 40 | 40 | protected $request;  | 
                                                        
| 41 | 41 | |
| 42 | 42 | /**  | 
                                                        
| 43 | - * @var \phpbb\files\upload  | 
                                                        |
| 44 | - */  | 
                                                        |
| 43 | + * @var \phpbb\files\upload  | 
                                                        |
| 44 | + */  | 
                                                        |
| 45 | 45 | protected $file_upload;  | 
                                                        
| 46 | 46 | |
| 47 | 47 | /**  | 
                                                        
| 48 | - * @var \phpbbgallery\core\image\image  | 
                                                        |
| 49 | - */  | 
                                                        |
| 48 | + * @var \phpbbgallery\core\image\image  | 
                                                        |
| 49 | + */  | 
                                                        |
| 50 | 50 | protected $gallery_image;  | 
                                                        
| 51 | 51 | |
| 52 | 52 | /**  | 
                                                        
| 53 | - * @var \phpbbgallery\core\config  | 
                                                        |
| 54 | - */  | 
                                                        |
| 53 | + * @var \phpbbgallery\core\config  | 
                                                        |
| 54 | + */  | 
                                                        |
| 55 | 55 | protected $gallery_config;  | 
                                                        
| 56 | 56 | |
| 57 | 57 | /**  | 
                                                        
| 58 | - * @var \phpbbgallery\core\url  | 
                                                        |
| 59 | - */  | 
                                                        |
| 58 | + * @var \phpbbgallery\core\url  | 
                                                        |
| 59 | + */  | 
                                                        |
| 60 | 60 | protected $gallery_url;  | 
                                                        
| 61 | 61 | |
| 62 | 62 | /**  | 
                                                        
| 63 | - * @var \phpbbgallery\core\block  | 
                                                        |
| 64 | - */  | 
                                                        |
| 63 | + * @var \phpbbgallery\core\block  | 
                                                        |
| 64 | + */  | 
                                                        |
| 65 | 65 | protected $block;  | 
                                                        
| 66 | 66 | |
| 67 | 67 | /**  | 
                                                        
| 68 | - * @var \phpbbgallery\core\file\file  | 
                                                        |
| 69 | - */  | 
                                                        |
| 68 | + * @var \phpbbgallery\core\file\file  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | 70 | protected $tools;  | 
                                                        
| 71 | 71 | |
| 72 | 72 | /**  | 
                                                        
| 73 | - * @var string  | 
                                                        |
| 74 | - */  | 
                                                        |
| 73 | + * @var string  | 
                                                        |
| 74 | + */  | 
                                                        |
| 75 | 75 | protected $images_table;  | 
                                                        
| 76 | 76 | |
| 77 | 77 | /**  | 
                                                        
| 78 | - * @var string  | 
                                                        |
| 79 | - */  | 
                                                        |
| 78 | + * @var string  | 
                                                        |
| 79 | + */  | 
                                                        |
| 80 | 80 | protected $root_path;  | 
                                                        
| 81 | 81 | |
| 82 | 82 | /**  | 
                                                        
| 83 | - * @var string  | 
                                                        |
| 84 | - */  | 
                                                        |
| 83 | + * @var string  | 
                                                        |
| 84 | + */  | 
                                                        |
| 85 | 85 | protected $php_ext;  | 
                                                        
| 86 | 86 | |
| 87 | 87 | /**  | 
                                                        
| 88 | - * Number of Files per Directory  | 
                                                        |
| 89 | - *  | 
                                                        |
| 90 | - * If this constant is set to a value >0 the gallery will create a new directory,  | 
                                                        |
| 91 | - * when the current directory has more files in it than set here.  | 
                                                        |
| 92 | - */  | 
                                                        |
| 88 | + * Number of Files per Directory  | 
                                                        |
| 89 | + *  | 
                                                        |
| 90 | + * If this constant is set to a value >0 the gallery will create a new directory,  | 
                                                        |
| 91 | + * when the current directory has more files in it than set here.  | 
                                                        |
| 92 | + */  | 
                                                        |
| 93 | 93 | const NUM_FILES_PER_DIR = 0;  | 
                                                        
| 94 | 94 | |
| 95 | 95 | /**  | 
                                                        
| 96 | - * Objects: phpBB Upload, 2 Files and Image-Functions  | 
                                                        |
| 97 | - */  | 
                                                        |
| 96 | + * Objects: phpBB Upload, 2 Files and Image-Functions  | 
                                                        |
| 97 | + */  | 
                                                        |
| 98 | 98 | private $upload = null;  | 
                                                        
| 99 | 99 | private $file = null;  | 
                                                        
| 100 | 100 | private $zip_file = null;  | 
                                                        
| 101 | 101 | //private $tools = null;  | 
                                                        
| 102 | 102 | |
| 103 | 103 | /**  | 
                                                        
| 104 | - * Basic variables...  | 
                                                        |
| 105 | - */  | 
                                                        |
| 104 | + * Basic variables...  | 
                                                        |
| 105 | + */  | 
                                                        |
| 106 | 106 | public $loaded_files = 0;  | 
                                                        
| 107 | 107 | public $uploaded_files = 0;  | 
                                                        
| 108 | 108 | public $errors = array();  | 
                                                        
@@ -230,8 +230,8 @@ discard block  | 
                                                    ||
| 230 | 230 | }  | 
                                                        
| 231 | 231 | |
| 232 | 232 | /**  | 
                                                        
| 233 | - * Upload a zip file and save the images into the import/ directory.  | 
                                                        |
| 234 | - */  | 
                                                        |
| 233 | + * Upload a zip file and save the images into the import/ directory.  | 
                                                        |
| 234 | + */  | 
                                                        |
| 235 | 235 | public function upload_zip()  | 
                                                        
| 236 | 236 |  	{ | 
                                                        
| 237 | 237 |  		if (!class_exists('compress_zip')) | 
                                                        
@@ -379,14 +379,14 @@ discard block  | 
                                                    ||
| 379 | 379 |  		$file_link = $this->gallery_url->path('upload') . $this->image_data[$image_id]['image_filename']; | 
                                                        
| 380 | 380 | |
| 381 | 381 | /**  | 
                                                        
| 382 | - * Event upload image before  | 
                                                        |
| 383 | - *  | 
                                                        |
| 384 | - * @event phpbbgallery.core.upload.update_image_before  | 
                                                        |
| 385 | - * @var array additional_sql_data array of additional settings  | 
                                                        |
| 386 | - * @var array image_data array of image_data  | 
                                                        |
| 387 | - * @var string file_link link to file  | 
                                                        |
| 388 | - * @since 1.2.0  | 
                                                        |
| 389 | - */  | 
                                                        |
| 382 | + * Event upload image before  | 
                                                        |
| 383 | + *  | 
                                                        |
| 384 | + * @event phpbbgallery.core.upload.update_image_before  | 
                                                        |
| 385 | + * @var array additional_sql_data array of additional settings  | 
                                                        |
| 386 | + * @var array image_data array of image_data  | 
                                                        |
| 387 | + * @var string file_link link to file  | 
                                                        |
| 388 | + * @since 1.2.0  | 
                                                        |
| 389 | + */  | 
                                                        |
| 390 | 390 |  		$vars = array('additional_sql_data', 'image_data', 'file_link'); | 
                                                        
| 391 | 391 |  		extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.upload.update_image_before', compact($vars))); | 
                                                        
| 392 | 392 | |
@@ -394,12 +394,12 @@ discard block  | 
                                                    ||
| 394 | 394 | if (!$this->prepare_file_update($image_id))  | 
                                                        
| 395 | 395 |  		{ | 
                                                        
| 396 | 396 | /**  | 
                                                        
| 397 | - * Event upload image update  | 
                                                        |
| 398 | - *  | 
                                                        |
| 399 | - * @event phpbbgallery.core.upload.update_image_nofilechange  | 
                                                        |
| 400 | - * @var array additional_sql_data array of additional settings  | 
                                                        |
| 401 | - * @since 1.2.0  | 
                                                        |
| 402 | - */  | 
                                                        |
| 397 | + * Event upload image update  | 
                                                        |
| 398 | + *  | 
                                                        |
| 399 | + * @event phpbbgallery.core.upload.update_image_nofilechange  | 
                                                        |
| 400 | + * @var array additional_sql_data array of additional settings  | 
                                                        |
| 401 | + * @since 1.2.0  | 
                                                        |
| 402 | + */  | 
                                                        |
| 403 | 403 |  			$vars = array('additional_sql_data'); | 
                                                        
| 404 | 404 |  			extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.upload.update_image_nofilechange', compact($vars))); | 
                                                        
| 405 | 405 | }  | 
                                                        
@@ -415,8 +415,8 @@ discard block  | 
                                                    ||
| 415 | 415 | }  | 
                                                        
| 416 | 416 | |
| 417 | 417 | /**  | 
                                                        
| 418 | - * Prepare file on upload: rotate and resize  | 
                                                        |
| 419 | - */  | 
                                                        |
| 418 | + * Prepare file on upload: rotate and resize  | 
                                                        |
| 419 | + */  | 
                                                        |
| 420 | 420 | public function prepare_file()  | 
                                                        
| 421 | 421 |  	{ | 
                                                        
| 422 | 422 | $upload_dir = $this->get_current_upload_dir();  | 
                                                        
@@ -446,13 +446,13 @@ discard block  | 
                                                    ||
| 446 | 446 | $file = $this->file;  | 
                                                        
| 447 | 447 | |
| 448 | 448 | /**  | 
                                                        
| 449 | - * Event upload image update  | 
                                                        |
| 450 | - *  | 
                                                        |
| 451 | - * @event phpbbgallery.core.upload.prepare_file_before  | 
                                                        |
| 452 | - * @var array additional_sql_data array of additional settings  | 
                                                        |
| 453 | - * @var array file File object  | 
                                                        |
| 454 | - * @since 1.2.0  | 
                                                        |
| 455 | - */  | 
                                                        |
| 449 | + * Event upload image update  | 
                                                        |
| 450 | + *  | 
                                                        |
| 451 | + * @event phpbbgallery.core.upload.prepare_file_before  | 
                                                        |
| 452 | + * @var array additional_sql_data array of additional settings  | 
                                                        |
| 453 | + * @var array file File object  | 
                                                        |
| 454 | + * @since 1.2.0  | 
                                                        |
| 455 | + */  | 
                                                        |
| 456 | 456 |  		$vars = array('additional_sql_data', 'file'); | 
                                                        
| 457 | 457 |  		extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.upload.prepare_file_before', compact($vars))); | 
                                                        
| 458 | 458 | |
@@ -804,8 +804,8 @@ discard block  | 
                                                    ||
| 804 | 804 | }  | 
                                                        
| 805 | 805 | |
| 806 | 806 | /**  | 
                                                        
| 807 | - * Generate some kind of check so users only complete the upload for their images  | 
                                                        |
| 808 | - */  | 
                                                        |
| 807 | + * Generate some kind of check so users only complete the upload for their images  | 
                                                        |
| 808 | + */  | 
                                                        |
| 809 | 809 | public function generate_hidden_fields()  | 
                                                        
| 810 | 810 |  	{ | 
                                                        
| 811 | 811 | $checks = array();  | 
                                                        
@@ -34,18 +34,18 @@ discard block  | 
                                                    ||
| 34 | 34 | const NUM_IMAGES = 3;  | 
                                                        
| 35 | 35 | |
| 36 | 36 | /**  | 
                                                        
| 37 | - * There are different modes to calculate who won the contest.  | 
                                                        |
| 38 | - * This value should be one of the constant-names below.  | 
                                                        |
| 39 | - */  | 
                                                        |
| 37 | + * There are different modes to calculate who won the contest.  | 
                                                        |
| 38 | + * This value should be one of the constant-names below.  | 
                                                        |
| 39 | + */  | 
                                                        |
| 40 | 40 | static public $mode = self::MODE_AVERAGE;  | 
                                                        
| 41 | 41 | |
| 42 | 42 | /**  | 
                                                        
| 43 | - * The image with the highest average wins.  | 
                                                        |
| 44 | - */  | 
                                                        |
| 43 | + * The image with the highest average wins.  | 
                                                        |
| 44 | + */  | 
                                                        |
| 45 | 45 | const MODE_AVERAGE = 1;  | 
                                                        
| 46 | 46 | /**  | 
                                                        
| 47 | - * The image with the highest number of total points wins.  | 
                                                        |
| 48 | - */  | 
                                                        |
| 47 | + * The image with the highest number of total points wins.  | 
                                                        |
| 48 | + */  | 
                                                        |
| 49 | 49 | const MODE_SUM = 2;  | 
                                                        
| 50 | 50 | |
| 51 | 51 | public function __construct(\phpbb\db\driver\driver_interface $db,  | 
                                                        
@@ -59,14 +59,14 @@ discard block  | 
                                                    ||
| 59 | 59 | }  | 
                                                        
| 60 | 60 | |
| 61 | 61 | /**  | 
                                                        
| 62 | - * Get the contest row from the table  | 
                                                        |
| 63 | - *  | 
                                                        |
| 64 | - * @param int $id ID of the contest or album, depending on second parameter  | 
                                                        |
| 65 | - * @param string $mode contest or album ID to get the contest.  | 
                                                        |
| 66 | - * @param bool $throw_error Shall we throw an error if the contest was not found?  | 
                                                        |
| 67 | - *  | 
                                                        |
| 68 | - * @return mixed Either the array or boolean false if contest does not exist  | 
                                                        |
| 69 | - */  | 
                                                        |
| 62 | + * Get the contest row from the table  | 
                                                        |
| 63 | + *  | 
                                                        |
| 64 | + * @param int $id ID of the contest or album, depending on second parameter  | 
                                                        |
| 65 | + * @param string $mode contest or album ID to get the contest.  | 
                                                        |
| 66 | + * @param bool $throw_error Shall we throw an error if the contest was not found?  | 
                                                        |
| 67 | + *  | 
                                                        |
| 68 | + * @return mixed Either the array or boolean false if contest does not exist  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | 70 | public function get_contest($id, $mode = 'contest', $throw_error = true)  | 
                                                        
| 71 | 71 |  	{ | 
                                                        
| 72 | 72 | $sql = 'SELECT *  | 
                                                        
@@ -190,9 +190,9 @@  | 
                                                    ||
| 190 | 190 | $this->db->sql_freeresult($result);  | 
                                                        
| 191 | 191 | |
| 192 | 192 | $sql = 'UPDATE ' . $this->contest_table . '  | 
                                                        
| 193 | - SET contest_first = ' . (int) $first .',  | 
                                                        |
| 194 | - contest_second = ' . (int) $second .',  | 
                                                        |
| 195 | - contest_third = ' . (int) $third .'  | 
                                                        |
| 193 | + SET contest_first = ' . (int) $first . ',  | 
                                                        |
| 194 | + contest_second = ' . (int) $second . ',  | 
                                                        |
| 195 | + contest_third = ' . (int) $third . '  | 
                                                        |
| 196 | 196 | WHERE contest_album_id = ' . (int) $album_id;  | 
                                                        
| 197 | 197 | $this->db->sql_query($sql);  | 
                                                        
| 198 | 198 | |
@@ -165,8 +165,7 @@  | 
                                                    ||
| 165 | 165 |  			{ | 
                                                        
| 166 | 166 | $this->resync($album_id);  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | - }  | 
                                                        |
| 169 | - else  | 
                                                        |
| 168 | + } else  | 
                                                        |
| 170 | 169 |  		{ | 
                                                        
| 171 | 170 | $this->resync((int) $album_ids);  | 
                                                        
| 172 | 171 | }  | 
                                                        
@@ -158,7 +158,7 @@ discard block  | 
                                                    ||
| 158 | 158 | */  | 
                                                        
| 159 | 159 | public function display_box()  | 
                                                        
| 160 | 160 |  	{ | 
                                                        
| 161 | -		$this->template->assign_var('GALLERY_RATING', self::MODE_SELECT);//@todo: phpbb_ext_gallery_core_config::get('rating_mode')); | 
                                                        |
| 161 | +		$this->template->assign_var('GALLERY_RATING', self::MODE_SELECT); //@todo: phpbb_ext_gallery_core_config::get('rating_mode')); | 
                                                        |
| 162 | 162 | |
| 163 | 163 |  		switch (self::MODE_SELECT)//@todo: phpbb_ext_gallery_core_config::get('rating_mode')) | 
                                                        
| 164 | 164 |  		{ | 
                                                        
@@ -201,7 +201,7 @@ discard block  | 
                                                    ||
| 201 | 201 | */  | 
                                                        
| 202 | 202 | public function get_image_rating($user_rating = false, $display_contest_end = true)  | 
                                                        
| 203 | 203 |  	{ | 
                                                        
| 204 | -		$this->template->assign_var('GALLERY_RATING', self::MODE_SELECT);//@todo: phpbb_ext_gallery_core_config::get('rating_mode')); | 
                                                        |
| 204 | +		$this->template->assign_var('GALLERY_RATING', self::MODE_SELECT); //@todo: phpbb_ext_gallery_core_config::get('rating_mode')); | 
                                                        |
| 205 | 205 | |
| 206 | 206 |  		switch (self::MODE_SELECT)//@todo: phpbb_ext_gallery_core_config::get('rating_mode')) | 
                                                        
| 207 | 207 |  		{ | 
                                                        
@@ -216,8 +216,7 @@ discard block  | 
                                                    ||
| 216 | 216 |  						return $this->language->lang('CONTEST_RATING_HIDDEN'); | 
                                                        
| 217 | 217 | }  | 
                                                        
| 218 | 218 |  					return $this->language->lang('CONTEST_RESULT_HIDDEN', $this->user->format_date(($this->album_data('contest_start') + $this->album_data('contest_end')), false, true)); | 
                                                        
| 219 | - }  | 
                                                        |
| 220 | - else  | 
                                                        |
| 219 | + } else  | 
                                                        |
| 221 | 220 |  				{ | 
                                                        
| 222 | 221 | if ($user_rating)  | 
                                                        
| 223 | 222 |  					{ | 
                                                        
@@ -364,8 +363,7 @@ discard block  | 
                                                    ||
| 364 | 363 | if (is_array($image_ids))  | 
                                                        
| 365 | 364 |  		{ | 
                                                        
| 366 | 365 |  			$image_ids = array_map('intval', $image_ids); | 
                                                        
| 367 | - }  | 
                                                        |
| 368 | - else  | 
                                                        |
| 366 | + } else  | 
                                                        |
| 369 | 367 |  		{ | 
                                                        
| 370 | 368 | $image_ids = (int) $image_ids;  | 
                                                        
| 371 | 369 | }  | 
                                                        
@@ -399,8 +397,7 @@ discard block  | 
                                                    ||
| 399 | 397 | if (is_array($image_ids))  | 
                                                        
| 400 | 398 |  		{ | 
                                                        
| 401 | 399 |  			$image_ids = array_map('intval', $image_ids); | 
                                                        
| 402 | - }  | 
                                                        |
| 403 | - else  | 
                                                        |
| 400 | + } else  | 
                                                        |
| 404 | 401 |  		{ | 
                                                        
| 405 | 402 | $image_ids = (int) $image_ids;  | 
                                                        
| 406 | 403 | }  | 
                                                        
@@ -13,91 +13,91 @@ discard block  | 
                                                    ||
| 13 | 13 | class rating  | 
                                                        
| 14 | 14 |  { | 
                                                        
| 15 | 15 | /**  | 
                                                        
| 16 | - * @var \phpbb\db\driver\driver_interface  | 
                                                        |
| 17 | - */  | 
                                                        |
| 16 | + * @var \phpbb\db\driver\driver_interface  | 
                                                        |
| 17 | + */  | 
                                                        |
| 18 | 18 | protected $db;  | 
                                                        
| 19 | 19 | |
| 20 | 20 | /**  | 
                                                        
| 21 | - * @var \phpbb\template\template  | 
                                                        |
| 22 | - */  | 
                                                        |
| 21 | + * @var \phpbb\template\template  | 
                                                        |
| 22 | + */  | 
                                                        |
| 23 | 23 | protected $template;  | 
                                                        
| 24 | 24 | |
| 25 | 25 | /**  | 
                                                        
| 26 | - * @var \phpbb\user  | 
                                                        |
| 27 | - */  | 
                                                        |
| 26 | + * @var \phpbb\user  | 
                                                        |
| 27 | + */  | 
                                                        |
| 28 | 28 | protected $user;  | 
                                                        
| 29 | 29 | |
| 30 | 30 | /**  | 
                                                        
| 31 | - * @var \phpbb\language\language  | 
                                                        |
| 32 | - */  | 
                                                        |
| 31 | + * @var \phpbb\language\language  | 
                                                        |
| 32 | + */  | 
                                                        |
| 33 | 33 | protected $language;  | 
                                                        
| 34 | 34 | |
| 35 | 35 | /**  | 
                                                        
| 36 | - * @var \phpbb\request\request  | 
                                                        |
| 37 | - */  | 
                                                        |
| 36 | + * @var \phpbb\request\request  | 
                                                        |
| 37 | + */  | 
                                                        |
| 38 | 38 | protected $request;  | 
                                                        
| 39 | 39 | |
| 40 | 40 | /**  | 
                                                        
| 41 | - * @var \phpbbgallery\core\config  | 
                                                        |
| 42 | - */  | 
                                                        |
| 41 | + * @var \phpbbgallery\core\config  | 
                                                        |
| 42 | + */  | 
                                                        |
| 43 | 43 | protected $gallery_config;  | 
                                                        
| 44 | 44 | |
| 45 | 45 | /**  | 
                                                        
| 46 | - * @var \phpbbgallery\core\auth\auth  | 
                                                        |
| 47 | - */  | 
                                                        |
| 46 | + * @var \phpbbgallery\core\auth\auth  | 
                                                        |
| 47 | + */  | 
                                                        |
| 48 | 48 | protected $gallery_auth;  | 
                                                        
| 49 | 49 | |
| 50 | 50 | /**  | 
                                                        
| 51 | - * @var string  | 
                                                        |
| 52 | - */  | 
                                                        |
| 51 | + * @var string  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | 53 | protected $images_table;  | 
                                                        
| 54 | 54 | |
| 55 | 55 | /**  | 
                                                        
| 56 | - * @var string  | 
                                                        |
| 57 | - */  | 
                                                        |
| 56 | + * @var string  | 
                                                        |
| 57 | + */  | 
                                                        |
| 58 | 58 | protected $albums_table;  | 
                                                        
| 59 | 59 | |
| 60 | 60 | /**  | 
                                                        
| 61 | - * @var string  | 
                                                        |
| 62 | - */  | 
                                                        |
| 61 | + * @var string  | 
                                                        |
| 62 | + */  | 
                                                        |
| 63 | 63 | protected $rates_table;  | 
                                                        
| 64 | 64 | |
| 65 | 65 | /**  | 
                                                        
| 66 | - * The image ID we want to rate  | 
                                                        |
| 67 | - */  | 
                                                        |
| 66 | + * The image ID we want to rate  | 
                                                        |
| 67 | + */  | 
                                                        |
| 68 | 68 | public $image_id = 0;  | 
                                                        
| 69 | 69 | |
| 70 | 70 | /**  | 
                                                        
| 71 | - * Private objects with the values for the image/album from the database  | 
                                                        |
| 72 | - */  | 
                                                        |
| 71 | + * Private objects with the values for the image/album from the database  | 
                                                        |
| 72 | + */  | 
                                                        |
| 73 | 73 | private $image_data = null;  | 
                                                        
| 74 | 74 | private $album_data = null;  | 
                                                        
| 75 | 75 | |
| 76 | 76 | /**  | 
                                                        
| 77 | - * Rating the user gave the image.  | 
                                                        |
| 78 | - */  | 
                                                        |
| 77 | + * Rating the user gave the image.  | 
                                                        |
| 78 | + */  | 
                                                        |
| 79 | 79 | public $user_rating = null;  | 
                                                        
| 80 | 80 | |
| 81 | 81 | /**  | 
                                                        
| 82 | - * Is rating currently possible?  | 
                                                        |
| 83 | - * Might be blocked because of contest-settings.  | 
                                                        |
| 84 | - */  | 
                                                        |
| 82 | + * Is rating currently possible?  | 
                                                        |
| 83 | + * Might be blocked because of contest-settings.  | 
                                                        |
| 84 | + */  | 
                                                        |
| 85 | 85 | public $rating_enabled = false;  | 
                                                        
| 86 | 86 | |
| 87 | 87 | /**  | 
                                                        
| 88 | - * Classic-rating box with a dropdown.  | 
                                                        |
| 89 | - */  | 
                                                        |
| 88 | + * Classic-rating box with a dropdown.  | 
                                                        |
| 89 | + */  | 
                                                        |
| 90 | 90 | const MODE_SELECT = 1;  | 
                                                        
| 91 | 91 | |
| 92 | 92 | /**  | 
                                                        
| 93 | - * Rating with stars, like the old-system from youtube.  | 
                                                        |
| 93 | + * Rating with stars, like the old-system from youtube.  | 
                                                        |
| 94 | 94 | //@todo: const MODE_STARS = 2;  | 
                                                        
| 95 | - */  | 
                                                        |
| 95 | + */  | 
                                                        |
| 96 | 96 | |
| 97 | 97 | /**  | 
                                                        
| 98 | - * Simple thumbs up or down.  | 
                                                        |
| 98 | + * Simple thumbs up or down.  | 
                                                        |
| 99 | 99 | //@todo: const MODE_THUMB = 3;  | 
                                                        
| 100 | - */  | 
                                                        |
| 100 | + */  | 
                                                        |
| 101 | 101 | |
| 102 | 102 | /**  | 
                                                        
| 103 | 103 | * Constructor  | 
                                                        
@@ -204,8 +204,8 @@ discard block  | 
                                                    ||
| 204 | 204 | }  | 
                                                        
| 205 | 205 | |
| 206 | 206 | /**  | 
                                                        
| 207 | - * Displays the box where the user can rate the image.  | 
                                                        |
| 208 | - */  | 
                                                        |
| 207 | + * Displays the box where the user can rate the image.  | 
                                                        |
| 208 | + */  | 
                                                        |
| 209 | 209 | public function display_box()  | 
                                                        
| 210 | 210 |  	{ | 
                                                        
| 211 | 211 |  		$this->template->assign_var('GALLERY_RATING', self::MODE_SELECT);//@todo: phpbb_ext_gallery_core_config::get('rating_mode')); | 
                                                        
@@ -280,8 +280,8 @@ discard block  | 
                                                    ||
| 280 | 280 | }  | 
                                                        
| 281 | 281 | |
| 282 | 282 | /**  | 
                                                        
| 283 | - * Get rated value for a image  | 
                                                        |
| 284 | - */  | 
                                                        |
| 283 | + * Get rated value for a image  | 
                                                        |
| 284 | + */  | 
                                                        |
| 285 | 285 | private function get_image_rating_value()  | 
                                                        
| 286 | 286 |  	{ | 
                                                        
| 287 | 287 | /*if (phpbb_ext_gallery_core_contest::$mode == phpbb_ext_gallery_core_contest::MODE_SUM)  | 
                                                        
@@ -295,14 +295,14 @@ discard block  | 
                                                    ||
| 295 | 295 | }  | 
                                                        
| 296 | 296 | |
| 297 | 297 | /**  | 
                                                        
| 298 | - * Is the user allowed to rate?  | 
                                                        |
| 299 | - * Following statements must be true:  | 
                                                        |
| 300 | - * - User must have permissions.  | 
                                                        |
| 301 | - * - User is neither owner of the image nor guest.  | 
                                                        |
| 302 | - * - Album and image are not locked.  | 
                                                        |
| 303 | - *  | 
                                                        |
| 304 | - * @return bool  | 
                                                        |
| 305 | - */  | 
                                                        |
| 298 | + * Is the user allowed to rate?  | 
                                                        |
| 299 | + * Following statements must be true:  | 
                                                        |
| 300 | + * - User must have permissions.  | 
                                                        |
| 301 | + * - User is neither owner of the image nor guest.  | 
                                                        |
| 302 | + * - Album and image are not locked.  | 
                                                        |
| 303 | + *  | 
                                                        |
| 304 | + * @return bool  | 
                                                        |
| 305 | + */  | 
                                                        |
| 306 | 306 | public function is_allowed()  | 
                                                        
| 307 | 307 |  	{ | 
                                                        
| 308 | 308 |  		return $this->gallery_auth->acl_check('i_rate', $this->album_data('album_id'), $this->album_data('album_user_id')) && | 
                                                        
@@ -311,25 +311,25 @@ discard block  | 
                                                    ||
| 311 | 311 | }  | 
                                                        
| 312 | 312 | |
| 313 | 313 | /**  | 
                                                        
| 314 | - * Is the user able to rate?  | 
                                                        |
| 315 | - * Following statements must be true:  | 
                                                        |
| 316 | - * - User must be allowed to rate  | 
                                                        |
| 317 | - * - If the image is in a contest, it must be in the rating timespan  | 
                                                        |
| 318 | - *  | 
                                                        |
| 319 | - * @return bool  | 
                                                        |
| 320 | - */  | 
                                                        |
| 314 | + * Is the user able to rate?  | 
                                                        |
| 315 | + * Following statements must be true:  | 
                                                        |
| 316 | + * - User must be allowed to rate  | 
                                                        |
| 317 | + * - If the image is in a contest, it must be in the rating timespan  | 
                                                        |
| 318 | + *  | 
                                                        |
| 319 | + * @return bool  | 
                                                        |
| 320 | + */  | 
                                                        |
| 321 | 321 | public function is_able()  | 
                                                        
| 322 | 322 |  	{ | 
                                                        
| 323 | 323 |  		return $this->is_allowed(); //&& phpbb_ext_gallery_core_contest::is_step('rate', $this->album_data(true)); | 
                                                        
| 324 | 324 | }  | 
                                                        
| 325 | 325 | |
| 326 | 326 | /**  | 
                                                        
| 327 | - * Get rating from a user for a given image  | 
                                                        |
| 328 | - *  | 
                                                        |
| 329 | - * @param int $user_id  | 
                                                        |
| 330 | - *  | 
                                                        |
| 331 | - * @return mixed False if the user did not rate or is guest, otherwise int the points.  | 
                                                        |
| 332 | - */  | 
                                                        |
| 327 | + * Get rating from a user for a given image  | 
                                                        |
| 328 | + *  | 
                                                        |
| 329 | + * @param int $user_id  | 
                                                        |
| 330 | + *  | 
                                                        |
| 331 | + * @return mixed False if the user did not rate or is guest, otherwise int the points.  | 
                                                        |
| 332 | + */  | 
                                                        |
| 333 | 333 | public function get_user_rating($user_id)  | 
                                                        
| 334 | 334 |  	{ | 
                                                        
| 335 | 335 | if (isset($this->user_rating[$user_id]))  | 
                                                        
@@ -405,10 +405,10 @@ discard block  | 
                                                    ||
| 405 | 405 | }  | 
                                                        
| 406 | 406 | |
| 407 | 407 | /**  | 
                                                        
| 408 | - * Recalculate the average image-rating and such stuff.  | 
                                                        |
| 409 | - *  | 
                                                        |
| 410 | - * @param mixed $image_ids Array or integer with image_id where we recalculate the rating.  | 
                                                        |
| 411 | - */  | 
                                                        |
| 408 | + * Recalculate the average image-rating and such stuff.  | 
                                                        |
| 409 | + *  | 
                                                        |
| 410 | + * @param mixed $image_ids Array or integer with image_id where we recalculate the rating.  | 
                                                        |
| 411 | + */  | 
                                                        |
| 412 | 412 | public function recalc_image_rating($image_ids)  | 
                                                        
| 413 | 413 |  	{ | 
                                                        
| 414 | 414 | if (is_array($image_ids))  | 
                                                        
@@ -439,11 +439,11 @@ discard block  | 
                                                    ||
| 439 | 439 | }  | 
                                                        
| 440 | 440 | |
| 441 | 441 | /**  | 
                                                        
| 442 | - * Delete all ratings for given image_ids  | 
                                                        |
| 443 | - *  | 
                                                        |
| 444 | - * @param mixed $image_ids Array or integer with image_id where we delete the rating.  | 
                                                        |
| 445 | - * @param bool $reset_average Shall we also reset the average? We can save that query, when the images are deleted anyway.  | 
                                                        |
| 446 | - */  | 
                                                        |
| 442 | + * Delete all ratings for given image_ids  | 
                                                        |
| 443 | + *  | 
                                                        |
| 444 | + * @param mixed $image_ids Array or integer with image_id where we delete the rating.  | 
                                                        |
| 445 | + * @param bool $reset_average Shall we also reset the average? We can save that query, when the images are deleted anyway.  | 
                                                        |
| 446 | + */  | 
                                                        |
| 447 | 447 | public function delete_ratings($image_ids, $reset_average = false)  | 
                                                        
| 448 | 448 |  	{ | 
                                                        
| 449 | 449 | if (is_array($image_ids))  | 
                                                        
@@ -23,13 +23,13 @@ discard block  | 
                                                    ||
| 23 | 23 | *  | 
                                                        
| 24 | 24 | * Constants defining some album properties  | 
                                                        
| 25 | 25 | */  | 
                                                        
| 26 | - const PUBLIC_ALBUM = 0;  | 
                                                        |
| 26 | + const PUBLIC_ALBUM = 0;  | 
                                                        |
| 27 | 27 | |
| 28 | - const TYPE_CAT = 0;  | 
                                                        |
| 29 | - const TYPE_UPLOAD = 1;  | 
                                                        |
| 28 | + const TYPE_CAT = 0;  | 
                                                        |
| 29 | + const TYPE_UPLOAD = 1;  | 
                                                        |
| 30 | 30 | const TYPE_CONTEST = 2;  | 
                                                        
| 31 | 31 | |
| 32 | - const ALBUM_OPEN = 0;  | 
                                                        |
| 32 | + const ALBUM_OPEN = 0;  | 
                                                        |
| 33 | 33 | const ALBUM_LOCKED = 1;  | 
                                                        
| 34 | 34 | |
| 35 | 35 | /**  | 
                                                        
@@ -58,22 +58,22 @@ discard block  | 
                                                    ||
| 58 | 58 | /**  | 
                                                        
| 59 | 59 | * Only visible for moderators.  | 
                                                        
| 60 | 60 | */  | 
                                                        
| 61 | - const STATUS_UNAPPROVED = 0;  | 
                                                        |
| 61 | + const STATUS_UNAPPROVED = 0;  | 
                                                        |
| 62 | 62 | |
| 63 | 63 | /**  | 
                                                        
| 64 | 64 | * Visible for everyone with the i_view-permissions  | 
                                                        
| 65 | 65 | */  | 
                                                        
| 66 | - const STATUS_APPROVED = 1;  | 
                                                        |
| 66 | + const STATUS_APPROVED = 1;  | 
                                                        |
| 67 | 67 | |
| 68 | 68 | /**  | 
                                                        
| 69 | 69 | * Visible for everyone with the i_view-permissions, but only moderators can comment.  | 
                                                        
| 70 | 70 | */  | 
                                                        
| 71 | - const STATUS_LOCKED = 2;  | 
                                                        |
| 71 | + const STATUS_LOCKED = 2;  | 
                                                        |
| 72 | 72 | |
| 73 | 73 | /**  | 
                                                        
| 74 | 74 | * Orphan files are only visible for their author, because they're not yet ready uploaded.  | 
                                                        
| 75 | 75 | */  | 
                                                        
| 76 | - const STATUS_ORPHAN = 3;  | 
                                                        |
| 76 | + const STATUS_ORPHAN = 3;  | 
                                                        |
| 77 | 77 | |
| 78 | 78 | /**  | 
                                                        
| 79 | 79 | * Constants regarding the image contest relation  | 
                                                        
@@ -316,7 +316,7 @@  | 
                                                    ||
| 316 | 316 | |
| 317 | 317 | public function generate_image_src()  | 
                                                        
| 318 | 318 |  	{ | 
                                                        
| 319 | - $this->image_src = $this->path . $this->data['image_filename'];  | 
                                                        |
| 319 | + $this->image_src = $this->path . $this->data['image_filename'];  | 
                                                        |
| 320 | 320 | |
| 321 | 321 | if ($this->data['image_filemissing'] || !file_exists($this->path_source . $this->data['image_filename']))  | 
                                                        
| 322 | 322 |  		{ | 
                                                        
@@ -104,12 +104,12 @@ discard block  | 
                                                    ||
| 104 | 104 | }  | 
                                                        
| 105 | 105 | |
| 106 | 106 | /**  | 
                                                        
| 107 | - * Image File Controller  | 
                                                        |
| 108 | -	*	Route: gallery/image/{image_id}/source | 
                                                        |
| 109 | - *  | 
                                                        |
| 110 | - * @param int $image_id  | 
                                                        |
| 111 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 112 | - */  | 
                                                        |
| 107 | + * Image File Controller  | 
                                                        |
| 108 | +	 *	Route: gallery/image/{image_id}/source | 
                                                        |
| 109 | + *  | 
                                                        |
| 110 | + * @param int $image_id  | 
                                                        |
| 111 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 112 | + */  | 
                                                        |
| 113 | 113 | public function source($image_id)  | 
                                                        
| 114 | 114 |  	{ | 
                                                        
| 115 | 115 | $this->auth->load_user_permissions($this->user->data['user_id']);  | 
                                                        
@@ -160,12 +160,12 @@ discard block  | 
                                                    ||
| 160 | 160 | }  | 
                                                        
| 161 | 161 | |
| 162 | 162 | /**  | 
                                                        
| 163 | - * Image File Controller  | 
                                                        |
| 164 | -	*	Route: gallery/image/{image_id}/medium | 
                                                        |
| 165 | - *  | 
                                                        |
| 166 | - * @param int $image_id  | 
                                                        |
| 167 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 168 | - */  | 
                                                        |
| 163 | + * Image File Controller  | 
                                                        |
| 164 | +	 *	Route: gallery/image/{image_id}/medium | 
                                                        |
| 165 | + *  | 
                                                        |
| 166 | + * @param int $image_id  | 
                                                        |
| 167 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 168 | + */  | 
                                                        |
| 169 | 169 | public function medium($image_id)  | 
                                                        
| 170 | 170 |  	{ | 
                                                        
| 171 | 171 | |
@@ -195,12 +195,12 @@ discard block  | 
                                                    ||
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
| 197 | 197 | /**  | 
                                                        
| 198 | - * Image File Controller  | 
                                                        |
| 199 | -	*	Route: gallery/image/{image_id}/mini | 
                                                        |
| 200 | - *  | 
                                                        |
| 201 | - * @param int $image_id  | 
                                                        |
| 202 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 203 | - */  | 
                                                        |
| 198 | + * Image File Controller  | 
                                                        |
| 199 | +	 *	Route: gallery/image/{image_id}/mini | 
                                                        |
| 200 | + *  | 
                                                        |
| 201 | + * @param int $image_id  | 
                                                        |
| 202 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 203 | + */  | 
                                                        |
| 204 | 204 | public function mini($image_id)  | 
                                                        
| 205 | 205 |  	{ | 
                                                        
| 206 | 206 | $this->path = $this->path_mini;  | 
                                                        
@@ -356,11 +356,11 @@ discard block  | 
                                                    ||
| 356 | 356 | }  | 
                                                        
| 357 | 357 | |
| 358 | 358 | /**  | 
                                                        
| 359 | - * Image File Controller  | 
                                                        |
| 360 | -	*	Route: gallery/image/{image_id}/x | 
                                                        |
| 361 | - *  | 
                                                        |
| 362 | - * @return \Symfony\Component\HttpFoundation\BinaryFileResponseResponse A Symfony Response object  | 
                                                        |
| 363 | - */  | 
                                                        |
| 359 | + * Image File Controller  | 
                                                        |
| 360 | +	 *	Route: gallery/image/{image_id}/x | 
                                                        |
| 361 | + *  | 
                                                        |
| 362 | + * @return \Symfony\Component\HttpFoundation\BinaryFileResponseResponse A Symfony Response object  | 
                                                        |
| 363 | + */  | 
                                                        |
| 364 | 364 | public function display()  | 
                                                        
| 365 | 365 |  	{ | 
                                                        
| 366 | 366 |  		$this->tool->set_last_modified($this->gallery_user->get_data('user_permissions_changed')); | 
                                                        
@@ -238,8 +238,7 @@ discard block  | 
                                                    ||
| 238 | 238 | $this->data['album_user_id'] = 1;  | 
                                                        
| 239 | 239 | $this->data['image_filemissing'] = 0;  | 
                                                        
| 240 | 240 | $this->data['album_watermark'] = 0;  | 
                                                        
| 241 | - }  | 
                                                        |
| 242 | - else  | 
                                                        |
| 241 | + } else  | 
                                                        |
| 243 | 242 |  		{ | 
                                                        
| 244 | 243 | $sql = 'SELECT *  | 
                                                        
| 245 | 244 | FROM ' . $this->table_images . ' i  | 
                                                        
@@ -409,8 +408,7 @@ discard block  | 
                                                    ||
| 409 | 408 |  			{ | 
                                                        
| 410 | 409 |  				$response->headers->set('expires', '-1'); | 
                                                        
| 411 | 410 | }  | 
                                                        
| 412 | - }  | 
                                                        |
| 413 | - else  | 
                                                        |
| 411 | + } else  | 
                                                        |
| 414 | 412 |  		{ | 
                                                        
| 415 | 413 |  			$response->headers->set('Content-Disposition', 'inline; ' . $this->tool->header_filename(htmlspecialchars_decode($this->tool->image_name) . '.' . $this->tool->image_type)); | 
                                                        
| 416 | 414 | if ($this->tool->is_ie_greater7($this->user->browser))  | 
                                                        
@@ -249,8 +249,7 @@ discard block  | 
                                                    ||
| 249 | 249 | 'last_image' => end($process->images),  | 
                                                        
| 250 | 250 | );  | 
                                                        
| 251 | 251 | $this->notification_helper->new_image($data);  | 
                                                        
| 252 | - }  | 
                                                        |
| 253 | - else  | 
                                                        |
| 252 | + } else  | 
                                                        |
| 254 | 253 |  			{ | 
                                                        
| 255 | 254 | $target = array(  | 
                                                        
| 256 | 255 | 'album_id' => $album_id,  | 
                                                        
@@ -355,8 +354,7 @@ discard block  | 
                                                    ||
| 355 | 354 |  					{ | 
                                                        
| 356 | 355 |  						$this->language->add_lang('ucp'); | 
                                                        
| 357 | 356 | $error_array[] = $this->language->lang($result . '_USERNAME');  | 
                                                        
| 358 | - }  | 
                                                        |
| 359 | - else  | 
                                                        |
| 357 | + } else  | 
                                                        |
| 360 | 358 |  					{ | 
                                                        
| 361 | 359 | $process->set_username($username);  | 
                                                        
| 362 | 360 | }  | 
                                                        
@@ -375,8 +373,7 @@ discard block  | 
                                                    ||
| 375 | 373 | if (!$process->uploaded_files)  | 
                                                        
| 376 | 374 |  				{ | 
                                                        
| 377 | 375 |  					$process->new_error($this->language->lang('UPLOAD_NO_FILE')); | 
                                                        
| 378 | - }  | 
                                                        |
| 379 | - else  | 
                                                        |
| 376 | + } else  | 
                                                        |
| 380 | 377 |  				{ | 
                                                        
| 381 | 378 | $mode = 'upload_edit';  | 
                                                        
| 382 | 379 | // Remove submit, so we get the first screen of step 2.  | 
                                                        
@@ -422,8 +419,7 @@ discard block  | 
                                                    ||
| 422 | 419 | if ($VAR == 'zip')  | 
                                                        
| 423 | 420 |  						{ | 
                                                        
| 424 | 421 | continue;  | 
                                                        
| 425 | - }  | 
                                                        |
| 426 | - else  | 
                                                        |
| 422 | + } else  | 
                                                        |
| 427 | 423 |  						{ | 
                                                        
| 428 | 424 | $filetypes[] = $VAR;  | 
                                                        
| 429 | 425 | }  | 
                                                        
@@ -523,8 +519,7 @@ discard block  | 
                                                    ||
| 523 | 519 | 'last_image' => end($process->images),  | 
                                                        
| 524 | 520 | );  | 
                                                        
| 525 | 521 | $this->notification_helper->new_image($data);  | 
                                                        
| 526 | - }  | 
                                                        |
| 527 | - else  | 
                                                        |
| 522 | + } else  | 
                                                        |
| 528 | 523 |  				{ | 
                                                        
| 529 | 524 | $target = array(  | 
                                                        
| 530 | 525 | 'album_id' => (int) $album_id,  | 
                                                        
@@ -591,8 +586,7 @@ discard block  | 
                                                    ||
| 591 | 586 | if (file_exists($phpbbgallery_core_file) && is_writable($phpbbgallery_core_file) && file_exists($phpbbgallery_core_file_source) && is_writable($phpbbgallery_core_file_source) && file_exists($phpbbgallery_core_file_medium) && is_writable($phpbbgallery_core_file_medium) && file_exists($phpbbgallery_core_file_mini) && is_writable($phpbbgallery_core_file_mini))  | 
                                                        
| 592 | 587 |  		{ | 
                                                        
| 593 | 588 | return true;  | 
                                                        
| 594 | - }  | 
                                                        |
| 595 | - else  | 
                                                        |
| 589 | + } else  | 
                                                        |
| 596 | 590 |  		{ | 
                                                        
| 597 | 591 | return false;  | 
                                                        
| 598 | 592 | }  | 
                                                        
@@ -165,8 +165,8 @@ discard block  | 
                                                    ||
| 165 | 165 |  		$this->language->add_lang(array('gallery'), 'phpbbgallery/core'); | 
                                                        
| 166 | 166 |  		$this->language->add_lang('search'); | 
                                                        
| 167 | 167 | /**  | 
                                                        
| 168 | - * Build the sort options  | 
                                                        |
| 169 | - */  | 
                                                        |
| 168 | + * Build the sort options  | 
                                                        |
| 169 | + */  | 
                                                        |
| 170 | 170 |  		$limit_days = array(0 => $this->language->lang('ALL_IMAGES'), 1 => $this->language->lang('1_DAY'), 7 => $this->language->lang('7_DAYS'), 14 => $this->language->lang('2_WEEKS'), 30 => $this->language->lang('1_MONTH'), 90 => $this->language->lang('3_MONTHS'), 180 => $this->language->lang('6_MONTHS'), 365 => $this->language->lang('1_YEAR')); | 
                                                        
| 171 | 171 |  		$sort_by_text = array('t' => $this->language->lang('TIME'), 'n' => $this->language->lang('IMAGE_NAME'), 'u' => $this->language->lang('SORT_USERNAME'), 'vc' => $this->language->lang('GALLERY_VIEWS')); | 
                                                        
| 172 | 172 |  		$sort_by_sql = array('t' => 'image_time', 'n' => 'image_name_clean', 'u' => 'image_username_clean', 'vc' => 'image_view_count'); | 
                                                        
@@ -369,11 +369,11 @@ discard block  | 
                                                    ||
| 369 | 369 | }  | 
                                                        
| 370 | 370 | |
| 371 | 371 | /**  | 
                                                        
| 372 | - * Index Controller  | 
                                                        |
| 373 | - * Route: gallery/search/random  | 
                                                        |
| 374 | - *  | 
                                                        |
| 375 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 376 | - */  | 
                                                        |
| 372 | + * Index Controller  | 
                                                        |
| 373 | + * Route: gallery/search/random  | 
                                                        |
| 374 | + *  | 
                                                        |
| 375 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object  | 
                                                        |
| 376 | + */  | 
                                                        |
| 377 | 377 | public function random()  | 
                                                        
| 378 | 378 |  	{ | 
                                                        
| 379 | 379 |  		$this->language->add_lang(array('gallery'), 'phpbbgallery/core'); | 
                                                        
@@ -232,8 +232,7 @@ discard block  | 
                                                    ||
| 232 | 232 | if ($search_terms == 'all')  | 
                                                        
| 233 | 233 |  				{ | 
                                                        
| 234 | 234 | $keywords .= ' ' . $add_keywords;  | 
                                                        
| 235 | - }  | 
                                                        |
| 236 | - else  | 
                                                        |
| 235 | + } else  | 
                                                        |
| 237 | 236 |  				{ | 
                                                        
| 238 | 237 | $search_terms = 'all';  | 
                                                        
| 239 | 238 |  					$keywords = preg_replace('#\s+#u', ' |', $keywords) . ' ' .$add_keywords; | 
                                                        
@@ -271,8 +270,7 @@ discard block  | 
                                                    ||
| 271 | 270 | if (empty($search_album))  | 
                                                        
| 272 | 271 |  			{ | 
                                                        
| 273 | 272 |  				$sql_where[] = $this->db->sql_in_set('i.image_album_id', $this->gallery_auth->acl_album_ids('i_view')); | 
                                                        
| 274 | - }  | 
                                                        |
| 275 | - else  | 
                                                        |
| 273 | + } else  | 
                                                        |
| 276 | 274 |  			{ | 
                                                        
| 277 | 275 |  				$sql_where[] = $this->db->sql_in_set('i.image_album_id', $search_album); | 
                                                        
| 278 | 276 | }  | 
                                                        
@@ -141,10 +141,10 @@ discard block  | 
                                                    ||
| 141 | 141 | |
| 142 | 142 | public function base($page = 1)  | 
                                                        
| 143 | 143 |  	{ | 
                                                        
| 144 | -		$search_id		= $this->request->variable('search_id', ''); | 
                                                        |
| 144 | +		$search_id = $this->request->variable('search_id', ''); | 
                                                        |
| 145 | 145 |  		$image_id		= $this->request->variable('image_id', 0); | 
                                                        
| 146 | 146 | |
| 147 | -		$submit			= $this->request->variable('submit', false); | 
                                                        |
| 147 | +		$submit = $this->request->variable('submit', false); | 
                                                        |
| 148 | 148 |  		$keywords		= utf8_normalize_nfc($this->request->variable('keywords', '', true)); | 
                                                        
| 149 | 149 |  		$add_keywords	= utf8_normalize_nfc($this->request->variable('add_keywords', '', true)); | 
                                                        
| 150 | 150 |  		$username		= $this->request->variable('username', '', true); | 
                                                        
@@ -152,13 +152,13 @@ discard block  | 
                                                    ||
| 152 | 152 |  		$search_terms	= $this->request->variable('terms', 'all'); | 
                                                        
| 153 | 153 |  		$search_album	= $this->request->variable('aid', array(0)); | 
                                                        
| 154 | 154 |  		$search_child	= $this->request->variable('sc', true); | 
                                                        
| 155 | -		$search_fields	= $this->request->variable('sf', 'all'); | 
                                                        |
| 156 | -		$sort_days		= $this->request->variable('st', 0); | 
                                                        |
| 155 | +		$search_fields = $this->request->variable('sf', 'all'); | 
                                                        |
| 156 | +		$sort_days = $this->request->variable('st', 0); | 
                                                        |
| 157 | 157 |  		$sort_key		= $this->request->variable('sk', 't'); | 
                                                        
| 158 | 158 |  		$sort_dir		= $this->request->variable('sd', 'd'); | 
                                                        
| 159 | 159 |  		$filtered		= $this->request->variable('filtered', false); | 
                                                        
| 160 | 160 | |
| 161 | -		$start 			= ($page - 1) * $this->gallery_config->get('items_per_page'); | 
                                                        |
| 161 | +		$start = ($page - 1) * $this->gallery_config->get('items_per_page'); | 
                                                        |
| 162 | 162 | if ($filtered)  | 
                                                        
| 163 | 163 |  		{ | 
                                                        
| 164 | 164 | $submit = true;  | 
                                                        
@@ -175,7 +175,7 @@ discard block  | 
                                                    ||
| 175 | 175 |  		if ($this->gallery_config->get('allow_rates')) | 
                                                        
| 176 | 176 |  		{ | 
                                                        
| 177 | 177 |  			$sort_by_text['ra'] = $this->language->lang('RATING'); | 
                                                        
| 178 | - $sort_by_sql['ra'] = 'image_rate_points';//@todo: (phpbb_gallery_contest::$mode == phpbb_gallery_contest::MODE_SUM) ? 'image_rate_points' : 'image_rate_avg';  | 
                                                        |
| 178 | + $sort_by_sql['ra'] = 'image_rate_points'; //@todo: (phpbb_gallery_contest::$mode == phpbb_gallery_contest::MODE_SUM) ? 'image_rate_points' : 'image_rate_avg';  | 
                                                        |
| 179 | 179 |  			$sort_by_text['r'] = $this->language->lang('RATES_COUNT'); | 
                                                        
| 180 | 180 | $sort_by_sql['r'] = 'image_rates';  | 
                                                        
| 181 | 181 | }  | 
                                                        
@@ -206,7 +206,7 @@ discard block  | 
                                                    ||
| 206 | 206 |  				{ | 
                                                        
| 207 | 207 |  					trigger_error(sprintf($this->language->lang('TOO_FEW_AUTHOR_CHARS'), $this->config['min_search_author_chars'])); | 
                                                        
| 208 | 208 | }  | 
                                                        
| 209 | -				$username_parsed = (strpos($username, '*') !== false) ? ' username_clean ' . $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), utf8_clean_string($this->db->sql_escape($username)))) : ' username_clean = \'' . $this->db->sql_escape(utf8_clean_string($username)) .'\''; | 
                                                        |
| 209 | +				$username_parsed = (strpos($username, '*') !== false) ? ' username_clean ' . $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), utf8_clean_string($this->db->sql_escape($username)))) : ' username_clean = \'' . $this->db->sql_escape(utf8_clean_string($username)) . '\''; | 
                                                        |
| 210 | 210 | $sql = 'SELECT user_id  | 
                                                        
| 211 | 211 | FROM ' . USERS_TABLE . '  | 
                                                        
| 212 | 212 | WHERE ' . $username_parsed . '  | 
                                                        
@@ -224,7 +224,7 @@ discard block  | 
                                                    ||
| 224 | 224 | |
| 225 | 225 | if (!empty($user_id))  | 
                                                        
| 226 | 226 |  			{ | 
                                                        
| 227 | -				$sql_where[] =  $this->db->sql_in_set('i.image_user_id', $user_id); | 
                                                        |
| 227 | +				$sql_where[] = $this->db->sql_in_set('i.image_user_id', $user_id); | 
                                                        |
| 228 | 228 | }  | 
                                                        
| 229 | 229 | // if we search in an existing search result just add the additional keywords. But we need to use "all search terms"-mode  | 
                                                        
| 230 | 230 | // so we can keep the old keywords in their old mode, but add the new ones as required words  | 
                                                        
@@ -237,7 +237,7 @@ discard block  | 
                                                    ||
| 237 | 237 | else  | 
                                                        
| 238 | 238 |  				{ | 
                                                        
| 239 | 239 | $search_terms = 'all';  | 
                                                        
| 240 | -					$keywords = preg_replace('#\s+#u', ' |', $keywords) . ' ' .$add_keywords; | 
                                                        |
| 240 | +					$keywords = preg_replace('#\s+#u', ' |', $keywords) . ' ' . $add_keywords; | 
                                                        |
| 241 | 241 | }  | 
                                                        
| 242 | 242 | }  | 
                                                        
| 243 | 243 |  			$keywords_ary = ($keywords) ? explode(' ', $keywords) : array(); | 
                                                        
@@ -262,7 +262,7 @@ discard block  | 
                                                    ||
| 262 | 262 | $match_search_query = '';  | 
                                                        
| 263 | 263 | foreach ($matches as $match)  | 
                                                        
| 264 | 264 |  				{ | 
                                                        
| 265 | -					$match_search_query .= (($match_search_query) ? ' OR ' : '') . 'LOWER('. $match . ') '; | 
                                                        |
| 265 | +					$match_search_query .= (($match_search_query) ? ' OR ' : '') . 'LOWER(' . $match . ') '; | 
                                                        |
| 266 | 266 |  					$match_search_query .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $this->db->get_any_char() . mb_strtolower($word) . $this->db->get_any_char())); | 
                                                        
| 267 | 267 | }  | 
                                                        
| 268 | 268 |  				$search_query .= ((!$search_query) ? '' : (($search_terms == 'all') ? ' AND ' : ' OR ')) . '(' . $match_search_query . ')'; | 
                                                        
@@ -291,7 +291,7 @@ discard block  | 
                                                    ||
| 291 | 291 |  				trigger_error('NO_SEARCH_RESULTS'); | 
                                                        
| 292 | 292 | }  | 
                                                        
| 293 | 293 | $sql_array['SELECT'] = '*, a.album_name, a.album_status, a.album_user_id, a.album_id';  | 
                                                        
| 294 | - $sql_array['LEFT_JOIN'] = array(  | 
                                                        |
| 294 | + $sql_array['LEFT_JOIN'] = array(  | 
                                                        |
| 295 | 295 | array(  | 
                                                        
| 296 | 296 | 'FROM' => array($this->albums_table => 'a'),  | 
                                                        
| 297 | 297 | 'ON' => 'a.album_id = i.image_album_id',  | 
                                                        
@@ -319,7 +319,7 @@ discard block  | 
                                                    ||
| 319 | 319 |  			{ | 
                                                        
| 320 | 320 |  				$this->image->assign_block('imageblock.image', $row, $show_options, $thumbnail_link, $imagename_link); | 
                                                        
| 321 | 321 | }  | 
                                                        
| 322 | -			$current_page = $page*$this->gallery_config->get('items_per_page'); | 
                                                        |
| 322 | +			$current_page = $page * $this->gallery_config->get('items_per_page'); | 
                                                        |
| 323 | 323 | $this->pagination->generate_template_pagination(array(  | 
                                                        
| 324 | 324 | 'routes' => array(  | 
                                                        
| 325 | 325 | 'phpbbgallery_core_search',  |