Completed
Push — master ( 2a36d1...bf34f3 )
by Michael
03:21
created
class/form/elements/smartformsection.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@
 block discarded – undo
6 6
  */
7 7
 class SmartFormSection extends XoopsFormElement
8 8
 {
9
-    /**
10
-     * Text
11
-     * @var string
12
-     * @access  private
13
-     */
14
-    public $_value;
9
+	/**
10
+	 * Text
11
+	 * @var string
12
+	 * @access  private
13
+	 */
14
+	public $_value;
15 15
 
16
-    /**
17
-     * SmartFormSection constructor.
18
-     * @param      $sectionname
19
-     * @param bool $value
20
-     */
21
-    public function __construct($sectionname, $value = false)
22
-    {
23
-        $this->setName($sectionname);
24
-        $this->_value = $value;
25
-    }
16
+	/**
17
+	 * SmartFormSection constructor.
18
+	 * @param      $sectionname
19
+	 * @param bool $value
20
+	 */
21
+	public function __construct($sectionname, $value = false)
22
+	{
23
+		$this->setName($sectionname);
24
+		$this->_value = $value;
25
+	}
26 26
 
27
-    /**
28
-     * Get the text
29
-     *
30
-     * @return string
31
-     */
32
-    public function getValue()
33
-    {
34
-        return $this->_value;
35
-    }
27
+	/**
28
+	 * Get the text
29
+	 *
30
+	 * @return string
31
+	 */
32
+	public function getValue()
33
+	{
34
+		return $this->_value;
35
+	}
36 36
 
37
-    /**
38
-     * Prepare HTML for output
39
-     *
40
-     * @return string
41
-     */
42
-    public function render()
43
-    {
44
-        return $this->getValue();
45
-    }
37
+	/**
38
+	 * Prepare HTML for output
39
+	 *
40
+	 * @return string
41
+	 */
42
+	public function render()
43
+	{
44
+		return $this->getValue();
45
+	}
46 46
 }
Please login to merge, or discard this patch.
class/form/elements/smartformemailelement.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
  */
36 36
 class SmartFormSelectElement extends XoopsFormElement
37 37
 {
38
-    /**
39
-     * @param  bool $withtags
40
-     * @return string
41
-     */
42
-    public function renderValidationJS($withtags = true)
43
-    {
44
-        $js = '';
38
+	/**
39
+	 * @param  bool $withtags
40
+	 * @return string
41
+	 */
42
+	public function renderValidationJS($withtags = true)
43
+	{
44
+		$js = '';
45 45
 
46
-        return $js;
47
-    }
46
+		return $js;
47
+	}
48 48
 }
Please login to merge, or discard this patch.
class/form/elements/smartformdate_timeelement.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormDate_timeElement extends XoopsFormDateTime
13 13
 {
14
-    /**
15
-     * SmartFormDate_timeElement constructor.
16
-     * @param mixed $object
17
-     * @param mixed $key
18
-     */
19
-    public function __construct($object, $key)
20
-    {
21
-        parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e'));
22
-    }
14
+	/**
15
+	 * SmartFormDate_timeElement constructor.
16
+	 * @param mixed $object
17
+	 * @param mixed $key
18
+	 */
19
+	public function __construct($object, $key)
20
+	{
21
+		parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e'));
22
+	}
23 23
 }
Please login to merge, or discard this patch.
class/form/elements/smartformsectionclose.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@
 block discarded – undo
6 6
  */
7 7
 class SmartFormSectionClose extends XoopsFormElement
8 8
 {
9
-    /**
10
-     * Text
11
-     * @var string
12
-     * @access  private
13
-     */
14
-    public $_value;
9
+	/**
10
+	 * Text
11
+	 * @var string
12
+	 * @access  private
13
+	 */
14
+	public $_value;
15 15
 
16
-    /**
17
-     * SmartFormSectionClose constructor.
18
-     * @param      $sectionname
19
-     * @param bool $value
20
-     */
21
-    public function __construct($sectionname, $value = false)
22
-    {
23
-        $this->setName($sectionname);
24
-        $this->_value = $value;
25
-    }
16
+	/**
17
+	 * SmartFormSectionClose constructor.
18
+	 * @param      $sectionname
19
+	 * @param bool $value
20
+	 */
21
+	public function __construct($sectionname, $value = false)
22
+	{
23
+		$this->setName($sectionname);
24
+		$this->_value = $value;
25
+	}
26 26
 
27
-    /**
28
-     * Get the text
29
-     *
30
-     * @return string
31
-     */
32
-    public function getValue()
33
-    {
34
-        return $this->_value;
35
-    }
27
+	/**
28
+	 * Get the text
29
+	 *
30
+	 * @return string
31
+	 */
32
+	public function getValue()
33
+	{
34
+		return $this->_value;
35
+	}
36 36
 
37
-    /**
38
-     * Prepare HTML for output
39
-     *
40
-     * @return string
41
-     */
42
-    public function render()
43
-    {
44
-        return $this->getValue();
45
-    }
37
+	/**
38
+	 * Prepare HTML for output
39
+	 *
40
+	 * @return string
41
+	 */
42
+	public function render()
43
+	{
44
+		return $this->getValue();
45
+	}
46 46
 }
