Completed
Push — master ( 4911d3...2a36d1 )
by Michael
02:09
created
class/smartobjecttreetable.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @subpackage SmartObjectTable
10 10
  */
11 11
 
12
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
12
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecttable.php';
13 13
 
14 14
 /**
15 15
  * SmartObjectTreeTable class
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 $space .= ' ';
100 100
             }
101 101
 
102
-            $aColumn['value'] = $space . $value;
102
+            $aColumn['value'] = $space.$value;
103 103
             $aColumn['class'] = $class;
104 104
             $aColumn['width'] = $column->getWidth();
105 105
             $aColumn['align'] = $column->getAlign();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             }
124 124
         }
125 125
 
126
-        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php';
126
+        require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php';
127 127
         $controller = new SmartObjectController($this->_objectHandler);
128 128
 
129 129
         if (in_array('edit', $this->_actions)) {
Please login to merge, or discard this patch.
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -22,157 +22,157 @@
 block discarded – undo
22 22
  */
23 23
 class SmartObjectTreeTable extends SmartObjectTable
24 24
 {
25
-    /**
26
-     * SmartObjectTreeTable constructor.
27
-     * @param SmartPersistableObjectHandler $objectHandler
28
-     * @param bool                          $criteria
29
-     * @param array                         $actions
30
-     * @param bool                          $userSide
31
-     */
32
-    public function __construct(
33
-        SmartPersistableObjectHandler $objectHandler,
34
-        $criteria = false,
35
-        $actions = ['edit', 'delete'],
36
-        $userSide = false
37
-    ) {
38
-        $this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide);
39
-        $this->_isTree = true;
40
-    }
41
-
42
-    /**
43
-     * Get children objects given a specific parentid
44
-     *
45
-     * @var    int $parentid id of the parent which children we want to retreive
46
-     * @return array of SmartObject
47
-     */
48
-    public function getChildrenOf($parentid = 0)
49
-    {
50
-        return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false;
51
-    }
52
-
53
-    /**
54
-     * @param     $object
55
-     * @param int $level
56
-     */
57
-    public function createTableRow($object, $level = 0)
58
-    {
59
-        $aObject = [];
60
-
61
-        $i = 0;
62
-
63
-        $aColumns        = [];
64
-        $doWeHaveActions = false;
65
-
66
-        foreach ($this->_columns as $column) {
67
-            $aColumn = [];
68
-
69
-            if ($i == 0) {
70
-                $class = 'head';
71
-            } elseif ($i % 2 == 0) {
72
-                $class = 'even';
73
-            } else {
74
-                $class = 'odd';
75
-            }
76
-
77
-            if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) {
78
-                $method = $column->_customMethodForValue;
79
-                $value  = $object->$method();
80
-            } else {
81
-                /**
82
-                 * If the column is the identifier, then put a link on it
83
-                 */
84
-                if ($column->getKeyName() == $this->_objectHandler->identifierName) {
85
-                    $value = $object->getItemLink();
86
-                } else {
87
-                    $value = $object->getVar($column->getKeyName());
88
-                }
89
-            }
90
-
91
-            $space = '';
92
-            if ($column->getKeyName() == $this->_objectHandler->identifierName) {
93
-                for ($i = 0; $i < $level; ++$i) {
94
-                    $space .= '--';
95
-                }
96
-            }
97
-
98
-            if ($space !== '') {
99
-                $space .= '&nbsp;';
100
-            }
101
-
102
-            $aColumn['value'] = $space . $value;
103
-            $aColumn['class'] = $class;
104
-            $aColumn['width'] = $column->getWidth();
105
-            $aColumn['align'] = $column->getAlign();
106
-            $aColumn['key']   = $column->getKeyName();
107
-
108
-            $aColumns[] = $aColumn;
109
-            ++$i;
110
-        }
111
-
112
-        $aObject['columns'] = $aColumns;
113
-
114
-        $class            = $class === 'even' ? 'odd' : 'even';
115
-        $aObject['class'] = $class;
116
-
117
-        $actions = [];
118
-
119
-        // Adding the custom actions if any
120
-        foreach ($this->_custom_actions as $action) {
121
-            if (method_exists($object, $action)) {
122
-                $actions[] = $object->$action();
123
-            }
124
-        }
125
-
126
-        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php';
127
-        $controller = new SmartObjectController($this->_objectHandler);
128
-
129
-        if (in_array('edit', $this->_actions)) {
130
-            $actions[] = $controller->getEditItemLink($object, false, true);
131
-        }
132
-        if (in_array('delete', $this->_actions)) {
133
-            $actions[] = $controller->getDeleteItemLink($object, false, true);
134
-        }
135
-        $aObject['actions'] = $actions;
136
-
137
-        $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30);
138
-        $aObject['id']     = $object->id();
139
-        $this->_aObjects[] = $aObject;
140
-
141
-        $childrenObjects = $this->getChildrenOf($object->id());
142
-
143
-        $this->_hasActions = $this->_hasActions ? true : count($actions) > 0;
144
-
145
-        if ($childrenObjects) {
146
-            ++$level;
147
-            foreach ($childrenObjects as $subObject) {
148
-                $this->createTableRow($subObject, $level);
149
-            }
150
-        }
151
-    }
152
-
153
-    public function createTableRows()
154
-    {
155
-        $this->_aObjects = [];
156
-
157
-        if (count($this->_objects) > 0) {
158
-            foreach ($this->getChildrenOf() as $object) {
159
-                $this->createTableRow($object);
160
-            }
161
-
162
-            $this->_tpl->assign('smartobject_objects', $this->_aObjects);
163
-        } else {
164
-            $colspan = count($this->_columns) + 1;
165
-            $this->_tpl->assign('smartobject_colspan', $colspan);
166
-        }
167
-    }
168
-
169
-    /**
170
-     * @return mixed
171
-     */
172
-    public function fetchObjects()
173
-    {
174
-        $ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid');
175
-
176
-        return $ret;
177
-    }
25
+	/**
26
+	 * SmartObjectTreeTable constructor.
27
+	 * @param SmartPersistableObjectHandler $objectHandler
28
+	 * @param bool                          $criteria
29
+	 * @param array                         $actions
30
+	 * @param bool                          $userSide
31
+	 */
32
+	public function __construct(
33
+		SmartPersistableObjectHandler $objectHandler,
34
+		$criteria = false,
35
+		$actions = ['edit', 'delete'],
36
+		$userSide = false
37
+	) {
38
+		$this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide);
39
+		$this->_isTree = true;
40
+	}
41
+
42
+	/**
43
+	 * Get children objects given a specific parentid
44
+	 *
45
+	 * @var    int $parentid id of the parent which children we want to retreive
46
+	 * @return array of SmartObject
47
+	 */
48
+	public function getChildrenOf($parentid = 0)
49
+	{
50
+		return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false;
51
+	}
52
+
53
+	/**
54
+	 * @param     $object
55
+	 * @param int $level
56
+	 */
57
+	public function createTableRow($object, $level = 0)
58
+	{
59
+		$aObject = [];
60
+
61
+		$i = 0;
62
+
63
+		$aColumns        = [];
64
+		$doWeHaveActions = false;
65
+
66
+		foreach ($this->_columns as $column) {
67
+			$aColumn = [];
68
+
69
+			if ($i == 0) {
70
+				$class = 'head';
71
+			} elseif ($i % 2 == 0) {
72
+				$class = 'even';
73
+			} else {
74
+				$class = 'odd';
75
+			}
76
+
77
+			if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) {
78
+				$method = $column->_customMethodForValue;
79
+				$value  = $object->$method();
80
+			} else {
81
+				/**
82
+				 * If the column is the identifier, then put a link on it
83
+				 */
84
+				if ($column->getKeyName() == $this->_objectHandler->identifierName) {
85
+					$value = $object->getItemLink();
86
+				} else {
87
+					$value = $object->getVar($column->getKeyName());
88
+				}
89
+			}
90
+
91
+			$space = '';
92
+			if ($column->getKeyName() == $this->_objectHandler->identifierName) {
93
+				for ($i = 0; $i < $level; ++$i) {
94
+					$space .= '--';
95
+				}
96
+			}
97
+
98
+			if ($space !== '') {
99
+				$space .= '&nbsp;';
100
+			}
101
+
102
+			$aColumn['value'] = $space . $value;
103
+			$aColumn['class'] = $class;
104
+			$aColumn['width'] = $column->getWidth();
105
+			$aColumn['align'] = $column->getAlign();
106
+			$aColumn['key']   = $column->getKeyName();
107
+
108
+			$aColumns[] = $aColumn;
109
+			++$i;
110
+		}
111
+
112
+		$aObject['columns'] = $aColumns;
113
+
114
+		$class            = $class === 'even' ? 'odd' : 'even';
115
+		$aObject['class'] = $class;
116
+
117
+		$actions = [];
118
+
119
+		// Adding the custom actions if any
120
+		foreach ($this->_custom_actions as $action) {
121
+			if (method_exists($object, $action)) {
122
+				$actions[] = $object->$action();
123
+			}
124
+		}
125
+
126
+		require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php';
127
+		$controller = new SmartObjectController($this->_objectHandler);
128
+
129
+		if (in_array('edit', $this->_actions)) {
130
+			$actions[] = $controller->getEditItemLink($object, false, true);
131
+		}
132
+		if (in_array('delete', $this->_actions)) {
133
+			$actions[] = $controller->getDeleteItemLink($object, false, true);
134
+		}
135
+		$aObject['actions'] = $actions;
136
+
137
+		$this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30);
138
+		$aObject['id']     = $object->id();
139
+		$this->_aObjects[] = $aObject;
140
+
141
+		$childrenObjects = $this->getChildrenOf($object->id());
142
+
143
+		$this->_hasActions = $this->_hasActions ? true : count($actions) > 0;
144
+
145
+		if ($childrenObjects) {
146
+			++$level;
147
+			foreach ($childrenObjects as $subObject) {
148
+				$this->createTableRow($subObject, $level);
149
+			}
150
+		}
151
+	}
152
+
153
+	public function createTableRows()
154
+	{
155
+		$this->_aObjects = [];
156
+
157
+		if (count($this->_objects) > 0) {
158
+			foreach ($this->getChildrenOf() as $object) {
159
+				$this->createTableRow($object);
160
+			}
161
+
162
+			$this->_tpl->assign('smartobject_objects', $this->_aObjects);
163
+		} else {
164
+			$colspan = count($this->_columns) + 1;
165
+			$this->_tpl->assign('smartobject_colspan', $colspan);
166
+		}
167
+	}
168
+
169
+	/**
170
+	 * @return mixed
171
+	 */
172
+	public function fetchObjects()
173
+	{
174
+		$ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid');
175
+
176
+		return $ret;
177
+	}
178 178
 }
