@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | $target = fopen($targetPath, 'wb'); |
109 | 109 | |
110 | - for ($i=0; $i<$totalParts; $i++) { |
|
110 | + for ($i = 0; $i < $totalParts; $i++) { |
|
111 | 111 | $chunk = fopen($targetFolder.DIRECTORY_SEPARATOR.$i, "rb"); |
112 | 112 | stream_copy_to_stream($chunk, $target); |
113 | 113 | fclose($chunk); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | // Success |
117 | 117 | fclose($target); |
118 | 118 | |
119 | - for ($i=0; $i<$totalParts; $i++) { |
|
119 | + for ($i = 0; $i < $totalParts; $i++) { |
|
120 | 120 | unlink($targetFolder.DIRECTORY_SEPARATOR.$i); |
121 | 121 | } |
122 | 122 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function handleUpload($uploadDirectory, $name = null) |
142 | 142 | { |
143 | 143 | if (is_writable($this->chunksFolder) && |
144 | - 1 == mt_rand(1, 1/$this->chunksCleanupProbability)) { |
|
144 | + 1 == mt_rand(1, 1 / $this->chunksCleanupProbability)) { |
|
145 | 145 | // Run garbage collection |
146 | 146 | $this->cleanupChunks(); |
147 | 147 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // exceed size allowed by server config |
151 | 151 | if ($this->toBytes(ini_get('post_max_size')) < $this->sizeLimit || |
152 | 152 | $this->toBytes(ini_get('upload_max_filesize')) < $this->sizeLimit) { |
153 | - $neededRequestSize = max(1, $this->sizeLimit / 1024 / 1024) . 'M'; |
|
153 | + $neededRequestSize = max(1, $this->sizeLimit / 1024 / 1024).'M'; |
|
154 | 154 | return array( |
155 | 155 | 'error'=>"Server error. Increase post_max_size and upload_max_filesize to ".$neededRequestSize |
156 | 156 | ); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | && !in_array(strtolower($ext), array_map("strtolower", $this->allowedExtensions))) { |
212 | 212 | $these = implode(', ', $this->allowedExtensions); |
213 | 213 | return array( |
214 | - 'error' => 'File has an invalid extension, it should be one of '. $these . '.', |
|
214 | + 'error' => 'File has an invalid extension, it should be one of '.$these.'.', |
|
215 | 215 | 'preventRetry' => true |
216 | 216 | ); |
217 | 217 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | - return array('error'=> 'Could not save uploaded file.' . |
|
267 | + return array('error'=> 'Could not save uploaded file.'. |
|
268 | 268 | 'The upload was cancelled, or server error encountered'); |
269 | 269 | } |
270 | 270 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if ($method == "DELETE") { |
302 | 302 | $url = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); |
303 | 303 | $tokens = explode('/', $url); |
304 | - $uuid = $tokens[sizeof($tokens)-1]; |
|
304 | + $uuid = $tokens[sizeof($tokens) - 1]; |
|
305 | 305 | } elseif ($method == "POST") { |
306 | 306 | $uuid = $_REQUEST['qquuid']; |
307 | 307 | } else { |
@@ -345,19 +345,19 @@ discard block |
||
345 | 345 | $pathinfo = pathinfo($filename); |
346 | 346 | $base = $pathinfo['filename']; |
347 | 347 | $ext = isset($pathinfo['extension']) ? $pathinfo['extension'] : ''; |
348 | - $ext = $ext == '' ? $ext : '.' . $ext; |
|
348 | + $ext = $ext == '' ? $ext : '.'.$ext; |
|
349 | 349 | |
350 | 350 | $unique = $base; |
351 | 351 | $suffix = 0; |
352 | 352 | |
353 | 353 | // Get unique file name for the file, by appending random suffix. |
354 | 354 | |
355 | - while (file_exists($uploadDirectory . DIRECTORY_SEPARATOR . $unique . $ext)) { |
|
355 | + while (file_exists($uploadDirectory.DIRECTORY_SEPARATOR.$unique.$ext)) { |
|
356 | 356 | $suffix += rand(1, 999); |
357 | 357 | $unique = $base.'-'.$suffix; |
358 | 358 | } |
359 | 359 | |
360 | - $result = $uploadDirectory . DIRECTORY_SEPARATOR . $unique . $ext; |
|
360 | + $result = $uploadDirectory.DIRECTORY_SEPARATOR.$unique.$ext; |
|
361 | 361 | |
362 | 362 | // Create an empty target file |
363 | 363 | if (!touch($result)) { |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | protected function toBytes($str) |
427 | 427 | { |
428 | 428 | $str = trim($str); |
429 | - $last = strtolower($str[strlen($str)-1]); |
|
430 | - if(is_numeric($last)) { |
|
431 | - $val = (int) $str; |
|
429 | + $last = strtolower($str[strlen($str) - 1]); |
|
430 | + if (is_numeric($last)) { |
|
431 | + $val = (int)$str; |
|
432 | 432 | } else { |
433 | - $val = (int) substr($str, 0, -1); |
|
433 | + $val = (int)substr($str, 0, -1); |
|
434 | 434 | } |
435 | 435 | switch ($last) { |
436 | 436 | case 'g': |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | public function loadGui($gui) |
58 | 58 | { |
59 | 59 | if (!empty($gui)) { |
60 | - $class = 'XoopsGui' . ucfirst($gui); |
|
60 | + $class = 'XoopsGui'.ucfirst($gui); |
|
61 | 61 | if (!class_exists($class)) { |
62 | - include_once XOOPS_ADMINTHEME_PATH . '/' . $gui . '/' . $gui . '.php'; |
|
62 | + include_once XOOPS_ADMINTHEME_PATH.'/'.$gui.'/'.$gui.'.php'; |
|
63 | 63 | } |
64 | 64 | if (class_exists($class)) { |
65 | 65 | if (call_user_func(array($class, 'validate'))) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | if (!isset($this->gui)) { |
72 | - if (file_exists($file = XOOPS_ADMINTHEME_PATH . '/transition/transition.php')) { |
|
72 | + if (file_exists($file = XOOPS_ADMINTHEME_PATH.'/transition/transition.php')) { |
|
73 | 73 | include_once $file; |
74 | 74 | $this->gui = new XoopsGuiTransition(); |
75 | 75 | $this->gui->foldername = 'transition'; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | xoops_load('XoopsLists'); |
89 | 89 | $lists = XoopsLists::getDirListAsArray(XOOPS_ADMINTHEME_PATH); |
90 | 90 | foreach (array_keys($lists) as $gui) { |
91 | - if (file_exists($file = XOOPS_ADMINTHEME_PATH . '/' . $gui . '/' . $gui . '.php')) { |
|
91 | + if (file_exists($file = XOOPS_ADMINTHEME_PATH.'/'.$gui.'/'.$gui.'.php')) { |
|
92 | 92 | include_once $file; |
93 | - if (class_exists($class = 'XoopsGui' . ucfirst($gui))) { |
|
93 | + if (class_exists($class = 'XoopsGui'.ucfirst($gui))) { |
|
94 | 94 | if (call_user_func(array($class, 'validate'))) { |
95 | 95 | $guis[$gui] = $gui; |
96 | 96 | } |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | { |
110 | 110 | $guis = XoopsSystemCpanel::getGuis(); |
111 | 111 | foreach ($guis as $gui) { |
112 | - if ($file = XOOPS_ADMINTHEME_PATH . '/' . $gui . '/' . $gui . '.php') { |
|
112 | + if ($file = XOOPS_ADMINTHEME_PATH.'/'.$gui.'/'.$gui.'.php') { |
|
113 | 113 | include_once $file; |
114 | - if (class_exists($class = 'XoopsGui' . ucfirst($gui))) { |
|
114 | + if (class_exists($class = 'XoopsGui'.ucfirst($gui))) { |
|
115 | 115 | call_user_func(array($class, 'flush')); |
116 | 116 | } |
117 | 117 | } |
@@ -63,16 +63,16 @@ |
||
63 | 63 | $form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_DESCRIPTION, 'emotion', 50, 50, $this->getVar('emotion')), true); |
64 | 64 | |
65 | 65 | $imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_SMILIES_FILE, '<br>'); |
66 | - $imgpath_img = sprintf(_AM_SYSTEM_SMILIES_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/smilies/'); |
|
66 | + $imgpath_img = sprintf(_AM_SYSTEM_SMILIES_IMAGE_PATH, XOOPS_UPLOAD_PATH.'/smilies/'); |
|
67 | 67 | $imageselect_img = new XoopsFormSelect($imgpath_img, 'smile_url', $blank_img); |
68 | - $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/smilies'); |
|
68 | + $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH.'/smilies'); |
|
69 | 69 | $imageselect_img->addOption("$blank_img", $blank_img); |
70 | 70 | foreach ($image_array_img as $image_img) { |
71 | 71 | $imageselect_img->addOption("$image_img", $image_img); |
72 | 72 | } |
73 | - $imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smile_url\', \'smilies\', \'\', \'' . XOOPS_UPLOAD_URL . '\' )"'); |
|
73 | + $imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smile_url\', \'smilies\', \'\', \''.XOOPS_UPLOAD_URL.'\' )"'); |
|
74 | 74 | $imgtray_img->addElement($imageselect_img, false); |
75 | - $imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/smilies/' . $blank_img . "' name='image_img' id='xo-smilies-img' alt='' />")); |
|
75 | + $imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='".XOOPS_UPLOAD_URL.'/smilies/'.$blank_img."' name='image_img' id='xo-smilies-img' alt='' />")); |
|
76 | 76 | |
77 | 77 | $fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>'); |
78 | 78 | $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_SMILIES_UPLOADS, 'smile_url', 500000), false); |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | // Name |
55 | 55 | $form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true); |
56 | 56 | // Name description |
57 | - $maxpixel = '<div>' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>'; |
|
58 | - $maxsize = '<div>' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>'; |
|
57 | + $maxpixel = '<div>'._US_MAXPIXEL.' : '.$xoopsConfigUser['avatar_width'].' x '.$xoopsConfigUser['avatar_height'].'</div>'; |
|
58 | + $maxsize = '<div>'._US_MAXIMGSZ.' : '.$xoopsConfigUser['avatar_maxsize'].'</div>'; |
|
59 | 59 | // Upload part |
60 | 60 | $imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br>'); |
61 | - $imgtray_img->setDescription($maxpixel . $maxsize); |
|
62 | - $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img); |
|
63 | - $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars'); |
|
61 | + $imgtray_img->setDescription($maxpixel.$maxsize); |
|
62 | + $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH.'/avatars/'), 'avatar_file', $blank_img); |
|
63 | + $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH.'/avatars'); |
|
64 | 64 | $imageselect_img->addOption("$blank_img", $blank_img); |
65 | 65 | foreach ($image_array_img as $image_img) { |
66 | 66 | $imageselect_img->addOption("$image_img", $image_img); |
67 | 67 | } |
68 | - $imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'"); |
|
68 | + $imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"".XOOPS_UPLOAD_URL."\")'"); |
|
69 | 69 | $imgtray_img->addElement($imageselect_img, false); |
70 | - $imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/avatars/' . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />")); |
|
70 | + $imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='".XOOPS_UPLOAD_URL.'/avatars/'.$blank_img."' name='image_img' id='xo-avatar-img' alt='' />")); |
|
71 | 71 | $fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>'); |
72 | 72 | $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false); |
73 | 73 | $imgtray_img->addElement($fileseltray_img); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $avatar = false; |
139 | 139 | $id = (int)$id; |
140 | 140 | if ($id > 0) { |
141 | - $sql = 'SELECT * FROM ' . $this->db->prefix('avatar') . ' WHERE avatar_id=' . $id; |
|
141 | + $sql = 'SELECT * FROM '.$this->db->prefix('avatar').' WHERE avatar_id='.$id; |
|
142 | 142 | if (!$result = $this->db->query($sql)) { |
143 | 143 | return false; |
144 | 144 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /* @var $db XoopsMySQLDatabase */ |
37 | 37 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
38 | 38 | $this->db = $db; |
39 | - $this->prefix = $this->db->prefix . '_'; |
|
39 | + $this->prefix = $this->db->prefix.'_'; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $value = substr($value[0], strlen(XOOPS_DB_PREFIX) + 1); |
57 | 57 | $tables[$value] = $value; |
58 | 58 | } |
59 | - if (true === (bool) $array) { |
|
59 | + if (true === (bool)$array) { |
|
60 | 60 | return $tables; |
61 | 61 | } else { |
62 | 62 | return implode(',', $tables); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function CleanSession() |
72 | 72 | { |
73 | - $result = $this->db->queryF('TRUNCATE TABLE ' . $this->db->prefix('session')); |
|
73 | + $result = $this->db->queryF('TRUNCATE TABLE '.$this->db->prefix('session')); |
|
74 | 74 | |
75 | 75 | return true; |
76 | 76 | } |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function CleanAvatar() |
88 | 88 | { |
89 | - $result = $this->db->queryF('SELECT avatar_id, avatar_file FROM ' . $this->db->prefix('avatar') . " WHERE avatar_type='C' AND avatar_id IN (" . 'SELECT t1.avatar_id FROM ' . $this->db->prefix('avatar_user_link') . ' AS t1 ' . 'LEFT JOIN ' . $this->db->prefix('users') . ' AS t2 ON t2.uid=t1.user_id ' . 'WHERE t2.uid IS NULL)'); |
|
89 | + $result = $this->db->queryF('SELECT avatar_id, avatar_file FROM '.$this->db->prefix('avatar')." WHERE avatar_type='C' AND avatar_id IN (".'SELECT t1.avatar_id FROM '.$this->db->prefix('avatar_user_link').' AS t1 '.'LEFT JOIN '.$this->db->prefix('users').' AS t2 ON t2.uid=t1.user_id '.'WHERE t2.uid IS NULL)'); |
|
90 | 90 | |
91 | 91 | while (false !== ($myrow = $this->db->fetchArray($result))) { |
92 | 92 | //delete file |
93 | - @unlink(XOOPS_UPLOAD_PATH . '/' . $myrow['avatar_file']); |
|
93 | + @unlink(XOOPS_UPLOAD_PATH.'/'.$myrow['avatar_file']); |
|
94 | 94 | //clean avatar table |
95 | - $result1 = $this->db->queryF('DELETE FROM ' . $this->db->prefix('avatar') . ' WHERE avatar_id=' . $myrow['avatar_id']); |
|
95 | + $result1 = $this->db->queryF('DELETE FROM '.$this->db->prefix('avatar').' WHERE avatar_id='.$myrow['avatar_id']); |
|
96 | 96 | } |
97 | 97 | //clean any deleted users from avatar_user_link table |
98 | - $result2 = $this->db->queryF('DELETE FROM ' . $this->db->prefix('avatar_user_link') . ' WHERE user_id NOT IN (SELECT uid FROM ' . $this->db->prefix('users') . ')'); |
|
98 | + $result2 = $this->db->queryF('DELETE FROM '.$this->db->prefix('avatar_user_link').' WHERE user_id NOT IN (SELECT uid FROM '.$this->db->prefix('users').')'); |
|
99 | 99 | |
100 | 100 | return true; |
101 | 101 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | if (is_dir($dir)) { |
113 | 113 | if ($dirHandle = opendir($dir)) { |
114 | 114 | while (($file = readdir($dirHandle)) !== false) { |
115 | - if (filetype($dir . $file) === 'file' && $file !== 'index.html') { |
|
116 | - unlink($dir . $file); |
|
115 | + if (filetype($dir.$file) === 'file' && $file !== 'index.html') { |
|
116 | + unlink($dir.$file); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | closedir($dirHandle); |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | foreach ($cacheList as $cache) { |
136 | 136 | switch ($cache) { |
137 | 137 | case 1: |
138 | - $this->clearDirectory(XOOPS_VAR_PATH . '/caches/smarty_cache/'); |
|
138 | + $this->clearDirectory(XOOPS_VAR_PATH.'/caches/smarty_cache/'); |
|
139 | 139 | break; |
140 | 140 | case 2: |
141 | - $this->clearDirectory(XOOPS_VAR_PATH . '/caches/smarty_compile/'); |
|
141 | + $this->clearDirectory(XOOPS_VAR_PATH.'/caches/smarty_compile/'); |
|
142 | 142 | break; |
143 | 143 | case 3: |
144 | - $this->clearDirectory(XOOPS_VAR_PATH . '/caches/xoops_cache/'); |
|
144 | + $this->clearDirectory(XOOPS_VAR_PATH.'/caches/xoops_cache/'); |
|
145 | 145 | break; |
146 | 146 | default: |
147 | 147 | return false; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function CheckRepairAnalyzeOptimizeQueries($tables, $maintenance) |
162 | 162 | { |
163 | - $ret = '<table class="outer"><th>' . _AM_SYSTEM_MAINTENANCE_TABLES1 . '</th><th>' . _AM_SYSTEM_MAINTENANCE_TABLES_OPTIMIZE . '</th><th>' . _AM_SYSTEM_MAINTENANCE_TABLES_CHECK . '</th><th>' . _AM_SYSTEM_MAINTENANCE_TABLES_REPAIR . '</th><th>' . _AM_SYSTEM_MAINTENANCE_TABLES_ANALYZE . '</th>'; |
|
163 | + $ret = '<table class="outer"><th>'._AM_SYSTEM_MAINTENANCE_TABLES1.'</th><th>'._AM_SYSTEM_MAINTENANCE_TABLES_OPTIMIZE.'</th><th>'._AM_SYSTEM_MAINTENANCE_TABLES_CHECK.'</th><th>'._AM_SYSTEM_MAINTENANCE_TABLES_REPAIR.'</th><th>'._AM_SYSTEM_MAINTENANCE_TABLES_ANALYZE.'</th>'; |
|
164 | 164 | $tab = array(); |
165 | 165 | for ($i = 0; $i < 4; ++$i) { |
166 | 166 | $tab[$i] = $i + 1; |
@@ -177,39 +177,39 @@ discard block |
||
177 | 177 | $class = 'odd'; |
178 | 178 | $tablesCount = count($tables); |
179 | 179 | for ($i = 0; $i < $tablesCount; ++$i) { |
180 | - $ret .= '<tr class="' . $class . '"><td align="center">' . $this->prefix . $tables[$i] . '</td>'; |
|
180 | + $ret .= '<tr class="'.$class.'"><td align="center">'.$this->prefix.$tables[$i].'</td>'; |
|
181 | 181 | for ($j = 0; $j < 4; ++$j) { |
182 | 182 | if ($tab1[$j] == 1) { |
183 | 183 | // Optimize |
184 | - $result = $this->db->queryF('OPTIMIZE TABLE ' . $this->prefix . $tables[$i]); |
|
184 | + $result = $this->db->queryF('OPTIMIZE TABLE '.$this->prefix.$tables[$i]); |
|
185 | 185 | if ($result) { |
186 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('success.png') . '" /></td>'; |
|
186 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('success.png').'" /></td>'; |
|
187 | 187 | } else { |
188 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('cancel.png') . '" /></td>'; |
|
188 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('cancel.png').'" /></td>'; |
|
189 | 189 | } |
190 | 190 | } elseif ($tab1[$j] == 2) { |
191 | 191 | // Check tables |
192 | - $result = $this->db->queryF('CHECK TABLE ' . $this->prefix . $tables[$i]); |
|
192 | + $result = $this->db->queryF('CHECK TABLE '.$this->prefix.$tables[$i]); |
|
193 | 193 | if ($result) { |
194 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('success.png') . '" /></td>'; |
|
194 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('success.png').'" /></td>'; |
|
195 | 195 | } else { |
196 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('cancel.png') . '" /></td>'; |
|
196 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('cancel.png').'" /></td>'; |
|
197 | 197 | } |
198 | 198 | } elseif ($tab1[$j] == 3) { |
199 | 199 | // Repair |
200 | - $result = $this->db->queryF('REPAIR TABLE ' . $this->prefix . $tables[$i]); |
|
200 | + $result = $this->db->queryF('REPAIR TABLE '.$this->prefix.$tables[$i]); |
|
201 | 201 | if ($result) { |
202 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('success.png') . '" /></td>'; |
|
202 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('success.png').'" /></td>'; |
|
203 | 203 | } else { |
204 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('cancel.png') . '" /></td>'; |
|
204 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('cancel.png').'" /></td>'; |
|
205 | 205 | } |
206 | 206 | } elseif ($tab1[$j] == 4) { |
207 | 207 | // Analyze |
208 | - $result = $this->db->queryF('ANALYZE TABLE ' . $this->prefix . $tables[$i]); |
|
208 | + $result = $this->db->queryF('ANALYZE TABLE '.$this->prefix.$tables[$i]); |
|
209 | 209 | if ($result) { |
210 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('success.png') . '" /></td>'; |
|
210 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('success.png').'" /></td>'; |
|
211 | 211 | } else { |
212 | - $ret .= '<td class="xo-actions txtcenter"><img src="' . system_AdminIcons('cancel.png') . '" /></td>'; |
|
212 | + $ret .= '<td class="xo-actions txtcenter"><img src="'.system_AdminIcons('cancel.png').'" /></td>'; |
|
213 | 213 | } |
214 | 214 | } else { |
215 | 215 | $ret .= '<td> </td>'; |
@@ -235,15 +235,15 @@ discard block |
||
235 | 235 | $ret = array(); |
236 | 236 | $ret[0] = "# \n"; |
237 | 237 | $ret[0] .= "# Dump SQL, Generate by Xoops \n"; |
238 | - $ret[0] .= '# Date : ' . date('d-m-Y - H:i') . " \n"; |
|
239 | - $ret[1] = '<table class="outer"><tr><th width="30%">' . _AM_SYSTEM_MAINTENANCE_DUMP_TABLES . '</th><th width="35%">' . _AM_SYSTEM_MAINTENANCE_DUMP_STRUCTURES . '</th><th width="35%">' . _AM_SYSTEM_MAINTENANCE_DUMP_NB_RECORDS . '</th></tr>'; |
|
238 | + $ret[0] .= '# Date : '.date('d-m-Y - H:i')." \n"; |
|
239 | + $ret[1] = '<table class="outer"><tr><th width="30%">'._AM_SYSTEM_MAINTENANCE_DUMP_TABLES.'</th><th width="35%">'._AM_SYSTEM_MAINTENANCE_DUMP_STRUCTURES.'</th><th width="35%">'._AM_SYSTEM_MAINTENANCE_DUMP_NB_RECORDS.'</th></tr>'; |
|
240 | 240 | $class = 'odd'; |
241 | 241 | $tablesCount = count($tables); |
242 | 242 | for ($i = 0; $i < $tablesCount; ++$i) { |
243 | 243 | //structure |
244 | - $ret = $this->dump_table_structure($ret, $this->prefix . $tables[$i], $drop, $class); |
|
244 | + $ret = $this->dump_table_structure($ret, $this->prefix.$tables[$i], $drop, $class); |
|
245 | 245 | //data |
246 | - $ret = $this->dump_table_datas($ret, $this->prefix . $tables[$i]); |
|
246 | + $ret = $this->dump_table_datas($ret, $this->prefix.$tables[$i]); |
|
247 | 247 | $class = ($class === 'even') ? 'odd' : 'even'; |
248 | 248 | } |
249 | 249 | $ret = $this->dump_write($ret); |
@@ -264,27 +264,27 @@ discard block |
||
264 | 264 | $ret = array(); |
265 | 265 | $ret[0] = "# \n"; |
266 | 266 | $ret[0] .= "# Dump SQL, Generate by Xoops \n"; |
267 | - $ret[0] .= '# Date : ' . date('d-m-Y - H:i') . " \n"; |
|
267 | + $ret[0] .= '# Date : '.date('d-m-Y - H:i')." \n"; |
|
268 | 268 | $ret[0] .= "# \n\n"; |
269 | - $ret[1] = '<table class="outer"><tr><th width="30%">' . _AM_SYSTEM_MAINTENANCE_DUMP_TABLES . '</th><th width="35%">' . _AM_SYSTEM_MAINTENANCE_DUMP_STRUCTURES . '</th><th width="35%">' . _AM_SYSTEM_MAINTENANCE_DUMP_NB_RECORDS . '</th></tr>'; |
|
269 | + $ret[1] = '<table class="outer"><tr><th width="30%">'._AM_SYSTEM_MAINTENANCE_DUMP_TABLES.'</th><th width="35%">'._AM_SYSTEM_MAINTENANCE_DUMP_STRUCTURES.'</th><th width="35%">'._AM_SYSTEM_MAINTENANCE_DUMP_NB_RECORDS.'</th></tr>'; |
|
270 | 270 | $class = 'odd'; |
271 | 271 | $modulesCount = count($modules); |
272 | 272 | for ($i = 0; $i < $modulesCount; ++$i) { |
273 | 273 | /* @var $module_handler XoopsModuleHandler */ |
274 | 274 | $module_handler = xoops_getHandler('module'); |
275 | 275 | $module = $module_handler->getByDirname($modules[$i]); |
276 | - $ret[1] .= '<tr><th colspan="3" align="left">' . ucfirst($modules[$i]) . '</th></tr>'; |
|
276 | + $ret[1] .= '<tr><th colspan="3" align="left">'.ucfirst($modules[$i]).'</th></tr>'; |
|
277 | 277 | $modtables = $module->getInfo('tables'); |
278 | 278 | if ($modtables !== false && is_array($modtables)) { |
279 | 279 | foreach ($modtables as $table) { |
280 | 280 | //structure |
281 | - $ret = $this->dump_table_structure($ret, $this->prefix . $table, $drop, $class); |
|
281 | + $ret = $this->dump_table_structure($ret, $this->prefix.$table, $drop, $class); |
|
282 | 282 | //data |
283 | - $ret = $this->dump_table_datas($ret, $this->prefix . $table); |
|
283 | + $ret = $this->dump_table_datas($ret, $this->prefix.$table); |
|
284 | 284 | $class = ($class === 'even') ? 'odd' : 'even'; |
285 | 285 | } |
286 | 286 | } else { |
287 | - $ret[1] .= '<tr><td colspan="3" align="center">' . _AM_SYSTEM_MAINTENANCE_DUMP_NO_TABLES . '</td></tr>'; |
|
287 | + $ret[1] .= '<tr><td colspan="3" align="center">'._AM_SYSTEM_MAINTENANCE_DUMP_NO_TABLES.'</td></tr>'; |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | $ret[1] .= '</table>'; |
@@ -305,19 +305,19 @@ discard block |
||
305 | 305 | public function dump_table_structure($ret, $table, $drop, $class) |
306 | 306 | { |
307 | 307 | $verif = false; |
308 | - $result = $this->db->queryF('SHOW create table `' . $table . '`;'); |
|
308 | + $result = $this->db->queryF('SHOW create table `'.$table.'`;'); |
|
309 | 309 | if ($result) { |
310 | 310 | if ($row = $this->db->fetchArray($result)) { |
311 | - $ret[0] .= '# Table structure for table `' . $table . "` \n\n"; |
|
311 | + $ret[0] .= '# Table structure for table `'.$table."` \n\n"; |
|
312 | 312 | if ($drop == 1) { |
313 | - $ret[0] .= 'DROP TABLE IF EXISTS `' . $table . "`;\n\n"; |
|
313 | + $ret[0] .= 'DROP TABLE IF EXISTS `'.$table."`;\n\n"; |
|
314 | 314 | } |
315 | 315 | $verif = true; |
316 | - $ret[0] .= $row['Create Table'] . ";\n\n"; |
|
316 | + $ret[0] .= $row['Create Table'].";\n\n"; |
|
317 | 317 | } |
318 | 318 | } |
319 | - $ret[1] .= '<tr class="' . $class . '"><td align="center">' . $table . '</td><td class="xo-actions txtcenter">'; |
|
320 | - $ret[1] .= ($verif === true) ? '<img src="' . system_AdminIcons('success.png') . '" />' : '<img src="' . system_AdminIcons('cancel.png') . '" />'; |
|
319 | + $ret[1] .= '<tr class="'.$class.'"><td align="center">'.$table.'</td><td class="xo-actions txtcenter">'; |
|
320 | + $ret[1] .= ($verif === true) ? '<img src="'.system_AdminIcons('success.png').'" />' : '<img src="'.system_AdminIcons('cancel.png').'" />'; |
|
321 | 321 | $ret[1] .= '</td>'; |
322 | 322 | $this->db->freeRecordSet($result); |
323 | 323 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | public function dump_table_datas($ret, $table) |
335 | 335 | { |
336 | 336 | $count = 0; |
337 | - $result = $this->db->queryF('SELECT * FROM ' . $table . ';'); |
|
337 | + $result = $this->db->queryF('SELECT * FROM '.$table.';'); |
|
338 | 338 | if ($result) { |
339 | 339 | $num_rows = $this->db->getRowsNum($result); |
340 | 340 | $num_fields = $this->db->getFieldsNum($result); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | ++$i; |
349 | 349 | } |
350 | 350 | |
351 | - $ret[0] .= 'INSERT INTO `' . $table . "` values\n"; |
|
351 | + $ret[0] .= 'INSERT INTO `'.$table."` values\n"; |
|
352 | 352 | $index = 0; |
353 | 353 | while ($row = $this->db->fetchRow($result)) { |
354 | 354 | ++$count; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $ret[0] .= $row[$i]; |
363 | 363 | break; |
364 | 364 | default: |
365 | - $ret[0] .= "'" . $this->db->escape($row[$i]) . "'"; |
|
365 | + $ret[0] .= "'".$this->db->escape($row[$i])."'"; |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | if ($i < $num_fields - 1) { |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | } |
383 | 383 | } |
384 | 384 | $ret[1] .= '<td align="center">'; |
385 | - $ret[1] .= $count . ' ' . _AM_SYSTEM_MAINTENANCE_DUMP_RECORDS . '</td></tr>'; |
|
385 | + $ret[1] .= $count.' '._AM_SYSTEM_MAINTENANCE_DUMP_RECORDS.'</td></tr>'; |
|
386 | 386 | $ret[0] .= "\n"; |
387 | 387 | $this->db->freeRecordSet($result); |
388 | 388 | $ret[0] .= "\n"; |
@@ -398,12 +398,12 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function dump_write($ret) |
400 | 400 | { |
401 | - $file_name = 'dump_' . date('Y.m.d') . '_' . date('H.i.s') . '.sql'; |
|
402 | - $path_file = './admin/maintenance/dump/' . $file_name; |
|
401 | + $file_name = 'dump_'.date('Y.m.d').'_'.date('H.i.s').'.sql'; |
|
402 | + $path_file = './admin/maintenance/dump/'.$file_name; |
|
403 | 403 | if (file_put_contents($path_file, $ret[0])) { |
404 | - $ret[1] .= '<table class="outer"><tr><th colspan="2" align="center">' . _AM_SYSTEM_MAINTENANCE_DUMP_FILE_CREATED . '</th><th>' . _AM_SYSTEM_MAINTENANCE_DUMP_RESULT . '</th></tr><tr><td colspan="2" align="center"><a href="' . XOOPS_URL . '/modules/system/admin/maintenance/dump/' . $file_name . '">' . $file_name . '</a></td><td class="xo-actions txtcenter"><img src="' . system_AdminIcons('success.png') . '" /></td><tr></table>'; |
|
404 | + $ret[1] .= '<table class="outer"><tr><th colspan="2" align="center">'._AM_SYSTEM_MAINTENANCE_DUMP_FILE_CREATED.'</th><th>'._AM_SYSTEM_MAINTENANCE_DUMP_RESULT.'</th></tr><tr><td colspan="2" align="center"><a href="'.XOOPS_URL.'/modules/system/admin/maintenance/dump/'.$file_name.'">'.$file_name.'</a></td><td class="xo-actions txtcenter"><img src="'.system_AdminIcons('success.png').'" /></td><tr></table>'; |
|
405 | 405 | } else { |
406 | - $ret[1] .= '<table class="outer"><tr><th colspan="2" align="center">' . _AM_SYSTEM_MAINTENANCE_DUMP_FILE_CREATED . '</th><th>' . _AM_SYSTEM_MAINTENANCE_DUMP_RESULT . '</th></tr><tr><td colspan="2" class="xo-actions txtcenter">' . $file_name . '</td><td class="xo-actions txtcenter"><img src="' . system_AdminIcons('cancel.png') . '" /></td><tr></table>'; |
|
406 | + $ret[1] .= '<table class="outer"><tr><th colspan="2" align="center">'._AM_SYSTEM_MAINTENANCE_DUMP_FILE_CREATED.'</th><th>'._AM_SYSTEM_MAINTENANCE_DUMP_RESULT.'</th></tr><tr><td colspan="2" class="xo-actions txtcenter">'.$file_name.'</td><td class="xo-actions txtcenter"><img src="'.system_AdminIcons('cancel.png').'" /></td><tr></table>'; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | return $ret; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $members = ''; |
55 | 55 | for ($i = 0; $i < $total; ++$i) { |
56 | 56 | if ($onlines[$i]['online_uid'] > 0) { |
57 | - $members .= ' <a href="' . XOOPS_URL . '/userinfo.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_uname'] . '">' . $onlines[$i]['online_uname'] . '</a>,'; |
|
57 | + $members .= ' <a href="'.XOOPS_URL.'/userinfo.php?uid='.$onlines[$i]['online_uid'].'" title="'.$onlines[$i]['online_uname'].'">'.$onlines[$i]['online_uname'].'</a>,'; |
|
58 | 58 | } else { |
59 | 59 | ++$guests; |
60 | 60 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $block['online_total'] = sprintf(_ONLINEPHRASE, $total); |
63 | 63 | if (is_object($xoopsModule)) { |
64 | 64 | $mytotal = $online_handler->getCount(new Criteria('online_module', $xoopsModule->getVar('mid'))); |
65 | - $block['online_total'] .= ' (' . sprintf(_ONLINEPHRASEX, $mytotal, $xoopsModule->getVar('name')) . ')'; |
|
65 | + $block['online_total'] .= ' ('.sprintf(_ONLINEPHRASEX, $mytotal, $xoopsModule->getVar('name')).')'; |
|
66 | 66 | } |
67 | 67 | $block['lang_members'] = _MEMBERS; |
68 | 68 | $block['lang_guests'] = _GUESTS; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $block['lang_registernow'] = _MB_SYSTEM_RNOW; |
94 | 94 | //$block['lang_rememberme'] = _MB_SYSTEM_REMEMBERME; |
95 | 95 | if ($xoopsConfig['use_ssl'] == 1 && $xoopsConfig['sslloginlink'] != '') { |
96 | - $block['sslloginlink'] = "<a href=\"javascript:openWithSelfMain('" . $xoopsConfig['sslloginlink'] . "', 'ssllogin', 300, 200);\">" . _MB_SYSTEM_SECURE . '</a>'; |
|
96 | + $block['sslloginlink'] = "<a href=\"javascript:openWithSelfMain('".$xoopsConfig['sslloginlink']."', 'ssllogin', 300, 200);\">"._MB_SYSTEM_SECURE.'</a>'; |
|
97 | 97 | } elseif ($GLOBALS['xoopsConfig']['usercookie']) { |
98 | 98 | $block['lang_rememberme'] = _MB_SYSTEM_REMEMBERME; |
99 | 99 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | foreach ($sublinks as $sublink) { |
140 | 140 | $block['modules'][$i]['sublinks'][] = array( |
141 | 141 | 'name' => $sublink['name'], |
142 | - 'url' => XOOPS_URL . '/modules/' . $modules[$i]->getVar('dirname') . '/' . $sublink['url']); |
|
142 | + 'url' => XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url']); |
|
143 | 143 | } |
144 | 144 | } else { |
145 | 145 | $block['modules'][$i]['sublinks'] = array(); |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | // waiting content for news |
210 | 210 | if (xoops_isActiveModule('news') && $module_handler->getCount(new Criteria('dirname', 'news'))) { |
211 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('stories') . ' WHERE published=0'); |
|
211 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('stories').' WHERE published=0'); |
|
212 | 212 | if ($result) { |
213 | - $block['modules'][0]['adminlink'] = XOOPS_URL . '/modules/news/admin/index.php?op=newarticle'; |
|
213 | + $block['modules'][0]['adminlink'] = XOOPS_URL.'/modules/news/admin/index.php?op=newarticle'; |
|
214 | 214 | list($block['modules'][0]['pendingnum']) = $xoopsDB->fetchRow($result); |
215 | 215 | $block['modules'][0]['lang_linkname'] = _MB_SYSTEM_SUBMS; |
216 | 216 | } |
@@ -218,21 +218,21 @@ discard block |
||
218 | 218 | |
219 | 219 | // waiting content for mylinks |
220 | 220 | if (xoops_isActiveModule('mylinks') && $module_handler->getCount(new Criteria('dirname', 'mylinks'))) { |
221 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_links') . ' WHERE status=0'); |
|
221 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('mylinks_links').' WHERE status=0'); |
|
222 | 222 | if ($result) { |
223 | - $block['modules'][1]['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/index.php?op=listNewLinks'; |
|
223 | + $block['modules'][1]['adminlink'] = XOOPS_URL.'/modules/mylinks/admin/index.php?op=listNewLinks'; |
|
224 | 224 | list($block['modules'][1]['pendingnum']) = $xoopsDB->fetchRow($result); |
225 | 225 | $block['modules'][1]['lang_linkname'] = _MB_SYSTEM_WLNKS; |
226 | 226 | } |
227 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_broken')); |
|
227 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('mylinks_broken')); |
|
228 | 228 | if ($result) { |
229 | - $block['modules'][2]['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/index.php?op=listBrokenLinks'; |
|
229 | + $block['modules'][2]['adminlink'] = XOOPS_URL.'/modules/mylinks/admin/index.php?op=listBrokenLinks'; |
|
230 | 230 | list($block['modules'][2]['pendingnum']) = $xoopsDB->fetchRow($result); |
231 | 231 | $block['modules'][2]['lang_linkname'] = _MB_SYSTEM_BLNK; |
232 | 232 | } |
233 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_mod')); |
|
233 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('mylinks_mod')); |
|
234 | 234 | if ($result) { |
235 | - $block['modules'][3]['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/index.php?op=listModReq'; |
|
235 | + $block['modules'][3]['adminlink'] = XOOPS_URL.'/modules/mylinks/admin/index.php?op=listModReq'; |
|
236 | 236 | list($block['modules'][3]['pendingnum']) = $xoopsDB->fetchRow($result); |
237 | 237 | $block['modules'][3]['lang_linkname'] = _MB_SYSTEM_MLNKS; |
238 | 238 | } |
@@ -240,39 +240,39 @@ discard block |
||
240 | 240 | |
241 | 241 | // waiting content for mydownloads |
242 | 242 | if (xoops_isActiveModule('mydownloads') && $module_handler->getCount(new Criteria('dirname', 'mydownloads'))) { |
243 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mydownloads_downloads') . ' WHERE status=0'); |
|
243 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('mydownloads_downloads').' WHERE status=0'); |
|
244 | 244 | if ($result) { |
245 | - $block['modules'][4]['adminlink'] = XOOPS_URL . '/modules/mydownloads/admin/index.php?op=listNewDownloads'; |
|
245 | + $block['modules'][4]['adminlink'] = XOOPS_URL.'/modules/mydownloads/admin/index.php?op=listNewDownloads'; |
|
246 | 246 | list($block['modules'][4]['pendingnum']) = $xoopsDB->fetchRow($result); |
247 | 247 | $block['modules'][4]['lang_linkname'] = _MB_SYSTEM_WDLS; |
248 | 248 | } |
249 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mydownloads_broken') . ''); |
|
249 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('mydownloads_broken').''); |
|
250 | 250 | if ($result) { |
251 | - $block['modules'][5]['adminlink'] = XOOPS_URL . '/modules/mydownloads/admin/index.php?op=listBrokenDownloads'; |
|
251 | + $block['modules'][5]['adminlink'] = XOOPS_URL.'/modules/mydownloads/admin/index.php?op=listBrokenDownloads'; |
|
252 | 252 | list($block['modules'][5]['pendingnum']) = $xoopsDB->fetchRow($result); |
253 | 253 | $block['modules'][5]['lang_linkname'] = _MB_SYSTEM_BFLS; |
254 | 254 | } |
255 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mydownloads_mod') . ''); |
|
255 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('mydownloads_mod').''); |
|
256 | 256 | if ($result) { |
257 | - $block['modules'][6]['adminlink'] = XOOPS_URL . '/modules/mydownloads/admin/index.php?op=listModReq'; |
|
257 | + $block['modules'][6]['adminlink'] = XOOPS_URL.'/modules/mydownloads/admin/index.php?op=listModReq'; |
|
258 | 258 | list($block['modules'][6]['pendingnum']) = $xoopsDB->fetchRow($result); |
259 | 259 | $block['modules'][6]['lang_linkname'] = _MB_SYSTEM_MFLS; |
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | 263 | // waiting content for xoops comments |
264 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xoopscomments') . ' WHERE com_status=1'); |
|
264 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('xoopscomments').' WHERE com_status=1'); |
|
265 | 265 | if ($result) { |
266 | - $block['modules'][7]['adminlink'] = XOOPS_URL . '/modules/system/admin.php?module=0&status=1&fct=comments'; |
|
266 | + $block['modules'][7]['adminlink'] = XOOPS_URL.'/modules/system/admin.php?module=0&status=1&fct=comments'; |
|
267 | 267 | list($block['modules'][7]['pendingnum']) = $xoopsDB->fetchRow($result); |
268 | 268 | $block['modules'][7]['lang_linkname'] = _MB_SYSTEM_COMPEND; |
269 | 269 | } |
270 | 270 | |
271 | 271 | // waiting content for TDMDownloads |
272 | 272 | if (xoops_isActiveModule('TDMdownloads') && $module_handler->getCount(new Criteria('dirname', 'TDMDownloads'))) { |
273 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tdmdownloads_downloads') . ' WHERE status=0'); |
|
273 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tdmdownloads_downloads').' WHERE status=0'); |
|
274 | 274 | if ($result) { |
275 | - $block['modules'][8]['adminlink'] = XOOPS_URL . '/modules/TDMDownloads/admin/downloads.php?op=list&statut_display=0'; |
|
275 | + $block['modules'][8]['adminlink'] = XOOPS_URL.'/modules/TDMDownloads/admin/downloads.php?op=list&statut_display=0'; |
|
276 | 276 | list($block['modules'][8]['pendingnum']) = $xoopsDB->fetchRow($result); |
277 | 277 | $block['modules'][8]['lang_linkname'] = _MB_SYSTEM_TDMDOWNLOADS; |
278 | 278 | } |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | |
281 | 281 | // waiting content for extgallery |
282 | 282 | if (xoops_isActiveModule('extgallery') && $module_handler->getCount(new Criteria('dirname', 'extgallery'))) { |
283 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('extgallery_publicphoto') . ' WHERE photo_approved=0'); |
|
283 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('extgallery_publicphoto').' WHERE photo_approved=0'); |
|
284 | 284 | if ($result) { |
285 | - $block['modules'][9]['adminlink'] = XOOPS_URL . '/modules/extgallery/admin/photo.php#pending-photo'; |
|
285 | + $block['modules'][9]['adminlink'] = XOOPS_URL.'/modules/extgallery/admin/photo.php#pending-photo'; |
|
286 | 286 | list($block['modules'][9]['pendingnum']) = $xoopsDB->fetchRow($result); |
287 | 287 | $block['modules'][9]['lang_linkname'] = _MB_SYSTEM_EXTGALLERY; |
288 | 288 | } |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | |
291 | 291 | // waiting content for smartsection |
292 | 292 | if (xoops_isActiveModule('smartsection') && $module_handler->getCount(new Criteria('dirname', 'smartsection'))) { |
293 | - $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('smartsection_items') . ' WHERE status=1'); |
|
293 | + $result = $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('smartsection_items').' WHERE status=1'); |
|
294 | 294 | if ($result) { |
295 | - $block['modules'][10]['adminlink'] = XOOPS_URL . '/modules/smartsection/admin/item.php'; |
|
295 | + $block['modules'][10]['adminlink'] = XOOPS_URL.'/modules/smartsection/admin/item.php'; |
|
296 | 296 | list($block['modules'][10]['pendingnum']) = $xoopsDB->fetchRow($result); |
297 | 297 | $block['modules'][10]['lang_linkname'] = _MB_SYSTEM_SMARTSECTION; |
298 | 298 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $block = array(); |
315 | 315 | if (!empty($options[3])) { |
316 | 316 | $block['showgroups'] = true; |
317 | - $result = $xoopsDB->query('SELECT u.uid, u.uname, u.email, u.user_viewemail, u.user_avatar, g.name AS groupname FROM ' . $xoopsDB->prefix('groups_users_link') . ' l LEFT JOIN ' . $xoopsDB->prefix('users') . ' u ON l.uid=u.uid LEFT JOIN ' . $xoopsDB->prefix('groups') . " g ON l.groupid=g.groupid WHERE g.group_type='Admin' ORDER BY l.groupid, u.uid"); |
|
317 | + $result = $xoopsDB->query('SELECT u.uid, u.uname, u.email, u.user_viewemail, u.user_avatar, g.name AS groupname FROM '.$xoopsDB->prefix('groups_users_link').' l LEFT JOIN '.$xoopsDB->prefix('users').' u ON l.uid=u.uid LEFT JOIN '.$xoopsDB->prefix('groups')." g ON l.groupid=g.groupid WHERE g.group_type='Admin' ORDER BY l.groupid, u.uid"); |
|
318 | 318 | if ($xoopsDB->getRowsNum($result) > 0) { |
319 | 319 | $prev_caption = ''; |
320 | 320 | $i = 0; |
@@ -327,21 +327,21 @@ discard block |
||
327 | 327 | $block['groups'][$i]['users'][] = array( |
328 | 328 | 'id' => $userinfo['uid'], |
329 | 329 | 'name' => $myts->htmlspecialchars($userinfo['uname']), |
330 | - 'msglink' => "<a href=\"javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userinfo['uid'] . "','pmlite',565,500);\"><img src=\"" . XOOPS_URL . "/images/icons/pm_small.gif\" border=\"0\" width=\"27\" height=\"17\" alt=\"\" /></a>", |
|
331 | - 'avatar' => XOOPS_UPLOAD_URL . '/' . $userinfo['user_avatar']); |
|
330 | + 'msglink' => "<a href=\"javascript:openWithSelfMain('".XOOPS_URL.'/pmlite.php?send2=1&to_userid='.$userinfo['uid']."','pmlite',565,500);\"><img src=\"".XOOPS_URL."/images/icons/pm_small.gif\" border=\"0\" width=\"27\" height=\"17\" alt=\"\" /></a>", |
|
331 | + 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']); |
|
332 | 332 | } else { |
333 | 333 | if ($userinfo['user_viewemail']) { |
334 | 334 | $block['groups'][$i]['users'][] = array( |
335 | 335 | 'id' => $userinfo['uid'], |
336 | 336 | 'name' => $myts->htmlspecialchars($userinfo['uname']), |
337 | - 'msglink' => '<a href="mailto:' . $userinfo['email'] . '"><img src="' . XOOPS_URL . '/images/icons/em_small.gif" border="0" width="16" height="14" alt="" /></a>', |
|
338 | - 'avatar' => XOOPS_UPLOAD_URL . '/' . $userinfo['user_avatar']); |
|
337 | + 'msglink' => '<a href="mailto:'.$userinfo['email'].'"><img src="'.XOOPS_URL.'/images/icons/em_small.gif" border="0" width="16" height="14" alt="" /></a>', |
|
338 | + 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']); |
|
339 | 339 | } else { |
340 | 340 | $block['groups'][$i]['users'][] = array( |
341 | 341 | 'id' => $userinfo['uid'], |
342 | 342 | 'name' => $myts->htmlspecialchars($userinfo['uname']), |
343 | 343 | 'msglink' => ' ', |
344 | - 'avatar' => XOOPS_UPLOAD_URL . '/' . $userinfo['user_avatar']); |
|
344 | + 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | ++$i; |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | } else { |
351 | 351 | $block['showgroups'] = false; |
352 | 352 | } |
353 | - $block['logourl'] = XOOPS_URL . '/images/' . $options[2]; |
|
354 | - $block['recommendlink'] = "<a href=\"javascript:openWithSelfMain('" . XOOPS_URL . '/misc.php?action=showpopups&type=friend&op=sendform&t=' . time() . "','friend'," . $options[0] . ',' . $options[1] . ")\">" . _MB_SYSTEM_RECO . '</a>'; |
|
353 | + $block['logourl'] = XOOPS_URL.'/images/'.$options[2]; |
|
354 | + $block['recommendlink'] = "<a href=\"javascript:openWithSelfMain('".XOOPS_URL.'/misc.php?action=showpopups&type=friend&op=sendform&t='.time()."','friend',".$options[0].','.$options[1].")\">"._MB_SYSTEM_RECO.'</a>'; |
|
355 | 355 | |
356 | 356 | return $block; |
357 | 357 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $count = count($newmembers); |
376 | 376 | for ($i = 0; $i < $count; ++$i) { |
377 | 377 | if ($options[1] == 1) { |
378 | - $block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') !== 'blank.gif' ? XOOPS_UPLOAD_URL . '/' . $newmembers[$i]->getVar('user_avatar') : ''; |
|
378 | + $block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') !== 'blank.gif' ? XOOPS_UPLOAD_URL . '/'.$newmembers[$i]->getVar('user_avatar') : ''; |
|
379 | 379 | } else { |
380 | 380 | $block['users'][$i]['avatar'] = ''; |
381 | 381 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | for ($i = 0; $i < $count; ++$i) { |
413 | 413 | $block['users'][$i]['rank'] = $i + 1; |
414 | 414 | if ($options[1] == 1) { |
415 | - $block['users'][$i]['avatar'] = $topposters[$i]->getVar('user_avatar') !== 'blank.gif' ? XOOPS_UPLOAD_URL . '/' . $topposters[$i]->getVar('user_avatar') : ''; |
|
415 | + $block['users'][$i]['avatar'] = $topposters[$i]->getVar('user_avatar') !== 'blank.gif' ? XOOPS_UPLOAD_URL . '/'.$topposters[$i]->getVar('user_avatar') : ''; |
|
416 | 416 | } else { |
417 | 417 | $block['users'][$i]['avatar'] = ''; |
418 | 418 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | function b_system_comments_show($options) |
433 | 433 | { |
434 | 434 | $block = array(); |
435 | - include_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; |
|
435 | + include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; |
|
436 | 436 | $comment_handler = xoops_getHandler('comment'); |
437 | 437 | $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); |
438 | 438 | $criteria->setLimit((int)$options[0]); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $moduleperm_handler = xoops_getHandler('groupperm'); |
445 | 445 | $gperm_groupid = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); |
446 | 446 | $criteria1 = new CriteriaCompo(new Criteria('gperm_name', 'module_read', '=')); |
447 | - $criteria1->add(new Criteria('gperm_groupid', '(' . implode(',', $gperm_groupid) . ')', 'IN')); |
|
447 | + $criteria1->add(new Criteria('gperm_groupid', '('.implode(',', $gperm_groupid).')', 'IN')); |
|
448 | 448 | $perms = $moduleperm_handler->getObjects($criteria1, true); |
449 | 449 | $modIds = array(); |
450 | 450 | foreach ($perms as $item) { |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | if (count($modIds) > 0) { |
454 | 454 | $modIds = array_unique($modIds); |
455 | - $criteria->add(new Criteria('com_modid', '(' . implode(',', $modIds) . ')', 'IN')); |
|
455 | + $criteria->add(new Criteria('com_modid', '('.implode(',', $modIds).')', 'IN')); |
|
456 | 456 | } |
457 | 457 | // Check modules permissions |
458 | 458 | |
@@ -465,26 +465,26 @@ discard block |
||
465 | 465 | $comment_config = array(); |
466 | 466 | foreach (array_keys($comments) as $i) { |
467 | 467 | $mid = $comments[$i]->getVar('com_modid'); |
468 | - $com['module'] = '<a href="' . XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/">' . $modules[$mid]->getVar('name') . '</a>'; |
|
468 | + $com['module'] = '<a href="'.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/">'.$modules[$mid]->getVar('name').'</a>'; |
|
469 | 469 | if (!isset($comment_config[$mid])) { |
470 | 470 | $comment_config[$mid] = $modules[$mid]->getInfo('comments'); |
471 | 471 | } |
472 | 472 | $com['id'] = $i; |
473 | - $com['title'] = '<a href="' . XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/' . $comment_config[$mid]['pageName'] . '?' . $comment_config[$mid]['itemName'] . '=' . $comments[$i]->getVar('com_itemid') . '&com_id=' . $i . '&com_rootid=' . $comments[$i]->getVar('com_rootid') . '&' . htmlspecialchars($comments[$i]->getVar('com_exparams')) . '#comment' . $i . '">' . $comments[$i]->getVar('com_title') . '</a>'; |
|
473 | + $com['title'] = '<a href="'.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'.$comment_config[$mid]['pageName'].'?'.$comment_config[$mid]['itemName'].'='.$comments[$i]->getVar('com_itemid').'&com_id='.$i.'&com_rootid='.$comments[$i]->getVar('com_rootid').'&'.htmlspecialchars($comments[$i]->getVar('com_exparams')).'#comment'.$i.'">'.$comments[$i]->getVar('com_title').'</a>'; |
|
474 | 474 | $com['icon'] = htmlspecialchars($comments[$i]->getVar('com_icon'), ENT_QUOTES); |
475 | 475 | $com['icon'] = ($com['icon'] != '') ? $com['icon'] : 'icon1.gif'; |
476 | 476 | $com['time'] = formatTimestamp($comments[$i]->getVar('com_created'), 'm'); |
477 | 477 | if ($comments[$i]->getVar('com_uid') > 0) { |
478 | 478 | $poster = $member_handler->getUser($comments[$i]->getVar('com_uid')); |
479 | 479 | if (is_object($poster)) { |
480 | - $com['poster'] = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $comments[$i]->getVar('com_uid') . '">' . $poster->getVar('uname') . '</a>'; |
|
480 | + $com['poster'] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$comments[$i]->getVar('com_uid').'">'.$poster->getVar('uname').'</a>'; |
|
481 | 481 | } else { |
482 | 482 | $com['poster'] = $GLOBALS['xoopsConfig']['anonymous']; |
483 | 483 | } |
484 | 484 | } else { |
485 | 485 | $com['poster'] = $GLOBALS['xoopsConfig']['anonymous']; |
486 | 486 | } |
487 | - $block['comments'][] =& $com; |
|
487 | + $block['comments'][] = & $com; |
|
488 | 488 | unset($com); |
489 | 489 | } |
490 | 490 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | function b_system_notification_show() |
499 | 499 | { |
500 | 500 | global $xoopsConfig, $xoopsUser, $xoopsModule; |
501 | - include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; |
|
502 | - include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php'; |
|
501 | + include_once XOOPS_ROOT_PATH.'/include/notification_functions.php'; |
|
502 | + include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/notification.php'; |
|
503 | 503 | // Notification must be enabled, and user must be logged in |
504 | 504 | if (empty($xoopsUser) || !notificationEnabled('block')) { |
505 | 505 | return false; // do not display block |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | // Now build the a nested associative array of info to pass |
509 | 509 | // to the block template. |
510 | 510 | $block = array(); |
511 | - $categories =& notificationSubscribableCategoryInfo(); |
|
511 | + $categories = & notificationSubscribableCategoryInfo(); |
|
512 | 512 | if (empty($categories)) { |
513 | 513 | return false; |
514 | 514 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | */ |
553 | 553 | function b_system_comments_edit($options) |
554 | 554 | { |
555 | - $inputtag = "<input type='text' name='options[]' value='" . (int)$options[0] . "' />"; |
|
555 | + $inputtag = "<input type='text' name='options[]' value='".(int)$options[0]."' />"; |
|
556 | 556 | $form = sprintf(_MB_SYSTEM_DISPLAYC, $inputtag); |
557 | 557 | |
558 | 558 | return $form; |
@@ -565,19 +565,19 @@ discard block |
||
565 | 565 | */ |
566 | 566 | function b_system_topposters_edit($options) |
567 | 567 | { |
568 | - include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
569 | - $inputtag = "<input type='text' name='options[]' value='" . (int)$options[0] . "' />"; |
|
568 | + include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
569 | + $inputtag = "<input type='text' name='options[]' value='".(int)$options[0]."' />"; |
|
570 | 570 | $form = sprintf(_MB_SYSTEM_DISPLAY, $inputtag); |
571 | - $form .= '<br>' . _MB_SYSTEM_DISPLAYA . " <input type='radio' id='options[]' name='options[]' value='1'"; |
|
571 | + $form .= '<br>'._MB_SYSTEM_DISPLAYA." <input type='radio' id='options[]' name='options[]' value='1'"; |
|
572 | 572 | if ($options[1] == 1) { |
573 | 573 | $form .= " checked"; |
574 | 574 | } |
575 | - $form .= ' /> ' . _YES . "<input type='radio' id='options[]' name='options[]' value='0'"; |
|
575 | + $form .= ' /> '._YES."<input type='radio' id='options[]' name='options[]' value='0'"; |
|
576 | 576 | if ($options[1] == 0) { |
577 | 577 | $form .= " checked"; |
578 | 578 | } |
579 | - $form .= ' /> ' . _NO . ''; |
|
580 | - $form .= '<br>' . _MB_SYSTEM_NODISPGR . "<br><select id='options[]' name='options[]' multiple='multiple'>"; |
|
579 | + $form .= ' /> '._NO.''; |
|
580 | + $form .= '<br>'._MB_SYSTEM_NODISPGR."<br><select id='options[]' name='options[]' multiple='multiple'>"; |
|
581 | 581 | $ranks = XoopsLists::getUserRankList(); |
582 | 582 | $size = count($options); |
583 | 583 | foreach ($ranks as $k => $v) { |
@@ -601,17 +601,17 @@ discard block |
||
601 | 601 | */ |
602 | 602 | function b_system_newmembers_edit($options) |
603 | 603 | { |
604 | - $inputtag = "<input type='text' name='options[]' value='" . $options[0] . "' />"; |
|
604 | + $inputtag = "<input type='text' name='options[]' value='".$options[0]."' />"; |
|
605 | 605 | $form = sprintf(_MB_SYSTEM_DISPLAY, $inputtag); |
606 | - $form .= '<br>' . _MB_SYSTEM_DISPLAYA . " <input type='radio' id='options[]' name='options[]' value='1'"; |
|
606 | + $form .= '<br>'._MB_SYSTEM_DISPLAYA." <input type='radio' id='options[]' name='options[]' value='1'"; |
|
607 | 607 | if ($options[1] == 1) { |
608 | 608 | $form .= " checked"; |
609 | 609 | } |
610 | - $form .= ' /> ' . _YES . "<input type='radio' id='options[]' name='options[]' value='0'"; |
|
610 | + $form .= ' /> '._YES."<input type='radio' id='options[]' name='options[]' value='0'"; |
|
611 | 611 | if ($options[1] == 0) { |
612 | 612 | $form .= " checked"; |
613 | 613 | } |
614 | - $form .= ' /> ' . _NO . ''; |
|
614 | + $form .= ' /> '._NO.''; |
|
615 | 615 | |
616 | 616 | return $form; |
617 | 617 | } |
@@ -623,23 +623,23 @@ discard block |
||
623 | 623 | */ |
624 | 624 | function b_system_info_edit($options) |
625 | 625 | { |
626 | - $form = _MB_SYSTEM_PWWIDTH . ' '; |
|
627 | - $form .= "<input type='text' name='options[]' value='" . $options[0] . "' />"; |
|
628 | - $form .= '<br>' . _MB_SYSTEM_PWHEIGHT . ' '; |
|
629 | - $form .= "<input type='text' name='options[]' value='" . $options[1] . "' />"; |
|
630 | - $form .= '<br>' . sprintf(_MB_SYSTEM_LOGO, XOOPS_URL . '/images/') . ' '; |
|
631 | - $form .= "<input type='text' name='options[]' value='" . $options[2] . "' />"; |
|
626 | + $form = _MB_SYSTEM_PWWIDTH.' '; |
|
627 | + $form .= "<input type='text' name='options[]' value='".$options[0]."' />"; |
|
628 | + $form .= '<br>'._MB_SYSTEM_PWHEIGHT.' '; |
|
629 | + $form .= "<input type='text' name='options[]' value='".$options[1]."' />"; |
|
630 | + $form .= '<br>'.sprintf(_MB_SYSTEM_LOGO, XOOPS_URL.'/images/').' '; |
|
631 | + $form .= "<input type='text' name='options[]' value='".$options[2]."' />"; |
|
632 | 632 | $chk = ''; |
633 | - $form .= '<br>' . _MB_SYSTEM_SADMIN . ' '; |
|
633 | + $form .= '<br>'._MB_SYSTEM_SADMIN.' '; |
|
634 | 634 | if ($options[3] == 1) { |
635 | 635 | $chk = " checked"; |
636 | 636 | } |
637 | - $form .= "<input type='radio' name='options[3]' value='1'" . $chk . ' /> ' . _YES . ''; |
|
637 | + $form .= "<input type='radio' name='options[3]' value='1'".$chk.' /> '._YES.''; |
|
638 | 638 | $chk = ''; |
639 | 639 | if ($options[3] == 0) { |
640 | 640 | $chk = " checked"; |
641 | 641 | } |
642 | - $form .= " <input type='radio' name='options[3]' value='0'" . $chk . ' />' . _NO . ''; |
|
642 | + $form .= " <input type='radio' name='options[3]' value='0'".$chk.' />'._NO.''; |
|
643 | 643 | |
644 | 644 | return $form; |
645 | 645 | } |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | if (!isset($options[2])) { |
658 | 658 | $options[2] = 3; // this was the fixed value pre 2.5.8 |
659 | 659 | } |
660 | - $selectSize = ($options[0] == 1) ? 1 : (int) $options[2]; |
|
660 | + $selectSize = ($options[0] == 1) ? 1 : (int)$options[2]; |
|
661 | 661 | $select = new XoopsFormSelect('', 'xoops_theme_select', $xoopsConfig['theme_set'], $selectSize); |
662 | 662 | foreach ($xoopsConfig['theme_set_allowed'] as $theme) { |
663 | 663 | $select->addOption($theme, $theme); |
@@ -665,11 +665,11 @@ discard block |
||
665 | 665 | |
666 | 666 | if ($options[0] == 1) { |
667 | 667 | $themeSelect = '<img vspace="2" id="xoops_theme_img" src="' |
668 | - . XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'] . '/shot.gif" ' |
|
669 | - . ' alt="screenshot" width="' . (int)$options[1] . '" />' |
|
668 | + . XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/shot.gif" ' |
|
669 | + . ' alt="screenshot" width="'.(int)$options[1].'" />' |
|
670 | 670 | . '<br>'; |
671 | 671 | $select->setExtra(' onchange="showImgSelected(\'xoops_theme_img\', \'xoops_theme_select\', \'themes\', \'/shot.gif\', ' |
672 | - . '\'' . XOOPS_URL . '\');" '); |
|
672 | + . '\''.XOOPS_URL.'\');" '); |
|
673 | 673 | $selectTray = new XoopsFormElementTray(''); |
674 | 674 | $selectTray->addElement($select); |
675 | 675 | $selectTray->addElement(new XoopsFormButton('', 'submit', _GO, 'submit')); |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | $themeSelect = $select->render(); |
682 | 682 | } |
683 | 683 | |
684 | - $block['theme_select'] = $themeSelect . '<br>(' . sprintf(_MB_SYSTEM_NUMTHEME, '<strong>' |
|
685 | - . count($xoopsConfig['theme_set_allowed']) . '</strong>') . ')<br>'; |
|
684 | + $block['theme_select'] = $themeSelect.'<br>('.sprintf(_MB_SYSTEM_NUMTHEME, '<strong>' |
|
685 | + . count($xoopsConfig['theme_set_allowed']).'</strong>').')<br>'; |
|
686 | 686 | |
687 | 687 | return $block; |
688 | 688 | } |
@@ -695,23 +695,23 @@ discard block |
||
695 | 695 | function b_system_themes_edit($options) |
696 | 696 | { |
697 | 697 | $chk = ''; |
698 | - $form = _MB_SYSTEM_THSHOW . ' '; |
|
698 | + $form = _MB_SYSTEM_THSHOW.' '; |
|
699 | 699 | if (!isset($options[2])) { |
700 | 700 | $options[2] = 3; // this was the fixed value pre 2.5.8 |
701 | 701 | } |
702 | 702 | if ($options[0] == 1) { |
703 | 703 | $chk = " checked"; |
704 | 704 | } |
705 | - $form .= "<input type='radio' name='options[0]' value='1'" . $chk . ' /> ' . _YES; |
|
705 | + $form .= "<input type='radio' name='options[0]' value='1'".$chk.' /> '._YES; |
|
706 | 706 | $chk = ''; |
707 | 707 | if ($options[0] == 0) { |
708 | 708 | $chk = ' checked'; |
709 | 709 | } |
710 | - $form .= ' <input type="radio" name="options[0]" value="0"' . $chk . ' />' . _NO; |
|
711 | - $form .= '<br>' . _MB_SYSTEM_THWIDTH . ' '; |
|
712 | - $form .= "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
713 | - $form .= '<br>' . _MB_SYSTEM_BLOCK_HEIGHT . ' '; |
|
714 | - $form .= "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
710 | + $form .= ' <input type="radio" name="options[0]" value="0"'.$chk.' />'._NO; |
|
711 | + $form .= '<br>'._MB_SYSTEM_THWIDTH.' '; |
|
712 | + $form .= "<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
713 | + $form .= '<br>'._MB_SYSTEM_BLOCK_HEIGHT.' '; |
|
714 | + $form .= "<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
715 | 715 | |
716 | 716 | return $form; |
717 | 717 | } |
@@ -432,9 +432,9 @@ |
||
432 | 432 | xoops_cp_header(); |
433 | 433 | // Display Question |
434 | 434 | xoops_confirm(array( |
435 | - 'op' => 'delete_ok', |
|
436 | - 'fct' => 'blocksadmin', |
|
437 | - 'bid' => $block->getVar('bid')), 'admin.php', sprintf(_AM_SYSTEM_BLOCKS_RUSUREDEL, $block->getVar('title'))); |
|
435 | + 'op' => 'delete_ok', |
|
436 | + 'fct' => 'blocksadmin', |
|
437 | + 'bid' => $block->getVar('bid')), 'admin.php', sprintf(_AM_SYSTEM_BLOCKS_RUSUREDEL, $block->getVar('title'))); |
|
438 | 438 | // Call Footer |
439 | 439 | xoops_cp_footer(); |
440 | 440 | } |
@@ -56,253 +56,253 @@ discard block |
||
56 | 56 | |
57 | 57 | switch ($op) { |
58 | 58 | |
59 | - case 'list': |
|
60 | - // Define main template |
|
61 | - $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
62 | - // Call Header |
|
63 | - xoops_cp_header(); |
|
64 | - // Define Stylesheet |
|
65 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
66 | - // Define scripts |
|
67 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
68 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
69 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
70 | - $xoTheme->addScript('modules/system/js/blocks.js'); |
|
71 | - // Define Breadcrumb and tips |
|
72 | - $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
73 | - $xoBreadCrumb->addHelp(system_adminVersion('blocksadmin', 'help')); |
|
74 | - $xoBreadCrumb->addTips(sprintf(_AM_SYSTEM_BLOCKS_TIPS, system_AdminIcons('block.png'), system_AdminIcons('success.png'), system_AdminIcons('cancel.png'))); |
|
75 | - $xoBreadCrumb->render(); |
|
76 | - |
|
77 | - // Initialize module handler |
|
78 | - /* @var $module_handler XoopsModuleHandler */ |
|
79 | - $module_handler = xoops_getHandler('module'); |
|
80 | - $modules = $module_handler->getObjects(null, true); |
|
81 | - $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); |
|
82 | - |
|
83 | - $criteria->add(new Criteria('isactive', 1)); |
|
84 | - // Modules for blocks to be visible in |
|
85 | - $display_list = $module_handler->getList($criteria); |
|
86 | - unset($criteria); |
|
87 | - // Initialize blocks handler |
|
88 | - /* @var $block_handler SystemBlockHandler */ |
|
89 | - $block_handler = xoops_getModuleHandler('block'); |
|
90 | - // Initialize module handler |
|
91 | - /* @var $module_handler XoopsModuleHandler */ |
|
92 | - $module_handler = xoops_getHandler('module'); |
|
93 | - $modules = $module_handler->getObjects(null, true); |
|
94 | - |
|
95 | - $filterform = new XoopsThemeForm('', 'filterform', 'admin.php', 'get'); |
|
96 | - $filterform->addElement(new XoopsFormHidden('fct', 'blocksadmin')); |
|
97 | - $filterform->addElement(new XoopsFormHidden('op', 'list')); |
|
98 | - $filterform->addElement(new XoopsFormHidden('filter', 1)); |
|
99 | - $sel_gen = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_GENERATOR, 'selgen', $selgen); |
|
100 | - $sel_gen->setExtra("onchange='submit()'"); |
|
101 | - $sel_gen->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES); |
|
102 | - $sel_gen->addOption(0, _AM_SYSTEM_BLOCKS_CUSTOM); |
|
103 | - foreach ($modules as $list) { |
|
104 | - $sel_gen->addOption($list->getVar('mid'), $list->getVar('name')); |
|
105 | - } |
|
106 | - $filterform->addElement($sel_gen); |
|
107 | - |
|
108 | - $sel_mod = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_SVISIBLEIN, 'selmod', $selmod); |
|
109 | - $sel_mod->setExtra("onchange='submit()'"); |
|
110 | - ksort($display_list); |
|
111 | - $display_list_spec[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; |
|
112 | - $display_list_spec[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; |
|
113 | - $display_list_spec[-2] = _AM_SYSTEM_BLOCKS_TYPES; |
|
114 | - $display_list = $display_list_spec + $display_list; |
|
115 | - foreach ($display_list as $k => $v) { |
|
116 | - $sel_mod->addOption($k, $v); |
|
117 | - } |
|
118 | - $filterform->addElement($sel_mod); |
|
119 | - |
|
120 | - // For selection of group access |
|
121 | - $sel_grp = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_GROUP, 'selgrp', $selgrp); |
|
122 | - $sel_grp->setExtra("onchange='submit()'"); |
|
123 | - /* @var $member_handler XoopsMemberHandler */ |
|
124 | - $member_handler = xoops_getHandler('member'); |
|
125 | - $group_list = $member_handler->getGroupList(); |
|
126 | - $sel_grp->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES); |
|
127 | - $sel_grp->addOption(0, _AM_SYSTEM_BLOCKS_UNASSIGNED); |
|
128 | - foreach ($group_list as $k => $v) { |
|
129 | - $sel_grp->addOption($k, $v); |
|
130 | - } |
|
131 | - $filterform->addElement($sel_grp); |
|
59 | + case 'list': |
|
60 | + // Define main template |
|
61 | + $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
62 | + // Call Header |
|
63 | + xoops_cp_header(); |
|
64 | + // Define Stylesheet |
|
65 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
66 | + // Define scripts |
|
67 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
68 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
69 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
70 | + $xoTheme->addScript('modules/system/js/blocks.js'); |
|
71 | + // Define Breadcrumb and tips |
|
72 | + $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
73 | + $xoBreadCrumb->addHelp(system_adminVersion('blocksadmin', 'help')); |
|
74 | + $xoBreadCrumb->addTips(sprintf(_AM_SYSTEM_BLOCKS_TIPS, system_AdminIcons('block.png'), system_AdminIcons('success.png'), system_AdminIcons('cancel.png'))); |
|
75 | + $xoBreadCrumb->render(); |
|
132 | 76 | |
133 | - $sel_vis = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_VISIBLE, 'selvis', $selvis); |
|
134 | - $sel_vis->setExtra("onchange='submit()'"); |
|
135 | - $sel_vis->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES); |
|
136 | - $sel_vis->addOption(0, _NO); |
|
137 | - $sel_vis->addOption(1, _YES); |
|
77 | + // Initialize module handler |
|
78 | + /* @var $module_handler XoopsModuleHandler */ |
|
79 | + $module_handler = xoops_getHandler('module'); |
|
80 | + $modules = $module_handler->getObjects(null, true); |
|
81 | + $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); |
|
82 | + |
|
83 | + $criteria->add(new Criteria('isactive', 1)); |
|
84 | + // Modules for blocks to be visible in |
|
85 | + $display_list = $module_handler->getList($criteria); |
|
86 | + unset($criteria); |
|
87 | + // Initialize blocks handler |
|
88 | + /* @var $block_handler SystemBlockHandler */ |
|
89 | + $block_handler = xoops_getModuleHandler('block'); |
|
90 | + // Initialize module handler |
|
91 | + /* @var $module_handler XoopsModuleHandler */ |
|
92 | + $module_handler = xoops_getHandler('module'); |
|
93 | + $modules = $module_handler->getObjects(null, true); |
|
94 | + |
|
95 | + $filterform = new XoopsThemeForm('', 'filterform', 'admin.php', 'get'); |
|
96 | + $filterform->addElement(new XoopsFormHidden('fct', 'blocksadmin')); |
|
97 | + $filterform->addElement(new XoopsFormHidden('op', 'list')); |
|
98 | + $filterform->addElement(new XoopsFormHidden('filter', 1)); |
|
99 | + $sel_gen = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_GENERATOR, 'selgen', $selgen); |
|
100 | + $sel_gen->setExtra("onchange='submit()'"); |
|
101 | + $sel_gen->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES); |
|
102 | + $sel_gen->addOption(0, _AM_SYSTEM_BLOCKS_CUSTOM); |
|
103 | + foreach ($modules as $list) { |
|
104 | + $sel_gen->addOption($list->getVar('mid'), $list->getVar('name')); |
|
105 | + } |
|
106 | + $filterform->addElement($sel_gen); |
|
107 | + |
|
108 | + $sel_mod = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_SVISIBLEIN, 'selmod', $selmod); |
|
109 | + $sel_mod->setExtra("onchange='submit()'"); |
|
110 | + ksort($display_list); |
|
111 | + $display_list_spec[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; |
|
112 | + $display_list_spec[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; |
|
113 | + $display_list_spec[-2] = _AM_SYSTEM_BLOCKS_TYPES; |
|
114 | + $display_list = $display_list_spec + $display_list; |
|
115 | + foreach ($display_list as $k => $v) { |
|
116 | + $sel_mod->addOption($k, $v); |
|
117 | + } |
|
118 | + $filterform->addElement($sel_mod); |
|
119 | + |
|
120 | + // For selection of group access |
|
121 | + $sel_grp = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_GROUP, 'selgrp', $selgrp); |
|
122 | + $sel_grp->setExtra("onchange='submit()'"); |
|
123 | + /* @var $member_handler XoopsMemberHandler */ |
|
124 | + $member_handler = xoops_getHandler('member'); |
|
125 | + $group_list = $member_handler->getGroupList(); |
|
126 | + $sel_grp->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES); |
|
127 | + $sel_grp->addOption(0, _AM_SYSTEM_BLOCKS_UNASSIGNED); |
|
128 | + foreach ($group_list as $k => $v) { |
|
129 | + $sel_grp->addOption($k, $v); |
|
130 | + } |
|
131 | + $filterform->addElement($sel_grp); |
|
138 | 132 | |
139 | - $filterform->addElement($sel_vis); |
|
133 | + $sel_vis = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_VISIBLE, 'selvis', $selvis); |
|
134 | + $sel_vis->setExtra("onchange='submit()'"); |
|
135 | + $sel_vis->addOption(-1, _AM_SYSTEM_BLOCKS_TYPES); |
|
136 | + $sel_vis->addOption(0, _NO); |
|
137 | + $sel_vis->addOption(1, _YES); |
|
140 | 138 | |
141 | - $filterform->assign($xoopsTpl); |
|
139 | + $filterform->addElement($sel_vis); |
|
142 | 140 | |
143 | - /* Get blocks */ |
|
144 | - $selvis = ($selvis == -1) ? null : $selvis; |
|
145 | - $selmod = ($selmod == -2) ? null : $selmod; |
|
146 | - $order_block = (isset($selvis) ? '' : 'b.visible DESC, ') . 'b.side,b.weight,b.bid'; |
|
141 | + $filterform->assign($xoopsTpl); |
|
147 | 142 | |
148 | - if ($selgrp == 0) { |
|
149 | - // get blocks that are not assigned to any groups |
|
150 | - $blocks_arr = $block_handler->getNonGroupedBlocks($selmod, $toponlyblock = false, $selvis, $order_block); |
|
151 | - } else { |
|
152 | - $blocks_arr = $block_handler->getAllByGroupModule($selgrp, $selmod, $toponlyblock = false, $selvis, $order_block); |
|
153 | - } |
|
143 | + /* Get blocks */ |
|
144 | + $selvis = ($selvis == -1) ? null : $selvis; |
|
145 | + $selmod = ($selmod == -2) ? null : $selmod; |
|
146 | + $order_block = (isset($selvis) ? '' : 'b.visible DESC, ') . 'b.side,b.weight,b.bid'; |
|
154 | 147 | |
155 | - if ($selgen >= 0) { |
|
156 | - foreach (array_keys($blocks_arr) as $bid) { |
|
157 | - if ($blocks_arr[$bid]->getVar('mid') != $selgen) { |
|
158 | - unset($blocks_arr[$bid]); |
|
159 | - } |
|
148 | + if ($selgrp == 0) { |
|
149 | + // get blocks that are not assigned to any groups |
|
150 | + $blocks_arr = $block_handler->getNonGroupedBlocks($selmod, $toponlyblock = false, $selvis, $order_block); |
|
151 | + } else { |
|
152 | + $blocks_arr = $block_handler->getAllByGroupModule($selgrp, $selmod, $toponlyblock = false, $selvis, $order_block); |
|
160 | 153 | } |
161 | - } |
|
162 | 154 | |
163 | - $arr = array(); |
|
164 | - foreach (array_keys($blocks_arr) as $i) { |
|
165 | - $arr[$i] = $blocks_arr[$i]->toArray(); |
|
166 | - $xoopsTpl->append_by_ref('blocks', $arr[$i]); |
|
167 | - } |
|
168 | - $block = $block_handler->create(); |
|
169 | - $blockform = $block->getForm(); |
|
170 | - $xoopsTpl->assign('blockform', $blockform->render()); |
|
171 | - // Call Footer |
|
172 | - xoops_cp_footer(); |
|
173 | - break; |
|
174 | - |
|
175 | - case 'add': |
|
176 | - // Define main template |
|
177 | - $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
178 | - // Call Header |
|
179 | - xoops_cp_header(); |
|
180 | - // Define Stylesheet |
|
181 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
182 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
183 | - // Define scripts |
|
184 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
185 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
186 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.form.js'); |
|
187 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
188 | - $xoTheme->addScript('modules/system/js/blocks.js'); |
|
189 | - // Define Breadcrumb and tips |
|
190 | - $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
191 | - $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADDBLOCK); |
|
192 | - $xoBreadCrumb->render(); |
|
193 | - // Initialize blocks handler |
|
194 | - $block_handler = xoops_getModuleHandler('block'); |
|
195 | - /* @var $block SystemBlock */ |
|
196 | - $block = $block_handler->create(); |
|
197 | - $blockform = $block->getForm(); |
|
198 | - $xoopsTpl->assign('blockform', $blockform->render()); |
|
199 | - // Call Footer |
|
200 | - xoops_cp_footer(); |
|
201 | - break; |
|
202 | - |
|
203 | - case 'display': |
|
204 | - // Initialize blocks handler |
|
205 | - /* @var $block_handler SystemBlockHandler */ |
|
206 | - $block_handler = xoops_getModuleHandler('block'); |
|
207 | - // Get variable |
|
208 | - $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
209 | - $visible = system_CleanVars($_POST, 'visible', 0, 'int'); |
|
210 | - if ($block_id > 0) { |
|
211 | - $block = $block_handler->get($block_id); |
|
212 | - $block->setVar('visible', $visible); |
|
213 | - if (!$block_handler->insert($block)) { |
|
214 | - $error = true; |
|
155 | + if ($selgen >= 0) { |
|
156 | + foreach (array_keys($blocks_arr) as $bid) { |
|
157 | + if ($blocks_arr[$bid]->getVar('mid') != $selgen) { |
|
158 | + unset($blocks_arr[$bid]); |
|
159 | + } |
|
160 | + } |
|
215 | 161 | } |
216 | - } |
|
217 | - break; |
|
218 | 162 | |
219 | - case 'drag': |
|
220 | - // Initialize blocks handler |
|
221 | - $block_handler = xoops_getModuleHandler('block'); |
|
222 | - // Get variable |
|
223 | - $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
224 | - $side = system_CleanVars($_POST, 'side', 0, 'int'); |
|
225 | - if ($block_id > 0) { |
|
226 | - $block = $block_handler->get($block_id); |
|
227 | - $block->setVar('side', $side); |
|
228 | - if (!$block_handler->insert($block)) { |
|
229 | - $error = true; |
|
163 | + $arr = array(); |
|
164 | + foreach (array_keys($blocks_arr) as $i) { |
|
165 | + $arr[$i] = $blocks_arr[$i]->toArray(); |
|
166 | + $xoopsTpl->append_by_ref('blocks', $arr[$i]); |
|
230 | 167 | } |
231 | - } |
|
232 | - break; |
|
168 | + $block = $block_handler->create(); |
|
169 | + $blockform = $block->getForm(); |
|
170 | + $xoopsTpl->assign('blockform', $blockform->render()); |
|
171 | + // Call Footer |
|
172 | + xoops_cp_footer(); |
|
173 | + break; |
|
233 | 174 | |
234 | - case 'order': |
|
235 | - // Initialize blocks handler |
|
236 | - $block_handler = xoops_getModuleHandler('block'); |
|
237 | - if (isset($_POST['blk'])) { |
|
238 | - $i = 0; |
|
239 | - foreach ($_POST['blk'] as $order) { |
|
240 | - if ($order > 0) { |
|
241 | - $block = $block_handler->get($order); |
|
242 | - $block->setVar('weight', $i); |
|
243 | - if (!$block_handler->insert($block)) { |
|
244 | - $error = true; |
|
175 | + case 'add': |
|
176 | + // Define main template |
|
177 | + $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
178 | + // Call Header |
|
179 | + xoops_cp_header(); |
|
180 | + // Define Stylesheet |
|
181 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
182 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
183 | + // Define scripts |
|
184 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
185 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
186 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.form.js'); |
|
187 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
188 | + $xoTheme->addScript('modules/system/js/blocks.js'); |
|
189 | + // Define Breadcrumb and tips |
|
190 | + $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
191 | + $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADDBLOCK); |
|
192 | + $xoBreadCrumb->render(); |
|
193 | + // Initialize blocks handler |
|
194 | + $block_handler = xoops_getModuleHandler('block'); |
|
195 | + /* @var $block SystemBlock */ |
|
196 | + $block = $block_handler->create(); |
|
197 | + $blockform = $block->getForm(); |
|
198 | + $xoopsTpl->assign('blockform', $blockform->render()); |
|
199 | + // Call Footer |
|
200 | + xoops_cp_footer(); |
|
201 | + break; |
|
202 | + |
|
203 | + case 'display': |
|
204 | + // Initialize blocks handler |
|
205 | + /* @var $block_handler SystemBlockHandler */ |
|
206 | + $block_handler = xoops_getModuleHandler('block'); |
|
207 | + // Get variable |
|
208 | + $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
209 | + $visible = system_CleanVars($_POST, 'visible', 0, 'int'); |
|
210 | + if ($block_id > 0) { |
|
211 | + $block = $block_handler->get($block_id); |
|
212 | + $block->setVar('visible', $visible); |
|
213 | + if (!$block_handler->insert($block)) { |
|
214 | + $error = true; |
|
215 | + } |
|
216 | + } |
|
217 | + break; |
|
218 | + |
|
219 | + case 'drag': |
|
220 | + // Initialize blocks handler |
|
221 | + $block_handler = xoops_getModuleHandler('block'); |
|
222 | + // Get variable |
|
223 | + $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
224 | + $side = system_CleanVars($_POST, 'side', 0, 'int'); |
|
225 | + if ($block_id > 0) { |
|
226 | + $block = $block_handler->get($block_id); |
|
227 | + $block->setVar('side', $side); |
|
228 | + if (!$block_handler->insert($block)) { |
|
229 | + $error = true; |
|
230 | + } |
|
231 | + } |
|
232 | + break; |
|
233 | + |
|
234 | + case 'order': |
|
235 | + // Initialize blocks handler |
|
236 | + $block_handler = xoops_getModuleHandler('block'); |
|
237 | + if (isset($_POST['blk'])) { |
|
238 | + $i = 0; |
|
239 | + foreach ($_POST['blk'] as $order) { |
|
240 | + if ($order > 0) { |
|
241 | + $block = $block_handler->get($order); |
|
242 | + $block->setVar('weight', $i); |
|
243 | + if (!$block_handler->insert($block)) { |
|
244 | + $error = true; |
|
245 | + } |
|
246 | + ++$i; |
|
245 | 247 | } |
246 | - ++$i; |
|
247 | 248 | } |
248 | 249 | } |
249 | - } |
|
250 | - exit; |
|
251 | - break; |
|
252 | - |
|
253 | - case 'preview': |
|
254 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
255 | - redirect_header('admin.php?fct=blocksadmin', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
256 | - } |
|
257 | - // Initialize blocks handler |
|
258 | - /* @var $block_handler XoopsBlockHandler */ |
|
259 | - $block_handler = xoops_getModuleHandler('block'); |
|
260 | - $block = $block_handler->create(); |
|
261 | - $block->setVars($_POST); |
|
262 | - $content = isset($_POST['content_block']) ? $_POST['content_block'] : ''; |
|
263 | - $block->setVar('content', $content); |
|
264 | - $myts = MyTextSanitizer::getInstance(); |
|
265 | - echo '<div id="xo-preview-dialog" title="' . $block->getVar('title', 's') . '">' . $block->getContent('s', $block->getVar('c_type')) . '</div>'; |
|
266 | - break; |
|
250 | + exit; |
|
251 | + break; |
|
267 | 252 | |
268 | - case 'save': |
|
269 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
270 | - redirect_header('admin.php?fct=blocksadmin', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
271 | - } |
|
272 | - // Initialize blocks handler |
|
273 | - $block_handler = xoops_getModuleHandler('block'); |
|
274 | - // Get avatar id |
|
275 | - $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
276 | - if ($block_id > 0) { |
|
277 | - $block = $block_handler->get($block_id); |
|
278 | - } else { |
|
279 | - $block = $block_handler->create(); |
|
280 | - } |
|
281 | - $block_type = system_CleanVars($_POST, 'block_type', '', 'string'); |
|
282 | - $block->setVar('block_type', $block_type); |
|
283 | - |
|
284 | - if (!$block->isCustom()) { |
|
253 | + case 'preview': |
|
254 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
255 | + redirect_header('admin.php?fct=blocksadmin', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
256 | + } |
|
257 | + // Initialize blocks handler |
|
258 | + /* @var $block_handler XoopsBlockHandler */ |
|
259 | + $block_handler = xoops_getModuleHandler('block'); |
|
260 | + $block = $block_handler->create(); |
|
285 | 261 | $block->setVars($_POST); |
286 | - $type = $block->getVar('block_type'); |
|
287 | - $name = $block->getVar('name'); |
|
288 | - // Save block options |
|
289 | - $options = $_POST['options']; |
|
290 | - if (isset($options)) { |
|
291 | - $options_count = count($options); |
|
292 | - if ($options_count > 0) { |
|
293 | - //Convert array values to comma-separated |
|
294 | - for ($i = 0; $i < $options_count; ++$i) { |
|
295 | - if (is_array($options[$i])) { |
|
296 | - $options[$i] = implode(',', $options[$i]); |
|
262 | + $content = isset($_POST['content_block']) ? $_POST['content_block'] : ''; |
|
263 | + $block->setVar('content', $content); |
|
264 | + $myts = MyTextSanitizer::getInstance(); |
|
265 | + echo '<div id="xo-preview-dialog" title="' . $block->getVar('title', 's') . '">' . $block->getContent('s', $block->getVar('c_type')) . '</div>'; |
|
266 | + break; |
|
267 | + |
|
268 | + case 'save': |
|
269 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
270 | + redirect_header('admin.php?fct=blocksadmin', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
271 | + } |
|
272 | + // Initialize blocks handler |
|
273 | + $block_handler = xoops_getModuleHandler('block'); |
|
274 | + // Get avatar id |
|
275 | + $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
276 | + if ($block_id > 0) { |
|
277 | + $block = $block_handler->get($block_id); |
|
278 | + } else { |
|
279 | + $block = $block_handler->create(); |
|
280 | + } |
|
281 | + $block_type = system_CleanVars($_POST, 'block_type', '', 'string'); |
|
282 | + $block->setVar('block_type', $block_type); |
|
283 | + |
|
284 | + if (!$block->isCustom()) { |
|
285 | + $block->setVars($_POST); |
|
286 | + $type = $block->getVar('block_type'); |
|
287 | + $name = $block->getVar('name'); |
|
288 | + // Save block options |
|
289 | + $options = $_POST['options']; |
|
290 | + if (isset($options)) { |
|
291 | + $options_count = count($options); |
|
292 | + if ($options_count > 0) { |
|
293 | + //Convert array values to comma-separated |
|
294 | + for ($i = 0; $i < $options_count; ++$i) { |
|
295 | + if (is_array($options[$i])) { |
|
296 | + $options[$i] = implode(',', $options[$i]); |
|
297 | + } |
|
297 | 298 | } |
299 | + $options = implode('|', $options); |
|
300 | + $block->setVar('options', $options); |
|
298 | 301 | } |
299 | - $options = implode('|', $options); |
|
300 | - $block->setVar('options', $options); |
|
301 | 302 | } |
302 | - } |
|
303 | - } else { |
|
304 | - $block->setVars($_POST); |
|
305 | - switch ($block->getVar('c_type')) { |
|
303 | + } else { |
|
304 | + $block->setVars($_POST); |
|
305 | + switch ($block->getVar('c_type')) { |
|
306 | 306 | case 'H': |
307 | 307 | $name = _AM_SYSTEM_BLOCKS_CUSTOMHTML; |
308 | 308 | break; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | default: |
316 | 316 | $name = _AM_SYSTEM_BLOCKS_CUSTOMNOSMILE; |
317 | 317 | break; |
318 | - } |
|
318 | + } |
|
319 | 319 | } |
320 | 320 | $block->setVar('name', $name); |
321 | 321 | $block->setVar('isactive', 1); |
@@ -374,138 +374,138 @@ discard block |
||
374 | 374 | redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_BLOCKS_DBUPDATED); |
375 | 375 | break; |
376 | 376 | |
377 | - case 'edit': |
|
378 | - // Initialize blocks handler |
|
379 | - $block_handler = xoops_getModuleHandler('block'); |
|
380 | - // Get avatar id |
|
381 | - $block_id = system_CleanVars($_REQUEST, 'bid', 0, 'int'); |
|
382 | - if ($block_id > 0) { |
|
383 | - // Define main template |
|
384 | - $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
385 | - // Call Header |
|
386 | - xoops_cp_header(); |
|
387 | - // Define Stylesheet |
|
388 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
389 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
390 | - // Define scripts |
|
391 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
392 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
393 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.form.js'); |
|
394 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
395 | - // Define Breadcrumb and tips |
|
396 | - $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
397 | - $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_EDITBLOCK); |
|
398 | - $xoBreadCrumb->render(); |
|
399 | - |
|
400 | - $block = $block_handler->get($block_id); |
|
401 | - $blockform = $block->getForm(); |
|
402 | - $xoopsTpl->assign('blockform', $blockform->render()); |
|
403 | - // Call Footer |
|
404 | - xoops_cp_footer(); |
|
405 | - } else { |
|
406 | - redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_DBERROR); |
|
407 | - } |
|
408 | - break; |
|
409 | - |
|
410 | - case 'delete': |
|
411 | - // Initialize blocks handler |
|
412 | - /* @var $block_handler SystemBlockHandler */ |
|
413 | - $block_handler = xoops_getModuleHandler('block'); |
|
414 | - // Get avatar id |
|
415 | - $block_id = system_CleanVars($_REQUEST, 'bid', 0, 'int'); |
|
416 | - if ($block_id > 0) { |
|
417 | - $block = $block_handler->get($block_id); |
|
418 | - if ($block->getVar('block_type') === 'S') { |
|
419 | - redirect_header('admin.php?fct=blocksadmin', 4, _AM_SYSTEM_BLOCKS_SYSTEMCANT); |
|
420 | - } elseif ($block->getVar('block_type') === 'M') { |
|
421 | - // Fix for duplicated blocks created in 2.0.9 module update |
|
422 | - // A module block can be deleted if there is more than 1 that |
|
423 | - // has the same func_num/show_func which is mostly likely |
|
424 | - // be the one that was duplicated in 2.0.9 |
|
425 | - if (1 >= $count = $block_handler->countSimilarBlocks($block->getVar('mid'), $block->getVar('func_num'), $block->getVar('show_func'))) { |
|
426 | - redirect_header('admin.php?fct=blocksadmin', 4, _AM_SYSTEM_BLOCKS_MODULECANT); |
|
377 | + case 'edit': |
|
378 | + // Initialize blocks handler |
|
379 | + $block_handler = xoops_getModuleHandler('block'); |
|
380 | + // Get avatar id |
|
381 | + $block_id = system_CleanVars($_REQUEST, 'bid', 0, 'int'); |
|
382 | + if ($block_id > 0) { |
|
383 | + // Define main template |
|
384 | + $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
385 | + // Call Header |
|
386 | + xoops_cp_header(); |
|
387 | + // Define Stylesheet |
|
388 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
389 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
390 | + // Define scripts |
|
391 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
392 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
393 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.form.js'); |
|
394 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
395 | + // Define Breadcrumb and tips |
|
396 | + $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
397 | + $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_EDITBLOCK); |
|
398 | + $xoBreadCrumb->render(); |
|
399 | + |
|
400 | + $block = $block_handler->get($block_id); |
|
401 | + $blockform = $block->getForm(); |
|
402 | + $xoopsTpl->assign('blockform', $blockform->render()); |
|
403 | + // Call Footer |
|
404 | + xoops_cp_footer(); |
|
405 | + } else { |
|
406 | + redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_DBERROR); |
|
407 | + } |
|
408 | + break; |
|
409 | + |
|
410 | + case 'delete': |
|
411 | + // Initialize blocks handler |
|
412 | + /* @var $block_handler SystemBlockHandler */ |
|
413 | + $block_handler = xoops_getModuleHandler('block'); |
|
414 | + // Get avatar id |
|
415 | + $block_id = system_CleanVars($_REQUEST, 'bid', 0, 'int'); |
|
416 | + if ($block_id > 0) { |
|
417 | + $block = $block_handler->get($block_id); |
|
418 | + if ($block->getVar('block_type') === 'S') { |
|
419 | + redirect_header('admin.php?fct=blocksadmin', 4, _AM_SYSTEM_BLOCKS_SYSTEMCANT); |
|
420 | + } elseif ($block->getVar('block_type') === 'M') { |
|
421 | + // Fix for duplicated blocks created in 2.0.9 module update |
|
422 | + // A module block can be deleted if there is more than 1 that |
|
423 | + // has the same func_num/show_func which is mostly likely |
|
424 | + // be the one that was duplicated in 2.0.9 |
|
425 | + if (1 >= $count = $block_handler->countSimilarBlocks($block->getVar('mid'), $block->getVar('func_num'), $block->getVar('show_func'))) { |
|
426 | + redirect_header('admin.php?fct=blocksadmin', 4, _AM_SYSTEM_BLOCKS_MODULECANT); |
|
427 | + } |
|
427 | 428 | } |
429 | + // Define main template |
|
430 | + $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; |
|
431 | + // Call Header |
|
432 | + xoops_cp_header(); |
|
433 | + // Display Question |
|
434 | + xoops_confirm(array( |
|
435 | + 'op' => 'delete_ok', |
|
436 | + 'fct' => 'blocksadmin', |
|
437 | + 'bid' => $block->getVar('bid')), 'admin.php', sprintf(_AM_SYSTEM_BLOCKS_RUSUREDEL, $block->getVar('title'))); |
|
438 | + // Call Footer |
|
439 | + xoops_cp_footer(); |
|
428 | 440 | } |
429 | - // Define main template |
|
430 | - $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; |
|
431 | - // Call Header |
|
432 | - xoops_cp_header(); |
|
433 | - // Display Question |
|
434 | - xoops_confirm(array( |
|
435 | - 'op' => 'delete_ok', |
|
436 | - 'fct' => 'blocksadmin', |
|
437 | - 'bid' => $block->getVar('bid')), 'admin.php', sprintf(_AM_SYSTEM_BLOCKS_RUSUREDEL, $block->getVar('title'))); |
|
438 | - // Call Footer |
|
439 | - xoops_cp_footer(); |
|
440 | - } |
|
441 | - break; |
|
441 | + break; |
|
442 | 442 | |
443 | - case 'delete_ok': |
|
444 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
445 | - redirect_header('admin.php?fct=blocksadmin', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
446 | - } |
|
447 | - // Initialize blocks handler |
|
448 | - $block_handler = xoops_getModuleHandler('block'); |
|
449 | - // Get avatar id |
|
450 | - $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
451 | - if ($block_id > 0) { |
|
452 | - $block = $block_handler->get($block_id); |
|
453 | - if ($block_handler->delete($block)) { |
|
454 | - // Delete Group link |
|
455 | - $blocklinkmodule_handler = xoops_getModuleHandler('blocklinkmodule'); |
|
456 | - $blocklinkmodule = $blocklinkmodule_handler->getObjects(new CriteriaCompo(new Criteria('block_id', $block_id))); |
|
457 | - foreach ($blocklinkmodule as $link) { |
|
458 | - $blocklinkmodule_handler->delete($link, true); |
|
459 | - } |
|
460 | - // Delete Group permission |
|
461 | - /* @var $groupperm_handler XoopsGroupPermHandler */ |
|
462 | - $groupperm_handler = xoops_getHandler('groupperm'); |
|
463 | - $criteria = new CriteriaCompo(new Criteria('gperm_name', 'block_read')); |
|
464 | - $criteria->add(new Criteria('gperm_itemid', $block_id)); |
|
465 | - $groupperm = $groupperm_handler->getObjects($criteria); |
|
466 | - foreach ($groupperm as $perm) { |
|
467 | - $groupperm_handler->delete($perm, true); |
|
468 | - } |
|
469 | - // Delete template |
|
470 | - if ($block->getVar('template') != '') { |
|
471 | - $tplfile_handler = xoops_getHandler('tplfile'); |
|
472 | - $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block_id); |
|
473 | - if (count($btemplate) > 0) { |
|
474 | - $tplfile_handler->delete($btemplate[0]); |
|
443 | + case 'delete_ok': |
|
444 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
445 | + redirect_header('admin.php?fct=blocksadmin', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
446 | + } |
|
447 | + // Initialize blocks handler |
|
448 | + $block_handler = xoops_getModuleHandler('block'); |
|
449 | + // Get avatar id |
|
450 | + $block_id = system_CleanVars($_POST, 'bid', 0, 'int'); |
|
451 | + if ($block_id > 0) { |
|
452 | + $block = $block_handler->get($block_id); |
|
453 | + if ($block_handler->delete($block)) { |
|
454 | + // Delete Group link |
|
455 | + $blocklinkmodule_handler = xoops_getModuleHandler('blocklinkmodule'); |
|
456 | + $blocklinkmodule = $blocklinkmodule_handler->getObjects(new CriteriaCompo(new Criteria('block_id', $block_id))); |
|
457 | + foreach ($blocklinkmodule as $link) { |
|
458 | + $blocklinkmodule_handler->delete($link, true); |
|
459 | + } |
|
460 | + // Delete Group permission |
|
461 | + /* @var $groupperm_handler XoopsGroupPermHandler */ |
|
462 | + $groupperm_handler = xoops_getHandler('groupperm'); |
|
463 | + $criteria = new CriteriaCompo(new Criteria('gperm_name', 'block_read')); |
|
464 | + $criteria->add(new Criteria('gperm_itemid', $block_id)); |
|
465 | + $groupperm = $groupperm_handler->getObjects($criteria); |
|
466 | + foreach ($groupperm as $perm) { |
|
467 | + $groupperm_handler->delete($perm, true); |
|
475 | 468 | } |
469 | + // Delete template |
|
470 | + if ($block->getVar('template') != '') { |
|
471 | + $tplfile_handler = xoops_getHandler('tplfile'); |
|
472 | + $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block_id); |
|
473 | + if (count($btemplate) > 0) { |
|
474 | + $tplfile_handler->delete($btemplate[0]); |
|
475 | + } |
|
476 | + } |
|
477 | + redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_BLOCKS_DBUPDATED); |
|
476 | 478 | } |
477 | - redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_BLOCKS_DBUPDATED); |
|
479 | + } else { |
|
480 | + redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_DBERROR); |
|
478 | 481 | } |
479 | - } else { |
|
480 | - redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_DBERROR); |
|
481 | - } |
|
482 | - break; |
|
483 | - |
|
484 | - case 'clone': |
|
485 | - // Initialize blocks handler |
|
486 | - $block_handler = xoops_getModuleHandler('block'); |
|
487 | - // Get avatar id |
|
488 | - $block_id = system_CleanVars($_REQUEST, 'bid', 0, 'int'); |
|
489 | - if ($block_id > 0) { |
|
490 | - // Define main template |
|
491 | - $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
492 | - // Call Header |
|
493 | - xoops_cp_header(); |
|
494 | - // Define Stylesheet |
|
495 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
496 | - // Define Breadcrumb and tips |
|
497 | - $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
498 | - $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_CLONEBLOCK); |
|
499 | - $xoBreadCrumb->render(); |
|
500 | - /* @var $block XoopsBlock */ |
|
501 | - $block = $block_handler->get($block_id); |
|
502 | - $blockform = $block->getForm('clone'); |
|
503 | - $xoopsTpl->assign('blockform', $blockform->render()); |
|
504 | - // Call Footer |
|
505 | - xoops_cp_footer(); |
|
506 | - } else { |
|
507 | - redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_DBERROR); |
|
508 | - } |
|
509 | - break; |
|
482 | + break; |
|
483 | + |
|
484 | + case 'clone': |
|
485 | + // Initialize blocks handler |
|
486 | + $block_handler = xoops_getModuleHandler('block'); |
|
487 | + // Get avatar id |
|
488 | + $block_id = system_CleanVars($_REQUEST, 'bid', 0, 'int'); |
|
489 | + if ($block_id > 0) { |
|
490 | + // Define main template |
|
491 | + $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl'; |
|
492 | + // Call Header |
|
493 | + xoops_cp_header(); |
|
494 | + // Define Stylesheet |
|
495 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
496 | + // Define Breadcrumb and tips |
|
497 | + $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
|
498 | + $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_CLONEBLOCK); |
|
499 | + $xoBreadCrumb->render(); |
|
500 | + /* @var $block XoopsBlock */ |
|
501 | + $block = $block_handler->get($block_id); |
|
502 | + $blockform = $block->getForm('clone'); |
|
503 | + $xoopsTpl->assign('blockform', $blockform->render()); |
|
504 | + // Call Footer |
|
505 | + xoops_cp_footer(); |
|
506 | + } else { |
|
507 | + redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_DBERROR); |
|
508 | + } |
|
509 | + break; |
|
510 | 510 | |
511 | 511 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Call Header |
63 | 63 | xoops_cp_header(); |
64 | 64 | // Define Stylesheet |
65 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
65 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
66 | 66 | // Define scripts |
67 | 67 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
68 | 68 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | /* Get blocks */ |
144 | 144 | $selvis = ($selvis == -1) ? null : $selvis; |
145 | 145 | $selmod = ($selmod == -2) ? null : $selmod; |
146 | - $order_block = (isset($selvis) ? '' : 'b.visible DESC, ') . 'b.side,b.weight,b.bid'; |
|
146 | + $order_block = (isset($selvis) ? '' : 'b.visible DESC, ').'b.side,b.weight,b.bid'; |
|
147 | 147 | |
148 | 148 | if ($selgrp == 0) { |
149 | 149 | // get blocks that are not assigned to any groups |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | // Call Header |
179 | 179 | xoops_cp_header(); |
180 | 180 | // Define Stylesheet |
181 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
182 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
181 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
182 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/ui/'.xoops_getModuleOption('jquery_theme', 'system').'/ui.all.css'); |
|
183 | 183 | // Define scripts |
184 | 184 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
185 | 185 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $content = isset($_POST['content_block']) ? $_POST['content_block'] : ''; |
263 | 263 | $block->setVar('content', $content); |
264 | 264 | $myts = MyTextSanitizer::getInstance(); |
265 | - echo '<div id="xo-preview-dialog" title="' . $block->getVar('title', 's') . '">' . $block->getContent('s', $block->getVar('c_type')) . '</div>'; |
|
265 | + echo '<div id="xo-preview-dialog" title="'.$block->getVar('title', 's').'">'.$block->getContent('s', $block->getVar('c_type')).'</div>'; |
|
266 | 266 | break; |
267 | 267 | |
268 | 268 | case 'save': |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | // Call Header |
386 | 386 | xoops_cp_header(); |
387 | 387 | // Define Stylesheet |
388 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
389 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
388 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
389 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/ui/'.xoops_getModuleOption('jquery_theme', 'system').'/ui.all.css'); |
|
390 | 390 | // Define scripts |
391 | 391 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
392 | 392 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | // Call Header |
493 | 493 | xoops_cp_header(); |
494 | 494 | // Define Stylesheet |
495 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
495 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
496 | 496 | // Define Breadcrumb and tips |
497 | 497 | $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath')); |
498 | 498 | $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_CLONEBLOCK); |
@@ -76,61 +76,187 @@ discard block |
||
76 | 76 | |
77 | 77 | switch ($op) { |
78 | 78 | |
79 | - case 'list': |
|
80 | - // Define main template |
|
81 | - $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
82 | - // Call Header |
|
83 | - xoops_cp_header(); |
|
84 | - // Define Stylesheet |
|
85 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
86 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
87 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
88 | - // Define scripts |
|
89 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
90 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
91 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
92 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
93 | - // Define Breadcrumb and tips |
|
94 | - $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
95 | - $xoBreadCrumb->addHelp(system_adminVersion('images', 'help')); |
|
96 | - $xoBreadCrumb->addTips(_AM_SYSTEM_IMAGES_TIPS); |
|
97 | - $xoBreadCrumb->render(); |
|
98 | - |
|
99 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
100 | - $imagecategorys = $imgcat_handler->getObjects(); |
|
101 | - |
|
102 | - $catcount = count($imagecategorys); |
|
103 | - /* @var $image_handler XoopsImageHandler */ |
|
104 | - $image_handler = xoops_getHandler('image'); |
|
105 | - |
|
106 | - foreach (array_keys($imagecategorys) as $i) { |
|
107 | - $imgcat_read = $gperm_handler->checkRight('imgcat_read', $imagecategorys[$i]->getVar('imgcat_id'), $groups, $xoopsModule->mid()); |
|
108 | - $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imagecategorys[$i]->getVar('imgcat_id'), $groups, $xoopsModule->mid()); |
|
109 | - if ($imgcat_read || $imgcat_write) { |
|
110 | - $count = $image_handler->getCount(new Criteria('imgcat_id', $imagecategorys[$i]->getVar('imgcat_id'))); |
|
111 | - |
|
112 | - $cat_images['id'] = $imagecategorys[$i]->getVar('imgcat_id'); |
|
113 | - $cat_images['name'] = $imagecategorys[$i]->getVar('imgcat_name'); |
|
114 | - $cat_images['count'] = $count; |
|
115 | - $cat_images['size'] = $count; |
|
116 | - $cat_images['maxsize'] = $imagecategorys[$i]->getVar('imgcat_maxsize'); |
|
117 | - $cat_images['maxwidth'] = $imagecategorys[$i]->getVar('imgcat_maxwidth'); |
|
118 | - $cat_images['maxheight'] = $imagecategorys[$i]->getVar('imgcat_maxheight'); |
|
119 | - $cat_images['display'] = $imagecategorys[$i]->getVar('imgcat_display'); |
|
120 | - $cat_images['weight'] = $imagecategorys[$i]->getVar('imgcat_weight'); |
|
121 | - $cat_images['type'] = $imagecategorys[$i]->getVar('imgcat_type'); |
|
122 | - $cat_images['store'] = $imagecategorys[$i]->getVar('imgcat_storetype'); |
|
123 | - |
|
124 | - $xoopsTpl->append_by_ref('cat_img', $cat_images); |
|
125 | - unset($cat_images); |
|
126 | - } |
|
127 | - } |
|
128 | - // Image Form |
|
129 | - if (!empty($catcount)) { |
|
79 | + case 'list': |
|
80 | + // Define main template |
|
81 | + $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
82 | + // Call Header |
|
83 | + xoops_cp_header(); |
|
84 | + // Define Stylesheet |
|
85 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
86 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
87 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
88 | + // Define scripts |
|
89 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
90 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
91 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
92 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
93 | + // Define Breadcrumb and tips |
|
94 | + $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
95 | + $xoBreadCrumb->addHelp(system_adminVersion('images', 'help')); |
|
96 | + $xoBreadCrumb->addTips(_AM_SYSTEM_IMAGES_TIPS); |
|
97 | + $xoBreadCrumb->render(); |
|
98 | + |
|
99 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
100 | + $imagecategorys = $imgcat_handler->getObjects(); |
|
101 | + |
|
102 | + $catcount = count($imagecategorys); |
|
103 | + /* @var $image_handler XoopsImageHandler */ |
|
104 | + $image_handler = xoops_getHandler('image'); |
|
105 | + |
|
106 | + foreach (array_keys($imagecategorys) as $i) { |
|
107 | + $imgcat_read = $gperm_handler->checkRight('imgcat_read', $imagecategorys[$i]->getVar('imgcat_id'), $groups, $xoopsModule->mid()); |
|
108 | + $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imagecategorys[$i]->getVar('imgcat_id'), $groups, $xoopsModule->mid()); |
|
109 | + if ($imgcat_read || $imgcat_write) { |
|
110 | + $count = $image_handler->getCount(new Criteria('imgcat_id', $imagecategorys[$i]->getVar('imgcat_id'))); |
|
111 | + |
|
112 | + $cat_images['id'] = $imagecategorys[$i]->getVar('imgcat_id'); |
|
113 | + $cat_images['name'] = $imagecategorys[$i]->getVar('imgcat_name'); |
|
114 | + $cat_images['count'] = $count; |
|
115 | + $cat_images['size'] = $count; |
|
116 | + $cat_images['maxsize'] = $imagecategorys[$i]->getVar('imgcat_maxsize'); |
|
117 | + $cat_images['maxwidth'] = $imagecategorys[$i]->getVar('imgcat_maxwidth'); |
|
118 | + $cat_images['maxheight'] = $imagecategorys[$i]->getVar('imgcat_maxheight'); |
|
119 | + $cat_images['display'] = $imagecategorys[$i]->getVar('imgcat_display'); |
|
120 | + $cat_images['weight'] = $imagecategorys[$i]->getVar('imgcat_weight'); |
|
121 | + $cat_images['type'] = $imagecategorys[$i]->getVar('imgcat_type'); |
|
122 | + $cat_images['store'] = $imagecategorys[$i]->getVar('imgcat_storetype'); |
|
123 | + |
|
124 | + $xoopsTpl->append_by_ref('cat_img', $cat_images); |
|
125 | + unset($cat_images); |
|
126 | + } |
|
127 | + } |
|
128 | + // Image Form |
|
129 | + if (!empty($catcount)) { |
|
130 | + $form = new XoopsThemeForm(_ADDIMAGE, 'image_form', 'admin.php', 'post', true); |
|
131 | + $form->setExtra('enctype="multipart/form-data"'); |
|
132 | + $form->addElement(new XoopsFormText(_IMAGENAME, 'image_nicename', 50, 255), true); |
|
133 | + $select = new XoopsFormSelect(_IMAGECAT, 'imgcat_id'); |
|
134 | + $select->addOptionArray($imgcat_handler->getList($groups, 'imgcat_write')); |
|
135 | + $form->addElement($select, true); |
|
136 | + $form->addElement(new XoopsFormFile(_IMAGEFILE, 'image_file', 5000000)); |
|
137 | + $form->addElement(new XoopsFormText(_IMGWEIGHT, 'image_weight', 3, 4, 0)); |
|
138 | + $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'image_display', 1, _YES, _NO)); |
|
139 | + $form->addElement(new XoopsFormHidden('op', 'addfile')); |
|
140 | + $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
141 | + $form->addElement(new XoopsFormButton('', 'img_button', _SUBMIT, 'submit')); |
|
142 | + $form->assign($xoopsTpl); |
|
143 | + } |
|
144 | + // Category Form |
|
145 | + if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
146 | + $form = new XoopsThemeForm(_AM_SYSTEM_IMAGES_ADDCAT, 'imagecat_form', 'admin.php', 'post', true); |
|
147 | + $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATNAME, 'imgcat_name', 50, 255), true); |
|
148 | + $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATRGRP, 'readgroup', true, XOOPS_GROUP_ADMIN, 5, true)); |
|
149 | + $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATWGRP, 'writegroup', true, XOOPS_GROUP_ADMIN, 5, true)); |
|
150 | + $form->addElement(new XoopsFormText(_IMGMAXSIZE, 'imgcat_maxsize', 10, 10, 1000000)); |
|
151 | + $form->addElement(new XoopsFormText(_IMGMAXWIDTH, 'imgcat_maxwidth', 3, 4, 800)); |
|
152 | + $form->addElement(new XoopsFormText(_IMGMAXHEIGHT, 'imgcat_maxheight', 3, 4, 600)); |
|
153 | + $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATWEIGHT, 'imgcat_weight', 3, 4, 0)); |
|
154 | + $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_IMAGES_IMGCATDISPLAY, 'imgcat_display', 1, _YES, _NO)); |
|
155 | + |
|
156 | + $storetype = new XoopsFormRadio(_MD_IMGCATSTRTYPE . '<br><span style="color:#ff0000;">' . _MD_STRTYOPENG . '</span>', 'imgcat_storetype', 'file'); |
|
157 | + $storetype->addOptionArray(array('file' => _MD_ASFILE, 'db' => _MD_INDB)); |
|
158 | + $form->addElement($storetype); |
|
159 | + |
|
160 | + //$form->addElement(new XoopsFormHidden('imgcat_storetype', 'file')); |
|
161 | + $form->addElement(new XoopsFormHidden('op', 'addcat')); |
|
162 | + $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
163 | + $form->addElement(new XoopsFormButton('', 'imgcat_button', _SUBMIT, 'submit')); |
|
164 | + $form->assign($xoopsTpl); |
|
165 | + } |
|
166 | + // Call Footer |
|
167 | + xoops_cp_footer(); |
|
168 | + break; |
|
169 | + |
|
170 | + case 'display_cat': |
|
171 | + // Get Image Category handler |
|
172 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
173 | + // Get category id |
|
174 | + $imgcat_id = system_CleanVars($_POST, 'imgcat_id', 0, 'int'); |
|
175 | + if ($imgcat_id > 0) { |
|
176 | + $imgcat = $imgcat_handler->get($imgcat_id); |
|
177 | + $old = $imgcat->getVar('imgcat_display'); |
|
178 | + $imgcat->setVar('imgcat_display', !$old); |
|
179 | + if (!$imgcat_handler->insert($imgcat)) { |
|
180 | + $error = true; |
|
181 | + } |
|
182 | + } |
|
183 | + break; |
|
184 | + |
|
185 | + case 'listimg': |
|
186 | + // Get category id |
|
187 | + $imgcat_id = system_CleanVars($_REQUEST, 'imgcat_id', 0, 'int'); |
|
188 | + if ($imgcat_id <= 0) { |
|
189 | + redirect_header('admin.php?fct=images', 1); |
|
190 | + } |
|
191 | + // Get rights |
|
192 | + $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoopsModule->mid()); |
|
193 | + // Get category handler |
|
194 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
195 | + |
|
196 | + $imagecategory = $imgcat_handler->get($imgcat_id); |
|
197 | + if (!is_object($imagecategory)) { |
|
198 | + redirect_header('admin.php?fct=images', 1); |
|
199 | + } |
|
200 | + // Get image handler |
|
201 | + $image_handler = xoops_getHandler('image'); |
|
202 | + // Define main template |
|
203 | + $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
204 | + // Call header |
|
205 | + xoops_cp_header(); |
|
206 | + // Define Stylesheet |
|
207 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
208 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
209 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
210 | + // Define scripts |
|
211 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
212 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
213 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
214 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
215 | + |
|
216 | + // Define Breadcrumb and tips |
|
217 | + $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
218 | + $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name')); |
|
219 | + $xoBreadCrumb->addHelp(system_adminVersion('images', 'help') . '#cat'); |
|
220 | + $xoBreadCrumb->addTips(_AM_SYSTEM_IMAGES_TIPS); |
|
221 | + $xoBreadCrumb->render(); |
|
222 | + |
|
223 | + $criteria = new CriteriaCompo(new Criteria('imgcat_id', $imgcat_id)); |
|
224 | + $criteria->setSort('image_weight ASC, image_id'); |
|
225 | + $criteria->setOrder('DESC'); |
|
226 | + $imgcount = $image_handler->getCount($criteria); |
|
227 | + $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
228 | + $criteria->setStart($start); |
|
229 | + $criteria->setLimit(xoops_getModuleOption('images_pager', 'system')); |
|
230 | + $images = $image_handler->getObjects($criteria, true, false); |
|
231 | + |
|
232 | + if ($imagecategory->getVar('imgcat_storetype') === 'db') { |
|
233 | + $xoopsTpl->assign('db_store', 1); |
|
234 | + } |
|
235 | + |
|
236 | + foreach ($images as $listImage) { |
|
237 | + $xoopsTpl->append('images', $listImage->toArray()); |
|
238 | + } |
|
239 | + if ($imgcount > 0) { |
|
240 | + if ($imgcount > xoops_getModuleOption('images_pager', 'system')) { |
|
241 | + //include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
242 | + $nav = new XoopsPageNav($imgcount, xoops_getModuleOption('images_pager', 'system'), $start, 'start', 'fct=images&op=listimg&imgcat_id=' . $imgcat_id); |
|
243 | + $xoopsTpl->assign('nav_menu', $nav->renderNav(4)); |
|
244 | + } |
|
245 | + } |
|
246 | + |
|
247 | + if (file_exists(XOOPS_ROOT_PATH . '/modules/system/language/' . $GLOBALS['xoopsConfig']['language'] . '/images/lightbox-btn-close.gif')) { |
|
248 | + $xoopsTpl->assign('xoops_language', $GLOBALS['xoopsConfig']['language']); |
|
249 | + } else { |
|
250 | + $xoopsTpl->assign('xoops_language', 'english'); |
|
251 | + } |
|
252 | + $xoopsTpl->assign('listimg', true); |
|
253 | + $xoopsTpl->assign('imgcat_id', $imgcat_id); |
|
254 | + |
|
255 | + // Image Form |
|
130 | 256 | $form = new XoopsThemeForm(_ADDIMAGE, 'image_form', 'admin.php', 'post', true); |
131 | 257 | $form->setExtra('enctype="multipart/form-data"'); |
132 | 258 | $form->addElement(new XoopsFormText(_IMAGENAME, 'image_nicename', 50, 255), true); |
133 | - $select = new XoopsFormSelect(_IMAGECAT, 'imgcat_id'); |
|
259 | + $select = new XoopsFormSelect(_IMAGECAT, 'imgcat_id', $imgcat_id); |
|
134 | 260 | $select->addOptionArray($imgcat_handler->getList($groups, 'imgcat_write')); |
135 | 261 | $form->addElement($select, true); |
136 | 262 | $form->addElement(new XoopsFormFile(_IMAGEFILE, 'image_file', 5000000)); |
@@ -140,625 +266,499 @@ discard block |
||
140 | 266 | $form->addElement(new XoopsFormHidden('fct', 'images')); |
141 | 267 | $form->addElement(new XoopsFormButton('', 'img_button', _SUBMIT, 'submit')); |
142 | 268 | $form->assign($xoopsTpl); |
143 | - } |
|
144 | - // Category Form |
|
145 | - if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
146 | - $form = new XoopsThemeForm(_AM_SYSTEM_IMAGES_ADDCAT, 'imagecat_form', 'admin.php', 'post', true); |
|
147 | - $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATNAME, 'imgcat_name', 50, 255), true); |
|
148 | - $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATRGRP, 'readgroup', true, XOOPS_GROUP_ADMIN, 5, true)); |
|
149 | - $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATWGRP, 'writegroup', true, XOOPS_GROUP_ADMIN, 5, true)); |
|
150 | - $form->addElement(new XoopsFormText(_IMGMAXSIZE, 'imgcat_maxsize', 10, 10, 1000000)); |
|
151 | - $form->addElement(new XoopsFormText(_IMGMAXWIDTH, 'imgcat_maxwidth', 3, 4, 800)); |
|
152 | - $form->addElement(new XoopsFormText(_IMGMAXHEIGHT, 'imgcat_maxheight', 3, 4, 600)); |
|
153 | - $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATWEIGHT, 'imgcat_weight', 3, 4, 0)); |
|
154 | - $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_IMAGES_IMGCATDISPLAY, 'imgcat_display', 1, _YES, _NO)); |
|
155 | - |
|
156 | - $storetype = new XoopsFormRadio(_MD_IMGCATSTRTYPE . '<br><span style="color:#ff0000;">' . _MD_STRTYOPENG . '</span>', 'imgcat_storetype', 'file'); |
|
157 | - $storetype->addOptionArray(array('file' => _MD_ASFILE, 'db' => _MD_INDB)); |
|
158 | - $form->addElement($storetype); |
|
159 | - |
|
160 | - //$form->addElement(new XoopsFormHidden('imgcat_storetype', 'file')); |
|
161 | - $form->addElement(new XoopsFormHidden('op', 'addcat')); |
|
162 | - $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
163 | - $form->addElement(new XoopsFormButton('', 'imgcat_button', _SUBMIT, 'submit')); |
|
164 | - $form->assign($xoopsTpl); |
|
165 | - } |
|
166 | - // Call Footer |
|
167 | - xoops_cp_footer(); |
|
168 | - break; |
|
169 | - |
|
170 | - case 'display_cat': |
|
171 | - // Get Image Category handler |
|
172 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
173 | - // Get category id |
|
174 | - $imgcat_id = system_CleanVars($_POST, 'imgcat_id', 0, 'int'); |
|
175 | - if ($imgcat_id > 0) { |
|
176 | - $imgcat = $imgcat_handler->get($imgcat_id); |
|
177 | - $old = $imgcat->getVar('imgcat_display'); |
|
178 | - $imgcat->setVar('imgcat_display', !$old); |
|
179 | - if (!$imgcat_handler->insert($imgcat)) { |
|
180 | - $error = true; |
|
181 | - } |
|
182 | - } |
|
183 | - break; |
|
184 | - |
|
185 | - case 'listimg': |
|
186 | - // Get category id |
|
187 | - $imgcat_id = system_CleanVars($_REQUEST, 'imgcat_id', 0, 'int'); |
|
188 | - if ($imgcat_id <= 0) { |
|
189 | - redirect_header('admin.php?fct=images', 1); |
|
190 | - } |
|
191 | - // Get rights |
|
192 | - $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoopsModule->mid()); |
|
193 | - // Get category handler |
|
194 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
195 | - |
|
196 | - $imagecategory = $imgcat_handler->get($imgcat_id); |
|
197 | - if (!is_object($imagecategory)) { |
|
198 | - redirect_header('admin.php?fct=images', 1); |
|
199 | - } |
|
200 | - // Get image handler |
|
201 | - $image_handler = xoops_getHandler('image'); |
|
202 | - // Define main template |
|
203 | - $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
204 | - // Call header |
|
205 | - xoops_cp_header(); |
|
206 | - // Define Stylesheet |
|
207 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
208 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
209 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
210 | - // Define scripts |
|
211 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
212 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
213 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
214 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
215 | - |
|
216 | - // Define Breadcrumb and tips |
|
217 | - $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
218 | - $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name')); |
|
219 | - $xoBreadCrumb->addHelp(system_adminVersion('images', 'help') . '#cat'); |
|
220 | - $xoBreadCrumb->addTips(_AM_SYSTEM_IMAGES_TIPS); |
|
221 | - $xoBreadCrumb->render(); |
|
222 | - |
|
223 | - $criteria = new CriteriaCompo(new Criteria('imgcat_id', $imgcat_id)); |
|
224 | - $criteria->setSort('image_weight ASC, image_id'); |
|
225 | - $criteria->setOrder('DESC'); |
|
226 | - $imgcount = $image_handler->getCount($criteria); |
|
227 | - $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
228 | - $criteria->setStart($start); |
|
229 | - $criteria->setLimit(xoops_getModuleOption('images_pager', 'system')); |
|
230 | - $images = $image_handler->getObjects($criteria, true, false); |
|
231 | - |
|
232 | - if ($imagecategory->getVar('imgcat_storetype') === 'db') { |
|
233 | - $xoopsTpl->assign('db_store', 1); |
|
234 | - } |
|
235 | - |
|
236 | - foreach ($images as $listImage) { |
|
237 | - $xoopsTpl->append('images', $listImage->toArray()); |
|
238 | - } |
|
239 | - if ($imgcount > 0) { |
|
240 | - if ($imgcount > xoops_getModuleOption('images_pager', 'system')) { |
|
241 | - //include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
242 | - $nav = new XoopsPageNav($imgcount, xoops_getModuleOption('images_pager', 'system'), $start, 'start', 'fct=images&op=listimg&imgcat_id=' . $imgcat_id); |
|
243 | - $xoopsTpl->assign('nav_menu', $nav->renderNav(4)); |
|
244 | - } |
|
245 | - } |
|
246 | - |
|
247 | - if (file_exists(XOOPS_ROOT_PATH . '/modules/system/language/' . $GLOBALS['xoopsConfig']['language'] . '/images/lightbox-btn-close.gif')) { |
|
248 | - $xoopsTpl->assign('xoops_language', $GLOBALS['xoopsConfig']['language']); |
|
249 | - } else { |
|
250 | - $xoopsTpl->assign('xoops_language', 'english'); |
|
251 | - } |
|
252 | - $xoopsTpl->assign('listimg', true); |
|
253 | - $xoopsTpl->assign('imgcat_id', $imgcat_id); |
|
254 | - |
|
255 | - // Image Form |
|
256 | - $form = new XoopsThemeForm(_ADDIMAGE, 'image_form', 'admin.php', 'post', true); |
|
257 | - $form->setExtra('enctype="multipart/form-data"'); |
|
258 | - $form->addElement(new XoopsFormText(_IMAGENAME, 'image_nicename', 50, 255), true); |
|
259 | - $select = new XoopsFormSelect(_IMAGECAT, 'imgcat_id', $imgcat_id); |
|
260 | - $select->addOptionArray($imgcat_handler->getList($groups, 'imgcat_write')); |
|
261 | - $form->addElement($select, true); |
|
262 | - $form->addElement(new XoopsFormFile(_IMAGEFILE, 'image_file', 5000000)); |
|
263 | - $form->addElement(new XoopsFormText(_IMGWEIGHT, 'image_weight', 3, 4, 0)); |
|
264 | - $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'image_display', 1, _YES, _NO)); |
|
265 | - $form->addElement(new XoopsFormHidden('op', 'addfile')); |
|
266 | - $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
267 | - $form->addElement(new XoopsFormButton('', 'img_button', _SUBMIT, 'submit')); |
|
268 | - $form->assign($xoopsTpl); |
|
269 | - |
|
270 | - // Call Footer |
|
271 | - xoops_cp_footer(); |
|
272 | - break; |
|
273 | - |
|
274 | - case 'display_img': |
|
275 | - // Get image handler |
|
276 | - $image_handler = xoops_getHandler('image'); |
|
277 | - // Get image id |
|
278 | - $image_id = system_CleanVars($_POST, 'image_id', 0, 'int'); |
|
279 | - if ($image_id > 0) { |
|
280 | - $img = $image_handler->get($image_id); |
|
281 | - $old = $img->getVar('image_display'); |
|
282 | - $img->setVar('image_display', !$old); |
|
283 | - if (!$image_handler->insert($img)) { |
|
284 | - $error = true; |
|
285 | - } |
|
286 | - } |
|
287 | - break; |
|
288 | - |
|
289 | - case 'editimg': |
|
290 | - // Define main template |
|
291 | - $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
292 | - // Call Header |
|
293 | - xoops_cp_header(); |
|
294 | - // Define Stylesheet |
|
295 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
296 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
297 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
298 | - // Define scripts |
|
299 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
300 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
301 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
302 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
303 | - // Get image handler |
|
304 | - $image_handler = xoops_getHandler('image'); |
|
305 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
306 | - // Get image id |
|
307 | - $image_id = system_CleanVars($_REQUEST, 'image_id', 0, 'int'); |
|
308 | - if ($image_id > 0) { |
|
309 | - $image = $image_handler->get($image_id); |
|
310 | - $image_cat = $imgcat_handler->get($image->getVar('imgcat_id')); |
|
311 | - // Define Breadcrumb and tips |
|
312 | - $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
313 | - $xoBreadCrumb->addLink($image_cat->getVar('imgcat_name'), system_adminVersion('images', 'adminpath') . '&op=listimg&imgcat_id=' . $image->getVar('imgcat_id')); |
|
314 | - $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_EDITIMG); |
|
315 | - $xoBreadCrumb->render(); |
|
316 | - $msg = '<div class="txtcenter"><img class="tooltip" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="' . $image->getVar('image_nicename') . '" title="' . $image->getVar('image_nicename') . '" style="max-width:120px; max-height:120px;"/></div>'; |
|
317 | 269 | |
318 | - $xoopsTpl->assign('edit_thumbs', $msg); |
|
270 | + // Call Footer |
|
271 | + xoops_cp_footer(); |
|
272 | + break; |
|
273 | + |
|
274 | + case 'display_img': |
|
275 | + // Get image handler |
|
276 | + $image_handler = xoops_getHandler('image'); |
|
277 | + // Get image id |
|
278 | + $image_id = system_CleanVars($_POST, 'image_id', 0, 'int'); |
|
279 | + if ($image_id > 0) { |
|
280 | + $img = $image_handler->get($image_id); |
|
281 | + $old = $img->getVar('image_display'); |
|
282 | + $img->setVar('image_display', !$old); |
|
283 | + if (!$image_handler->insert($img)) { |
|
284 | + $error = true; |
|
285 | + } |
|
286 | + } |
|
287 | + break; |
|
319 | 288 | |
320 | - $form = new XoopsThemeForm(_AM_SYSTEM_IMAGES_EDITIMG, 'edit_form', 'admin.php', 'post', true); |
|
321 | - $form->setExtra('enctype="multipart/form-data"'); |
|
322 | - $form->addElement(new XoopsFormText(_IMAGENAME, 'image_nicename', 50, 255, $image->getVar('image_nicename')), true); |
|
323 | - $select = new XoopsFormSelect(_IMAGECAT, 'imgcat_id', $image->getVar('imgcat_id')); |
|
324 | - $select->addOptionArray($imgcat_handler->getList($groups, 'imgcat_write', $image->getVar('imgcat_write'))); |
|
325 | - $form->addElement($select, true); |
|
326 | - //$form->addElement(new XoopsFormFile( _IMAGEFILE, 'image_file', 5000000) ); |
|
327 | - $form->addElement(new XoopsFormText(_IMGWEIGHT, 'image_weight', 3, 4, $image->getVar('image_weight'))); |
|
328 | - $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'image_display', $image->getVar('image_display'), _YES, _NO)); |
|
329 | - $form->addElement(new XoopsFormHidden('image_id', $image_id)); |
|
330 | - $form->addElement(new XoopsFormHidden('op', 'save')); |
|
331 | - $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
332 | - //$form->addElement(new XoopsFormButton( '', 'img_button', _SUBMIT, 'submit' ) ); |
|
333 | - $form->addElement(new XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
334 | - $form->assign($xoopsTpl); |
|
335 | - } else { |
|
336 | - redirect_header('admin.php?fct=images', 1, _AM_SYSTEM_DBERROR); |
|
337 | - } |
|
338 | - // Call Footer |
|
339 | - xoops_cp_footer(); |
|
340 | - break; |
|
341 | - |
|
342 | - case 'delfile': |
|
343 | - // Get image handler |
|
344 | - $image_handler = xoops_getHandler('image'); |
|
345 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
346 | - // Call Header |
|
347 | - xoops_cp_header(); |
|
348 | - // Define Stylesheet |
|
349 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
350 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
351 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
352 | - // Define scripts |
|
353 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
354 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
355 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
356 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
357 | - // Get image id |
|
358 | - $image_id = system_CleanVars($_REQUEST, 'image_id', 0, 'int'); |
|
359 | - if ($image_id > 0) { |
|
360 | - $image = $image_handler->get($image_id); |
|
361 | - $image_cat = $imgcat_handler->get($image->getVar('imgcat_id')); |
|
362 | - if ($image_cat->getVar('imgcat_storetype') === 'db') { |
|
363 | - $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
289 | + case 'editimg': |
|
290 | + // Define main template |
|
291 | + $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
292 | + // Call Header |
|
293 | + xoops_cp_header(); |
|
294 | + // Define Stylesheet |
|
295 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
296 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
297 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
298 | + // Define scripts |
|
299 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
300 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
301 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
302 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
303 | + // Get image handler |
|
304 | + $image_handler = xoops_getHandler('image'); |
|
305 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
306 | + // Get image id |
|
307 | + $image_id = system_CleanVars($_REQUEST, 'image_id', 0, 'int'); |
|
308 | + if ($image_id > 0) { |
|
309 | + $image = $image_handler->get($image_id); |
|
310 | + $image_cat = $imgcat_handler->get($image->getVar('imgcat_id')); |
|
311 | + // Define Breadcrumb and tips |
|
312 | + $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
313 | + $xoBreadCrumb->addLink($image_cat->getVar('imgcat_name'), system_adminVersion('images', 'adminpath') . '&op=listimg&imgcat_id=' . $image->getVar('imgcat_id')); |
|
314 | + $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_EDITIMG); |
|
315 | + $xoBreadCrumb->render(); |
|
316 | + $msg = '<div class="txtcenter"><img class="tooltip" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="' . $image->getVar('image_nicename') . '" title="' . $image->getVar('image_nicename') . '" style="max-width:120px; max-height:120px;"/></div>'; |
|
317 | + |
|
318 | + $xoopsTpl->assign('edit_thumbs', $msg); |
|
319 | + |
|
320 | + $form = new XoopsThemeForm(_AM_SYSTEM_IMAGES_EDITIMG, 'edit_form', 'admin.php', 'post', true); |
|
321 | + $form->setExtra('enctype="multipart/form-data"'); |
|
322 | + $form->addElement(new XoopsFormText(_IMAGENAME, 'image_nicename', 50, 255, $image->getVar('image_nicename')), true); |
|
323 | + $select = new XoopsFormSelect(_IMAGECAT, 'imgcat_id', $image->getVar('imgcat_id')); |
|
324 | + $select->addOptionArray($imgcat_handler->getList($groups, 'imgcat_write', $image->getVar('imgcat_write'))); |
|
325 | + $form->addElement($select, true); |
|
326 | + //$form->addElement(new XoopsFormFile( _IMAGEFILE, 'image_file', 5000000) ); |
|
327 | + $form->addElement(new XoopsFormText(_IMGWEIGHT, 'image_weight', 3, 4, $image->getVar('image_weight'))); |
|
328 | + $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'image_display', $image->getVar('image_display'), _YES, _NO)); |
|
329 | + $form->addElement(new XoopsFormHidden('image_id', $image_id)); |
|
330 | + $form->addElement(new XoopsFormHidden('op', 'save')); |
|
331 | + $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
332 | + //$form->addElement(new XoopsFormButton( '', 'img_button', _SUBMIT, 'submit' ) ); |
|
333 | + $form->addElement(new XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
334 | + $form->assign($xoopsTpl); |
|
364 | 335 | } else { |
365 | - $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
366 | - } |
|
367 | - $msg .= '<div class="spacer">' . $image->getVar('image_nicename') . '</div>'; |
|
368 | - $msg .= '<div class="spacer">' . _AM_SYSTEM_IMAGES_RUDELIMG . '</div>'; |
|
369 | - xoops_confirm(array('op' => 'delfileok', 'image_id' => $image_id, 'fct' => 'images'), 'admin.php', $msg, _DELETE); |
|
370 | - } else { |
|
371 | - redirect_header('admin.php?fct=images', 1, _AM_SYSTEM_DBERROR); |
|
372 | - } |
|
373 | - // Call Footer |
|
374 | - xoops_cp_footer(); |
|
375 | - break; |
|
376 | - |
|
377 | - case 'delfileok': |
|
378 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
379 | - redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
380 | - } |
|
381 | - // Get image id |
|
382 | - $image_id = system_CleanVars($_POST, 'image_id', 0, 'int'); |
|
383 | - if ($image_id <= 0) { |
|
384 | - redirect_header('admin.php?fct=images', 1); |
|
385 | - } |
|
386 | - $image_handler = xoops_getHandler('image'); |
|
387 | - $image = $image_handler->get($image_id); |
|
388 | - if (!is_object($image)) { |
|
389 | - redirect_header('admin.php?fct=images', 1); |
|
390 | - } |
|
391 | - if (!$image_handler->delete($image)) { |
|
336 | + redirect_header('admin.php?fct=images', 1, _AM_SYSTEM_DBERROR); |
|
337 | + } |
|
338 | + // Call Footer |
|
339 | + xoops_cp_footer(); |
|
340 | + break; |
|
341 | + |
|
342 | + case 'delfile': |
|
343 | + // Get image handler |
|
344 | + $image_handler = xoops_getHandler('image'); |
|
345 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
346 | + // Call Header |
|
392 | 347 | xoops_cp_header(); |
393 | - xoops_error(sprintf(_AM_SYSTEM_IMAGES_FAILDEL, $image->getVar('image_id'))); |
|
348 | + // Define Stylesheet |
|
349 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
350 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
351 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
352 | + // Define scripts |
|
353 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
354 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
355 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
356 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
357 | + // Get image id |
|
358 | + $image_id = system_CleanVars($_REQUEST, 'image_id', 0, 'int'); |
|
359 | + if ($image_id > 0) { |
|
360 | + $image = $image_handler->get($image_id); |
|
361 | + $image_cat = $imgcat_handler->get($image->getVar('imgcat_id')); |
|
362 | + if ($image_cat->getVar('imgcat_storetype') === 'db') { |
|
363 | + $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
364 | + } else { |
|
365 | + $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
366 | + } |
|
367 | + $msg .= '<div class="spacer">' . $image->getVar('image_nicename') . '</div>'; |
|
368 | + $msg .= '<div class="spacer">' . _AM_SYSTEM_IMAGES_RUDELIMG . '</div>'; |
|
369 | + xoops_confirm(array('op' => 'delfileok', 'image_id' => $image_id, 'fct' => 'images'), 'admin.php', $msg, _DELETE); |
|
370 | + } else { |
|
371 | + redirect_header('admin.php?fct=images', 1, _AM_SYSTEM_DBERROR); |
|
372 | + } |
|
373 | + // Call Footer |
|
394 | 374 | xoops_cp_footer(); |
395 | - exit(); |
|
396 | - } |
|
397 | - @unlink(XOOPS_UPLOAD_PATH . '/' . $image->getVar('image_name')); |
|
398 | - redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
399 | - break; |
|
400 | - |
|
401 | - case 'save': |
|
402 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
403 | - redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
404 | - } |
|
405 | - // Get image handler |
|
406 | - $image_handler = xoops_getHandler('image'); |
|
407 | - // Call Header |
|
408 | - xoops_cp_header(); |
|
409 | - // Define Stylesheet |
|
410 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
411 | - // Get image id |
|
412 | - $image_id = system_CleanVars($_POST, 'image_id', 0, 'int'); |
|
413 | - if ($image_id > 0) { |
|
414 | - $image = $image_handler->get($image_id); |
|
415 | - $image->setVars($_POST); |
|
416 | - if (!$image_handler->insert($image)) { |
|
417 | - echo sprintf(_AM_SYSTEM_IMAGES_FAILSAVE, $avatar->getVar('avatar_name')); |
|
375 | + break; |
|
376 | + |
|
377 | + case 'delfileok': |
|
378 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
379 | + redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
380 | + } |
|
381 | + // Get image id |
|
382 | + $image_id = system_CleanVars($_POST, 'image_id', 0, 'int'); |
|
383 | + if ($image_id <= 0) { |
|
384 | + redirect_header('admin.php?fct=images', 1); |
|
385 | + } |
|
386 | + $image_handler = xoops_getHandler('image'); |
|
387 | + $image = $image_handler->get($image_id); |
|
388 | + if (!is_object($image)) { |
|
389 | + redirect_header('admin.php?fct=images', 1); |
|
390 | + } |
|
391 | + if (!$image_handler->delete($image)) { |
|
392 | + xoops_cp_header(); |
|
393 | + xoops_error(sprintf(_AM_SYSTEM_IMAGES_FAILDEL, $image->getVar('image_id'))); |
|
418 | 394 | xoops_cp_footer(); |
419 | - exit; |
|
395 | + exit(); |
|
420 | 396 | } |
397 | + @unlink(XOOPS_UPLOAD_PATH . '/' . $image->getVar('image_name')); |
|
421 | 398 | redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
422 | - } |
|
423 | - |
|
424 | - // Call Footer |
|
425 | - xoops_cp_footer(); |
|
426 | - break; |
|
427 | - |
|
428 | - case 'addfile': |
|
429 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
430 | - redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
431 | - } |
|
432 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
433 | - $imagecategory = $imgcat_handler->get((int)$imgcat_id); |
|
434 | - if (!is_object($imagecategory)) { |
|
435 | - redirect_header('admin.php?fct=images', 1); |
|
436 | - } |
|
437 | - xoops_load('xoopsmediauploader'); |
|
438 | - $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/images', array( |
|
439 | - 'image/gif', |
|
440 | - 'image/jpeg', |
|
441 | - 'image/pjpeg', |
|
442 | - 'image/x-png', |
|
443 | - 'image/png', |
|
444 | - 'image/bmp'), $imagecategory->getVar('imgcat_maxsize'), $imagecategory->getVar('imgcat_maxwidth'), $imagecategory->getVar('imgcat_maxheight')); |
|
445 | - $uploader->setPrefix('img'); |
|
446 | - $err = array(); |
|
447 | - $ucount = count($_POST['xoops_upload_file']); |
|
448 | - for ($i = 0; $i < $ucount; ++$i) { |
|
449 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) { |
|
450 | - if (!$uploader->upload()) { |
|
451 | - $err[] =& $uploader->getErrors(); |
|
452 | - } else { |
|
453 | - $image_handler = xoops_getHandler('image'); |
|
454 | - $image = $image_handler->create(); |
|
455 | - $image->setVar('image_name', 'images/' . $uploader->getSavedFileName()); |
|
456 | - $image->setVar('image_nicename', $image_nicename); |
|
457 | - $image->setVar('image_mimetype', $uploader->getMediaType()); |
|
458 | - $image->setVar('image_created', time()); |
|
459 | - $image_display = empty($image_display) ? 0 : 1; |
|
460 | - $image->setVar('image_display', $image_display); |
|
461 | - $image->setVar('image_weight', $image_weight); |
|
462 | - $image->setVar('imgcat_id', $imgcat_id); |
|
463 | - if ($imagecategory->getVar('imgcat_storetype') === 'db') { |
|
464 | - $fp = @fopen($uploader->getSavedDestination(), 'rb'); |
|
465 | - $fbinary = @fread($fp, filesize($uploader->getSavedDestination())); |
|
466 | - @fclose($fp); |
|
467 | - $image->setVar('image_body', $fbinary, true); |
|
468 | - @unlink($uploader->getSavedDestination()); |
|
469 | - } |
|
470 | - if (!$image_handler->insert($image)) { |
|
471 | - $err[] = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename')); |
|
399 | + break; |
|
400 | + |
|
401 | + case 'save': |
|
402 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
403 | + redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
404 | + } |
|
405 | + // Get image handler |
|
406 | + $image_handler = xoops_getHandler('image'); |
|
407 | + // Call Header |
|
408 | + xoops_cp_header(); |
|
409 | + // Define Stylesheet |
|
410 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
411 | + // Get image id |
|
412 | + $image_id = system_CleanVars($_POST, 'image_id', 0, 'int'); |
|
413 | + if ($image_id > 0) { |
|
414 | + $image = $image_handler->get($image_id); |
|
415 | + $image->setVars($_POST); |
|
416 | + if (!$image_handler->insert($image)) { |
|
417 | + echo sprintf(_AM_SYSTEM_IMAGES_FAILSAVE, $avatar->getVar('avatar_name')); |
|
418 | + xoops_cp_footer(); |
|
419 | + exit; |
|
420 | + } |
|
421 | + redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
422 | + } |
|
423 | + |
|
424 | + // Call Footer |
|
425 | + xoops_cp_footer(); |
|
426 | + break; |
|
427 | + |
|
428 | + case 'addfile': |
|
429 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
430 | + redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
431 | + } |
|
432 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
433 | + $imagecategory = $imgcat_handler->get((int)$imgcat_id); |
|
434 | + if (!is_object($imagecategory)) { |
|
435 | + redirect_header('admin.php?fct=images', 1); |
|
436 | + } |
|
437 | + xoops_load('xoopsmediauploader'); |
|
438 | + $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/images', array( |
|
439 | + 'image/gif', |
|
440 | + 'image/jpeg', |
|
441 | + 'image/pjpeg', |
|
442 | + 'image/x-png', |
|
443 | + 'image/png', |
|
444 | + 'image/bmp'), $imagecategory->getVar('imgcat_maxsize'), $imagecategory->getVar('imgcat_maxwidth'), $imagecategory->getVar('imgcat_maxheight')); |
|
445 | + $uploader->setPrefix('img'); |
|
446 | + $err = array(); |
|
447 | + $ucount = count($_POST['xoops_upload_file']); |
|
448 | + for ($i = 0; $i < $ucount; ++$i) { |
|
449 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) { |
|
450 | + if (!$uploader->upload()) { |
|
451 | + $err[] =& $uploader->getErrors(); |
|
452 | + } else { |
|
453 | + $image_handler = xoops_getHandler('image'); |
|
454 | + $image = $image_handler->create(); |
|
455 | + $image->setVar('image_name', 'images/' . $uploader->getSavedFileName()); |
|
456 | + $image->setVar('image_nicename', $image_nicename); |
|
457 | + $image->setVar('image_mimetype', $uploader->getMediaType()); |
|
458 | + $image->setVar('image_created', time()); |
|
459 | + $image_display = empty($image_display) ? 0 : 1; |
|
460 | + $image->setVar('image_display', $image_display); |
|
461 | + $image->setVar('image_weight', $image_weight); |
|
462 | + $image->setVar('imgcat_id', $imgcat_id); |
|
463 | + if ($imagecategory->getVar('imgcat_storetype') === 'db') { |
|
464 | + $fp = @fopen($uploader->getSavedDestination(), 'rb'); |
|
465 | + $fbinary = @fread($fp, filesize($uploader->getSavedDestination())); |
|
466 | + @fclose($fp); |
|
467 | + $image->setVar('image_body', $fbinary, true); |
|
468 | + @unlink($uploader->getSavedDestination()); |
|
469 | + } |
|
470 | + if (!$image_handler->insert($image)) { |
|
471 | + $err[] = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename')); |
|
472 | + } |
|
472 | 473 | } |
474 | + } else { |
|
475 | + $err[] = sprintf(_FAILFETCHIMG, $i); |
|
476 | + $err = array_merge($err, $uploader->getErrors(false)); |
|
473 | 477 | } |
474 | - } else { |
|
475 | - $err[] = sprintf(_FAILFETCHIMG, $i); |
|
476 | - $err = array_merge($err, $uploader->getErrors(false)); |
|
477 | 478 | } |
478 | - } |
|
479 | - if (count($err) > 0) { |
|
479 | + if (count($err) > 0) { |
|
480 | + xoops_cp_header(); |
|
481 | + xoops_error($err); |
|
482 | + xoops_cp_footer(); |
|
483 | + exit(); |
|
484 | + } |
|
485 | + redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
486 | + break; |
|
487 | + |
|
488 | + case 'addcat': |
|
489 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
490 | + redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
491 | + } |
|
492 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
493 | + $imagecategory = $imgcat_handler->create(); |
|
494 | + $imagecategory->setVar('imgcat_name', $imgcat_name); |
|
495 | + $imagecategory->setVar('imgcat_maxsize', $imgcat_maxsize); |
|
496 | + $imagecategory->setVar('imgcat_maxwidth', $imgcat_maxwidth); |
|
497 | + $imagecategory->setVar('imgcat_maxheight', $imgcat_maxheight); |
|
498 | + $imgcat_display = empty($imgcat_display) ? 0 : 1; |
|
499 | + $imagecategory->setVar('imgcat_display', $imgcat_display); |
|
500 | + $imagecategory->setVar('imgcat_weight', $imgcat_weight); |
|
501 | + $imagecategory->setVar('imgcat_storetype', $imgcat_storetype); |
|
502 | + $imagecategory->setVar('imgcat_type', 'C'); |
|
503 | + if (!$imgcat_handler->insert($imagecategory)) { |
|
504 | + exit(); |
|
505 | + } |
|
506 | + $newid = $imagecategory->getVar('imgcat_id'); |
|
507 | + /* @var $imagecategoryperm_handler XoopsGroupPermHandler */ |
|
508 | + $imagecategoryperm_handler = xoops_getHandler('groupperm'); |
|
509 | + if (!isset($readgroup)) { |
|
510 | + $readgroup = array(); |
|
511 | + } |
|
512 | + if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { |
|
513 | + $readgroup[] = XOOPS_GROUP_ADMIN; |
|
514 | + } |
|
515 | + foreach ($readgroup as $rgroup) { |
|
516 | + $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
517 | + $imagecategoryperm->setVar('gperm_groupid', $rgroup); |
|
518 | + $imagecategoryperm->setVar('gperm_itemid', $newid); |
|
519 | + $imagecategoryperm->setVar('gperm_name', 'imgcat_read'); |
|
520 | + $imagecategoryperm->setVar('gperm_modid', 1); |
|
521 | + $imagecategoryperm_handler->insert($imagecategoryperm); |
|
522 | + unset($imagecategoryperm); |
|
523 | + } |
|
524 | + if (!isset($writegroup)) { |
|
525 | + $writegroup = array(); |
|
526 | + } |
|
527 | + if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { |
|
528 | + $writegroup[] = XOOPS_GROUP_ADMIN; |
|
529 | + } |
|
530 | + foreach ($writegroup as $wgroup) { |
|
531 | + $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
532 | + $imagecategoryperm->setVar('gperm_groupid', $wgroup); |
|
533 | + $imagecategoryperm->setVar('gperm_itemid', $newid); |
|
534 | + $imagecategoryperm->setVar('gperm_name', 'imgcat_write'); |
|
535 | + $imagecategoryperm->setVar('gperm_modid', 1); |
|
536 | + $imagecategoryperm_handler->insert($imagecategoryperm); |
|
537 | + unset($imagecategoryperm); |
|
538 | + } |
|
539 | + |
|
540 | + redirect_header('admin.php?fct=images', 2, _AM_SYSTEM_DBUPDATED); |
|
541 | + break; |
|
542 | + |
|
543 | + case 'editcat': |
|
544 | + if ($imgcat_id <= 0) { |
|
545 | + redirect_header('admin.php?fct=images', 1); |
|
546 | + } |
|
547 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
548 | + $imagecategory = $imgcat_handler->get($imgcat_id); |
|
549 | + if (!is_object($imagecategory)) { |
|
550 | + redirect_header('admin.php?fct=images', 1); |
|
551 | + } |
|
552 | + |
|
553 | + $imagecategoryperm_handler = xoops_getHandler('groupperm'); |
|
554 | + $form = new XoopsThemeForm(_AM_SYSTEM_IMAGES_EDITIMG, 'imagecat_form', 'admin.php', 'post', true); |
|
555 | + $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATNAME, 'imgcat_name', 50, 255, $imagecategory->getVar('imgcat_name')), true); |
|
556 | + $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATRGRP, 'readgroup', true, $imagecategoryperm_handler->getGroupIds('imgcat_read', $imgcat_id), 5, true)); |
|
557 | + $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATWGRP, 'writegroup', true, $imagecategoryperm_handler->getGroupIds('imgcat_write', $imgcat_id), 5, true)); |
|
558 | + $form->addElement(new XoopsFormText(_IMGMAXSIZE, 'imgcat_maxsize', 10, 10, $imagecategory->getVar('imgcat_maxsize'))); |
|
559 | + $form->addElement(new XoopsFormText(_IMGMAXWIDTH, 'imgcat_maxwidth', 3, 4, $imagecategory->getVar('imgcat_maxwidth'))); |
|
560 | + $form->addElement(new XoopsFormText(_IMGMAXHEIGHT, 'imgcat_maxheight', 3, 4, $imagecategory->getVar('imgcat_maxheight'))); |
|
561 | + $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATWEIGHT, 'imgcat_weight', 3, 4, $imagecategory->getVar('imgcat_weight'))); |
|
562 | + $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_IMAGES_IMGCATDISPLAY, 'imgcat_display', $imagecategory->getVar('imgcat_display'), _YES, _NO)); |
|
563 | + $storetype = array('db' => _AM_SYSTEM_IMAGES_INDB, 'file' => _AM_SYSTEM_IMAGES_ASFILE); |
|
564 | + $form->addElement(new XoopsFormLabel(_AM_SYSTEM_IMAGES_IMGCATSTRTYPE, $storetype[$imagecategory->getVar('imgcat_storetype')])); |
|
565 | + $form->addElement(new XoopsFormHidden('imgcat_id', $imgcat_id)); |
|
566 | + $form->addElement(new XoopsFormHidden('op', 'updatecat')); |
|
567 | + $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
568 | + //$form->addElement(new XoopsFormButton('', 'imgcat_button', _SUBMIT, 'submit')); |
|
569 | + $form->addElement(new XoopsFormButtonTray('imgcat_button', _SUBMIT, 'submit', '', false)); |
|
570 | + // Define main template |
|
571 | + $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; |
|
572 | + // Call Header |
|
480 | 573 | xoops_cp_header(); |
481 | - xoops_error($err); |
|
574 | + // Define Stylesheet |
|
575 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
576 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
577 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
578 | + // Define scripts |
|
579 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
580 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
581 | + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
582 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
583 | + // Define Breadcrumb and tips |
|
584 | + $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
585 | + $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name'), ''); |
|
586 | + $xoBreadCrumb->render(); |
|
587 | + echo '<br>'; |
|
588 | + $form->display(); |
|
589 | + // Call Footer |
|
482 | 590 | xoops_cp_footer(); |
483 | 591 | exit(); |
484 | - } |
|
485 | - redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
486 | - break; |
|
487 | - |
|
488 | - case 'addcat': |
|
489 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
490 | - redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
491 | - } |
|
492 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
493 | - $imagecategory = $imgcat_handler->create(); |
|
494 | - $imagecategory->setVar('imgcat_name', $imgcat_name); |
|
495 | - $imagecategory->setVar('imgcat_maxsize', $imgcat_maxsize); |
|
496 | - $imagecategory->setVar('imgcat_maxwidth', $imgcat_maxwidth); |
|
497 | - $imagecategory->setVar('imgcat_maxheight', $imgcat_maxheight); |
|
498 | - $imgcat_display = empty($imgcat_display) ? 0 : 1; |
|
499 | - $imagecategory->setVar('imgcat_display', $imgcat_display); |
|
500 | - $imagecategory->setVar('imgcat_weight', $imgcat_weight); |
|
501 | - $imagecategory->setVar('imgcat_storetype', $imgcat_storetype); |
|
502 | - $imagecategory->setVar('imgcat_type', 'C'); |
|
503 | - if (!$imgcat_handler->insert($imagecategory)) { |
|
504 | - exit(); |
|
505 | - } |
|
506 | - $newid = $imagecategory->getVar('imgcat_id'); |
|
507 | - /* @var $imagecategoryperm_handler XoopsGroupPermHandler */ |
|
508 | - $imagecategoryperm_handler = xoops_getHandler('groupperm'); |
|
509 | - if (!isset($readgroup)) { |
|
510 | - $readgroup = array(); |
|
511 | - } |
|
512 | - if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { |
|
513 | - $readgroup[] = XOOPS_GROUP_ADMIN; |
|
514 | - } |
|
515 | - foreach ($readgroup as $rgroup) { |
|
516 | - $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
517 | - $imagecategoryperm->setVar('gperm_groupid', $rgroup); |
|
518 | - $imagecategoryperm->setVar('gperm_itemid', $newid); |
|
519 | - $imagecategoryperm->setVar('gperm_name', 'imgcat_read'); |
|
520 | - $imagecategoryperm->setVar('gperm_modid', 1); |
|
521 | - $imagecategoryperm_handler->insert($imagecategoryperm); |
|
522 | - unset($imagecategoryperm); |
|
523 | - } |
|
524 | - if (!isset($writegroup)) { |
|
525 | - $writegroup = array(); |
|
526 | - } |
|
527 | - if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { |
|
528 | - $writegroup[] = XOOPS_GROUP_ADMIN; |
|
529 | - } |
|
530 | - foreach ($writegroup as $wgroup) { |
|
531 | - $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
532 | - $imagecategoryperm->setVar('gperm_groupid', $wgroup); |
|
533 | - $imagecategoryperm->setVar('gperm_itemid', $newid); |
|
534 | - $imagecategoryperm->setVar('gperm_name', 'imgcat_write'); |
|
535 | - $imagecategoryperm->setVar('gperm_modid', 1); |
|
536 | - $imagecategoryperm_handler->insert($imagecategoryperm); |
|
537 | - unset($imagecategoryperm); |
|
538 | - } |
|
539 | - |
|
540 | - redirect_header('admin.php?fct=images', 2, _AM_SYSTEM_DBUPDATED); |
|
541 | - break; |
|
542 | - |
|
543 | - case 'editcat': |
|
544 | - if ($imgcat_id <= 0) { |
|
545 | - redirect_header('admin.php?fct=images', 1); |
|
546 | - } |
|
547 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
548 | - $imagecategory = $imgcat_handler->get($imgcat_id); |
|
549 | - if (!is_object($imagecategory)) { |
|
550 | - redirect_header('admin.php?fct=images', 1); |
|
551 | - } |
|
552 | - |
|
553 | - $imagecategoryperm_handler = xoops_getHandler('groupperm'); |
|
554 | - $form = new XoopsThemeForm(_AM_SYSTEM_IMAGES_EDITIMG, 'imagecat_form', 'admin.php', 'post', true); |
|
555 | - $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATNAME, 'imgcat_name', 50, 255, $imagecategory->getVar('imgcat_name')), true); |
|
556 | - $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATRGRP, 'readgroup', true, $imagecategoryperm_handler->getGroupIds('imgcat_read', $imgcat_id), 5, true)); |
|
557 | - $form->addElement(new XoopsFormSelectGroup(_AM_SYSTEM_IMAGES_IMGCATWGRP, 'writegroup', true, $imagecategoryperm_handler->getGroupIds('imgcat_write', $imgcat_id), 5, true)); |
|
558 | - $form->addElement(new XoopsFormText(_IMGMAXSIZE, 'imgcat_maxsize', 10, 10, $imagecategory->getVar('imgcat_maxsize'))); |
|
559 | - $form->addElement(new XoopsFormText(_IMGMAXWIDTH, 'imgcat_maxwidth', 3, 4, $imagecategory->getVar('imgcat_maxwidth'))); |
|
560 | - $form->addElement(new XoopsFormText(_IMGMAXHEIGHT, 'imgcat_maxheight', 3, 4, $imagecategory->getVar('imgcat_maxheight'))); |
|
561 | - $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATWEIGHT, 'imgcat_weight', 3, 4, $imagecategory->getVar('imgcat_weight'))); |
|
562 | - $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_IMAGES_IMGCATDISPLAY, 'imgcat_display', $imagecategory->getVar('imgcat_display'), _YES, _NO)); |
|
563 | - $storetype = array('db' => _AM_SYSTEM_IMAGES_INDB, 'file' => _AM_SYSTEM_IMAGES_ASFILE); |
|
564 | - $form->addElement(new XoopsFormLabel(_AM_SYSTEM_IMAGES_IMGCATSTRTYPE, $storetype[$imagecategory->getVar('imgcat_storetype')])); |
|
565 | - $form->addElement(new XoopsFormHidden('imgcat_id', $imgcat_id)); |
|
566 | - $form->addElement(new XoopsFormHidden('op', 'updatecat')); |
|
567 | - $form->addElement(new XoopsFormHidden('fct', 'images')); |
|
568 | - //$form->addElement(new XoopsFormButton('', 'imgcat_button', _SUBMIT, 'submit')); |
|
569 | - $form->addElement(new XoopsFormButtonTray('imgcat_button', _SUBMIT, 'submit', '', false)); |
|
570 | - // Define main template |
|
571 | - $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; |
|
572 | - // Call Header |
|
573 | - xoops_cp_header(); |
|
574 | - // Define Stylesheet |
|
575 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
576 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
577 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
578 | - // Define scripts |
|
579 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
580 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
|
581 | - $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
|
582 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
583 | - // Define Breadcrumb and tips |
|
584 | - $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
585 | - $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name'), ''); |
|
586 | - $xoBreadCrumb->render(); |
|
587 | - echo '<br>'; |
|
588 | - $form->display(); |
|
589 | - // Call Footer |
|
590 | - xoops_cp_footer(); |
|
591 | - exit(); |
|
592 | - |
|
593 | - case 'updatecat': |
|
594 | - if (!$GLOBALS['xoopsSecurity']->check() || $imgcat_id <= 0) { |
|
595 | - redirect_header('admin.php?fct=images', 1, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
596 | - } |
|
597 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
598 | - $imagecategory = $imgcat_handler->get($imgcat_id); |
|
599 | - if (!is_object($imagecategory)) { |
|
600 | - redirect_header('admin.php?fct=images', 1); |
|
601 | - } |
|
602 | - $imagecategory->setVar('imgcat_name', $imgcat_name); |
|
603 | - $imgcat_display = empty($imgcat_display) ? 0 : 1; |
|
604 | - $imagecategory->setVar('imgcat_display', $imgcat_display); |
|
605 | - $imagecategory->setVar('imgcat_maxsize', $imgcat_maxsize); |
|
606 | - $imagecategory->setVar('imgcat_maxwidth', $imgcat_maxwidth); |
|
607 | - $imagecategory->setVar('imgcat_maxheight', $imgcat_maxheight); |
|
608 | - $imagecategory->setVar('imgcat_weight', $imgcat_weight); |
|
609 | - if (!$imgcat_handler->insert($imagecategory)) { |
|
610 | - exit(); |
|
611 | - } |
|
612 | - $imagecategoryperm_handler = xoops_getHandler('groupperm'); |
|
613 | - $criteria = new CriteriaCompo(new Criteria('gperm_itemid', $imgcat_id)); |
|
614 | - $criteria->add(new Criteria('gperm_modid', 1)); |
|
615 | - $criteria2 = new CriteriaCompo(new Criteria('gperm_name', 'imgcat_write')); |
|
616 | - $criteria2->add(new Criteria('gperm_name', 'imgcat_read'), 'OR'); |
|
617 | - $criteria->add($criteria2); |
|
618 | - $imagecategoryperm_handler->deleteAll($criteria); |
|
619 | - if (!isset($readgroup)) { |
|
620 | - $readgroup = array(); |
|
621 | - } |
|
622 | - if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { |
|
623 | - $readgroup[] = XOOPS_GROUP_ADMIN; |
|
624 | - } |
|
625 | - foreach ($readgroup as $rgroup) { |
|
626 | - $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
627 | - $imagecategoryperm->setVar('gperm_groupid', $rgroup); |
|
628 | - $imagecategoryperm->setVar('gperm_itemid', $imgcat_id); |
|
629 | - $imagecategoryperm->setVar('gperm_name', 'imgcat_read'); |
|
630 | - $imagecategoryperm->setVar('gperm_modid', 1); |
|
631 | - $imagecategoryperm_handler->insert($imagecategoryperm); |
|
632 | - unset($imagecategoryperm); |
|
633 | - } |
|
634 | - if (!isset($writegroup)) { |
|
635 | - $writegroup = array(); |
|
636 | - } |
|
637 | - if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { |
|
638 | - $writegroup[] = XOOPS_GROUP_ADMIN; |
|
639 | - } |
|
640 | - foreach ($writegroup as $wgroup) { |
|
641 | - $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
642 | - $imagecategoryperm->setVar('gperm_groupid', $wgroup); |
|
643 | - $imagecategoryperm->setVar('gperm_itemid', $imgcat_id); |
|
644 | - $imagecategoryperm->setVar('gperm_name', 'imgcat_write'); |
|
645 | - $imagecategoryperm->setVar('gperm_modid', 1); |
|
646 | - $imagecategoryperm_handler->insert($imagecategoryperm); |
|
647 | - unset($imagecategoryperm); |
|
648 | - } |
|
649 | - redirect_header('admin.php?fct=images', 2, _AM_SYSTEM_DBUPDATED); |
|
650 | - break; |
|
651 | - |
|
652 | - case 'delcat': |
|
653 | - // Call Header |
|
654 | - xoops_cp_header(); |
|
655 | - // Display message |
|
656 | - xoops_confirm(array('op' => 'delcatok', 'imgcat_id' => $imgcat_id, 'fct' => 'images'), 'admin.php', _AM_SYSTEM_IMAGES_RUDELIMGCAT); |
|
657 | - // Call Footer |
|
658 | - xoops_cp_footer(); |
|
659 | - break; |
|
660 | - |
|
661 | - case 'delcatok': |
|
662 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
663 | - redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
664 | - } |
|
665 | - $imgcat_id = (int)$imgcat_id; |
|
666 | - if ($imgcat_id <= 0) { |
|
667 | - redirect_header('admin.php?fct=images', 1); |
|
668 | - } |
|
669 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
670 | - $imagecategory = $imgcat_handler->get($imgcat_id); |
|
671 | - if (!is_object($imagecategory)) { |
|
672 | - redirect_header('admin.php?fct=images', 1); |
|
673 | - } |
|
674 | - if ($imagecategory->getVar('imgcat_type') !== 'C') { |
|
592 | + |
|
593 | + case 'updatecat': |
|
594 | + if (!$GLOBALS['xoopsSecurity']->check() || $imgcat_id <= 0) { |
|
595 | + redirect_header('admin.php?fct=images', 1, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
596 | + } |
|
597 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
598 | + $imagecategory = $imgcat_handler->get($imgcat_id); |
|
599 | + if (!is_object($imagecategory)) { |
|
600 | + redirect_header('admin.php?fct=images', 1); |
|
601 | + } |
|
602 | + $imagecategory->setVar('imgcat_name', $imgcat_name); |
|
603 | + $imgcat_display = empty($imgcat_display) ? 0 : 1; |
|
604 | + $imagecategory->setVar('imgcat_display', $imgcat_display); |
|
605 | + $imagecategory->setVar('imgcat_maxsize', $imgcat_maxsize); |
|
606 | + $imagecategory->setVar('imgcat_maxwidth', $imgcat_maxwidth); |
|
607 | + $imagecategory->setVar('imgcat_maxheight', $imgcat_maxheight); |
|
608 | + $imagecategory->setVar('imgcat_weight', $imgcat_weight); |
|
609 | + if (!$imgcat_handler->insert($imagecategory)) { |
|
610 | + exit(); |
|
611 | + } |
|
612 | + $imagecategoryperm_handler = xoops_getHandler('groupperm'); |
|
613 | + $criteria = new CriteriaCompo(new Criteria('gperm_itemid', $imgcat_id)); |
|
614 | + $criteria->add(new Criteria('gperm_modid', 1)); |
|
615 | + $criteria2 = new CriteriaCompo(new Criteria('gperm_name', 'imgcat_write')); |
|
616 | + $criteria2->add(new Criteria('gperm_name', 'imgcat_read'), 'OR'); |
|
617 | + $criteria->add($criteria2); |
|
618 | + $imagecategoryperm_handler->deleteAll($criteria); |
|
619 | + if (!isset($readgroup)) { |
|
620 | + $readgroup = array(); |
|
621 | + } |
|
622 | + if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { |
|
623 | + $readgroup[] = XOOPS_GROUP_ADMIN; |
|
624 | + } |
|
625 | + foreach ($readgroup as $rgroup) { |
|
626 | + $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
627 | + $imagecategoryperm->setVar('gperm_groupid', $rgroup); |
|
628 | + $imagecategoryperm->setVar('gperm_itemid', $imgcat_id); |
|
629 | + $imagecategoryperm->setVar('gperm_name', 'imgcat_read'); |
|
630 | + $imagecategoryperm->setVar('gperm_modid', 1); |
|
631 | + $imagecategoryperm_handler->insert($imagecategoryperm); |
|
632 | + unset($imagecategoryperm); |
|
633 | + } |
|
634 | + if (!isset($writegroup)) { |
|
635 | + $writegroup = array(); |
|
636 | + } |
|
637 | + if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { |
|
638 | + $writegroup[] = XOOPS_GROUP_ADMIN; |
|
639 | + } |
|
640 | + foreach ($writegroup as $wgroup) { |
|
641 | + $imagecategoryperm = $imagecategoryperm_handler->create(); |
|
642 | + $imagecategoryperm->setVar('gperm_groupid', $wgroup); |
|
643 | + $imagecategoryperm->setVar('gperm_itemid', $imgcat_id); |
|
644 | + $imagecategoryperm->setVar('gperm_name', 'imgcat_write'); |
|
645 | + $imagecategoryperm->setVar('gperm_modid', 1); |
|
646 | + $imagecategoryperm_handler->insert($imagecategoryperm); |
|
647 | + unset($imagecategoryperm); |
|
648 | + } |
|
649 | + redirect_header('admin.php?fct=images', 2, _AM_SYSTEM_DBUPDATED); |
|
650 | + break; |
|
651 | + |
|
652 | + case 'delcat': |
|
653 | + // Call Header |
|
675 | 654 | xoops_cp_header(); |
676 | - xoops_error(_MD_SCATDELNG); |
|
655 | + // Display message |
|
656 | + xoops_confirm(array('op' => 'delcatok', 'imgcat_id' => $imgcat_id, 'fct' => 'images'), 'admin.php', _AM_SYSTEM_IMAGES_RUDELIMGCAT); |
|
657 | + // Call Footer |
|
677 | 658 | xoops_cp_footer(); |
678 | - exit(); |
|
679 | - } |
|
680 | - /* @var $image_handler XoopsImageHandler */ |
|
681 | - $image_handler = xoops_getHandler('image'); |
|
682 | - $images = $image_handler->getObjects(new Criteria('imgcat_id', $imgcat_id), true, false); |
|
683 | - $errors = array(); |
|
684 | - foreach (array_keys($images) as $i) { |
|
685 | - if (!$image_handler->delete($images[$i])) { |
|
686 | - $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILDEL, $i); |
|
687 | - } else { |
|
688 | - if (file_exists(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name')) && !unlink(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name'))) { |
|
689 | - $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILUNLINK, $i); |
|
659 | + break; |
|
660 | + |
|
661 | + case 'delcatok': |
|
662 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
663 | + redirect_header('admin.php?fct=images', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
664 | + } |
|
665 | + $imgcat_id = (int)$imgcat_id; |
|
666 | + if ($imgcat_id <= 0) { |
|
667 | + redirect_header('admin.php?fct=images', 1); |
|
668 | + } |
|
669 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
670 | + $imagecategory = $imgcat_handler->get($imgcat_id); |
|
671 | + if (!is_object($imagecategory)) { |
|
672 | + redirect_header('admin.php?fct=images', 1); |
|
673 | + } |
|
674 | + if ($imagecategory->getVar('imgcat_type') !== 'C') { |
|
675 | + xoops_cp_header(); |
|
676 | + xoops_error(_MD_SCATDELNG); |
|
677 | + xoops_cp_footer(); |
|
678 | + exit(); |
|
679 | + } |
|
680 | + /* @var $image_handler XoopsImageHandler */ |
|
681 | + $image_handler = xoops_getHandler('image'); |
|
682 | + $images = $image_handler->getObjects(new Criteria('imgcat_id', $imgcat_id), true, false); |
|
683 | + $errors = array(); |
|
684 | + foreach (array_keys($images) as $i) { |
|
685 | + if (!$image_handler->delete($images[$i])) { |
|
686 | + $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILDEL, $i); |
|
687 | + } else { |
|
688 | + if (file_exists(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name')) && !unlink(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name'))) { |
|
689 | + $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILUNLINK, $i); |
|
690 | + } |
|
690 | 691 | } |
691 | 692 | } |
692 | - } |
|
693 | - if (!$imgcat_handler->delete($imagecategory)) { |
|
694 | - $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILDELCAT, $imagecategory->getVar('imgcat_name')); |
|
695 | - } |
|
696 | - if (count($errors) > 0) { |
|
693 | + if (!$imgcat_handler->delete($imagecategory)) { |
|
694 | + $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILDELCAT, $imagecategory->getVar('imgcat_name')); |
|
695 | + } |
|
696 | + if (count($errors) > 0) { |
|
697 | + xoops_cp_header(); |
|
698 | + xoops_error($errors); |
|
699 | + xoops_cp_footer(); |
|
700 | + exit(); |
|
701 | + } |
|
702 | + redirect_header('admin.php?fct=images', 2, _AM_SYSTEM_DBUPDATED); |
|
703 | + break; |
|
704 | + |
|
705 | + case 'multiupload': |
|
706 | + // Get category id |
|
707 | + $imgcat_id = system_CleanVars($_REQUEST, 'imgcat_id', 0, 'int'); |
|
708 | + if ($imgcat_id <= 0) { |
|
709 | + redirect_header('admin.php?fct=images', 1); |
|
710 | + } |
|
711 | + // Get rights |
|
712 | + $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoopsModule->mid()); |
|
713 | + // Get category handler |
|
714 | + $imgcat_handler = xoops_getHandler('imagecategory'); |
|
715 | + |
|
716 | + $imagecategory = $imgcat_handler->get($imgcat_id); |
|
717 | + if (!is_object($imagecategory)) { |
|
718 | + redirect_header('admin.php?fct=images', 1); |
|
719 | + } |
|
720 | + // Get image handler |
|
721 | + //$image_handler = xoops_getHandler('image'); |
|
722 | + // Define main template |
|
723 | + $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
724 | + // Call header |
|
697 | 725 | xoops_cp_header(); |
698 | - xoops_error($errors); |
|
726 | + // Define Stylesheet |
|
727 | + $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/fine-uploader-new.css'); |
|
728 | + $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/ManuallyTriggerUploads.css'); |
|
729 | + $xoTheme->addStylesheet(XOOPS_URL . '/media/font-awesome/css/font-awesome.min.css'); |
|
730 | + $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
731 | + // Define scripts |
|
732 | + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
733 | + $xoTheme->addScript('modules/system/js/admin.js'); |
|
734 | + $xoTheme->addScript('media/fine-uploader/fine-uploader.js'); |
|
735 | + // Define Breadcrumb and tips |
|
736 | + $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
737 | + $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name'), system_adminVersion('images', 'adminpath') . '&op=listimg&imgcat_id=' . $imgcat_id); |
|
738 | + $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MULTIUPLOAD); |
|
739 | + $xoBreadCrumb->render(); |
|
740 | + |
|
741 | + $xoopsTpl->assign('multiupload', true); |
|
742 | + $xoopsTpl->assign('imgcat_maxsize', $imagecategory->getVar('imgcat_maxsize')); |
|
743 | + $xoopsTpl->assign('imgcat_maxwidth', $imagecategory->getVar('imgcat_maxwidth')); |
|
744 | + $xoopsTpl->assign('imgcat_maxheight', $imagecategory->getVar('imgcat_maxheight')); |
|
745 | + $xoopsTpl->assign('imgcat_name', $imagecategory->getVar('imgcat_name')); |
|
746 | + $payload = array( |
|
747 | + 'aud' => 'ajaxfineupload.php', |
|
748 | + 'cat' => $imgcat_id, |
|
749 | + 'uid' => $xoopsUser instanceof \XoopsUser ? $xoopsUser->id() : 0, |
|
750 | + 'handler' => 'fineimuploadhandler', |
|
751 | + 'moddir' => 'system', |
|
752 | + ); |
|
753 | + $jwt = \Xmf\Jwt\TokenFactory::build('fineuploader', $payload, 60*30); // token good for 30 minutes |
|
754 | + $xoopsTpl->assign('jwt', $jwt); |
|
755 | + $fineup_debug = 'false'; |
|
756 | + if (($xoopsUser instanceof \XoopsUser ? $xoopsUser->isAdmin() : false) |
|
757 | + && isset($_REQUEST['FINEUPLOADER_DEBUG'])) |
|
758 | + { |
|
759 | + $fineup_debug = 'true'; |
|
760 | + } |
|
761 | + $xoopsTpl->assign('fineup_debug', $fineup_debug); |
|
762 | + // Call footer |
|
699 | 763 | xoops_cp_footer(); |
700 | - exit(); |
|
701 | - } |
|
702 | - redirect_header('admin.php?fct=images', 2, _AM_SYSTEM_DBUPDATED); |
|
703 | - break; |
|
704 | - |
|
705 | - case 'multiupload': |
|
706 | - // Get category id |
|
707 | - $imgcat_id = system_CleanVars($_REQUEST, 'imgcat_id', 0, 'int'); |
|
708 | - if ($imgcat_id <= 0) { |
|
709 | - redirect_header('admin.php?fct=images', 1); |
|
710 | - } |
|
711 | - // Get rights |
|
712 | - $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoopsModule->mid()); |
|
713 | - // Get category handler |
|
714 | - $imgcat_handler = xoops_getHandler('imagecategory'); |
|
715 | - |
|
716 | - $imagecategory = $imgcat_handler->get($imgcat_id); |
|
717 | - if (!is_object($imagecategory)) { |
|
718 | - redirect_header('admin.php?fct=images', 1); |
|
719 | - } |
|
720 | - // Get image handler |
|
721 | - //$image_handler = xoops_getHandler('image'); |
|
722 | - // Define main template |
|
723 | - $GLOBALS['xoopsOption']['template_main'] = 'system_images.tpl'; |
|
724 | - // Call header |
|
725 | - xoops_cp_header(); |
|
726 | - // Define Stylesheet |
|
727 | - $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/fine-uploader-new.css'); |
|
728 | - $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/ManuallyTriggerUploads.css'); |
|
729 | - $xoTheme->addStylesheet(XOOPS_URL . '/media/font-awesome/css/font-awesome.min.css'); |
|
730 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
731 | - // Define scripts |
|
732 | - $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
|
733 | - $xoTheme->addScript('modules/system/js/admin.js'); |
|
734 | - $xoTheme->addScript('media/fine-uploader/fine-uploader.js'); |
|
735 | - // Define Breadcrumb and tips |
|
736 | - $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
|
737 | - $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name'), system_adminVersion('images', 'adminpath') . '&op=listimg&imgcat_id=' . $imgcat_id); |
|
738 | - $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MULTIUPLOAD); |
|
739 | - $xoBreadCrumb->render(); |
|
740 | - |
|
741 | - $xoopsTpl->assign('multiupload', true); |
|
742 | - $xoopsTpl->assign('imgcat_maxsize', $imagecategory->getVar('imgcat_maxsize')); |
|
743 | - $xoopsTpl->assign('imgcat_maxwidth', $imagecategory->getVar('imgcat_maxwidth')); |
|
744 | - $xoopsTpl->assign('imgcat_maxheight', $imagecategory->getVar('imgcat_maxheight')); |
|
745 | - $xoopsTpl->assign('imgcat_name', $imagecategory->getVar('imgcat_name')); |
|
746 | - $payload = array( |
|
747 | - 'aud' => 'ajaxfineupload.php', |
|
748 | - 'cat' => $imgcat_id, |
|
749 | - 'uid' => $xoopsUser instanceof \XoopsUser ? $xoopsUser->id() : 0, |
|
750 | - 'handler' => 'fineimuploadhandler', |
|
751 | - 'moddir' => 'system', |
|
752 | - ); |
|
753 | - $jwt = \Xmf\Jwt\TokenFactory::build('fineuploader', $payload, 60*30); // token good for 30 minutes |
|
754 | - $xoopsTpl->assign('jwt', $jwt); |
|
755 | - $fineup_debug = 'false'; |
|
756 | - if (($xoopsUser instanceof \XoopsUser ? $xoopsUser->isAdmin() : false) |
|
757 | - && isset($_REQUEST['FINEUPLOADER_DEBUG'])) |
|
758 | - { |
|
759 | - $fineup_debug = 'true'; |
|
760 | - } |
|
761 | - $xoopsTpl->assign('fineup_debug', $fineup_debug); |
|
762 | - // Call footer |
|
763 | - xoops_cp_footer(); |
|
764 | 764 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | // Call Header |
83 | 83 | xoops_cp_header(); |
84 | 84 | // Define Stylesheet |
85 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
86 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
87 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
85 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
86 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/ui/'.xoops_getModuleOption('jquery_theme', 'system').'/ui.all.css'); |
|
87 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/lightbox.css'); |
|
88 | 88 | // Define scripts |
89 | 89 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
90 | 90 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $form->addElement(new XoopsFormText(_AM_SYSTEM_IMAGES_IMGCATWEIGHT, 'imgcat_weight', 3, 4, 0)); |
154 | 154 | $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_IMAGES_IMGCATDISPLAY, 'imgcat_display', 1, _YES, _NO)); |
155 | 155 | |
156 | - $storetype = new XoopsFormRadio(_MD_IMGCATSTRTYPE . '<br><span style="color:#ff0000;">' . _MD_STRTYOPENG . '</span>', 'imgcat_storetype', 'file'); |
|
156 | + $storetype = new XoopsFormRadio(_MD_IMGCATSTRTYPE.'<br><span style="color:#ff0000;">'._MD_STRTYOPENG.'</span>', 'imgcat_storetype', 'file'); |
|
157 | 157 | $storetype->addOptionArray(array('file' => _MD_ASFILE, 'db' => _MD_INDB)); |
158 | 158 | $form->addElement($storetype); |
159 | 159 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | // Call header |
205 | 205 | xoops_cp_header(); |
206 | 206 | // Define Stylesheet |
207 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
208 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
209 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
207 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
208 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/ui/'.xoops_getModuleOption('jquery_theme', 'system').'/ui.all.css'); |
|
209 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/lightbox.css'); |
|
210 | 210 | // Define scripts |
211 | 211 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
212 | 212 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // Define Breadcrumb and tips |
217 | 217 | $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
218 | 218 | $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name')); |
219 | - $xoBreadCrumb->addHelp(system_adminVersion('images', 'help') . '#cat'); |
|
219 | + $xoBreadCrumb->addHelp(system_adminVersion('images', 'help').'#cat'); |
|
220 | 220 | $xoBreadCrumb->addTips(_AM_SYSTEM_IMAGES_TIPS); |
221 | 221 | $xoBreadCrumb->render(); |
222 | 222 | |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | if ($imgcount > 0) { |
240 | 240 | if ($imgcount > xoops_getModuleOption('images_pager', 'system')) { |
241 | 241 | //include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
242 | - $nav = new XoopsPageNav($imgcount, xoops_getModuleOption('images_pager', 'system'), $start, 'start', 'fct=images&op=listimg&imgcat_id=' . $imgcat_id); |
|
242 | + $nav = new XoopsPageNav($imgcount, xoops_getModuleOption('images_pager', 'system'), $start, 'start', 'fct=images&op=listimg&imgcat_id='.$imgcat_id); |
|
243 | 243 | $xoopsTpl->assign('nav_menu', $nav->renderNav(4)); |
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | - if (file_exists(XOOPS_ROOT_PATH . '/modules/system/language/' . $GLOBALS['xoopsConfig']['language'] . '/images/lightbox-btn-close.gif')) { |
|
247 | + if (file_exists(XOOPS_ROOT_PATH.'/modules/system/language/'.$GLOBALS['xoopsConfig']['language'].'/images/lightbox-btn-close.gif')) { |
|
248 | 248 | $xoopsTpl->assign('xoops_language', $GLOBALS['xoopsConfig']['language']); |
249 | 249 | } else { |
250 | 250 | $xoopsTpl->assign('xoops_language', 'english'); |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | // Call Header |
293 | 293 | xoops_cp_header(); |
294 | 294 | // Define Stylesheet |
295 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
296 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
297 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
295 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
296 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/ui/'.xoops_getModuleOption('jquery_theme', 'system').'/ui.all.css'); |
|
297 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/lightbox.css'); |
|
298 | 298 | // Define scripts |
299 | 299 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
300 | 300 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | $image_cat = $imgcat_handler->get($image->getVar('imgcat_id')); |
311 | 311 | // Define Breadcrumb and tips |
312 | 312 | $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
313 | - $xoBreadCrumb->addLink($image_cat->getVar('imgcat_name'), system_adminVersion('images', 'adminpath') . '&op=listimg&imgcat_id=' . $image->getVar('imgcat_id')); |
|
313 | + $xoBreadCrumb->addLink($image_cat->getVar('imgcat_name'), system_adminVersion('images', 'adminpath').'&op=listimg&imgcat_id='.$image->getVar('imgcat_id')); |
|
314 | 314 | $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_EDITIMG); |
315 | 315 | $xoBreadCrumb->render(); |
316 | - $msg = '<div class="txtcenter"><img class="tooltip" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="' . $image->getVar('image_nicename') . '" title="' . $image->getVar('image_nicename') . '" style="max-width:120px; max-height:120px;"/></div>'; |
|
316 | + $msg = '<div class="txtcenter"><img class="tooltip" src="'.XOOPS_URL.'/image.php?id='.$image->getVar('image_id').'&width=120&height=120" alt="'.$image->getVar('image_nicename').'" title="'.$image->getVar('image_nicename').'" style="max-width:120px; max-height:120px;"/></div>'; |
|
317 | 317 | |
318 | 318 | $xoopsTpl->assign('edit_thumbs', $msg); |
319 | 319 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | // Call Header |
347 | 347 | xoops_cp_header(); |
348 | 348 | // Define Stylesheet |
349 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
350 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
351 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
349 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
350 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/ui/'.xoops_getModuleOption('jquery_theme', 'system').'/ui.all.css'); |
|
351 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/lightbox.css'); |
|
352 | 352 | // Define scripts |
353 | 353 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
354 | 354 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -360,12 +360,12 @@ discard block |
||
360 | 360 | $image = $image_handler->get($image_id); |
361 | 361 | $image_cat = $imgcat_handler->get($image->getVar('imgcat_id')); |
362 | 362 | if ($image_cat->getVar('imgcat_storetype') === 'db') { |
363 | - $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
363 | + $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="'.XOOPS_URL.'/image.php?id='.$image->getVar('image_id').'&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
364 | 364 | } else { |
365 | - $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="' . XOOPS_URL . '/image.php?id=' . $image->getVar('image_id') . '&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
365 | + $msg = '<div style="width: 180px;margin:0 auto;"><img class="thumb" src="'.XOOPS_URL.'/image.php?id='.$image->getVar('image_id').'&width=120&height=120" alt="" title="" style="max-width:120px; max-height:120px;"/></div>'; |
|
366 | 366 | } |
367 | - $msg .= '<div class="spacer">' . $image->getVar('image_nicename') . '</div>'; |
|
368 | - $msg .= '<div class="spacer">' . _AM_SYSTEM_IMAGES_RUDELIMG . '</div>'; |
|
367 | + $msg .= '<div class="spacer">'.$image->getVar('image_nicename').'</div>'; |
|
368 | + $msg .= '<div class="spacer">'._AM_SYSTEM_IMAGES_RUDELIMG.'</div>'; |
|
369 | 369 | xoops_confirm(array('op' => 'delfileok', 'image_id' => $image_id, 'fct' => 'images'), 'admin.php', $msg, _DELETE); |
370 | 370 | } else { |
371 | 371 | redirect_header('admin.php?fct=images', 1, _AM_SYSTEM_DBERROR); |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | xoops_cp_footer(); |
395 | 395 | exit(); |
396 | 396 | } |
397 | - @unlink(XOOPS_UPLOAD_PATH . '/' . $image->getVar('image_name')); |
|
398 | - redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
397 | + @unlink(XOOPS_UPLOAD_PATH.'/'.$image->getVar('image_name')); |
|
398 | + redirect_header('admin.php?fct=images&op=listimg&imgcat_id='.$image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
399 | 399 | break; |
400 | 400 | |
401 | 401 | case 'save': |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | // Call Header |
408 | 408 | xoops_cp_header(); |
409 | 409 | // Define Stylesheet |
410 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
410 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
411 | 411 | // Get image id |
412 | 412 | $image_id = system_CleanVars($_POST, 'image_id', 0, 'int'); |
413 | 413 | if ($image_id > 0) { |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | xoops_cp_footer(); |
419 | 419 | exit; |
420 | 420 | } |
421 | - redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
421 | + redirect_header('admin.php?fct=images&op=listimg&imgcat_id='.$image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | // Call Footer |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | redirect_header('admin.php?fct=images', 1); |
436 | 436 | } |
437 | 437 | xoops_load('xoopsmediauploader'); |
438 | - $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/images', array( |
|
438 | + $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH.'/images', array( |
|
439 | 439 | 'image/gif', |
440 | 440 | 'image/jpeg', |
441 | 441 | 'image/pjpeg', |
@@ -448,11 +448,11 @@ discard block |
||
448 | 448 | for ($i = 0; $i < $ucount; ++$i) { |
449 | 449 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) { |
450 | 450 | if (!$uploader->upload()) { |
451 | - $err[] =& $uploader->getErrors(); |
|
451 | + $err[] = & $uploader->getErrors(); |
|
452 | 452 | } else { |
453 | 453 | $image_handler = xoops_getHandler('image'); |
454 | 454 | $image = $image_handler->create(); |
455 | - $image->setVar('image_name', 'images/' . $uploader->getSavedFileName()); |
|
455 | + $image->setVar('image_name', 'images/'.$uploader->getSavedFileName()); |
|
456 | 456 | $image->setVar('image_nicename', $image_nicename); |
457 | 457 | $image->setVar('image_mimetype', $uploader->getMediaType()); |
458 | 458 | $image->setVar('image_created', time()); |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | xoops_cp_footer(); |
483 | 483 | exit(); |
484 | 484 | } |
485 | - redirect_header('admin.php?fct=images&op=listimg&imgcat_id=' . $image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
485 | + redirect_header('admin.php?fct=images&op=listimg&imgcat_id='.$image->getVar('imgcat_id'), 2, _AM_SYSTEM_DBUPDATED); |
|
486 | 486 | break; |
487 | 487 | |
488 | 488 | case 'addcat': |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | // Call Header |
573 | 573 | xoops_cp_header(); |
574 | 574 | // Define Stylesheet |
575 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
576 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
|
577 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/lightbox.css'); |
|
575 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
576 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/ui/'.xoops_getModuleOption('jquery_theme', 'system').'/ui.all.css'); |
|
577 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/lightbox.css'); |
|
578 | 578 | // Define scripts |
579 | 579 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
580 | 580 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | if (!$image_handler->delete($images[$i])) { |
686 | 686 | $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILDEL, $i); |
687 | 687 | } else { |
688 | - if (file_exists(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name')) && !unlink(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name'))) { |
|
688 | + if (file_exists(XOOPS_UPLOAD_PATH.'/'.$images[$i]->getVar('image_name')) && !unlink(XOOPS_UPLOAD_PATH.'/'.$images[$i]->getVar('image_name'))) { |
|
689 | 689 | $errors[] = sprintf(_AM_SYSTEM_IMAGES_FAILUNLINK, $i); |
690 | 690 | } |
691 | 691 | } |
@@ -724,17 +724,17 @@ discard block |
||
724 | 724 | // Call header |
725 | 725 | xoops_cp_header(); |
726 | 726 | // Define Stylesheet |
727 | - $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/fine-uploader-new.css'); |
|
728 | - $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/ManuallyTriggerUploads.css'); |
|
729 | - $xoTheme->addStylesheet(XOOPS_URL . '/media/font-awesome/css/font-awesome.min.css'); |
|
730 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
727 | + $xoTheme->addStylesheet(XOOPS_URL.'/media/fine-uploader/fine-uploader-new.css'); |
|
728 | + $xoTheme->addStylesheet(XOOPS_URL.'/media/fine-uploader/ManuallyTriggerUploads.css'); |
|
729 | + $xoTheme->addStylesheet(XOOPS_URL.'/media/font-awesome/css/font-awesome.min.css'); |
|
730 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
731 | 731 | // Define scripts |
732 | 732 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
733 | 733 | $xoTheme->addScript('modules/system/js/admin.js'); |
734 | 734 | $xoTheme->addScript('media/fine-uploader/fine-uploader.js'); |
735 | 735 | // Define Breadcrumb and tips |
736 | 736 | $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MANAGER, system_adminVersion('images', 'adminpath')); |
737 | - $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name'), system_adminVersion('images', 'adminpath') . '&op=listimg&imgcat_id=' . $imgcat_id); |
|
737 | + $xoBreadCrumb->addLink($imagecategory->getVar('imgcat_name'), system_adminVersion('images', 'adminpath').'&op=listimg&imgcat_id='.$imgcat_id); |
|
738 | 738 | $xoBreadCrumb->addLink(_AM_SYSTEM_IMAGES_MULTIUPLOAD); |
739 | 739 | $xoBreadCrumb->render(); |
740 | 740 | |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | 'handler' => 'fineimuploadhandler', |
751 | 751 | 'moddir' => 'system', |
752 | 752 | ); |
753 | - $jwt = \Xmf\Jwt\TokenFactory::build('fineuploader', $payload, 60*30); // token good for 30 minutes |
|
753 | + $jwt = \Xmf\Jwt\TokenFactory::build('fineuploader', $payload, 60 * 30); // token good for 30 minutes |
|
754 | 754 | $xoopsTpl->assign('jwt', $jwt); |
755 | 755 | $fineup_debug = 'false'; |
756 | 756 | if (($xoopsUser instanceof \XoopsUser ? $xoopsUser->isAdmin() : false) |
@@ -313,9 +313,9 @@ |
||
313 | 313 | $xoBreadCrumb->render(); |
314 | 314 | // Display message |
315 | 315 | xoops_confirm(array( |
316 | - 'ok' => 1, |
|
317 | - 'groups_id' => $_REQUEST['groups_id'], |
|
318 | - 'op' => 'groups_delete'), 'admin.php?fct=groups', sprintf(_AM_SYSTEM_GROUPS_SUREDEL) . '<br \>' . $obj->getVar('name') . '<br \>'); |
|
316 | + 'ok' => 1, |
|
317 | + 'groups_id' => $_REQUEST['groups_id'], |
|
318 | + 'op' => 'groups_delete'), 'admin.php?fct=groups', sprintf(_AM_SYSTEM_GROUPS_SUREDEL) . '<br \>' . $obj->getVar('name') . '<br \>'); |
|
319 | 319 | } |
320 | 320 | } else { |
321 | 321 | redirect_header('admin.php?fct=groups', 1, _AM_SYSTEM_DBERROR); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | case 'list': |
44 | 44 | default: |
45 | 45 | // Define Stylesheet |
46 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
46 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
47 | 47 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
48 | 48 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.tablesorter.js'); |
49 | 49 | $xoTheme->addScript('modules/system/js/admin.js'); |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | } else { |
80 | 80 | $groups['nb_users_by_groups'] = ''; |
81 | 81 | } |
82 | - $edit_delete = '<a href="admin.php?fct=groups&op=groups_edit&groups_id=' . $groups_id . '"> |
|
83 | - <img src="./images/icons/edit.png" border="0" alt="' . _AM_SYSTEM_GROUPS_EDIT . '" title="' . _AM_SYSTEM_GROUPS_EDIT . '"></a>'; |
|
82 | + $edit_delete = '<a href="admin.php?fct=groups&op=groups_edit&groups_id='.$groups_id.'"> |
|
83 | + <img src="./images/icons/edit.png" border="0" alt="' . _AM_SYSTEM_GROUPS_EDIT.'" title="'._AM_SYSTEM_GROUPS_EDIT.'"></a>'; |
|
84 | 84 | if (!in_array($groups_arr[$i]->getVar('groupid'), array(XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS))) { |
85 | 85 | $groups['delete'] = 1; |
86 | - $edit_delete .= '<a href="admin.php?fct=groups&op=groups_delete&groups_id=' . $groups_id . '"> |
|
87 | - <img src="./images/icons/delete.png" border="0" alt="' . _AM_SYSTEM_GROUPS_DELETE . '" title="' . _AM_SYSTEM_GROUPS_DELETE . '"></a>'; |
|
86 | + $edit_delete .= '<a href="admin.php?fct=groups&op=groups_delete&groups_id='.$groups_id.'"> |
|
87 | + <img src="./images/icons/delete.png" border="0" alt="' . _AM_SYSTEM_GROUPS_DELETE.'" title="'._AM_SYSTEM_GROUPS_DELETE.'"></a>'; |
|
88 | 88 | } |
89 | 89 | $groups['edit_delete'] = $edit_delete; |
90 | 90 | $xoopsTpl->append_by_ref('groups', $groups); |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | //Add a group |
102 | 102 | case 'groups_add': |
103 | 103 | // Define Stylesheet |
104 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
104 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
105 | 105 | // Define Breadcrumb and tips |
106 | 106 | $xoBreadCrumb->addLink(_AM_SYSTEM_GROUPS_NAV_ADD); |
107 | - $xoBreadCrumb->addHelp(system_adminVersion('groups', 'help') . '#add'); |
|
107 | + $xoBreadCrumb->addHelp(system_adminVersion('groups', 'help').'#add'); |
|
108 | 108 | $xoBreadCrumb->addTips(_AM_SYSTEM_GROUPS_NAV_TIPS_2); |
109 | 109 | $xoBreadCrumb->render(); |
110 | 110 | // Create form |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | //Edit a group |
118 | 118 | case 'groups_edit': |
119 | 119 | // Define Stylesheet |
120 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
120 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
121 | 121 | // Define Breadcrumb and tips |
122 | 122 | $xoBreadCrumb->addLink(_AM_SYSTEM_GROUPS_NAV_EDIT); |
123 | - $xoBreadCrumb->addHelp(system_adminVersion('groups', 'help') . '#edit'); |
|
123 | + $xoBreadCrumb->addHelp(system_adminVersion('groups', 'help').'#edit'); |
|
124 | 124 | $xoBreadCrumb->addTips(_AM_SYSTEM_GROUPS_NAV_TIPS_2); |
125 | 125 | $xoBreadCrumb->render(); |
126 | 126 | // Create form |
@@ -306,16 +306,16 @@ discard block |
||
306 | 306 | } |
307 | 307 | } else { |
308 | 308 | // Define Stylesheet |
309 | - $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
|
309 | + $xoTheme->addStylesheet(XOOPS_URL.'/modules/system/css/admin.css'); |
|
310 | 310 | // Define Breadcrumb and tips |
311 | 311 | $xoBreadCrumb->addLink(_AM_SYSTEM_GROUPS_NAV_DELETE); |
312 | - $xoBreadCrumb->addHelp(system_adminVersion('groups', 'help') . '#edit'); |
|
312 | + $xoBreadCrumb->addHelp(system_adminVersion('groups', 'help').'#edit'); |
|
313 | 313 | $xoBreadCrumb->render(); |
314 | 314 | // Display message |
315 | 315 | xoops_confirm(array( |
316 | 316 | 'ok' => 1, |
317 | 317 | 'groups_id' => $_REQUEST['groups_id'], |
318 | - 'op' => 'groups_delete'), 'admin.php?fct=groups', sprintf(_AM_SYSTEM_GROUPS_SUREDEL) . '<br \>' . $obj->getVar('name') . '<br \>'); |
|
318 | + 'op' => 'groups_delete'), 'admin.php?fct=groups', sprintf(_AM_SYSTEM_GROUPS_SUREDEL).'<br \>'.$obj->getVar('name').'<br \>'); |
|
319 | 319 | } |
320 | 320 | } else { |
321 | 321 | redirect_header('admin.php?fct=groups', 1, _AM_SYSTEM_DBERROR); |