11 define(
"RMCPATH",XOOPS_ROOT_PATH.
'/modules/rmcommon');
12 define(
"RMCURL",XOOPS_URL.
'/modules/rmcommon');
13 define(
'ABSURL', XOOPS_URL);
14 define(
'ABSPATH', XOOPS_ROOT_PATH);
15 define(
'RMCVERSION',
'2.1.8.8 RC');
18 define(
'RMMSG_INFO', 0);
19 define(
'RMMSG_WARN', 1);
20 define(
'RMMSG_SUCCESS', 2);
21 define(
'RMMSG_SAVED', 3);
22 define(
'RMMSG_ERROR', 4);
23 define(
'RMMSG_OTHER', 5);
25 ob_start(
'cu_render_output');
33 if(class_exists(
$class))
return;
37 if(
$class==
'xoopskernel')
return;
41 if (substr(
$class, strlen(
$class) - strlen(
'handler'))==
'handler'){
52 if (is_a($xoopsModule,
'XoopsModule') && $xoopsModule->dirname()!=
'system'){
53 $paths[] =
'/modules/'.$xoopsModule->dirname().
'/class';
56 foreach ($paths as
$path){
63 }
elseif (file_exists(XOOPS_ROOT_PATH.$path.
'/'.
$class.
'.php')){
64 include_once XOOPS_ROOT_PATH.$path.
'/'.
$class.
'.php';
66 }
elseif(file_exists(XOOPS_ROOT_PATH.$path.
'/'.
$class.
'.class.php')){
67 include_once XOOPS_ROOT_PATH.$path.
'/'.
$class.
'.class.php';
74 spl_autoload_register(
'rmc_autoloader');
83 global $xoTheme, $xoopsTpl;
87 if (function_exists(
'xoops_cp_header'))
return $output;
91 if(defined(
'COMMENTS_INCLUDED') && COMMENTS_INCLUDED){
105 $str =
"<meta\s+name=['\"]??".$name.
"['\"]??\s+content=['\"]??(.+)['\"]??\s*\/?>";
108 $str =
"meta name=\"$name\" content=\"$content\" />\n";
112 $rtn .=
"\n<meta name=\"$name\" content=\"$content\" />";
121 $pos = strpos(
$page,
"</body>");
122 if($pos===FALSE)
return $output;
130 $pos = strpos(
$page,
"<!-- RMTemplateHeader -->");
137 $pos = strpos(
$page,
"</head>");
138 if($pos===FALSE)
return $output;
149 include_once XOOPS_ROOT_PATH.
'/class/logger/xoopslogger.php';
150 include_once XOOPS_ROOT_PATH.
'/class/database/databasefactory.php';
152 $dbF =
new XoopsDatabaseFactory();
164 define(
'RMCLANG', $rmEvents->run_event(
'rmcommon.set.language', $rmc_config[
'lang']));
167 $file = XOOPS_CACHE_PATH.
'/plgs.cnf';
171 if (file_exists(
$file)){
177 $result =
$db->query(
"SELECT dir FROM ".
$db->prefix(
"rmc_plugins").
' WHERE status=1');
179 $GLOBALS[
'installed_plugins'][$row[
'dir']] =
true;
181 $rmEvents->load_extra_preloads(
RMCPATH.
'/plugins/'.$row[
'dir'], ucfirst($row[
'dir']).
'Plugin');
189 $rmEvents->load_extra_preloads(
RMCPATH.
'/plugins/'.$p, ucfirst($p).
'Plugin');
195 $rmEvents->load_extra_preloads(
RMCPATH.
'/themes/'.$rmc_config[
'theme'], ucfirst($rmc_config[
'theme']));
200 $GLOBALS[
'installed_plugins'] = $rmEvents->run_event(
"rmcommon.plugins.loaded",
$GLOBALS[
'installed_plugins']);
202 require_once
'api/l10n.php';
211 _e(
'Sorry, Red Mexico Common Utilities has not been installed yet!');
215 $rmEvents->run_event(
'rmcommon.base.loaded');
216 $rmTpl->add_head_script(
'var xoUrl = "'.XOOPS_URL.
'";');
220 $interval = $rmc_config[
'updatesinterval']<=0 ? 7 : $rmc_config[
'updatesinterval'];
221 if(file_exists(XOOPS_CACHE_PATH.
'/updates.chk'))
222 $updates = unserialize(base64_decode(file_get_contents(XOOPS_CACHE_PATH.
'/updates.chk')));
224 $updates = array(
'date'=>0,
'total'=>0,
'updates'=>array());
226 $rmTpl->add_local_script(
'updates.js',
'rmcommon',
'include',
'text/javascript',
'',
true);
228 if($updates[
'date']<(time()-($rmc_config[
'updatesinterval']*86400))){
229 $rmTpl->add_head_script(
'(function(){rmCheckUpdates();})();');
230 define(
'RMC_CHECK_UPDATES', 1);
232 $rmTpl->add_head_script(
'$(document).ready(function(){rmCallNotifier('.$updates[
'total'].
');});');
237 include_once
RMCPATH.
'/include/tpl_functions.php';