XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
install.php
Go to the documentation of this file.
1 <?php
2 // $Id: install.php 1062 2012-09-14 16:18:41Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
12 
13  // Restore previous configurations
14  $db = XoopsDatabaseFactory::getDatabaseConnection();
15 
16  $db->queryF("UPDATE ".$db->prefix("config")." SET conf_value='default' WHERE conf_name='cpanel'");
17 
18  return true;
19 
20 }
21 
23 
24  xoops_setActiveModules();
25  return true;
26 
27 }
28 
30  // Restore previous configurations
31  $db = XoopsDatabaseFactory::getDatabaseConnection();
32 
33  $db->queryF("UPDATE ".$db->prefix("config")." SET conf_value='redmexico' WHERE conf_name='cpanel'");
34 
35  // Temporary solution
36  $contents = file_get_contents(XOOPS_VAR_PATH.'/configs/xoopsconfig.php');
37  $write = "if(file_exists(XOOPS_ROOT_PATH.'/modules/rmcommon/loader.php')) include_once XOOPS_ROOT_PATH.'/modules/rmcommon/loader.php';";
38  if(strpos($contents,$write)!==FALSE) return true;
39 
40  $pos = strpos($contents, '<?php');
41 
42  file_put_contents(XOOPS_VAR_PATH.'/configs/xoopsconfig.php', substr($contents, $pos, 5)."\n".$write."\n".substr($contents, $pos+5));
43  xoops_setActiveModules();
44 
45  return true;
46 }