Please login to merge, or discard this patch.
class/form/elements/smartformselect_multielement.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
  */
17 17
 class SmartFormSelect_multiElement extends SmartFormSelectElement
18 18
 {
19
-    /**
20
-     * SmartFormSelect_multiElement constructor.
21
-     * @param string $object
22
-     * @param string $key
23
-     */
24
-    public function __construct($object, $key)
25
-    {
26
-        $this->multiple = true;
27
-        parent::__construct($object, $key);
28
-    }
19
+	/**
20
+	 * SmartFormSelect_multiElement constructor.
21
+	 * @param string $object
22
+	 * @param string $key
23
+	 */
24
+	public function __construct($object, $key)
25
+	{
26
+		$this->multiple = true;
27
+		parent::__construct($object, $key);
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  * @package    SmartObject
10 10
  * @subpackage SmartObjectForm
11 11
  */
12
-require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformselectelement.php';
12
+require_once SMARTOBJECT_ROOT_PATH.'class/form/elements/smartformselectelement.php';
13 13
 
14 14
 /**
15 15
  * Class SmartFormSelect_multiElement
Please login to merge, or discard this patch.
class/form/elements/smartformautocompleteelement.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormAutocompleteElement extends SmartAutocompleteElement
13 13
 {
14
-    /**
15
-     * SmartFormAutocompleteElement constructor.
16
-     * @param string $object
17
-     * @param string $key
18
-     */
19
-    public function __construct($object, $key)
20
-    {
21
-        $var            = $object->vars[$key];
22
-        $control        = $object->controls[$key];
23
-        $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255);
14
+	/**
15
+	 * SmartFormAutocompleteElement constructor.
16
+	 * @param string $object
17
+	 * @param string $key
18
+	 */
19
+	public function __construct($object, $key)
20
+	{
21
+		$var            = $object->vars[$key];
22
+		$control        = $object->controls[$key];
23
+		$form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255);
24 24
 
25
-        $form_size = isset($control['size']) ? $control['size'] : 50;
26
-        parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e'));
27
-    }
25
+		$form_size = isset($control['size']) ? $control['size'] : 50;
26
+		parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e'));
27
+	}
28 28
 }
Please login to merge, or discard this patch.
class/form/elements/smartformyesnoelement.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormYesnoElement extends XoopsFormRadioYN
13 13
 {
14
-    /**
15
-     * SmartFormYesnoElement constructor.
16
-     * @param string $object
17
-     * @param string $key
18
-     */
19
-    public function __construct($object, $key)
20
-    {
21
-        parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e'));
22
-    }
14
+	/**
15
+	 * SmartFormYesnoElement constructor.
16
+	 * @param string $object
17
+	 * @param string $key
18
+	 */
19
+	public function __construct($object, $key)
20
+	{
21
+		parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e'));
22
+	}
23 23
 }
Please login to merge, or discard this patch.
class/basedurl.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -36,29 +36,29 @@
 block discarded – undo
36 36
  */
37 37
 class SmartobjectBasedUrl extends SmartObject
38 38
 {
39
-    /**
40
-     * SmartobjectBasedUrl constructor.
41
-     */
42
-    public function __construct()
43
-    {
44
-        $this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false);
45
-        $this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false);
46
-        $this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false);
47
-    }
39
+	/**
40
+	 * SmartobjectBasedUrl constructor.
41
+	 */
42
+	public function __construct()
43
+	{
44
+		$this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false);
45
+		$this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false);
46
+		$this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false);
47
+	}
48 48
 
49
-    /**
50
-     * @param  string $key
51
-     * @param  string $format
52
-     * @return mixed
53
-     */
54
-    public function getVar($key, $format = 'e')
55
-    {
56
-        if (0 === strpos($key, 'url_')) {
57
-            return parent::getVar('url', $format);
58
-        } elseif (0 === strpos($key, 'caption_')) {
59
-            return parent::getVar('caption', $format);
60
-        } else {
61
-            return parent::getVar($key, $format);
62
-        }
63
-    }
49
+	/**
50
+	 * @param  string $key
51
+	 * @param  string $format
52
+	 * @return mixed
53
+	 */
54
+	public function getVar($key, $format = 'e')
55
+	{
56
+		if (0 === strpos($key, 'url_')) {
57
+			return parent::getVar('url', $format);
58
+		} elseif (0 === strpos($key, 'caption_')) {
59
+			return parent::getVar('caption', $format);
60
+		} else {
61
+			return parent::getVar($key, $format);
62
+		}
63
+	}
64 64
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
31 31
 
32
-require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php';
32
+require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php';
33 33
 
