@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | */ |
22 | 22 | |
23 | -require_once __DIR__ . '/../../include/common.php'; |
|
23 | +require_once __DIR__.'/../../include/common.php'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Class Configurator |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | class Configurator |
29 | 29 | { |
30 | 30 | public $uploadFolders = []; |
31 | - public $blankFiles = []; |
|
31 | + public $blankFiles = []; |
|
32 | 32 | public $templateFolders = []; |
33 | 33 | public $oldFiles = []; |
34 | 34 | public $oldFolders = []; |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | $capsDirName = strtoupper($moduleDirName); |
44 | 44 | $this->name = 'Module Configurator'; |
45 | 45 | $this->uploadFolders = [ |
46 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
47 | - constant($capsDirName . '_UPLOAD_PATH') . '/content', |
|
48 | - constant($capsDirName . '_UPLOAD_PATH') . '/images', |
|
49 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/category', |
|
50 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/thumbnails', |
|
46 | + constant($capsDirName.'_UPLOAD_PATH'), |
|
47 | + constant($capsDirName.'_UPLOAD_PATH').'/content', |
|
48 | + constant($capsDirName.'_UPLOAD_PATH').'/images', |
|
49 | + constant($capsDirName.'_UPLOAD_PATH').'/images/category', |
|
50 | + constant($capsDirName.'_UPLOAD_PATH').'/images/thumbnails', |
|
51 | 51 | ]; |
52 | 52 | $this->blankFiles = [ |
53 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
54 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/category', |
|
55 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/thumbnails', |
|
53 | + constant($capsDirName.'_UPLOAD_PATH'), |
|
54 | + constant($capsDirName.'_UPLOAD_PATH').'/images/category', |
|
55 | + constant($capsDirName.'_UPLOAD_PATH').'/images/thumbnails', |
|
56 | 56 | ]; |
57 | 57 | |
58 | 58 | $this->templateFolders = [ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | '/templates/admin/' |
62 | 62 | |
63 | 63 | ]; |
64 | - $this->oldFiles = [ |
|
64 | + $this->oldFiles = [ |
|
65 | 65 | '/class/request.php', |
66 | 66 | '/class/registry.php', |
67 | 67 | '/class/utilities.php', |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | '/include/functions.php', |
71 | 71 | '/ajaxrating.txt' |
72 | 72 | ]; |
73 | - $this->oldFolders = [ |
|
73 | + $this->oldFolders = [ |
|
74 | 74 | '/images', |
75 | 75 | '/css', |
76 | 76 | '/js', |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | //check for minimum XOOPS version |
38 | 38 | $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
39 | 39 | if (null === $requiredVer) { |
40 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
40 | + $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string |
|
41 | 41 | } |
42 | - $success = true; |
|
42 | + $success = true; |
|
43 | 43 | |
44 | 44 | if (version_compare($currentVer, $requiredVer, '<')) { |
45 | - $success = false; |
|
46 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
45 | + $success = false; |
|
46 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | return $success; |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | // check for minimum PHP version |
64 | 64 | $success = true; |
65 | 65 | $verNum = PHP_VERSION; |
66 | - $reqVer =& $module->getInfo('min_php'); |
|
66 | + $reqVer = & $module->getInfo('min_php'); |
|
67 | 67 | if (false !== $reqVer && '' !== $reqVer) { |
68 | 68 | if (version_compare($verNum, $reqVer, '<')) { |
69 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
69 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
70 | 70 | $success = false; |
71 | 71 | } |
72 | 72 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | require_once $GLOBALS['xoops']->path('class/template.php'); |
71 | 71 | $breadcrumbTpl = new \XoopsTpl(); |
72 | 72 | $breadcrumbTpl->assign('breadcrumb', $this->bread); |
73 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
73 | + $html = $breadcrumbTpl->fetch('db:'.$this->dirname.'_common_breadcrumb.tpl'); |
|
74 | 74 | unset($breadcrumbTpl); |
75 | 75 | |
76 | 76 | return $html; |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | // $sql .= " WHERE metakey='version' LIMIT 1"; |
35 | 35 | // $query = $GLOBALS['xoopsDB']->query($sql); |
36 | 36 | // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
37 | - $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
37 | + $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>".constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO')."</legend>\n"; |
|
38 | 38 | $html .= "<div style='padding: 8px;'>\n"; |
39 | 39 | // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
40 | 40 | // $html .= "<br>\n"; |
41 | 41 | // $html .= "<br>\n"; |
42 | - $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
42 | + $html .= '<div>'.constant('CO_'.$moduleDirNameUpper.'_SPHPINI')."</div>\n"; |
|
43 | 43 | $html .= "<ul>\n"; |
44 | 44 | // |
45 | - $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
46 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
45 | + $gdlib = function_exists('gd_info') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>'; |
|
46 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib; |
|
47 | 47 | if (function_exists('gd_info')) { |
48 | 48 | if (true === ($gdlib = gd_info())) { |
49 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
49 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | // |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
57 | 57 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
58 | 58 | // |
59 | - $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
60 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
59 | + $downloads = ini_get('file_uploads') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>'; |
|
60 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads; |
|
61 | 61 | // |
62 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
|
63 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
|
64 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n"; |
|
62 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: blue;">'.ini_get('upload_max_filesize')."</span></b>\n"; |
|
63 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: blue;">'.ini_get('post_max_size')."</span></b>\n"; |
|
64 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: blue;">'.ini_get('memory_limit')."</span></b>\n"; |
|
65 | 65 | $html .= "</ul>\n"; |
66 | 66 | $html .= "<ul>\n"; |
67 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
67 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH."</b>\n"; |
|
68 | 68 | $html .= "</ul>\n"; |
69 | 69 | $html .= "<br>\n"; |
70 | - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
70 | + $html .= constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC')."\n"; |
|
71 | 71 | $html .= '</div>'; |
72 | 72 | $html .= '</fieldset><br>'; |
73 | 73 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
34 | 34 | } |
35 | 35 | |
36 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
36 | + file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>'); |
|
37 | 37 | } |
38 | 38 | } catch (\Exception $e) { |
39 | 39 | echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | if (!mkdir($dst) && !is_dir($dst)) { |
62 | 62 | while (false !== ($file = readdir($dir))) { |
63 | 63 | if (('.' !== $file) && ('..' !== $file)) { |
64 | - if (is_dir($src . '/' . $file)) { |
|
65 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
64 | + if (is_dir($src.'/'.$file)) { |
|
65 | + self::recurseCopy($src.'/'.$file, $dst.'/'.$file); |
|
66 | 66 | } else { |
67 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
67 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | self::rrmdir($fObj->getPathname()); |
160 | 160 | } |
161 | 161 | } |
162 | - $iterator = null; // clear iterator Obj to close file/directory |
|
162 | + $iterator = null; // clear iterator Obj to close file/directory |
|
163 | 163 | return rmdir($src); // remove the directory & return results |
164 | 164 | } |
165 | 165 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | $iterator = new \DirectoryIterator($src); |
193 | 193 | foreach ($iterator as $fObj) { |
194 | 194 | if ($fObj->isFile()) { |
195 | - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
195 | + rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
196 | 196 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
197 | 197 | // Try recursively on directory |
198 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
198 | + self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
199 | 199 | // rmdir($fObj->getPath()); // now delete the directory |
200 | 200 | } |
201 | 201 | } |
202 | - $iterator = null; // clear iterator Obj to close file/directory |
|
202 | + $iterator = null; // clear iterator Obj to close file/directory |
|
203 | 203 | return rmdir($src); // remove the directory & return results |
204 | 204 | } |
205 | 205 | |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | $iterator = new \DirectoryIterator($src); |
236 | 236 | foreach ($iterator as $fObj) { |
237 | 237 | if ($fObj->isFile()) { |
238 | - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
238 | + copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
239 | 239 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
240 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
240 | + self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | return true; |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getFirstChild($selectId, $order = '') |
69 | 69 | { |
70 | - $selectId = (int)$selectId; |
|
70 | + $selectId = (int) $selectId; |
|
71 | 71 | $arr = []; |
72 | - $sql = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . ''; |
|
72 | + $sql = 'SELECT * FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.''; |
|
73 | 73 | if ('' !== $order) { |
74 | 74 | $sql .= " ORDER BY $order"; |
75 | 75 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getFirstChildId($selectId) |
96 | 96 | { |
97 | - $selectId = (int)$selectId; |
|
97 | + $selectId = (int) $selectId; |
|
98 | 98 | $idarray = []; |
99 | - $result = $this->db->query('SELECT ' . $this->id . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . ''); |
|
99 | + $result = $this->db->query('SELECT '.$this->id.' FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.''); |
|
100 | 100 | $count = $this->db->getRowsNum($result); |
101 | 101 | if (0 == $count) { |
102 | 102 | return $idarray; |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getAllChildId($selectId, $order = '', array $idarray = []) |
121 | 121 | { |
122 | - $selectId = (int)$selectId; |
|
123 | - $sql = 'SELECT ' . $this->id . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . ''; |
|
122 | + $selectId = (int) $selectId; |
|
123 | + $sql = 'SELECT '.$this->id.' FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.''; |
|
124 | 124 | if ('' !== $order) { |
125 | 125 | $sql .= " ORDER BY $order"; |
126 | 126 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getAllParentId($selectId, $order = '', array $idarray = []) |
150 | 150 | { |
151 | - $selectId = (int)$selectId; |
|
152 | - $sql = 'SELECT ' . $this->pid . ' FROM ' . $this->table . ' WHERE ' . $this->id . '=' . $selectId . ''; |
|
151 | + $selectId = (int) $selectId; |
|
152 | + $sql = 'SELECT '.$this->pid.' FROM '.$this->table.' WHERE '.$this->id.'='.$selectId.''; |
|
153 | 153 | if ('' !== $order) { |
154 | 154 | $sql .= " ORDER BY $order"; |
155 | 155 | } |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getPathFromId($selectId, $title, $path = '') |
177 | 177 | { |
178 | - $selectId = (int)$selectId; |
|
179 | - $result = $this->db->query('SELECT ' . $this->pid . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->id . "=$selectId"); |
|
178 | + $selectId = (int) $selectId; |
|
179 | + $result = $this->db->query('SELECT '.$this->pid.', '.$title.' FROM '.$this->table.' WHERE '.$this->id."=$selectId"); |
|
180 | 180 | if (0 == $this->db->getRowsNum($result)) { |
181 | 181 | return $path; |
182 | 182 | } |
183 | 183 | list($parentid, $name) = $this->db->fetchRow($result); |
184 | 184 | $myts = \MyTextSanitizer::getInstance(); |
185 | 185 | $name = $myts->htmlspecialchars($name); |
186 | - $path = '/' . $name . $path . ''; |
|
186 | + $path = '/'.$name.$path.''; |
|
187 | 187 | if (0 == $parentid) { |
188 | 188 | return $path; |
189 | 189 | } |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | $sel_name = $this->id; |
210 | 210 | } |
211 | 211 | $myts = \MyTextSanitizer::getInstance(); |
212 | - echo "<select name='" . $sel_name . "'"; |
|
212 | + echo "<select name='".$sel_name."'"; |
|
213 | 213 | if ('' !== $onchange) { |
214 | - echo " onchange='" . $onchange . "'"; |
|
214 | + echo " onchange='".$onchange."'"; |
|
215 | 215 | } |
216 | 216 | echo ">\n"; |
217 | - $sql = 'SELECT ' . $this->id . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=0'; |
|
217 | + $sql = 'SELECT '.$this->id.', '.$title.' FROM '.$this->table.' WHERE '.$this->pid.'=0'; |
|
218 | 218 | if ('' !== $order) { |
219 | 219 | $sql .= " ORDER BY $order"; |
220 | 220 | } |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | $arr = $this->getChildTreeArray($catid, $order); |
233 | 233 | foreach ($arr as $option) { |
234 | 234 | $option['prefix'] = str_replace('.', '--', $option['prefix']); |
235 | - $catpath = $option['prefix'] . ' ' . $myts->htmlspecialchars($option[$title]); |
|
235 | + $catpath = $option['prefix'].' '.$myts->htmlspecialchars($option[$title]); |
|
236 | 236 | if ($option[$this->id] == $preset_id) { |
237 | 237 | $sel = " selected='selected'"; |
238 | 238 | } |
239 | - echo "<option value='" . $option[$this->id] . "'$sel>$catpath</option>\n"; |
|
239 | + echo "<option value='".$option[$this->id]."'$sel>$catpath</option>\n"; |
|
240 | 240 | $sel = ''; |
241 | 241 | } |
242 | 242 | } |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | public function getNicePathFromId($selectId, $title, $funcURL, $path = '') |
257 | 257 | { |
258 | 258 | $path = !empty($path) ? $path : $path; |
259 | - $selectId = (int)$selectId; |
|
260 | - $sql = 'SELECT ' . $this->pid . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->id . "=$selectId"; |
|
259 | + $selectId = (int) $selectId; |
|
260 | + $sql = 'SELECT '.$this->pid.', '.$title.' FROM '.$this->table.' WHERE '.$this->id."=$selectId"; |
|
261 | 261 | $result = $this->db->query($sql); |
262 | 262 | if (0 == $this->db->getRowsNum($result)) { |
263 | 263 | return $path; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | list($parentid, $name) = $this->db->fetchRow($result); |
266 | 266 | $myts = \MyTextSanitizer::getInstance(); |
267 | 267 | $name = $myts->htmlspecialchars($name); |
268 | - $path = "<li><a href='" . $funcURL . '&' . $this->id . '=' . $selectId . "'>" . $name . '</a></li>' . $path . ''; |
|
268 | + $path = "<li><a href='".$funcURL.'&'.$this->id.'='.$selectId."'>".$name.'</a></li>'.$path.''; |
|
269 | 269 | if (0 == $parentid) { |
270 | 270 | return $path; |
271 | 271 | } |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function getIdPathFromId($selectId, $path = '') |
286 | 286 | { |
287 | - $selectId = (int)$selectId; |
|
288 | - $result = $this->db->query('SELECT ' . $this->pid . ' FROM ' . $this->table . ' WHERE ' . $this->id . "=$selectId"); |
|
287 | + $selectId = (int) $selectId; |
|
288 | + $result = $this->db->query('SELECT '.$this->pid.' FROM '.$this->table.' WHERE '.$this->id."=$selectId"); |
|
289 | 289 | if (0 == $this->db->getRowsNum($result)) { |
290 | 290 | return $path; |
291 | 291 | } |
292 | 292 | list($parentid) = $this->db->fetchRow($result); |
293 | - $path = '/' . $selectId . $path . ''; |
|
293 | + $path = '/'.$selectId.$path.''; |
|
294 | 294 | if (0 == $parentid) { |
295 | 295 | return $path; |
296 | 296 | } |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function getAllChild($selectId = 0, $order = '', array $parray = []) |
312 | 312 | { |
313 | - $selectId = (int)$selectId; |
|
314 | - $sql = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . ''; |
|
313 | + $selectId = (int) $selectId; |
|
314 | + $sql = 'SELECT * FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.''; |
|
315 | 315 | if ('' !== $order) { |
316 | 316 | $sql .= " ORDER BY $order"; |
317 | 317 | } |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getChildTreeArray($selectId = 0, $order = '', array $parray = [], $r_prefix = '') |
342 | 342 | { |
343 | - $selectId = (int)$selectId; |
|
344 | - $sql = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . ''; |
|
343 | + $selectId = (int) $selectId; |
|
344 | + $sql = 'SELECT * FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.''; |
|
345 | 345 | if ('' !== $order) { |
346 | 346 | $sql .= " ORDER BY $order"; |
347 | 347 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | return $parray; |
352 | 352 | } |
353 | 353 | while (false !== ($row = $this->db->fetchArray($result))) { |
354 | - $row['prefix'] = $r_prefix . '.'; |
|
354 | + $row['prefix'] = $r_prefix.'.'; |
|
355 | 355 | array_push($parray, $row); |
356 | 356 | $parray = $this->getChildTreeArray($row[$this->id], $order, $parray, $row['prefix']); |
357 | 357 | } |
@@ -52,153 +52,153 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | switch ($op) { |
55 | - case 'preview': |
|
55 | + case 'preview': |
|
56 | 56 | |
57 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
57 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
58 | 58 | |
59 | - $faqObj = $faqHandler->create(); |
|
60 | - $answerObj = $answerHandler->create(); |
|
61 | - $categoryObj = $categoryHandler->get($_POST['categoryid']); |
|
59 | + $faqObj = $faqHandler->create(); |
|
60 | + $answerObj = $answerHandler->create(); |
|
61 | + $categoryObj = $categoryHandler->get($_POST['categoryid']); |
|
62 | 62 | |
63 | - if (!$xoopsUser) { |
|
64 | - if (1 == $xoopsModuleConfig['anonpost']) { |
|
65 | - $uid = 0; |
|
63 | + if (!$xoopsUser) { |
|
64 | + if (1 == $xoopsModuleConfig['anonpost']) { |
|
65 | + $uid = 0; |
|
66 | + } else { |
|
67 | + redirect_header('index.php', 3, _NOPERM); |
|
68 | + } |
|
66 | 69 | } else { |
67 | - redirect_header('index.php', 3, _NOPERM); |
|
70 | + $uid = $xoopsUser->uid(); |
|
68 | 71 | } |
69 | - } else { |
|
70 | - $uid = $xoopsUser->uid(); |
|
71 | - } |
|
72 | 72 | |
73 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
73 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
74 | 74 | |
75 | - // Putting the values about the FAQ in the FAQ object |
|
76 | - $faqObj->setVar('categoryid', $_POST['categoryid']); |
|
77 | - $faqObj->setVar('uid', $uid); |
|
78 | - $faqObj->setVar('question', $_POST['question']); |
|
79 | - $faqObj->setVar('howdoi', $_POST['howdoi']); |
|
80 | - $faqObj->setVar('diduno', $_POST['diduno']); |
|
81 | - $faqObj->setVar('datesub', time()); |
|
75 | + // Putting the values about the FAQ in the FAQ object |
|
76 | + $faqObj->setVar('categoryid', $_POST['categoryid']); |
|
77 | + $faqObj->setVar('uid', $uid); |
|
78 | + $faqObj->setVar('question', $_POST['question']); |
|
79 | + $faqObj->setVar('howdoi', $_POST['howdoi']); |
|
80 | + $faqObj->setVar('diduno', $_POST['diduno']); |
|
81 | + $faqObj->setVar('datesub', time()); |
|
82 | 82 | |
83 | - // Putting the values in the answer object |
|
84 | - $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED); |
|
85 | - $answerObj->setVar('faqid', $faqObj->faqid()); |
|
86 | - $answerObj->setVar('answer', $_POST['answer']); |
|
87 | - $answerObj->setVar('uid', $uid); |
|
83 | + // Putting the values in the answer object |
|
84 | + $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED); |
|
85 | + $answerObj->setVar('faqid', $faqObj->faqid()); |
|
86 | + $answerObj->setVar('answer', $_POST['answer']); |
|
87 | + $answerObj->setVar('uid', $uid); |
|
88 | 88 | |
89 | - global $xoopsUser, $myts; |
|
89 | + global $xoopsUser, $myts; |
|
90 | 90 | |
91 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
92 | - require_once XOOPS_ROOT_PATH . '/header.php'; |
|
93 | - require_once __DIR__ . '/footer.php'; |
|
91 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
92 | + require_once XOOPS_ROOT_PATH . '/header.php'; |
|
93 | + require_once __DIR__ . '/footer.php'; |
|
94 | 94 | |
95 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
95 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
96 | 96 | |
97 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
98 | - $faq = $faqObj->toArray(null, $categoryObj, false); |
|
99 | - $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
|
100 | - $faq['answer'] = $answerObj->answer(); |
|
101 | - $faq['who_when'] = $faqObj->getWhoAndWhen(); |
|
97 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
98 | + $faq = $faqObj->toArray(null, $categoryObj, false); |
|
99 | + $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
|
100 | + $faq['answer'] = $answerObj->answer(); |
|
101 | + $faq['who_when'] = $faqObj->getWhoAndWhen(); |
|
102 | 102 | |
103 | - $faq['comments'] = -1; |
|
104 | - $xoopsTpl->assign('faq', $faq); |
|
105 | - $xoopsTpl->assign('op', 'preview'); |
|
106 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
107 | - $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
103 | + $faq['comments'] = -1; |
|
104 | + $xoopsTpl->assign('faq', $faq); |
|
105 | + $xoopsTpl->assign('op', 'preview'); |
|
106 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
107 | + $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
108 | 108 | |
109 | - $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
110 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
109 | + $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
110 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
111 | 111 | |
112 | - require_once __DIR__ . '/include/submit.inc.php'; |
|
112 | + require_once __DIR__ . '/include/submit.inc.php'; |
|
113 | 113 | |
114 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
114 | + require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
115 | 115 | |
116 | - exit(); |
|
117 | - break; |
|
116 | + exit(); |
|
117 | + break; |
|
118 | 118 | |
119 | - case 'post': |
|
119 | + case 'post': |
|
120 | 120 | |
121 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
121 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
122 | 122 | |
123 | - $newFaqObj = $faqHandler->create(); |
|
124 | - $newAnswerObj = $answerHandler->create(); |
|
123 | + $newFaqObj = $faqHandler->create(); |
|
124 | + $newAnswerObj = $answerHandler->create(); |
|
125 | 125 | |
126 | - if (!$xoopsUser) { |
|
127 | - if (1 == $xoopsModuleConfig['anonpost']) { |
|
128 | - $uid = 0; |
|
126 | + if (!$xoopsUser) { |
|
127 | + if (1 == $xoopsModuleConfig['anonpost']) { |
|
128 | + $uid = 0; |
|
129 | + } else { |
|
130 | + redirect_header('index.php', 3, _NOPERM); |
|
131 | + } |
|
129 | 132 | } else { |
130 | - redirect_header('index.php', 3, _NOPERM); |
|
133 | + $uid = $xoopsUser->uid(); |
|
131 | 134 | } |
132 | - } else { |
|
133 | - $uid = $xoopsUser->uid(); |
|
134 | - } |
|
135 | - |
|
136 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
137 | - |
|
138 | - // Putting the values about the FAQ in the FAQ object |
|
139 | - $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
140 | - $newFaqObj->setVar('uid', $uid); |
|
141 | - $newFaqObj->setVar('question', $_POST['question']); |
|
142 | - $newFaqObj->setVar('howdoi', $_POST['howdoi']); |
|
143 | - $newFaqObj->setVar('diduno', $_POST['diduno']); |
|
144 | - $newFaqObj->setVar('notifypub', $notifypub); |
|
145 | - //$newFaqObj->setVar('modulelink', $_POST['modulelink']); |
|
146 | - //$newFaqObj->setVar('contextpage', $_POST['contextpage']); |
|
147 | 135 | |
148 | - // Setting the status of the FAQ |
|
149 | - |
|
150 | - // if user is admin, FAQ are automatically published |
|
151 | - $isAdmin = Smartfaq\Utility::userIsAdmin(); |
|
152 | - if ($isAdmin) { |
|
153 | - $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED); |
|
154 | - } elseif (1 == $xoopsModuleConfig['autoapprove_submitted_faq']) { |
|
155 | - $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED); |
|
156 | - } else { |
|
157 | - $newFaqObj->setVar('status', Constants::SF_STATUS_SUBMITTED); |
|
158 | - } |
|
136 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
137 | + |
|
138 | + // Putting the values about the FAQ in the FAQ object |
|
139 | + $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
140 | + $newFaqObj->setVar('uid', $uid); |
|
141 | + $newFaqObj->setVar('question', $_POST['question']); |
|
142 | + $newFaqObj->setVar('howdoi', $_POST['howdoi']); |
|
143 | + $newFaqObj->setVar('diduno', $_POST['diduno']); |
|
144 | + $newFaqObj->setVar('notifypub', $notifypub); |
|
145 | + //$newFaqObj->setVar('modulelink', $_POST['modulelink']); |
|
146 | + //$newFaqObj->setVar('contextpage', $_POST['contextpage']); |
|
147 | + |
|
148 | + // Setting the status of the FAQ |
|
149 | + |
|
150 | + // if user is admin, FAQ are automatically published |
|
151 | + $isAdmin = Smartfaq\Utility::userIsAdmin(); |
|
152 | + if ($isAdmin) { |
|
153 | + $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED); |
|
154 | + } elseif (1 == $xoopsModuleConfig['autoapprove_submitted_faq']) { |
|
155 | + $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED); |
|
156 | + } else { |
|
157 | + $newFaqObj->setVar('status', Constants::SF_STATUS_SUBMITTED); |
|
158 | + } |
|
159 | 159 | |
160 | - // Storing the FAQ object in the database |
|
161 | - if (!$newFaqObj->store()) { |
|
162 | - redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR); |
|
163 | - } |
|
160 | + // Storing the FAQ object in the database |
|
161 | + if (!$newFaqObj->store()) { |
|
162 | + redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR); |
|
163 | + } |
|
164 | 164 | |
165 | - // Putting the values in the answer object |
|
166 | - $newAnswerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED); |
|
167 | - $newAnswerObj->setVar('faqid', $newFaqObj->faqid()); |
|
168 | - $newAnswerObj->setVar('answer', $_POST['answer']); |
|
169 | - $newAnswerObj->setVar('uid', $uid); |
|
170 | - |
|
171 | - //==================================================================================== |
|
172 | - //TODO post Attachment |
|
173 | - $attachments_tmp = []; |
|
174 | - if (!empty($_POST['attachments_tmp'])) { |
|
175 | - $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
|
176 | - if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
|
177 | - foreach ($_POST['delete_tmp'] as $key) { |
|
178 | - unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
179 | - unset($attachments_tmp[$key]); |
|
165 | + // Putting the values in the answer object |
|
166 | + $newAnswerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED); |
|
167 | + $newAnswerObj->setVar('faqid', $newFaqObj->faqid()); |
|
168 | + $newAnswerObj->setVar('answer', $_POST['answer']); |
|
169 | + $newAnswerObj->setVar('uid', $uid); |
|
170 | + |
|
171 | + //==================================================================================== |
|
172 | + //TODO post Attachment |
|
173 | + $attachments_tmp = []; |
|
174 | + if (!empty($_POST['attachments_tmp'])) { |
|
175 | + $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
|
176 | + if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
|
177 | + foreach ($_POST['delete_tmp'] as $key) { |
|
178 | + unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
179 | + unset($attachments_tmp[$key]); |
|
180 | + } |
|
180 | 181 | } |
181 | 182 | } |
182 | - } |
|
183 | - if (count($attachments_tmp)) { |
|
184 | - foreach ($attachments_tmp as $key => $attach) { |
|
185 | - if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
186 | - $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
|
183 | + if (count($attachments_tmp)) { |
|
184 | + foreach ($attachments_tmp as $key => $attach) { |
|
185 | + if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
186 | + $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
|
187 | + } |
|
187 | 188 | } |
188 | 189 | } |
189 | - } |
|
190 | - $error_upload = ''; |
|
190 | + $error_upload = ''; |
|
191 | 191 | |
192 | - if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name'] |
|
193 | - && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) { |
|
194 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
195 | - $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
|
196 | - $uploaddir = XOOPS_CACHE_PATH; |
|
192 | + if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name'] |
|
193 | + && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) { |
|
194 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
195 | + $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
|
196 | + $uploaddir = XOOPS_CACHE_PATH; |
|
197 | 197 | |
198 | - $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
198 | + $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
199 | 199 | |
200 | - if ($_FILES['userfile']['error'] > 0) { |
|
201 | - switch ($_FILES['userfile']['error']) { |
|
200 | + if ($_FILES['userfile']['error'] > 0) { |
|
201 | + switch ($_FILES['userfile']['error']) { |
|
202 | 202 | case 1: |
203 | 203 | $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI; |
204 | 204 | break; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | default: |
209 | 209 | $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF; |
210 | 210 | break; |
211 | - } |
|
211 | + } |
|
212 | 212 | } else { |
213 | 213 | $uploader->setCheckMediaTypeByExt(); |
214 | 214 | |
@@ -271,30 +271,30 @@ discard block |
||
271 | 271 | redirect_header('index.php', 2, $redirect_msg); |
272 | 272 | break; |
273 | 273 | |
274 | - case 'form': |
|
275 | - default: |
|
274 | + case 'form': |
|
275 | + default: |
|
276 | 276 | |
277 | - global $xoopsUser, $myts; |
|
277 | + global $xoopsUser, $myts; |
|
278 | 278 | |
279 | - $faqObj = $faqHandler->create(); |
|
280 | - $answerObj = $answerHandler->create(); |
|
281 | - $categoryObj = $categoryHandler->create(); |
|
279 | + $faqObj = $faqHandler->create(); |
|
280 | + $answerObj = $answerHandler->create(); |
|
281 | + $categoryObj = $categoryHandler->create(); |
|
282 | 282 | |
283 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
|
284 | - require_once XOOPS_ROOT_PATH . '/header.php'; |
|
285 | - require_once __DIR__ . '/footer.php'; |
|
283 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
|
284 | + require_once XOOPS_ROOT_PATH . '/header.php'; |
|
285 | + require_once __DIR__ . '/footer.php'; |
|
286 | 286 | |
287 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
288 | - $notifypub = 1; |
|
289 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
290 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
291 | - $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
287 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
288 | + $notifypub = 1; |
|
289 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
290 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
291 | + $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
292 | 292 | |
293 | - $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
294 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
293 | + $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
294 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
295 | 295 | |
296 | - require_once __DIR__ . '/include/submit.inc.php'; |
|
296 | + require_once __DIR__ . '/include/submit.inc.php'; |
|
297 | 297 | |
298 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
299 | - break; |
|
298 | + require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
299 | + break; |
|
300 | 300 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use XoopsModules\Smartfaq; |
10 | 10 | use XoopsModules\Smartfaq\Constants; |
11 | 11 | |
12 | -require_once __DIR__ . '/header.php'; |
|
12 | +require_once __DIR__.'/header.php'; |
|
13 | 13 | |
14 | 14 | global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; |
15 | 15 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | global $xoopsUser, $myts; |
90 | 90 | |
91 | 91 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
92 | - require_once XOOPS_ROOT_PATH . '/header.php'; |
|
93 | - require_once __DIR__ . '/footer.php'; |
|
92 | + require_once XOOPS_ROOT_PATH.'/header.php'; |
|
93 | + require_once __DIR__.'/footer.php'; |
|
94 | 94 | |
95 | 95 | $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
96 | 96 | |
97 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
97 | + $moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
98 | 98 | $faq = $faqObj->toArray(null, $categoryObj, false); |
99 | 99 | $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
100 | 100 | $faq['answer'] = $answerObj->answer(); |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
108 | 108 | |
109 | 109 | $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
110 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
110 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO); |
|
111 | 111 | |
112 | - require_once __DIR__ . '/include/submit.inc.php'; |
|
112 | + require_once __DIR__.'/include/submit.inc.php'; |
|
113 | 113 | |
114 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
114 | + require_once XOOPS_ROOT_PATH.'/footer.php'; |
|
115 | 115 | |
116 | 116 | exit(); |
117 | 117 | break; |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
176 | 176 | if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
177 | 177 | foreach ($_POST['delete_tmp'] as $key) { |
178 | - unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
178 | + unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0]); |
|
179 | 179 | unset($attachments_tmp[$key]); |
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | 183 | if (count($attachments_tmp)) { |
184 | 184 | foreach ($attachments_tmp as $key => $attach) { |
185 | - if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
185 | + if (rename(XOOPS_CACHE_PATH.'/'.$attachments_tmp[$key][0], XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0])) { |
|
186 | 186 | $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
187 | 187 | } |
188 | 188 | } |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | |
192 | 192 | if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name'] |
193 | 193 | && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) { |
194 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
194 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/class/uploader.php'; |
|
195 | 195 | $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
196 | 196 | $uploaddir = XOOPS_CACHE_PATH; |
197 | 197 | |
198 | - $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
198 | + $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int) $maxfilesize, (int) $xoopsModuleConfig['max_img_width'], (int) $xoopsModuleConfig['max_img_height']); |
|
199 | 199 | |
200 | 200 | if ($_FILES['userfile']['error'] > 0) { |
201 | 201 | switch ($_FILES['userfile']['error']) { |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | $uploader->setCheckMediaTypeByExt(); |
214 | 214 | |
215 | 215 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
216 | - $prefix = is_object($xoopsUser) ? (string)$xoopsUser->uid() . '_' : 'newbb_'; |
|
216 | + $prefix = is_object($xoopsUser) ? (string) $xoopsUser->uid().'_' : 'newbb_'; |
|
217 | 217 | $uploader->setPrefix($prefix); |
218 | 218 | if (!$uploader->upload()) { |
219 | - $error_message[] = $error_upload =& $uploader->getErrors(); |
|
219 | + $error_message[] = $error_upload = & $uploader->getErrors(); |
|
220 | 220 | } else { |
221 | 221 | if (is_file($uploader->getSavedDestination())) { |
222 | - if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $uploader->getSavedFileName())) { |
|
222 | + if (rename(XOOPS_CACHE_PATH.'/'.$uploader->getSavedFileName(), XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$uploader->getSavedFileName())) { |
|
223 | 223 | $post_obj->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType()); |
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
227 | 227 | } else { |
228 | - $error_message[] = $error_upload =& $uploader->getErrors(); |
|
228 | + $error_message[] = $error_upload = & $uploader->getErrors(); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } else { |
259 | 259 | // Subscribe the user to On Published notification, if requested |
260 | 260 | if (1 == $notifypub) { |
261 | - require_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
261 | + require_once XOOPS_ROOT_PATH.'/include/notification_constants.php'; |
|
262 | 262 | $notificationHandler = xoops_getHandler('notification'); |
263 | 263 | $notificationHandler->subscribe('faq', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
264 | 264 | } |
@@ -281,20 +281,20 @@ discard block |
||
281 | 281 | $categoryObj = $categoryHandler->create(); |
282 | 282 | |
283 | 283 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
284 | - require_once XOOPS_ROOT_PATH . '/header.php'; |
|
285 | - require_once __DIR__ . '/footer.php'; |
|
284 | + require_once XOOPS_ROOT_PATH.'/header.php'; |
|
285 | + require_once __DIR__.'/footer.php'; |
|
286 | 286 | |
287 | 287 | $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
288 | 288 | $notifypub = 1; |
289 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
289 | + $moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
290 | 290 | $xoopsTpl->assign('whereInSection', $moduleName); |
291 | 291 | $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
292 | 292 | |
293 | 293 | $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
294 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
294 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO); |
|
295 | 295 | |
296 | - require_once __DIR__ . '/include/submit.inc.php'; |
|
296 | + require_once __DIR__.'/include/submit.inc.php'; |
|
297 | 297 | |
298 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
298 | + require_once XOOPS_ROOT_PATH.'/footer.php'; |
|
299 | 299 | break; |
300 | 300 | } |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | use XoopsModules\Smartfaq; |
10 | 10 | |
11 | -require_once __DIR__ . '/header.php'; |
|
11 | +require_once __DIR__.'/header.php'; |
|
12 | 12 | |
13 | -$faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0; |
|
13 | +$faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : 0; |
|
14 | 14 | |
15 | 15 | if (0 == $faqid) { |
16 | 16 | redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $faqObj->updateCounter(); |
48 | 48 | } |
49 | 49 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_faq.tpl'; |
50 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
51 | -require_once __DIR__ . '/footer.php'; |
|
50 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
51 | +require_once __DIR__.'/footer.php'; |
|
52 | 52 | |
53 | 53 | $faq = $faqObj->toArray(null, $categoryObj, false); |
54 | 54 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $xoopsTpl->assign('display_categoryname', false); |
84 | 84 | |
85 | 85 | $xoopsTpl->assign('xcodes', $faqObj->getVar('xcodes')); |
86 | -$xoopsTpl->assign('mail_link', 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/faq.php?faqid=' . $faqObj->getVar('faqid')); |
|
86 | +$xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']).'&body='.sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/faq.php?faqid='.$faqObj->getVar('faqid')); |
|
87 | 87 | $xoopsTpl->assign('lang_printerpage', _MD_SF_PRINTERFRIENDLY); |
88 | 88 | $xoopsTpl->assign('lang_sendstory', _MD_SF_SENDSTORY); |
89 | 89 | $xoopsTpl->assign('faqid', $faqObj->getVar('faqid')); |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | |
100 | 100 | // Page Title Hack by marcan |
101 | 101 | $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
102 | -$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $categoryObj->name() . ' - ' . $faq['question']); |
|
102 | +$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$categoryObj->name().' - '.$faq['question']); |
|
103 | 103 | // End Page Title Hack by marcan |
104 | 104 | |
105 | 105 | // Include the comments if the selected FAQ supports comments |
106 | 106 | if (1 == $faqObj->cancomment()) { |
107 | - require_once XOOPS_ROOT_PATH . '/include/comment_view.php'; |
|
107 | + require_once XOOPS_ROOT_PATH.'/include/comment_view.php'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //code to include smartie |
111 | -if (file_exists(XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php')) { |
|
112 | - require_once XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php'; |
|
111 | +if (file_exists(XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php')) { |
|
112 | + require_once XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php'; |
|
113 | 113 | $xoopsTpl->assign('smarttie', 1); |
114 | 114 | } |
115 | 115 | //end code for smarttie |
116 | 116 | |
117 | -require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
117 | +require_once XOOPS_ROOT_PATH.'/footer.php'; |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * @see http://www.php-fig.org/psr/psr-4/examples/ |
5 | 5 | */ |
6 | -spl_autoload_register(function ($class) { |
|
6 | +spl_autoload_register(function($class) { |
|
7 | 7 | // project-specific namespace prefix |
8 | - $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); |
|
8 | + $prefix = 'XoopsModules\\'.ucfirst(basename(dirname(__DIR__))); |
|
9 | 9 | |
10 | 10 | // base directory for the namespace prefix |
11 | - $base_dir = __DIR__ . '/../class/'; |
|
11 | + $base_dir = __DIR__.'/../class/'; |
|
12 | 12 | |
13 | 13 | // does the class use the namespace prefix? |
14 | 14 | $len = strlen($prefix); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // replace the namespace prefix with the base directory, replace namespace |
24 | 24 | // separators with directory separators in the relative class name, append |
25 | 25 | // with .php |
26 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
26 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
27 | 27 | |
28 | 28 | // if the file exists, require it |
29 | 29 | if (file_exists($file)) { |