XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
modules.php
Go to the documentation of this file.
1 <?php
2 /*
3 Theme name: Two Point Six
4 Theme URI: http://www.redmexico.com.mx
5 Version: 1.0
6 Author: bitcero
7 Author URI: http://www.bitcero.info
8 */
9 
10 require dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))).'/mainfile.php';
11 
12 $xoopsLogger->renderingEnabled = false;
13 $xoopsLogger->activated = false;
14 
15 /*if(!$xoopsSecurity->check()){
16  die('Session token expired');
17 }*/
19 
20 include_once XOOPS_ROOT_PATH.'/kernel/module.php';
21 
22 $db = XoopsDatabaseFactory::getDatabaseConnection();
23 
24 $sql = "SELECT * FROM ".$db->prefix("modules")." WHERE isactive='1' ORDER BY `name`";
25 $result = $db->query($sql);
26 $installed_dirs = array();
27 
28 while($row = $db->fetchArray($result)){
29  $mod = new XoopsModule();
30  $mod->assignVars($row);
31  $installed_dirs[] = $mod->dirname();
32 
33  if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$mod->getVar('dirname').'/class/'.strtolower($mod->getVar('dirname').'controller').'.php')){
34  include_once XOOPS_ROOT_PATH.'/modules/'.$mod->getVar('dirname').'/class/'.strtolower($mod->getVar('dirname').'controller').'.php';
35  $class = ucfirst($mod->getVar('dirname')).'Controller';
36  $class = new $class();
37  if (method_exists($class, 'get_main_link')){
38  $main_link = $class->get_main_link();
39  } else {
40 
41  if ($mod->getVar('hasmain')){
42  $main_link = XOOPS_URL.'/modules/'.$mod->dirname();
43  } else {
44  $main_link = "#";
45  }
46 
47  }
48  } else {
49 
50  if ($mod->getVar('hasmain')){
51  $main_link = XOOPS_URL.'/modules/'.$mod->dirname();
52  } else {
53  $main_link = "#";
54  }
55 
56  }
57 
58  // Admin section
59  $admin_link = $mod->getVar('hasadmin') ? XOOPS_URL.'/modules/'.$mod->dirname().'/'.$mod->getInfo('adminindex') : '';
60 
61  //$deficon = XOOPS_ROOT_PATH.'/modules/rmcommon/themes/twop6/images/modules/'.$mod->dirname().'.png';
62 
63  $modules[] = array(
64  'id' => $mod->getVar('mid'),
65  'name' => $mod->getVar('name'),
66  'realname' => $mod->getInfo('name'),
67  'version' => $mod->getInfo('rmnative') ? RMUtilities::format_version($mod->getInfo('rmversion')) : $mod->getInfo('version'),
68  'description' => $mod->getInfo('description'),
69  'image' => XOOPS_URL.'/modules/'.$mod->getVar('dirname').'/'.$mod->getInfo('image'),
70  'link' => $main_link,
71  'admin_link' => $admin_link,
72  'updated' => formatTimestamp($mod->getVar('last_update'), 's'),
73  'author' => $mod->getInfo('author'),
74  'author_mail' => $mod->getInfo('authormail'),
75  'author_web' => $mod->getInfo('authorweb'),
76  'author_url' => $mod->getInfo('authorurl'),
77  'license' => $mod->getInfo('license'),
78  'dirname' => $mod->getInfo('dirname'),
79  'active' => $mod->getVar('isactive')
80  );
81 }
82 
83 // Event for installed modules
84 $modules = RMEvents::get()->run_event('rmcommon.installed.modules', $modules, $installed_dirs);
85 
86 //include dirname(dirname(__FILE__)).'/include/modules.php';
87 
88 foreach($modules as $mod): ?>
89 <a rel="tooltip" href="<?php echo $mod['admin_link']; ?>" title="<?php echo $mod['name']; ?>">
90  <img src="<?php echo $mod['image']; ?>" alt="<?php echo $mod['name']; ?>" />
91  <span><?php echo $mod['name']; ?></span>
92 </a>
93 <?php endforeach;
94 
95 die();