@@ -7,12 +7,9 @@ |
||
| 7 | 7 | namespace okapi\services\logs\images; |
| 8 | 8 | |
| 9 | 9 | use Exception; |
| 10 | -use okapi\Okapi; |
|
| 11 | 10 | use okapi\Db; |
| 12 | -use okapi\OkapiRequest; |
|
| 13 | 11 | use okapi\InvalidParam; |
| 14 | 12 | use okapi\Settings; |
| 15 | -use okapi\BadRequest; |
|
| 16 | 13 | |
| 17 | 14 | |
| 18 | 15 | class LogImagesCommon |
@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | function validate_image_uuid($request) |
| 21 | 21 | { |
| 22 | 22 | $image_uuid = $request->get_parameter('image_uuid'); |
| 23 | - if (!$image_uuid) |
|
| 24 | - throw new ParamMissing('image_uuid'); |
|
| 23 | + if (!$image_uuid) { |
|
| 24 | + throw new ParamMissing('image_uuid'); |
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | # When uploading images, OCPL stores the user_id of the uploader |
| 27 | 28 | # in the 'pictures' table. This is redundant to cache_logs.user_id, |
@@ -91,8 +92,7 @@ discard block |
||
| 91 | 92 | |
| 92 | 93 | static function prepare_position($log_internal_id, $position, $end_offset) |
| 93 | 94 | { |
| 94 | - if (Settings::get('OC_BRANCH') == 'oc.de' && $position !== null) |
|
| 95 | - { |
|
| 95 | + if (Settings::get('OC_BRANCH') == 'oc.de' && $position !== null) { |
|
| 96 | 96 | # Prevent race conditions when creating sequence numbers if a |
| 97 | 97 | # user tries to upload multiple images simultaneously. With a |
| 98 | 98 | # few picture uploads per hour - most of them probably witout |
@@ -107,16 +107,13 @@ discard block |
||
| 107 | 107 | where object_type = 1 and object_id = '".Db::escape_string($log_internal_id)."' |
| 108 | 108 | "); |
| 109 | 109 | |
| 110 | - if (Settings::get('OC_BRANCH') == 'oc.pl') |
|
| 111 | - { |
|
| 110 | + if (Settings::get('OC_BRANCH') == 'oc.pl') { |
|
| 112 | 111 | # Ignore the position parameter, always insert at end. |
| 113 | 112 | # Remember that this function is NOT called when editing OCPL images. |
| 114 | 113 | |
| 115 | 114 | $position = $log_images_count; |
| 116 | 115 | $seq = 1; |
| 117 | - } |
|
| 118 | - else |
|
| 119 | - { |
|
| 116 | + } else { |
|
| 120 | 117 | if ($position === null || $position >= $log_images_count) { |
| 121 | 118 | $position = $log_images_count - 1 + $end_offset; |
| 122 | 119 | $seq = Db::select_value(" |
@@ -19,9 +19,12 @@ discard block |
||
| 19 | 19 | require $stylepath . '/editdesc.inc.php'; |
| 20 | 20 | |
| 21 | 21 | // check for old-style parameters |
| 22 | - if (isset($_REQUEST['cacheid']) && isset($_REQUEST['desclang']) && !isset($_REQUEST['descid'])) // Ocprop |
|
| 22 | + if (isset($_REQUEST['cacheid']) && isset($_REQUEST['desclang']) && !isset($_REQUEST['descid'])) { |
|
| 23 | + // Ocprop |
|
| 23 | 24 | { |
| 24 | - $cache_id = $_REQUEST['cacheid']; // Ocprop |
|
| 25 | + $cache_id = $_REQUEST['cacheid']; |
|
| 26 | + } |
|
| 27 | + // Ocprop |
|
| 25 | 28 | $desc_lang = $_REQUEST['desclang']; // Ocprop |
| 26 | 29 | |
| 27 | 30 | $rs = sql("SELECT `id` FROM `cache_desc` WHERE `cache_id`='&1' AND `language`='&2'", $cache_id, $desc_lang); |
@@ -87,10 +90,13 @@ discard block |
||
| 87 | 90 | $show_all_langs = false; |
| 88 | 91 | |
| 89 | 92 | //save to DB? |
| 90 | - if (isset($_POST['post'])) // Ocprop |
|
| 93 | + if (isset($_POST['post'])) { |
|
| 94 | + // Ocprop |
|
| 91 | 95 | { |
| 92 | 96 | //here we read all used information from the form if submitted |
| 93 | - $descMode = isset($_POST['descMode']) ? $_POST['descMode'] + 0 : 1; // Ocprop |
|
| 97 | + $descMode = isset($_POST['descMode']) ? $_POST['descMode'] + 0 : 1; |
|
| 98 | + } |
|
| 99 | + // Ocprop |
|
| 94 | 100 | |
| 95 | 101 | // fuer alte Versionen von OCProp |
| 96 | 102 | if (isset($_POST['submit']) && !isset($_POST['version2'])) { |
@@ -147,7 +153,8 @@ discard block |
||
| 147 | 153 | |
| 148 | 154 | $desc = processEditorInput($oldDescMode, $descMode, $desc); |
| 149 | 155 | |
| 150 | - if (isset($_POST['submitform'])) // Ocprop |
|
| 156 | + if (isset($_POST['submitform'])) { |
|
| 157 | + // Ocprop |
|
| 151 | 158 | { |
| 152 | 159 | // prüfen, ob sprache nicht schon vorhanden |
| 153 | 160 | $rs = sql( |
@@ -160,6 +167,7 @@ discard block |
||
| 160 | 167 | $descid, |
| 161 | 168 | $desclang |
| 162 | 169 | ); |
| 170 | + } |
|
| 163 | 171 | $r = sql_fetch_array($rs); |
| 164 | 172 | if ($r['count'] > 0) { |
| 165 | 173 | tpl_errorMsg('editdesc', $error_desc_exists); |
@@ -224,8 +232,7 @@ discard block |
||
| 224 | 232 | |
| 225 | 233 | if ($oldDescMode == 0) { |
| 226 | 234 | $desc = processEditorInput($oldDescMode, $descMode, $desc_record['desc']); |
| 227 | - } |
|
| 228 | - else { |
|
| 235 | + } else { |
|
| 229 | 236 | $desc = $desc_record['desc']; |
| 230 | 237 | } |
| 231 | 238 | } |
@@ -1,8 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if (isset($_REQUEST['lang'])) { |
| 3 | 3 | $lang = $_REQUEST['lang']; |
| 4 | - } |
|
| 5 | - else { |
|
| 4 | + } else { |
|
| 6 | 5 | $lang = 'de'; |
| 7 | 6 | } |
| 8 | 7 | ?> |
@@ -1,14 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if (isset($_REQUEST['cacheid'])) { |
| 3 | 3 | $cacheID = $_REQUEST['cacheid']; |
| 4 | - } |
|
| 5 | - else { |
|
| 4 | + } else { |
|
| 6 | 5 | $cacheID = 0; |
| 7 | 6 | } |
| 8 | 7 | if (isset($_REQUEST['lang'])) { |
| 9 | 8 | $lang = $_REQUEST['lang']; |
| 10 | - } |
|
| 11 | - else { |
|
| 9 | + } else { |
|
| 12 | 10 | $lang = 'de'; |
| 13 | 11 | } |
| 14 | 12 | ?> |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | - if (isset($_REQUEST['lang'])) |
|
| 3 | - $lang = $_REQUEST['lang']; |
|
| 4 | - else |
|
| 5 | - $lang = 'de'; |
|
| 6 | -?> |
|
| 2 | + if (isset($_REQUEST['lang'])) { |
|
| 3 | + $lang = $_REQUEST['lang']; |
|
| 4 | + } else { |
|
| 5 | + $lang = 'de'; |
|
| 6 | + } |
|
| 7 | + ?> |
|
| 7 | 8 | |
| 8 | 9 | tinyMCE_GZ.init({ |
| 9 | 10 | plugins : 'advhr,contextmenu,emotions,insertdatetime,paste,table', |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | $text = isset($_REQUEST['text']) ? $_REQUEST['text'] : ''; |
| 56 | 56 | if (isset($_REQUEST['emailaddress'])) { |
| 57 | 57 | $bEmailaddress = ($_REQUEST['emailaddress'] == 1); |
| 58 | -} |
|
| 59 | -else { |
|
| 58 | +} else { |
|
| 60 | 59 | $own_user = new user($login->userid); |
| 61 | 60 | $bEmailaddress = $own_user->getUsermailSendAddress(); |
| 62 | 61 | } |
@@ -894,8 +894,9 @@ |
||
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | if ($db['dblink_slave'] !== false) { |
| 897 | - if (mysql_select_db($opt['db']['placeholder']['db'], $db['dblink_slave']) == false) |
|
| 898 | - sql_error(); |
|
| 897 | + if (mysql_select_db($opt['db']['placeholder']['db'], $db['dblink_slave']) == false) { |
|
| 898 | + sql_error(); |
|
| 899 | + } |
|
| 899 | 900 | |
| 900 | 901 | mysql_query("SET NAMES '" . mysql_real_escape_string($opt['charset']['mysql'], $db['dblink_slave']) . "'", $db['dblink_slave']); |
| 901 | 902 | |
@@ -29,13 +29,18 @@ |
||
| 29 | 29 | require_once('replicate_common.inc.php'); |
| 30 | 30 | |
| 31 | 31 | $since = $request->get_parameter('since'); |
| 32 | - if ($since === null) throw new ParamMissing('since'); |
|
| 33 | - if ((int)$since != $since) throw new InvalidParam('since'); |
|
| 32 | + if ($since === null) { |
|
| 33 | + throw new ParamMissing('since'); |
|
| 34 | + } |
|
| 35 | + if ((int)$since != $since) { |
|
| 36 | + throw new InvalidParam('since'); |
|
| 37 | + } |
|
| 34 | 38 | |
| 35 | 39 | # Let's check the $since parameter. |
| 36 | 40 | |
| 37 | - if (!ReplicateCommon::check_since_param($since)) |
|
| 38 | - throw new BadRequest("The 'since' parameter is too old. You must update your database more frequently."); |
|
| 41 | + if (!ReplicateCommon::check_since_param($since)) { |
|
| 42 | + throw new BadRequest("The 'since' parameter is too old. You must update your database more frequently."); |
|
| 43 | + } |
|
| 39 | 44 | |
| 40 | 45 | # Select a best chunk for the given $since, get the chunk from the database (or cache). |
| 41 | 46 | |
@@ -21,16 +21,21 @@ |
||
| 21 | 21 | public static function call(OkapiRequest $request) |
| 22 | 22 | { |
| 23 | 23 | $log_uuid = $request->get_parameter('log_uuid'); |
| 24 | - if (!$log_uuid) throw new ParamMissing('log_uuid'); |
|
| 24 | + if (!$log_uuid) { |
|
| 25 | + throw new ParamMissing('log_uuid'); |
|
| 26 | + } |
|
| 25 | 27 | $fields = $request->get_parameter('fields'); |
| 26 | - if (!$fields) $fields = "date|user|type|comment"; |
|
| 28 | + if (!$fields) { |
|
| 29 | + $fields = "date|user|type|comment"; |
|
| 30 | + } |
|
| 27 | 31 | |
| 28 | 32 | $results = OkapiServiceRunner::call('services/logs/entries', new OkapiInternalRequest( |
| 29 | 33 | $request->consumer, $request->token, array('log_uuids' => $log_uuid, |
| 30 | 34 | 'fields' => $fields))); |
| 31 | 35 | $result = $results[$log_uuid]; |
| 32 | - if ($result == null) |
|
| 33 | - throw new InvalidParam('log_uuid', "This log entry does not exist."); |
|
| 36 | + if ($result == null) { |
|
| 37 | + throw new InvalidParam('log_uuid', "This log entry does not exist."); |
|
| 38 | + } |
|
| 34 | 39 | return Okapi::formatted_response($request, $result); |
| 35 | 40 | } |
| 36 | 41 | } |