@@ -15,69 +15,69 @@ discard block |
||
| 15 | 15 | class exif |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * Default value for new users |
|
| 19 | - */ |
|
| 18 | + * Default value for new users |
|
| 19 | + */ |
|
| 20 | 20 | const DEFAULT_DISPLAY = true; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * phpBB will treat the time from the Exif data like UTC. |
|
| 24 | - * If your images were taken with an other timezone, you can insert an offset here. |
|
| 25 | - * The offset is than added to the timestamp before it is converted into the users time. |
|
| 26 | - * |
|
| 27 | - * Offset must be set in seconds. |
|
| 28 | - */ |
|
| 23 | + * phpBB will treat the time from the Exif data like UTC. |
|
| 24 | + * If your images were taken with an other timezone, you can insert an offset here. |
|
| 25 | + * The offset is than added to the timestamp before it is converted into the users time. |
|
| 26 | + * |
|
| 27 | + * Offset must be set in seconds. |
|
| 28 | + */ |
|
| 29 | 29 | const TIME_OFFSET = 0; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Constants for the status of the Exif data. |
|
| 33 | - */ |
|
| 32 | + * Constants for the status of the Exif data. |
|
| 33 | + */ |
|
| 34 | 34 | const UNAVAILABLE = 0; |
| 35 | 35 | const AVAILABLE = 1; |
| 36 | 36 | const UNKNOWN = 2; |
| 37 | 37 | const DBSAVED = 3; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Is the function available? |
|
| 41 | - */ |
|
| 40 | + * Is the function available? |
|
| 41 | + */ |
|
| 42 | 42 | static public $function_exists = null; |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * Exif data array with all allowed groups and keys. |
|
| 46 | - */ |
|
| 45 | + * Exif data array with all allowed groups and keys. |
|
| 46 | + */ |
|
| 47 | 47 | public $data = array(); |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Filtered data array. We don't have empty or invalid values here. |
|
| 51 | - */ |
|
| 50 | + * Filtered data array. We don't have empty or invalid values here. |
|
| 51 | + */ |
|
| 52 | 52 | public $prepared_data = array(); |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Does the image have exif data? |
|
| 56 | - * Values see constant declaration at the beginning of the class. |
|
| 57 | - */ |
|
| 55 | + * Does the image have exif data? |
|
| 56 | + * Values see constant declaration at the beginning of the class. |
|
| 57 | + */ |
|
| 58 | 58 | public $status = 2; |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | - * Full data array, but serialized to a string |
|
| 62 | - */ |
|
| 61 | + * Full data array, but serialized to a string |
|
| 62 | + */ |
|
| 63 | 63 | public $serialized = ''; |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * Full link to the image-file |
|
| 67 | - */ |
|
| 66 | + * Full link to the image-file |
|
| 67 | + */ |
|
| 68 | 68 | public $file = ''; |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | - * Image-ID, just needed to update the Exif status |
|
| 72 | - */ |
|
| 71 | + * Image-ID, just needed to update the Exif status |
|
| 72 | + */ |
|
| 73 | 73 | public $image_id = false; |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Constructor |
|
| 77 | - * |
|
| 78 | - * @param string $file Full link to the image-file |
|
| 79 | - * @param mixed $image_id False or integer |
|
| 80 | - */ |
|
| 76 | + * Constructor |
|
| 77 | + * |
|
| 78 | + * @param string $file Full link to the image-file |
|
| 79 | + * @param mixed $image_id False or integer |
|
| 80 | + */ |
|
| 81 | 81 | public function __construct($file, $image_id = false) |
| 82 | 82 | { |
| 83 | 83 | if (self::$function_exists === null) |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * Intepret the values from the database, and read the data if we don't have it. |
|
| 97 | - * |
|
| 98 | - * @param int $status Value of a status constant (see beginning of the class) |
|
| 99 | - * @param mixed $data Either an empty string or the serialized array of the Exif from the database |
|
| 100 | - */ |
|
| 96 | + * Intepret the values from the database, and read the data if we don't have it. |
|
| 97 | + * |
|
| 98 | + * @param int $status Value of a status constant (see beginning of the class) |
|
| 99 | + * @param mixed $data Either an empty string or the serialized array of the Exif from the database |
|
| 100 | + */ |
|
| 101 | 101 | public function interpret($status, $data) |
| 102 | 102 | { |
| 103 | 103 | $this->orig_status = $status; |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * Read Exif data from the image |
|
| 117 | - */ |
|
| 116 | + * Read Exif data from the image |
|
| 117 | + */ |
|
| 118 | 118 | public function read() |
| 119 | 119 | { |
| 120 | 120 | if (!self::$function_exists || !$this->file || !file_exists($this->file)) |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | - * Validate and prepare the data, so we can send it into the template. |
|
| 164 | - */ |
|
| 163 | + * Validate and prepare the data, so we can send it into the template. |
|
| 164 | + */ |
|
| 165 | 165 | private function prepare_data() |
| 166 | 166 | { |
| 167 | 167 | global $user; |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | - * Sends the Exif into the template |
|
| 272 | - * |
|
| 273 | - * @param bool $expand_view Shall we expand the Exif data on page view or collapse? |
|
| 274 | - * @param string $block Name of the template loop the Exifs are displayed in. |
|
| 275 | - */ |
|
| 271 | + * Sends the Exif into the template |
|
| 272 | + * |
|
| 273 | + * @param bool $expand_view Shall we expand the Exif data on page view or collapse? |
|
| 274 | + * @param string $block Name of the template loop the Exifs are displayed in. |
|
| 275 | + */ |
|
| 276 | 276 | public function send_to_template($expand_view = true, $block = 'exif_value') |
| 277 | 277 | { |
| 278 | 278 | $this->prepare_data(); |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | - * Save the new Exif status in the database |
|
| 300 | - */ |
|
| 299 | + * Save the new Exif status in the database |
|
| 300 | + */ |
|
| 301 | 301 | public function set_status() |
| 302 | 302 | { |
| 303 | 303 | if (!$this->image_id || ($this->orig_status == $this->status)) |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | - * There are lots of possible Exif Groups and Values. |
|
| 319 | - * But you will never heard of the missing ones. so we just allow the most common ones. |
|
| 320 | - */ |
|
| 318 | + * There are lots of possible Exif Groups and Values. |
|
| 319 | + * But you will never heard of the missing ones. so we just allow the most common ones. |
|
| 320 | + */ |
|
| 321 | 321 | static private $allowed_groups = array( |
| 322 | 322 | 'EXIF', |
| 323 | 323 | 'IFD0', |
@@ -36,16 +36,16 @@ |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Constructor |
|
| 40 | - * NOTE: The parameters of this method must match in order and type with |
|
| 41 | - * the dependencies defined in the services.yml file for this service. |
|
| 42 | - * |
|
| 43 | - * @param \phpbb\user $user User object |
|
| 44 | - * @param \phpbbgallery\core\config $gallery_config Core gallery config object |
|
| 45 | - * @param \phpbbgallery\core\auth\auth $gallery_auth Core gallery auth object |
|
| 46 | - * @param \phpbbgallery\core\url $gallery_url Core gallery url object |
|
| 47 | - * @param \phpbbgallery\core\user $gallery_user Core gallery user wraper |
|
| 48 | - */ |
|
| 39 | + * Constructor |
|
| 40 | + * NOTE: The parameters of this method must match in order and type with |
|
| 41 | + * the dependencies defined in the services.yml file for this service. |
|
| 42 | + * |
|
| 43 | + * @param \phpbb\user $user User object |
|
| 44 | + * @param \phpbbgallery\core\config $gallery_config Core gallery config object |
|
| 45 | + * @param \phpbbgallery\core\auth\auth $gallery_auth Core gallery auth object |
|
| 46 | + * @param \phpbbgallery\core\url $gallery_url Core gallery url object |
|
| 47 | + * @param \phpbbgallery\core\user $gallery_user Core gallery user wraper |
|
| 48 | + */ |
|
| 49 | 49 | |
| 50 | 50 | 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) |
| 51 | 51 | { |
@@ -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); |
@@ -13,24 +13,24 @@ discard block |
||
| 13 | 13 | class upload |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * Number of Files per Directory |
|
| 17 | - * |
|
| 18 | - * If this constant is set to a value >0 the gallery will create a new directory, |
|
| 19 | - * when the current directory has more files in it than set here. |
|
| 20 | - */ |
|
| 16 | + * Number of Files per Directory |
|
| 17 | + * |
|
| 18 | + * If this constant is set to a value >0 the gallery will create a new directory, |
|
| 19 | + * when the current directory has more files in it than set here. |
|
| 20 | + */ |
|
| 21 | 21 | const NUM_FILES_PER_DIR = 0; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * Objects: phpBB Upload, 2 Files and Image-Functions |
|
| 25 | - */ |
|
| 24 | + * Objects: phpBB Upload, 2 Files and Image-Functions |
|
| 25 | + */ |
|
| 26 | 26 | private $upload = null; |
| 27 | 27 | private $file = null; |
| 28 | 28 | private $zip_file = null; |
| 29 | 29 | //private $tools = null; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Basic variables... |
|
| 33 | - */ |
|
| 32 | + * Basic variables... |
|
| 33 | + */ |
|
| 34 | 34 | public $loaded_files = 0; |
| 35 | 35 | public $uploaded_files = 0; |
| 36 | 36 | public $errors = array(); |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | - * Upload a zip file and save the images into the import/ directory. |
|
| 162 | - */ |
|
| 161 | + * Upload a zip file and save the images into the import/ directory. |
|
| 162 | + */ |
|
| 163 | 163 | public function upload_zip() |
| 164 | 164 | { |
| 165 | 165 | if (!class_exists('compress_zip')) |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | $file_link = $this->gallery_url->path('upload') . $this->image_data[$image_id]['image_filename']; |
| 308 | 308 | |
| 309 | 309 | /** |
| 310 | - * Event upload image before |
|
| 311 | - * |
|
| 312 | - * @event phpbbgallery.core.upload.update_image_before |
|
| 313 | - * @var array additional_sql_data array of additional settings |
|
| 314 | - * @var array image_data array of image_data |
|
| 315 | - * @var string file_link link to file |
|
| 316 | - * @since 1.2.0 |
|
| 317 | - */ |
|
| 310 | + * Event upload image before |
|
| 311 | + * |
|
| 312 | + * @event phpbbgallery.core.upload.update_image_before |
|
| 313 | + * @var array additional_sql_data array of additional settings |
|
| 314 | + * @var array image_data array of image_data |
|
| 315 | + * @var string file_link link to file |
|
| 316 | + * @since 1.2.0 |
|
| 317 | + */ |
|
| 318 | 318 | $vars = array('additional_sql_data', 'image_data', 'file_link'); |
| 319 | 319 | extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.upload.update_image_before', compact($vars))); |
| 320 | 320 | |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | if (!$this->prepare_file_update($image_id)) |
| 323 | 323 | { |
| 324 | 324 | /** |
| 325 | - * Event upload image update |
|
| 326 | - * |
|
| 327 | - * @event phpbbgallery.core.upload.update_image_nofilechange |
|
| 328 | - * @var array additional_sql_data array of additional settings |
|
| 329 | - * @since 1.2.0 |
|
| 330 | - */ |
|
| 325 | + * Event upload image update |
|
| 326 | + * |
|
| 327 | + * @event phpbbgallery.core.upload.update_image_nofilechange |
|
| 328 | + * @var array additional_sql_data array of additional settings |
|
| 329 | + * @since 1.2.0 |
|
| 330 | + */ |
|
| 331 | 331 | $vars = array('additional_sql_data'); |
| 332 | 332 | extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.upload.update_image_nofilechange', compact($vars))); |
| 333 | 333 | } |
@@ -345,8 +345,8 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | - * Prepare file on upload: rotate and resize |
|
| 349 | - */ |
|
| 348 | + * Prepare file on upload: rotate and resize |
|
| 349 | + */ |
|
| 350 | 350 | public function prepare_file() |
| 351 | 351 | { |
| 352 | 352 | $upload_dir = $this->get_current_upload_dir(); |
@@ -376,13 +376,13 @@ discard block |
||
| 376 | 376 | $file = $this->file; |
| 377 | 377 | |
| 378 | 378 | /** |
| 379 | - * Event upload image update |
|
| 380 | - * |
|
| 381 | - * @event phpbbgallery.core.upload.prepare_file_before |
|
| 382 | - * @var array additional_sql_data array of additional settings |
|
| 383 | - * @var array file File object |
|
| 384 | - * @since 1.2.0 |
|
| 385 | - */ |
|
| 379 | + * Event upload image update |
|
| 380 | + * |
|
| 381 | + * @event phpbbgallery.core.upload.prepare_file_before |
|
| 382 | + * @var array additional_sql_data array of additional settings |
|
| 383 | + * @var array file File object |
|
| 384 | + * @since 1.2.0 |
|
| 385 | + */ |
|
| 386 | 386 | $vars = array('additional_sql_data', 'file'); |
| 387 | 387 | extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.upload.prepare_file_before', compact($vars))); |
| 388 | 388 | |
@@ -729,8 +729,8 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | /** |
| 732 | - * Generate some kind of check so users only complete the uplaod for their images |
|
| 733 | - */ |
|
| 732 | + * Generate some kind of check so users only complete the uplaod for their images |
|
| 733 | + */ |
|
| 734 | 734 | public function generate_hidden_fields() |
| 735 | 735 | { |
| 736 | 736 | $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 * |
@@ -13,41 +13,41 @@ discard block |
||
| 13 | 13 | class rating |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * The image ID we want to rate |
|
| 17 | - */ |
|
| 16 | + * The image ID we want to rate |
|
| 17 | + */ |
|
| 18 | 18 | public $image_id = 0; |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * Private objects with the values for the image/album from the database |
|
| 22 | - */ |
|
| 21 | + * Private objects with the values for the image/album from the database |
|
| 22 | + */ |
|
| 23 | 23 | private $image_data = null; |
| 24 | 24 | private $album_data = null; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Rating the user gave the image. |
|
| 28 | - */ |
|
| 27 | + * Rating the user gave the image. |
|
| 28 | + */ |
|
| 29 | 29 | public $user_rating = null; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Is rating currently possible? |
|
| 33 | - * Might be blocked because of contest-settings. |
|
| 34 | - */ |
|
| 32 | + * Is rating currently possible? |
|
| 33 | + * Might be blocked because of contest-settings. |
|
| 34 | + */ |
|
| 35 | 35 | public $rating_enabled = false; |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Classic-rating box with a dropdown. |
|
| 39 | - */ |
|
| 38 | + * Classic-rating box with a dropdown. |
|
| 39 | + */ |
|
| 40 | 40 | const MODE_SELECT = 1; |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Rating with stars, like the old-system from youtube. |
|
| 43 | + * Rating with stars, like the old-system from youtube. |
|
| 44 | 44 | //@todo: const MODE_STARS = 2; |
| 45 | - */ |
|
| 45 | + */ |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Simple thumbs up or down. |
|
| 48 | + * Simple thumbs up or down. |
|
| 49 | 49 | //@todo: const MODE_THUMB = 3; |
| 50 | - */ |
|
| 50 | + */ |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Constructor |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | - * Displays the box where the user can rate the image. |
|
| 158 | - */ |
|
| 157 | + * Displays the box where the user can rate the image. |
|
| 158 | + */ |
|
| 159 | 159 | public function display_box() |
| 160 | 160 | { |
| 161 | 161 | $this->template->assign_var('GALLERY_RATING', self::MODE_SELECT);//@todo: phpbb_ext_gallery_core_config::get('rating_mode')); |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * Get rated value for a image |
|
| 234 | - */ |
|
| 233 | + * Get rated value for a image |
|
| 234 | + */ |
|
| 235 | 235 | private function get_image_rating_value() |
| 236 | 236 | { |
| 237 | 237 | /*if (phpbb_ext_gallery_core_contest::$mode == phpbb_ext_gallery_core_contest::MODE_SUM) |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | - * Is the user allowed to rate? |
|
| 249 | - * Following statements must be true: |
|
| 250 | - * - User must have permissions. |
|
| 251 | - * - User is neither owner of the image nor guest. |
|
| 252 | - * - Album and image are not locked. |
|
| 253 | - * |
|
| 254 | - * @return bool |
|
| 255 | - */ |
|
| 248 | + * Is the user allowed to rate? |
|
| 249 | + * Following statements must be true: |
|
| 250 | + * - User must have permissions. |
|
| 251 | + * - User is neither owner of the image nor guest. |
|
| 252 | + * - Album and image are not locked. |
|
| 253 | + * |
|
| 254 | + * @return bool |
|
| 255 | + */ |
|
| 256 | 256 | public function is_allowed() |
| 257 | 257 | { |
| 258 | 258 | return $this->gallery_auth->acl_check('i_rate', $this->album_data('album_id'), $this->album_data('album_user_id')) && |
@@ -261,25 +261,25 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
| 264 | - * Is the user able to rate? |
|
| 265 | - * Following statements must be true: |
|
| 266 | - * - User must be allowed to rate |
|
| 267 | - * - If the image is in a contest, it must be in the rating timespan |
|
| 268 | - * |
|
| 269 | - * @return bool |
|
| 270 | - */ |
|
| 264 | + * Is the user able to rate? |
|
| 265 | + * Following statements must be true: |
|
| 266 | + * - User must be allowed to rate |
|
| 267 | + * - If the image is in a contest, it must be in the rating timespan |
|
| 268 | + * |
|
| 269 | + * @return bool |
|
| 270 | + */ |
|
| 271 | 271 | public function is_able() |
| 272 | 272 | { |
| 273 | 273 | return $this->is_allowed(); //&& phpbb_ext_gallery_core_contest::is_step('rate', $this->album_data(true)); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | - * Get rating from a user for a given image |
|
| 278 | - * |
|
| 279 | - * @param int $user_id |
|
| 280 | - * |
|
| 281 | - * @return mixed False if the user did not rate or is guest, otherwise int the points. |
|
| 282 | - */ |
|
| 277 | + * Get rating from a user for a given image |
|
| 278 | + * |
|
| 279 | + * @param int $user_id |
|
| 280 | + * |
|
| 281 | + * @return mixed False if the user did not rate or is guest, otherwise int the points. |
|
| 282 | + */ |
|
| 283 | 283 | public function get_user_rating($user_id) |
| 284 | 284 | { |
| 285 | 285 | if (isset($this->user_rating[$user_id])) |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
| 358 | - * Recalculate the average image-rating and such stuff. |
|
| 359 | - * |
|
| 360 | - * @param mixed $image_ids Array or integer with image_id where we recalculate the rating. |
|
| 361 | - */ |
|
| 358 | + * Recalculate the average image-rating and such stuff. |
|
| 359 | + * |
|
| 360 | + * @param mixed $image_ids Array or integer with image_id where we recalculate the rating. |
|
| 361 | + */ |
|
| 362 | 362 | public function recalc_image_rating($image_ids) |
| 363 | 363 | { |
| 364 | 364 | if (is_array($image_ids)) |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | - * Delete all ratings for given image_ids |
|
| 393 | - * |
|
| 394 | - * @param mixed $image_ids Array or integer with image_id where we delete the rating. |
|
| 395 | - * @param bool $reset_average Shall we also reset the average? We can save that query, when the images are deleted anyway. |
|
| 396 | - */ |
|
| 392 | + * Delete all ratings for given image_ids |
|
| 393 | + * |
|
| 394 | + * @param mixed $image_ids Array or integer with image_id where we delete the rating. |
|
| 395 | + * @param bool $reset_average Shall we also reset the average? We can save that query, when the images are deleted anyway. |
|
| 396 | + */ |
|
| 397 | 397 | public function delete_ratings($image_ids, $reset_average = false) |
| 398 | 398 | { |
| 399 | 399 | if (is_array($image_ids)) |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | - * Event delete images |
|
| 194 | - * |
|
| 195 | - * @event phpbbgallery.core.image.delete_images |
|
| 196 | - * @var array images array of the image ids we are deleting |
|
| 197 | - * @var array filenames array of the image filenames |
|
| 198 | - * @since 1.2.0 |
|
| 199 | - */ |
|
| 193 | + * Event delete images |
|
| 194 | + * |
|
| 195 | + * @event phpbbgallery.core.image.delete_images |
|
| 196 | + * @var array images array of the image ids we are deleting |
|
| 197 | + * @var array filenames array of the image filenames |
|
| 198 | + * @since 1.2.0 |
|
| 199 | + */ |
|
| 200 | 200 | $vars = array('images', 'filenames'); |
| 201 | 201 | extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.image.delete_images', compact($vars))); |
| 202 | 202 | |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | - * Get the real filenames, so we can load/delete/edit the image-file. |
|
| 260 | - * |
|
| 261 | - * @param mixed $images Array or integer with the image_id(s) |
|
| 262 | - * @return array Format: $image_id => $filename |
|
| 263 | - */ |
|
| 259 | + * Get the real filenames, so we can load/delete/edit the image-file. |
|
| 260 | + * |
|
| 261 | + * @param mixed $images Array or integer with the image_id(s) |
|
| 262 | + * @return array Format: $image_id => $filename |
|
| 263 | + */ |
|
| 264 | 264 | public function get_filenames($images) |
| 265 | 265 | { |
| 266 | 266 | if (empty($images)) |
@@ -375,13 +375,13 @@ discard block |
||
| 375 | 375 | $tpl = '{CONTENT}'; |
| 376 | 376 | |
| 377 | 377 | /** |
| 378 | - * Event generate link |
|
| 379 | - * |
|
| 380 | - * @event phpbbgallery.core.image.generate_link |
|
| 381 | - * @var string mode type of link |
|
| 382 | - * @var string tpl html to be outputed |
|
| 383 | - * @since 1.2.0 |
|
| 384 | - */ |
|
| 378 | + * Event generate link |
|
| 379 | + * |
|
| 380 | + * @event phpbbgallery.core.image.generate_link |
|
| 381 | + * @var string mode type of link |
|
| 382 | + * @var string tpl html to be outputed |
|
| 383 | + * @since 1.2.0 |
|
| 384 | + */ |
|
| 385 | 385 | $vars = array('mode', 'tpl'); |
| 386 | 386 | extract($this->phpbb_dispatcher->trigger_event('phpbbgallery.core.image.generate_link', compact($vars)));//@todo: Correctly identify the event |
| 387 | 387 | break; |
@@ -391,12 +391,12 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | - * Handle user- & total image_counter |
|
| 395 | - * |
|
| 396 | - * @param array $image_id_ary array with the image_ids which changed their status |
|
| 397 | - * @param bool $add are we adding or removing the images |
|
| 398 | - * @param bool $readd is it possible that there are images which aren't really changed |
|
| 399 | - */ |
|
| 394 | + * Handle user- & total image_counter |
|
| 395 | + * |
|
| 396 | + * @param array $image_id_ary array with the image_ids which changed their status |
|
| 397 | + * @param bool $add are we adding or removing the images |
|
| 398 | + * @param bool $readd is it possible that there are images which aren't really changed |
|
| 399 | + */ |
|
| 400 | 400 | public function handle_counter($image_id_ary, $add, $readd = false) |
| 401 | 401 | { |
| 402 | 402 | if (empty($image_id_ary)) |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
| 470 | - * Approve image |
|
| 471 | - * @param (array) $image_id_ary The image ID array to be approved |
|
| 472 | - * @param (int) $album_id The album image is approved to (just save some queries for log) |
|
| 473 | - * return 0 on success |
|
| 474 | - */ |
|
| 470 | + * Approve image |
|
| 471 | + * @param (array) $image_id_ary The image ID array to be approved |
|
| 472 | + * @param (int) $album_id The album image is approved to (just save some queries for log) |
|
| 473 | + * return 0 on success |
|
| 474 | + */ |
|
| 475 | 475 | public function approve_images($image_id_ary, $album_id) |
| 476 | 476 | { |
| 477 | 477 | $sql = 'SELECT image_id, image_name, image_user_id |
@@ -507,10 +507,10 @@ discard block |
||
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
| 510 | - * UnApprove image |
|
| 511 | - * @param (array) $image_id_ary The image ID array to be unapproved |
|
| 512 | - * @param (int) $album_id The album image is approved to (just save some queries for log) |
|
| 513 | - */ |
|
| 510 | + * UnApprove image |
|
| 511 | + * @param (array) $image_id_ary The image ID array to be unapproved |
|
| 512 | + * @param (int) $album_id The album image is approved to (just save some queries for log) |
|
| 513 | + */ |
|
| 514 | 514 | public function unapprove_images($image_id_ary, $album_id) |
| 515 | 515 | { |
| 516 | 516 | self::handle_counter($image_id_ary, false); |
@@ -563,10 +563,10 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
| 566 | - * Lock images |
|
| 567 | - * @param (array) $image_id_ary Array of images we want to lock |
|
| 568 | - * @param (int) $album_id Album id, so we can log the action |
|
| 569 | - */ |
|
| 566 | + * Lock images |
|
| 567 | + * @param (array) $image_id_ary Array of images we want to lock |
|
| 568 | + * @param (int) $album_id Album id, so we can log the action |
|
| 569 | + */ |
|
| 570 | 570 | public function lock_images($image_id_ary, $album_id) |
| 571 | 571 | { |
| 572 | 572 | self::handle_counter($image_id_ary, false); |
@@ -590,9 +590,9 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | /** |
| 593 | - * Get last image id |
|
| 594 | - * Return (int) image_id |
|
| 595 | - **/ |
|
| 593 | + * Get last image id |
|
| 594 | + * Return (int) image_id |
|
| 595 | + **/ |
|
| 596 | 596 | public function get_last_image() |
| 597 | 597 | { |
| 598 | 598 | $this->gallery_auth->load_user_premissions($this->user->data['user_id']); |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * Image File Controller |
|
| 102 | - * Route: gallery/image/{image_id}/source |
|
| 103 | - * |
|
| 104 | - * @param int $image_id |
|
| 105 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 106 | - */ |
|
| 101 | + * Image File Controller |
|
| 102 | + * Route: gallery/image/{image_id}/source |
|
| 103 | + * |
|
| 104 | + * @param int $image_id |
|
| 105 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 106 | + */ |
|
| 107 | 107 | public function source($image_id) |
| 108 | 108 | { |
| 109 | 109 | $this->auth->load_user_premissions($this->user->data['user_id']); |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | - * Image File Controller |
|
| 159 | - * Route: gallery/image/{image_id}/medium |
|
| 160 | - * |
|
| 161 | - * @param int $image_id |
|
| 162 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 163 | - */ |
|
| 158 | + * Image File Controller |
|
| 159 | + * Route: gallery/image/{image_id}/medium |
|
| 160 | + * |
|
| 161 | + * @param int $image_id |
|
| 162 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 163 | + */ |
|
| 164 | 164 | public function medium($image_id) |
| 165 | 165 | { |
| 166 | 166 | |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | - * Image File Controller |
|
| 194 | - * Route: gallery/image/{image_id}/mini |
|
| 195 | - * |
|
| 196 | - * @param int $image_id |
|
| 197 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 198 | - */ |
|
| 193 | + * Image File Controller |
|
| 194 | + * Route: gallery/image/{image_id}/mini |
|
| 195 | + * |
|
| 196 | + * @param int $image_id |
|
| 197 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 198 | + */ |
|
| 199 | 199 | public function mini($image_id) |
| 200 | 200 | { |
| 201 | 201 | $this->path = $this->path_mini; |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | - * Image File Controller |
|
| 358 | - * Route: gallery/image/{image_id}/x |
|
| 359 | - * |
|
| 360 | - * @return \Symfony\Component\HttpFoundation\BinaryFileResponseResponse A Symfony Response object |
|
| 361 | - */ |
|
| 357 | + * Image File Controller |
|
| 358 | + * Route: gallery/image/{image_id}/x |
|
| 359 | + * |
|
| 360 | + * @return \Symfony\Component\HttpFoundation\BinaryFileResponseResponse A Symfony Response object |
|
| 361 | + */ |
|
| 362 | 362 | public function display() |
| 363 | 363 | { |
| 364 | 364 | $this->tool->set_last_modified($this->gallery_user->get_data('user_permissions_changed')); |
@@ -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'); |