34 34
 /**
35 35
  * Class SmartobjectBasedUrl
Please login to merge, or discard this patch.
class/smartobjectcontroller.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 
124 124
     /**
125 125
      * @param        $smartObj
126
-     * @param        $objectid
127
-     * @param        $created_success_msg
128
-     * @param        $modified_success_msg
126
+     * @param        integer $objectid
127
+     * @param        string $created_success_msg
128
+     * @param        string $modified_success_msg
129 129
      * @param  bool  $redirect_page
130 130
      * @param  bool  $debug
131 131
      * @return mixed
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      * @param  bool   $confirm_msg
290 290
      * @param  string $op
291 291
      * @param  bool   $userSide
292
-     * @return bool
292
+     * @return boolean|null
293 293
      * @internal param string $redir_page redirect page after deleting the object
294 294
      */
295 295
     public function handleObjectDeletion($confirm_msg = false, $op = 'del', $userSide = false)
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     }
444 444
 
445 445
     /**
446
-     * @param         $smartObj
446
+     * @param         SmartMlObject $smartObj
447 447
      * @param  bool   $onlyUrl
448 448
      * @param  bool   $withimage
449 449
      * @return string
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     }
534 534
 
535 535
     /**
536
-     * @param $smartObj
536
+     * @param SmartObject $smartObj
537 537
      * @return string
538 538
      */
539 539
     public function getPrintAndMailLink($smartObj)
