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 // $Id$
3 // --------------------------------------------------------------
4 // Designia v1.0
5 // Theme for Common Utilities 2
6 // Author: Eduardo Cort├ęs <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
11 /*require dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))).'/mainfile.php';
12 
13 $xoopsLogger->renderingEnabled = false;
14 $xoopsLogger->activated = false;
15 
16 if(!$xoopsSecurity->check()){
17  die('Session token expired');
18 }*/
20 
21 include_once XOOPS_ROOT_PATH.'/kernel/module.php';
22 
23 $db = XoopsDatabaseFactory::getDatabaseConnection();
24 
25 $sql = "SELECT * FROM ".$db->prefix("modules")." WHERE isactive='1' ORDER BY `name`";
26 $result = $db->query($sql);
27 $installed_dirs = array();
28 
29 while($row = $db->fetchArray($result)){
30  $mod = new XoopsModule();
31  $mod->assignVars($row);
32  $installed_dirs[] = $mod->dirname();
33 
34  if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$mod->getVar('dirname').'/class/'.strtolower($mod->getVar('dirname').'controller').'.php')){
35  include_once XOOPS_ROOT_PATH.'/modules/'.$mod->getVar('dirname').'/class/'.strtolower($mod->getVar('dirname').'controller').'.php';
36  $class = ucfirst($mod->getVar('dirname')).'Controller';
37  $class = new $class();
38  if (method_exists($class, 'get_main_link')){
39  $main_link = $class->get_main_link();
40  } else {
41 
42  if ($mod->getVar('hasmain')){
43  $main_link = XOOPS_URL.'/modules/'.$mod->dirname();
44  } else {
45  $main_link = "#";
46  }
47 
48  }
49  } else {
50 
51  if ($mod->getVar('hasmain')){
52  $main_link = XOOPS_URL.'/modules/'.$mod->dirname();
53  } else {
54  $main_link = "#";
55  }
56 
57  }
58 
59  // Admin section
60  $admin_link = $mod->getVar('hasadmin') ? XOOPS_URL.'/modules/'.$mod->dirname().'/'.$mod->getInfo('adminindex') : '';
61 
62  $deficon = XOOPS_ROOT_PATH.'/modules/rmcommon/themes/designia/images/modules/'.$mod->dirname().'.png';
63 
64  $modules[] = array(
65  'id' => $mod->getVar('mid'),
66  'name' => $mod->getVar('name'),
67  'realname' => $mod->getInfo('name'),
68  'version' => $mod->getInfo('rmnative') ? RMUtilities::format_version($mod->getInfo('rmversion')) : $mod->getInfo('version'),
69  'description' => $mod->getInfo('description'),
70  'image' => is_file($deficon) ? str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $deficon) : (XOOPS_URL.'/modules/'.$mod->getVar('dirname').'/'.($mod->getInfo('icon32') ? $mod->getInfo('icon32') : $mod->getInfo('image'))),
71  'link' => $main_link,
72  'admin_link' => $admin_link,
73  'updated' => formatTimestamp($mod->getVar('last_update'), 's'),
74  'author' => $mod->getInfo('author'),
75  'author_mail' => $mod->getInfo('authormail'),
76  'author_web' => $mod->getInfo('authorweb'),
77  'author_url' => $mod->getInfo('authorurl'),
78  'license' => $mod->getInfo('license'),
79  'dirname' => $mod->getInfo('dirname'),
80  'active' => $mod->getVar('isactive')
81  );
82 }
83 
84 // Event for installed modules
85 $modules = RMEvents::get()->run_event('rmcommon.installed.modules', $modules, $installed_dirs);
86 
87 //include dirname(dirname(__FILE__)).'/include/modules.php';
88 
89 //die();