@@ -30,6 +30,6 @@ |
||
30 | 30 | $smarthookHandler = SmartHookHandler::getInstance(); |
31 | 31 | |
32 | 32 | if (!class_exists('smartmetagen')) { |
33 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartmetagen.php'; |
|
33 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartmetagen.php'; |
|
34 | 34 | } |
35 | 35 | //$smartobjectConfig = smart_getModuleConfig('smartobject'); |
@@ -31,513 +31,513 @@ |
||
31 | 31 | */ |
32 | 32 | class SmartObjectController |
33 | 33 | { |
34 | - public $handler; |
|
35 | - |
|
36 | - /** |
|
37 | - * SmartObjectController constructor. |
|
38 | - * @param $handler |
|
39 | - */ |
|
40 | - public function __construct($handler) |
|
41 | - { |
|
42 | - $this->handler = $handler; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @param $smartObj |
|
47 | - */ |
|
48 | - public function postDataToObject(&$smartObj) |
|
49 | - { |
|
50 | - foreach (array_keys($smartObj->vars) as $key) { |
|
51 | - switch ($smartObj->vars[$key]['data_type']) { |
|
52 | - case XOBJ_DTYPE_IMAGE: |
|
53 | - if (isset($_POST['url_' . $key]) && $_POST['url_' . $key] !== '') { |
|
54 | - $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
55 | - $smartObj->setVar($key, $_POST['url_' . $key]); |
|
56 | - if (file_exists($oldFile)) { |
|
57 | - unlink($oldFile); |
|
58 | - } |
|
59 | - } |
|
60 | - if (isset($_POST['delete_' . $key]) && $_POST['delete_' . $key] == '1') { |
|
61 | - $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
62 | - $smartObj->setVar($key, ''); |
|
63 | - if (file_exists($oldFile)) { |
|
64 | - unlink($oldFile); |
|
65 | - } |
|
66 | - } |
|
67 | - break; |
|
68 | - |
|
69 | - case XOBJ_DTYPE_URLLINK: |
|
70 | - $linkObj = $smartObj->getUrlLinkObj($key); |
|
71 | - $linkObj->setVar('caption', $_POST['caption_' . $key]); |
|
72 | - $linkObj->setVar('description', $_POST['desc_' . $key]); |
|
73 | - $linkObj->setVar('target', $_POST['target_' . $key]); |
|
74 | - $linkObj->setVar('url', $_POST['url_' . $key]); |
|
75 | - if ($linkObj->getVar('url') !== '') { |
|
76 | - $smartObj->storeUrlLinkObj($linkObj); |
|
77 | - } |
|
78 | - //todo: catch errors |
|
79 | - $smartObj->setVar($key, $linkObj->getVar('urllinkid')); |
|
80 | - break; |
|
81 | - |
|
82 | - case XOBJ_DTYPE_FILE: |
|
83 | - if (!isset($_FILES['upload_' . $key]['name']) || $_FILES['upload_' . $key]['name'] === '') { |
|
84 | - $fileObj = $smartObj->getFileObj($key); |
|
85 | - $fileObj->setVar('caption', $_POST['caption_' . $key]); |
|
86 | - $fileObj->setVar('description', $_POST['desc_' . $key]); |
|
87 | - $fileObj->setVar('url', $_POST['url_' . $key]); |
|
88 | - if (!($fileObj->getVar('url') === '' && $fileObj->getVar('url') === '' |
|
89 | - && $fileObj->getVar('url') === '')) { |
|
90 | - $res = $smartObj->storeFileObj($fileObj); |
|
91 | - if ($res) { |
|
92 | - $smartObj->setVar($key, $fileObj->getVar('fileid')); |
|
93 | - } else { |
|
94 | - //error setted, but no error message (to be improved) |
|
95 | - $smartObj->setErrors($fileObj->getErrors()); |
|
96 | - } |
|
97 | - } |
|
98 | - } |
|
99 | - break; |
|
100 | - |
|
101 | - case XOBJ_DTYPE_STIME: |
|
102 | - case XOBJ_DTYPE_MTIME: |
|
103 | - case XOBJ_DTYPE_LTIME: |
|
104 | - // check if this field's value is available in the POST array |
|
105 | - if (is_array($_POST[$key]) && isset($_POST[$key]['date'])) { |
|
106 | - $value = strtotime($_POST[$key]['date']) + $_POST[$key]['time']; |
|
107 | - } else { |
|
108 | - $value = strtotime($_POST[$key]); |
|
109 | - //if strtotime returns false, the value is already a time stamp |
|
110 | - if (!$value) { |
|
111 | - $value = (int)$_POST[$key]; |
|
112 | - } |
|
113 | - } |
|
114 | - $smartObj->setVar($key, $value); |
|
115 | - |
|
116 | - break; |
|
117 | - |
|
118 | - default: |
|
119 | - $smartObj->setVar($key, $_POST[$key]); |
|
120 | - break; |
|
121 | - } |
|
122 | - } |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * @param $smartObj |
|
127 | - * @param $objectid |
|
128 | - * @param $created_success_msg |
|
129 | - * @param $modified_success_msg |
|
130 | - * @param bool $redirect_page |
|
131 | - * @param bool $debug |
|
132 | - * @return mixed |
|
133 | - */ |
|
134 | - public function doStoreFromDefaultForm( |
|
135 | - &$smartObj, |
|
136 | - $objectid, |
|
137 | - $created_success_msg, |
|
138 | - $modified_success_msg, |
|
139 | - $redirect_page = false, |
|
140 | - $debug = false |
|
141 | - ) { |
|
142 | - global $smart_previous_page; |
|
143 | - |
|
144 | - $this->postDataToObject($smartObj); |
|
145 | - |
|
146 | - if ($smartObj->isNew()) { |
|
147 | - $redirect_msg = $created_success_msg; |
|
148 | - } else { |
|
149 | - $redirect_msg = $modified_success_msg; |
|
150 | - } |
|
151 | - |
|
152 | - // Check if there were uploaded files |
|
153 | - if (isset($_POST['smart_upload_image']) || isset($_POST['smart_upload_file'])) { |
|
154 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartuploader.php'; |
|
155 | - $uploaderObj = new SmartUploader($smartObj->getImageDir(true), $this->handler->_allowedMimeTypes, $this->handler->_maxFileSize, $this->handler->_maxWidth, $this->handler->_maxHeight); |
|
156 | - foreach ($_FILES as $name => $file_array) { |
|
157 | - if (isset($file_array['name']) && $file_array['name'] !== '' |
|
158 | - && in_array(str_replace('upload_', '', $name), array_keys($smartObj->vars))) { |
|
159 | - if ($uploaderObj->fetchMedia($name)) { |
|
160 | - $uploaderObj->setTargetFileName(time() . '_' . $uploaderObj->getMediaName()); |
|
161 | - if ($uploaderObj->upload()) { |
|
162 | - // Find the related field in the SmartObject |
|
163 | - $related_field = str_replace('upload_', '', $name); |
|
164 | - $uploadedArray[] = $related_field; |
|
165 | - //si c'est un fichier Rich |
|
166 | - if ($smartObj->vars[$related_field]['data_type'] === XOBJ_DTYPE_FILE) { |
|
167 | - $object_fileurl = $smartObj->getUploadDir(); |
|
168 | - $fileObj = $smartObj->getFileObj($related_field); |
|
169 | - $fileObj->setVar('url', $object_fileurl . $uploaderObj->getSavedFileName()); |
|
170 | - $fileObj->setVar('caption', $_POST['caption_' . $related_field]); |
|
171 | - $fileObj->setVar('description', $_POST['desc_' . $related_field]); |
|
172 | - $smartObj->storeFileObj($fileObj); |
|
173 | - //todo: catch errors |
|
174 | - $smartObj->setVar($related_field, $fileObj->getVar('fileid')); |
|
175 | - } else { |
|
176 | - $old_file = $smartObj->getUploadDir(true) . $smartObj->getVar($related_field); |
|
177 | - unlink($old_file); |
|
178 | - $smartObj->setVar($related_field, $uploaderObj->getSavedFileName()); |
|
179 | - } |
|
180 | - } else { |
|
181 | - $smartObj->setErrors($uploaderObj->getErrors(false)); |
|
182 | - } |
|
183 | - } else { |
|
184 | - $smartObj->setErrors($uploaderObj->getErrors(false)); |
|
185 | - } |
|
186 | - } |
|
187 | - } |
|
188 | - } |
|
189 | - |
|
190 | - if ($debug) { |
|
191 | - $storeResult = $this->handler->insertD($smartObj); |
|
192 | - } else { |
|
193 | - $storeResult = $this->handler->insert($smartObj); |
|
194 | - } |
|
195 | - |
|
196 | - if ($storeResult) { |
|
197 | - if ($this->handler->getPermissions()) { |
|
198 | - $smartPermissionsHandler = new SmartobjectPermissionHandler($this->handler); |
|
199 | - $smartPermissionsHandler->storeAllPermissionsForId($smartObj->id()); |
|
200 | - } |
|
201 | - } |
|
202 | - |
|
203 | - if ($redirect_page === null) { |
|
204 | - return $smartObj; |
|
205 | - } else { |
|
206 | - if (!$storeResult) { |
|
207 | - redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $smartObj->getHtmlErrors()); |
|
208 | - } |
|
209 | - |
|
210 | - $redirect_page = $redirect_page ?: smart_get_page_before_form(); |
|
211 | - |
|
212 | - redirect_header($redirect_page, 2, $redirect_msg); |
|
213 | - } |
|
214 | - } |
|
215 | - |
|
216 | - /** |
|
217 | - * Store the object in the database autmatically from a form sending POST data |
|
218 | - * |
|
219 | - * @param string $created_success_msg message to display if new object was created |
|
220 | - * @param string $modified_success_msg message to display if object was successfully edited |
|
221 | - * @param bool|string $redirect_page redirect page, if not set, then we backup once |
|
222 | - * @param bool $debug |
|
223 | - * @param bool $x_param |
|
224 | - * @return bool |
|
225 | - * @internal param string $created_redir_page redirect page after creating the object |
|
226 | - * @internal param string $modified_redir_page redirect page after editing the object |
|
227 | - * @internal param bool $exit if set to TRUE then the script ends |
|
228 | - */ |
|
229 | - public function storeFromDefaultForm( |
|
230 | - $created_success_msg, |
|
231 | - $modified_success_msg, |
|
232 | - $redirect_page = false, |
|
233 | - $debug = false, |
|
234 | - $x_param = false |
|
235 | - ) { |
|
236 | - $objectid = isset($_POST[$this->handler->keyName]) ? (int)$_POST[$this->handler->keyName] : 0; |
|
237 | - if ($debug) { |
|
238 | - if ($x_param) { |
|
239 | - $smartObj = $this->handler->getD($objectid, true, $x_param); |
|
240 | - } else { |
|
241 | - $smartObj = $this->handler->getD($objectid); |
|
242 | - } |
|
243 | - } else { |
|
244 | - if ($x_param) { |
|
245 | - $smartObj = $this->handler->get($objectid, true, false, false, $x_param); |
|
246 | - } else { |
|
247 | - $smartObj = $this->handler->get($objectid); |
|
248 | - } |
|
249 | - } |
|
250 | - |
|
251 | - // if handler is the Multilanguage handler, we will need to treat this for multilanguage |
|
252 | - if (is_subclass_of($this->handler, 'smartpersistablemlobjecthandler')) { |
|
253 | - if ($smartObj->isNew()) { |
|
254 | - // This is a new object. We need to store the meta data and then the language data |
|
255 | - // First, we will get rid of the multilanguage data to only store the meta data |
|
256 | - $smartObj->stripMultilanguageFields(); |
|
257 | - $newObject = $this->doStoreFromDefaultForm($smartObj, $objectid, $created_success_msg, $modified_success_msg, $redirect_page, $debug); |
|
258 | - /** |
|
259 | - * @todo we need to trap potential errors here |
|
260 | - */ |
|
261 | - |
|
262 | - // ok, the meta daa is stored. Let's recreate the object and then |
|
263 | - // get rid of anything not multilanguage |
|
264 | - unset($smartObj); |
|
265 | - $smartObj = $this->handler->get($objectid); |
|
266 | - $smartObj->stripNonMultilanguageFields(); |
|
267 | - |
|
268 | - $smartObj->setVar($this->handler->keyName, $newObject->getVar($this->handler->keyName)); |
|
269 | - $this->handler->changeTableNameForML(); |
|
270 | - $ret = $this->doStoreFromDefaultForm($smartObj, $objectid, $created_success_msg, $modified_success_msg, $redirect_page, $debug); |
|
271 | - |
|
272 | - return $ret; |
|
273 | - } |
|
274 | - } else { |
|
275 | - return $this->doStoreFromDefaultForm($smartObj, $objectid, $created_success_msg, $modified_success_msg, $redirect_page, $debug); |
|
276 | - } |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * @return bool |
|
281 | - */ |
|
282 | - public function storeSmartObjectD() |
|
283 | - { |
|
284 | - return $this->storeSmartObject(true); |
|
285 | - } |
|
286 | - |
|
287 | - /** |
|
288 | - * @param bool $debug |
|
289 | - * @param bool $xparam |
|
290 | - * @return bool |
|
291 | - */ |
|
292 | - public function storeSmartObject($debug = false, $xparam = false) |
|
293 | - { |
|
294 | - $ret = $this->storeFromDefaultForm('', '', null, $debug, $xparam); |
|
295 | - |
|
296 | - return $ret; |
|
297 | - } |
|
298 | - |
|
299 | - /** |
|
300 | - * Handles deletion of an object which keyid is passed as a GET param |
|
301 | - * |
|
302 | - * @param bool $confirm_msg |
|
303 | - * @param string $op |
|
304 | - * @param bool $userSide |
|
305 | - * @return bool |
|
306 | - * @internal param string $redir_page redirect page after deleting the object |
|
307 | - */ |
|
308 | - public function handleObjectDeletion($confirm_msg = false, $op = 'del', $userSide = false) |
|
309 | - { |
|
310 | - global $smart_previous_page; |
|
311 | - |
|
312 | - $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
313 | - $smartObj = $this->handler->get($objectid); |
|
314 | - |
|
315 | - if ($smartObj->isNew()) { |
|
316 | - redirect_header('javascript:history.go(-1)', 3, _CO_SOBJECT_NOT_SELECTED); |
|
317 | - } |
|
318 | - |
|
319 | - $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
320 | - if ($confirm) { |
|
321 | - if (!$this->handler->delete($smartObj)) { |
|
322 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
323 | - exit; |
|
324 | - } |
|
325 | - |
|
326 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS); |
|
327 | - } else { |
|
328 | - // no confirm: show deletion condition |
|
329 | - |
|
330 | - xoops_cp_header(); |
|
331 | - |
|
332 | - if (!$confirm_msg) { |
|
333 | - $confirm_msg = _CO_SOBJECT_DELETE_CONFIRM; |
|
334 | - } |
|
335 | - |
|
336 | - xoops_confirm(array( |
|
337 | - 'op' => $op, |
|
338 | - $this->handler->keyName => $smartObj->getVar($this->handler->keyName), |
|
339 | - 'confirm' => 1, |
|
340 | - 'redirect_page' => $smart_previous_page |
|
341 | - ), xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE); |
|
342 | - |
|
343 | - xoops_cp_footer(); |
|
344 | - } |
|
345 | - exit(); |
|
346 | - } |
|
347 | - |
|
348 | - /** |
|
349 | - * @param bool $confirm_msg |
|
350 | - * @param string $op |
|
351 | - */ |
|
352 | - public function handleObjectDeletionFromUserSide($confirm_msg = false, $op = 'del') |
|
353 | - { |
|
354 | - global $smart_previous_page, $xoopsTpl; |
|
355 | - |
|
356 | - $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
357 | - $smartObj = $this->handler->get($objectid); |
|
358 | - |
|
359 | - if ($smartObj->isNew()) { |
|
360 | - redirect_header('javascript:history.go(-1)', 3, _CO_SOBJECT_NOT_SELECTED); |
|
361 | - } |
|
362 | - |
|
363 | - $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
364 | - if ($confirm) { |
|
365 | - if (!$this->handler->delete($smartObj)) { |
|
366 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
367 | - exit; |
|
368 | - } |
|
369 | - |
|
370 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS); |
|
371 | - } else { |
|
372 | - // no confirm: show deletion condition |
|
373 | - if (!$confirm_msg) { |
|
374 | - $confirm_msg = _CO_SOBJECT_DELETE_CONFIRM; |
|
375 | - } |
|
376 | - |
|
377 | - ob_start(); |
|
378 | - xoops_confirm(array( |
|
379 | - 'op' => $op, |
|
380 | - $this->handler->keyName => $smartObj->getVar($this->handler->keyName), |
|
381 | - 'confirm' => 1, |
|
382 | - 'redirect_page' => $smart_previous_page |
|
383 | - ), xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE); |
|
384 | - $smartobjectDeleteConfirm = ob_get_clean(); |
|
385 | - $xoopsTpl->assign('smartobject_delete_confirm', $smartobjectDeleteConfirm); |
|
386 | - } |
|
387 | - } |
|
388 | - |
|
389 | - /** |
|
390 | - * Retreive the object admin side link for a {@link SmartObjectSingleView} page |
|
391 | - * |
|
392 | - * @param SmartObject $smartObj reference to the object from which we want the user side link |
|
393 | - * @param bool $onlyUrl wether or not to return a simple URL or a full <a> link |
|
394 | - * @param bool $withimage |
|
395 | - * @return string admin side link to the object |
|
396 | - */ |
|
397 | - public function getAdminViewItemLink(SmartObject $smartObj, $onlyUrl = false, $withimage = false) |
|
398 | - { |
|
399 | - $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=view&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
400 | - if ($onlyUrl) { |
|
401 | - return $ret; |
|
402 | - } elseif ($withimage) { |
|
403 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "viewmag.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_ADMIN_VIEW . "' title='" . _CO_SOBJECT_ADMIN_VIEW . "'></a>"; |
|
404 | - } |
|
405 | - |
|
406 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
407 | - } |
|
408 | - |
|
409 | - /** |
|
410 | - * Retreive the object user side link |
|
411 | - * |
|
412 | - * @param SmartObject $smartObj reference to the object from which we want the user side link |
|
413 | - * @param bool $onlyUrl wether or not to return a simple URL or a full <a> link |
|
414 | - * @return string user side link to the object |
|
415 | - */ |
|
416 | - public function getItemLink(SmartObject $smartObj, $onlyUrl = false) |
|
417 | - { |
|
418 | - $seoMode = smart_getModuleModeSEO($this->handler->_moduleName); |
|
419 | - $seoModuleName = smart_getModuleNameForSEO($this->handler->_moduleName); |
|
420 | - |
|
421 | - /** |
|
422 | - * $seoIncludeId feature is not finished yet, so let's put it always to true |
|
423 | - */ |
|
424 | - //$seoIncludeId = smart_getModuleIncludeIdSEO($this->handler->_moduleName); |
|
425 | - $seoIncludeId = true; |
|
426 | - |
|
427 | - if ($seoMode === 'rewrite') { |
|
428 | - $ret = XOOPS_URL . '/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html'; |
|
429 | - } elseif ($seoMode === 'pathinfo') { |
|
430 | - $ret = SMARTOBJECT_URL . 'seo.php/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html'; |
|
431 | - } else { |
|
432 | - $ret = $this->handler->_moduleUrl . $this->handler->_page . '?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
433 | - } |
|
434 | - |
|
435 | - if (!$onlyUrl) { |
|
436 | - $ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
437 | - } |
|
438 | - |
|
439 | - return $ret; |
|
440 | - } |
|
441 | - |
|
442 | - /** |
|
443 | - * @param $smartObj |
|
444 | - * @param bool $onlyUrl |
|
445 | - * @param bool $withimage |
|
446 | - * @return string |
|
447 | - */ |
|
448 | - public function getEditLanguageLink($smartObj, $onlyUrl = false, $withimage = true) |
|
449 | - { |
|
450 | - $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName) . '&language=' . $smartObj->getVar('language'); |
|
451 | - if ($onlyUrl) { |
|
452 | - return $ret; |
|
453 | - } elseif ($withimage) { |
|
454 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "wizard.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_LANGUAGE_MODIFY . "' title='" . _CO_SOBJECT_LANGUAGE_MODIFY . "'></a>"; |
|
455 | - } |
|
456 | - |
|
457 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
458 | - } |
|
459 | - |
|
460 | - /** |
|
461 | - * @param $smartObj |
|
462 | - * @param bool $onlyUrl |
|
463 | - * @param bool $withimage |
|
464 | - * @param bool $userSide |
|
465 | - * @return string |
|
466 | - */ |
|
467 | - public function getEditItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
|
468 | - { |
|
469 | - $admin_side = $userSide ? '' : 'admin/'; |
|
470 | - $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
471 | - if ($onlyUrl) { |
|
472 | - return $ret; |
|
473 | - } elseif ($withimage) { |
|
474 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "edit.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_MODIFY . "' title='" . _CO_SOBJECT_MODIFY . "'></a>"; |
|
475 | - } |
|
476 | - |
|
477 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
478 | - } |
|
479 | - |
|
480 | - /** |
|
481 | - * @param $smartObj |
|
482 | - * @param bool $onlyUrl |
|
483 | - * @param bool $withimage |
|
484 | - * @param bool $userSide |
|
485 | - * @return string |
|
486 | - */ |
|
487 | - public function getDeleteItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
|
488 | - { |
|
489 | - $admin_side = $userSide ? '' : 'admin/'; |
|
490 | - $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=del&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
491 | - if ($onlyUrl) { |
|
492 | - return $ret; |
|
493 | - } elseif ($withimage) { |
|
494 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "editdelete.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_DELETE . "' title='" . _CO_SOBJECT_DELETE . "'></a>"; |
|
495 | - } |
|
496 | - |
|
497 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
498 | - } |
|
499 | - |
|
500 | - /** |
|
501 | - * @param $smartObj |
|
502 | - * @return string |
|
503 | - */ |
|
504 | - public function getPrintAndMailLink($smartObj) |
|
505 | - { |
|
506 | - global $xoopsConfig; |
|
507 | - |
|
508 | - $printlink = $this->handler->_moduleUrl . 'print.php?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
509 | - $js = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);"; |
|
510 | - $printlink = '<a href="' . $js . '"><img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"></a>'; |
|
511 | - |
|
512 | - $smartModule = smart_getModuleInfo($smartObj->handler->_moduleName); |
|
513 | - $link = smart_getCurrentPage(); |
|
514 | - $mid = $smartModule->getVar('mid'); |
|
515 | - $friendlink = "<a href=\"javascript:openWithSelfMain('" |
|
516 | - . SMARTOBJECT_URL |
|
517 | - . 'sendlink.php?link=' |
|
518 | - . $link |
|
519 | - . '&mid=' |
|
520 | - . $mid |
|
521 | - . "', ',',',',',','sendmessage', 674, 500);\"><img src=\"" |
|
522 | - . SMARTOBJECT_IMAGES_ACTIONS_URL |
|
523 | - . "mail_send.png\" alt=\"" |
|
524 | - . _CO_SOBJECT_EMAIL |
|
525 | - . "\" title=\"" |
|
526 | - . _CO_SOBJECT_EMAIL |
|
527 | - . "\" style=\"vertical-align: middle;\"></a>"; |
|
528 | - |
|
529 | - $ret = '<span id="smartobject_print_button">' . $printlink . ' </span>' . '<span id="smartobject_mail_button">' . $friendlink . '</span>'; |
|
530 | - |
|
531 | - return $ret; |
|
532 | - } |
|
533 | - |
|
534 | - /** |
|
535 | - * @return string |
|
536 | - */ |
|
537 | - public function getModuleItemString() |
|
538 | - { |
|
539 | - $ret = $this->handler->_moduleName . '_' . $this->handler->_itemname; |
|
540 | - |
|
541 | - return $ret; |
|
542 | - } |
|
34 | + public $handler; |
|
35 | + |
|
36 | + /** |
|
37 | + * SmartObjectController constructor. |
|
38 | + * @param $handler |
|
39 | + */ |
|
40 | + public function __construct($handler) |
|
41 | + { |
|
42 | + $this->handler = $handler; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @param $smartObj |
|
47 | + */ |
|
48 | + public function postDataToObject(&$smartObj) |
|
49 | + { |
|
50 | + foreach (array_keys($smartObj->vars) as $key) { |
|
51 | + switch ($smartObj->vars[$key]['data_type']) { |
|
52 | + case XOBJ_DTYPE_IMAGE: |
|
53 | + if (isset($_POST['url_' . $key]) && $_POST['url_' . $key] !== '') { |
|
54 | + $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
55 | + $smartObj->setVar($key, $_POST['url_' . $key]); |
|
56 | + if (file_exists($oldFile)) { |
|
57 | + unlink($oldFile); |
|
58 | + } |
|
59 | + } |
|
60 | + if (isset($_POST['delete_' . $key]) && $_POST['delete_' . $key] == '1') { |
|
61 | + $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
62 | + $smartObj->setVar($key, ''); |
|
63 | + if (file_exists($oldFile)) { |
|
64 | + unlink($oldFile); |
|
65 | + } |
|
66 | + } |
|
67 | + break; |
|
68 | + |
|
69 | + case XOBJ_DTYPE_URLLINK: |
|
70 | + $linkObj = $smartObj->getUrlLinkObj($key); |
|
71 | + $linkObj->setVar('caption', $_POST['caption_' . $key]); |
|
72 | + $linkObj->setVar('description', $_POST['desc_' . $key]); |
|
73 | + $linkObj->setVar('target', $_POST['target_' . $key]); |
|
74 | + $linkObj->setVar('url', $_POST['url_' . $key]); |
|
75 | + if ($linkObj->getVar('url') !== '') { |
|
76 | + $smartObj->storeUrlLinkObj($linkObj); |
|
77 | + } |
|
78 | + //todo: catch errors |
|
79 | + $smartObj->setVar($key, $linkObj->getVar('urllinkid')); |
|
80 | + break; |
|
81 | + |
|
82 | + case XOBJ_DTYPE_FILE: |
|
83 | + if (!isset($_FILES['upload_' . $key]['name']) || $_FILES['upload_' . $key]['name'] === '') { |
|
84 | + $fileObj = $smartObj->getFileObj($key); |
|
85 | + $fileObj->setVar('caption', $_POST['caption_' . $key]); |
|
86 | + $fileObj->setVar('description', $_POST['desc_' . $key]); |
|
87 | + $fileObj->setVar('url', $_POST['url_' . $key]); |
|
88 | + if (!($fileObj->getVar('url') === '' && $fileObj->getVar('url') === '' |
|
89 | + && $fileObj->getVar('url') === '')) { |
|
90 | + $res = $smartObj->storeFileObj($fileObj); |
|
91 | + if ($res) { |
|
92 | + $smartObj->setVar($key, $fileObj->getVar('fileid')); |
|
93 | + } else { |
|
94 | + //error setted, but no error message (to be improved) |
|
95 | + $smartObj->setErrors($fileObj->getErrors()); |
|
96 | + } |
|
97 | + } |
|
98 | + } |
|
99 | + break; |
|
100 | + |
|
101 | + case XOBJ_DTYPE_STIME: |
|
102 | + case XOBJ_DTYPE_MTIME: |
|
103 | + case XOBJ_DTYPE_LTIME: |
|
104 | + // check if this field's value is available in the POST array |
|
105 | + if (is_array($_POST[$key]) && isset($_POST[$key]['date'])) { |
|
106 | + $value = strtotime($_POST[$key]['date']) + $_POST[$key]['time']; |
|
107 | + } else { |
|
108 | + $value = strtotime($_POST[$key]); |
|
109 | + //if strtotime returns false, the value is already a time stamp |
|
110 | + if (!$value) { |
|
111 | + $value = (int)$_POST[$key]; |
|
112 | + } |
|
113 | + } |
|
114 | + $smartObj->setVar($key, $value); |
|
115 | + |
|
116 | + break; |
|
117 | + |
|
118 | + default: |
|
119 | + $smartObj->setVar($key, $_POST[$key]); |
|
120 | + break; |
|
121 | + } |
|
122 | + } |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * @param $smartObj |
|
127 | + * @param $objectid |
|
128 | + * @param $created_success_msg |
|
129 | + * @param $modified_success_msg |
|
130 | + * @param bool $redirect_page |
|
131 | + * @param bool $debug |
|
132 | + * @return mixed |
|
133 | + */ |
|
134 | + public function doStoreFromDefaultForm( |
|
135 | + &$smartObj, |
|
136 | + $objectid, |
|
137 | + $created_success_msg, |
|
138 | + $modified_success_msg, |
|
139 | + $redirect_page = false, |
|
140 | + $debug = false |
|
141 | + ) { |
|
142 | + global $smart_previous_page; |
|
143 | + |
|
144 | + $this->postDataToObject($smartObj); |
|
145 | + |
|
146 | + if ($smartObj->isNew()) { |
|
147 | + $redirect_msg = $created_success_msg; |
|
148 | + } else { |
|
149 | + $redirect_msg = $modified_success_msg; |
|
150 | + } |
|
151 | + |
|
152 | + // Check if there were uploaded files |
|
153 | + if (isset($_POST['smart_upload_image']) || isset($_POST['smart_upload_file'])) { |
|
154 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartuploader.php'; |
|
155 | + $uploaderObj = new SmartUploader($smartObj->getImageDir(true), $this->handler->_allowedMimeTypes, $this->handler->_maxFileSize, $this->handler->_maxWidth, $this->handler->_maxHeight); |
|
156 | + foreach ($_FILES as $name => $file_array) { |
|
157 | + if (isset($file_array['name']) && $file_array['name'] !== '' |
|
158 | + && in_array(str_replace('upload_', '', $name), array_keys($smartObj->vars))) { |
|
159 | + if ($uploaderObj->fetchMedia($name)) { |
|
160 | + $uploaderObj->setTargetFileName(time() . '_' . $uploaderObj->getMediaName()); |
|
161 | + if ($uploaderObj->upload()) { |
|
162 | + // Find the related field in the SmartObject |
|
163 | + $related_field = str_replace('upload_', '', $name); |
|
164 | + $uploadedArray[] = $related_field; |
|
165 | + //si c'est un fichier Rich |
|
166 | + if ($smartObj->vars[$related_field]['data_type'] === XOBJ_DTYPE_FILE) { |
|
167 | + $object_fileurl = $smartObj->getUploadDir(); |
|
168 | + $fileObj = $smartObj->getFileObj($related_field); |
|
169 | + $fileObj->setVar('url', $object_fileurl . $uploaderObj->getSavedFileName()); |
|
170 | + $fileObj->setVar('caption', $_POST['caption_' . $related_field]); |
|
171 | + $fileObj->setVar('description', $_POST['desc_' . $related_field]); |
|
172 | + $smartObj->storeFileObj($fileObj); |
|
173 | + //todo: catch errors |
|
174 | + $smartObj->setVar($related_field, $fileObj->getVar('fileid')); |
|
175 | + } else { |
|
176 | + $old_file = $smartObj->getUploadDir(true) . $smartObj->getVar($related_field); |
|
177 | + unlink($old_file); |
|
178 | + $smartObj->setVar($related_field, $uploaderObj->getSavedFileName()); |
|
179 | + } |
|
180 | + } else { |
|
181 | + $smartObj->setErrors($uploaderObj->getErrors(false)); |
|
182 | + } |
|
183 | + } else { |
|
184 | + $smartObj->setErrors($uploaderObj->getErrors(false)); |
|
185 | + } |
|
186 | + } |
|
187 | + } |
|
188 | + } |
|
189 | + |
|
190 | + if ($debug) { |
|
191 | + $storeResult = $this->handler->insertD($smartObj); |
|
192 | + } else { |
|
193 | + $storeResult = $this->handler->insert($smartObj); |
|
194 | + } |
|
195 | + |
|
196 | + if ($storeResult) { |
|
197 | + if ($this->handler->getPermissions()) { |
|
198 | + $smartPermissionsHandler = new SmartobjectPermissionHandler($this->handler); |
|
199 | + $smartPermissionsHandler->storeAllPermissionsForId($smartObj->id()); |
|
200 | + } |
|
201 | + } |
|
202 | + |
|
203 | + if ($redirect_page === null) { |
|
204 | + return $smartObj; |
|
205 | + } else { |
|
206 | + if (!$storeResult) { |
|
207 | + redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $smartObj->getHtmlErrors()); |
|
208 | + } |
|
209 | + |
|
210 | + $redirect_page = $redirect_page ?: smart_get_page_before_form(); |
|
211 | + |
|
212 | + redirect_header($redirect_page, 2, $redirect_msg); |
|
213 | + } |
|
214 | + } |
|
215 | + |
|
216 | + /** |
|
217 | + * Store the object in the database autmatically from a form sending POST data |
|
218 | + * |
|
219 | + * @param string $created_success_msg message to display if new object was created |
|
220 | + * @param string $modified_success_msg message to display if object was successfully edited |
|
221 | + * @param bool|string $redirect_page redirect page, if not set, then we backup once |
|
222 | + * @param bool $debug |
|
223 | + * @param bool $x_param |
|
224 | + * @return bool |
|
225 | + * @internal param string $created_redir_page redirect page after creating the object |
|
226 | + * @internal param string $modified_redir_page redirect page after editing the object |
|
227 | + * @internal param bool $exit if set to TRUE then the script ends |
|
228 | + */ |
|
229 | + public function storeFromDefaultForm( |
|
230 | + $created_success_msg, |
|
231 | + $modified_success_msg, |
|
232 | + $redirect_page = false, |
|
233 | + $debug = false, |
|
234 | + $x_param = false |
|
235 | + ) { |
|
236 | + $objectid = isset($_POST[$this->handler->keyName]) ? (int)$_POST[$this->handler->keyName] : 0; |
|
237 | + if ($debug) { |
|
238 | + if ($x_param) { |
|
239 | + $smartObj = $this->handler->getD($objectid, true, $x_param); |
|
240 | + } else { |
|
241 | + $smartObj = $this->handler->getD($objectid); |
|
242 | + } |
|
243 | + } else { |
|
244 | + if ($x_param) { |
|
245 | + $smartObj = $this->handler->get($objectid, true, false, false, $x_param); |
|
246 | + } else { |
|
247 | + $smartObj = $this->handler->get($objectid); |
|
248 | + } |
|
249 | + } |
|
250 | + |
|
251 | + // if handler is the Multilanguage handler, we will need to treat this for multilanguage |
|
252 | + if (is_subclass_of($this->handler, 'smartpersistablemlobjecthandler')) { |
|
253 | + if ($smartObj->isNew()) { |
|
254 | + // This is a new object. We need to store the meta data and then the language data |
|
255 | + // First, we will get rid of the multilanguage data to only store the meta data |
|
256 | + $smartObj->stripMultilanguageFields(); |
|
257 | + $newObject = $this->doStoreFromDefaultForm($smartObj, $objectid, $created_success_msg, $modified_success_msg, $redirect_page, $debug); |
|
258 | + /** |
|
259 | + * @todo we need to trap potential errors here |
|
260 | + */ |
|
261 | + |
|
262 | + // ok, the meta daa is stored. Let's recreate the object and then |
|
263 | + // get rid of anything not multilanguage |
|
264 | + unset($smartObj); |
|
265 | + $smartObj = $this->handler->get($objectid); |
|
266 | + $smartObj->stripNonMultilanguageFields(); |
|
267 | + |
|
268 | + $smartObj->setVar($this->handler->keyName, $newObject->getVar($this->handler->keyName)); |
|
269 | + $this->handler->changeTableNameForML(); |
|
270 | + $ret = $this->doStoreFromDefaultForm($smartObj, $objectid, $created_success_msg, $modified_success_msg, $redirect_page, $debug); |
|
271 | + |
|
272 | + return $ret; |
|
273 | + } |
|
274 | + } else { |
|
275 | + return $this->doStoreFromDefaultForm($smartObj, $objectid, $created_success_msg, $modified_success_msg, $redirect_page, $debug); |
|
276 | + } |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * @return bool |
|
281 | + */ |
|
282 | + public function storeSmartObjectD() |
|
283 | + { |
|
284 | + return $this->storeSmartObject(true); |
|
285 | + } |
|
286 | + |
|
287 | + /** |
|
288 | + * @param bool $debug |
|
289 | + * @param bool $xparam |
|
290 | + * @return bool |
|
291 | + */ |
|
292 | + public function storeSmartObject($debug = false, $xparam = false) |
|
293 | + { |
|
294 | + $ret = $this->storeFromDefaultForm('', '', null, $debug, $xparam); |
|
295 | + |
|
296 | + return $ret; |
|
297 | + } |
|
298 | + |
|
299 | + /** |
|
300 | + * Handles deletion of an object which keyid is passed as a GET param |
|
301 | + * |
|
302 | + * @param bool $confirm_msg |
|
303 | + * @param string $op |
|
304 | + * @param bool $userSide |
|
305 | + * @return bool |
|
306 | + * @internal param string $redir_page redirect page after deleting the object |
|
307 | + */ |
|
308 | + public function handleObjectDeletion($confirm_msg = false, $op = 'del', $userSide = false) |
|
309 | + { |
|
310 | + global $smart_previous_page; |
|
311 | + |
|
312 | + $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
313 | + $smartObj = $this->handler->get($objectid); |
|
314 | + |
|
315 | + if ($smartObj->isNew()) { |
|
316 | + redirect_header('javascript:history.go(-1)', 3, _CO_SOBJECT_NOT_SELECTED); |
|
317 | + } |
|
318 | + |
|
319 | + $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
320 | + if ($confirm) { |
|
321 | + if (!$this->handler->delete($smartObj)) { |
|
322 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
323 | + exit; |
|
324 | + } |
|
325 | + |
|
326 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS); |
|
327 | + } else { |
|
328 | + // no confirm: show deletion condition |
|
329 | + |
|
330 | + xoops_cp_header(); |
|
331 | + |
|
332 | + if (!$confirm_msg) { |
|
333 | + $confirm_msg = _CO_SOBJECT_DELETE_CONFIRM; |
|
334 | + } |
|
335 | + |
|
336 | + xoops_confirm(array( |
|
337 | + 'op' => $op, |
|
338 | + $this->handler->keyName => $smartObj->getVar($this->handler->keyName), |
|
339 | + 'confirm' => 1, |
|
340 | + 'redirect_page' => $smart_previous_page |
|
341 | + ), xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE); |
|
342 | + |
|
343 | + xoops_cp_footer(); |
|
344 | + } |
|
345 | + exit(); |
|
346 | + } |
|
347 | + |
|
348 | + /** |
|
349 | + * @param bool $confirm_msg |
|
350 | + * @param string $op |
|
351 | + */ |
|
352 | + public function handleObjectDeletionFromUserSide($confirm_msg = false, $op = 'del') |
|
353 | + { |
|
354 | + global $smart_previous_page, $xoopsTpl; |
|
355 | + |
|
356 | + $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
357 | + $smartObj = $this->handler->get($objectid); |
|
358 | + |
|
359 | + if ($smartObj->isNew()) { |
|
360 | + redirect_header('javascript:history.go(-1)', 3, _CO_SOBJECT_NOT_SELECTED); |
|
361 | + } |
|
362 | + |
|
363 | + $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
364 | + if ($confirm) { |
|
365 | + if (!$this->handler->delete($smartObj)) { |
|
366 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
367 | + exit; |
|
368 | + } |
|
369 | + |
|
370 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS); |
|
371 | + } else { |
|
372 | + // no confirm: show deletion condition |
|
373 | + if (!$confirm_msg) { |
|
374 | + $confirm_msg = _CO_SOBJECT_DELETE_CONFIRM; |
|
375 | + } |
|
376 | + |
|
377 | + ob_start(); |
|
378 | + xoops_confirm(array( |
|
379 | + 'op' => $op, |
|
380 | + $this->handler->keyName => $smartObj->getVar($this->handler->keyName), |
|
381 | + 'confirm' => 1, |
|
382 | + 'redirect_page' => $smart_previous_page |
|
383 | + ), xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE); |
|
384 | + $smartobjectDeleteConfirm = ob_get_clean(); |
|
385 | + $xoopsTpl->assign('smartobject_delete_confirm', $smartobjectDeleteConfirm); |
|
386 | + } |
|
387 | + } |
|
388 | + |
|
389 | + /** |
|
390 | + * Retreive the object admin side link for a {@link SmartObjectSingleView} page |
|
391 | + * |
|
392 | + * @param SmartObject $smartObj reference to the object from which we want the user side link |
|
393 | + * @param bool $onlyUrl wether or not to return a simple URL or a full <a> link |
|
394 | + * @param bool $withimage |
|
395 | + * @return string admin side link to the object |
|
396 | + */ |
|
397 | + public function getAdminViewItemLink(SmartObject $smartObj, $onlyUrl = false, $withimage = false) |
|
398 | + { |
|
399 | + $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=view&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
400 | + if ($onlyUrl) { |
|
401 | + return $ret; |
|
402 | + } elseif ($withimage) { |
|
403 | + return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "viewmag.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_ADMIN_VIEW . "' title='" . _CO_SOBJECT_ADMIN_VIEW . "'></a>"; |
|
404 | + } |
|
405 | + |
|
406 | + return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
407 | + } |
|
408 | + |
|
409 | + /** |
|
410 | + * Retreive the object user side link |
|
411 | + * |
|
412 | + * @param SmartObject $smartObj reference to the object from which we want the user side link |
|
413 | + * @param bool $onlyUrl wether or not to return a simple URL or a full <a> link |
|
414 | + * @return string user side link to the object |
|
415 | + */ |
|
416 | + public function getItemLink(SmartObject $smartObj, $onlyUrl = false) |
|
417 | + { |
|
418 | + $seoMode = smart_getModuleModeSEO($this->handler->_moduleName); |
|
419 | + $seoModuleName = smart_getModuleNameForSEO($this->handler->_moduleName); |
|
420 | + |
|
421 | + /** |
|
422 | + * $seoIncludeId feature is not finished yet, so let's put it always to true |
|
423 | + */ |
|
424 | + //$seoIncludeId = smart_getModuleIncludeIdSEO($this->handler->_moduleName); |
|
425 | + $seoIncludeId = true; |
|
426 | + |
|
427 | + if ($seoMode === 'rewrite') { |
|
428 | + $ret = XOOPS_URL . '/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html'; |
|
429 | + } elseif ($seoMode === 'pathinfo') { |
|
430 | + $ret = SMARTOBJECT_URL . 'seo.php/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html'; |
|
431 | + } else { |
|
432 | + $ret = $this->handler->_moduleUrl . $this->handler->_page . '?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
433 | + } |
|
434 | + |
|
435 | + if (!$onlyUrl) { |
|
436 | + $ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
437 | + } |
|
438 | + |
|
439 | + return $ret; |
|
440 | + } |
|
441 | + |
|
442 | + /** |
|
443 | + * @param $smartObj |
|
444 | + * @param bool $onlyUrl |
|
445 | + * @param bool $withimage |
|
446 | + * @return string |
|
447 | + */ |
|
448 | + public function getEditLanguageLink($smartObj, $onlyUrl = false, $withimage = true) |
|
449 | + { |
|
450 | + $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName) . '&language=' . $smartObj->getVar('language'); |
|
451 | + if ($onlyUrl) { |
|
452 | + return $ret; |
|
453 | + } elseif ($withimage) { |
|
454 | + return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "wizard.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_LANGUAGE_MODIFY . "' title='" . _CO_SOBJECT_LANGUAGE_MODIFY . "'></a>"; |
|
455 | + } |
|
456 | + |
|
457 | + return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
458 | + } |
|
459 | + |
|
460 | + /** |
|
461 | + * @param $smartObj |
|
462 | + * @param bool $onlyUrl |
|
463 | + * @param bool $withimage |
|
464 | + * @param bool $userSide |
|
465 | + * @return string |
|
466 | + */ |
|
467 | + public function getEditItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
|
468 | + { |
|
469 | + $admin_side = $userSide ? '' : 'admin/'; |
|
470 | + $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
471 | + if ($onlyUrl) { |
|
472 | + return $ret; |
|
473 | + } elseif ($withimage) { |
|
474 | + return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "edit.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_MODIFY . "' title='" . _CO_SOBJECT_MODIFY . "'></a>"; |
|
475 | + } |
|
476 | + |
|
477 | + return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
478 | + } |
|
479 | + |
|
480 | + /** |
|
481 | + * @param $smartObj |
|
482 | + * @param bool $onlyUrl |
|
483 | + * @param bool $withimage |
|
484 | + * @param bool $userSide |
|
485 | + * @return string |
|
486 | + */ |
|
487 | + public function getDeleteItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
|
488 | + { |
|
489 | + $admin_side = $userSide ? '' : 'admin/'; |
|
490 | + $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=del&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
491 | + if ($onlyUrl) { |
|
492 | + return $ret; |
|
493 | + } elseif ($withimage) { |
|
494 | + return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "editdelete.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_DELETE . "' title='" . _CO_SOBJECT_DELETE . "'></a>"; |
|
495 | + } |
|
496 | + |
|
497 | + return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
498 | + } |
|
499 | + |
|
500 | + /** |
|
501 | + * @param $smartObj |
|
502 | + * @return string |
|
503 | + */ |
|
504 | + public function getPrintAndMailLink($smartObj) |
|
505 | + { |
|
506 | + global $xoopsConfig; |
|
507 | + |
|
508 | + $printlink = $this->handler->_moduleUrl . 'print.php?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
509 | + $js = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);"; |
|
510 | + $printlink = '<a href="' . $js . '"><img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"></a>'; |
|
511 | + |
|
512 | + $smartModule = smart_getModuleInfo($smartObj->handler->_moduleName); |
|
513 | + $link = smart_getCurrentPage(); |
|
514 | + $mid = $smartModule->getVar('mid'); |
|
515 | + $friendlink = "<a href=\"javascript:openWithSelfMain('" |
|
516 | + . SMARTOBJECT_URL |
|
517 | + . 'sendlink.php?link=' |
|
518 | + . $link |
|
519 | + . '&mid=' |
|
520 | + . $mid |
|
521 | + . "', ',',',',',','sendmessage', 674, 500);\"><img src=\"" |
|
522 | + . SMARTOBJECT_IMAGES_ACTIONS_URL |
|
523 | + . "mail_send.png\" alt=\"" |
|
524 | + . _CO_SOBJECT_EMAIL |
|
525 | + . "\" title=\"" |
|
526 | + . _CO_SOBJECT_EMAIL |
|
527 | + . "\" style=\"vertical-align: middle;\"></a>"; |
|
528 | + |
|
529 | + $ret = '<span id="smartobject_print_button">' . $printlink . ' </span>' . '<span id="smartobject_mail_button">' . $friendlink . '</span>'; |
|
530 | + |
|
531 | + return $ret; |
|
532 | + } |
|
533 | + |
|
534 | + /** |
|
535 | + * @return string |
|
536 | + */ |
|
537 | + public function getModuleItemString() |
|
538 | + { |
|
539 | + $ret = $this->handler->_moduleName . '_' . $this->handler->_itemname; |
|
540 | + |
|
541 | + return $ret; |
|
542 | + } |
|
543 | 543 | } |
@@ -13,169 +13,169 @@ |
||
13 | 13 | */ |
14 | 14 | class SmartObjectsRegistry |
15 | 15 | { |
16 | - public $_registryArray; |
|
16 | + public $_registryArray; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Access the only instance of this class |
|
20 | - * |
|
21 | - * @return XoopsObject |
|
22 | - * |
|
23 | - * @static |
|
24 | - * @staticvar object |
|
25 | - */ |
|
26 | - public static function getInstance() |
|
27 | - { |
|
28 | - static $instance; |
|
29 | - if (null === $instance) { |
|
30 | - $instance = new static(); |
|
31 | - } |
|
18 | + /** |
|
19 | + * Access the only instance of this class |
|
20 | + * |
|
21 | + * @return XoopsObject |
|
22 | + * |
|
23 | + * @static |
|
24 | + * @staticvar object |
|
25 | + */ |
|
26 | + public static function getInstance() |
|
27 | + { |
|
28 | + static $instance; |
|
29 | + if (null === $instance) { |
|
30 | + $instance = new static(); |
|
31 | + } |
|
32 | 32 | |
33 | - return $instance; |
|
34 | - } |
|
33 | + return $instance; |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Adding objects to the registry |
|
38 | - * |
|
39 | - * @param SmartPersistableObjectHandler $handler of the objects to add |
|
40 | - * @param bool|CriteriaCompo $criteria to pass to the getObjects method of the handler (with id_as_key) |
|
41 | - * @return FALSE if an error occured |
|
42 | - */ |
|
43 | - public function addObjectsFromHandler(&$handler, $criteria = false) |
|
44 | - { |
|
45 | - if (method_exists($handler, 'getObjects')) { |
|
46 | - $objects = $handler->getObjects($criteria, true); |
|
47 | - $this->_registryArray['objects'][$handler->_moduleName][$handler->_itemname] = $objects; |
|
36 | + /** |
|
37 | + * Adding objects to the registry |
|
38 | + * |
|
39 | + * @param SmartPersistableObjectHandler $handler of the objects to add |
|
40 | + * @param bool|CriteriaCompo $criteria to pass to the getObjects method of the handler (with id_as_key) |
|
41 | + * @return FALSE if an error occured |
|
42 | + */ |
|
43 | + public function addObjectsFromHandler(&$handler, $criteria = false) |
|
44 | + { |
|
45 | + if (method_exists($handler, 'getObjects')) { |
|
46 | + $objects = $handler->getObjects($criteria, true); |
|
47 | + $this->_registryArray['objects'][$handler->_moduleName][$handler->_itemname] = $objects; |
|
48 | 48 | |
49 | - return $objects; |
|
50 | - } else { |
|
51 | - return false; |
|
52 | - } |
|
53 | - } |
|
49 | + return $objects; |
|
50 | + } else { |
|
51 | + return false; |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Adding objects to the registry from an item name |
|
57 | - * This method will fetch the handler of the item / module and call the addObjectsFromHandler |
|
58 | - * |
|
59 | - * @param string $item name of the item |
|
60 | - * @param bool|string $modulename name of the module |
|
61 | - * @param bool|CriteriaCompo $criteria to pass to the getObjects method of the handler (with id_as_key) |
|
62 | - * @return FALSE if an error occured |
|
63 | - */ |
|
64 | - public function addObjectsFromItemName($item, $modulename = false, $criteria = false) |
|
65 | - { |
|
66 | - if (!$modulename) { |
|
67 | - global $xoopsModule; |
|
68 | - if (!is_object($xoopsModule)) { |
|
69 | - return false; |
|
70 | - } else { |
|
71 | - $modulename = $xoopsModule->dirname(); |
|
72 | - } |
|
73 | - } |
|
74 | - $objectHandler = xoops_getModuleHandler($item, $modulename); |
|
55 | + /** |
|
56 | + * Adding objects to the registry from an item name |
|
57 | + * This method will fetch the handler of the item / module and call the addObjectsFromHandler |
|
58 | + * |
|
59 | + * @param string $item name of the item |
|
60 | + * @param bool|string $modulename name of the module |
|
61 | + * @param bool|CriteriaCompo $criteria to pass to the getObjects method of the handler (with id_as_key) |
|
62 | + * @return FALSE if an error occured |
|
63 | + */ |
|
64 | + public function addObjectsFromItemName($item, $modulename = false, $criteria = false) |
|
65 | + { |
|
66 | + if (!$modulename) { |
|
67 | + global $xoopsModule; |
|
68 | + if (!is_object($xoopsModule)) { |
|
69 | + return false; |
|
70 | + } else { |
|
71 | + $modulename = $xoopsModule->dirname(); |
|
72 | + } |
|
73 | + } |
|
74 | + $objectHandler = xoops_getModuleHandler($item, $modulename); |
|
75 | 75 | |
76 | - if (method_exists($objectHandler, 'getObjects')) { |
|
77 | - $objects = $objectHandler->getObjects($criteria, true); |
|
78 | - $this->_registryArray['objects'][$objectHandler->_moduleName][$objectHandler->_itemname] = $objects; |
|
76 | + if (method_exists($objectHandler, 'getObjects')) { |
|
77 | + $objects = $objectHandler->getObjects($criteria, true); |
|
78 | + $this->_registryArray['objects'][$objectHandler->_moduleName][$objectHandler->_itemname] = $objects; |
|
79 | 79 | |
80 | - return $objects; |
|
81 | - } else { |
|
82 | - return false; |
|
83 | - } |
|
84 | - } |
|
80 | + return $objects; |
|
81 | + } else { |
|
82 | + return false; |
|
83 | + } |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Fetching objects from the registry |
|
88 | - * |
|
89 | - * @param string $itemname |
|
90 | - * @param string $modulename |
|
91 | - * |
|
92 | - * @return the requested objects or FALSE if they don't exists in the registry |
|
93 | - */ |
|
94 | - public function getObjects($itemname, $modulename) |
|
95 | - { |
|
96 | - if (!$modulename) { |
|
97 | - global $xoopsModule; |
|
98 | - if (!is_object($xoopsModule)) { |
|
99 | - return false; |
|
100 | - } else { |
|
101 | - $modulename = $xoopsModule->dirname(); |
|
102 | - } |
|
103 | - } |
|
104 | - if (isset($this->_registryArray['objects'][$modulename][$itemname])) { |
|
105 | - return $this->_registryArray['objects'][$modulename][$itemname]; |
|
106 | - } else { |
|
107 | - // if they were not in registry, let's fetch them and add them to the reigistry |
|
108 | - $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
109 | - if (method_exists($moduleHandler, 'getObjects')) { |
|
110 | - $objects = $moduleHandler->getObjects(); |
|
111 | - } |
|
112 | - $this->_registryArray['objects'][$modulename][$itemname] = $objects; |
|
86 | + /** |
|
87 | + * Fetching objects from the registry |
|
88 | + * |
|
89 | + * @param string $itemname |
|
90 | + * @param string $modulename |
|
91 | + * |
|
92 | + * @return the requested objects or FALSE if they don't exists in the registry |
|
93 | + */ |
|
94 | + public function getObjects($itemname, $modulename) |
|
95 | + { |
|
96 | + if (!$modulename) { |
|
97 | + global $xoopsModule; |
|
98 | + if (!is_object($xoopsModule)) { |
|
99 | + return false; |
|
100 | + } else { |
|
101 | + $modulename = $xoopsModule->dirname(); |
|
102 | + } |
|
103 | + } |
|
104 | + if (isset($this->_registryArray['objects'][$modulename][$itemname])) { |
|
105 | + return $this->_registryArray['objects'][$modulename][$itemname]; |
|
106 | + } else { |
|
107 | + // if they were not in registry, let's fetch them and add them to the reigistry |
|
108 | + $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
109 | + if (method_exists($moduleHandler, 'getObjects')) { |
|
110 | + $objects = $moduleHandler->getObjects(); |
|
111 | + } |
|
112 | + $this->_registryArray['objects'][$modulename][$itemname] = $objects; |
|
113 | 113 | |
114 | - return $objects; |
|
115 | - } |
|
116 | - } |
|
114 | + return $objects; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Fetching objects from the registry, as a list: objectid => identifier |
|
120 | - * |
|
121 | - * @param string $itemname |
|
122 | - * @param string $modulename |
|
123 | - * |
|
124 | - * @return the requested objects or FALSE if they don't exists in the registry |
|
125 | - */ |
|
126 | - public function getList($itemname, $modulename) |
|
127 | - { |
|
128 | - if (!$modulename) { |
|
129 | - global $xoopsModule; |
|
130 | - if (!is_object($xoopsModule)) { |
|
131 | - return false; |
|
132 | - } else { |
|
133 | - $modulename = $xoopsModule->dirname(); |
|
134 | - } |
|
135 | - } |
|
136 | - if (isset($this->_registryArray['list'][$modulename][$itemname])) { |
|
137 | - return $this->_registryArray['list'][$modulename][$itemname]; |
|
138 | - } else { |
|
139 | - // if they were not in registry, let's fetch them and add them to the reigistry |
|
140 | - $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
141 | - if (method_exists($moduleHandler, 'getList')) { |
|
142 | - $objects = $moduleHandler->getList(); |
|
143 | - } |
|
144 | - $this->_registryArray['list'][$modulename][$itemname] = $objects; |
|
118 | + /** |
|
119 | + * Fetching objects from the registry, as a list: objectid => identifier |
|
120 | + * |
|
121 | + * @param string $itemname |
|
122 | + * @param string $modulename |
|
123 | + * |
|
124 | + * @return the requested objects or FALSE if they don't exists in the registry |
|
125 | + */ |
|
126 | + public function getList($itemname, $modulename) |
|
127 | + { |
|
128 | + if (!$modulename) { |
|
129 | + global $xoopsModule; |
|
130 | + if (!is_object($xoopsModule)) { |
|
131 | + return false; |
|
132 | + } else { |
|
133 | + $modulename = $xoopsModule->dirname(); |
|
134 | + } |
|
135 | + } |
|
136 | + if (isset($this->_registryArray['list'][$modulename][$itemname])) { |
|
137 | + return $this->_registryArray['list'][$modulename][$itemname]; |
|
138 | + } else { |
|
139 | + // if they were not in registry, let's fetch them and add them to the reigistry |
|
140 | + $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
141 | + if (method_exists($moduleHandler, 'getList')) { |
|
142 | + $objects = $moduleHandler->getList(); |
|
143 | + } |
|
144 | + $this->_registryArray['list'][$modulename][$itemname] = $objects; |
|
145 | 145 | |
146 | - return $objects; |
|
147 | - } |
|
148 | - } |
|
146 | + return $objects; |
|
147 | + } |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * Retreive a single object |
|
152 | - * |
|
153 | - * @param string $itemname |
|
154 | - * @param string $key |
|
155 | - * |
|
156 | - * @param bool $modulename |
|
157 | - * @return the requestd object or FALSE if they don't exists in the registry |
|
158 | - */ |
|
159 | - public function getSingleObject($itemname, $key, $modulename = false) |
|
160 | - { |
|
161 | - if (!$modulename) { |
|
162 | - global $xoopsModule; |
|
163 | - if (!is_object($xoopsModule)) { |
|
164 | - return false; |
|
165 | - } else { |
|
166 | - $modulename = $xoopsModule->dirname(); |
|
167 | - } |
|
168 | - } |
|
169 | - if (isset($this->_registryArray['objects'][$modulename][$itemname][$key])) { |
|
170 | - return $this->_registryArray['objects'][$modulename][$itemname][$key]; |
|
171 | - } else { |
|
172 | - $objectHandler = xoops_getModuleHandler($itemname, $modulename); |
|
173 | - $object = $objectHandler->get($key); |
|
174 | - if (!$object->isNew()) { |
|
175 | - return $object; |
|
176 | - } else { |
|
177 | - return false; |
|
178 | - } |
|
179 | - } |
|
180 | - } |
|
150 | + /** |
|
151 | + * Retreive a single object |
|
152 | + * |
|
153 | + * @param string $itemname |
|
154 | + * @param string $key |
|
155 | + * |
|
156 | + * @param bool $modulename |
|
157 | + * @return the requestd object or FALSE if they don't exists in the registry |
|
158 | + */ |
|
159 | + public function getSingleObject($itemname, $key, $modulename = false) |
|
160 | + { |
|
161 | + if (!$modulename) { |
|
162 | + global $xoopsModule; |
|
163 | + if (!is_object($xoopsModule)) { |
|
164 | + return false; |
|
165 | + } else { |
|
166 | + $modulename = $xoopsModule->dirname(); |
|
167 | + } |
|
168 | + } |
|
169 | + if (isset($this->_registryArray['objects'][$modulename][$itemname][$key])) { |
|
170 | + return $this->_registryArray['objects'][$modulename][$itemname][$key]; |
|
171 | + } else { |
|
172 | + $objectHandler = xoops_getModuleHandler($itemname, $modulename); |
|
173 | + $object = $objectHandler->get($key); |
|
174 | + if (!$object->isNew()) { |
|
175 | + return $object; |
|
176 | + } else { |
|
177 | + return false; |
|
178 | + } |
|
179 | + } |
|
180 | + } |
|
181 | 181 | } |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | */ |
9 | 9 | function smartobject_addto_show($options) |
10 | 10 | { |
11 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
12 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartaddto.php'; |
|
13 | - $smartaddto = new SmartAddTo($options[0]); |
|
14 | - $block = $smartaddto->renderForBlock(); |
|
11 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
12 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartaddto.php'; |
|
13 | + $smartaddto = new SmartAddTo($options[0]); |
|
14 | + $block = $smartaddto->renderForBlock(); |
|
15 | 15 | |
16 | - return $block; |
|
16 | + return $block; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function smartobject_addto_edit($options) |
24 | 24 | { |
25 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
25 | + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
26 | 26 | |
27 | - $form = ''; |
|
27 | + $form = ''; |
|
28 | 28 | |
29 | - $layout_select = new XoopsFormSelect(_MB_SOBJECT_BLOCKS_ADDTO_LAYOUT, 'options[]', $options[0]); |
|
30 | - $layout_select->addOption(0, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION0); |
|
31 | - $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1); |
|
32 | - $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2); |
|
33 | - $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3); |
|
34 | - $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>'; |
|
29 | + $layout_select = new XoopsFormSelect(_MB_SOBJECT_BLOCKS_ADDTO_LAYOUT, 'options[]', $options[0]); |
|
30 | + $layout_select->addOption(0, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION0); |
|
31 | + $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1); |
|
32 | + $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2); |
|
33 | + $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3); |
|
34 | + $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>'; |
|
35 | 35 | |
36 | - return $form; |
|
36 | + return $form; |
|
37 | 37 | } |
@@ -26,82 +26,82 @@ |
||
26 | 26 | $op = isset($_POST['op']) ? $_POST['op'] : ''; |
27 | 27 | |
28 | 28 | switch ($op) { |
29 | - case 'sendlink': |
|
30 | - |
|
31 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
32 | - $controller = new SmartObjectController($smartobjectLinkHandler); |
|
33 | - |
|
34 | - $linkObj = $controller->storeSmartObject(); |
|
35 | - if ($linkObj->hasError()) { |
|
36 | - /** |
|
37 | - * @todo inform user and propose to close the window if a problem occured when saving the link |
|
38 | - */ |
|
39 | - } |
|
40 | - |
|
41 | - $xoopsMailer = xoops_getMailer(); |
|
42 | - $xoopsMailer->useMail(); |
|
43 | - $xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template'); |
|
44 | - |
|
45 | - $xoopsMailer->setTemplate('sendlink.tpl'); |
|
46 | - $xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']); |
|
47 | - $xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name')); |
|
48 | - $xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name')); |
|
49 | - $xoopsMailer->assign('SITEURL', XOOPS_URL . '/'); |
|
50 | - $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']); |
|
51 | - $xoopsMailer->assign('MESSAGE', $_POST['body']); |
|
52 | - $xoopsMailer->setToEmails($linkObj->getVar('to_email')); |
|
53 | - $xoopsMailer->setFromEmail($linkObj->getVar('from_email')); |
|
54 | - $xoopsMailer->setFromName($xoopsConfig['sitename']); |
|
55 | - $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename']))); |
|
56 | - |
|
57 | - if (!$xoopsMailer->send(true)) { |
|
58 | - $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true)); |
|
59 | - } else { |
|
60 | - $xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS); |
|
61 | - } |
|
62 | - |
|
63 | - break; |
|
64 | - |
|
65 | - default: |
|
66 | - if (isset($_GET['mid'])) { |
|
67 | - $mid = $_GET['mid']; |
|
68 | - } else { |
|
69 | - /** |
|
70 | - * @todo close the window if no mid is passed as GET |
|
71 | - */ |
|
72 | - } |
|
73 | - |
|
74 | - $hModule = xoops_getHandler('module'); |
|
75 | - $module = $hModule->get($mid); |
|
76 | - $linkObj->setVar('mid', $module->getVar('mid')); |
|
77 | - $linkObj->setVar('mid_name', $module->getVar('name')); |
|
78 | - |
|
79 | - if (isset($_GET['link'])) { |
|
80 | - $link = $_GET['link']; |
|
81 | - } else { |
|
82 | - /** |
|
83 | - * @todo close the window if no link is passed as GET |
|
84 | - */ |
|
85 | - } |
|
86 | - $linkObj->setVar('link', $link); |
|
87 | - |
|
88 | - if (is_object($xoopsUser)) { |
|
89 | - $linkObj->setVar('from_uid', $xoopsUser->getVar('uid')); |
|
90 | - $linkObj->setVar('from_name', $xoopsUser->getVar('name') !== '' ? $xoopsUser->getVar('name') : $xoopsUser->getVar('uname')); |
|
91 | - $linkObj->setVar('from_email', $xoopsUser->getVar('email')); |
|
92 | - } |
|
93 | - |
|
94 | - $linkObj->setVar('subject', sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $xoopsConfig['sitename'])); |
|
95 | - $linkObj->setVar('body', sprintf(_CO_SOBJECT_BODY_DEFAULT, $xoopsConfig['sitename'], $link)); |
|
96 | - $linkObj->setVar('date', time()); |
|
97 | - $linkObj->hideFieldFromForm(array('from_uid', 'to_uid', 'link', 'mid', 'mid_name')); |
|
98 | - |
|
99 | - $form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND, 'javascript:window.close();'); |
|
100 | - |
|
101 | - $form->assign($xoopsTpl); |
|
102 | - |
|
103 | - $xoopsTpl->assign('showform', true); |
|
104 | - break; |
|
29 | + case 'sendlink': |
|
30 | + |
|
31 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
32 | + $controller = new SmartObjectController($smartobjectLinkHandler); |
|
33 | + |
|
34 | + $linkObj = $controller->storeSmartObject(); |
|
35 | + if ($linkObj->hasError()) { |
|
36 | + /** |
|
37 | + * @todo inform user and propose to close the window if a problem occured when saving the link |
|
38 | + */ |
|
39 | + } |
|
40 | + |
|
41 | + $xoopsMailer = xoops_getMailer(); |
|
42 | + $xoopsMailer->useMail(); |
|
43 | + $xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template'); |
|
44 | + |
|
45 | + $xoopsMailer->setTemplate('sendlink.tpl'); |
|
46 | + $xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']); |
|
47 | + $xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name')); |
|
48 | + $xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name')); |
|
49 | + $xoopsMailer->assign('SITEURL', XOOPS_URL . '/'); |
|
50 | + $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']); |
|
51 | + $xoopsMailer->assign('MESSAGE', $_POST['body']); |
|
52 | + $xoopsMailer->setToEmails($linkObj->getVar('to_email')); |
|
53 | + $xoopsMailer->setFromEmail($linkObj->getVar('from_email')); |
|
54 | + $xoopsMailer->setFromName($xoopsConfig['sitename']); |
|
55 | + $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename']))); |
|
56 | + |
|
57 | + if (!$xoopsMailer->send(true)) { |
|
58 | + $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true)); |
|
59 | + } else { |
|
60 | + $xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS); |
|
61 | + } |
|
62 | + |
|
63 | + break; |
|
64 | + |
|
65 | + default: |
|
66 | + if (isset($_GET['mid'])) { |
|
67 | + $mid = $_GET['mid']; |
|
68 | + } else { |
|
69 | + /** |
|
70 | + * @todo close the window if no mid is passed as GET |
|
71 | + */ |
|
72 | + } |
|
73 | + |
|
74 | + $hModule = xoops_getHandler('module'); |
|
75 | + $module = $hModule->get($mid); |
|
76 | + $linkObj->setVar('mid', $module->getVar('mid')); |
|
77 | + $linkObj->setVar('mid_name', $module->getVar('name')); |
|
78 | + |
|
79 | + if (isset($_GET['link'])) { |
|
80 | + $link = $_GET['link']; |
|
81 | + } else { |
|
82 | + /** |
|
83 | + * @todo close the window if no link is passed as GET |
|
84 | + */ |
|
85 | + } |
|
86 | + $linkObj->setVar('link', $link); |
|
87 | + |
|
88 | + if (is_object($xoopsUser)) { |
|
89 | + $linkObj->setVar('from_uid', $xoopsUser->getVar('uid')); |
|
90 | + $linkObj->setVar('from_name', $xoopsUser->getVar('name') !== '' ? $xoopsUser->getVar('name') : $xoopsUser->getVar('uname')); |
|
91 | + $linkObj->setVar('from_email', $xoopsUser->getVar('email')); |
|
92 | + } |
|
93 | + |
|
94 | + $linkObj->setVar('subject', sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $xoopsConfig['sitename'])); |
|
95 | + $linkObj->setVar('body', sprintf(_CO_SOBJECT_BODY_DEFAULT, $xoopsConfig['sitename'], $link)); |
|
96 | + $linkObj->setVar('date', time()); |
|
97 | + $linkObj->hideFieldFromForm(array('from_uid', 'to_uid', 'link', 'mid', 'mid_name')); |
|
98 | + |
|
99 | + $form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND, 'javascript:window.close();'); |
|
100 | + |
|
101 | + $form->assign($xoopsTpl); |
|
102 | + |
|
103 | + $xoopsTpl->assign('showform', true); |
|
104 | + break; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $xoopsTpl->display('db:smartobject_sendlink.tpl'); |
@@ -12,32 +12,32 @@ discard block |
||
12 | 12 | |
13 | 13 | function editclass($showmenu = false, $adsenseid = 0, $clone = false) |
14 | 14 | { |
15 | - global $smartobjectAdsenseHandler; |
|
16 | - |
|
17 | - $adsenseObj = $smartobjectAdsenseHandler->get($adsenseid); |
|
18 | - |
|
19 | - if (!$clone && !$adsenseObj->isNew()) { |
|
20 | - if ($showmenu) { |
|
21 | - //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING); |
|
22 | - } |
|
23 | - smart_collapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO); |
|
24 | - |
|
25 | - $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense'); |
|
26 | - $sform->display(); |
|
27 | - smart_close_collapsable('adsenseedit'); |
|
28 | - } else { |
|
29 | - $adsenseObj->setVar('adsenseid', 0); |
|
30 | - $adsenseObj->setVar('tag', ''); |
|
31 | - |
|
32 | - if ($showmenu) { |
|
33 | - //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
34 | - } |
|
35 | - |
|
36 | - smart_collapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO); |
|
37 | - $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true); |
|
38 | - $sform->display(); |
|
39 | - smart_close_collapsable('adsensecreate'); |
|
40 | - } |
|
15 | + global $smartobjectAdsenseHandler; |
|
16 | + |
|
17 | + $adsenseObj = $smartobjectAdsenseHandler->get($adsenseid); |
|
18 | + |
|
19 | + if (!$clone && !$adsenseObj->isNew()) { |
|
20 | + if ($showmenu) { |
|
21 | + //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING); |
|
22 | + } |
|
23 | + smart_collapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO); |
|
24 | + |
|
25 | + $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense'); |
|
26 | + $sform->display(); |
|
27 | + smart_close_collapsable('adsenseedit'); |
|
28 | + } else { |
|
29 | + $adsenseObj->setVar('adsenseid', 0); |
|
30 | + $adsenseObj->setVar('tag', ''); |
|
31 | + |
|
32 | + if ($showmenu) { |
|
33 | + //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
34 | + } |
|
35 | + |
|
36 | + smart_collapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO); |
|
37 | + $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true); |
|
38 | + $sform->display(); |
|
39 | + smart_close_collapsable('adsensecreate'); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | require_once __DIR__ . '/admin_header.php'; |
@@ -50,73 +50,73 @@ discard block |
||
50 | 50 | $op = ''; |
51 | 51 | |
52 | 52 | if (isset($_GET['op'])) { |
53 | - $op = $_GET['op']; |
|
53 | + $op = $_GET['op']; |
|
54 | 54 | } |
55 | 55 | if (isset($_POST['op'])) { |
56 | - $op = $_POST['op']; |
|
56 | + $op = $_POST['op']; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | switch ($op) { |
60 | - case 'mod': |
|
60 | + case 'mod': |
|
61 | 61 | |
62 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
62 | + $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
63 | 63 | |
64 | - smart_xoops_cp_header(); |
|
65 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
64 | + smart_xoops_cp_header(); |
|
65 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
66 | 66 | |
67 | - editclass(true, $adsenseid); |
|
68 | - break; |
|
67 | + editclass(true, $adsenseid); |
|
68 | + break; |
|
69 | 69 | |
70 | - case 'clone': |
|
70 | + case 'clone': |
|
71 | 71 | |
72 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
72 | + $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
73 | 73 | |
74 | - smart_xoops_cp_header(); |
|
75 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
74 | + smart_xoops_cp_header(); |
|
75 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
76 | 76 | |
77 | - editclass(true, $adsenseid, true); |
|
78 | - break; |
|
77 | + editclass(true, $adsenseid, true); |
|
78 | + break; |
|
79 | 79 | |
80 | - case 'addadsense': |
|
81 | - if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') { |
|
82 | - $xoopsCaptcha = XoopsCaptcha::getInstance(); |
|
83 | - if (!$xoopsCaptcha->verify()) { |
|
84 | - redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage()); |
|
85 | - exit; |
|
86 | - } |
|
87 | - } |
|
88 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
89 | - $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
90 | - $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED); |
|
91 | - break; |
|
80 | + case 'addadsense': |
|
81 | + if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') { |
|
82 | + $xoopsCaptcha = XoopsCaptcha::getInstance(); |
|
83 | + if (!$xoopsCaptcha->verify()) { |
|
84 | + redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage()); |
|
85 | + exit; |
|
86 | + } |
|
87 | + } |
|
88 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
89 | + $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
90 | + $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED); |
|
91 | + break; |
|
92 | 92 | |
93 | - case 'del': |
|
93 | + case 'del': |
|
94 | 94 | |
95 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
96 | - $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
97 | - $controller->handleObjectDeletion(); |
|
95 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
96 | + $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
97 | + $controller->handleObjectDeletion(); |
|
98 | 98 | |
99 | - break; |
|
99 | + break; |
|
100 | 100 | |
101 | - default: |
|
101 | + default: |
|
102 | 102 | |
103 | - smart_xoops_cp_header(); |
|
104 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
103 | + smart_xoops_cp_header(); |
|
104 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
105 | 105 | |
106 | - //smart_adminMenu(3, _AM_SOBJECT_ADSENSES); |
|
106 | + //smart_adminMenu(3, _AM_SOBJECT_ADSENSES); |
|
107 | 107 | |
108 | - smart_collapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC); |
|
108 | + smart_collapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC); |
|
109 | 109 | |
110 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | - $objectTable = new SmartObjectTable($smartobjectAdsenseHandler); |
|
112 | - $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
113 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode')); |
|
110 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | + $objectTable = new SmartObjectTable($smartobjectAdsenseHandler); |
|
112 | + $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
113 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode')); |
|
114 | 114 | |
115 | - // $objectTable->addCustomAction('getCreateItemLink'); |
|
116 | - // $objectTable->addCustomAction('getCreateAttributLink'); |
|
115 | + // $objectTable->addCustomAction('getCreateItemLink'); |
|
116 | + // $objectTable->addCustomAction('getCreateAttributLink'); |
|
117 | 117 | |
118 | - $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE); |
|
119 | - /* |
|
118 | + $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE); |
|
119 | + /* |
|
120 | 120 | $criteria_upcoming = new CriteriaCompo(); |
121 | 121 | $criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
122 | 122 | $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | 'criteria' => $criteria_last30days |
141 | 141 | )); |
142 | 142 | */ |
143 | - $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
144 | - $objectTable->addCustomAction('getCloneLink'); |
|
143 | + $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
144 | + $objectTable->addCustomAction('getCloneLink'); |
|
145 | 145 | |
146 | - $objectTable->render(); |
|
146 | + $objectTable->render(); |
|
147 | 147 | |
148 | - echo '<br>'; |
|
149 | - smart_close_collapsable('createdadsenses'); |
|
150 | - echo '<br>'; |
|
148 | + echo '<br>'; |
|
149 | + smart_close_collapsable('createdadsenses'); |
|
150 | + echo '<br>'; |
|
151 | 151 | |
152 | - break; |
|
152 | + break; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | //smart_modFooter(); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
11 | 11 | } else { |
12 | - $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
12 | + $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
13 | 13 | } |
14 | 14 | $adminObject = \Xmf\Module\Admin::getInstance(); |
15 | 15 | |
@@ -54,43 +54,43 @@ discard block |
||
54 | 54 | //--------------------------------- |
55 | 55 | |
56 | 56 | if (!defined('SMARTOBJECT_ROOT_PATH')) { |
57 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
|
57 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $smartobjectConfig = smart_getModuleConfig('smartobject'); |
61 | 61 | |
62 | 62 | if (isset($smartobjectConfig['enable_currencyman']) && $smartobjectConfig['enable_currencyman'] === true) { |
63 | - ++$i; |
|
64 | - $adminmenu[$i]['title'] = _MI_SOBJECT_CURRENCIES; |
|
65 | - $adminmenu[$i]['link'] = 'admin/currency.php'; |
|
66 | - $adminmenu[$i]['icon'] = $pathIcon32 . '/cash_stack.png'; |
|
63 | + ++$i; |
|
64 | + $adminmenu[$i]['title'] = _MI_SOBJECT_CURRENCIES; |
|
65 | + $adminmenu[$i]['link'] = 'admin/currency.php'; |
|
66 | + $adminmenu[$i]['icon'] = $pathIcon32 . '/cash_stack.png'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | global $xoopsModule; |
70 | 70 | if (isset($xoopsModule)) { |
71 | - // $i = -1; |
|
72 | - |
|
73 | - // --- for XCL --- |
|
74 | - // $headermenu[$i]['link'] = '../../system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'); |
|
75 | - $mid = $xoopsModule->getVar('mid'); |
|
76 | - if (defined('XOOPS_CUBE_LEGACY')) { |
|
77 | - $link_pref = XOOPS_URL . '/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id=' . $mid; |
|
78 | - } else { |
|
79 | - $link_pref = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mid; |
|
80 | - } |
|
81 | - $headermenu[$i]['link'] = $link_pref; |
|
82 | - // ----- |
|
83 | - |
|
84 | - // --- for XCL --- |
|
85 | - // $headermenu[$i]['link'] = XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoopsModule->getVar('dirname'); |
|
86 | - $dirname = $xoopsModule->getVar('dirname'); |
|
87 | - if (defined('XOOPS_CUBE_LEGACY')) { |
|
88 | - $link_module = XOOPS_URL . '/modules/legacy/admin/index.php?action=ModuleUpdate&dirname=' . $dirname; |
|
89 | - } else { |
|
90 | - $link_module = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $dirname; |
|
91 | - } |
|
92 | - $headermenu[$i]['link'] = $link_module; |
|
93 | - // ----- |
|
94 | - |
|
95 | - ++$i; |
|
71 | + // $i = -1; |
|
72 | + |
|
73 | + // --- for XCL --- |
|
74 | + // $headermenu[$i]['link'] = '../../system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'); |
|
75 | + $mid = $xoopsModule->getVar('mid'); |
|
76 | + if (defined('XOOPS_CUBE_LEGACY')) { |
|
77 | + $link_pref = XOOPS_URL . '/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id=' . $mid; |
|
78 | + } else { |
|
79 | + $link_pref = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mid; |
|
80 | + } |
|
81 | + $headermenu[$i]['link'] = $link_pref; |
|
82 | + // ----- |
|
83 | + |
|
84 | + // --- for XCL --- |
|
85 | + // $headermenu[$i]['link'] = XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoopsModule->getVar('dirname'); |
|
86 | + $dirname = $xoopsModule->getVar('dirname'); |
|
87 | + if (defined('XOOPS_CUBE_LEGACY')) { |
|
88 | + $link_module = XOOPS_URL . '/modules/legacy/admin/index.php?action=ModuleUpdate&dirname=' . $dirname; |
|
89 | + } else { |
|
90 | + $link_module = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $dirname; |
|
91 | + } |
|
92 | + $headermenu[$i]['link'] = $link_module; |
|
93 | + // ----- |
|
94 | + |
|
95 | + ++$i; |
|
96 | 96 | } |
@@ -10,29 +10,29 @@ discard block |
||
10 | 10 | |
11 | 11 | function editclass($showmenu = false, $currencyid = 0) |
12 | 12 | { |
13 | - global $smartobjectCurrencyHandler; |
|
14 | - |
|
15 | - $currencyObj = $smartobjectCurrencyHandler->get($currencyid); |
|
16 | - |
|
17 | - if (!$currencyObj->isNew()) { |
|
18 | - if ($showmenu) { |
|
19 | - //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING); |
|
20 | - } |
|
21 | - smart_collapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO); |
|
22 | - |
|
23 | - $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency'); |
|
24 | - $sform->display(); |
|
25 | - smart_close_collapsable('currencyedit'); |
|
26 | - } else { |
|
27 | - if ($showmenu) { |
|
28 | - //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
29 | - } |
|
30 | - |
|
31 | - smart_collapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO); |
|
32 | - $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency'); |
|
33 | - $sform->display(); |
|
34 | - smart_close_collapsable('currencycreate'); |
|
35 | - } |
|
13 | + global $smartobjectCurrencyHandler; |
|
14 | + |
|
15 | + $currencyObj = $smartobjectCurrencyHandler->get($currencyid); |
|
16 | + |
|
17 | + if (!$currencyObj->isNew()) { |
|
18 | + if ($showmenu) { |
|
19 | + //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING); |
|
20 | + } |
|
21 | + smart_collapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO); |
|
22 | + |
|
23 | + $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency'); |
|
24 | + $sform->display(); |
|
25 | + smart_close_collapsable('currencyedit'); |
|
26 | + } else { |
|
27 | + if ($showmenu) { |
|
28 | + //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
29 | + } |
|
30 | + |
|
31 | + smart_collapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO); |
|
32 | + $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency'); |
|
33 | + $sform->display(); |
|
34 | + smart_close_collapsable('currencycreate'); |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | require_once __DIR__ . '/admin_header.php'; |
@@ -43,36 +43,36 @@ discard block |
||
43 | 43 | $op = ''; |
44 | 44 | |
45 | 45 | if (isset($_GET['op'])) { |
46 | - $op = $_GET['op']; |
|
46 | + $op = $_GET['op']; |
|
47 | 47 | } |
48 | 48 | if (isset($_POST['op'])) { |
49 | - $op = $_POST['op']; |
|
49 | + $op = $_POST['op']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | switch ($op) { |
53 | - case 'mod': |
|
54 | - $currencyid = isset($_GET['currencyid']) ? (int)$_GET['currencyid'] : 0; |
|
53 | + case 'mod': |
|
54 | + $currencyid = isset($_GET['currencyid']) ? (int)$_GET['currencyid'] : 0; |
|
55 | 55 | |
56 | - smart_xoops_cp_header(); |
|
56 | + smart_xoops_cp_header(); |
|
57 | 57 | |
58 | - editclass(true, $currencyid); |
|
59 | - break; |
|
58 | + editclass(true, $currencyid); |
|
59 | + break; |
|
60 | 60 | |
61 | - case 'updateCurrencies': |
|
61 | + case 'updateCurrencies': |
|
62 | 62 | |
63 | - if (!isset($_POST['SmartobjectCurrency_objects']) || count($_POST['SmartobjectCurrency_objects']) == 0) { |
|
64 | - redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE); |
|
65 | - } |
|
63 | + if (!isset($_POST['SmartobjectCurrency_objects']) || count($_POST['SmartobjectCurrency_objects']) == 0) { |
|
64 | + redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE); |
|
65 | + } |
|
66 | 66 | |
67 | - if (isset($_POST['default_currency'])) { |
|
68 | - $newDefaultCurrency = $_POST['default_currency']; |
|
69 | - $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
70 | - $smartobjectCurrencyHandler->query($sql); |
|
71 | - $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency; |
|
72 | - $smartobjectCurrencyHandler->query($sql); |
|
73 | - } |
|
67 | + if (isset($_POST['default_currency'])) { |
|
68 | + $newDefaultCurrency = $_POST['default_currency']; |
|
69 | + $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
70 | + $smartobjectCurrencyHandler->query($sql); |
|
71 | + $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency; |
|
72 | + $smartobjectCurrencyHandler->query($sql); |
|
73 | + } |
|
74 | 74 | |
75 | - /* |
|
75 | + /* |
|
76 | 76 | $criteria = new CriteriaCompo(); |
77 | 77 | $criteria->add(new Criteria('currencyid', '(' . implode(', ', $_POST['SmartobjectCurrency_objects']) . ')', 'IN')); |
78 | 78 | $currenciesObj = $smartobjectCurrencyHandler->getObjects($criteria, true); |
@@ -82,49 +82,49 @@ discard block |
||
82 | 82 | $smartobjectCurrencyHandler->insert($currencyObj); |
83 | 83 | } |
84 | 84 | */ |
85 | - redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED); |
|
86 | - break; |
|
85 | + redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED); |
|
86 | + break; |
|
87 | 87 | |
88 | - case 'addcurrency': |
|
89 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | - $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
91 | - $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php'); |
|
88 | + case 'addcurrency': |
|
89 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | + $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
91 | + $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php'); |
|
92 | 92 | |
93 | - break; |
|
93 | + break; |
|
94 | 94 | |
95 | - case 'del': |
|
96 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
97 | - $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
98 | - $controller->handleObjectDeletion(); |
|
95 | + case 'del': |
|
96 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
97 | + $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
98 | + $controller->handleObjectDeletion(); |
|
99 | 99 | |
100 | - break; |
|
100 | + break; |
|
101 | 101 | |
102 | - default: |
|
102 | + default: |
|
103 | 103 | |
104 | - smart_xoops_cp_header(); |
|
104 | + smart_xoops_cp_header(); |
|
105 | 105 | |
106 | - //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES); |
|
106 | + //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES); |
|
107 | 107 | |
108 | - smart_collapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC); |
|
108 | + smart_collapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC); |
|
109 | 109 | |
110 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | - $objectTable = new SmartObjectTable($smartobjectCurrencyHandler); |
|
112 | - $objectTable->addColumn(new SmartObjectColumn('name', 'left', false, 'getCurrencyLink')); |
|
113 | - $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 150)); |
|
114 | - $objectTable->addColumn(new SmartObjectColumn('iso4217', 'center', 150)); |
|
115 | - $objectTable->addColumn(new SmartObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl')); |
|
110 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | + $objectTable = new SmartObjectTable($smartobjectCurrencyHandler); |
|
112 | + $objectTable->addColumn(new SmartObjectColumn('name', 'left', false, 'getCurrencyLink')); |
|
113 | + $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 150)); |
|
114 | + $objectTable->addColumn(new SmartObjectColumn('iso4217', 'center', 150)); |
|
115 | + $objectTable->addColumn(new SmartObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl')); |
|
116 | 116 | |
117 | - $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE); |
|
117 | + $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE); |
|
118 | 118 | |
119 | - $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL); |
|
119 | + $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL); |
|
120 | 120 | |
121 | - $objectTable->render(); |
|
121 | + $objectTable->render(); |
|
122 | 122 | |
123 | - echo '<br>'; |
|
124 | - smart_close_collapsable('createdcurrencies'); |
|
125 | - echo '<br>'; |
|
123 | + echo '<br>'; |
|
124 | + smart_close_collapsable('createdcurrencies'); |
|
125 | + echo '<br>'; |
|
126 | 126 | |
127 | - break; |
|
127 | + break; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | //smart_modFooter(); |
@@ -12,32 +12,32 @@ discard block |
||
12 | 12 | |
13 | 13 | function editcustomtag($showmenu = false, $customtagid = 0, $clone = false) |
14 | 14 | { |
15 | - global $smartobjectCustomtagHandler; |
|
16 | - |
|
17 | - $customtagObj = $smartobjectCustomtagHandler->get($customtagid); |
|
18 | - |
|
19 | - if (!$clone && !$customtagObj->isNew()) { |
|
20 | - if ($showmenu) { |
|
21 | - //smart_adminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _AM_SOBJECT_EDITING); |
|
22 | - } |
|
23 | - smart_collapsableBar('customtagedit', _AM_SOBJECT_CUSTOMTAGS_EDIT, _AM_SOBJECT_CUSTOMTAGS_EDIT_INFO); |
|
24 | - |
|
25 | - $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_EDIT, 'addcustomtag'); |
|
26 | - $sform->display(); |
|
27 | - smart_close_collapsable('customtagedit'); |
|
28 | - } else { |
|
29 | - $customtagObj->setVar('customtagid', 0); |
|
30 | - $customtagObj->setVar('tag', ''); |
|
31 | - |
|
32 | - if ($showmenu) { |
|
33 | - //smart_adminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _CO_SOBJECT_CREATINGNEW); |
|
34 | - } |
|
35 | - |
|
36 | - smart_collapsableBar('customtagcreate', _AM_SOBJECT_CUSTOMTAGS_CREATE, _AM_SOBJECT_CUSTOMTAGS_CREATE_INFO); |
|
37 | - $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'addcustomtag'); |
|
38 | - $sform->display(); |
|
39 | - smart_close_collapsable('customtagcreate'); |
|
40 | - } |
|
15 | + global $smartobjectCustomtagHandler; |
|
16 | + |
|
17 | + $customtagObj = $smartobjectCustomtagHandler->get($customtagid); |
|
18 | + |
|
19 | + if (!$clone && !$customtagObj->isNew()) { |
|
20 | + if ($showmenu) { |
|
21 | + //smart_adminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _AM_SOBJECT_EDITING); |
|
22 | + } |
|
23 | + smart_collapsableBar('customtagedit', _AM_SOBJECT_CUSTOMTAGS_EDIT, _AM_SOBJECT_CUSTOMTAGS_EDIT_INFO); |
|
24 | + |
|
25 | + $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_EDIT, 'addcustomtag'); |
|
26 | + $sform->display(); |
|
27 | + smart_close_collapsable('customtagedit'); |
|
28 | + } else { |
|
29 | + $customtagObj->setVar('customtagid', 0); |
|
30 | + $customtagObj->setVar('tag', ''); |
|
31 | + |
|
32 | + if ($showmenu) { |
|
33 | + //smart_adminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _CO_SOBJECT_CREATINGNEW); |
|
34 | + } |
|
35 | + |
|
36 | + smart_collapsableBar('customtagcreate', _AM_SOBJECT_CUSTOMTAGS_CREATE, _AM_SOBJECT_CUSTOMTAGS_CREATE_INFO); |
|
37 | + $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'addcustomtag'); |
|
38 | + $sform->display(); |
|
39 | + smart_close_collapsable('customtagcreate'); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | require_once __DIR__ . '/admin_header.php'; |
@@ -52,70 +52,70 @@ discard block |
||
52 | 52 | $op = ''; |
53 | 53 | |
54 | 54 | if (isset($_GET['op'])) { |
55 | - $op = $_GET['op']; |
|
55 | + $op = $_GET['op']; |
|
56 | 56 | } |
57 | 57 | if (isset($_POST['op'])) { |
58 | - $op = $_POST['op']; |
|
58 | + $op = $_POST['op']; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | switch ($op) { |
62 | - case 'mod': |
|
62 | + case 'mod': |
|
63 | 63 | |
64 | - $customtagid = isset($_GET['customtagid']) ? (int)$_GET['customtagid'] : 0; |
|
64 | + $customtagid = isset($_GET['customtagid']) ? (int)$_GET['customtagid'] : 0; |
|
65 | 65 | |
66 | - smart_xoops_cp_header(); |
|
67 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
66 | + smart_xoops_cp_header(); |
|
67 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
68 | 68 | |
69 | - editcustomtag(true, $customtagid); |
|
70 | - break; |
|
69 | + editcustomtag(true, $customtagid); |
|
70 | + break; |
|
71 | 71 | |
72 | - case 'clone': |
|
72 | + case 'clone': |
|
73 | 73 | |
74 | - $customtagid = isset($_GET['customtagid']) ? (int)$_GET['customtagid'] : 0; |
|
74 | + $customtagid = isset($_GET['customtagid']) ? (int)$_GET['customtagid'] : 0; |
|
75 | 75 | |
76 | - smart_xoops_cp_header(); |
|
77 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
76 | + smart_xoops_cp_header(); |
|
77 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
78 | 78 | |
79 | - editcustomtag(true, $customtagid, true); |
|
80 | - break; |
|
79 | + editcustomtag(true, $customtagid, true); |
|
80 | + break; |
|
81 | 81 | |
82 | - case 'addcustomtag': |
|
83 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
84 | - $controller = new SmartObjectController($smartobjectCustomtagHandler); |
|
85 | - $controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED); |
|
86 | - break; |
|
82 | + case 'addcustomtag': |
|
83 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
84 | + $controller = new SmartObjectController($smartobjectCustomtagHandler); |
|
85 | + $controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED); |
|
86 | + break; |
|
87 | 87 | |
88 | - case 'del': |
|
88 | + case 'del': |
|
89 | 89 | |
90 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
91 | - $controller = new SmartObjectController($smartobjectCustomtagHandler); |
|
92 | - $controller->handleObjectDeletion(); |
|
90 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
91 | + $controller = new SmartObjectController($smartobjectCustomtagHandler); |
|
92 | + $controller->handleObjectDeletion(); |
|
93 | 93 | |
94 | - break; |
|
94 | + break; |
|
95 | 95 | |
96 | - default: |
|
96 | + default: |
|
97 | 97 | |
98 | - smart_xoops_cp_header(); |
|
99 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
100 | - $adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', ''); |
|
101 | - $adminObject->displayButton('left', ''); |
|
98 | + smart_xoops_cp_header(); |
|
99 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
100 | + $adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', ''); |
|
101 | + $adminObject->displayButton('left', ''); |
|
102 | 102 | |
103 | - //smart_adminMenu(2, _AM_SOBJECT_CUSTOMTAGS); |
|
103 | + //smart_adminMenu(2, _AM_SOBJECT_CUSTOMTAGS); |
|
104 | 104 | |
105 | - smart_collapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC); |
|
105 | + smart_collapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC); |
|
106 | 106 | |
107 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
108 | - $objectTable = new SmartObjectTable($smartobjectCustomtagHandler); |
|
109 | - $objectTable->addColumn(new SmartObjectColumn('name', 'left', 150, 'getCustomtagName')); |
|
110 | - $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
111 | - $objectTable->addColumn(new SmartObjectColumn('language', 'center', 150)); |
|
107 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
108 | + $objectTable = new SmartObjectTable($smartobjectCustomtagHandler); |
|
109 | + $objectTable->addColumn(new SmartObjectColumn('name', 'left', 150, 'getCustomtagName')); |
|
110 | + $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
111 | + $objectTable->addColumn(new SmartObjectColumn('language', 'center', 150)); |
|
112 | 112 | |
113 | - // $objectTable->addCustomAction('getCreateItemLink'); |
|
114 | - // $objectTable->addCustomAction('getCreateAttributLink'); |
|
113 | + // $objectTable->addCustomAction('getCreateItemLink'); |
|
114 | + // $objectTable->addCustomAction('getCreateAttributLink'); |
|
115 | 115 | |
116 | - // $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button |
|
116 | + // $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button |
|
117 | 117 | |
118 | - /* |
|
118 | + /* |
|
119 | 119 | $criteria_upcoming = new CriteriaCompo(); |
120 | 120 | $criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
121 | 121 | $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
@@ -139,16 +139,16 @@ discard block |
||
139 | 139 | 'criteria' => $criteria_last30days |
140 | 140 | )); |
141 | 141 | */ |
142 | - $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
143 | - $objectTable->addCustomAction('getCloneLink'); |
|
142 | + $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
143 | + $objectTable->addCustomAction('getCloneLink'); |
|
144 | 144 | |
145 | - $objectTable->render(); |
|
145 | + $objectTable->render(); |
|
146 | 146 | |
147 | - echo '<br>'; |
|
148 | - smart_close_collapsable('createdcustomtags'); |
|
149 | - echo '<br>'; |
|
147 | + echo '<br>'; |
|
148 | + smart_close_collapsable('createdcustomtags'); |
|
149 | + echo '<br>'; |
|
150 | 150 | |
151 | - break; |
|
151 | + break; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | //smart_modFooter(); |