Please login to merge, or discard this patch.
Indentation   +507 added lines, -507 removed lines patch added patch discarded remove patch
@@ -31,511 +31,511 @@
 block discarded – undo
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
-            }
324
-
325
-            redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS);
326
-        } else {
327
-            // no confirm: show deletion condition
328
-
329
-            xoops_cp_header();
330
-
331
-            if (!$confirm_msg) {
332
-                $confirm_msg = _CO_SOBJECT_DELETE_CONFIRM;
333
-            }
334
-
335
-            xoops_confirm([
336
-                              'op'                    => $op,
337
-                              $this->handler->keyName => $smartObj->getVar($this->handler->keyName),
338
-                              'confirm'               => 1,
339
-                              'redirect_page'         => $smart_previous_page
340
-                          ], xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE);
341
-
342
-            xoops_cp_footer();
343
-        }
344
-        exit();
345
-    }
346
-
347
-    /**
348
-     * @param bool   $confirm_msg
349
-     * @param string $op
350
-     */
351
-    public function handleObjectDeletionFromUserSide($confirm_msg = false, $op = 'del')
352
-    {
353
-        global $smart_previous_page, $xoopsTpl;
354
-
355
-        $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0;
356
-        $smartObj = $this->handler->get($objectid);
357
-
358
-        if ($smartObj->isNew()) {
359
-            redirect_header('javascript:history.go(-1)', 3, _CO_SOBJECT_NOT_SELECTED);
360
-        }
361
-
362
-        $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
363
-        if ($confirm) {
364
-            if (!$this->handler->delete($smartObj)) {
365
-                redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors());
366
-            }
367
-
368
-            redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS);
369
-        } else {
370
-            // no confirm: show deletion condition
371
-            if (!$confirm_msg) {
372
-                $confirm_msg = _CO_SOBJECT_DELETE_CONFIRM;
373
-            }
374
-
375
-            ob_start();
376
-            xoops_confirm([
377
-                              'op'                    => $op,
378
-                              $this->handler->keyName => $smartObj->getVar($this->handler->keyName),
379
-                              'confirm'               => 1,
380
-                              'redirect_page'         => $smart_previous_page
381
-                          ], xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE);
382
-            $smartobjectDeleteConfirm = ob_get_clean();
383
-            $xoopsTpl->assign('smartobject_delete_confirm', $smartobjectDeleteConfirm);
384
-        }
385
-    }
386
-
387
-    /**
388
-     * Retreive the object admin side link for a {@link SmartObjectSingleView} page
389
-     *
390
-     * @param  SmartObject $smartObj reference to the object from which we want the user side link
391
-     * @param  bool        $onlyUrl  wether or not to return a simple URL or a full <a> link
392
-     * @param  bool        $withimage
393
-     * @return string      admin side link to the object
394
-     */
395
-    public function getAdminViewItemLink(SmartObject $smartObj, $onlyUrl = false, $withimage = false)
396
-    {
397
-        $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=view&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
398
-        if ($onlyUrl) {
399
-            return $ret;
400
-        } elseif ($withimage) {
401
-            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>";
402
-        }
403
-
404
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
405
-    }
406
-
407
-    /**
408
-     * Retreive the object user side link
409
-     *
410
-     * @param  SmartObject $smartObj reference to the object from which we want the user side link
411
-     * @param  bool        $onlyUrl  wether or not to return a simple URL or a full <a> link
412
-     * @return string      user side link to the object
413
-     */
414
-    public function getItemLink(SmartObject $smartObj, $onlyUrl = false)
415
-    {
416
-        $seoMode       = smart_getModuleModeSEO($this->handler->_moduleName);
417
-        $seoModuleName = smart_getModuleNameForSEO($this->handler->_moduleName);
418
-
419
-        /**
420
-         * $seoIncludeId feature is not finished yet, so let's put it always to true
421
-         */
422
-        //$seoIncludeId = smart_getModuleIncludeIdSEO($this->handler->_moduleName);
423
-        $seoIncludeId = true;
424
-
425
-        if ($seoMode === 'rewrite') {
426
-            $ret = XOOPS_URL . '/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
427
-        } elseif ($seoMode === 'pathinfo') {
428
-            $ret = SMARTOBJECT_URL . 'seo.php/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
429
-        } else {
430
-            $ret = $this->handler->_moduleUrl . $this->handler->_page . '?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
431
-        }
432
-
433
-        if (!$onlyUrl) {
434
-            $ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
435
-        }
436
-
437
-        return $ret;
438
-    }
439
-
440
-    /**
441
-     * @param         $smartObj
442
-     * @param  bool   $onlyUrl
443
-     * @param  bool   $withimage
444
-     * @return string
445
-     */
446
-    public function getEditLanguageLink($smartObj, $onlyUrl = false, $withimage = true)
447
-    {
448
-        $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName) . '&language=' . $smartObj->getVar('language');
449
-        if ($onlyUrl) {
450
-            return $ret;
451
-        } elseif ($withimage) {
452
-            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>";
453
-        }
454
-
455
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
456
-    }
457
-
458
-    /**
459
-     * @param         $smartObj
460
-     * @param  bool   $onlyUrl
461
-     * @param  bool   $withimage
462
-     * @param  bool   $userSide
463
-     * @return string
464
-     */
465
-    public function getEditItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false)
466
-    {
467
-        $admin_side = $userSide ? '' : 'admin/';
468
-        $ret        = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
469
-        if ($onlyUrl) {
470
-            return $ret;
471
-        } elseif ($withimage) {
472
-            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>";
473
-        }
474
-
475
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
476
-    }
477
-
478
-    /**
479
-     * @param         $smartObj
480
-     * @param  bool   $onlyUrl
481
-     * @param  bool   $withimage
482
-     * @param  bool   $userSide
483
-     * @return string
484
-     */
485
-    public function getDeleteItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false)
486
-    {
487
-        $admin_side = $userSide ? '' : 'admin/';
488
-        $ret        = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=del&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
489
-        if ($onlyUrl) {
490
-            return $ret;
491
-        } elseif ($withimage) {
492
-            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>";
493
-        }
494
-
495
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
496
-    }
497
-
498
-    /**
499
-     * @param $smartObj
500
-     * @return string
501
-     */
502
-    public function getPrintAndMailLink($smartObj)
503
-    {
504
-        global $xoopsConfig;
505
-
506
-        $printlink = $this->handler->_moduleUrl . 'print.php?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
507
-        $js        = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);";
508
-        $printlink = '<a href="' . $js . '"><img  src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"></a>';
509
-
510
-        $smartModule = smart_getModuleInfo($smartObj->handler->_moduleName);
511
-        $link        = smart_getCurrentPage();
512
-        $mid         = $smartModule->getVar('mid');
513
-        $friendlink  = "<a href=\"javascript:openWithSelfMain('"
514
-                       . SMARTOBJECT_URL
515
-                       . 'sendlink.php?link='
516
-                       . $link
517
-                       . '&amp;mid='
518
-                       . $mid
519
-                       . "', ',',',',',','sendmessage', 674, 500);\"><img src=\""
520
-                       . SMARTOBJECT_IMAGES_ACTIONS_URL
521
-                       . "mail_send.png\"  alt=\""
522
-                       . _CO_SOBJECT_EMAIL
523
-                       . "\" title=\""
524
-                       . _CO_SOBJECT_EMAIL
525
-                       . "\" style=\"vertical-align: middle;\"></a>";
526
-
527
-        $ret = '<span id="smartobject_print_button">' . $printlink . '&nbsp;</span>' . '<span id="smartobject_mail_button">' . $friendlink . '</span>';
528
-
529
-        return $ret;
530
-    }
531
-
532
-    /**
533
-     * @return string
534
-     */
535
-    public function getModuleItemString()
536
-    {
537
-        $ret = $this->handler->_moduleName . '_' . $this->handler->_itemname;
538
-
539
-        return $ret;
540
-    }
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
+			}
324
+
325
+			redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS);
326
+		} else {
327
+			// no confirm: show deletion condition
328
+
329
+			xoops_cp_header();
330
+
331
+			if (!$confirm_msg) {
332
+				$confirm_msg = _CO_SOBJECT_DELETE_CONFIRM;
333
+			}
334
+
335
+			xoops_confirm([
336
+							  'op'                    => $op,
337
+							  $this->handler->keyName => $smartObj->getVar($this->handler->keyName),
338
+							  'confirm'               => 1,
339
+							  'redirect_page'         => $smart_previous_page
340
+						  ], xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE);
341
+
342
+			xoops_cp_footer();
343
+		}
344
+		exit();
345
+	}
346
+
347
+	/**
348
+	 * @param bool   $confirm_msg
349
+	 * @param string $op
350
+	 */
351
+	public function handleObjectDeletionFromUserSide($confirm_msg = false, $op = 'del')
352
+	{
353
+		global $smart_previous_page, $xoopsTpl;
354
+
355
+		$objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0;
356
+		$smartObj = $this->handler->get($objectid);
357
+
358
+		if ($smartObj->isNew()) {
359
+			redirect_header('javascript:history.go(-1)', 3, _CO_SOBJECT_NOT_SELECTED);
360
+		}
361
+
362
+		$confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
363
+		if ($confirm) {
364
+			if (!$this->handler->delete($smartObj)) {
365
+				redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors());
366
+			}
367
+
368
+			redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS);
369
+		} else {
370
+			// no confirm: show deletion condition
371
+			if (!$confirm_msg) {
372
+				$confirm_msg = _CO_SOBJECT_DELETE_CONFIRM;
373
+			}
374
+
375
+			ob_start();
376
+			xoops_confirm([
377
+							  'op'                    => $op,
378
+							  $this->handler->keyName => $smartObj->getVar($this->handler->keyName),
379
+							  'confirm'               => 1,
380
+							  'redirect_page'         => $smart_previous_page
381
+						  ], xoops_getenv('PHP_SELF'), sprintf($confirm_msg, $smartObj->getVar($this->handler->identifierName)), _CO_SOBJECT_DELETE);
382
+			$smartobjectDeleteConfirm = ob_get_clean();
383
+			$xoopsTpl->assign('smartobject_delete_confirm', $smartobjectDeleteConfirm);
384
+		}
385
+	}
386
+
387
+	/**
388
+	 * Retreive the object admin side link for a {@link SmartObjectSingleView} page
389
+	 *
390
+	 * @param  SmartObject $smartObj reference to the object from which we want the user side link
391
+	 * @param  bool        $onlyUrl  wether or not to return a simple URL or a full <a> link
392
+	 * @param  bool        $withimage
393
+	 * @return string      admin side link to the object
394
+	 */
395
+	public function getAdminViewItemLink(SmartObject $smartObj, $onlyUrl = false, $withimage = false)
396
+	{
397
+		$ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=view&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
398
+		if ($onlyUrl) {
399
+			return $ret;
400
+		} elseif ($withimage) {
401
+			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>";
402
+		}
403
+
404
+		return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
405
+	}
406
+
407
+	/**
408
+	 * Retreive the object user side link
409
+	 *
410
+	 * @param  SmartObject $smartObj reference to the object from which we want the user side link
411
+	 * @param  bool        $onlyUrl  wether or not to return a simple URL or a full <a> link
412
+	 * @return string      user side link to the object
413
+	 */
414
+	public function getItemLink(SmartObject $smartObj, $onlyUrl = false)
415
+	{
416
+		$seoMode       = smart_getModuleModeSEO($this->handler->_moduleName);
417
+		$seoModuleName = smart_getModuleNameForSEO($this->handler->_moduleName);
418
+
419
+		/**
420
+		 * $seoIncludeId feature is not finished yet, so let's put it always to true
421
+		 */
422
+		//$seoIncludeId = smart_getModuleIncludeIdSEO($this->handler->_moduleName);
423
+		$seoIncludeId = true;
424
+
425
+		if ($seoMode === 'rewrite') {
426
+			$ret = XOOPS_URL . '/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
427
+		} elseif ($seoMode === 'pathinfo') {
428
+			$ret = SMARTOBJECT_URL . 'seo.php/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
429
+		} else {
430
+			$ret = $this->handler->_moduleUrl . $this->handler->_page . '?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
431
+		}
432
+
433
+		if (!$onlyUrl) {
434
+			$ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
435
+		}
436
+
437
+		return $ret;
438
+	}
439
+
440
+	/**
441
+	 * @param         $smartObj
442
+	 * @param  bool   $onlyUrl
443
+	 * @param  bool   $withimage
444
+	 * @return string
445
+	 */
446
+	public function getEditLanguageLink($smartObj, $onlyUrl = false, $withimage = true)
447
+	{
448
+		$ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName) . '&language=' . $smartObj->getVar('language');
449
+		if ($onlyUrl) {
450
+			return $ret;
451
+		} elseif ($withimage) {
452
+			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>";
453
+		}
454
+
455
+		return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
456
+	}
457
+
458
+	/**
459
+	 * @param         $smartObj
460
+	 * @param  bool   $onlyUrl
461
+	 * @param  bool   $withimage
462
+	 * @param  bool   $userSide
463
+	 * @return string
464
+	 */
465
+	public function getEditItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false)
466
+	{
467
+		$admin_side = $userSide ? '' : 'admin/';
468
+		$ret        = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
469
+		if ($onlyUrl) {
470
+			return $ret;
471
+		} elseif ($withimage) {
472
+			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>";
473
+		}
474
+
475
+		return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
476
+	}
477
+
478
+	/**
479
+	 * @param         $smartObj
480
+	 * @param  bool   $onlyUrl
481
+	 * @param  bool   $withimage
482
+	 * @param  bool   $userSide
483
+	 * @return string
484
+	 */
485
+	public function getDeleteItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false)
486
+	{
487
+		$admin_side = $userSide ? '' : 'admin/';
488
+		$ret        = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=del&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
489
+		if ($onlyUrl) {
490
+			return $ret;
491
+		} elseif ($withimage) {
492
+			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>";
493
+		}
494
+
495
+		return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
496
+	}
497
+
498
+	/**
499
+	 * @param $smartObj
500
+	 * @return string
501
+	 */
502
+	public function getPrintAndMailLink($smartObj)
503
+	{
504
+		global $xoopsConfig;
505
+
506
+		$printlink = $this->handler->_moduleUrl . 'print.php?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
507
+		$js        = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);";
508
+		$printlink = '<a href="' . $js . '"><img  src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"></a>';
509
+
510
+		$smartModule = smart_getModuleInfo($smartObj->handler->_moduleName);
511
+		$link        = smart_getCurrentPage();
512
+		$mid         = $smartModule->getVar('mid');
513
+		$friendlink  = "<a href=\"javascript:openWithSelfMain('"
514
+					   . SMARTOBJECT_URL
515
+					   . 'sendlink.php?link='
516
+					   . $link
517
+					   . '&amp;mid='
518
+					   . $mid
519
+					   . "', ',',',',',','sendmessage', 674, 500);\"><img src=\""
520
+					   . SMARTOBJECT_IMAGES_ACTIONS_URL
521
+					   . "mail_send.png\"  alt=\""
522
+					   . _CO_SOBJECT_EMAIL
523
+					   . "\" title=\""
524
+					   . _CO_SOBJECT_EMAIL
525
+					   . "\" style=\"vertical-align: middle;\"></a>";
526
+
527
+		$ret = '<span id="smartobject_print_button">' . $printlink . '&nbsp;</span>' . '<span id="smartobject_mail_button">' . $friendlink . '</span>';
528
+
529
+		return $ret;
530
+	}
531
+
532
+	/**
533
+	 * @return string
534
+	 */
535
+	public function getModuleItemString()
536
+	{
537
+		$ret = $this->handler->_moduleName . '_' . $this->handler->_itemname;
538
+
539
+		return $ret;
540
+	}
541 541
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  * @credit  Jan Keller Pedersen <[email protected]> - IDG Danmark A/S <www.idg.dk>
24 24
  * @link    http://smartfactory.ca The SmartFactory
