1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26: function system_CleanVars(&$global, $key, $default = '', $type = 'int')
27: {
28: switch ($type) {
29: case 'array':
30: $ret = (isset($global[$key]) && is_array($global[$key])) ? $global[$key] : $default;
31: break;
32: case 'date':
33: $ret = isset($global[$key]) ? strtotime($global[$key]) : $default;
34: break;
35: case 'string':
36: $ret = isset($global[$key]) ? filter_var($global[$key], FILTER_SANITIZE_MAGIC_QUOTES) : $default;
37: break;
38: case 'int':
39: default:
40: $ret = isset($global[$key]) ? filter_var($global[$key], FILTER_SANITIZE_NUMBER_INT) : $default;
41: break;
42: }
43: if ($ret === false) {
44: return $default;
45: }
46:
47: return $ret;
48: }
49:
50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60:
61: function system_loadLanguage($name, $domain = '', $language = null)
62: {
63: 64: 65:
66: if (empty($name)) {
67: return false;
68: }
69: $language = empty($language) ? $GLOBALS['xoopsConfig']['language'] : $language;
70: $path = 'modules/' . $domain . '/language/';
71: if (file_exists($file = $GLOBALS['xoops']->path($path . $language . '/admin/' . $name . '.php'))) {
72: $ret = include_once $file;
73: } else {
74: $ret = include_once $GLOBALS['xoops']->path($path . 'english/admin/' . $name . '.php');
75: }
76:
77: return $ret;
78: }
79:
80: 81: 82: 83: 84: 85:
86: function system_adminVersion($version, $value = '')
87: {
88: static $tblVersion = array();
89: if (is_array($tblVersion) && array_key_exists($version . '.' . $value, $tblVersion)) {
90: return $tblVersion[$version . '.' . $value];
91: }
92: $path = XOOPS_ROOT_PATH . '/modules/system/admin/' . $version . '/xoops_version.php';
93: if (file_exists($path)) {
94: include $path;
95:
96: $retvalue = $modversion[$value];
97: $tblVersion[$version . '.' . $value] = $retvalue;
98:
99: return $retvalue;
100: }
101:
102: return null;
103: }
104:
105: 106: 107: 108: 109:
110: function system_AdminIcons($img)
111: {
112: $style = xoops_getModuleOption('typeicons', 'system');
113: if ($style == '') {
114: $style = 'default';
115: }
116:
117: $url = $GLOBALS['xoops']->url('modules/system/images/icons/' . $style . '/' . $img);
118:
119: return $url;
120: }
121:
122: 123: 124:
125: function system_loadTemplate($name)
126: {
127: global $sysTpl, $xoopsModule;
128:
129: $path = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/templates/admin/' . $name . '.tpl';
130: if (file_exists($path)) {
131: echo $sysTpl->fetch($path);
132: } else {
133: echo 'Unable to read ' . $name;
134: }
135: }
136:
137: 138: 139: 140: 141: 142: 143:
144: function modify_chmod($value_chmod, $path_file, $id)
145: {
146: $chmod = '<div id="loading_' . $id . '" align="center" style="display:none;">' . '<img src="./images/mimetypes/spinner.gif" title="Loading" alt="Loading" width="12px"/></div>' . '<div id="chmod' . $id . '">' . '<select size="1" onChange="filemanager_modify_chmod(\'' . $path_file . '\', \'' . $id . '\')" name="chmod" id="chmod">';
147: if ($value_chmod == 777) {
148: $chmod .= '<option value="777" selected><span style="color:green;">777</span></option>';
149: } else {
150: $chmod .= '<option value="777"><span style="color:green;">777</span></option>';
151: }
152:
153: if ($value_chmod == 776) {
154: $chmod .= '<option value="776" selected>776</option>';
155: } else {
156: $chmod .= '<option value="776">776</option>';
157: }
158:
159: if ($value_chmod == 766) {
160: $chmod .= '<option value="766" selected>766</option>';
161: } else {
162: $chmod .= '<option value="766">766</option>';
163: }
164:
165: if ($value_chmod == 666) {
166: $chmod .= '<option value="666" selected>666</option>';
167: } else {
168: $chmod .= '<option value="666">666</option>';
169: }
170:
171: if ($value_chmod == 664) {
172: $chmod .= '<option value="664" selected>664</option>';
173: } else {
174: $chmod .= '<option value="664">664</option>';
175: }
176:
177: if ($value_chmod == 644) {
178: $chmod .= '<option value="644" selected>644</option>';
179: } else {
180: $chmod .= '<option value="644">644</option>';
181: }
182:
183: if ($value_chmod == 444) {
184: $chmod .= '<option value="444" selected><span style="color:red;">444</span></option>';
185: } else {
186: $chmod .= '<option value="444">444</option>';
187: }
188:
189: if ($value_chmod == 440) {
190: $chmod .= '<option value="440" selected>440</option>';
191: } else {
192: $chmod .= '<option value="440">440</option>';
193: }
194:
195: if ($value_chmod == 400) {
196: $chmod .= '<option value="400" selected>400</option>';
197: } else {
198: $chmod .= '<option value="400">400</option>';
199: }
200: $chmod .= '</select>';
201:
202: return $chmod;
203: }
204: