@@ -47,7 +47,7 @@ |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | // TODO: we need to find a better solution for this |
50 | - $response = new k_TextResponse('Failure: ' . $action->error->view()); |
|
50 | + $response = new k_TextResponse('Failure: '.$action->error->view()); |
|
51 | 51 | $response->setStatus(400); |
52 | 52 | return $response; |
53 | 53 | } |
@@ -52,8 +52,8 @@ |
||
52 | 52 | $db = new DB_Sql; |
53 | 53 | $db->query("SELECT id FROM cms_element |
54 | 54 | WHERE intranet_id = ".$this->kernel->intranet->get('id')." |
55 | - AND section_id = " . $this->id . " |
|
56 | - AND active = 1 " . $sql_expire . $sql_publish . " |
|
55 | + AND section_id = " . $this->id." |
|
56 | + AND active = 1 " . $sql_expire.$sql_publish." |
|
57 | 57 | ORDER BY position ASC"); |
58 | 58 | $i = 0; |
59 | 59 |
@@ -24,7 +24,9 @@ discard block |
||
24 | 24 | $this->cmspage->kernel->useModule('filemanager'); |
25 | 25 | $this->value['picture'] = array(); |
26 | 26 | |
27 | - if ($this->value['pic_id'] == 0) return; |
|
27 | + if ($this->value['pic_id'] == 0) { |
|
28 | + return; |
|
29 | + } |
|
28 | 30 | |
29 | 31 | |
30 | 32 | $filemanager = new FileHandler($this->cmspage->kernel, $this->value['pic_id']); |
@@ -32,8 +34,7 @@ discard block |
||
32 | 34 | if ($filemanager->get('id') > 0) { |
33 | 35 | if ($size == 'original') { |
34 | 36 | $this->value['picture'] = $filemanager->get(); |
35 | - } |
|
36 | - else { |
|
37 | + } else { |
|
37 | 38 | $filemanager->createInstance($size); |
38 | 39 | $this->value['picture'] = $filemanager->instance->get(); |
39 | 40 | |
@@ -43,7 +44,9 @@ discard block |
||
43 | 44 | |
44 | 45 | function validate_section(& $var) { |
45 | 46 | $validator = new Intraface_Validator($this->error); |
46 | - if (!empty($var['pic_id'])) $validator->isNumeric($var['pic_id'], 'error in pic_id', 'allow_empty'); |
|
47 | + if (!empty($var['pic_id'])) { |
|
48 | + $validator->isNumeric($var['pic_id'], 'error in pic_id', 'allow_empty'); |
|
49 | + } |
|
47 | 50 | |
48 | 51 | if ($this->error->isError()) { |
49 | 52 | return 0; |
@@ -91,7 +94,9 @@ discard block |
||
91 | 94 | $var['pic_id'] = $this->parameter->get('pic_id'); |
92 | 95 | } |
93 | 96 | */ |
94 | - if (!empty($var['pic_id'])) $this->addParameter('pic_id', $var['pic_id']); |
|
97 | + if (!empty($var['pic_id'])) { |
|
98 | + $this->addParameter('pic_id', $var['pic_id']); |
|
99 | + } |
|
95 | 100 | return 1; |
96 | 101 | |
97 | 102 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function save($parameter, $value) |
80 | 80 | { |
81 | 81 | if ($this->object->get('id') == 0) { |
82 | - throw new Exception('Parameter::save() object cannot be 0 - problems in ' . get_class($this->object)); |
|
82 | + throw new Exception('Parameter::save() object cannot be 0 - problems in '.get_class($this->object)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | # mangler noget validering - skal sikkert kunne s�ttes fra elementet? |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | |
92 | 92 | // hvis parameteren tidligere er oprettet opdateres den! |
93 | 93 | if (!empty($old_parameter)) { |
94 | - $db->query("UPDATE cms_parameter SET value='".$value."' WHERE type_key = ".$this->type_key." AND intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id=". $this->object->get('id') . " AND parameter='".$parameter."'"); |
|
94 | + $db->query("UPDATE cms_parameter SET value='".$value."' WHERE type_key = ".$this->type_key." AND intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id=".$this->object->get('id')." AND parameter='".$parameter."'"); |
|
95 | 95 | } elseif (!empty($value) AND empty($old_parameter)) { |
96 | 96 | // hvis parameteren ikke findes oprettes den |
97 | 97 | $db->query("INSERT INTO cms_parameter SET type_key=".$this->type_key.", belong_to_id = '".$this->object->get('id')."', parameter='".$parameter."', value='".$value."', intranet_id = ".$this->object->kernel->intranet->get('id')); |
98 | 98 | } elseif (empty($value) AND !empty($old_parameter)) { |
99 | 99 | // hvis parametervvalue er tom skal den gamle parameter slettes |
100 | - $db->query("DELETE FROM cms_parameter WHERE belong_to_id = '".$this->object->get('id')."' AND parameter='".$parameter."' AND intranet_id = ".$this->object->kernel->intranet->get('id') . " AND type_key =" .$this->type_key); |
|
100 | + $db->query("DELETE FROM cms_parameter WHERE belong_to_id = '".$this->object->get('id')."' AND parameter='".$parameter."' AND intranet_id = ".$this->object->kernel->intranet->get('id')." AND type_key =".$this->type_key); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | $this->load(); |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | private function load() |
115 | 115 | { |
116 | 116 | if ($this->object->get('id') == 0) { |
117 | - throw new Exception('Parameter::save() object cannot be 0 - problems with ' . get_class($this->object)); |
|
117 | + throw new Exception('Parameter::save() object cannot be 0 - problems with '.get_class($this->object)); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $db = new DB_Sql; |
121 | - $sql = "SELECT parameter, value FROM cms_parameter WHERE intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id = " . $this->object->get('id') . " AND type_key = " . $this->type_key; // . " AND parameter = '" .$parameter . "'" |
|
121 | + $sql = "SELECT parameter, value FROM cms_parameter WHERE intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id = ".$this->object->get('id')." AND type_key = ".$this->type_key; // . " AND parameter = '" .$parameter . "'" |
|
122 | 122 | $db->query($sql); |
123 | 123 | |
124 | - while($db->nextRecord()) { |
|
124 | + while ($db->nextRecord()) { |
|
125 | 125 | $this->value[$db->f('parameter')] = $db->f('value'); |
126 | 126 | } |
127 | 127 | $this->loaded = true; |
@@ -49,9 +49,13 @@ discard block |
||
49 | 49 | { |
50 | 50 | $validator = new Intraface_Validator($this->error); |
51 | 51 | |
52 | - if (!empty($var['pic_text'])) $validator->isString($var['pic_text'], 'error in pic_text', '', 'allow_empty'); |
|
52 | + if (!empty($var['pic_text'])) { |
|
53 | + $validator->isString($var['pic_text'], 'error in pic_text', '', 'allow_empty'); |
|
54 | + } |
|
53 | 55 | //if (!empty($var['pic_id'])) $validator->isNumeric($var['pic_id'], 'error in pic_id', 'allow_empty'); |
54 | - if (!empty($var['pic_url'])) $validator->isString($var['pic_url'], 'error in pic_url', 'allow_empty'); |
|
56 | + if (!empty($var['pic_url'])) { |
|
57 | + $validator->isString($var['pic_url'], 'error in pic_url', 'allow_empty'); |
|
58 | + } |
|
55 | 59 | |
56 | 60 | // st�rrelsen skal ogs� valideres |
57 | 61 | |
@@ -94,9 +98,15 @@ discard block |
||
94 | 98 | if (isset($var['pic_id'])) { |
95 | 99 | $this->parameter->save('pic_id', $var['pic_id']); |
96 | 100 | } |
97 | - if (!empty($var['pic_size'])) $this->parameter->save('pic_size', $var['pic_size']); |
|
98 | - if (!empty($var['pic_text'])) $this->parameter->save('pic_text', $var['pic_text']); |
|
99 | - if (!empty($var['pic_url'])) $this->parameter->save('pic_url', $var['pic_url']); |
|
101 | + if (!empty($var['pic_size'])) { |
|
102 | + $this->parameter->save('pic_size', $var['pic_size']); |
|
103 | + } |
|
104 | + if (!empty($var['pic_text'])) { |
|
105 | + $this->parameter->save('pic_text', $var['pic_text']); |
|
106 | + } |
|
107 | + if (!empty($var['pic_url'])) { |
|
108 | + $this->parameter->save('pic_url', $var['pic_url']); |
|
109 | + } |
|
100 | 110 | |
101 | 111 | return true; |
102 | 112 | } |
@@ -52,7 +52,9 @@ |
||
52 | 52 | // @todo this should be avoided |
53 | 53 | $filehandler->createInstance(); |
54 | 54 | // HACK lille hack - til at undg� at vi f�r filer med som ikke har beskrivelser (formentlig slettede filer) |
55 | - if (!$filehandler->get('description')) continue; |
|
55 | + if (!$filehandler->get('description')) { |
|
56 | + continue; |
|
57 | + } |
|
56 | 58 | $this->value['files'][$i] = $filehandler->get(); |
57 | 59 | $this->value['files'][$i]['append_file_id'] = $append_file_id; |
58 | 60 | // $this->value['pictures'][$i]['show_uri'] = $file_uri; |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | protected function validate_element($var) |
52 | 52 | { |
53 | - if ($this->error->isError()){ |
|
53 | + if ($this->error->isError()) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | protected function validate_element($var) |
36 | 36 | { |
37 | - if ($this->error->isError()){ |
|
37 | + if ($this->error->isError()) { |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $api = $this->get('api_key'); |
36 | 36 | } |
37 | 37 | |
38 | - $this->value['map'] = '<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?'.htmlentities('v=2.0&appid=' . $api) .'"></script>'; |
|
38 | + $this->value['map'] = '<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?'.htmlentities('v=2.0&appid='.$api).'"></script>'; |
|
39 | 39 | /* flash version |
40 | 40 | $this->value['map'] .= '<script type="text/javascript">'; |
41 | 41 | $this->value['map'] .= ' var latlon = new LatLon(' .$a['ResultSet']['Result']['Latitude'] . ', '. $a['ResultSet']['Result']['Longitude'].');'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->value['map'] .= ' var words = "title";'; |
52 | 52 | $this->value['map'] .= ' marker.openSmartWindow(words);'; |
53 | 53 | $this->value['map'] .= ' } '; |
54 | - $this->value['map'] .= ' var latlon = new YGeoPoint(' .$this->get('latitude') . ', '. $this->get('longitude').');'; |
|
54 | + $this->value['map'] .= ' var latlon = new YGeoPoint('.$this->get('latitude').', '.$this->get('longitude').');'; |
|
55 | 55 | $this->value['map'] .= ' var mymap = new YMap(document.getElementById("mapContainer"));'; |
56 | 56 | $this->value['map'] .= ' var marker = new YMarker(latlon);'; |
57 | 57 | $this->value['map'] .= ' marker.addLabel("<b>A</b>"); '; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->value['map'] .= ' }'; |
85 | 85 | $this->value['map'] .= '}'; |
86 | 86 | $this->value['map'] .= 'load();'; |
87 | - $this->value['map'] .= ' var latlon = new YGeoPoint(' .$this->get('latitude') . ', '. $this->get('longitude').');'; |
|
87 | + $this->value['map'] .= ' var latlon = new YGeoPoint('.$this->get('latitude').', '.$this->get('longitude').');'; |
|
88 | 88 | $this->value['map'] .= ' var mymap = new YMap(document.getElementById("mapContainer"));'; |
89 | 89 | $this->value['map'] .= ' var marker = new YMarker(latlon);'; |
90 | 90 | $this->value['map'] .= ' marker.addLabel("<b>A</b>"); '; |
@@ -121,13 +121,27 @@ |
||
121 | 121 | |
122 | 122 | function save_element($var) |
123 | 123 | { |
124 | - if (!empty($var['service'])) $this->parameter->save('service', $var['service']); |
|
125 | - if (!empty($var['text'])) $this->parameter->save('text', $var['text']); |
|
126 | - if (!empty($var['latitude'])) $this->parameter->save('latitude', $var['latitude']); |
|
127 | - if (!empty($var['longitude'])) $this->parameter->save('longitude', $var['longitude']); |
|
128 | - if (!empty($var['height'])) $this->parameter->save('height', $var['height']); |
|
129 | - if (!empty($var['width'])) $this->parameter->save('width', $var['width']); |
|
130 | - if (!empty($var['api_key'])) $this->parameter->save('api_key', $var['api_key']); |
|
124 | + if (!empty($var['service'])) { |
|
125 | + $this->parameter->save('service', $var['service']); |
|
126 | + } |
|
127 | + if (!empty($var['text'])) { |
|
128 | + $this->parameter->save('text', $var['text']); |
|
129 | + } |
|
130 | + if (!empty($var['latitude'])) { |
|
131 | + $this->parameter->save('latitude', $var['latitude']); |
|
132 | + } |
|
133 | + if (!empty($var['longitude'])) { |
|
134 | + $this->parameter->save('longitude', $var['longitude']); |
|
135 | + } |
|
136 | + if (!empty($var['height'])) { |
|
137 | + $this->parameter->save('height', $var['height']); |
|
138 | + } |
|
139 | + if (!empty($var['width'])) { |
|
140 | + $this->parameter->save('width', $var['width']); |
|
141 | + } |
|
142 | + if (!empty($var['api_key'])) { |
|
143 | + $this->parameter->save('api_key', $var['api_key']); |
|
144 | + } |
|
131 | 145 | return true; |
132 | 146 | } |
133 | 147 | } |
134 | 148 | \ No newline at end of file |