|
From: <red...@us...> - 2013-08-19 19:19:05
|
Revision: 11939
http://sourceforge.net/p/xoops/svn/11939
Author: redheadedrod
Date: 2013-08-19 19:19:01 +0000 (Mon, 19 Aug 2013)
Log Message:
-----------
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/database/mysqldatabase.php
XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/moduleadmin.php
Modified: XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/database/mysqldatabase.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/database/mysqldatabase.php 2013-08-19 18:29:38 UTC (rev 11938)
+++ XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/database/mysqldatabase.php 2013-08-19 19:19:01 UTC (rev 11939)
@@ -1,408 +1,412 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
-/**
- * MySQL access
- *
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package class
- * @subpackage database
- * @since 1.0.0
- * @author Kazumi Ono <on...@xo...>
- * @version $Id: mysqldatabase.php 10328 2012-12-07 00:56:07Z trabis $
- */
-
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-/**
- * connection to a mysql database
- *
- * @abstract
- * @author Kazumi Ono <on...@xo...>
- * @copyright copyright (c) 2000-2003 XOOPS.org
- * @package class
- * @subpackage database
- */
-class XoopsMySQLDatabase extends XoopsDatabase
-{
-
- /**
- * connect to the database
- *
- * @param bool $selectdb select the database now?
- * @return bool successful?
- */
- public function connect($selectdb = true)
- {
- static $db_charset_set;
-
- if (!extension_loaded('mysql')) {
- trigger_error('notrace:mysql extension not loaded', E_USER_ERROR);
- return false;
- }
-
- $this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET');
-
- if (XOOPS_DB_PCONNECT == 1) {
- $this->conn = @mysql_pconnect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS);
- } else {
- $this->conn = @mysql_connect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS);
- }
-
- if (!$this->conn) {
- $xoopsPreload = XoopsPreload::getInstance();
- $xoopsPreload->triggerEvent('core.database.noconn', array($this));
- return false;
- }
- if ($selectdb != false) {
- if (!mysql_select_db(XOOPS_DB_NAME)) {
- $xoopsPreload = XoopsPreload::getInstance();
- $xoopsPreload->triggerEvent('core.database.nodb');
- return false;
- }
- }
- if (!isset($db_charset_set) && defined('XOOPS_DB_CHARSET') && XOOPS_DB_CHARSET) {
- $this->queryF("SET NAMES '" . XOOPS_DB_CHARSET . "'");
- }
- $db_charset_set = 1;
- $this->queryF("SET SQL_BIG_SELECTS = 1");
- return true;
- }
-
- /**
- * Return information about the database server in use
- *
- * This is a new function added for 2.5.7 and later to allow support for other databases.
- *
- * @return will return version of server in use
- */
- function getServerVersion()
- {
- return mysql_get_server_info();
- }
-
- /**
- * generate an ID for a new row
- *
- * This is for compatibility only. Will always return 0, because MySQL supports
- * autoincrement for primary keys.
- *
- * @param string $sequence name of the sequence from which to get the next ID
- * @return int always 0, because mysql has support for autoincrement
- */
- public function genId($sequence)
- {
- return 0; // will use auto_increment
- }
-
- /**
- * Get a result row as an enumerated array
- *
- * @param resource $result
- * @return array
- */
- public function fetchRow($result)
- {
- return @mysql_fetch_row($result);
- }
-
- /**
- * Fetch a result row as an associative array
- *
- * @param resource $result
- * @return array
- */
- public function fetchArray($result)
- {
- return @mysql_fetch_assoc($result);
- }
-
- /**
- * Fetch a result row as an associative array
- *
- * @param resource $result
- * @return array
- */
- public function fetchBoth($result)
- {
- return @mysql_fetch_array($result, MYSQL_BOTH);
- }
-
- /**
- * XoopsMySQLDatabase::fetchObjected()
- *
- * @param resource $result
- * @return object|stdClass
- */
- public function fetchObject($result)
- {
- return @mysql_fetch_object($result);
- }
-
- /**
- * Get the ID generated from the previous INSERT operation
- *
- * @return int
- */
- public function getInsertId()
- {
- return mysql_insert_id($this->conn);
- }
-
- /**
- * Get number of rows in result
- *
- * @param resource $result
- * @return int
- */
- public function getRowsNum($result)
- {
- return @mysql_num_rows($result);
- }
-
- /**
- * Get number of affected rows
- *
- * @return int
- */
- public function getAffectedRows()
- {
- return mysql_affected_rows($this->conn);
- }
-
- /**
- * Close MySQL connection
- *
- * @return void
- */
- public function close()
- {
- mysql_close($this->conn);
- }
-
- /**
- * will free all memory associated with the result identifier result.
- *
- * @param resource $result query result
- * @return bool TRUE on success or FALSE on failure.
- */
- public function freeRecordSet($result)
- {
- return mysql_free_result($result);
- }
-
- /**
- * Returns the text of the error message from previous MySQL operation
- *
- * @return bool Returns the error text from the last MySQL function, or '' (the empty string) if no error occurred.
- */
- public function error()
- {
- return @mysql_error();
- }
-
- /**
- * Returns the numerical value of the error message from previous MySQL operation
- *
- * @return int Returns the error number from the last MySQL function, or 0 (zero) if no error occurred.
- */
- public function errno()
- {
- return @mysql_errno();
- }
-
- /**
- * Returns escaped string text with single quotes around it to be safely stored in database
- *
- * @param string $str unescaped string text
- * @return string escaped string text with single quotes around
- */
- public function quoteString($str)
- {
- return $this->quote($str);
- }
-
- /**
- * Quotes a string for use in a query.
- *
- * @param $string
- * @return string
- */
- public function quote($string)
- {
- return "'" . str_replace("\\\"", '"', str_replace("\\"", '"', mysql_real_escape_string($string, $this->conn))) . "'";
- }
-
- /**
- * perform a query on the database
- *
- * @param string $sql a valid MySQL query
- * @param int $limit number of records to return
- * @param int $start offset of first record to return
- * @return bool|resource query result or FALSE if successful
- * or TRUE if successful and no result
- */
- public function queryF($sql, $limit = 0, $start = 0)
- {
- if (!empty($limit)) {
- if (empty($start)) {
- $start = 0;
- }
- $sql = $sql . ' LIMIT ' . (int) $start . ', ' . (int) $limit;
- }
- $xoopsPreload = XoopsPreload::getInstance();
- $xoopsPreload->triggerEvent('core.database.query.start');
- $result = mysql_query($sql, $this->conn);
- $xoopsPreload->triggerEvent('core.database.query.end');
-
- if ($result) {
- $xoopsPreload->triggerEvent('core.database.query.success', (array($sql)));
- return $result;
- } else {
- $xoopsPreload->triggerEvent('core.database.query.failure', (array($sql, $this)));
- return false;
- }
- }
-
- /**
- * perform a query
- *
- * This method is empty and does nothing! It should therefore only be
- * used if nothing is exactly what you want done! ;-)
- *
- * @param string $sql a valid MySQL query
- * @param int $limit number of records to return
- * @param int $start offset of first record to return
- * @abstract
- */
- public function query($sql, $limit = 0, $start = 0)
- {
- }
-
- /**
- * perform queries from SQL dump file in a batch
- *
- * @param string $file file path to an SQL dump file
- * @return bool FALSE if failed reading SQL file or TRUE if the file has been read and queries executed
- */
- public function queryFromFile($file)
- {
- if (false !== ($fp = fopen($file, 'r'))) {
- $sql_queries = trim(fread($fp, filesize($file)));
- SqlUtility::splitMySqlFile($pieces, $sql_queries);
- foreach ($pieces as $query) {
- // [0] contains the prefixed query
- // [4] contains unprefixed table name
- $prefixed_query = SqlUtility::prefixQuery(trim($query), $this->prefix());
- if ($prefixed_query != false) {
- $this->query($prefixed_query[0]);
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * Get field name
- *
- * @param resource $result query result
- * @param int $offset numerical field index
- * @return string
- */
- public function getFieldName($result, $offset)
- {
- return mysql_field_name($result, $offset);
- }
-
- /**
- * Get field type
- *
- * @param resource $result query result
- * @param int $offset numerical field index
- * @return string
- */
- public function getFieldType($result, $offset)
- {
- return mysql_field_type($result, $offset);
- }
-
- /**
- * Get number of fields in result
- *
- * @param resource $result query result
- * @return int
- */
- public function getFieldsNum($result)
- {
- return mysql_num_fields($result);
- }
-}
-
-/**
- * Safe Connection to a MySQL database.
- *
- * @author Kazumi Ono <on...@xo...>
- * @copyright copyright (c) 2000-2003 XOOPS.org
- * @package kernel
- * @subpackage database
- */
-class XoopsMySQLDatabaseSafe extends XoopsMySQLDatabase
-{
- /**
- * perform a query on the database
- *
- * @param string $sql a valid MySQL query
- * @param int $limit number of records to return
- * @param int $start offset of first record to return
- * @return resource query result or FALSE if successful
- * or TRUE if successful and no result
- */
- public function query($sql, $limit = 0, $start = 0)
- {
- return $this->queryF($sql, $limit, $start);
- }
-}
-
-/**
- * Read-Only connection to a MySQL database.
- *
- * This class allows only SELECT queries to be performed through its
- * {@link query()} method for security reasons.
- *
- * @author Kazumi Ono <on...@xo...>
- * @copyright copyright (c) 2000-2003 XOOPS.org
- * @package kernel
- * @subpackage database
- */
-class XoopsMySQLDatabaseProxy extends XoopsMySQLDatabase
-{
- /**
- * perform a query on the database
- *
- * this method allows only SELECT queries for safety.
- *
- * @param string $sql a valid MySQL query
- * @param int $limit number of records to return
- * @param int $start offset of first record to return
- * @return resource query result or FALSE if unsuccessful
- */
- public function query($sql, $limit = 0, $start = 0)
- {
- $sql = ltrim($sql);
- if (!$this->allowWebChanges && strtolower(substr($sql, 0, 6)) != 'select') {
- trigger_error('Database updates are not allowed during processing of a GET request', E_USER_WARNING);
- return false;
- }
- return $this->queryF($sql, $limit, $start);
- }
-}
\ No newline at end of file
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/**
+ * MySQL access
+ *
+ * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package class
+ * @subpackage database
+ * @since 1.0.0
+ * @author Kazumi Ono <on...@xo...>
+ * @version $Id: mysqldatabase.php 10328 2012-12-07 00:56:07Z trabis $
+ */
+
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+/**
+ * connection to a mysql database
+ *
+ * @abstract
+ * @author Kazumi Ono <on...@xo...>
+ * @copyright copyright (c) 2000-2003 XOOPS.org
+ * @package class
+ * @subpackage database
+ */
+class XoopsMySQLDatabase extends XoopsDatabase
+{
+
+ /**
+ * @var object keep track of last result since we need it for getAffectedRows
+ */
+ private $_lastResult;
+
+ /**
+ * connect to the database
+ *
+ * @param bool $selectdb select the database now?
+ * @return bool successful?
+ */
+ public function connect($selectdb = true)
+ {
+ static $db_charset_set;
+
+ $config = new \Doctrine\DBAL\Configuration();
+ $connectionParams = array(
+ 'dbname' => XOOPS_DB_NAME,
+ 'user' => XOOPS_DB_USER,
+ 'password' => XOOPS_DB_PASS,
+ 'host' => XOOPS_DB_HOST,
+// 'port' => ?,
+// 'unix_socket' => ?,
+ 'charset' => XOOPS_DB_CHARSET,
+ 'driver' => 'pdo_mysql'
+ );
+ $this->conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
+
+ if (!$this->conn) {
+ $xoopsPreload = XoopsPreload::getInstance();
+ $xoopsPreload->triggerEvent('core.database.noconn', array($this));
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * generate an ID for a new row
+ *
+ * This is for compatibility only. Will always return 0, because MySQL supports
+ * autoincrement for primary keys.
+ *
+ * @param string $sequence name of the sequence from which to get the next ID
+ * @return int always 0, because mysql has support for autoincrement
+ */
+ public function genId($sequence)
+ {
+ return 0; // will use auto_increment
+ }
+
+ /**
+ * Get a result row as an enumerated array
+ *
+ * @param resource $result
+ * @return array
+ */
+ public function fetchRow($result)
+ {
+ return $result->fetch(\PDO::FETCH_NUM);
+ }
+
+ /**
+ * Fetch a result row as an associative array
+ *
+ * @param resource $result
+ * @return array
+ */
+ public function fetchArray($result)
+ {
+ return $result->fetch(\PDO::FETCH_ASSOC);
+ }
+
+ /**
+ * Fetch a result row as an associative array
+ *
+ * @param resource $result
+ * @return array
+ */
+ public function fetchBoth($result)
+ {
+ return $result->fetch(\PDO::FETCH_BOTH);
+ }
+
+ /**
+ * XoopsMySQLDatabase::fetchObjected()
+ *
+ * @param resource $result
+ * @return object|stdClass
+ */
+ public function fetchObject($result)
+ {
+ return $result->fetch(\PDO::FETCH_OBJ);
+ }
+
+ /**
+ * Get the ID generated from the previous INSERT operation
+ *
+ * @return int
+ */
+ public function getInsertId()
+ {
+ return $this->conn->lastInsertId();
+ }
+
+ /**
+ * Get number of rows in result
+ *
+ * @param resource $result
+ * @return int
+ */
+ public function getRowsNum($result)
+ {
+ return $result->rowCount();
+ }
+
+ /**
+ * Get number of affected rows
+ *
+ * @return int
+ */
+ public function getAffectedRows()
+ {
+ return $this->_lastResult->rowCount();
+ }
+
+ /**
+ * Close MySQL connection
+ *
+ * @return void
+ */
+ public function close()
+ {
+ $this->conn->close();
+ }
+
+ /**
+ * will free all memory associated with the result identifier result.
+ *
+ * @param resource $result query result
+ * @return bool TRUE on success or FALSE on failure.
+ */
+ public function freeRecordSet($result)
+ {
+ return $result->closeCursor();
+ }
+
+ /**
+ * Returns the text of the error message from previous MySQL operation
+ *
+ * @return bool Returns the error text from the last MySQL function, or '' (the empty string) if no error occurred.
+ */
+ public function error()
+ {
+ return $this->conn->errorInfo();
+ }
+
+ /**
+ * Returns the numerical value of the error message from previous MySQL operation
+ *
+ * @return int Returns the error number from the last MySQL function, or 0 (zero) if no error occurred.
+ */
+ public function errno()
+ {
+ return $this->conn->errorCode();
+ }
+
+ /**
+ * Returns escaped string text with single quotes around it to be safely stored in database
+ *
+ * @param string $str unescaped string text
+ * @return string escaped string text with single quotes around
+ */
+ public function quoteString($str)
+ {
+ return $this->quote($str);
+ }
+
+ /**
+ * Quotes a string for use in a query.
+ *
+ * @param $string
+ * @return string
+ */
+ public function quote($string)
+ {
+ return $this->conn->quote($string);
+ }
+
+ /**
+ * perform a query on the database
+ *
+ * @param string $sql a valid MySQL query
+ * @param int $limit number of records to return
+ * @param int $start offset of first record to return
+ * @return bool|resource query result or FALSE if successful
+ * or TRUE if successful and no result
+ */
+ public function queryF($sql, $limit = 0, $start = 0)
+ {
+ if (!empty($limit)) {
+ if (empty($start)) {
+ $start = 0;
+ }
+ $sql = $sql . ' LIMIT ' . (int) $start . ', ' . (int) $limit;
+ }
+ $xoopsPreload = XoopsPreload::getInstance();
+ $xoopsPreload->triggerEvent('core.database.query.start');
+ $result = $this->conn->query($sql);
+ $this->_lastResult = $result;
+ $xoopsPreload->triggerEvent('core.database.query.end');
+
+ if ($result) {
+ $xoopsPreload->triggerEvent('core.database.query.success', (array($sql)));
+ return $result;
+ } else {
+ $xoopsPreload->triggerEvent('core.database.query.failure', (array($sql, $this)));
+ return false;
+ }
+ }
+
+ /**
+ * perform a query
+ *
+ * This method is empty and does nothing! It should therefore only be
+ * used if nothing is exactly what you want done! ;-)
+ *
+ * @param string $sql a valid MySQL query
+ * @param int $limit number of records to return
+ * @param int $start offset of first record to return
+ * @abstract
+ */
+ public function query($sql, $limit = 0, $start = 0)
+ {
+ }
+
+ /**
+ * perform queries from SQL dump file in a batch
+ *
+ * @param string $file file path to an SQL dump file
+ * @return bool FALSE if failed reading SQL file or TRUE if the file has been read and queries executed
+ */
+ public function queryFromFile($file)
+ {
+ if (false !== ($fp = fopen($file, 'r'))) {
+ $sql_queries = trim(fread($fp, filesize($file)));
+ SqlUtility::splitMySqlFile($pieces, $sql_queries);
+ foreach ($pieces as $query) {
+ // [0] contains the prefixed query
+ // [4] contains unprefixed table name
+ $prefixed_query = SqlUtility::prefixQuery(trim($query), $this->prefix());
+ if ($prefixed_query != false) {
+ $this->query($prefixed_query[0]);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get field name
+ *
+ * @deprecated Names are available as keys when using fetchArray
+ *
+ * @param resource $result query result
+ * @param int $offset numerical field index
+ * @return string
+ */
+ public function getFieldName($result, $offset)
+ {
+ $xoops = Xoops::getInstance();
+ $xoops->deprecated('getFieldName() is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
+
+ return null;
+ }
+
+ /**
+ * Get field type
+ *
+ * @deprecated Field types should be know from the XoopsObject or
+ * schema, not from the result set.
+ *
+ * @param resource $result query result
+ * @param int $offset numerical field index
+ * @return string
+ */
+ public function getFieldType($result, $offset)
+ {
+ $xoops = Xoops::getInstance();
+ $xoops->deprecated('getFieldType() is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
+
+ return null;
+ }
+
+ /**
+ * Get number of fields in result
+ *
+ * @param resource $result query result
+ * @return int
+ */
+ public function getFieldsNum($result)
+ {
+ return $result->columnCount();
+ }
+
+ /**
+ * Return the connection object, a Doctrine\DBAL\Connection
+ *
+ * @return object Doctrine\DBAL\Connection
+ */
+ public function direct()
+ {
+ return $this->conn;
+ }
+
+}
+
+/**
+ * Safe Connection to a MySQL database.
+ *
+ * @author Kazumi Ono <on...@xo...>
+ * @copyright copyright (c) 2000-2003 XOOPS.org
+ * @package kernel
+ * @subpackage database
+ */
+class XoopsMySQLDatabaseSafe extends XoopsMySQLDatabase
+{
+ /**
+ * perform a query on the database
+ *
+ * @param string $sql a valid MySQL query
+ * @param int $limit number of records to return
+ * @param int $start offset of first record to return
+ * @return resource query result or FALSE if successful
+ * or TRUE if successful and no result
+ */
+ public function query($sql, $limit = 0, $start = 0)
+ {
+ return $this->queryF($sql, $limit, $start);
+ }
+}
+
+/**
+ * Read-Only connection to a MySQL database.
+ *
+ * This class allows only SELECT queries to be performed through its
+ * {@link query()} method for security reasons.
+ *
+ * @author Kazumi Ono <on...@xo...>
+ * @copyright copyright (c) 2000-2003 XOOPS.org
+ * @package kernel
+ * @subpackage database
+ */
+class XoopsMySQLDatabaseProxy extends XoopsMySQLDatabase
+{
+ /**
+ * perform a query on the database
+ *
+ * this method allows only SELECT queries for safety.
+ *
+ * @param string $sql a valid MySQL query
+ * @param int $limit number of records to return
+ * @param int $start offset of first record to return
+ * @return resource query result or FALSE if unsuccessful
+ */
+ public function query($sql, $limit = 0, $start = 0)
+ {
+ $sql = ltrim($sql);
+ if (!$this->allowWebChanges && strtolower(substr($sql, 0, 6)) != 'select') {
+ trigger_error('Database updates are not allowed during processing of a GET request', E_USER_WARNING);
+ return false;
+ }
+ return $this->queryF($sql, $limit, $start);
+ }
+}
Modified: XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/moduleadmin.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/moduleadmin.php 2013-08-19 18:29:38 UTC (rev 11938)
+++ XoopsCore/branches/2.6.x/2.6.0_redheadedrod/class/moduleadmin.php 2013-08-19 19:19:01 UTC (rev 11939)
@@ -17,7 +17,7 @@
* @package class
* @since 2.6.0
* @author Mage Grégory (AKA Mage)
- * @version $Id: moduleadmin.php 10677 2013-01-06 01:12:16Z trabis $
+ * @version $Id: moduleadmin.php 11012 2013-02-10 00:51:04Z trabis $
*/
class XoopsModuleAdmin
@@ -127,11 +127,11 @@
case "folder":
if (!is_dir($value)) {
$this->_itemConfigBoxLine[] = array(
- 'type' => 'error', 'text' => sprintf(_AM_MODULEADMIN_CONFIG_FOLDERKO, $value)
+ 'type' => 'error', 'text' => sprintf(XoopsLocale::EF_FOLDER_DOES_NOT_EXIST, $value)
);
} else {
$this->_itemConfigBoxLine[] = array(
- 'type' => 'accept', 'text' => sprintf(_AM_MODULEADMIN_CONFIG_FOLDEROK, $value)
+ 'type' => 'accept', 'text' => sprintf(xoopsLocale::SF_FOLDER_EXISTS, $value)
);
}
break;
@@ -141,12 +141,12 @@
if (substr(decoct(fileperms($value[0])), 2) != $value[1]) {
$this->_itemConfigBoxLine[] = array(
'type' => 'error',
- 'text' => sprintf(_AM_MODULEADMIN_CONFIG_CHMOD, $value[0], $value[1], substr(decoct(fileperms($value[0])), 2))
+ 'text' => sprintf(XoopsLocale::EF_FOLDER_MUST_BE_WITH_CHMOD, $value[0], $value[1], substr(decoct(fileperms($value[0])), 2))
);
} else {
$this->_itemConfigBoxLine[] = array(
'type' => 'accept',
- 'text' => sprintf(_AM_MODULEADMIN_CONFIG_CHMOD, $value[0], $value[1], substr(decoct(fileperms($value[0])), 2))
+ 'text' => sprintf(XoopsLocale::EF_FOLDER_MUST_BE_WITH_CHMOD, $value[0], $value[1], substr(decoct(fileperms($value[0])), 2))
);
}
}
@@ -163,11 +163,11 @@
}
if ($xoops->isActiveModule($text) == false) {
$this->_itemConfigBoxLine[] = array(
- 'type' => $type, 'text' => sprintf(_AM_MODULEADMIN_CONFIG_EXTENSIONKO, $text)
+ 'type' => $type, 'text' => sprintf(XoopsLocale::EF_EXTENSION_IS_NOT_INSTALLED, $text)
);
} else {
$this->_itemConfigBoxLine[] = array(
- 'type' => 'accept', 'text' => sprintf(_AM_MODULEADMIN_CONFIG_EXTENSIONOK, $text)
+ 'type' => 'accept', 'text' => sprintf(XoopsLocale::SF_EXTENSION_IS_INSTALLED, $text)
);
}
break;
@@ -183,11 +183,11 @@
}
if ($xoops->isActiveModule($text) == false) {
$this->_itemConfigBoxLine[] = array(
- 'type' => $type, 'text' => sprintf(_AM_MODULEADMIN_CONFIG_MODULEKO, $text)
+ 'type' => $type, 'text' => sprintf(XoopsLocale::F_MODULE_IS_NOT_INSTALLED, $text)
);
} else {
$this->_itemConfigBoxLine[] = array(
- 'type' => 'accept', 'text' => sprintf(_AM_MODULEADMIN_CONFIG_MODULEOK, $text)
+ 'type' => 'accept', 'text' => sprintf(XoopsLocale::F_MODULE_IS_INSTALLED, $text)
);
}
break;
@@ -352,7 +352,7 @@
$help = array();
$help['link'] = '../system/help.php?mid=' . $this->_obj->getVar('mid', 's') . "&" . $this->_obj->getInfo('help');
$help['icon'] = $xoops->url("/media/xoops/images/icons/32/help.png");
- $help['title'] = _AM_SYSTEM_HELP;
+ $help['title'] = XoopsLocale::HELP;
$xoops->tpl()->append('xo_admin_index_menu', $help);
}
$xoops->tpl()->assign('xo_admin_box', $this->_itemInfoBox);
@@ -362,16 +362,28 @@
// PHP version
if ($this->_obj->getInfo('min_php')) {
if (phpversion() < $this->_obj->getInfo('min_php')) {
- $this->addConfigBoxLine(sprintf(_AM_MODULEADMIN_CONFIG_PHP, $this->_obj->getInfo('min_php'), phpversion()), 'error');
+ $this->addConfigBoxLine(sprintf(XoopsLocale::F_MINIMUM_PHP_VERSION_REQUIRED, $this->_obj->getInfo('min_php'), phpversion()), 'error');
} else {
- $this->addConfigBoxLine(sprintf(_AM_MODULEADMIN_CONFIG_PHP, $this->_obj->getInfo('min_php'), phpversion()), 'accept');
+ $this->addConfigBoxLine(sprintf(XoopsLocale::F_MINIMUM_PHP_VERSION_REQUIRED, $this->_obj->getInfo('min_php'), phpversion()), 'accept');
}
}
// Database version
$dbarray = $this->_obj->getInfo('min_db');
if ($dbarray[XOOPS_DB_TYPE]) {
- global $xoopsDB;
- $dbCurrentVersion= $xoopsDB->getServerVersion();
+ switch (XOOPS_DB_TYPE) {
+ case "mysql":
+ $dbCurrentVersion = mysql_get_server_info();
+ break;
+ case "mysqli":
+ $dbCurrentVersion = mysqli_get_server_info();
+ break;
+ case "pdo":
+ $dbCurrentVersion = $xoops->db()->getAttribute(PDO::ATTR_SERVER_VERSION);
+ break;
+ default:
+ $dbCurrentVersion = '0';
+ break;
+ }
$currentVerParts = explode('.', (string)$dbCurrentVersion);
$iCurrentVerParts = array_map('intval', $currentVerParts);
$dbRequiredVersion = $dbarray[XOOPS_DB_TYPE];
@@ -389,18 +401,18 @@
}
}
if ($reqVer > $curVer) {
- $this->addConfigBoxLine(sprintf(strtoupper(XOOPS_DB_TYPE) . ' ' . _AM_MODULEADMIN_CONFIG_DB, $dbRequiredVersion, $dbCurrentVersion), 'error');
+ $this->addConfigBoxLine(sprintf(strtoupper(XOOPS_DB_TYPE) . ' ' . XoopsLocale::F_MINIMUM_DATABASE_VERSION_REQUIRED, $dbRequiredVersion, $dbCurrentVersion), 'error');
} else {
- $this->addConfigBoxLine(sprintf(strtoupper(XOOPS_DB_TYPE) . ' ' . _AM_MODULEADMIN_CONFIG_DB, $dbRequiredVersion, $dbCurrentVersion), 'accept');
+ $this->addConfigBoxLine(sprintf(strtoupper(XOOPS_DB_TYPE) . ' ' . XoopsLocale::F_MINIMUM_DATABASE_VERSION_REQUIRED, $dbRequiredVersion, $dbCurrentVersion), 'accept');
}
}
// xoops version
if ($this->_obj->getInfo('min_xoops')) {
if (substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION) - 6) < $this->_obj->getInfo('min_xoops')) {
- $this->addConfigBoxLine(sprintf(_AM_MODULEADMIN_CONFIG_XOOPS, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION) - 6)), 'error');
+ $this->addConfigBoxLine(sprintf(XoopsLocale::F_MINIMUM_XOOPS_VERSION_REQUIRED, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION) - 6)), 'error');
} else {
- $this->addConfigBoxLine(sprintf(_AM_MODULEADMIN_CONFIG_XOOPS, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION) - 6)), 'accept');
+ $this->addConfigBoxLine(sprintf(XoopsLocale::F_MINIMUM_XOOPS_VERSION_REQUIRED, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION) - 6)), 'accept');
}
}
$xoops->tpl()->assign('xo_admin_index_config', $this->_itemConfigBoxLine);
@@ -480,7 +492,7 @@
$date = explode('/', $this->_obj->getInfo('release_date'));
$author = explode(',', $this->_obj->getInfo('author'));
$nickname = explode(',', $this->_obj->getInfo('nickname'));
- $release_date = XoopsLocal::formatTimestamp(mktime(0, 0, 0, $date[1], $date[2], $date[0]), 's');
+ $release_date = XoopsLocale::formatTimestamp(mktime(0, 0, 0, $date[1], $date[2], $date[0]), 's');
$author_list = '';
foreach (array_keys($author) as $i) {
@@ -492,12 +504,11 @@
}
}
$changelog = '';
- $language = $xoops->getConfig('language');
- if (!is_file(XOOPS_ROOT_PATH . "/modules/" . $this->_obj->getVar("dirname") . "/language/" . $language . "/changelog.txt")) {
- $language = 'english';
+ $language = $xoops->getConfig('locale');
+ if (!is_file(XOOPS_ROOT_PATH . "/modules/" . $this->_obj->getVar("dirname") . "/locale/" . $language . "/changelog.txt")) {
+ $language = 'en_US';
}
- $language = empty($language) ? $xoops->getConfig('language') : $language;
- $file = XOOPS_ROOT_PATH . "/modules/" . $this->_obj->getVar("dirname") . "/language/" . $language . "/changelog.txt";
+ $file = XOOPS_ROOT_PATH . "/modules/" . $this->_obj->getVar("dirname") . "/locale/" . $language . "/changelog.txt";
if (is_readable($file)) {
$changelog = utf8_encode(implode("<br />", file($file))) . "\n";
} else {
@@ -516,10 +527,10 @@
$this->_obj->setInfo('changelog', $changelog);
$xoops->tpl()->assign('module', $this->_obj);
- $this->addInfoBox(_AM_MODULEADMIN_ABOUT_MODULEINFO, 'info', 'id="xo-about"');
- $this->addInfoBoxLine(_AM_MODULEADMIN_ABOUT_DESCRIPTION . ' ' . $this->_obj->getInfo("description"), 'info');
- $this->addInfoBoxLine(_AM_MODULEADMIN_ABOUT_UPDATEDATE . ' <span class="bold">' . XoopsLocal::formatTimestamp($this->_obj->getVar("last_update"), "m") . '</span>', 'info');
- $this->addInfoBoxLine(_AM_MODULEADMIN_ABOUT_WEBSITE . ' <a class="xo-tooltip" href="http://' . $this->_obj->getInfo("module_website_url") . '" rel="external" title="' . $this->_obj->getInfo("module_website_name") . ' - ' . $this->_obj->getInfo("module_website_url") . '">
+ $this->addInfoBox(XoopsLocale::MODULE_INFORMATION, 'info', 'id="xo-about"');
+ $this->addInfoBoxLine(XoopsLocale::C_DESCRIPTION . ' ' . $this->_obj->getInfo("description"), 'info');
+ $this->addInfoBoxLine(XoopsLocale::C_UPDATE_DATE . ' <span class="bold">' . XoopsLocale::formatTimestamp($this->_obj->getVar("last_update"), "m") . '</span>', 'info');
+ $this->addInfoBoxLine(XoopsLocale::C_WEBSITE . ' <a class="xo-tooltip" href="http://' . $this->_obj->getInfo("module_website_url") . '" rel="external" title="' . $this->_obj->getInfo("module_website_name") . ' - ' . $this->_obj->getInfo("module_website_url") . '">
' . $this->_obj->getInfo("module_website_name") . '</a>', 'info');
$xoops->tpl()->assign('xoops_logo', $logo_xoops);
|