@@ -185,7 +185,9 @@ |
||
| 185 | 185 | $attribute_string = ''; |
| 186 | 186 | $attributes_array = $variation->getAttributesAsArray(); |
| 187 | 187 | foreach ($attributes_array as $attribute) {
|
| 188 | - if ($attribute_string != '') $attribute_string .= '-'; |
|
| 188 | + if ($attribute_string != '') { |
|
| 189 | + $attribute_string .= '-'; |
|
| 190 | + } |
|
| 189 | 191 | $attribute_string .= $attribute['id']; |
| 190 | 192 | } |
| 191 | 193 | |
@@ -303,8 +303,7 @@ |
||
| 303 | 303 | // we put the possibility for BasketEvaluation not to be run. |
| 304 | 304 | if (is_string($customer) && $customer == 'no_evaluation') {
|
| 305 | 305 | // nothing happens |
| 306 | - } |
|
| 307 | - elseif (is_array($customer)) {
|
|
| 306 | + } elseif (is_array($customer)) {
|
|
| 308 | 307 | require_once 'Intraface/modules/webshop/BasketEvaluation.php'; |
| 309 | 308 | $basketevaluation = new BasketEvaluation($this->webshop->kernel); |
| 310 | 309 | if (!$basketevaluation->run($this->webshop->basket, $customer)) {
|
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $search['area'] = 'category_'.$category_id; |
| 145 | 145 | if ($results_per_page > 0) {
|
| 146 | 146 | $search['use_paging'] = 'true'; |
| 147 | - }else {
|
|
| 147 | + } else {
|
|
| 148 | 148 | $search['use_paging'] = 'false'; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -493,11 +493,15 @@ discard block |
||
| 493 | 493 | $attributes_array = $variation->getAttributesAsArray(); |
| 494 | 494 | |
| 495 | 495 | foreach ($attributes_array as $attribute) {
|
| 496 | - if ($attribute_string != '') $attribute_string .= '-'; |
|
| 496 | + if ($attribute_string != '') { |
|
| 497 | + $attribute_string .= '-'; |
|
| 498 | + } |
|
| 497 | 499 | $attribute_string .= $attribute['id']; |
| 498 | 500 | |
| 499 | 501 | // We calculate all products which is on stock with this attribute to be able to mark unused attributes in list. |
| 500 | - if (!isset($attribute_for_sale[$attribute['id']])) $attribute_for_sale[$attribute['id']] = 0; |
|
| 502 | + if (!isset($attribute_for_sale[$attribute['id']])) { |
|
| 503 | + $attribute_for_sale[$attribute['id']] = 0; |
|
| 504 | + } |
|
| 501 | 505 | if ($stock !== false) {
|
| 502 | 506 | // If for_sale is less than zero we add zero. |
| 503 | 507 | $attribute_for_sale[$attribute['id']] += (($stock['for_sale'] < 0) ? 0 : $stock['for_sale']); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $search['area'] = 'category_'.$category_id; |
| 143 | 143 | if ($results_per_page > 0) {
|
| 144 | 144 | $search['use_paging'] = 'true'; |
| 145 | - }else {
|
|
| 145 | + } else {
|
|
| 146 | 146 | $search['use_paging'] = 'false'; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -327,11 +327,15 @@ discard block |
||
| 327 | 327 | $attributes_array = $variation->getAttributesAsArray(); |
| 328 | 328 | |
| 329 | 329 | foreach ($attributes_array as $attribute) {
|
| 330 | - if ($attribute_string != '') $attribute_string .= '-'; |
|
| 330 | + if ($attribute_string != '') { |
|
| 331 | + $attribute_string .= '-'; |
|
| 332 | + } |
|
| 331 | 333 | $attribute_string .= $attribute['id']; |
| 332 | 334 | |
| 333 | 335 | // We calculate all products which is on stock with this attribute to be able to mark unused attributes in list. |
| 334 | - if (!isset($attribute_for_sale[$attribute['id']])) $attribute_for_sale[$attribute['id']] = 0; |
|
| 336 | + if (!isset($attribute_for_sale[$attribute['id']])) { |
|
| 337 | + $attribute_for_sale[$attribute['id']] = 0; |
|
| 338 | + } |
|
| 335 | 339 | if ($stock !== false) {
|
| 336 | 340 | // If for_sale is less than zero we add zero. |
| 337 | 341 | $attribute_for_sale[$attribute['id']] += (($stock['for_sale'] < 0) ? 0 : $stock['for_sale']); |
@@ -20,15 +20,37 @@ discard block |
||
| 20 | 20 | require_once 'bucket.inc.php'; |
| 21 | 21 | |
| 22 | 22 | // paths |
| 23 | -if (!defined('PATH_INCLUDE_IHTML')) define('PATH_INCLUDE_IHTML', PATH_ROOT.'Intraface/ihtml' . DIRECTORY_SEPARATOR);
|
|
| 24 | -if (!defined('PATH_INCLUDE_MODULE')) define('PATH_INCLUDE_MODULE', PATH_ROOT.'Intraface/modules' . DIRECTORY_SEPARATOR);
|
|
| 25 | -if (!defined('PATH_INCLUDE_SHARED')) define('PATH_INCLUDE_SHARED', PATH_ROOT.'Intraface/shared' . DIRECTORY_SEPARATOR);
|
|
| 26 | -if (!defined('PATH_INCLUDE_CONFIG')) define('PATH_INCLUDE_CONFIG', PATH_ROOT.'/Intraface/config'.DIRECTORY_SEPARATOR);
|
|
| 27 | -if (!defined('PATH_UPLOAD')) define('PATH_UPLOAD', PATH_ROOT . 'upload/'); // Directory for upload of files.
|
|
| 28 | -if (!defined('PATH_UPLOAD_TEMPORARY')) define('PATH_UPLOAD_TEMPORARY', 'tempdir/'); // Mappen i Upload_path, under intranetid, hvor temp-filer placeres.
|
|
| 29 | -if (!defined('PATH_CAPTCHA')) define('PATH_CAPTCHA', PATH_ROOT . 'captcha/'); // remember trailing slash - used for the demo formular
|
|
| 30 | -if (!defined('PATH_CACHE')) define('PATH_CACHE', PATH_ROOT . 'cache/'); // remember trailing slash - path to cache
|
|
| 31 | -if (!defined('PATH_INCLUDE_BACKUP')) define('PATH_INCLUDE_BACKUP', PATH_ROOT . 'backup/');
|
|
| 23 | +if (!defined('PATH_INCLUDE_IHTML')) { |
|
| 24 | + define('PATH_INCLUDE_IHTML', PATH_ROOT.'Intraface/ihtml' . DIRECTORY_SEPARATOR); |
|
| 25 | +} |
|
| 26 | +if (!defined('PATH_INCLUDE_MODULE')) { |
|
| 27 | + define('PATH_INCLUDE_MODULE', PATH_ROOT.'Intraface/modules' . DIRECTORY_SEPARATOR); |
|
| 28 | +} |
|
| 29 | +if (!defined('PATH_INCLUDE_SHARED')) { |
|
| 30 | + define('PATH_INCLUDE_SHARED', PATH_ROOT.'Intraface/shared' . DIRECTORY_SEPARATOR); |
|
| 31 | +} |
|
| 32 | +if (!defined('PATH_INCLUDE_CONFIG')) { |
|
| 33 | + define('PATH_INCLUDE_CONFIG', PATH_ROOT.'/Intraface/config'.DIRECTORY_SEPARATOR); |
|
| 34 | +} |
|
| 35 | +if (!defined('PATH_UPLOAD')) { |
|
| 36 | + define('PATH_UPLOAD', PATH_ROOT . 'upload/'); |
|
| 37 | +} |
|
| 38 | +// Directory for upload of files. |
|
| 39 | +if (!defined('PATH_UPLOAD_TEMPORARY')) { |
|
| 40 | + define('PATH_UPLOAD_TEMPORARY', 'tempdir/'); |
|
| 41 | +} |
|
| 42 | +// Mappen i Upload_path, under intranetid, hvor temp-filer placeres. |
|
| 43 | +if (!defined('PATH_CAPTCHA')) { |
|
| 44 | + define('PATH_CAPTCHA', PATH_ROOT . 'captcha/'); |
|
| 45 | +} |
|
| 46 | +// remember trailing slash - used for the demo formular |
|
| 47 | +if (!defined('PATH_CACHE')) { |
|
| 48 | + define('PATH_CACHE', PATH_ROOT . 'cache/'); |
|
| 49 | +} |
|
| 50 | +// remember trailing slash - path to cache |
|
| 51 | +if (!defined('PATH_INCLUDE_BACKUP')) { |
|
| 52 | + define('PATH_INCLUDE_BACKUP', PATH_ROOT . 'backup/'); |
|
| 53 | +} |
|
| 32 | 54 | |
| 33 | 55 | // paths on www |
| 34 | 56 | if (defined('NET_SCHEME') && defined('NET_HOST') && defined('NET_DIRECTORY')) {
|
@@ -43,10 +65,14 @@ discard block |
||
| 43 | 65 | $bucket = new bucket_Container(new Intraface_Factory()); |
| 44 | 66 | |
| 45 | 67 | // filehandler |
| 46 | -if (!defined('IMAGE_LIBRARY')) define('IMAGE_LIBRARY', 'GD');
|
|
| 68 | +if (!defined('IMAGE_LIBRARY')) { |
|
| 69 | + define('IMAGE_LIBRARY', 'GD'); |
|
| 70 | +} |
|
| 47 | 71 | |
| 48 | 72 | // database |
| 49 | -if (!defined('DB_DSN')) define('DB_DSN', 'mysql://'.DB_USER.':'.DB_PASS.'@'.DB_HOST.'/'.DB_NAME.'');
|
|
| 73 | +if (!defined('DB_DSN')) { |
|
| 74 | + define('DB_DSN', 'mysql://'.DB_USER.':'.DB_PASS.'@'.DB_HOST.'/'.DB_NAME.''); |
|
| 75 | +} |
|
| 50 | 76 | if (!defined('MDB2_DEBUG')) {
|
| 51 | 77 | define('MDB2_DEBUG', false);
|
| 52 | 78 | } |
@@ -94,8 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | if ($i = array_search($type, $address_type)) {
|
| 96 | 96 | $this->type = $i; |
| 97 | - } |
|
| 98 | - else {
|
|
| 97 | + } else {
|
|
| 99 | 98 | throw new Exception('Ugyldig address type');
|
| 100 | 99 | } |
| 101 | 100 | |
@@ -108,23 +107,20 @@ discard block |
||
| 108 | 107 | function load() {
|
| 109 | 108 | if ($this->old_address_id != 0) {
|
| 110 | 109 | $sql = "id = ".$this->old_address_id; |
| 111 | - } |
|
| 112 | - else {
|
|
| 110 | + } else {
|
|
| 113 | 111 | $sql = "type = ".$this->type." AND belong_to_id = ".$this->id." AND active = 1"; |
| 114 | 112 | } |
| 115 | 113 | |
| 116 | 114 | $this->db->query("SELECT * FROM address WHERE ".$sql);
|
| 117 | 115 | if ($this->db->numRows() > 1) {
|
| 118 | 116 | throw new Exception('Der er mere end 1 aktiv adresse', FATAL);
|
| 119 | - } |
|
| 120 | - elseif ($this->db->nextRecord()) {
|
|
| 117 | + } elseif ($this->db->nextRecord()) {
|
|
| 121 | 118 | $this->value['address_id'] = $this->db->f('id');
|
| 122 | 119 | for ($i = 0, $max = count($this->fields); $i<$max; $i++) {
|
| 123 | 120 | $this->value[$this->fields[$i]] = $this->db->f($this->fields[$i]); |
| 124 | 121 | } |
| 125 | 122 | return $this->db->f('id');
|
| 126 | - } |
|
| 127 | - else {
|
|
| 123 | + } else {
|
|
| 128 | 124 | return 0; |
| 129 | 125 | } |
| 130 | 126 | } |
@@ -140,11 +136,9 @@ discard block |
||
| 140 | 136 | $db = new DB_sql; |
| 141 | 137 | if ($this->old_address_id != 0) {
|
| 142 | 138 | return 0; |
| 143 | - } |
|
| 144 | - elseif ($this->id == 0) {
|
|
| 139 | + } elseif ($this->id == 0) {
|
|
| 145 | 140 | throw new Exception('Address:save(): Id kan ikke v�re 0 n�r du fors�ger at gemme adresse', FATAL);
|
| 146 | - } |
|
| 147 | - elseif (count($array_var) > 0) {
|
|
| 141 | + } elseif (count($array_var) > 0) {
|
|
| 148 | 142 | |
| 149 | 143 | $db->query("SELECT * FROM address WHERE id = ".$this->address_id);
|
| 150 | 144 | if ($db->nextRecord()) {
|
@@ -155,22 +149,19 @@ discard block |
||
| 155 | 149 | if ($db->f($this->fields[$i]) != $array_var[$this->fields[$i]]) {
|
| 156 | 150 | $do_update = 1; |
| 157 | 151 | } |
| 158 | - } |
|
| 159 | - else {
|
|
| 152 | + } else {
|
|
| 160 | 153 | // $sql .= $this->fields[$i]." = '', "; |
| 161 | 154 | } |
| 162 | 155 | |
| 163 | 156 | } |
| 164 | - } |
|
| 165 | - else {
|
|
| 157 | + } else {
|
|
| 166 | 158 | // Kun hvis der rent faktisk gemmes nogle v�rdier opdaterer vi |
| 167 | 159 | $do_update = 0; |
| 168 | 160 | for ($i = 0, $max = count($this->fields), $sql = ''; $i<$max; $i++) {
|
| 169 | 161 | if (array_key_exists($this->fields[$i], $array_var) AND isset($array_var[$this->fields[$i]])) {
|
| 170 | 162 | $sql .= $this->fields[$i]." = '".$array_var[$this->fields[$i]]."', "; |
| 171 | 163 | $do_update = 1; |
| 172 | - } |
|
| 173 | - else {
|
|
| 164 | + } else {
|
|
| 174 | 165 | // $sql .= $this->fields[$i]." = \"\", "; |
| 175 | 166 | } |
| 176 | 167 | } |
@@ -179,16 +170,14 @@ discard block |
||
| 179 | 170 | if ($do_update == 0) {
|
| 180 | 171 | // Hmmmmm, der er slet ikke nogen felter der er �ndret! S� gemmer vi ikke, men siger at det gik godt :-) |
| 181 | 172 | return 1; |
| 182 | - } |
|
| 183 | - else {
|
|
| 173 | + } else {
|
|
| 184 | 174 | $this->db->query("UPDATE address SET active = 0 WHERE type = ".$this->type." AND belong_to_id = ".$this->id);
|
| 185 | 175 | $this->db->query("INSERT INTO address SET ".$sql." type = ".$this->type.", belong_to_id = ".$this->id.", active = 1, changed_date = NOW()");
|
| 186 | 176 | $this->adress_id = $this->db->insertedId(); |
| 187 | 177 | $this->load(); |
| 188 | 178 | return 1; |
| 189 | 179 | } |
| 190 | - } |
|
| 191 | - else {
|
|
| 180 | + } else {
|
|
| 192 | 181 | // Der var slet ikke noget indhold i arrayet, s� vi lader v�re at opdatere, men siger, at vi gjorde. |
| 193 | 182 | return 1; |
| 194 | 183 | } |
@@ -205,19 +194,15 @@ discard block |
||
| 205 | 194 | function update($array_var) {
|
| 206 | 195 | if ($this->old_address_id != 0) {
|
| 207 | 196 | return 0; |
| 208 | - } |
|
| 209 | - elseif ($this->address_id == 0) {
|
|
| 197 | + } elseif ($this->address_id == 0) {
|
|
| 210 | 198 | $this->save($array_var); |
| 211 | - } |
|
| 212 | - elseif ($this->id == 0) {
|
|
| 199 | + } elseif ($this->id == 0) {
|
|
| 213 | 200 | throw new Exception("Id kan ikke v�re 0 n�r du fors�ger at gemme adresse", FATAL);
|
| 214 | - } |
|
| 215 | - else {
|
|
| 201 | + } else {
|
|
| 216 | 202 | for ($i = 0, $max = count($this->fields), $sql = ''; $i<$max; $i++) {
|
| 217 | 203 | if (isset($array_var[$this->fields[$i]])) {
|
| 218 | 204 | $sql .= $this->fields[$i]." = \"".$array_var[$this->fields[$i]]."\", "; |
| 219 | - } |
|
| 220 | - else {
|
|
| 205 | + } else {
|
|
| 221 | 206 | $sql .= $this->fields[$i]." = \"\", "; |
| 222 | 207 | } |
| 223 | 208 | } |
@@ -516,7 +516,9 @@ |
||
| 516 | 516 | $temparray = explode($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen ) ); |
| 517 | 517 | |
| 518 | 518 | while (list($iarg, $ival) = each($temparray)) {
|
| 519 | - if (!empty($ival)) $result[] = trim($ival); |
|
| 519 | + if (!empty($ival)) { |
|
| 520 | + $result[] = trim($ival); |
|
| 521 | + } |
|
| 520 | 522 | } |
| 521 | 523 | $instring = 1; |
| 522 | 524 | } |
@@ -285,7 +285,9 @@ |
||
| 285 | 285 | public $options; |
| 286 | 286 | function options() |
| 287 | 287 | { |
| 288 | - if (empty($this->options)) return array(); |
|
| 288 | + if (empty($this->options)) { |
|
| 289 | + return array(); |
|
| 290 | + } |
|
| 289 | 291 | return $this->options; |
| 290 | 292 | } |
| 291 | 293 | } |
@@ -146,10 +146,11 @@ discard block |
||
| 146 | 146 | $_config = $this->configSettings($config, $events); |
| 147 | 147 | |
| 148 | 148 | $js = $this->returnGlobalEvents(); |
| 149 | - if (!empty($_config)) |
|
| 150 | - $js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");";
|
|
| 151 | - else |
|
| 152 | - $js .= "CKEDITOR.replace('".$name."');";
|
|
| 149 | + if (!empty($_config)) { |
|
| 150 | + $js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");"; |
|
| 151 | + } else { |
|
| 152 | + $js .= "CKEDITOR.replace('".$name."');"; |
|
| 153 | + } |
|
| 153 | 154 | |
| 154 | 155 | $out .= $this->script($js); |
| 155 | 156 | |
@@ -186,8 +187,7 @@ discard block |
||
| 186 | 187 | $js = $this->returnGlobalEvents(); |
| 187 | 188 | if (!empty($_config)) {
|
| 188 | 189 | $js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
|
| 189 | - } |
|
| 190 | - else {
|
|
| 190 | + } else {
|
|
| 191 | 191 | $js .= "CKEDITOR.replace('".$id."');";
|
| 192 | 192 | } |
| 193 | 193 | $out .= $this->script($js); |
@@ -230,12 +230,10 @@ discard block |
||
| 230 | 230 | if (empty($_config)) {
|
| 231 | 231 | if (empty($className)) {
|
| 232 | 232 | $js .= "CKEDITOR.replaceAll();"; |
| 233 | - } |
|
| 234 | - else {
|
|
| 233 | + } else {
|
|
| 235 | 234 | $js .= "CKEDITOR.replaceAll('".$className."');";
|
| 236 | 235 | } |
| 237 | - } |
|
| 238 | - else {
|
|
| 236 | + } else {
|
|
| 239 | 237 | $classDetection = ""; |
| 240 | 238 | $js .= "CKEDITOR.replaceAll( function(textarea, config) {\n";
|
| 241 | 239 | if (!empty($className)) {
|
@@ -293,8 +291,7 @@ discard block |
||
| 293 | 291 | {
|
| 294 | 292 | if (!empty($event)) {
|
| 295 | 293 | $this->_events[$event] = array(); |
| 296 | - } |
|
| 297 | - else {
|
|
| 294 | + } else {
|
|
| 298 | 295 | $this->_events = array(); |
| 299 | 296 | } |
| 300 | 297 | } |
@@ -333,8 +330,7 @@ discard block |
||
| 333 | 330 | {
|
| 334 | 331 | if (!empty($event)) {
|
| 335 | 332 | $this->_globalEvents[$event] = array(); |
| 336 | - } |
|
| 337 | - else {
|
|
| 333 | + } else {
|
|
| 338 | 334 | $this->_globalEvents = array(); |
| 339 | 335 | } |
| 340 | 336 | } |
@@ -387,11 +383,9 @@ discard block |
||
| 387 | 383 | foreach ($_events as $eventName => $handlers) {
|
| 388 | 384 | if (empty($handlers)) {
|
| 389 | 385 | continue; |
| 390 | - } |
|
| 391 | - else if (count($handlers) == 1) {
|
|
| 386 | + } else if (count($handlers) == 1) {
|
|
| 392 | 387 | $_config['on'][$eventName] = '@@'.$handlers[0]; |
| 393 | - } |
|
| 394 | - else {
|
|
| 388 | + } else {
|
|
| 395 | 389 | $_config['on'][$eventName] = '@@function (ev){';
|
| 396 | 390 | foreach ($handlers as $handler => $code) {
|
| 397 | 391 | $_config['on'][$eventName] .= '('.$code.')(ev);';
|
@@ -497,8 +491,7 @@ discard block |
||
| 497 | 491 | */ |
| 498 | 492 | if (isset($_SERVER['SCRIPT_FILENAME'])) {
|
| 499 | 493 | $realPath = dirname($_SERVER['SCRIPT_FILENAME']); |
| 500 | - } |
|
| 501 | - else {
|
|
| 494 | + } else {
|
|
| 502 | 495 | /** |
| 503 | 496 | * realpath — Returns canonicalized absolute pathname |
| 504 | 497 | */ |
@@ -554,8 +547,7 @@ discard block |
||
| 554 | 547 | // Use @@ to not use quotes when outputting string value |
| 555 | 548 | if (strpos($val, '@@') === 0) {
|
| 556 | 549 | return substr($val, 2); |
| 557 | - } |
|
| 558 | - else {
|
|
| 550 | + } else {
|
|
| 559 | 551 | // All scalars are converted to strings to avoid indeterminism. |
| 560 | 552 | // PHP's "1" and 1 are equal for all PHP operators, but |
| 561 | 553 | // JS's "1" and 1 are not. So if we pass "1" or 1 from the PHP backend, |
@@ -581,12 +573,15 @@ discard block |
||
| 581 | 573 | $result = array(); |
| 582 | 574 | if ($isList) |
| 583 | 575 | {
|
| 584 | - foreach ($val as $v) $result[] = $this->jsEncode($v); |
|
| 576 | + foreach ($val as $v) { |
|
| 577 | + $result[] = $this->jsEncode($v); |
|
| 578 | + } |
|
| 585 | 579 | return '[ ' . join(', ', $result) . ' ]';
|
| 586 | - } |
|
| 587 | - else |
|
| 580 | + } else |
|
| 588 | 581 | {
|
| 589 | - foreach ($val as $k => $v) $result[] = $this->jsEncode($k).': '.$this->jsEncode($v); |
|
| 582 | + foreach ($val as $k => $v) { |
|
| 583 | + $result[] = $this->jsEncode($k).': '.$this->jsEncode($v); |
|
| 584 | + } |
|
| 590 | 585 | return '{ ' . join(', ', $result) . ' }';
|
| 591 | 586 | } |
| 592 | 587 | } |