Please login to merge, or discard this patch.
class/smartobjectabout.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
     {
50 50
         global $xoopsModule, $xoopsConfig;
51 51
 
52
-        $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php';
52
+        $fileName = XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/modinfo.php';
53 53
         if (file_exists($fileName)) {
54 54
             require_once $fileName;
55 55
         } else {
56
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php';
56
+            require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/english/modinfo.php';
57 57
         }
58 58
         $this->_aboutTitle = $aboutTitle;
59 59
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
         //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name'));
107 107
 
108
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
108
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
109 109
 
110 110
         // ---
111 111
         // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $this->_tpl = new XoopsTpl();
114 114
         // ---
115 115
 
116
-        $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/');
116
+        $this->_tpl->assign('module_url', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/');
117 117
         $this->_tpl->assign('module_image', $versioninfo->getInfo('image'));
118 118
         $this->_tpl->assign('module_name', $versioninfo->getInfo('name'));
119 119
         $this->_tpl->assign('module_version', $versioninfo->getInfo('version'));
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
         // Left headings...
123 123
         if ($versioninfo->getInfo('author_realname') !== '') {
124
-            $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')';
124
+            $author_name = $versioninfo->getInfo('author').' ('.$versioninfo->getInfo('author_realname').')';
125 125
         } else {
126 126
             $author_name = $versioninfo->getInfo('author');
127 127
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         // For changelog thanks to 3Dev
168 168
         global $xoopsModule;
169
-        $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt';
169
+        $filename = XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/changelog.txt';
170 170
         if (is_file($filename)) {
171 171
             $filesize = filesize($filename);
172 172
             $handle   = fopen($filename, 'r');
Please login to merge, or discard this patch.
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -19,165 +19,165 @@
 block discarded – undo
19 19
  */
20 20
 class SmartobjectAbout
21 21
 {
22
-    public $_lang_aboutTitle;
23
-    public $_lang_author_info;
24
-    public $_lang_developer_lead;
25
-    public $_lang_developer_contributor;
26
-    public $_lang_developer_website;
27
-    public $_lang_developer_email;
28
-    public $_lang_developer_credits;
29
-    public $_lang_module_info;
30
-    public $_lang_module_status;
31
-    public $_lang_module_release_date;
32
-    public $_lang_module_demo;
33
-    public $_lang_module_support;
34
-    public $_lang_module_bug;
35
-    public $_lang_module_submit_bug;
36
-    public $_lang_module_feature;
37
-    public $_lang_module_submit_feature;
38
-    public $_lang_module_disclaimer;
39
-    public $_lang_author_word;
40
-    public $_lang_version_history;
41
-    public $_lang_by;
42
-    public $_tpl;
43
-
44
-    /**
45
-     * SmartobjectAbout constructor.
46
-     * @param string $aboutTitle
47
-     */
48
-    public function __construct($aboutTitle = 'About')
49
-    {
50
-        global $xoopsModule, $xoopsConfig;
51
-
52
-        $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php';
53
-        if (file_exists($fileName)) {
54
-            require_once $fileName;
55
-        } else {
56
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php';
57
-        }
58
-        $this->_aboutTitle = $aboutTitle;
59
-
60
-        $this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR;
61
-        $this->_lang_developer_website     = _CO_SOBJECT_DEVELOPER_WEBSITE;
62
-        $this->_lang_developer_email       = _CO_SOBJECT_DEVELOPER_EMAIL;
63
-        $this->_lang_developer_credits     = _CO_SOBJECT_DEVELOPER_CREDITS;
64
-        $this->_lang_module_info           = _CO_SOBJECT_MODULE_INFO;
65
-        $this->_lang_module_status         = _CO_SOBJECT_MODULE_STATUS;
66
-        $this->_lang_module_release_date   = _CO_SOBJECT_MODULE_RELEASE_DATE;
67
-        $this->_lang_module_demo           = _CO_SOBJECT_MODULE_DEMO;
68
-        $this->_lang_module_support        = _CO_SOBJECT_MODULE_SUPPORT;
69
-        $this->_lang_module_bug            = _CO_SOBJECT_MODULE_BUG;
70
-        $this->_lang_module_submit_bug     = _CO_SOBJECT_MODULE_SUBMIT_BUG;
71
-        $this->_lang_module_feature        = _CO_SOBJECT_MODULE_FEATURE;
72
-        $this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE;
73
-        $this->_lang_module_disclaimer     = _CO_SOBJECT_MODULE_DISCLAIMER;
74
-        $this->_lang_author_word           = _CO_SOBJECT_AUTHOR_WORD;
75
-        $this->_lang_version_history       = _CO_SOBJECT_VERSION_HISTORY;
76
-    }
77
-
78
-    /**
79
-     * @param $value
80
-     * @return mixed
81
-     */
82
-    public function sanitize($value)
83
-    {
84
-        $myts = MyTextSanitizer::getInstance();
85
-
86
-        return $myts->displayTarea($value, 1);
87
-    }
88
-
89
-    public function render()
90
-    {
91
-        /**
92
-         * @todo move the output to a template
93
-         * @todo make the output XHTML compliant
94
-         */
95
-
96
-        $myts = MyTextSanitizer::getInstance();
97
-
98
-        global $xoopsModule;
99
-
100
-        smart_xoops_cp_header();
101
-
102
-        /** @var XoopsModuleHandler $moduleHandler */
103
-        $moduleHandler = xoops_getHandler('module');
104
-        $versioninfo   = $moduleHandler->get($xoopsModule->getVar('mid'));
105
-
106
-        //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name'));
107
-
108
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
109
-
110
-        // ---
111
-        // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
112
-        //      $this->_tpl = new XoopsTpl();
113
-        $this->_tpl = new XoopsTpl();
114
-        // ---
115
-
116
-        $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/');
117
-        $this->_tpl->assign('module_image', $versioninfo->getInfo('image'));
118
-        $this->_tpl->assign('module_name', $versioninfo->getInfo('name'));
119
-        $this->_tpl->assign('module_version', $versioninfo->getInfo('version'));
120
-        $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version'));
121
-
122
-        // Left headings...
123
-        if ($versioninfo->getInfo('author_realname') !== '') {
124
-            $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')';
125
-        } else {
126
-            $author_name = $versioninfo->getInfo('author');
127
-        }
128
-        $this->_tpl->assign('module_author_name', $author_name);
129
-
130
-        $this->_tpl->assign('module_license', $versioninfo->getInfo('license'));
131
-
132
-        $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits'));
133
-
134
-        // Developers Information
135
-        $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead'));
136
-        $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor'));
137
-        $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url'));
138
-        $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name'));
139
-        $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email'));
140
-
141
-        $people = $versioninfo->getInfo('people');
142
-        if ($people) {
143
-            $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map([$this, 'sanitize'], $people['developers']) : false);
144
-            $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map([$this, 'sanitize'], $people['testers']) : false);
145
-            $this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map([$this, 'sanitize'], $people['translators']) : false);
146
-            $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map([$this, 'sanitize'], $people['documenters']) : false);
147
-            $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map([$this, 'sanitize'], $people['other']) : false);
148
-        }
149
-        //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email'));
150
-
151
-        // Module Development information
152
-        $this->_tpl->assign('module_date', $versioninfo->getInfo('date'));
153
-        $this->_tpl->assign('module_status', $versioninfo->getInfo('status'));
154
-        $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url'));
155
-        $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name'));
156
-        $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url'));
157
-        $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name'));
158
-        $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug'));
159
-        $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature'));
160
-
161
-        // Warning
162
-        $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning')));
163
-
164
-        // Author's note
165
-        $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word'));
166
-
167
-        // For changelog thanks to 3Dev
168
-        global $xoopsModule;
169
-        $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt';
170
-        if (is_file($filename)) {
171
-            $filesize = filesize($filename);
172
-            $handle   = fopen($filename, 'r');
173
-            $this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true));
174
-            fclose($handle);
175
-        }
176
-
177
-        $this->_tpl->display('db:smartobject_about.tpl');
178
-
179
-        smart_modFooter();
180
-
181
-        xoops_cp_footer();
182
-    }
22
+	public $_lang_aboutTitle;
23
+	public $_lang_author_info;
24
+	public $_lang_developer_lead;
25
+	public $_lang_developer_contributor;
26
+	public $_lang_developer_website;
27
+	public $_lang_developer_email;
28
+	public $_lang_developer_credits;
29
+	public $_lang_module_info;
30
+	public $_lang_module_status;
31
+	public $_lang_module_release_date;
32
+	public $_lang_module_demo;
33
+	public $_lang_module_support;
34
+	public $_lang_module_bug;
35
+	public $_lang_module_submit_bug;
36
+	public $_lang_module_feature;
37
+	public $_lang_module_submit_feature;
38
+	public $_lang_module_disclaimer;
39
+	public $_lang_author_word;
40
+	public $_lang_version_history;
41
+	public $_lang_by;
42
+	public $_tpl;
43
+
44
+	/**
45
+	 * SmartobjectAbout constructor.
46
+	 * @param string $aboutTitle
47
+	 */
48
+	public function __construct($aboutTitle = 'About')
49
+	{
50
+		global $xoopsModule, $xoopsConfig;
51
+
52
+		$fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php';
53
+		if (file_exists($fileName)) {
54
+			require_once $fileName;
55
+		} else {
56
+			require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php';
57
+		}
58
+		$this->_aboutTitle = $aboutTitle;
59
+
60
+		$this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR;
61
+		$this->_lang_developer_website     = _CO_SOBJECT_DEVELOPER_WEBSITE;
62
+		$this->_lang_developer_email       = _CO_SOBJECT_DEVELOPER_EMAIL;
63
+		$this->_lang_developer_credits     = _CO_SOBJECT_DEVELOPER_CREDITS;
64
+		$this->_lang_module_info           = _CO_SOBJECT_MODULE_INFO;
65
+		$this->_lang_module_status         = _CO_SOBJECT_MODULE_STATUS;
66
+		$this->_lang_module_release_date   = _CO_SOBJECT_MODULE_RELEASE_DATE;
67
+		$this->_lang_module_demo           = _CO_SOBJECT_MODULE_DEMO;
68
+		$this->_lang_module_support        = _CO_SOBJECT_MODULE_SUPPORT;
69
+		$this->_lang_module_bug            = _CO_SOBJECT_MODULE_BUG;
70
+		$this->_lang_module_submit_bug     = _CO_SOBJECT_MODULE_SUBMIT_BUG;
71
+		$this->_lang_module_feature        = _CO_SOBJECT_MODULE_FEATURE;
72
+		$this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE;
73
+		$this->_lang_module_disclaimer     = _CO_SOBJECT_MODULE_DISCLAIMER;
74
+		$this->_lang_author_word           = _CO_SOBJECT_AUTHOR_WORD;
75
+		$this->_lang_version_history       = _CO_SOBJECT_VERSION_HISTORY;
76
+	}
77
+
78
+	/**
79
+	 * @param $value
80
+	 * @return mixed
81
+	 */
82
+	public function sanitize($value)
83
+	{
84
+		$myts = MyTextSanitizer::getInstance();
85
+
86
+		return $myts->displayTarea($value, 1);
87
+	}
88
+
89
+	public function render()
90
+	{
91
+		/**
92
+		 * @todo move the output to a template
93
+		 * @todo make the output XHTML compliant
94
+		 */
95
+
96
+		$myts = MyTextSanitizer::getInstance();
97
+
98
+		global $xoopsModule;
99
+
100
+		smart_xoops_cp_header();
101
+
102
+		/** @var XoopsModuleHandler $moduleHandler */
103
+		$moduleHandler = xoops_getHandler('module');
104
+		$versioninfo   = $moduleHandler->get($xoopsModule->getVar('mid'));
105
+
106
+		//smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name'));
107
+
108
+		require_once XOOPS_ROOT_PATH . '/class/template.php';
109
+
110
+		// ---
111
+		// 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
112
+		//      $this->_tpl = new XoopsTpl();
113
+		$this->_tpl = new XoopsTpl();
114
+		// ---
115
+
116
+		$this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/');
117
+		$this->_tpl->assign('module_image', $versioninfo->getInfo('image'));
118
+		$this->_tpl->assign('module_name', $versioninfo->getInfo('name'));
119
+		$this->_tpl->assign('module_version', $versioninfo->getInfo('version'));
120
+		$this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version'));
121
+
122
+		// Left headings...
123
+		if ($versioninfo->getInfo('author_realname') !== '') {
124
+			$author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')';
125
+		} else {
126
+			$author_name = $versioninfo->getInfo('author');
127
+		}
128
+		$this->_tpl->assign('module_author_name', $author_name);
129
+
130
+		$this->_tpl->assign('module_license', $versioninfo->getInfo('license'));
131
+
132
+		$this->_tpl->assign('module_credits', $versioninfo->getInfo('credits'));
133
+
134
+		// Developers Information
135
+		$this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead'));
136
+		$this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor'));
137
+		$this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url'));
138
+		$this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name'));
139
+		$this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email'));
140
+
141
+		$people = $versioninfo->getInfo('people');
142
+		if ($people) {
143
+			$this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map([$this, 'sanitize'], $people['developers']) : false);
144
+			$this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map([$this, 'sanitize'], $people['testers']) : false);
145
+			$this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map([$this, 'sanitize'], $people['translators']) : false);
146
+			$this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map([$this, 'sanitize'], $people['documenters']) : false);
147
+			$this->_tpl->assign('module_people_other', isset($people['other']) ? array_map([$this, 'sanitize'], $people['other']) : false);
148
+		}
149
+		//$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email'));
150
+
151
+		// Module Development information
152
+		$this->_tpl->assign('module_date', $versioninfo->getInfo('date'));
153
+		$this->_tpl->assign('module_status', $versioninfo->getInfo('status'));
154
+		$this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url'));
155
+		$this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name'));
156
+		$this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url'));
157
+		$this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name'));
158
+		$this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug'));
159
+		$this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature'));
160
+
161
+		// Warning
162
+		$this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning')));
163
+
164
+		// Author's note
165
+		$this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word'));
166
+
167
+		// For changelog thanks to 3Dev
168
+		global $xoopsModule;
169
+		$filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt';
170
+		if (is_file($filename)) {
171
+			$filesize = filesize($filename);
172
+			$handle   = fopen($filename, 'r');
173
+			$this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true));
174
+			fclose($handle);
175
+		}
176
+
177
+		$this->_tpl->display('db:smartobject_about.tpl');
178
+
179
+		smart_modFooter();
180
+
181
+		xoops_cp_footer();
182
+	}
183 183
 }
