Exemplo n.º 1
0
 public function indexAction()
 {
     $this->view->phpVersion = phpversion();
     $this->view->databaseVersion = Gio_Db_Mysql::getInstance()->getVersion();
     $configs = Gio_Core_Config_Xml::getConfig('install');
     $this->view->installInformation = $configs;
     $modules = Modules_Core_Services_Module::getModulesInstalled();
     /**
      * Add module core to the top array 
      */
     $modules = array_pad($modules, -count($modules) - 1, array('module_id' => 'core'));
     $quickaccess = array();
     if ($modules) {
         foreach ($modules as $index => $module) {
             $aboutXml = MOD_DIR . DS . $module['module_id'] . DS . 'configs' . DS . 'about.xml';
             if (!file_exists($aboutXml)) {
                 continue;
             }
             $aboutXml = @simplexml_load_file($aboutXml);
             $items = isset($aboutXml->admin->quickaccess->item) ? $aboutXml->admin->quickaccess->item : null;
             if ($items) {
                 foreach ($items as $item) {
                     $data = array();
                     $data['module'] = $module['module_id'];
                     $data['route'] = $item->route;
                     $data['lang_key'] = $item->lang_key;
                     $data['thumbnail'] = $item->thumbnail;
                     $quickaccess[] = $data;
                 }
             }
         }
     }
     $this->view->quickaccess = $quickaccess;
 }
Exemplo n.º 2
0
 /**
  * @return Gio_Db_Mysql
  */
 public function __construct($instance = false)
 {
     if ($instance) {
         return $this;
     }
     $configs = Gio_Core_Config_Xml::getConfig('db');
     $this->_host = $configs->host;
     $this->_username = $configs->username;
     $this->_password = $configs->password;
     $this->_dbName = $configs->name;
     $this->_port = $configs->port;
     $this->_tablePrefix = $configs->table_prefix;
     $host = $this->_port != null ? $this->_host . ':' . $this->_port : $this->_host;
     $link = null;
     $connected = false;
     $connected = mysql_pconnect($host, $this->_username, $this->_password, $link) or die('Cannot connect to Database!');
     $this->_connected = $connected;
     $this->_link = $link;
     mysql_select_db($this->_dbName, $connected);
     mysql_query(sprintf("SET CHARACTER SET '%s'", mysql_real_escape_string($configs->encoding)));
     return self::$_instance = $this;
 }
Exemplo n.º 3
0
 /**
  * Test database connection
  * 
  * @return void
  */
 private function _testdbconn()
 {
     $request = $this->getRequest();
     if (!$request->isPost()) {
         return;
     }
     $conn = Gio_Db_Mysql::getInstance();
     $options = array('host' => $request->getPost('host'), 'port' => $request->getPost('port'), 'username' => $request->getPost('username'), 'password' => $request->getPost('password'));
     $success = $conn->testConnection($options);
     if ($success) {
         $databases = $conn->getDatabases($options);
         $return = array('result' => 'RESULT_OK', 'databases' => $databases);
     } else {
         $return = array('result' => 'RESULT_ERROR', 'databases' => null);
     }
     $json = new Services_JSON();
     $this->getResponse()->setBody($json->encodeUnsafe($return));
 }
Exemplo n.º 4
0
    public static function getUsersOnline()
    {
        $mysql = new Gio_Db_Mysql();
        $sql = 'SELECT * FROM ' . $mysql->_tablePrefix . 'core_session AS s
				WHERE status = "active" AND data != ""';
        $rs = $mysql->query($sql);
        $sessions = array();
        while ($row = $mysql->fetchAll($rs)) {
            $sessions[] = $row;
        }
        /**
         * Free result 
         */
        $mysql->freeResult($rs);
        return $sessions;
    }