25 25
  */
26
-require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php';
27
-require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjecthandler.php';
26
+require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php';
27
+require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobjecthandler.php';
28 28
 
29 29
 /**
30 30
  * Class SmartObjectController
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
         foreach (array_keys($smartObj->vars) as $key) {
51 51
             switch ($smartObj->vars[$key]['data_type']) {
52 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]);
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 56
                         if (file_exists($oldFile)) {
57 57
                             unlink($oldFile);
58 58
                         }
59 59
                     }
60
-                    if (isset($_POST['delete_' . $key]) && $_POST['delete_' . $key] == '1') {
61
-                        $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e');
60
+                    if (isset($_POST['delete_'.$key]) && $_POST['delete_'.$key] == '1') {
61
+                        $oldFile = $smartObj->getUploadDir(true).$smartObj->getVar($key, 'e');
62 62
                         $smartObj->setVar($key, '');
63 63
                         if (file_exists($oldFile)) {
64 64
                             unlink($oldFile);
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 
69 69
                 case XOBJ_DTYPE_URLLINK:
70 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]);
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 75
                     if ($linkObj->getVar('url') !== '') {
76 76
                         $smartObj->storeUrlLinkObj($linkObj);
77 77
                     }
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
                     break;
81 81
 
82 82
                 case XOBJ_DTYPE_FILE:
83
-                    if (!isset($_FILES['upload_' . $key]['name']) || $_FILES['upload_' . $key]['name'] === '') {
83
+                    if (!isset($_FILES['upload_'.$key]['name']) || $_FILES['upload_'.$key]['name'] === '') {
84 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]);
85
+                        $fileObj->setVar('caption', $_POST['caption_'.$key]);
86
+                        $fileObj->setVar('description', $_POST['desc_'.$key]);
87
+                        $fileObj->setVar('url', $_POST['url_'.$key]);
88 88
                         if (!($fileObj->getVar('url') === '' && $fileObj->getVar('url') === ''
89 89
                               && $fileObj->getVar('url') === '')) {
90 90
                             $res = $smartObj->storeFileObj($fileObj);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                         $value = strtotime($_POST[$key]);
109 109
                         //if strtotime returns false, the value is already a time stamp
110 110
                         if (!$value) {
111
-                            $value = (int)$_POST[$key];
111
+                            $value = (int) $_POST[$key];
112 112
                         }
113 113
                     }
114 114
                     $smartObj->setVar($key, $value);
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
 
152 152
         // Check if there were uploaded files
153 153
         if (isset($_POST['smart_upload_image']) || isset($_POST['smart_upload_file'])) {
154
-            require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartuploader.php';
154
+            require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartuploader.php';
155 155
             $uploaderObj = new SmartUploader($smartObj->getImageDir(true), $this->handler->_allowedMimeTypes, $this->handler->_maxFileSize, $this->handler->_maxWidth, $this->handler->_maxHeight);
156 156
             foreach ($_FILES as $name => $file_array) {
157 157
                 if (isset($file_array['name']) && $file_array['name'] !== ''
158 158
                     && in_array(str_replace('upload_', '', $name), array_keys($smartObj->vars))) {
159 159
                     if ($uploaderObj->fetchMedia($name)) {
160
-                        $uploaderObj->setTargetFileName(time() . '_' . $uploaderObj->getMediaName());
160
+                        $uploaderObj->setTargetFileName(time().'_'.$uploaderObj->getMediaName());
161 161
                         if ($uploaderObj->upload()) {
162 162
                             // Find the related field in the SmartObject
163 163
                             $related_field   = str_replace('upload_', '', $name);
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
                             if ($smartObj->vars[$related_field]['data_type'] === XOBJ_DTYPE_FILE) {
167 167
                                 $object_fileurl = $smartObj->getUploadDir();
168 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]);
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 172
                                 $smartObj->storeFileObj($fileObj);
173 173
                                 //todo: catch errors
174 174
                                 $smartObj->setVar($related_field, $fileObj->getVar('fileid'));
175 175
                             } else {
176
-                                $old_file = $smartObj->getUploadDir(true) . $smartObj->getVar($related_field);
176
+                                $old_file = $smartObj->getUploadDir(true).$smartObj->getVar($related_field);
177 177
                                 unlink($old_file);
178 178
                                 $smartObj->setVar($related_field, $uploaderObj->getSavedFileName());
179 179
                             }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             return $smartObj;
205 205
         } else {
206 206
             if (!$storeResult) {
207
-                redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $smartObj->getHtmlErrors());
207
+                redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR.$smartObj->getHtmlErrors());
208 208
             }
209 209
 
210 210
             $redirect_page = $redirect_page ?: smart_get_page_before_form();
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         $debug = false,
234 234
         $x_param = false
235 235
     ) {
236
-        $objectid = isset($_POST[$this->handler->keyName]) ? (int)$_POST[$this->handler->keyName] : 0;
236
+        $objectid = isset($_POST[$this->handler->keyName]) ? (int) $_POST[$this->handler->keyName] : 0;
237 237
         if ($debug) {
238 238
             if ($x_param) {
239 239
                 $smartObj = $this->handler->getD($objectid, true, $x_param);
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     {
310 310
         global $smart_previous_page;
311 311
 
312
-        $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0;
312
+        $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int) $_REQUEST[$this->handler->keyName] : 0;
313 313
         $smartObj = $this->handler->get($objectid);
314 314
 
315 315
         if ($smartObj->isNew()) {
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
320 320
         if ($confirm) {
321 321
             if (!$this->handler->delete($smartObj)) {
322
-                redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors());
322
+                redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR.$smartObj->getHtmlErrors());
323 323
             }
324 324
 
325 325
             redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS);
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     {
353 353
         global $smart_previous_page, $xoopsTpl;
354 354
 
355
-        $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0;
355
+        $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int) $_REQUEST[$this->handler->keyName] : 0;
356 356
         $smartObj = $this->handler->get($objectid);
357 357
 
358 358
         if ($smartObj->isNew()) {
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
363 363
         if ($confirm) {
364 364
             if (!$this->handler->delete($smartObj)) {
365
-                redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors());
365
+                redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR.$smartObj->getHtmlErrors());
366 366
             }
367 367
 
368 368
             redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS);
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
      */
