@@ -5,68 +5,68 @@ discard block |
||
5 | 5 | */ |
6 | 6 | class SmartPlugin |
7 | 7 | { |
8 | - public $_infoArray; |
|
9 | - |
|
10 | - /** |
|
11 | - * SmartPlugin constructor. |
|
12 | - * @param $array |
|
13 | - */ |
|
14 | - public function __construct($array) |
|
15 | - { |
|
16 | - $this->_infoArray = $array; |
|
17 | - } |
|
18 | - |
|
19 | - /** |
|
20 | - * @param $item |
|
21 | - * @return bool |
|
22 | - */ |
|
23 | - public function getItemInfo($item) |
|
24 | - { |
|
25 | - if (isset($this->_infoArray['items'][$item])) { |
|
26 | - return $this->_infoArray['items'][$item]; |
|
27 | - } else { |
|
28 | - return false; |
|
29 | - } |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * @return mixed |
|
34 | - */ |
|
35 | - public function getItemList() |
|
36 | - { |
|
37 | - $itemsArray = $this->_infoArray['items']; |
|
38 | - foreach ($itemsArray as $k => $v) { |
|
39 | - $ret[$k] = $v['caption']; |
|
40 | - } |
|
41 | - |
|
42 | - return $ret; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @return bool|int|string |
|
47 | - */ |
|
48 | - public function getItem() |
|
49 | - { |
|
50 | - $ret = false; |
|
51 | - foreach ($this->_infoArray['items'] as $k => $v) { |
|
52 | - $search_str = str_replace('%u', '', $v['url']); |
|
53 | - if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
54 | - $ret = $k; |
|
55 | - break; |
|
56 | - } |
|
57 | - } |
|
58 | - |
|
59 | - return $ret; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @param $item |
|
64 | - * @return mixed |
|
65 | - */ |
|
66 | - public function getItemIdForItem($item) |
|
67 | - { |
|
68 | - return $_REQUEST[$this->_infoArray['items'][$item]['request']]; |
|
69 | - } |
|
8 | + public $_infoArray; |
|
9 | + |
|
10 | + /** |
|
11 | + * SmartPlugin constructor. |
|
12 | + * @param $array |
|
13 | + */ |
|
14 | + public function __construct($array) |
|
15 | + { |
|
16 | + $this->_infoArray = $array; |
|
17 | + } |
|
18 | + |
|
19 | + /** |
|
20 | + * @param $item |
|
21 | + * @return bool |
|
22 | + */ |
|
23 | + public function getItemInfo($item) |
|
24 | + { |
|
25 | + if (isset($this->_infoArray['items'][$item])) { |
|
26 | + return $this->_infoArray['items'][$item]; |
|
27 | + } else { |
|
28 | + return false; |
|
29 | + } |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * @return mixed |
|
34 | + */ |
|
35 | + public function getItemList() |
|
36 | + { |
|
37 | + $itemsArray = $this->_infoArray['items']; |
|
38 | + foreach ($itemsArray as $k => $v) { |
|
39 | + $ret[$k] = $v['caption']; |
|
40 | + } |
|
41 | + |
|
42 | + return $ret; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @return bool|int|string |
|
47 | + */ |
|
48 | + public function getItem() |
|
49 | + { |
|
50 | + $ret = false; |
|
51 | + foreach ($this->_infoArray['items'] as $k => $v) { |
|
52 | + $search_str = str_replace('%u', '', $v['url']); |
|
53 | + if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
54 | + $ret = $k; |
|
55 | + break; |
|
56 | + } |
|
57 | + } |
|
58 | + |
|
59 | + return $ret; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @param $item |
|
64 | + * @return mixed |
|
65 | + */ |
|
66 | + public function getItemIdForItem($item) |
|
67 | + { |
|
68 | + return $_REQUEST[$this->_infoArray['items'][$item]['request']]; |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -74,57 +74,57 @@ discard block |
||
74 | 74 | */ |
75 | 75 | class SmartPluginHandler |
76 | 76 | { |
77 | - public $pluginPatterns = false; |
|
78 | - |
|
79 | - /** |
|
80 | - * @param $dirname |
|
81 | - * @return bool|SmartPlugin |
|
82 | - */ |
|
83 | - public function getPlugin($dirname) |
|
84 | - { |
|
85 | - $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
86 | - if (file_exists($pluginName)) { |
|
87 | - include_once($pluginName); |
|
88 | - $function = 'smartobject_plugin_' . $dirname; |
|
89 | - if (function_exists($function)) { |
|
90 | - $array = $function(); |
|
91 | - $ret = new SmartPlugin($array); |
|
92 | - |
|
93 | - return $ret; |
|
94 | - } |
|
95 | - } |
|
96 | - |
|
97 | - return false; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @return array |
|
102 | - */ |
|
103 | - public function getPluginsArray() |
|
104 | - { |
|
105 | - include_once(XOOPS_ROOT_PATH . '/class/xoopslists.php'); |
|
106 | - |
|
107 | - $moduleHandler = xoops_getHandler('module'); |
|
108 | - $criteria = new CriteriaCompo(); |
|
109 | - $criteria->add(new Criteria('isactive', 1)); |
|
110 | - $tempModulesObj = $moduleHandler->getObjects($criteria); |
|
111 | - $modulesObj = array(); |
|
112 | - foreach ($tempModulesObj as $moduleObj) { |
|
113 | - $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
|
114 | - } |
|
115 | - |
|
116 | - $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
117 | - $ret = array(); |
|
118 | - foreach ($aFiles as $file) { |
|
119 | - if (substr($file, strlen($file) - 4, 4) === '.php') { |
|
120 | - $pluginName = str_replace('.php', '', $file); |
|
121 | - $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
122 | - if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
|
123 | - $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
127 | - |
|
128 | - return $ret; |
|
129 | - } |
|
77 | + public $pluginPatterns = false; |
|
78 | + |
|
79 | + /** |
|
80 | + * @param $dirname |
|
81 | + * @return bool|SmartPlugin |
|
82 | + */ |
|
83 | + public function getPlugin($dirname) |
|
84 | + { |
|
85 | + $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
86 | + if (file_exists($pluginName)) { |
|
87 | + include_once($pluginName); |
|
88 | + $function = 'smartobject_plugin_' . $dirname; |
|
89 | + if (function_exists($function)) { |
|
90 | + $array = $function(); |
|
91 | + $ret = new SmartPlugin($array); |
|
92 | + |
|
93 | + return $ret; |
|
94 | + } |
|
95 | + } |
|
96 | + |
|
97 | + return false; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @return array |
|
102 | + */ |
|
103 | + public function getPluginsArray() |
|
104 | + { |
|
105 | + include_once(XOOPS_ROOT_PATH . '/class/xoopslists.php'); |
|
106 | + |
|
107 | + $moduleHandler = xoops_getHandler('module'); |
|
108 | + $criteria = new CriteriaCompo(); |
|
109 | + $criteria->add(new Criteria('isactive', 1)); |
|
110 | + $tempModulesObj = $moduleHandler->getObjects($criteria); |
|
111 | + $modulesObj = array(); |
|
112 | + foreach ($tempModulesObj as $moduleObj) { |
|
113 | + $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
|
114 | + } |
|
115 | + |
|
116 | + $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
117 | + $ret = array(); |
|
118 | + foreach ($aFiles as $file) { |
|
119 | + if (substr($file, strlen($file) - 4, 4) === '.php') { |
|
120 | + $pluginName = str_replace('.php', '', $file); |
|
121 | + $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
122 | + if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
|
123 | + $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | + |
|
128 | + return $ret; |
|
129 | + } |
|
130 | 130 | } |
@@ -29,27 +29,27 @@ discard block |
||
29 | 29 | // Project: XOOPS Project // |
30 | 30 | // ------------------------------------------------------------------------- // |
31 | 31 | /** |
32 | - * ! |
|
33 | - * Example |
|
34 | - * |
|
35 | - * include_once 'uploader.php'; |
|
36 | - * $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'); |
|
37 | - * $maxfilesize = 50000; |
|
38 | - * $maxfilewidth = 120; |
|
39 | - * $maxfileheight = 120; |
|
40 | - * $uploader = new SmartUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); |
|
41 | - * if ($uploader->fetchMedia($HTTP_POST_VARS['uploade_file_name'])) { |
|
42 | - * if (!$uploader->upload()) { |
|
43 | - * echo $uploader->getErrors(); |
|
44 | - * } else { |
|
45 | - * echo '<h4>File uploaded successfully!</h4>' |
|
46 | - * echo 'Saved as: ' . $uploader->getSavedFileName() . '<br />'; |
|
47 | - * echo 'Full path: ' . $uploader->getSavedDestination(); |
|
48 | - * } |
|
49 | - * } else { |
|
50 | - * echo $uploader->getErrors(); |
|
51 | - * } |
|
52 | - */ |
|
32 | + * ! |
|
33 | + * Example |
|
34 | + * |
|
35 | + * include_once 'uploader.php'; |
|
36 | + * $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'); |
|
37 | + * $maxfilesize = 50000; |
|
38 | + * $maxfilewidth = 120; |
|
39 | + * $maxfileheight = 120; |
|
40 | + * $uploader = new SmartUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); |
|
41 | + * if ($uploader->fetchMedia($HTTP_POST_VARS['uploade_file_name'])) { |
|
42 | + * if (!$uploader->upload()) { |
|
43 | + * echo $uploader->getErrors(); |
|
44 | + * } else { |
|
45 | + * echo '<h4>File uploaded successfully!</h4>' |
|
46 | + * echo 'Saved as: ' . $uploader->getSavedFileName() . '<br />'; |
|
47 | + * echo 'Full path: ' . $uploader->getSavedDestination(); |
|
48 | + * } |
|
49 | + * } else { |
|
50 | + * echo $uploader->getErrors(); |
|
51 | + * } |
|
52 | + */ |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Upload Media files |
@@ -89,51 +89,51 @@ discard block |
||
89 | 89 | */ |
90 | 90 | class SmartUploader extends XoopsMediaUploader |
91 | 91 | { |
92 | - public $ext; |
|
93 | - public $dimension; |
|
92 | + public $ext; |
|
93 | + public $dimension; |
|
94 | 94 | |
95 | - /** |
|
96 | - * No admin check for uploads |
|
97 | - */ |
|
98 | - public $noAdminSizeCheck; |
|
95 | + /** |
|
96 | + * No admin check for uploads |
|
97 | + */ |
|
98 | + public $noAdminSizeCheck; |
|
99 | 99 | |
100 | - /** |
|
101 | - * Constructor |
|
102 | - * |
|
103 | - * @param string $uploadDir |
|
104 | - * @param array|int $allowedMimeTypes |
|
105 | - * @param int $maxFileSize |
|
106 | - * @param int $maxWidth |
|
107 | - * @param int $maxHeight |
|
108 | - * @internal param int $cmodvalue |
|
109 | - */ |
|
110 | - public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $maxWidth = 0, $maxHeight = 0) |
|
111 | - { |
|
112 | - parent::__construct($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
113 | - } |
|
100 | + /** |
|
101 | + * Constructor |
|
102 | + * |
|
103 | + * @param string $uploadDir |
|
104 | + * @param array|int $allowedMimeTypes |
|
105 | + * @param int $maxFileSize |
|
106 | + * @param int $maxWidth |
|
107 | + * @param int $maxHeight |
|
108 | + * @internal param int $cmodvalue |
|
109 | + */ |
|
110 | + public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $maxWidth = 0, $maxHeight = 0) |
|
111 | + { |
|
112 | + parent::__construct($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * @param $value |
|
117 | - */ |
|
118 | - public function noAdminSizeCheck($value) |
|
119 | - { |
|
120 | - $this->noAdminSizeCheck = $value; |
|
121 | - } |
|
115 | + /** |
|
116 | + * @param $value |
|
117 | + */ |
|
118 | + public function noAdminSizeCheck($value) |
|
119 | + { |
|
120 | + $this->noAdminSizeCheck = $value; |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Is the file the right size? |
|
125 | - * |
|
126 | - * @return bool |
|
127 | - */ |
|
128 | - public function checkMaxFileSize() |
|
129 | - { |
|
130 | - if ($this->noAdminSizeCheck) { |
|
131 | - return true; |
|
132 | - } |
|
133 | - if ($this->mediaSize > $this->maxFileSize) { |
|
134 | - return false; |
|
135 | - } |
|
123 | + /** |
|
124 | + * Is the file the right size? |
|
125 | + * |
|
126 | + * @return bool |
|
127 | + */ |
|
128 | + public function checkMaxFileSize() |
|
129 | + { |
|
130 | + if ($this->noAdminSizeCheck) { |
|
131 | + return true; |
|
132 | + } |
|
133 | + if ($this->mediaSize > $this->maxFileSize) { |
|
134 | + return false; |
|
135 | + } |
|
136 | 136 | |
137 | - return true; |
|
138 | - } |
|
137 | + return true; |
|
138 | + } |
|
139 | 139 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | * @link http://smartfactory.ca The SmartFactory |
81 | 81 | * @package SmartObject |
82 | 82 | */ |
83 | -mt_srand((double)microtime() * 1000000); |
|
83 | +mt_srand((double) microtime() * 1000000); |
|
84 | 84 | |
85 | 85 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
86 | 86 |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | $modversion['min_xoops'] = '2.5.8'; |
44 | 44 | $modversion['min_admin'] = '1.1'; |
45 | 45 | $modversion['min_db'] = array( |
46 | - 'mysql' => '5.0.7', |
|
47 | - 'mysqli' => '5.0.7' |
|
46 | + 'mysql' => '5.0.7', |
|
47 | + 'mysqli' => '5.0.7' |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | // --- |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | global $xoopsConfig; |
75 | 75 | $common_file = XOOPS_ROOT_PATH . '/modules/smartobject/language/' . $xoopsConfig['language'] . '/common.php'; |
76 | 76 | if (file_exists($common_file)) { |
77 | - $flag_common = true; |
|
78 | - include_once $common_file; |
|
77 | + $flag_common = true; |
|
78 | + include_once $common_file; |
|
79 | 79 | } else { |
80 | - include_once(XOOPS_ROOT_PATH . '/modules/smartobject/language/english/common.php'); |
|
80 | + include_once(XOOPS_ROOT_PATH . '/modules/smartobject/language/english/common.php'); |
|
81 | 81 | } |
82 | 82 | // ----- |
83 | 83 |
@@ -1,28 +1,28 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Projax |
|
4 | - * |
|
5 | - * An open source set of php helper classes for prototype and script.aculo.us. |
|
6 | - * |
|
7 | - * @package Projax |
|
8 | - * @author Vikas Patial |
|
9 | - * @copyright Copyright (c) 2006, ngcoders. |
|
10 | - * @license http://www.gnu.org/copyleft/gpl.html |
|
11 | - * @link http://www.ngcoders.com |
|
12 | - * @since Version 0.2 |
|
13 | - * @filesource |
|
14 | - */ |
|
3 | + * Projax |
|
4 | + * |
|
5 | + * An open source set of php helper classes for prototype and script.aculo.us. |
|
6 | + * |
|
7 | + * @package Projax |
|
8 | + * @author Vikas Patial |
|
9 | + * @copyright Copyright (c) 2006, ngcoders. |
|
10 | + * @license http://www.gnu.org/copyleft/gpl.html |
|
11 | + * @link http://www.ngcoders.com |
|
12 | + * @since Version 0.2 |
|
13 | + * @filesource |
|
14 | + */ |
|
15 | 15 | |
16 | 16 | if (!class_exists('Projax')) { |
17 | - include __DIR__ . '/classes/JavaScript.php'; |
|
18 | - include 'classes/Prototype.php'; |
|
19 | - include 'classes/Scriptaculous.php'; |
|
17 | + include __DIR__ . '/classes/JavaScript.php'; |
|
18 | + include 'classes/Prototype.php'; |
|
19 | + include 'classes/Scriptaculous.php'; |
|
20 | 20 | |
21 | - // For $projax = new Projax(); |
|
22 | - /** |
|
23 | - * Class projax |
|
24 | - */ |
|
25 | - class projax extends Scriptaculous |
|
26 | - { |
|
27 | - } |
|
21 | + // For $projax = new Projax(); |
|
22 | + /** |
|
23 | + * Class projax |
|
24 | + */ |
|
25 | + class projax extends Scriptaculous |
|
26 | + { |
|
27 | + } |
|
28 | 28 | } |