Please login to merge, or discard this patch.
class/smartobjecttag.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class SmartobjectTag extends SmartMlObject
37 37
 {
38
-    /**
39
-     * SmartobjectTag constructor.
40
-     */
41
-    public function __construct()
42
-    {
43
-        $this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
44
-        $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
45
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
46
-        $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
38
+	/**
39
+	 * SmartobjectTag constructor.
40
+	 */
41
+	public function __construct()
42
+	{
43
+		$this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
44
+		$this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
45
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
46
+		$this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
47 47
 
48
-        // call parent constructor to get Multilanguage field initiated
49
-        $this->SmartMlObject();
50
-    }
48
+		// call parent constructor to get Multilanguage field initiated
49
+		$this->SmartMlObject();
50
+	}
51 51
 }
52 52
 
53 53
 /**
@@ -55,27 +55,27 @@  discard block
 block discarded – undo
55 55
  */
56 56
 class SmartobjectTagHandler extends SmartPersistableMlObjectHandler
57 57
 {
58
-    /**
59
-     * SmartobjectTagHandler constructor.
60
-     * @param XoopsDatabase $db
61
-     */
62
-    public function __construct(XoopsDatabase $db)
63
-    {
64
-        parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject');
65
-    }
58
+	/**
59
+	 * SmartobjectTagHandler constructor.
60
+	 * @param XoopsDatabase $db
61
+	 */
62
+	public function __construct(XoopsDatabase $db)
63
+	{
64
+		parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject');
65
+	}
66 66
 
67
-    /**
68
-     * @return mixed
69
-     */
70
-    public function getLanguages()
71
-    {
72
-        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
73
-        $aLanguages     = XoopsLists::getLangList();
74
-        $ret['default'] = _CO_SOBJECT_ALL;
75
-        foreach ($aLanguages as $lang) {
76
-            $ret[$lang] = $lang;
77
-        }
67
+	/**
68
+	 * @return mixed
69
+	 */
70
+	public function getLanguages()
71
+	{
72
+		require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
73
+		$aLanguages     = XoopsLists::getLangList();
74
+		$ret['default'] = _CO_SOBJECT_ALL;
75
+		foreach ($aLanguages as $lang) {
76
+			$ret[$lang] = $lang;
77
+		}
78 78
 
79
-        return $ret;
80
-    }
79
+		return $ret;
80
+	}
81 81
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // -------------------------------------------------------------------------//
29 29
 
30 30
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
31
-require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartmlobject.php';
31
+require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartmlobject.php';
32 32
 
33 33
 /**
34 34
  * Class SmartobjectTag
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function getLanguages()
71 71
     {
72
-        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
72
+        require_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
73 73
         $aLanguages     = XoopsLists::getLangList();
74 74
         $ret['default'] = _CO_SOBJECT_ALL;
75 75
         foreach ($aLanguages as $lang) {
Please login to merge, or discard this patch.
class/utility.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
                 if (!mkdir($folder) && !is_dir($folder)) {
30 30
                     throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
31 31
                 } else {
32
-                    file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
32
+                    file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
33 33
                 }
34 34
             }
35 35
         } catch (Exception $e) {
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
         //    @mkdir($dst);
68 68
         while (false !== ($file = readdir($dir))) {
69 69
             if (($file !== '.') && ($file !== '..')) {
70
-                if (is_dir($src . '/' . $file)) {
71
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
70
+                if (is_dir($src.'/'.$file)) {
71
+                    self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
72 72
                 } else {
73
-                    copy($src . '/' . $file, $dst . '/' . $file);
73
+                    copy($src.'/'.$file, $dst.'/'.$file);
74 74
                 }
75 75
             }
76 76
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
98 98
         $currArray  = explode('.', $currentVer);
99 99
         if (null === $requiredVer) {
100
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
100
+            $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string
101 101
         }
102 102
         $reqArray = explode('.', $requiredVer);
103 103
         $success  = true;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     break;
113 113
                 }
114 114
             } else {
115
-                if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
115
+                if ((int) $v > 0) { // handles versions like x.x.x.0_RC2
116 116
                     $success = false;
117 117
                     break;
118 118
                 }
Please login to merge, or discard this patch.
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -5,149 +5,149 @@
 block discarded – undo
5 5
  */
6 6
 class SmartObjectUtility extends XoopsObject
7 7
 {
8
-    /**
9
-     * Function responsible for checking if a directory exists, we can also write in and create an index.html file
10
-     *
11
-     * @param string $folder The full path of the directory to check
12
-     *
13
-     * @return void
14
-     */
15
-    public static function createFolder($folder)
16
-    {
17
-        //        try {
18
-        //            if (!mkdir($folder) && !is_dir($folder)) {
19
-        //                throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
20
-        //            } else {
21
-        //                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
22
-        //            }
23
-        //        }
24
-        //        catch (Exception $e) {
25
-        //            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
26
-        //        }
27
-        try {
28
-            if (!file_exists($folder)) {
29
-                if (!mkdir($folder) && !is_dir($folder)) {
30
-                    throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
31
-                } else {
32
-                    file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
33
-                }
34
-            }
35
-        } catch (Exception $e) {
36
-            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
37
-        }
38
-    }
8
+	/**
9
+	 * Function responsible for checking if a directory exists, we can also write in and create an index.html file
10
+	 *
11
+	 * @param string $folder The full path of the directory to check
12
+	 *
13
+	 * @return void
14
+	 */
15
+	public static function createFolder($folder)
16
+	{
17
+		//        try {
18
+		//            if (!mkdir($folder) && !is_dir($folder)) {
19
+		//                throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
20
+		//            } else {
21
+		//                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
22
+		//            }
23
+		//        }
24
+		//        catch (Exception $e) {
25
+		//            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
26
+		//        }
27
+		try {
28
+			if (!file_exists($folder)) {
29
+				if (!mkdir($folder) && !is_dir($folder)) {
30
+					throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
31
+				} else {
32
+					file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
33
+				}
34
+			}
35
+		} catch (Exception $e) {
36
+			echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
37
+		}
38
+	}
39 39
 
40
-    /**
41
-     * @param $file
42
-     * @param $folder
43
-     * @return bool
44
-     */
45
-    public static function copyFile($file, $folder)
46
-    {
47
-        return copy($file, $folder);
48
-        //        try {
49
-        //            if (!is_dir($folder)) {
50
-        //                throw new \RuntimeException(sprintf('Unable to copy file as: %s ', $folder));
51
-        //            } else {
52
-        //                return copy($file, $folder);
53
-        //            }
54
-        //        } catch (Exception $e) {
55
-        //            echo 'Caught exception: ', $e->getMessage(), "\n", "<br>";
56
-        //        }
57
-        //        return false;
58
-    }
40
+	/**
41
+	 * @param $file
42
+	 * @param $folder
43
+	 * @return bool
44
+	 */
45
+	public static function copyFile($file, $folder)
46
+	{
47
+		return copy($file, $folder);
48
+		//        try {
49
+		//            if (!is_dir($folder)) {
50
+		//                throw new \RuntimeException(sprintf('Unable to copy file as: %s ', $folder));
51
+		//            } else {
52
+		//                return copy($file, $folder);
53
+		//            }
54
+		//        } catch (Exception $e) {
55
+		//            echo 'Caught exception: ', $e->getMessage(), "\n", "<br>";
56
+		//        }
57
+		//        return false;
58
+	}
59 59
 
60
-    /**
61
-     * @param $src
62
-     * @param $dst
63
-     */
64
-    public static function recurseCopy($src, $dst)
65
-    {
66
-        $dir = opendir($src);
67
-        //    @mkdir($dst);
68
-        while (false !== ($file = readdir($dir))) {
69
-            if (($file !== '.') && ($file !== '..')) {
70
-                if (is_dir($src . '/' . $file)) {
71
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
72
-                } else {
73
-                    copy($src . '/' . $file, $dst . '/' . $file);
74
-                }
75
-            }
76
-        }
77
-        closedir($dir);
78
-    }
60
+	/**
61
+	 * @param $src
62
+	 * @param $dst
63
+	 */
64
+	public static function recurseCopy($src, $dst)
65
+	{
66
+		$dir = opendir($src);
67
+		//    @mkdir($dst);
68
+		while (false !== ($file = readdir($dir))) {
69
+			if (($file !== '.') && ($file !== '..')) {
70
+				if (is_dir($src . '/' . $file)) {
71
+					self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
72
+				} else {
73
+					copy($src . '/' . $file, $dst . '/' . $file);
74
+				}
75
+			}
76
+		}
77
+		closedir($dir);
78
+	}
79 79
 
80
-    /**
81
-     *
82
-     * Verifies XOOPS version meets minimum requirements for this module
83
-     * @static
84
-     * @param XoopsModule $module
85
-     *
86
-     * @param null|string $requiredVer
87
-     * @return bool true if meets requirements, false if not
88
-     */
89
-    public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
90
-    {
91
-        $moduleDirName = basename(dirname(__DIR__));
92
-        if (null === $module) {
93
-            $module = XoopsModule::getByDirname($moduleDirName);
94
-        }
95
-        xoops_loadLanguage('admin', $moduleDirName);
96
-        //check for minimum XOOPS version
97
-        $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
98
-        $currArray  = explode('.', $currentVer);
99
-        if (null === $requiredVer) {
100
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
101
-        }
102
-        $reqArray = explode('.', $requiredVer);
103
-        $success  = true;
104
-        foreach ($reqArray as $k => $v) {
105
-            if (isset($currArray[$k])) {
106
-                if ($currArray[$k] > $v) {
107
-                    break;
108
-                } elseif ($currArray[$k] == $v) {
109
-                    continue;
110
-                } else {
111
-                    $success = false;
112
-                    break;
113
-                }
114
-            } else {
115
-                if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
116
-                    $success = false;
117
-                    break;
118
-                }
119
-            }
120
-        }
80
+	/**
81
+	 *
82
+	 * Verifies XOOPS version meets minimum requirements for this module
83
+	 * @static
84
+	 * @param XoopsModule $module
85
+	 *
86
+	 * @param null|string $requiredVer
87
+	 * @return bool true if meets requirements, false if not
88
+	 */
89
+	public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
90
+	{
91
+		$moduleDirName = basename(dirname(__DIR__));
92
+		if (null === $module) {
93
+			$module = XoopsModule::getByDirname($moduleDirName);
94
+		}
95
+		xoops_loadLanguage('admin', $moduleDirName);
96
+		//check for minimum XOOPS version
97
+		$currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
98
+		$currArray  = explode('.', $currentVer);
99
+		if (null === $requiredVer) {
100
+			$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
101
+		}
102
+		$reqArray = explode('.', $requiredVer);
103
+		$success  = true;
104
+		foreach ($reqArray as $k => $v) {
105
+			if (isset($currArray[$k])) {
106
+				if ($currArray[$k] > $v) {
107
+					break;
108
+				} elseif ($currArray[$k] == $v) {
109
+					continue;
110
+				} else {
111
+					$success = false;
112
+					break;
113
+				}
114
+			} else {
115
+				if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
116
+					$success = false;
117
+					break;
118
+				}
119
+			}
120
+		}
121 121
 
122
-        if (false === $success) {
123
-            $module->setErrors(sprintf(_AM_SOBJECT_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
124
-        }
122
+		if (false === $success) {
123
+			$module->setErrors(sprintf(_AM_SOBJECT_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
124
+		}
125 125
 
126
-        return $success;
127
-    }
126
+		return $success;
127
+	}
128 128
 
129
-    /**
130
-     *
131
-     * Verifies PHP version meets minimum requirements for this module
132
-     * @static
133
-     * @param XoopsModule $module
134
-     *
135
-     * @return bool true if meets requirements, false if not
136
-     */
137
-    public static function checkVerPhp(XoopsModule $module)
138
-    {
139
-        xoops_loadLanguage('admin', $module->dirname());
140
-        // check for minimum PHP version
141
-        $success = true;
142
-        $verNum  = PHP_VERSION;
143
-        $reqVer  = $module->getInfo('min_php');
144
-        if (false !== $reqVer && '' !== $reqVer) {
145
-            if (version_compare($verNum, $reqVer, '<')) {
146
-                $module->setErrors(sprintf(_AM_SOBJECT_ERROR_BAD_PHP, $reqVer, $verNum));
147
-                $success = false;
148
-            }
149
-        }
129
+	/**
130
+	 *
131
+	 * Verifies PHP version meets minimum requirements for this module
132
+	 * @static
133
+	 * @param XoopsModule $module
134
+	 *
135
+	 * @return bool true if meets requirements, false if not
136
+	 */
137
+	public static function checkVerPhp(XoopsModule $module)
138
+	{
139
+		xoops_loadLanguage('admin', $module->dirname());
140
+		// check for minimum PHP version
141
+		$success = true;
142
+		$verNum  = PHP_VERSION;
143
+		$reqVer  = $module->getInfo('min_php');
144
+		if (false !== $reqVer && '' !== $reqVer) {
145
+			if (version_compare($verNum, $reqVer, '<')) {
146
+				$module->setErrors(sprintf(_AM_SOBJECT_ERROR_BAD_PHP, $reqVer, $verNum));
147
+				$success = false;
148
+			}
149
+		}
150 150
 
151
-        return $success;
152
-    }
151
+		return $success;
152
+	}
153 153
 }
Please login to merge, or discard this patch.
class/smartprinterfriendly.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -15,65 +15,65 @@
 block discarded – undo
15 15
  */
16 16
 class SmartPrinterFriendly
17 17
 {
18
-    public $_title;
19
-    public $_dsc;
20
-    public $_content;
21
-    public $_tpl;
22
-    public $_pageTitle = false;
23
-    public $_width     = 680;
18
+	public $_title;
19
+	public $_dsc;
20
+	public $_content;
21
+	public $_tpl;
22
+	public $_pageTitle = false;
23
+	public $_width     = 680;
24 24
 
25
-    /**
26
-     * SmartPrinterFriendly constructor.
27
-     * @param      $content
28
-     * @param bool $title
29
-     * @param bool $dsc
30
-     */
31
-    public function __construct($content, $title = false, $dsc = false)
32
-    {
33
-        $this->_title   = $title;
34
-        $this->_dsc     = $dsc;
35
-        $this->_content = $content;
36
-    }
25
+	/**
26
+	 * SmartPrinterFriendly constructor.
27
+	 * @param      $content
28
+	 * @param bool $title
29
+	 * @param bool $dsc
30
+	 */
31
+	public function __construct($content, $title = false, $dsc = false)
32
+	{
33
+		$this->_title   = $title;
34
+		$this->_dsc     = $dsc;
35
+		$this->_content = $content;
36
+	}
37 37
 
38
-    public function render()
39
-    {
40
-        /**
41
-         * @todo move the output to a template
42
-         * @todo make the output XHTML compliant
43
-         */
38
+	public function render()
39
+	{
40
+		/**
41
+		 * @todo move the output to a template
42
+		 * @todo make the output XHTML compliant
43
+		 */
44 44
 
45
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
45
+		require_once XOOPS_ROOT_PATH . '/class/template.php';
46 46
 
47
-        $this->_tpl = new XoopsTpl();
47
+		$this->_tpl = new XoopsTpl();
48 48
 
49
-        $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title);
50
-        $this->_tpl->assign('smartobject_print_title', $this->_title);
51
-        $this->_tpl->assign('smartobject_print_dsc', $this->_dsc);
52
-        $this->_tpl->assign('smartobject_print_content', $this->_content);
53
-        $this->_tpl->assign('smartobject_print_width', $this->_width);
49
+		$this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title);
50
+		$this->_tpl->assign('smartobject_print_title', $this->_title);
51
+		$this->_tpl->assign('smartobject_print_dsc', $this->_dsc);
52
+		$this->_tpl->assign('smartobject_print_content', $this->_content);
53
+		$this->_tpl->assign('smartobject_print_width', $this->_width);
54 54
 
55
-        $current_urls = smart_getCurrentUrls();
56
-        $current_url  = $current_urls['full'];
55
+		$current_urls = smart_getCurrentUrls();
56
+		$current_url  = $current_urls['full'];
57 57
 
58
-        $this->_tpl->assign('smartobject_print_currenturl', $current_url);
59
-        $this->_tpl->assign('smartobject_print_url', $this->url);
58
+		$this->_tpl->assign('smartobject_print_currenturl', $current_url);
59
+		$this->_tpl->assign('smartobject_print_url', $this->url);
60 60
 
61
-        $this->_tpl->display('db:smartobject_print.tpl');
62
-    }
61
+		$this->_tpl->display('db:smartobject_print.tpl');
62
+	}
63 63
 
64
-    /**
65
-     * @param $text
66
-     */
67
-    public function setPageTitle($text)
68
-    {
69
-        $this->_pageTitle = $text;
70
-    }
64
+	/**
65
+	 * @param $text
66
+	 */
67
+	public function setPageTitle($text)
68
+	{
69
+		$this->_pageTitle = $text;
70
+	}
71 71
 
72
-    /**
73
-     * @param $width
74
-     */
75
-    public function setWidth($width)
76
-    {
77
-        $this->_width = $width;
78
-    }
72
+	/**
73
+	 * @param $width
74
+	 */
75
+	public function setWidth($width)
76
+	{
77
+		$this->_width = $width;
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
          * @todo make the output XHTML compliant
43 43
          */
44 44
 
45
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
45
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
46 46
 
47 47
         $this->_tpl = new XoopsTpl();
48 48
 
Please login to merge, or discard this patch.
class/smartloader.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,6 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@
 block discarded – undo
13 13
 
14 14
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
15 15
 
16
-require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php';
16
+require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php';
17 17
 
18 18
 /**
19 19
  * Include other classes used by the SmartObject
20 20
  */
21
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecthandler.php';
22
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobject.php';
23
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectsregistry.php';
21
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecthandler.php';
22
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobject.php';
23
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectsregistry.php';
24 24
 
25 25
 /**
26 26
  * Including SmartHook feature
27 27
  */
28 28
 
29
-require_once SMARTOBJECT_ROOT_PATH . 'class/smarthookhandler.php';
29
+require_once SMARTOBJECT_ROOT_PATH.'class/smarthookhandler.php';
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');
Please login to merge, or discard this patch.
blocks/addto.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
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';
11
+    require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php';
12
+    require_once SMARTOBJECT_ROOT_PATH.'class/smartaddto.php';
13 13
     $smartaddto = new SmartAddTo($options[0]);
14 14
     $block      = $smartaddto->renderForBlock();
15 15
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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 27
     $form = '';
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1);
32 32
     $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2);
33 33
     $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3);