395 395
     public function getAdminViewItemLink(SmartObject $smartObj, $onlyUrl = false, $withimage = false)
396 396
     {
397
-        $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=view&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
397
+        $ret = $this->handler->_moduleUrl.'admin/'.$this->handler->_page.'?op=view&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName);
398 398
         if ($onlyUrl) {
399 399
             return $ret;
400 400
         } elseif ($withimage) {
401
-            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>";
401
+            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>";
402 402
         }
403 403
 
404
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
404
+        return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>';
405 405
     }
406 406
 
407 407
     /**
@@ -423,15 +423,15 @@  discard block
 block discarded – undo
423 423
         $seoIncludeId = true;
424 424
 
425 425
         if ($seoMode === 'rewrite') {
426
-            $ret = XOOPS_URL . '/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
426
+            $ret = XOOPS_URL.'/'.$seoModuleName.'.'.$this->handler->_itemname.($seoIncludeId ? '.'.$smartObj->getVar($this->handler->keyName) : '').'/'.$smartObj->getVar('short_url').'.html';
427 427
         } elseif ($seoMode === 'pathinfo') {
428
-            $ret = SMARTOBJECT_URL . 'seo.php/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
428
+            $ret = SMARTOBJECT_URL.'seo.php/'.$seoModuleName.'.'.$this->handler->_itemname.($seoIncludeId ? '.'.$smartObj->getVar($this->handler->keyName) : '').'/'.$smartObj->getVar('short_url').'.html';
429 429
         } else {
430
-            $ret = $this->handler->_moduleUrl . $this->handler->_page . '?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
430
+            $ret = $this->handler->_moduleUrl.$this->handler->_page.'?'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName);
431 431
         }
432 432
 
433 433
         if (!$onlyUrl) {
434
-            $ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
434
+            $ret = "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>';
435 435
         }
436 436
 
437 437
         return $ret;
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function getEditLanguageLink($smartObj, $onlyUrl = false, $withimage = true)
447 447
     {
448
-        $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName) . '&language=' . $smartObj->getVar('language');
448
+        $ret = $this->handler->_moduleUrl.'admin/'.$this->handler->_page.'?op=mod&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName).'&language='.$smartObj->getVar('language');
449 449
         if ($onlyUrl) {
450 450
             return $ret;
451 451
         } elseif ($withimage) {
452
-            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>";
452
+            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>";
453 453
         }
454 454
 
455
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
455
+        return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>';
456 456
     }
457 457
 
458 458
     /**
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
     public function getEditItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false)
466 466
     {
467 467
         $admin_side = $userSide ? '' : 'admin/';
468
-        $ret        = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
468
+        $ret        = $this->handler->_moduleUrl.$admin_side.$this->handler->_page.'?op=mod&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName);
469 469
         if ($onlyUrl) {
470 470
             return $ret;
471 471
         } elseif ($withimage) {
472
-            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>";
472
+            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>";
473 473
         }
474 474
 
475
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
475
+        return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>';
476 476
     }
477 477
 
478 478
     /**
@@ -485,14 +485,14 @@  discard block
 block discarded – undo
485 485
     public function getDeleteItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false)
486 486
     {
487 487
         $admin_side = $userSide ? '' : 'admin/';
488
-        $ret        = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=del&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
488
+        $ret        = $this->handler->_moduleUrl.$admin_side.$this->handler->_page.'?op=del&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName);
489 489
         if ($onlyUrl) {
490 490
             return $ret;
491 491
         } elseif ($withimage) {
492
-            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>";
492
+            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>";
493 493
         }
494 494
 
495
-        return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>';
495
+        return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>';
496 496
     }
497 497
 
498 498
     /**
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
     {
504 504
         global $xoopsConfig;
505 505
 
506
-        $printlink = $this->handler->_moduleUrl . 'print.php?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName);
507
-        $js        = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);";
508
-        $printlink = '<a href="' . $js . '"><img  src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"></a>';
506
+        $printlink = $this->handler->_moduleUrl.'print.php?'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName);
507
+        $js        = "javascript:openWithSelfMain('".$printlink."', 'smartpopup', 700, 519);";
508
+        $printlink = '<a href="'.$js.'"><img  src="'.SMARTOBJECT_IMAGES_ACTIONS_URL.'fileprint.png" alt="" style="vertical-align: middle;"></a>';
509 509
 
510 510
         $smartModule = smart_getModuleInfo($smartObj->handler->_moduleName);
511 511
         $link        = smart_getCurrentPage();
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
                        . _CO_SOBJECT_EMAIL
525 525
                        . "\" style=\"vertical-align: middle;\"></a>";
526 526
 
527
-        $ret = '<span id="smartobject_print_button">' . $printlink . '&nbsp;</span>' . '<span id="smartobject_mail_button">' . $friendlink . '</span>';
527
+        $ret = '<span id="smartobject_print_button">'.$printlink.'&nbsp;</span>'.'<span id="smartobject_mail_button">'.$friendlink.'</span>';
528 528
 
529 529
         return $ret;
530 530
     }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
      */
535 535
     public function getModuleItemString()
536 536
     {
537
-        $ret = $this->handler->_moduleName . '_' . $this->handler->_itemname;
537
+        $ret = $this->handler->_moduleName.'_'.$this->handler->_itemname;
538 538
 
539 539
         return $ret;
540 540
     }
Please login to merge, or discard this patch.