XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
functions.php
Go to the documentation of this file.
1 <?php
22 function system_CleanVars(&$global, $key, $default = '', $type = 'int')
23 {
24  switch ($type) {
25  case 'array':
26  $ret = (isset($global[$key]) && is_array($global[$key])) ? $global[$key] : $default;
27  break;
28  case 'date':
29  $ret = (isset($global[$key])) ? strtotime($global[$key]) : $default;
30  break;
31  case 'string':
32  $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_SANITIZE_MAGIC_QUOTES) : $default;
33  break;
34  case 'int': default:
35  $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_SANITIZE_NUMBER_INT) : $default;
36  break;
37  }
38  if ($ret === false) {
39  return $default;
40  }
41  return $ret;
42 }
43 
55 function system_loadLanguage($name, $domain = '', $language = null)
56 {
60  if (empty($name)) {
61  return false;
62  }
63  $language = empty($language) ? $GLOBALS['xoopsConfig']['language'] : $language;
64  $path = 'modules/' . $domain . '/language/';
65  if ( file_exists($file = $GLOBALS['xoops']->path( $path . $language . '/admin/' . $name . '.php') ) ) {
66  $ret = include_once $file;
67  } else {
68  $ret = include_once $GLOBALS['xoops']->path( $path . 'english/admin/' . $name . '.php');
69  }
70  return $ret;
71 }
72 
73 function system_adminVersion($version, $value = '')
74 {
75  static $tblVersion = array();
76  if (is_array($tblVersion) && array_key_exists($version . '.' . $value, $tblVersion)) {
77  return $tblVersion[$version . '.' . $value];
78  }
79  $path = XOOPS_ROOT_PATH . '/modules/system/admin/' . $version . '/xoops_version.php';
80  if (file_exists($path)) {
81 
82  include $path;
83 
84  $retvalue = $modversion[$value];
85  $tblVersion[$version . '.' . $value] = $retvalue;
86  return $retvalue;
87  }
88 }
89 
90 function system_AdminIcons($img)
91 {
92  $style='default';
93 
94  $url = $GLOBALS['xoops']->url('modules/system/images/icons/' . $style . '/' . $img);
95  return $url;
96 }
97 
98 function system_loadTemplate($name)
99 {
100  global $sysTpl, $xoopsModule;
101 
102  $path = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/templates/admin/' . $name . '.html';
103  if (file_exists($path)) {
104  echo $sysTpl->fetch($path);
105  } else {
106  echo "Unable to read " . $name;
107  }
108 }
109 
110 function modify_chmod($value_chmod, $path_file, $id)
111 {
112  $chmod = '<div id="loading_' . $id . '" align="center" style="display:none;">'
113  . '<img src="./images/mimetypes/spinner.gif" title="Loading" alt="Loading" width="12px"/></div>'
114  . '<div id="chmod' . $id . '">'
115  . '<select size="1" onChange="filemanager_modify_chmod(\'' . $path_file . '\', \'' . $id . '\')" name="chmod" id="chmod">';
116  if ($value_chmod == 777) {
117  $chmod .= '<option value="777" selected><span style="color:green">777</span></option>';
118  } else {
119  $chmod .= '<option value="777"><span style="color:green">777</span></option>';
120  }
121 
122  if ($value_chmod == 776) {
123  $chmod .= '<option value="776" selected>776</option>';
124  } else {
125  $chmod .= '<option value="776">776</option>';
126  }
127 
128  if ($value_chmod == 766) {
129  $chmod .= '<option value="766" selected>766</option>';
130  } else {
131  $chmod .= '<option value="766">766</option>';
132  }
133 
134  if ($value_chmod == 666) {
135  $chmod .= '<option value="666" selected>666</option>';
136  } else {
137  $chmod .= '<option value="666">666</option>';
138  }
139 
140  if ($value_chmod == 664) {
141  $chmod .= '<option value="664" selected>664</option>';
142  } else {
143  $chmod .= '<option value="664">664</option>';
144  }
145 
146  if ($value_chmod == 644) {
147  $chmod .= '<option value="644" selected>644</option>';
148  } else {
149  $chmod .= '<option value="644">644</option>';
150  }
151 
152  if ($value_chmod == 444) {
153  $chmod .= '<option value="444" selected><span style="color:red">444</span></option>';
154  } else {
155  $chmod .= '<option value="444">444</option>';
156  }
157 
158  if ($value_chmod == 440) {
159  $chmod .= '<option value="440" selected>440</option>';
160  } else {
161  $chmod .= '<option value="440">440</option>';
162  }
163 
164  if($value_chmod == 400) {
165  $chmod .= '<option value="400" selected>400</option>';
166  } else {
167  $chmod .= '<option value="400">400</option>';
168  }
169  $chmod .= '</select>';
170 
171  return $chmod;
172 }
173 ?>