34
-    $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>';
34
+    $form .= $layout_select->getCaption().' '.$layout_select->render().'<br>';
35 35
 
36 36
     return $form;
37 37
 }
Please login to merge, or discard this patch.
sendlink.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * Licence: GNU
8 8
  */
9 9
 
10
-require_once __DIR__ . '/header.php';
11
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartloader.php';
12
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectlink.php';
13
-require_once XOOPS_ROOT_PATH . '/class/template.php';
10
+require_once __DIR__.'/header.php';
11
+require_once SMARTOBJECT_ROOT_PATH.'class/smartloader.php';
12
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectlink.php';
13
+require_once XOOPS_ROOT_PATH.'/class/template.php';
14 14
 
15 15
 $xoopsTpl                = new XoopsTpl();
16 16
 $myts                    = MyTextSanitizer::getInstance();
17 17
 $xoopsConfig['sitename'] = $myts->displayTarea($xoopsConfig['sitename']);
18 18
 
19 19
 xoops_header(false);
20
-echo smart_get_css_link(SMARTOBJECT_URL . 'assets/css/module.css');
20
+echo smart_get_css_link(SMARTOBJECT_URL.'assets/css/module.css');
21 21
 echo '</head><body>';
22 22
 
23 23
 $smartobjectLinkHandler = xoops_getModuleHandler('link', 'smartobject');
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 switch ($op) {
29 29
     case 'sendlink':
30 30
 
31
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
31
+        require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobjectcontroller.php';
32 32
         $controller = new SmartObjectController($smartobjectLinkHandler);
33 33
 
34 34
         $linkObj = $controller->storeSmartObject();
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 
41 41
         $xoopsMailer = xoops_getMailer();
42 42
         $xoopsMailer->useMail();
43
-        $xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template');
43
+        $xoopsMailer->setTemplateDir('language/'.$xoopsConfig['language'].'/mail_template');
44 44
 
45 45
         $xoopsMailer->setTemplate('sendlink.tpl');
46 46
         $xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
47 47
         $xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name'));
48 48
         $xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name'));
49
-        $xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
49
+        $xoopsMailer->assign('SITEURL', XOOPS_URL.'/');
50 50
         $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
51 51
         $xoopsMailer->assign('MESSAGE', $_POST['body']);
52 52
         $xoopsMailer->setToEmails($linkObj->getVar('to_email'));
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename'])));
56 56
 
57 57
         if (!$xoopsMailer->send(true)) {
58
-            $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true));
58
+            $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']).'<br>'.$xoopsMailer->getErrors(true));
59 59
         } else {
60 60
             $xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS);
61 61
         }
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -26,82 +26,82 @@
 block discarded – undo
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(['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(['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');
Please login to merge, or discard this patch.
admin/admin_header2.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * Licence: GNU
8 8
  */
9 9
 
10
-require_once __DIR__ . '/../../../include/cp_header.php';
10
+require_once __DIR__.'/../../../include/cp_header.php';
11 11
 
12
-require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php';
12
+require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php';
13 13
 smart_loadCommonLanguageFile();
Please login to merge, or discard this patch.