From: <wis...@us...> - 2012-02-26 17:48:23
|
Revision: 9067 http://xoops.svn.sourceforge.net/xoops/?rev=9067&view=rev Author: wishcraft Date: 2012-02-26 17:48:12 +0000 (Sun, 26 Feb 2012) Log Message: ----------- 2.6.0 alpha database patch for ADODB and File Query Cache - Remember to patch secure.dist.php with changes will not work otherwise. Added Paths: ----------- XoopsCore/branches/tasks/2.6.0-wishcraft/class/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/access_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ado5_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ado_access_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ado_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ado_mssql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-active-record.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-active-recordx.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-csvlib.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-datadict.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-error.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-errorhandler.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-errorpear.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-exceptions.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-iterator.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-lib.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-memcache.lib.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-pager.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-pear.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-perf.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-php4.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-time.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-xmlschema.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb-xmlschema03.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/adodb.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/contrib/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/contrib/toxmlrpc.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-access.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-db2.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-firebird.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-generic.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-ibase.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-informix.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-mssql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-mssqlnative.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-mysql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-oci8.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-postgres.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-sapdb.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-sqlite.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/datadict/datadict-sybase.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-access.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-ado.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-ado5.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-ado_access.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-ado_mssql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-ads.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-borland_ibase.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-csv.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-db2.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-db2oci.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-db2ora.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-fbsql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-firebird.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-ibase.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-informix.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-informix72.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-ldap.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mssql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mssql_n.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mssqlnative.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mssqlpo.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mysql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mysqli.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mysqlpo.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-mysqlt.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-netezza.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-oci8.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-oci805.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-oci8po.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-odbc.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-odbc_db2.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-odbc_mssql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-odbc_oracle.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-odbtp.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-odbtp_unicode.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-oracle.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-pdo.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-pdo_mssql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-pdo_mysql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-pdo_oci.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-pdo_pgsql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-pdo_sqlite.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-postgres.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-postgres64.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-postgres7.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-postgres8.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-proxy.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-sapdb.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-sqlanywhere.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-sqlite.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-sqlitepo.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-sybase.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-sybase_ase.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/drivers/adodb-vfp.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-ar.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-bg.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-bgutf8.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-ca.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-cn.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-cz.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-da.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-de.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-en.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-es.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-esperanto.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-fa.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-fr.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-hu.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-it.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-nl.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-pl.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-pt-br.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-ro.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-ru1251.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-sv.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb-uk1251.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/lang/adodb_th.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/license.txt XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/pear/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/pear/Auth/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/pear/Auth/Container/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/pear/Auth/Container/ADOdb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/pear/readme.Auth.txt XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/perf-db2.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/perf-informix.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/perf-mssql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/perf-mssqlnative.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/perf-mysql.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/perf-oci8.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/perf/perf-postgres.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/pivottable.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/readme.txt XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/rsfilter.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/server.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/toexport.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/tohtml.inc.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xmlschema.dtd XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xmlschema03.dtd XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xsl/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xsl/convert-0.1-0.2.xsl XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xsl/convert-0.1-0.3.xsl XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xsl/convert-0.2-0.1.xsl XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xsl/convert-0.2-0.3.xsl XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xsl/remove-0.2.xsl XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/adodb/xsl/remove-0.3.xsl XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ads_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/borland_ibase_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/csv_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/database.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/databasefactory.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/db2_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/db2oci_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/fbsql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/firebird_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ibase_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/informix72_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/informix_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/ldap_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/manager.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mssql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mssql_n_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mssqlnative_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mssqlpo_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mysql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mysqli_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mysqlpo_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/mysqlt_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/netezza_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/oci805_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/oci8_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/oci8po_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/odbc_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/odbc_db2_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/odbc_mssql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/odbc_oracle_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/odbtp_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/odbtp_unicode_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/oracle_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ado.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ado5.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ado_access.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ado_mssql.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ads.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/borland_ibase.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/csv.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/db2.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/db2oci.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/firebird.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ibase.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/informix.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/informix72.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/ldap.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mssql.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mssql_n.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mssqlnative.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mssqlpo.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mysql.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mysqli.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mysqlpo.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/mysqlt.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/netezza.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/oci8.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/oci805.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/oci8po.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/odbc_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/odbc_db2.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/odbc_mssql.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/odbc_oracle.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/odbtp.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/odbtp_unicode.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/oracle.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/pdo.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/pdo_mssql.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/pdo_mysql.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/pdo_oci.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/pdo_pgsql.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/pdo_sqlite.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/pivot.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/postgres.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/postgres7.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/postgres8.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/proxy.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/sapdb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/sqlanywhere.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/sqlite.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/sqlitepo.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/sybase.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/sybase_ase.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo/vfp.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo_mssql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo_mysql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo_oci_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo_pgsql_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/pdo_sqlite_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/postgres7_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/postgres8_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/postgres_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/proxy_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/sapdb_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/sqlanywhere_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/sqlite_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/sqlitepo_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/sqlutility.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/sybase_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/sybase_ase_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/vfp_adodb.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/ XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/joint.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/read.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/stats.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/sync.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/write.php XoopsCore/branches/tasks/2.6.0-wishcraft/class/model/xoopsmodel.php XoopsCore/branches/tasks/2.6.0-wishcraft/comments.php XoopsCore/branches/tasks/2.6.0-wishcraft/install/ XoopsCore/branches/tasks/2.6.0-wishcraft/install/include/ XoopsCore/branches/tasks/2.6.0-wishcraft/install/include/config.php XoopsCore/branches/tasks/2.6.0-wishcraft/install/include/makedata.php XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/ XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/ XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/firebird.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/mysqli.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/mysqlpo.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/mysqlt.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/pdo_mysql.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/pdo_pgsql.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/postgres.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/postgres7.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/english/postgres8.lang.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/language/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/ XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/firebird.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/firebird.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/mysqli.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/mysqli.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/mysqlpo.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/mysqlpo.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/mysqlt.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/mysqlt.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/pdo_mysql.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/pdo_mysql.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/pdo_pgsql.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/pdo_pgsql.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/postgres.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/postgres.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/postgres7.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/postgres7.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/postgres8.data.sql XoopsCore/branches/tasks/2.6.0-wishcraft/install/sql/postgres8.structure.sql XoopsCore/branches/tasks/2.6.0-wishcraft/kernel/ XoopsCore/branches/tasks/2.6.0-wishcraft/kernel/object.php XoopsCore/branches/tasks/2.6.0-wishcraft/language/ XoopsCore/branches/tasks/2.6.0-wishcraft/language/english/ XoopsCore/branches/tasks/2.6.0-wishcraft/language/english/global.php XoopsCore/branches/tasks/2.6.0-wishcraft/language/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/maintenance/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/maintenance/dump/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/maintenance/dump/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/maintenance/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/maintenance/main.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/maintenance/xoops_version.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/modulesadmin/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/modulesadmin/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/modulesadmin/main.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/admin/modulesadmin/xoops_version.php XoopsCore/branches/tasks/2.6.0-wishcraft/xoops_data/ XoopsCore/branches/tasks/2.6.0-wishcraft/xoops_data/caches/ XoopsCore/branches/tasks/2.6.0-wishcraft/xoops_data/caches/adodb_cache/ XoopsCore/branches/tasks/2.6.0-wishcraft/xoops_data/caches/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/xoops_data/data/ XoopsCore/branches/tasks/2.6.0-wishcraft/xoops_data/data/secure.dist.php Added: XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/access_adodb.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/access_adodb.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/class/database/access_adodb.php 2012-02-26 17:48:12 UTC (rev 9067) @@ -0,0 +1,1776 @@ +<?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. +*/ + +/** + * Factory Class for Xoops Database + * + * @copyright The XOOPS project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package kernel + * @subpackage database + * @since 2.6.0 + * @author Kazumi Ono <on...@xo...> + * @author Simon Roberts <si...@xo...> + * @version $Id: mysqldatabase.php 3775 2009-10-23 10:29:51Z trabis $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * + * @package kernel + * @subpackage database + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ + +/** + * base class + */ +include_once XOOPS_ROOT_PATH . '/class/database/database.php'; +include_once XOOPS_ROOT_PATH . '/class/database/adodb/adodb.inc.php'; +include_once XOOPS_ROOT_PATH . '/class/database/pdo/'.XOOPS_DB_TYPE.'.php'; + +// xoops_load( 'xoopsdatabase' ); +/** + * connection to a mysql database + * + * @abstrac + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + * @package kernel + * @subpackage database + */ +class XoopsAccess_ADODBDatabase extends XoopsDatabase +{ + /** + * Database connection + * + * @var resource + */ + var $conn; + + /** + * connect to the database + * + * @param bool $selectdb select the database now? + * @return bool successful? + */ + public function connect($selectdb = true) + { + static $db_charset_set;$this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET'); + + if (!defined('XOOPS_DB_DNS')) { + trigger_error('notrace:Xoops Database DNS not set', E_USER_ERROR); + return false; + } + + // This is a global variable that determines how arrays are retrieved by recordsets. The recordset saves this value on creation (eg.// + // in Execute( ) or SelectLimit( )), and any subsequent changes to $ADODB_FETCH_MODE have no affect on existing recordsets, only on + // recordsets created in the future + $GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_ASSOC; // Options: ADODB_FETCH_DEFAULT, ADODB_FETCH_NUM, ADODB_FETCH_ASSOC, ADODB_FETCH_BOTH + + // If you are using recordset caching, this is the directory to save your recordsets in. Define this before you call any caching + // public functions such as CacheExecute( ). We recommend setting register_globals=off in php.ini if you use this feature for security reasons. + $GLOBALS['ADODB_CACHE_DIR'] = XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . 'caches'. DIRECTORY_SEPARATOR .'adodb_cache'; + + // If the database driver API does not support counting the number of records returned in a SELECT statement, the public function RecordCount() + // is emulated when the global variable $ADODB_COUNTRECS is set to true, which is the default. We emulate this by buffering the records, + // which can take up large amounts of memory for big recordsets. Set this variable to false for the best performance. This variable is + // checked every time a query is executed, so you can selectively choose which recordsets to count. + $GLOBALS['ADODB_COUNTRECS'] = true; + + //Determines the language used in MetaErrorMsg(). The default is 'en', for English. To find out what languages are supported, see the + // files in adodb/lang/adodb-$lang.inc.php, where $lang is the supported language. + $GLOBALS['ADODB_LANG'] = 'en'; + + // Determines whether to right trim CHAR fields (and also VARCHAR for ibase/firebird). Set to true to trim. Default is false. + // Currently works for oci8po, ibase and firebird drivers. + $GLOBALS['ADODB_ANSI_PADDING_OFF'] = true; + + $this->conn = @NewADOConnection(XOOPS_DB_DSN); + if (!$this->conn) { + $this->logger->addQuery('', $this->error(), $this->errno()); + return false; + } else { + $this->conn->setFetchMode($GLOBALS['ADODB_FETCH_MODE']); + } + } + + /** + * check if connected to a database + * + * @return true if connected to database + */ + public function isConnected() + { + return @$this->conn->IsConnected(); // will use auto_increment + } + + /** + * execute a sql question to the database + * + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @param $inputarr parameter can be used for binding variables to parameters + * @return ADORecordset Objects + */ + public function execute($sql, $inputarr=false) + { + return @$this->conn->Execute($sql, $inputarr); // will use auto_increment + } + + /** + * Similar to Execute, except that the recordset is cached for $secs2cache seconds + * + * @param $secs2cache the recordset is cached for $secs2cache seconds + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @param $inputarr parameter can be used for binding variables to parameters + * @return ADODBRecordset Object from cache + */ + public function executeCache($secs2cache,$sql,$inputarr=false) + { + return @$this->conn->CacheExecute($secs2cache,$sql,$inputarr); + } + + /** + * Execute an Oracle stored procedure, and returns an Oracle REF cursor variable as a regular ADOdb recordset + * + * @param $cursorName Oracle REF cursor variable as a regular ADOdb recordset + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @param $parameters parameter can be used for binding variables to parameters + * @returntrue if connected to database + */ + public function executeCursor($sql,$cursorName='rs',$parameters=false) + { + if (XOOPS_DB_TYPE!='oci8_adodb') + trigger_error('ADODB: Function not supported by database type! Function: '.__FUNC__.'; Class: '.__CLASS__); + else + return @$this->conn->ExecuteCursor($sql,$cursorName,$parameters); + } + + /** + * Returns a recordset if successful. Returns false otherwise. Performs a select statement. + * + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @param $numrows number of rows to return + * @param $offset offset in record count to load from. + * @param $inputarr parameter can be used for binding variables to parameters + * @return ADORecordset Object + */ + public function fetchSelectLimit($sql,$numrows=-1,$offset=-1,$inputarr=false) + { + return @$this->conn->SelectLimit($sql,$numrows,$offset,$inputarr); + } + + /** + * Similar to SelectLimit, except that the recordset returned is cached for $secs2cache seconds + * + * @param $secs2cache the recordset is cached for $secs2cache seconds + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @param $numrows number of rows to return + * @param $offset offset in record count to load from. + * @param $inputarr parameter can be used for binding variables to parameters + * @return true if connected to database + */ + public function fetchCacheSelectLimit($secs2cache, $sql, $numrows=-1,$offset=-1,$inputarr=false) + { + return @$this->conn->CacheSelectLimit($secs2cache, $sql, $numrows,$offset,$inputarr); + } + + /** + * Flush (delete) any cached recordsets for the SQL statement $sql in $ADODB_CACHE_DIR + * + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @returntrue if connected to database + */ + public function flushCache($sql=false) + { + return @$this->conn->CacheFlush($sql); + } + + /** + * Prepares (compiles) an SQL query for repeated execution. Bind parameters are denoted by ? + * except for the oci8 driver, which uses the traditional Oracle :varname convention. + * + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @returntrue if connected to database + */ + public function getPrepare($sql) + { + return @$this->conn->Prepare($sql); + } + + /** + * hen calling stored procedures in mssql and oci8 (oracle), and you might want to directly bind to parameters + * except for the oci8 driver, which uses the traditional Oracle :varname convention. + * + * @param $cursor Oracle REF cursor variable as a regular ADOdb recordset + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @returntrue if connected to database + */ + public function getPrepareSP($sql, $cursor=false) + { + return @$this->conn->Prepare($sql); + } + + /** + * Binds a PHP variable as input to a stored procedure variable. + * + * @param $stmt is the value returned by PrepareSP() + * @param $var is the PHP variable you want to bind + * @param $name is the name of the stored + * @param $maxLen the maximum length of the data to bind + * @param $type which is database dependant + * @returntrue if connected to database + */ + public function setInParameter($stmt, $var, $name, $maxLen = 4000, $type = false ) + { + return @$this->conn->InParameter($stmt, $var, $name, $maxLen, $type); + } + + /** + * Binds a PHP variable as output from a stored procedure variable. + * + * @param $stmt is the value returned by PrepareSP() + * @param $var is the PHP variable you want to bind + * @param $name is the name of the stored + * @param $maxLen the maximum length of the data to bind + * @param $type which is database dependant + * @returntrue if connected to database + */ + public function setOutParameter($stmt, $var, $name, $maxLen = 4000, $type = false ) + { + return @$this->conn->OutParameter($stmt, $var, $name, $maxLen, $type); + } + + /** + * Binds a PHP variable as output from a stored procedure variable. + * + * @param $stmt is the value returned by PrepareSP() + * @param $var is the PHP variable you want to bind + * @param $name is the name of the stored + * @param $isOutput Indicates direction of parameter 0/false=IN 1=OUT 2= IN/OUT + * @param $maxLen the maximum length of the data to bind + * @param $type which is database dependant + * @returntrue if connected to database + */ + public function setParameter($stmt, $var, $name, $isOutput=false, $maxLen = 4000, $type = false ) + { + trigger_error('ADODB: This public function is deprecated. Use InParameter( ) and OutParameter( ) instead. - Function: '.__FUNC__.'; Class='.__CLASS__); + return @$this->conn->Parameter($stmt, $var, $name, $isOutput, $maxLen, $types); + } + + /** + * Generates a bind placeholder portably. + * For most databases, the bind placeholder is "?" + * + * @param $name string to be encoded as parameter binding + * @return string portably define an SQL statement with bind parameters + */ + public function setParam($name) + { + return @$this->conn->Param($name); + } + + /** + * Executes the SQL and returns the first field of the first row + * + * @param $sql parameter SQL statement and return derived class of ADORecordSet if successful + * @return string the first field of the first rowe + */ + public function getOne($sql) + { + return @$this->conn->GetOne($sql); + } + + /** + * Returns an associative array for the given query $sql with optional bind parameters in $inputarr + * + * @param $sql query + * @param $inputarr optional bind parameters + * @param $force_array is set to true, when an array is created for each value + * @param $first2cols Indicates direction of parameter + * @return array an associative array for the given query + */ + public function getAssoc($sql,$inputarr=false,$force_array=false,$first2cols=false) + { + return @$this->conn->GetAssoc($sql,$inputarr,$force_array,$first2cols); + } + + /** + * Caching version of GetAssoc public function above + * + * @param $secs2cache the recordset is cached for $secs2cache seconds + * @param $sql query + * @param $inputarr optional bind parameters + * @param $force_array is set to true, when an array is created for each value + * @param $first2cols Indicates direction of parameter + * @return array an associative array for the given query + */ + public function getCacheAssoc($secs2cache,$sql,$inputarr=false,$force_array=false,$first2cols=false) + { + return @$this->conn->GetAssoc($sql,$inputarr,$force_array,$first2cols); + } + + + /** + * Returns the median value of $field for $table + * + * @param $table table name to get median from + * @param $field field in table to get median from + * @param $where The $where clause is optional. If used, make sure the WHERE is included, as in "WHERE name > 'A'" + * @return string the median value of $field for $table + */ + public function getMedian($table, $field, $where='') + { + return @$this->conn->GetMedian($table, $field, $where); + } + + /** + * Executes the SQL and returns the first row as an array + * + * @param $sql query + * @return array First row as an array + */ + public function getRow($sql) + { + return @$this->conn->GetRow($sql); + } + + /** + * Executes the SQL and returns the first row as an array, <br /> + * except that the recordset is serialized and cached + * + * @param integer $secs2cache number of seconds to cache for + * @param string $sql query + * @return array First row as an array + */ + public function getCacheRow($secs2cache, $sql) + { + return @$this->conn->CacheGetRow($secs2cache, $sql); + } + + /** + * Executes the SQL and returns the all the rows as a 2-dimensional array + * The recordset is discarded for you automatically + * + * @param string $sql query + * @param array $inputarr parameters to bind to sql query + * @return array he all the rows as a 2-dimensional array + */ + public function getAll($sql,$inputarr=false) + { + return @$this->conn->GetAll($sql,$inputarr); // will use auto_increment + } + + /** + * Executes the SQL and returns the all the rows as a 2-dimensional array + * Similar to above GetAll public functions, except that the recordset is serialized and cached + * + * @param array $secs2cache seconds to cache query + * @param string $sql query + * @returntrue if connected to database + */ + public function getCacheAll($secs2cache, $sql) + { + return @$this->conn->CacheGetAll($secs2cache, $sql); + } + + /** + * Executes the SQL and returns all elements of the first column as a 1-dimensional array + * + * @param string $sql query + * @return array all elements of the first column as a 1-dimensional array + */ + public function fetchGetCol($sql) + { + return @$this->conn->GetCol($sql); + } + + /** + * Executes the SQL and returns all elements of the first column as a 1-dimensional array + * Similar to above GetCol public functions, except that the recordset is serialized and cached + * + * @param array $secs2cache seconds to cache query + * @param string $sql query + * @return array all elements of the first column as a 1-dimensional array + */ + public function fetchCacheGetCol($secs2cache, $sql) + { + return @$this->conn->CacheGetCol($secs2cache, $sql); + } + + /** + * Try to update a record, and if the record is not found, an insert statement is generated and executed + * + * @param string $table which is the table name + * @param array $arrFields which is an associative array where the keys are the field names + * @param array $keyCols is the name of the primary key, or an array of field names if it is a compound key + * @param boolean $autoQuote will quote all values that are non-numeric; auto-quoting will not quote nullss + * @return integer Try to update a record, and if the record is not found, an insert statement is generated and executed + */ + public function setReplace($table, $arrFields, $keyCols,$autoQuote=false) + { + return @$this->conn->Replace($table, $arrFields, $keyCols,$autoQuote); + } + + /** + * AutoExecute() inserts or updates $table given an array of $arrField. + * + * @param string $table which is the table name. + * @param array $arrFields which is an associative array where the keys are the field names. + * @param array $mode is enumerator either DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE. + * @param string $where clause is required if $mode == 'UPDATE'. + * @param boolean $forceUpdate false then we will query the database first and check if the field value returned by <br /> + the query matches the current field value. + * @param boolean $magicq is used to indicate whether magic quotes are enabled + * @returntrue if connected to database + */ + public function setAutoExecute($table, $arrFields, $mode, $where=false, $forceUpdate=true,$magicq=false) + { + return @$this->conn->AutoExecute($table, $arrFields, $mode, $where, $forceUpdate,$magicq); + } + + /** + * Generate SQL to update a table given a recordset $rs, and the modified fields of the array $arrFields + * (which must be an associative array holding the column names and the new values).s + * + * @param object $rs ADORecordset Object + * @param array $arrFields modified fields of the array. + * @param boolean $forceUpdate is true, then we also generate the SQL even if $arrFields is identical to $rs->fields. + * @param boolean $magicq is used to indicate whether magic quotes are enabled. + * @param boolean $forcenulls is used to indicate whether NULLS are forced with the update. + * @return string Update SQL Query/Question + */ + public function getUpdateSQL(&$rs, $arrFields, $forceUpdate=false,$magicq=false,$forcenulls=false) + { + return @$this->conn->GetUpdateSQL($rs, $arrFields, $forceUpdate,$magicq,$forcenulls); + } + + /** + * Generate SQL to insert into a table given a recordset $rs. Requires the query to be associative. + * + * @param object $rs ADORecordset Object + * @param array $arrFields modified fields of the array. + * @param boolean $magicq is used to indicate whether magic quotes are enabled. + * @param boolean $forcenulls is used to indicate whether NULLS are forced with the update. + * @return string Update SQL Query/Question + */ + public function getInsertSQL(&$rs, $arrFields,$magicq=false,$forcenulls=false) + { + return @$this->conn->GetInsertSQL($rs, $arrFields, $magicq,$forcenulls); + } + + /** + * Allows you to store a blob (in $val) into $table into $column in a row at $where + * + * @param string $table Table in database for blob + * @param string $column Column in table in database for blob. + * @param string $val Value to set blob. + * @param string $where SQL Where clause include ie. WHERE 1=1. + * @return boolean true if successful, false otherwise + */ + public function setUpdateBlob($table, $column, $val, $where) + { + return @$this->conn->UpdateBlob($table, $column, $val, $where); + } + + /** + * Allows you to store a clob (in $val) into $table into $column in a row at $where. + * Similar to UpdateBlob (see above), but for Character Large OBjects + * + * @param string $table Table in database for blob + * @param string $column Column in table in database for blob. + * @param string $val Value to set blob. + * @param string $where SQL Where clause include ie. WHERE 1=1. + * @return boolean true if successful, false otherwise + */ + public function setUpdateClob($table,$column,$val,$where) + { + return @$this->conn->UpdateClob($table,$column,$val,$where); + } + + /** + * Allows you to store a blob (in $val) into $table into $column in a row at $where + * Similar to UpdateBlob, except that we pass in a file path to where the blob resides. + * + * @param string $table Table in database for blob + * @param string $column Column in table in database for blob. + * @param string $path Real Path of the Blob to be put in the database. + * @param string $where SQL Where clause include ie. WHERE 1=1. + * @param enum $blobtype Type field for blob default ie. BLOB. + * @return boolean true if successful, false otherwise + */ + public function setUpdateBlobFile($table,$column,$path,$where,$blobtype='BLOB') + { + return @$this->conn->UpdateBlobFile($table,$column,$path,$where,$blobtype); + } + + + /** + * Some databases require blob's to be encoded manually before uploading + * + * @param string $blob data to be encoded. + * @return string the encoded blob value + */ + public function getBlobEncode($blob) + { + return @$this->conn->BlobEncode($blob); + } + + /** + * Some databases require blob's to be decoded manually after doing a select statement + * + * @param string $blob data to be encoded. + * @param integer $maxblobsize The default maxblobsize is set in $connection->maxblobsize, which is set to 256K. + * @return string the decoded blob value + */ + public function getBlobDecode($blob, $maxblobsize=false) + { + return @$this->conn->BlobDecode($blob,$maxblobsize); + } + + /** + * Used for pagination of recordset. $page is 1-based + * + * @param string $sql data to be encoded. + * @param integer $nrows Number of rows per page + * @param integer $page Page Number on. + * @param array $inputarr Variable to bind to the SQL statement (optional) + * @return string the decoded blob value + */ + public function fetchPageExecute($sql, $nrows, $page, $inputarr=false) + { + return @$this->conn->PageExecute($sql, $nrows, $page, $inputarr); + } + + /** + * Used for pagination of recordset. $page is 1-based + * Caching version of PageExecute + * + * @param integer $secs2cache Seconds to hold in cache + * @param string $sql data to be encoded. + * @param integer $nrows Number of rows per page + * @param integer $page Page Number on. + * @param array $inputarr Variable to bind to the SQL statement (optional) + * @return string the decoded blob value + */ + public function fetchCachePageExecute($secs2cache, $sql, $nrows, $page, $inputarr=false) + { + return @$this->conn->CachePageExecute($secs2cache, $sql, $nrows, $page, $inputarr); + } + + /** + * Start a monitored transaction. As SQL statements are executed, ADOdb will monitor for SQL errors, + * and if any are detected, when CompleteTrans() is called, we auto-rollback. + * + * @return boolean true if successful. + */ + public function setStartTrans() + { + return @$this->conn->StartTrans(); + } + + /** + * Start a monitored transaction. As SQL statements are executed, ADOdb will monitor for SQL errors, + * and if any are detected, when CompleteTrans() is called, we auto-rollback. + * + * @return boolean true if successful. + */ + public function setBeginTrans() + { + return @$this->conn->BeginTrans(); + } + + + /** + * Complete a transaction called with StartTrans() + * This public function monitors for SQL errors, and will commit if no errors have occured, otherwise it will rollback. + * + * @param boolean $autoComplete is true monitor sql errors and commit and rollback as appropriate + * @return boolean true on commit, false on rollback + */ + public function setCompleteTrans($autoComplete=true) + { + return @$this->conn->CompleteTrans($autoComplete); + } + + /** + * Fail a transaction started with StartTrans(). The rollback will only occur when CompleteTrans() is called + * + * @return boolean true + */ + public function isFailTrans() + { + return @$this->conn->FailTrans(); + } + + /** + * Check whether smart transaction has failed, eg. returns true if SQL execution failed, or FailTrans() was called. + * + * @return boolean true + */ + public function hasFailedTrans() + { + return @$this->conn->HasFailedTrans(); + } + + /** + * SetTransactionMode allows you to pass in the transaction mode to use for all subsequent transactions for that connection session + * + * @param enum $mode Supported values: READ UNCOMMITTED; READ COMMITTED; REPEATABLE READ; SERIALIZABLE; (oci8) SNAPSHOT; READ ONLY. + * @return string the decoded blob value + */ + public function setTransactionMode($mode ) + { + return @$this->conn->SetTransactionMode($mode); + } + + /** + * End a transaction successfully + * + * @param boolean $ok you pass the parameter false, the data is rolled back. . + * @return boolean will return true also as data is always committed. + */ + public function setCommitTrans($ok=true) + { + return @$this->conn->CommitTrans($ok); + } + + /** + * End a transaction, rollback all changes + * + * @param boolean $ok you pass the parameter false, the data is rolled back. . + * @return boolean true if successful. If the database does not support transactions, will return false as data is never rollbacked. + */ + public function setRollbackTrans($ok=true) + { + return @$this->conn->RollbackTrans($ok); + } + + /** + * Sets the current fetch mode for the connection and stores. + * + * @param enum $mode Legal modes are ADODB_FETCH_ASSOC and ADODB_FETCH_NUM. + * @return string the decoded blob value + */ + public function setFetchMode($mode) + { + return @$this->conn->SetFetchMode($mode); + } + + /** + * Generates the sql string used to concatenate $sa, $sb, etc together + * + * @param string $sa string to concatinate. (required) + * @param string $sb string to concatinate. (required) + * @param string $sc string to concatinate. (optional) + * @param string $sd string to concatinate. (optional) + * @param string $se string to concatinate. (optional) + * @param string $sf string to concatinate. (optional) + * @param string $sg string to concatinate. (optional) + * @param string $sh string to concatinate. (optional) + * @param string $si string to concatinate. (optional) + * @param string $sj string to concatinate. (optional) + * @param string $sk string to concatinate. (optional) + * @param string $sl string to concatinate. (optional) + * @param string $sm string to concatinate. (optional) + * @param string $sn string to concatinate. (optional) + * @param string $so string to concatinate. (optional) + * @param string $sp string to concatinate. (optional) + * @param string $sq string to concatinate. (optional) + * @param string $sr string to concatinate. (optional) + * @param string $ss string to concatinate. (optional) + * @param string $st string to concatinate. (optional) + * @param string $su string to concatinate. (optional) + * @param string $sv string to concatinate. (optional) + * @param string $sw string to concatinate. (optional) + * @param string $sx string to concatinate. (optional) + * @param string $sy string to concatinate. (optional) + * @param string $sz string to concatinate. (optional) + * @return string the concatenated string + */ + public function getConcat($sa, $sb, $sc, $sd, $se, $sf, $sg, $sh, $si, $sj, $sk, $sl, $sm, $sn, $so, $sp, $sq, $sr, $ss, $st, $su, $sv, $sw, $sx, $sy, $sz) + { + return @$this->conn->Concat($sa, $sb, $sc, $sd, $se, $sf, $sg, $sh, $si, $sj, $sk, $sl, $sm, $sn, $so, $sp, $sq, $sr, $ss, $st, $su, $sv, $sw, $sx, $sy, $sz); + } + + /** + * Portable IFNULL public function (NVL in Oracle). + * + * Example + * $sql = 'SELECT '.$GLOBALS['xoopsDB']->conn->IfNull('name', "'- unknown -'"). ' FROM table'; + * $rs = $GLOBALS['xoopsDB']->conn->Execute($sql); + * + * @param string $field data to be encoded. + * @param string $nullReplacementValue Replace NULL with this value. + * @return string a string that represents the public function that checks whether a $field is null for the given database, and if null, change the value returned to $nullReplacementValue. + */ + public function setIfNull($field, $nullReplacementValue) + { + return @$this->conn->IfNull($field, $nullReplacementValue); + } + + /** + * This is not a public function, but a property + * Some databases have "length" and others "len" as the public function to measure the length of a string + * + * Example + * $sql = "SELECT ".$GLOBALS['xoopsDB']->conn->length()."(field) from table + * $rs = $GLOBALS['xoopsDB']->conn->Execute($sql); + * + * @return integer public function to measure the length of a string + */ + public function getLength() + { + return @$this->conn->length; + } + + /** + * This is not a public function, but a property. This is a string that holds the sql to generate a random number + * + * @return float between 0.0 and 1.0 inclusive + */ + public function getRandom() + { + return @$this->conn->random; + } + + /** + * This is not a public function, but a property + * Some databases have "substr" and others "substring" as the public function to retrieve a sub-string. + * the 1st parameter of substr is the field, the 2nd is the offset (1-based) to the beginning of + * the sub-string, and the 3rd is the length of the sub-string + * + * Example + * $sql = "SELECT ".$GLOBALS['xoopsDB']->conn->substr."(field, $offset, $length) from table"; + * $rs = $GLOBALS['xoopsDB']->conn->Execute($sql); + * + * @return string parameter for substr for $this->Execute + */ + public function getSubstr() + { + return @$this->conn->substr; + } + + /** + * Format the $date in the format the database accepts. + * + * Example + * $sql = "select * from atable where created > ".$GLOBALS['xoopsDB']->conn->DBDate("$year-$month-$day") + * $rs = $GLOBALS['xoopsDB']->conn->Execute($sql); + * + * @param string $date date string in format of $year-$month-$day + * @return string the date as a quoted string + */ + public function fetchDBDate($date) + { + return @$this->conn->DBDate($date); + } + + /** + * Format the $date in the bind format the database accepts. + * Normally this means that the date string is not quoted, unlike DBDate, which quotes the string. + * + * Example + * $sql = "select * from atable where created > ".$GLOBALS['xoopsDB']->conn->Param('0') + * OR $sql = "select * from atable where created > ?"; + * $rs = $GLOBALS['xoopsDB']->conn->Execute($sql,array($GLOBALS['xoopsDB']->conn->BindDate("$year-$month-$day")); + * + * @param string $date date string in format of $year-$month-$day + * @return string the date as a quoted string + */ + public function fetchBindDate($date) + { + return @$this->conn->BindDate($date); + } + + /** + * Format the timestamp $ts in the format the database accepts; this can be a Unix integer timestamp or an ISO format Y-m-d H:i:s. + * + * Example + * $sql = "select * from atable where created > ".$GLOBALS['xoopsDB']->conn->DBTimeStamp("$year-$month-$day $hr:$min:$secs") + * $rs = $GLOBALS['xoopsDB']->conn->Execute($sql); + * + * @param string/integer $ts time & date in the format the database accepts; this can be a Unix integer timestamp or an ISO format Y-m-d H:i:s. + * @return string the timestamp as a quoted string. + */ + public function fetchDBTimeStamp($ts) + { + return @$this->conn->DBTimeStamp($ts); + } + + + /** + * Format the $date in the bind format the database accepts. + * Normally this means that the date string is not quoted, unlike DBDate, which quotes the string. + * + * Example + * $sql = "select * from atable where created > ".$GLOBALS['xoopsDB']->conn->Param('0') + * OR $sql = "select * from atable where created > ?"; + * $rs = $GLOBALS['xoopsDB']->conn->Execute($sql,array($GLOBALS['xoopsDB']->conn->BindTimeStamp("$year-$month-$day $hr:$min:$secs")); + * + * @param string/integer $ts time & date in the format the database accepts; this can be a Unix integer timestamp or an ISO format Y-m-d H:i:s. + * @return string the date as a quoted string + */ + public function fetchBindTimeStamp($ts) + { + return @$this->conn->BindTimeStamp($ts); + } + + + + /** + * Parses the date string $str and returns it in unix mktime format + * Expects the date to be in Y-m-d H:i:s format, except for Sybase and Microsoft SQL Server, + * where M d Y is also accepted + * + * @param string $str the date string. + * @return intger UNIX Time Stamp + */ + public function fetchUnixDate($str) + { + return @$this->conn->UnixDate($str); + } + + /** + * Parses the timestamp string $str and returns it in unix mktime format + * + * @param string $str the date string - Expects the date to to be in "Y-m-d, H:i:s" (1970-12-24, 00:00:00) <br /> + * or "Y-m-d H:i:s" (1970-12-24 00:00:00) + * or "YmdHis" (19701225000000) format, + * except for Sybase and Microsoft SQL Server, + * where "M d Y h:i:sA" (Dec 25 1970 00:00:00AM) + * @return intger UNIX Time Stamp + */ + public function fetchUnixTimeStamp($str) + { + return @$this->conn->UnixTimeStamp($str); + } + + /** + * Allows you to calculate future and past dates based on $basedate in a portable fashion. + * + * Example; + * # get date one week from now + * $fld = $GLOBALS['xoopsDB']->conn->OffsetDate(7); // returns "(trunc(sysdate)+7") + * + * # get date and time that is 60 hours from current date and time + * $fld = $GLOBALS['xo... [truncated message content] |
From: <wis...@us...> - 2012-04-29 15:27:45
|
Revision: 9399 http://xoops.svn.sourceforge.net/xoops/?rev=9399&view=rev Author: wishcraft Date: 2012-04-29 15:27:36 +0000 (Sun, 29 Apr 2012) Log Message: ----------- Sitemap SEO Solution for XOOPS 2.6.0 Alpha - Needs Module Coupling - All Tested and Working!! Added Paths: ----------- XoopsCore/branches/tasks/2.6.0-wishcraft/kernel/module.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/templates/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/templates/system_sitemap.html XoopsCore/branches/tasks/2.6.0-wishcraft/sitemap.php Added: XoopsCore/branches/tasks/2.6.0-wishcraft/kernel/module.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/kernel/module.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/kernel/module.php 2012-04-29 15:27:36 UTC (rev 9399) @@ -0,0 +1,720 @@ +<?php +/** + * XOOPS Kernel Class + * + * 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. + * + * @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 kernel + * @since 2.0.0 + * @version $Id: module.php 8782 2012-01-22 20:14:47Z forxoops $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * A Module + * + * @package kernel + * @author Kazumi Ono <on...@xo...> + */ +class XoopsModule extends XoopsObject +{ + /** + * @var string + */ + public $modinfo; + + /** + * + * @var array + */ + public $adminmenu; + /** + * + * @var array + */ + private $_msg = array(); + + /** + * Constructor + */ + public function __construct() + { + $this->initVar('mid', XOBJ_DTYPE_INT, null, false); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150); + $this->initVar('version', XOBJ_DTYPE_INT, 100, false); + $this->initVar('last_update', XOBJ_DTYPE_INT, null, false); + $this->initVar('weight', XOBJ_DTYPE_INT, 0, false); + $this->initVar('isactive', XOBJ_DTYPE_INT, 1, false); + $this->initVar('dirname', XOBJ_DTYPE_OTHER, null, true); + $this->initVar('hasmain', XOBJ_DTYPE_INT, 0, false); + $this->initVar('hasadmin', XOBJ_DTYPE_INT, 0, false); + $this->initVar('hassearch', XOBJ_DTYPE_INT, 0, false); + $this->initVar('hasconfig', XOBJ_DTYPE_INT, 0, false); + $this->initVar('hascomments', XOBJ_DTYPE_INT, 0, false); + // RMV-NOTIFY + $this->initVar('hasnotification', XOBJ_DTYPE_INT, 0, false); + } + + /** + * Load module info + * + * @param string $dirname Directory Name + * @param boolean $verbose + */ + public function loadInfoAsVar($dirname, $verbose = true) + { + $dirname = basename($dirname); + if (!isset($this->modinfo)) { + $this->loadInfo($dirname, $verbose); + } + $this->setVar('name', $this->modinfo['name'], true); + $this->setVar('version', intval(100 * ($this->modinfo['version'] + 0.001)), true); + $this->setVar('dirname', $this->modinfo['dirname'], true); + $hasmain = (isset($this->modinfo['hasMain']) && $this->modinfo['hasMain'] == 1) ? 1 : 0; + $hasadmin = (isset($this->modinfo['hasAdmin']) && $this->modinfo['hasAdmin'] == 1) ? 1 : 0; + $hassearch = (isset($this->modinfo['hasSearch']) && $this->modinfo['hasSearch'] == 1) ? 1 : 0; + $hasconfig = ((isset($this->modinfo['config']) && is_array($this->modinfo['config'])) || ! empty($this->modinfo['hasComments'])) ? 1 : 0; + $hascomments = (isset($this->modinfo['hasComments']) && $this->modinfo['hasComments'] == 1) ? 1 : 0; + // RMV-NOTIFY + $hasnotification = (isset($this->modinfo['hasNotification']) && $this->modinfo['hasNotification'] == 1) ? 1 : 0; + $this->setVar('hasmain', $hasmain); + $this->setVar('hasadmin', $hasadmin); + $this->setVar('hassearch', $hassearch); + $this->setVar('hasconfig', $hasconfig); + $this->setVar('hascomments', $hascomments); + // RMV-NOTIFY + $this->setVar('hasnotification', $hasnotification); + } + + /** + * add a message + * + * @param string $str message to add + * @access public + */ + public function setMessage($str) + { + $this->_msg[] = trim($str); + } + + /** + * return the messages for this object as an array + * + * @return array an array of messages + * @access public + */ + public function getMessages() + { + return $this->_msg; + } + + /** + * Set module info + * + * @param string $name + * @param mix $value + * @return bool + **/ + public function setInfo($name, $value) + { + if (empty($name)) { + $this->modinfo = $value; + } else { + $this->modinfo[$name] = $value; + } + return true; + } + + /** + * Get module info + * + * @param string $name + * @return array |string Array of module information. + * If {@link $name} is set, returns a single module information item as string. + */ + public function getInfo($name = null) + { + if (!isset($this->modinfo)) { + $this->loadInfo($this->getVar('dirname')); + } + if (isset($name)) { + if (isset($this->modinfo[$name])) { + return $this->modinfo[$name]; + } + $return = false; + return $return; + } + return $this->modinfo; + } + + /** + * Get a link to the modules main page + * + * @return string FALSE on fail + */ + public function mainLink() + { + if ($this->getVar('hasmain') == 1) { + $ret = '<a href="' . XOOPS_URL . '/modules/' . $this->getVar('dirname') . '/">' . $this->getVar('name') . '</a>'; + return $ret; + } + return false; + } + + /** + * Get links to the subpages + * + * @return string + */ + public function subLink() + { + $ret = array(); + if ($this->getInfo('sub') && is_array($this->getInfo('sub'))) { + foreach ($this->getInfo('sub') as $submenu) { + $ret[] = array( + 'name' => $submenu['name'] , + 'url' => $submenu['url']); + } + } + return $ret; + } + + /** + * Load the admin menu for the module + */ + public function loadAdminMenu() + { + if ($this->getInfo('adminmenu') && $this->getInfo('adminmenu') != '' && file_exists(XOOPS_ROOT_PATH . '/modules/' . $this->getInfo('dirname') . '/' . $this->getInfo('adminmenu'))) { + $adminmenu = array(); + include XOOPS_ROOT_PATH . '/modules/' . $this->getInfo('dirname') . '/' . $this->getInfo('adminmenu'); + $this->adminmenu = $adminmenu; + } + } + + /** + * Get the admin menu for the module + * + * @return string + */ + public function getAdminMenu() + { + if (!isset($this->adminmenu)) { + $this->loadAdminMenu(); + } + return $this->adminmenu; + } + + /** + * Load the module info for this module + * + * @param string $dirname Module directory + * @param bool $verbose Give an error on fail? + * @return bool + */ + public function loadInfo($dirname, $verbose = true) + { + global $xoopsConfig; //for legacy + $xoops = xoops::getInstance(); + $dirname = basename($dirname); + if (file_exists($file = $xoops->path('modules/' . $dirname . '/language/' . $xoops->getConfig('language') . '/modinfo.php'))) { + include_once $file; + } else if (file_exists($file = $xoops->path('modules/' . $dirname . '/language/english/modinfo.php'))) { + include_once $file; + } + + if (!file_exists($file = $xoops->path('modules/' . $dirname . '/xoops_version.php'))) { + if (false != $verbose) { + echo "Module File for $dirname Not Found!"; + } + return false; + } + include $file; + $this->modinfo = $modversion; + return true; + } + + /** + * Search contents within a module + * + * @param string $term + * @param string $andor 'AND' or 'OR' + * @param integer $limit + * @param integer $offset + * @param integer $userid + * @return mixed Search result. + */ + public function search($term = '', $andor = 'AND', $limit = 0, $offset = 0, $userid = 0) + { + $xoops = xoops::getInstance(); + if ($this->getVar('hassearch') != 1) { + return false; + } + $search = $this->getInfo('search'); + if ($this->getVar('hassearch') != 1 || ! isset($search['file']) || ! isset($search['func']) || $search['func'] == '' || $search['file'] == '') { + return false; + } + if (file_exists($file = $xoops->path('modules/' . $this->getVar('dirname') . '/' . $search['file']))) { + include_once $file; + } else { + return false; + } + if (function_exists($search['func'])) { + $func = (string)$search['func']; + return $func($term, $andor, $limit, $offset, $userid); + } + return false; + } + + /** + * @param string $format + * @return mixed + */ + public function id($format = 'n') + { + return $this->getVar('mid', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function mid($format = '') + { + return $this->getVar('mid', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function name($format = '') + { + return $this->getVar('name', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function version($format = '') + { + return $this->getVar('version', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function last_update($format = '') + { + return $this->getVar('last_update', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function weight($format = '') + { + return $this->getVar('weight', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function isactive($format = '') + { + return $this->getVar('isactive', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function dirname($format = '') + { + return $this->getVar('dirname', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function hasmain($format = '') + { + return $this->getVar('hasmain', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function hasadmin($format = '') + { + return $this->getVar('hasadmin', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function hassearch($format = '') + { + return $this->getVar('hassearch', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function hasconfig($format = '') + { + return $this->getVar('hasconfig', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function hascomments($format = '') + { + return $this->getVar('hascomments', $format); + } + + /** + * @param string $format + * @return mixed + */ + public function hasnotification($format = '') + { + return $this->getVar('hasnotification', $format); + } + + /** + * @param $dirname + * @return XoopsModule + */ + public function getByDirName($dirname) + { + return Xoops::getInstance()->getHandlerModule()->getByDirname($dirname); + } + + /** + * Sitemap contents within a module + * + * @param integer $limit + * @return mixed Sitemap result. + */ + public function getSitemap($limit = 4000) + { + if (!empty($this->getInfo('sitemap'))&&is_array($sitemap = $this->getInfo('sitemap'))) { + $xoops = xoops::getInstance(); + if (file_exists($file = $xoops->path('modules/' . $this->getVar('dirname') . '/' . $sitemap['file']))) { + include_once $file; + } else { + return false; + } + if (function_exists($sitemap['func'])) { + $func = (string)$sitemap['func']; + return $func($limit); + } + } + return false; + } +} + +/** + * XOOPS module handler class. + * + * This class is responsible for providing data access mechanisms to the data source + * of XOOPS module class objects. + * + * @package kernel + * @author Kazumi Ono <on...@xo...> + * @copyright (c) 2000-2003 The Xoops Project - www.xoops.org + */ +class XoopsModuleHandler extends XoopsPersistableObjectHandler +{ + /** + * holds an array of cached module references, indexed by module id + * + * @var array + * @access private + */ + private $_cachedModule_mid = array(); + + /** + * holds an array of cached module references, indexed by module dirname + * + * @var array + * @access private + */ + private $_cachedModule_dirname = array(); + + /** + * Constructor + * + * @param XoopsDatabase|null $db {@link XoopsDatabase} + */ + public function __construct(XoopsDatabase $db = null) + { + parent::__construct($db, 'modules', 'XoopsModule', 'mid', 'dirname'); + } + + /** + * Load a module from the database + * + * @param int $id ID of the module + * @return XoopsModule|bool on fail + */ + function getById($id = null) + { + static $_cachedModule_dirname; + static $_cachedModule_mid; + $id = intval($id); + if ($id > 0) { + if (!empty($_cachedModule_mid[$id])) { + return $_cachedModule_mid[$id]; + } else { + $module = parent::get($id); + if (!is_object($module)) { + return false; + } + $_cachedModule_mid[$id] = $module; + $_cachedModule_dirname[$module->getVar('dirname')] = $module; + return $module; + } + } + return false; + } + + /** + * Load a module by its dirname + * + * @param string $dirname + * @return XoopsModule|bool FALSE on fail + */ + public function getByDirname($dirname) + { + $dirname = basename(trim($dirname)); + static $_cachedModule_mid; + static $_cachedModule_dirname; + if (!empty($_cachedModule_dirname[$dirname])) { + return $_cachedModule_dirname[$dirname]; + } else { + $myts = MyTextSanitizer::getInstance(); + $criteria = new Criteria('dirname', $myts->addSlashes($dirname)); + $modules = $this->getObjectsArray($criteria); + if (count($modules) == 1 && is_object($modules[0])) { + $module = $modules[0]; + } else { + return false; + } + /* @var $module XoopsModule */ + $_cachedModule_dirname[$dirname] = $module; + $_cachedModule_mid[$module->getVar('mid')] = $module; + return $module; + } + } + + /** + * Write a module to the database + * + * @param XoopsModule $module reference to a {@link XoopsModule} + * + * @return bool + */ + public function insertModule(XoopsModule &$module) + { + if (!parent::insert($module)) { + return false; + } + + $dirname = $module->getvar('dirname'); + $mid = $module->getvar('mid'); + + if (!empty($this->_cachedModule_dirname[$dirname])) { + unset($this->_cachedModule_dirname[$dirname]); + } + if (!empty($this->_cachedModule_mid[$mid])) { + unset($this->_cachedModule_mid[$mid]); + } + return true; + } + + /** + * Delete a module from the database + * + * @param XoopsModule &$module + * @return bool + */ + public function deleteModule(XoopsModule &$module) + { + if (!parent::delete($module)) { + return false; + } + + // delete admin permissions assigned for this module + $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'module_admin' AND gperm_itemid = %u", $this->db->prefix('group_permission'), $module->getVar('mid')); + $this->db->query($sql); + // delete read permissions assigned for this module + $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'module_read' AND gperm_itemid = %u", $this->db->prefix('group_permission'), $module->getVar('mid')); + $this->db->query($sql); + + $sql = sprintf("SELECT block_id FROM %s WHERE module_id = %u", $this->db->prefix('block_module_link'), $module->getVar('mid')); + if ($result = $this->db->query($sql)) { + $block_id_arr = array(); + while ($myrow = $this->db->fetchArray($result)) { + array_push($block_id_arr, $myrow['block_id']); + } + } + // loop through block_id_arr + if (isset($block_id_arr)) { + foreach ($block_id_arr as $i) { + $sql = sprintf("SELECT block_id FROM %s WHERE module_id != %u AND block_id = %u", $this->db->prefix('block_module_link'), $module->getVar('mid'), $i); + if ($result2 = $this->db->query($sql)) { + if (0 < $this->db->getRowsNum($result2)) { + // this block has other entries, so delete the entry for this module + $sql = sprintf("DELETE FROM %s WHERE (module_id = %u) AND (block_id = %u)", $this->db->prefix('block_module_link'), $module->getVar('mid'), $i); + $this->db->query($sql); + } else { + // this block doesnt have other entries, so disable the block and let it show on top page only. otherwise, this block will not display anymore on block admin page! + $sql = sprintf("UPDATE %s SET visible = 0 WHERE bid = %u", $this->db->prefix('newblocks'), $i); + $this->db->query($sql); + $sql = sprintf("UPDATE %s SET module_id = -1 WHERE module_id = %u", $this->db->prefix('block_module_link'), $module->getVar('mid')); + $this->db->query($sql); + } + } + } + } + + if (!empty($this->_cachedModule_dirname[$module->getVar('dirname')])) { + unset($this->_cachedModule_dirname[$module->getVar('dirname')]); + } + if (!empty($this->_cachedModule_mid[$module->getVar('mid')])) { + unset($this->_cachedModule_mid[$module->getVar('mid')]); + } + return true; + } + + /** + * Load some modules + * + * @param CriteriaElement|null $criteria {@link CriteriaElement} + * @param boolean $id_as_key Use the ID as key into the array + * @return array + */ + public function getObjectsArray(CriteriaElement $criteria = null, $id_as_key = false) + { + $ret = array(); + $limit = $start = 0; + $sql = 'SELECT * FROM ' . $this->db->prefix('modules'); + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); + $sql .= ' ORDER BY weight ' . $criteria->getOrder() . ', mid ASC'; + $limit = $criteria->getLimit(); + $start = $criteria->getStart(); + } + $result = $this->db->query($sql, $limit, $start); + if (!$result) { + return $ret; + } + while ($myrow = $this->db->fetchArray($result)) { + $module = new XoopsModule(); + $module->assignVars($myrow); + if (!$id_as_key) { + $ret[] = $module; + } else { + $ret[$myrow['mid']] = $module; + } + unset($module); + } + return $ret; + } + + /** + * returns an array of module names + * + * @param CriteriaElement|null $criteria + * @param boolean $dirname_as_key if true, array keys will be module directory names + * if false, array keys will be module id + * @return array + */ + function getNameList(CriteriaElement $criteria = null, $dirname_as_key = false) + { + $ret = array(); + $modules = $this->getObjectsArray($criteria, true); + foreach (array_keys($modules) as $i) { + if (!$dirname_as_key) { + $ret[$i] = $modules[$i]->getVar('name'); + } else { + $ret[$modules[$i]->getVar('dirname')] = $modules[$i]->getVar('name'); + } + } + return $ret; + } + + /** + * returns an array of sitemap objects based on a criteria + * + * @param CriteriaElement|null $criteria + * @return array of XoopsSitemap Objects + */ + function getSitemap(CriteriaElement $criteria = null) + { + // Sets Head of Sitemap Root of site + $ret = array(); + $ret[] = new XoopsSitemap(); + $ret[sizeof($ret)-1]->setVar('loc', XOOPS_URL); + $ret[sizeof($ret)-1]->setVar('lastmod', time()); + $ret[sizeof($ret)-1]->setVar('changefreq', 'daily'); + $ret[sizeof($ret)-1]->setVar('priority', 'daily'); + + // Retrieves Sitemap from criteria of modules + $modules = $this->getObjectsArray($criteria, true); + foreach (array_keys($modules) as $i) { + foreach($modules[$i]->getSitemap() as $object) { + if (is_a($object, 'XoopsSitemap')) { + $ret[] = $object; + } + } + } + return count($ret)>0?$ret:false; + } + +} + +/** + * A Sitemap Object + * + * @package kernel + * @author Simon Roberts <si...@ch...> + */ +class XoopsSitemap extends XoopsObject +{ + /** + * Constructor + */ + public function __construct() + { + $this->initVar('loc', XOBJ_DTYPE_TXTBOX, null, false, 1000); + $this->initVar('lastmod', XOBJ_DTYPE_INT, time(), false); + $this->initVar('changefreq', XOBJ_DTYPE_ENUM, 'daily', false, false, false, array('daily','weekly','monthly','yearly')); + $this->initVar('priority', XOBJ_DTYPE_ENUM, '1', false, false, false, array('1','0.9','0.8','0.7','0.6','0.5','0.4','0.3','0.2','0.1')); + } + + public function toArray() { + $ret = parent::toArray(); + $ret['lastmod'] = date('Y-m-d', $this->getVar('lastmod')); + return $ret; + } +} \ No newline at end of file Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/templates/system_sitemap.html =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/templates/system_sitemap.html (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/templates/system_sitemap.html 2012-04-29 15:27:36 UTC (rev 9399) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> +<{foreach item=item from=$items}> + <url> + <loc><{$item.loc}></loc> + <lastmod><{$item.lastmod}></lastmod> + <changefreq><{$item.changefreq}></changefreq> + <priority><{$item.priority}></priority> + </url> + +<{/foreach}> +</urlset> \ No newline at end of file Added: XoopsCore/branches/tasks/2.6.0-wishcraft/sitemap.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/sitemap.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/sitemap.php 2012-04-29 15:27:36 UTC (rev 9399) @@ -0,0 +1,48 @@ +<?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. +*/ + +/** + * XOOPS feed creator + * + * @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 core + * @since 2.0.0 + * @version $Id: backend.php 8236 2011-11-08 00:31:09Z trabis $ + */ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mainfile.php'; +$xoops = Xoops::getInstance(); +$xoops->logger->disable(); + +if (function_exists('mb_http_output')) { + mb_http_output('pass'); +} +header('Content-Type:text/xml; charset=utf-8'); + +$tpl = new XoopsTpl(); +$tpl->caching = 2; +$tpl->cache_lifetime = 1800; +if (!$tpl->is_cached('module:system|system_sitemap.html')) { + $module_handler = $xoops->getHandlerModule(); + $sarray = $module_handler->getSitemap(new Criteria('`isactive`', true)); + if (!empty($sarray) && is_array($sarray)) { + foreach ($sarray as $node) { + $tpl->append('items', array( + 'loc' => XoopsLocal::convert_encoding(htmlspecialchars($node->getVar('loc'), ENT_QUOTES)), + 'lastmod' => date('Y-m-d', $node->getVar('lastmod')), + 'changefreq' => $node->getVar('changefreq'), + 'priority' => $node->getVar('priority') + )); + } + } +} +$tpl->display('system_sitemap.html'); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wis...@us...> - 2012-04-29 15:42:01
|
Revision: 9402 http://xoops.svn.sourceforge.net/xoops/?rev=9402&view=rev Author: wishcraft Date: 2012-04-29 15:41:51 +0000 (Sun, 29 Apr 2012) Log Message: ----------- Xortify 3.08 - For XOOPS 2.6.0 - Production and tested - Final release for 2.6.0 Alpha3 Added Paths: ----------- XoopsCore/branches/tasks/2.6.0-wishcraft/banned.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/preloads/xortify.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/menu.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl_provisionning.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curlserialised.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curlserialised_provisionning.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curlxml.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curlxml_provisionning.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_json.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_json_provisionning.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_soap.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_soap_provisionning.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_wgetserialised.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_wgetserialised_provisionning.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_wgetxml.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_wgetxml_provisionning.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/authfactory.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/curl.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/curlserialised.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/curlxml.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/json.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/log.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/soap.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/wgetserialised.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/wgetxml.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/cron/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/cron/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/cron/serverup.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/changelog.txt XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/credits.txt XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/install.txt XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/lang_diff.txt XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/licence.txt XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/docs/readme.txt XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/16/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/16/about.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/16/access.list.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/16/current.bans.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/16/home.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/16/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/16/xortify.log.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/about.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/access.list.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/current.bans.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/home.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/xoopsmicrobutton.gif XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/32/xortify.log.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/icons/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/images/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/images/accessdenied.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/images/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/images/left_both.gif XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/images/right_both.gif XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/images/xortify_slogo.png XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/JSON.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/forms.objects.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/forms.xortify.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/functions.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/install.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/post.header.addmeta.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/post.header.endcache.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/post.loader.mainfile.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/pre.loader.mainfile.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/include/update.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/admin.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/ban.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/help/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/help/help.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/help/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/main.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/english/modinfo.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/language/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/plugin/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/plugin/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/plugin/projecthoneypot.org.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/plugin/protector.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/plugin/spiders.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/plugin/stopforumspam.com.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/plugin/xortify.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/preloads/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/preloads/core.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/preloads/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/projecthoneypot.org/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/projecthoneypot.org/post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/protector/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/protector/footer.post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/protector/header.post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/protector/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/providers.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/spiders/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/spiders/post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/stopforumspam.com/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/stopforumspam.com/post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/xortify/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/xortify/footer.post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/xortify/header.post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/xortify/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/providers/xortify/post.loader.php XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/sql/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/sql/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/sql/mysql.sql XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/admin/ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/admin/xortify_cpanel_bans.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/admin/xortify_cpanel_log.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/admin/xortify_cpanel_signup_form.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/admin/xortify_cpanel_signup_nocommunication.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/index.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/templates/xortify_banning_notice.html XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/xoops_version.php Added: XoopsCore/branches/tasks/2.6.0-wishcraft/banned.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/banned.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/banned.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,52 @@ +<?php + + + include dirname(__FILE__).'/mainfile.php'; + + $GLOBALS['xoops'] = Xoops::getInstance(); + + if (isset($_SESSION['xortify']['lid'])) { + $lid = $_SESSION['xortify']['lid']; + setcookie('xortify', array('lid' => $lid), time()+3600*24*7*4*3); + } elseif (isset($_COOKIE['xortify']['lid'])) { + $lid = $_COOKIE['xortify']['lid']; + $_SESSION['xortify']['lid'] = $lid; + } + + $GLOBALS['xoops']->loadLanguage('ban', 'xortify'); + + $module_handler = $GLOBALS['xoops']->getHandler('module'); + $GLOBALS['xortifyModule'] = $module_handler->getByDirname('xortify'); + + $GLOBALS['xoops']->header('xortify|xortify_banning_notice.html'); + + include_once XOOPS_ROOT_PATH.'/modules/xortify/include/functions.php'; + addmeta_googleanalytics(_XOR_MI_XOOPS_GOOGLE_ANALYTICS_ACCOUNTID_FAILEDTOPASS, $_SERVER['HTTP_HOST']); + if (defined('_XOR_MI_CLIENT_GOOGLE_ANALYTICS_ACCOUNTID_FAILEDTOPASS')&&strlen(constant('_XOR_MI_CLIENT_GOOGLE_ANALYTICS_ACCOUNTID_FAILEDTOPASS'))>=13) { + addmeta_googleanalytics(_XOR_MI_CLIENT_GOOGLE_ANALYTICS_ACCOUNTID_FAILEDTOPASS, $_SERVER['HTTP_HOST']); + } + $GLOBALS['xoops']->tpl->assign('xoops_pagetitle', _XOR_PAGETITLE); + $GLOBALS['xoops']->tpl->assign('description', _XOR_DESCRIPTION); + $GLOBALS['xoops']->tpl->assign('version', $GLOBALS['xortifyModule']->getVar('version')/100); + $GLOBALS['xoops']->tpl->assign('platform', XOOPS_VERSION); + + $log_handler = $GLOBALS['xoops']->getModuleHandler('log', 'xortify'); + $log = $log_handler->get($lid); + if (is_object($log)) { + setcookie('xortify', array('lid' => $lid), time()+3600*24*7*4*3); + $GLOBALS['xoops']->tpl->assign('status', $log->getVar('extra')); + $GLOBALS['xoops']->tpl->assign('provider', $log->getVar('provider')); + $GLOBALS['xoops']->tpl->assign('agent', $log->getVar('agent')); + } + $GLOBALS['xoops']->tpl->assign('xoops_lblocks', false); + $GLOBALS['xoops']->tpl->assign('xoops_rblocks', false); + $GLOBALS['xoops']->tpl->assign('xoops_ccblocks', false); + $GLOBALS['xoops']->tpl->assign('xoops_clblocks', false); + $GLOBALS['xoops']->tpl->assign('xoops_crblocks', false); + $GLOBALS['xoops']->tpl->assign('xoops_showlblock', false); + $GLOBALS['xoops']->tpl->assign('xoops_showrblock', false); + $GLOBALS['xoops']->tpl->assign('xoops_showcblock', false); + + $GLOBALS['xoops']->footer(); + +?> Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/preloads/xortify.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/preloads/xortify.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/system/preloads/xortify.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,55 @@ +<?php +/** + * @package xortify + * @subpackage module + * @description Sector Nexoork Security Drone + * @author Simon Roberts WISHCRAFT <si...@ch...> + * @author Richardo Costa TRABIS + * @copyright copyright (c) 2010-2013 XOOPS.org + * @licence GPL 2.0 - see docs/LICENCE.txt + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class SystemXortifyPreload extends XoopsPreloadItem +{ + + static function init() { + $xoops = Xoops::getInstance(); + $module_handler = $xoops->getHandler('module'); + $config_handler = $xoops->getHandler('config'); + $GLOBALS['xortifyModule'] = $module_handler->getByDirname('xortify'); + if (is_object($GLOBALS['xortifyModule'])) { + $GLOBALS['xortifyModuleConfig'] = $config_handler->getConfigList($GLOBALS['xortifyModule']->getVar('mid')); + } else { + $GLOBALS['xortifyModuleConfig']['fault_delay'] = 600; + } + XoopsLoad::load('xoopscache'); + } + + + static function eventCoreIncludeCommonEnd($args) + { + SystemXortifyPreload::init(); + $result = XoopsCache::read('xortify_core_include_common_end_cron'); + if ((isset($result['time'])?(float)$result['time']:0)<=microtime(true)) { + XoopsCache::write('xortify_core_include_common_end_cron', array('time'=>microtime(true)+$GLOBALS['xortifyModuleConfig']['fault_delay']), $GLOBALS['xortifyModuleConfig']['fault_delay']); + switch ($GLOBALS['xortifyModuleConfig']['crontype']) { + case 'preloader': + $read = XoopsCache::read('xortify_pause_preload'); + if ((isset($read['time'])?(float)$read['time']:0)<=microtime(true)) { + XoopsCache::write('xortify_pause_preload', array('time'=>microtime(true)+$GLOBALS['xortifyModuleConfig']['croninterval'])); + $GLOBALS['xortify_preloader']=true; + ob_start(); + include(XOOPS_ROOT_PATH.'/modules/xortify/cron/serverup.php'); + ob_end_clean(); + } + break; + } + XoopsCache::write('xortify_core_include_common_end_cron', array('time'=>microtime(true)), -1); + } + + } +} + +?> \ No newline at end of file Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.html =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.html (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.html 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,10 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>Untitled Document</title> +</head> + +<body> +</body> +</html> Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/index.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,445 @@ +<?php +/** + * @package xortify + * @subpackage module + * @description Sector Network Security Drone + * @author Simon Roberts WISHCRAFT <si...@ch...> + * @copyright copyright (c) 2010-2013 XOOPS.org + * @licence GPL 2.0 - see docs/LICENCE.txt + */ + + + require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; + + $xoops = Xoops::getInstance(); + XoopsLoad::load('system', 'system'); + + error_reporting(E_ALL); + + if (!defined('_CHARSET')) + define ("_CHARSET","UTF-8"); + if (!defined('_CHARSET_ISO')) + define ("_CHARSET_ISO","ISO-8859-1"); + + $GLOBALS['myts'] = MyTextSanitizer::getInstance(); + + $module_handler = $GLOBALS['xoops']->getHandler('module'); + $config_handler = $GLOBALS['xoops']->getHandler('config'); + $GLOBALS['xortifyModule'] = $module_handler->getByDirname('xortify'); + $GLOBALS['xortifyModuleConfig'] = $config_handler->getConfigList($GLOBALS['xortifyModule']->getVar('mid')); + + include_once $GLOBALS['xoops']->path('class'.DS.'cache'.DS.'xoopscache.php'); + include_once $GLOBALS['xoops']->path('class'.DS.'pagenav.php'); + include_once $GLOBALS['xoops']->path('class'.DS.'xoopslists.php'); + include_once $GLOBALS['xoops']->path('class'.DS.'xoopsmailer.php'); + include_once $GLOBALS['xoops']->path('class'.DS.'tree.php'); + include_once $GLOBALS['xoops']->path('class'.DS.'moduleadmin.php'); + include_once $GLOBALS['xoops']->path('modules'.DS.'xortify'.DS.'class'.DS.'auth'.DS.'authfactory.php'); + include_once $GLOBALS['xoops']->path('modules'.DS.'xortify'.DS.'include'.DS.'functions.php'); + include_once $GLOBALS['xoops']->path('modules'.DS.'xortify'.DS.'include'.DS.'forms.xortify.php'); + + $GLOBALS['xortifyImageIcon'] = XOOPS_URL .'/'. $GLOBALS['xortifyModule']->getInfo('icons16'); + $GLOBALS['xortifyImageAdmin'] = XOOPS_URL .'/'. $GLOBALS['xortifyModule']->getInfo('icons32'); + + $myts = MyTextSanitizer::getInstance(); + + if ($GLOBALS['xoopsUser']) { + $moduleperm_handler = $GLOBALS['xoops']->getHandler('groupperm'); + if (!$moduleperm_handler->checkRight('module_admin', $GLOBALS['xortifyModule']->getVar( 'mid' ), $GLOBALS['xoopsUser']->getGroups())) { + $GLOBALS['xoops']->redirect(XOOPS_URL, 1, _NOPERM); + exit(); + } + } else { + $GLOBALS['xoops']->redirect(XOOPS_URL . "/user.php", 1, _NOPERM); + exit(); + } + + $GLOBALS['xoops']->loadLanguage('admin', 'xortify'); + $GLOBALS['xoops']->loadLanguage('modinfo', 'xortify'); + + $GLOBALS['xoops']->header(); + $GLOBALS['xoops']->tpl->assign('pathImageIcon', $GLOBALS['xortifyImageIcon']); + $GLOBALS['xoops']->tpl->assign('pathImageAdmin', $GLOBALS['xortifyImageAdmin']); + + $op = isset($_REQUEST['op'])?$_REQUEST['op']:"dashboard"; + $fct = isset($_REQUEST['fct'])?$_REQUEST['fct']:""; + + switch($op) { + case "signup": + + switch ($fct) + { + case "save": + + $xortifyAuth = XortifyAuthFactory::getAuthConnection(false, $GLOBALS['xortifyModuleConfig']['protocol']); + $myts = MyTextSanitizer::getInstance(); + $uname = isset($_POST['uname']) ? $myts->stripSlashesGPC(trim($_POST['uname'])) : ''; + $email = isset($_POST['email']) ? $myts->stripSlashesGPC(trim($_POST['email'])) : ''; + $url = isset($_POST['url']) ? $myts->stripSlashesGPC(trim($_POST['url'])) : ''; + $pass = isset($_POST['pass']) ? $myts->stripSlashesGPC(trim($_POST['pass'])) : ''; + $vpass = isset($_POST['vpass']) ? $myts->stripSlashesGPC(trim($_POST['vpass'])) : ''; + $agree = (isset($_POST['agree']) && intval($_POST['agree'])) ? 1 : 0; + + if ($agree != 1) { + $stop .= _US_UNEEDAGREE . '<br />'; + } + + $validate = $xortifyAuth->validate($uname, $email, $pass, $vpass); + + if ($validate!=false) + $stop .= "User details didn't validate with Xortify.com<br/>$validate"; + + XoopsLoad::load("captcha"); + $xoopsCaptcha = XoopsCaptcha::getInstance(); + if (! $xoopsCaptcha->verify() ) { + $stop .= $xoopsCaptcha->getMessage(); + } + + if ($stop!='') { + + echo xortify_adminMenu(4, 'index.php?op=signup&fct=signup'); + echo "<p align='center' style='font-size: 15px; color: #FF0000;'>$stop</p>"; + $GLOBALS['xoops'] = Xoops::getInstance(); + $xortifyAuth = XortifyAuthFactory::getAuthConnection(false, $GLOBALS['xortifyModuleConfig']['protocol']); + $disclaimer = $xortifyAuth->network_disclaimer(); + if (strlen(trim($disclaimer))==0) + { + $disclaimer = _XOR_ADMIN_NONETWORKCOMM_DISCLAIMER; + } + if ($disclaimer != _XOR_ADMIN_NONETWORKCOMM_DISCLAIMER) { + $uname = new XoopsFormText('', "uname", 35, 128, (isset($_POST['uname'])?$_POST['uname']:'')); + $pass = new XoopsFormPassword('', "pass", 35, 128, (isset($_POST['pass'])?$_POST['pass']:'')); + $vpass = new XoopsFormPassword('', "vpass", 35, 128, (isset($_POST['vpass'])?$_POST['vpass']:'')); + $email = new XoopsFormText('', "email", 35, 128, (isset($_POST['email'])?$_POST['email']:'')); + $url = new XoopsFormText('', "url", 35, 128, (isset($_POST['url'])?$_POST['url']:'')); + $viewemail = new XoopsFormRadioYN('', "viewemail", (isset($_POST['viewemail'])?$_POST['viewemail']:false)); + $timezone = new XoopsFormSelectTimezone('', "timezone", (isset($_POST['timezone'])?$_POST['timezone']:'')); + $myts = MyTextSanitizer::getInstance(); + $disclaim = new XoopsFormLabel('', $myts->nl2br($disclaimer)); + $agree = new XoopsFormRadioYN('', "agree", false); + $captcha = new XoopsFormCaptcha('', 'xoopscaptcha', false); + $op = new XoopsFormHidden('op', 'signup'); + $fct = new XoopsFormHidden('fct', 'save'); + $submit = new XoopsFormButton('', 'submit', _XOR_FRM_REGISTER, 'submit'); + $GLOBALS['xoops']->tpl->assign('uname',$uname->render()); + $GLOBALS['xoops']->tpl->assign('pass',$pass->render()); + $GLOBALS['xoops']->tpl->assign('vpass',$vpass->render()); + $GLOBALS['xoops']->tpl->assign('email',$email->render()); + $GLOBALS['xoops']->tpl->assign('yoururl',$url->render()); + $GLOBALS['xoops']->tpl->assign('viewemail',$viewemail->render()); + $GLOBALS['xoops']->tpl->assign('timezone',$timezone->render()); + $GLOBALS['xoops']->tpl->assign('disclaimer',$disclaim->render()); + $GLOBALS['xoops']->tpl->assign('agree',$agree->render()); + $GLOBALS['xoops']->tpl->assign('captcha',$captcha->render()); + $GLOBALS['xoops']->tpl->assign('op',$op->render()); + $GLOBALS['xoops']->tpl->assign('fct',$fct->render()); + $GLOBALS['xoops']->tpl->assign('submit',$submit->render()); + $GLOBALS['xoops']->tpl->display('admin:xortify|xortify_cpanel_signup_form.html'); + xortify_footer_adminMenu(); + $GLOBALS['xoops']->footer(); + exit; + } else { + $GLOBALS['xoops']->tpl->assign('protocol', $GLOBALS['xortifyModuleConfig']['protocol']); + switch($GLOBALS['xortifyModuleConfig']['protocol']) { + case 'curlserialised': + case 'wgetserialised': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_uriserial']); + break; + case 'curl': + case 'json': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_urijson']); + break; + case 'curlxml': + case 'wgetxml': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_urixml']); + break; + case 'soap': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_urisoap']); + break; + } + $GLOBALS['xoops']->tpl->assign('error', $disclaimer); + $GLOBALS['xoops']->tpl->display('admin:xortify|xortify_cpanel_signup_nocommunication.html'); + } + } else { + @$xortifyAuth->create_user( $_POST['viewemail'], $uname, $email, $url, $actkey, + $pass, $_POST['timezone'], $_POST['mailok'], $xortifyAuth->check_siteinfo(array())); + + $moduleHandler = $GLOBALS['xoops']->getHandler('module'); + $configHandler = $GLOBALS['xoops']->getHandler('config'); + $GLOBALS['xortifyModule'] = $moduleHandler->getByDirname('xortify'); + $configs = $configHandler->getConfigs(new Criteria('conf_modid', $GLOBALS['xortifyModule']->mid()) ); + foreach($configs as $id => $config) + switch($config->getVar('conf_name')) { + case 'xortify_username': + $config->setVar('conf_value', $uname); + @$configHandler->insertConfig($config); + break; + case 'xortify_password': + $config->setVar('conf_value', $pass); + @$configHandler->insertConfig($config); + break; + } + + $GLOBALS['xoops']->redirect("index.php", 4, _XOR_USERCREATED_PLEASEACTIVATE); + exit(0); + } + break; + default: + case "signup": + + echo xortify_adminMenu(4, 'index.php?op=signup&fct=signup'); + $GLOBALS['xoops'] = Xoops::getInstance(); + + $disclaimer = XortifyAuthFactory::getAuthConnection(false, $GLOBALS['xortifyModuleConfig']['protocol'])->network_disclaimer(); + + if (strlen(trim($disclaimer))==0) + { + $disclaimer = _XOR_ADMIN_NONETWORKCOMM_DISCLAIMER; + } + if ($disclaimer != _XOR_ADMIN_NONETWORKCOMM_DISCLAIMER) { + + $uname = new XoopsFormText('', "uname", 35, 128, (isset($_POST['uname'])?$_POST['uname']:'')); + $pass = new XoopsFormPassword('', "pass", 35, 128, (isset($_POST['pass'])?$_POST['pass']:'')); + $vpass = new XoopsFormPassword('', "vpass", 35, 128, (isset($_POST['vpass'])?$_POST['vpass']:'')); + $email = new XoopsFormText('', "email", 35, 128, (isset($_POST['email'])?$_POST['email']:'')); + $url = new XoopsFormText('', "yoururl", 35, 128, (isset($_POST['url'])?$_POST['url']:'')); + $viewemail = new XoopsFormRadioYN('', "viewemail", (isset($_POST['viewemail'])?$_POST['viewemail']:false)); + $timezone = new XoopsFormSelectTimezone('', "timezone", (isset($_POST['timezone'])?$_POST['timezone']:'')); + $myts = MyTextSanitizer::getInstance(); + $disclaim = new XoopsFormLabel('', $myts->nl2br($disclaimer)); + $agree = new XoopsFormRadioYN('', "agree", false); + $captcha = new XoopsFormCaptcha('', 'xoopscaptcha', false); + $op = new XoopsFormHidden('op', 'signup'); + $fct = new XoopsFormHidden('fct', 'save'); + $submit = new XoopsFormButton('', 'submit', _XOR_FRM_REGISTER, 'submit'); + $GLOBALS['xoops']->tpl->assign('uname',$uname->render()); + $GLOBALS['xoops']->tpl->assign('pass',$pass->render()); + $GLOBALS['xoops']->tpl->assign('vpass',$vpass->render()); + $GLOBALS['xoops']->tpl->assign('email',$email->render()); + $GLOBALS['xoops']->tpl->assign('yoururl',$url->render()); + $GLOBALS['xoops']->tpl->assign('viewemail',$viewemail->render()); + $GLOBALS['xoops']->tpl->assign('timezone',$timezone->render()); + $GLOBALS['xoops']->tpl->assign('disclaimer',$disclaim->render()); + $GLOBALS['xoops']->tpl->assign('agree',$agree->render()); + $GLOBALS['xoops']->tpl->assign('captcha',$captcha->render()); + $GLOBALS['xoops']->tpl->assign('op',$op->render()); + $GLOBALS['xoops']->tpl->assign('fct',$fct->render()); + $GLOBALS['xoops']->tpl->assign('submit',$submit->render()); + $GLOBALS['xoops']->tpl->display('admin:xortify|xortify_cpanel_signup_form.html'); + + xortify_footer_adminMenu(); + $GLOBALS['xoops']->footer(); + exit; + } else { + + $GLOBALS['xoops']->tpl->assign('protocol', $GLOBALS['xortifyModuleConfig']['protocol']); + switch($GLOBALS['xortifyModuleConfig']['protocol']) { + case 'curlserialised': + case 'wgetserialised': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_uriserial']); + break; + case 'curl': + case 'json': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_urijson']); + break; + case 'curlxml': + case 'wgetxml': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_urixml']); + break; + case 'soap': + $GLOBALS['xoops']->tpl->assign('port', $GLOBALS['xortifyModuleConfig']['xortify_urisoap']); + break; + } + $GLOBALS['xoops']->tpl->assign('error', $disclaimer); + $GLOBALS['xoops']->tpl->display('admin:xortify|xortify_cpanel_signup_nocommunication.html'); + + } + break; + } + break; + case "log": + echo xortify_adminMenu(3, 'index.php?op=log'); + + include_once $GLOBALS['xoops']->path( "/class/pagenav.php" ); + + $log_handler = $GLOBALS['xoops']->getModuleHandler('log', 'xortify'); + + $ttl = $log_handler->getCount(NULL); + $limit = !empty($_POST['limit'])?intval($_POST['limit']):30; + $start = !empty($_POST['start'])?intval($_POST['start']):0; + $order = !empty($_POST['order'])?$_POST['order']:'DESC'; + $sort = !empty($_POST['sort'])?''.$_POST['sort'].'':'date'; + + $pagenav = new XoopsPageNav($ttl, $limit, $start, 'start', 'limit='.$limit.'&sort='.$sort.'&order='.$order.'&op='.$op); + $GLOBALS['xoops']->tpl->assign('pagenav', $pagenav->renderNav()); + + foreach (array( 'action','provider','date','uname','email','ip4','ip6','proxy-ip4', + 'proxy-ip6','network-addy','agent') as $id => $key) { + $GLOBALS['xoops']->tpl->assign(strtolower(str_replace('-','_',$key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$start.'&limit='.$limit.'&sort='.str_replace('_','-',$key).'&order='.((str_replace('_','-',$key)==$sort)?($order=='DESC'?'ASC':'DESC'):$order).'&op='.$op.'">'.(defined('_XOR_AM_TH_'.strtoupper(str_replace('-','_',$key)))?constant('_XOR_AM_TH_'.strtoupper(str_replace('-','_',$key))):'_XOR_AM_TH_'.strtoupper(str_replace('-','_',$key))).'</a>'); + } + + $criteria = new Criteria('1','1'); + $criteria->setStart($start); + $criteria->setLimit($limit); + $criteria->setSort('`'.$sort.'`'); + $criteria->setOrder($order); + + $logs = $log_handler->getObjects($criteria, true); + foreach($logs as $id => $log) { + $GLOBALS['xoops']->tpl->append('log', $log->toArray()); + } + $GLOBALS['xoops']->tpl->display('admin:xortify|xortify_cpanel_log.html'); + + break; + case "list": + + echo xortify_adminMenu(2, 'index.php?op=list&fct=bans'); + + XoopsLoad::load("xoopscache"); + if (!class_exists('XoopsCache')) + XoopsLoad::load("cache"); + XoopsLoad::load("pagenav"); + + if (!$bans = XoopsCache::read('xortify_bans_cache')) { + + require_once( XOOPS_ROOT_PATH.'/modules/xortify/class/'.$GLOBALS['xortifyModuleConfig']['protocol'].'.php' ); + + $func = strtoupper($GLOBALS['xortifyModuleConfig']['protocol']).'XortifyExchange'; + + ob_start(); + $soapExchg = new $func; + $bans = $soapExchg->retrieveBans(); + ob_end_flush(); + + XoopsCache::delete('xortify_bans_cache'); + XoopsCache::delete('xortify_bans_cache_backup'); + XoopsCache::write('xortify_bans_cache', $bans, $GLOBALS['xortifyModuleConfig']['xortify_seconds']); + XoopsCache::write('xortify_bans_cache_backup', $bans, ($GLOBALS['xortifyModuleConfig']['xortify_seconds'] * 1.45)); + } + + if ($bans['bans']==0) { + + echo _XS_AM_NOCACHEMSG; + } else { + + $limit = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; + $start = !empty($_REQUEST['start'])?intval($_REQUEST['start']):0; + + $pagenav = new XoopsPageNav($bans['bans'], $limit, $start, 'start', 'limit='.$limit.'&op='.$op); + $GLOBALS['xoops']->tpl->assign('pagenav', $pagenav->renderNav()); + $i=0; + $num=0; + foreach($bans['data'] as $key => $data) { + $i++; + if ($i>=$start&&$num<=$limit) { + $num++; + if (strlen($data['ip4'])>0) { + $ipaddy = $data['ip4']; + $iptype = _XS_IPTYPE_IP4; + } elseif (strlen($data['ip6'])>0) { + $ipaddy = $data['ip6']; + $iptype = _XS_IPTYPE_IP6; + } else { + $ipaddy = ''; + $iptype = _XS_IPTYPE_EMPTY; + } + + if (strlen($data['proxy-ip4'])>0) { + $proxyip = $data['proxy-ip4']; + $proxyiptype = _XS_IPTYPE_IP4; + } elseif (strlen($data['proxy-ip6'])>0) { + $proxyip = $data['proxy-ip6']; + $proxyiptype = _XS_IPTYPE_IP6; + } else { + $proxyip = ''; + $proxyiptype = ''; + } + + $GLOBALS['xoops']->tpl->append('bans', array('netaddy'=>$data['network-addy']?$data['network-addy']:' ', + 'macaddy'=>$data['mac-addy']?$data['mac-addy']:' ', + 'iptype'=>$iptype, 'ipaddy'=>$ipaddy, + 'proxyiptype'=>$proxyiptype,'ip'=>$proxyip, + 'long' => $data['long']?$data['long']:' ', + 'category' =>$data['category'],'comments'=>$data['comments'])); + + } + } + $hostname = 'xortify.com'; + switch($GLOBALS['xortifyModuleConfig']['protocol']) { + case 'curlserialised': + case 'wgetserialised': + $hostname = parse_url($GLOBALS['xortifyModuleConfig']['xortify_uriserial'], PHP_URL_HOST); + break; + case 'curl': + case 'json': + $hostname = parse_url($GLOBALS['xortifyModuleConfig']['xortify_urijson'], PHP_URL_HOST); + break; + case 'curlxml': + case 'wgetxml': + $hostname = parse_url($GLOBALS['xortifyModuleConfig']['xortify_urixml'], PHP_URL_HOST); + break; + case 'soap': + $hostname = parse_url($GLOBALS['xortifyModuleConfig']['xortify_urisoap'], PHP_URL_HOST); + break; + } + $GLOBALS['xoops']->tpl->assign('cloudurl', 'http://'.$hostname); + $GLOBALS['xoops']->tpl->display('admin:xortify|xortify_cpanel_bans.html'); + } + + + break; + case "dashboard": + default: + + echo xortify_adminMenu(1, 'index.php?op=dashboard'); + + $log_handler = $GLOBALS['xoops']->getModuleHandler('log', 'xortify'); + + $indexAdmin = new XoopsModuleAdmin(); + + $indexAdmin->addInfoBox(_XOR_ADMIN_COUNTS); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_BANNED, $log_handler->getCountByField('action','banned')), 'default', 'Green'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_BLOCKED, $log_handler->getCountByField('action','blocked')), 'default', 'Green'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_MONITORED, $log_handler->getCountByField('action','monitored')), 'default', 'Green'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_PROJECTHONEYPOTORG, $log_handler->getCountByField('provider','projecthoneypot.org')), 'default', 'Green'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_PROTECTOR, $log_handler->getCountByField('provider','protector')), 'default', 'Green'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_SPIDERS, $log_handler->getCountByField('provider','spiders')), 'default', 'Green'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_STOPFORUMSPAMCOM, $log_handler->getCountByField('provider','stopforumspam.com')), 'default', 'Green'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_XORTIFY, $log_handler->getCountByField('provider','xortify')), 'default', 'Green'); + + XoopsLoad::load('xoopscache'); + if (!class_exists('XoopsCache')) { + // XOOPS 2.4 Compliance + XoopsLoad::load('cache'); + if (!class_exists('XoopsCache')) { + include_once XOOPS_ROOT_PATH.DS.'class'.DS.'cache'.DS.'xoopscache.php'; + } + } + + if ($bans = XoopsCache::read('xortify_bans_cache')) { + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_CLOUDEDBANS, count($bans['data'])), 'default', 'Green'); + } + + if ($result = XoopsCache::read('xortify_cleanup_last')) { + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_WHENCLEANED, date(_DATESTRING, $result['when'])), 'default' , 'Purple'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_CLEANINGTOOK, $result['took']), 'default', 'Purple'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_FILESDELETED, $result['files']), 'default' , 'Purple'); + $indexAdmin->addInfoBoxLine(sprintf(_XOR_ADMIN_THEREARE_BYTESSAVED, $result['size']), 'default', 'Purple'); + } + echo $indexAdmin->renderIndex(); + + break; + case "about": + + echo xortify_adminMenu(5, 'index.php?op=about'); + + $paypalitemno='XBZNTNX2BZUR4'; + $aboutAdmin = new XoopsModuleAdmin(); + + $aboutAdmin->renderabout($paypalitemno, false); + + } + + xortify_footer_adminMenu(); + $GLOBALS['xoops']->footer(); +?> \ No newline at end of file Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/menu.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/menu.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/admin/menu.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,35 @@ +<?php +/** + * @package xortify + * @subpackage module + * @description Sector Network Security Drone + * @author Simon Roberts WISHCRAFT <si...@ch...> + * @copyright copyright (c) 2010-2013 XOOPS.org + * @licence GPL 2.0 - see docs/LICENCE.txt + */ +global $adminmenu; +$adminmenu = array(); +if (is_object($GLOBALS['xortifyModule'])) { + $xortifyImageAdmin = '/icons/32'; + $adminmenu[1]['title'] = _XOR_ADMENU4; + $adminmenu[1]['icon'] = $xortifyImageAdmin.'/home.png'; + $adminmenu[1]['image'] = $xortifyImageAdmin.'/home.png'; + $adminmenu[1]['link'] = "admin/index.php?op=dashboard"; + $adminmenu[2]['title'] = _XOR_ADMENU1; + $adminmenu[2]['icon'] = $xortifyImageAdmin.'/current.bans.png'; + $adminmenu[2]['image'] = $xortifyImageAdmin.'/current.bans.png'; + $adminmenu[2]['link'] = "admin/index.php?op=list&fct=bans"; + $adminmenu[3]['title'] = _XOR_ADMENU3; + $adminmenu[3]['icon'] = $xortifyImageAdmin.'/xortify.log.png'; + $adminmenu[3]['image'] = $xortifyImageAdmin.'/xortify.log.png'; + $adminmenu[3]['link'] = "admin/index.php?op=log"; + $adminmenu[4]['title'] = _XOR_ADMENU2; + $adminmenu[4]['icon'] = $xortifyImageAdmin.'/access.list.png'; + $adminmenu[4]['image'] = $xortifyImageAdmin.'/access.list.png'; + $adminmenu[4]['link'] = "admin/index.php?op=signup&fct=signup"; + $adminmenu[5]['title'] = _XOR_ADMENU5; + $adminmenu[5]['icon'] = $xortifyImageAdmin.'/about.png'; + $adminmenu[5]['image'] = $xortifyImageAdmin.'/about.png'; + $adminmenu[5]['link'] = "admin/index.php?op=about"; +} +?> \ No newline at end of file Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,118 @@ +<?php +/** + * @package xortify + * @subpackage module + * @description Sector Network Security Drone + * @author Simon Roberts WISHCRAFT <si...@ch...> + * @copyright copyright (c) 2010-2013 XOOPS.org + * @licence GPL 2.0 - see docs/LICENCE.txt + */ + + +class XortifyAuth { + + var $_dao; + + var $_errors; + /** + * Authentication Service constructor + */ + function XortifyAuth (&$dao){ + $this->_dao = $dao; + } + + /** + * @abstract need to be write in the dervied class + */ + function authenticate($uname, $pwd = null) { + $authenticated = false; + + return $authenticated; + } + + /** + * add an error + * + * @param string $value error to add + * @access protected + */ + function setErrors($err_no, $err_str) + { + $this->_errors[$err_no] = trim($err_str); + } + + /** + * return the errors for this object as an array + * + * @return array an array of errors + * @access protected + */ + function getErrors() + { + return $this->_errors; + } + + /** + * return the errors for this object as html + * + * @return string html listing the errors + * @access protected + */ + function getHtmlErrors() + { + global $xoopsConfig; + $ret = '<br>'; + if ( $xoopsConfig['debug_mode'] == 1 || $xoopsConfig['debug_mode'] == 2 ) + { + if (!empty($this->_errors)) { + foreach ($this->_errors as $errno => $errstr) { + $ret .= $errstr . '<br/>'; + } + } else { + $ret .= _NONE.'<br />'; + } + $ret .= sprintf(_AUTH_MSG_AUTH_METHOD, $this->auth_method); + } + else { + $ret .= _US_INCORRECTLOGIN; + } + return $ret; + } + + /** + * checks for variables require in siteinfo package in the auth library + * + * @param array $siteinfo + * + * @return array $siteinfo + * @access protected + */ + function check_siteinfo($siteinfo){ + + global $xoopsConfig; + if (!isset($siteinfo)||empty($siteinfo)||!is_array($siteinfo)){ + $siteinfo = array(); + $siteinfo['sitename'] = $xoopsConfig['sitename']; + $siteinfo['adminmail'] = $xoopsConfig['adminmail']; + $siteinfo['systemkey'] = XOOPS_LICENSE_KEY; + $siteinfo['xoops_url'] = XOOPS_URL; + } + + if (!isset($siteinfo['sitename'])||empty($siteinfo['sitename'])) + $siteinfo['sitename'] = $xoopsConfig['sitename']; + + if (!isset($siteinfo['adminmail'])||empty($siteinfo['adminmail'])) + $siteinfo['adminmail'] = $xoopsConfig['adminmail']; + + if (!isset($siteinfo['xoops_url'])||empty($siteinfo['xoops_url'])) + $siteinfo['xoops_url'] = XOOPS_URL; + + if (!isset($siteinfo['systemkey'])||empty($siteinfo['systemkey'])) + $siteinfo['systemkey'] = $xoopsConfig['systemkey']; + + return $siteinfo; + } +} + + +?> Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,186 @@ +<?php +/** + * @package xortify + * @subpackage module + * @description Sector Network Security Drone + * @author Simon Roberts WISHCRAFT <si...@ch...> + * @copyright copyright (c) 2010-2013 XOOPS.org + * @licence GPL 2.0 - see docs/LICENCE.txt + */ + +if (!function_exists('json_encode')){ + function json_encode($data) { + static $json = NULL; + if (!class_exists('Services_JSON') ) { include_once $GLOBALS['xoops']->path('/modules/xortify/include/JSON.php'); } + $json = new Services_JSON(); + return $json->encode($data); + } +} + +if (!function_exists('json_decode')){ + function json_decode($data) { + static $json = NULL; + if (!class_exists('Services_JSON') ) { include_once $GLOBALS['xoops']->path('/modules/xortify/include/JSON.php'); } + $json = new Services_JSON(); + return $json->decode($data); + } +} + + +define('XORTIFY_CURL_API', $GLOBALS['xortifyModuleConfig']['xortify_uricurl']); +define('XORTIFY_USER_AGENT', 'Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.2) XOOPS/20100101 XoopsAuth/1.xx (php)'); +include_once XOOPS_ROOT_PATH . '/modules/xortify/class/auth/auth_curl_provisionning.php'; + +class XortifyAuthCurl extends XortifyAuth { + + var $curl_client; + var $curl_xoops_username = ''; + var $curl_xoops_password = ''; + var $_dao; + var $_json = ''; + /** + * Authentication Service constructor + */ + function XortifyAuthCurl (&$dao) { + if (!$ch = curl_init(XORTIFY_CURL_API)) { + trigger_error('Could not intialise CURL file: '.XORTIFY_CURL_API); + return false; + } + $cookies = XOOPS_VAR_PATH.'/cache/xoops_cache/authcurl_'.md5(XORTIFY_CURL_API).'.cookie'; + + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $GLOBALS['xortifyModuleConfig']['curl_connecttimeout']*2); + curl_setopt($ch, CURLOPT_TIMEOUT, $GLOBALS['xortifyModuleConfig']['curl_timeout']*2); + curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_USERAGENT, XORTIFY_USER_AGENT); + $this->curl_client = $ch; + } + + + /** + * Authenticate user again curl directory (Bind) + * + * @param string $uname Username + * @param string $pwd Password + * + * @return bool + */ + function authenticate($uname, $pwd = null) { + $authenticated = false; + $this->XortifyAuthCurl($GLOBALS['xoopsDB']); + + if (!$this->curl_client) { + $this->setErrors(0, _AUTH_CURL_EXTENSION_NOT_LOAD); + return $authenticated; + } + + + $rnd = rand(-100000, 100000000); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, array('xoops_authentication' => json_encode(array("username"=> $this->curl_xoops_username, "password"=> $this->curl_xoops_password, "auth" => array('username' => $uname, "password" => $pwd, "time" => time(), "passhash" => sha1((time()-$rnd).$uname.$pwd), "rand"=>$rnd))))); + $data = curl_exec($this->curl_client); + curl_close($this->curl_client); + $result = $this->obj2array(json_decode($data)); + return $result["RESULT"]; + } + + + /** + * validate a user via curl + * + * @param string $uname + * @param string $email + * @param string $pass + * @param string $vpass + * + * @return string + */ + function validate($uname, $email, $pass, $vpass){ + $this->XortifyAuthCurl($GLOBALS['xoopsDB']); + $rnd = rand(-100000, 100000000); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, array('xoops_user_validate' => json_encode(array("username"=> $this->curl_xoops_username, "password"=> $this->curl_xoops_password, "validate" => array('uname' => $uname, "pass" => $pass, "vpass" => $vpass, "email" => $email, "time" => time(), "passhash" => sha1((time()-$rnd).$uname.$pass), "rand"=>$rnd))))); + $data = curl_exec($this->curl_client); + curl_close($this->curl_client); + $result = $this->obj2array(json_decode($data)); + if ($result['ERRNUM']==1){ + return $result["RESULT"]; + } else { + return false; + } + + } + + + /** + * get the xoops site disclaimer via curl + * + * @return string + */ + function network_disclaimer(){ + $this->XortifyAuthCurl($GLOBALS['xoopsDB']); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, array('xoops_network_disclaimer' => json_encode(array("username"=> $this->curl_xoops_username, "password"=> $this->curl_xoops_password)))); + $data = curl_exec($this->curl_client); + curl_close($this->curl_client); + + $result = $this->obj2array(json_decode($data)); + if ($result['ERRNUM']==1){ + return $result["RESULT"]; + } else { + return false; + } + + } + + /** + * create a user + * + * @param bool $user_viewemail + * @param string $uname + * @param string $email + * @param string $url + * @param string $actkey + * @param string $pass + * @param integer $timezone_offset + * @param bool $user_mailok + * @param array $siteinfo + * + * @return array + */ + function create_user($user_viewemail, $uname, $email, $url, $actkey, + $pass, $timezone_offset, $user_mailok, $siteinfo){ + + $siteinfo = $this->check_siteinfo($siteinfo); + + $rnd = rand(-100000, 100000000); + $this->XortifyAuthCurl($GLOBALS['xoopsDB']); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, 'xoops_create_user='.json_encode(array("username"=> $this->curl_xoops_username, "password"=> $this->curl_xoops_password, "user" => array('user_viewemail' =>$user_viewemail, 'uname' => $uname, 'email' => $email, 'url' => $url, 'actkey' => $actkey, 'pass' => $pass, 'timezone_offset' => $timezone_offset, 'user_mailok' => $user_mailok, "time" => time(), "passhash" => sha1((time()-$rnd).$uname.$pass), "rand"=>$rnd), "siteinfo" => $siteinfo))); + $data = curl_exec($this->curl_client); + curl_close($this->curl_client); + $result = $this->obj2array(json_decode($data)); + if ($result['ERRNUM']==1){ + return $result["RESULT"]; + } else { + return false; + } + } + + function obj2array($objects) { + $ret = array(); + foreach($objects as $key => $value) { + if (is_a($value, 'stdClass')) { + $ret[$key] = (array)$value; + } elseif (is_array($value)) { + $ret[$key] = $this->obj2array($value); + } else { + $ret[$key] = $value; + } + } + return $ret; + } + +} +// end class + + +?> Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl_provisionning.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl_provisionning.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curl_provisionning.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,190 @@ +<?php +/** + * @package xortify + * @subpackage module + * @description Sector Network Security Drone + * @author Simon Roberts WISHCRAFT <si...@ch...> + * @copyright copyright (c) 2010-2013 XOOPS.org + * @licence GPL 2.0 - see docs/LICENCE.txt + */ + + +class XortifyAuthCurlProvisionning { + + var $_auth_instance; + + function &getInstance(&$auth_instance) + { + static $provis_instance; + if (!isset($provis_instance)) { + $provis_instance = new XortifyAuthCurlProvisionning($auth_instance); + } + return $provis_instance; + } + + /** + * Authentication Service constructor + */ + function XortifyAuthCurlProvisionning (&$auth_instance) { + $this->_auth_instance = &$auth_instance; + $config_handler = $GLOBALS['xoops']->getHandler('config'); + $config = $config_handler->getConfigsByCat(XOOPS_CONF_AUTH); + foreach ($config as $key => $val) { + $this->$key = $val; + } + $config_gen = $config_handler->getConfigsByCat(XOOPS_CONF); + $this->default_TZ = $config_gen['default_TZ']; + $this->theme_set = $config_gen['theme_set']; + $this->com_mode = $config_gen['com_mode']; + $this->com_order = $config_gen['com_order']; + } + + /** + * Return a Xortify User Object + * + * @return XortifyUser or false + */ + function getXortifyUser($uname) { + $member_handler = $GLOBALS['xoops']->getHandler('member'); + $criteria = new Criteria('uname', $uname); + $getuser = $member_handler->getUsers($criteria); + if (count($getuser) == 1) + return $getuser[0]; + else return false; + } + + /** + * Launch the synchronisation process + * + * @return bool + */ + function sync($datas, $uname, $pwd = null) { + $xoopsUser = $this->getXortifyUser($uname); + if (!$xoopsUser) { // Xortify User Database not exists + if ($this->curl_provisionning) { + $xoopsUser = $this->add($datas, $uname, $pwd); + } else $this->_auth_instance->setErrors(0, sprintf(_AUTH_LDAP_XOOPS_USER_NOTFOUND, $uname)); + } else { // Xortify User Database exists + + } + return $xoopsUser; + } + + /** + * Add a new user to the system + * + * @return bool + */ + function add($datas, $uname, $pwd = null) { + $ret = false; + $member_handler = $GLOBALS['xoops']->getHandler('member'); + // Create XOOPS Database User + $newuser = $member_handler->createUser(); + $newuser->setVar('uname', $uname); + $newuser->setVar('pass', md5(stripslashes($pwd))); + $newuser->setVar('email', $datas['email']); + $newuser->setVar('rank', 0); + $newuser->setVar('level', 1); + $newuser->setVar('timezone_offset', $this->default_TZ); + $newuser->setVar('theme', $this->theme_set); + $newuser->setVar('umode', $this->com_mode); + $newuser->setVar('uorder', $this->com_order); + if ($this->curl_provisionning) + $tab_mapping = explode('|', $this->curl_field_mapping); + else + $tab_mapping = explode('|', $this->ldap_field_mapping); + + foreach ($tab_mapping as $mapping) { + $fields = explode('=', trim($mapping)); + if ($fields[0] && $fields[1]) + $newuser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])])); + } + if ($member_handler->insertUser($newuser)) { + } + if ($member_handler->insertUser($newuser)) { + foreach ($this->curl_provisionning_group as $groupid) + $member_handler->addUserToGroup($groupid, $newuser->getVar('uid')); + $newuser->unsetNew(); + return $newuser; + } else $GLOBALS['xoops']->redirect(XOOPS_URL.'/user.php', 5, $newuser->getHtmlErrors()); + + $newuser->unsetNew(); + return $newuser; + //else $GLOBALS['xoops']->redirect(XOOPS_URL.'/user.php', 5, $newuser->getHtmlErrors()); + return $ret; + } + + /** + * Modify user information + * + * @return bool + */ + function change(&$xoopsUser, $datas, $uname, $pwd = null) { + $ret = false; + $member_handler = $GLOBALS['xoops']->getHandler('member'); + $xoopsUser->setVar('pass', md5(stripslashes($pwd))); + $tab_mapping = explode('|', $this->ldap_field_mapping); + foreach ($tab_mapping as $mapping) { + $fields = explode('=', trim($mapping)); + if ($fields[0] && $fields[1]) + $xoopsUser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0])); + } + if ($member_handler->insertUser($xoopsUser)) { + return $xoopsUser; + } else $GLOBALS['xoops']->redirect(XOOPS_URL.'/user.php', 5, $xoopsUser->getHtmlErrors()); + return $ret; + } + + function change_curl(&$xoopsUser, $datas, $uname, $pwd = null) { + $ret = false; + $member_handler = $GLOBALS['xoops']->getHandler('member'); + $xoopsUser->setVar('pass', md5(stripslashes($pwd))); + $tab_mapping = explode('|', $this->curl_field_mapping); + foreach ($tab_mapping as $mapping) { + $fields = explode('=', trim($mapping)); + if ($fields[0] && $fields[1]) + $xoopsUser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0])); + } + if ($member_handler->insertUser($xoopsUser)) { + return $xoopsUser; + } else $GLOBALS['xoops']->redirect(XOOPS_URL.'/user.php', 5, $xoopsUser->getHtmlErrors()); + return $ret; + } + + /** + * Modify a user + * + * @return bool + */ + function delete() { + } + + /** + * Suspend a user + * + * @return bool + */ + function suspend() { + } + + /** + * Restore a user + * + * @return bool + */ + function restore() { + } + + /** + * Add a new user to the system + * + * @return bool + */ + function resetpwd() { + } + + +} +// end class + +?> Added: XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curlserialised.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curlserialised.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/modules/xortify/class/auth/auth_curlserialised.php 2012-04-29 15:41:51 UTC (rev 9402) @@ -0,0 +1,167 @@ +<?php +/** + * @package xortify + * @subpackage module + * @description Sector Network Security Drone + * @author Simon Roberts WISHCRAFT <si...@ch...> + * @copyright copyright (c) 2010-2013 XOOPS.org + * @licence GPL 2.0 - see docs/LICENCE.txt + */ + + +define('XORTIFY_CURLSERIAL_API', $GLOBALS['xortifyModuleConfig']['xortify_uriserial']); +define('XORTIFY_USER_AGENT', 'Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.2) XOOPS/20100101 XoopsAuth/1.xx (php)'); +include_once XOOPS_ROOT_PATH . '/modules/xortify/class/auth/auth_curlserialised_provisionning.php'; + +class XortifyAuthCurlserialised extends XortifyAuth { + + var $curl_client; + var $curl_xoops_username = ''; + var $curl_xoops_password = ''; + var $_dao; + /** + * Authentication Service constructor + */ + function XortifyAuthCurlserialised (&$dao) { + + if (!$ch = curl_init(XORTIFY_CURLSERIAL_API)) { + trigger_error('Could not intialise CURL file: '.$url); + return false; + } + $cookies = XOOPS_VAR_PATH.'/cache/xoops_cache/authcurl_'.md5(XORTIFY_CURLSERIAL_API).'.cookie'; + + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $GLOBALS['xortifyModuleConfig']['curl_connecttimeout']*2); + curl_setopt($ch, CURLOPT_TIMEOUT, $GLOBALS['xortifyModuleConfig']['curl_timeout']*2); + curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_USERAGENT, XORTIFY_USER_AGENT); + $this->curl_client = $ch; + } + + + /** + * Authenticate user again curl directory (Bind) + * + * @param string $uname Username + * @param string $pwd Password + * + * @return bool + */ + function authenticate($uname, $pwd = null) { + $authenticated = false; + $this->XortifyAuthCurlserialised($GLOBALS['xoopsDB']); + + if (!$this->curl_client) { + $this->setErrors(0, _AUTH_CURL_EXTENSION_NOT_LOAD); + return $authenticated; + } + + + $rnd = rand(-100000, 100000000); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, array('xoops_authentication' => serialize(array("username"=> $this->curl_xoops_username, "password"=> $this->curl_xoops_password, "auth" => array('username' => $uname, "password" => $pwd, "time" => time(), "passhash" => sha1((time()-$rnd).$uname.$pwd), "rand"=>$rnd))))); + $data = curl_exec($this->curl_client); + curl_close($this->curl_client); + $result = unserialize($data); + return $result["RESULT"]; + } + + + /** + * validate a user via curl + * + * @param string $uname + * @param string $email + * @param string $pass + * @param string $vpass + * + * @return string + */ + function validate($uname, $email, $pass, $vpass){ + $this->XortifyAuthCurlserialised($GLOBALS['xoopsDB']); + $rnd = rand(-100000, 100000000); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, array('xoops_user_validate' => serialize(array("username"=> $this->curl_xoops_username, "password"=> $this->curl_xoops_password, "validate" => array('uname' => $uname, "pass" => $pass, "vpass" => $vpass, "email" => $email, "time" => time(), "passhash" => sha1((time()-$rnd).$uname.$pass), "rand"=>$rnd))))); + $data = curl_exec($this->curl_client); + curl_close($this->curl_client); + $result = unserialize($data); + if ($result['ERRNUM']==1){ + return $result["RESULT"]; + } else { + return false; + } + + } + + + /** + * get the xoops site disclaimer via curl + * + * @return string + */ + function network_disclaimer(){ + $this->XortifyAuthCurlserialised($GLOBALS['xoopsDB']); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, array('xoops_network_disclaimer' => serialize(array("username"=> $this->curl_xoops_username, "password"=> $this->curl_xoops_password)))); + $data = curl_exec($this->curl_client); + curl_close($this->curl_client); + $result = unserialize($data); + if ($result['ERRNUM']==1){ + return $result["RESULT"]; + } else { + return false; + } + + } + + /** + * create a user + * + * @param bool $user_viewemail + * @param string $uname + * @param string $email + * @param string $url + * @param string $actkey + * @param string $pass + * @param integer $timezone_offset + * @param bool $user_mailok + * @param array $siteinfo + * + * @return array + */ + function create_user($user_viewemail, $uname, $email, $url, $actkey, + $pass, $timezone_offset, $user_mailok, $siteinfo){ + + $siteinfo = $this->check_siteinfo($siteinfo); + + $rnd = rand(-100000, 100000000); + $this->XortifyAuthCurlserialised($GLOBALS['xoopsDB']); + curl_setopt($this->curl_client, CURLOPT_POSTFIELDS... [truncated message content] |
From: <wis...@us...> - 2012-04-29 16:36:25
|
Revision: 9404 http://xoops.svn.sourceforge.net/xoops/?rev=9404&view=rev Author: wishcraft Date: 2012-04-29 16:36:18 +0000 (Sun, 29 Apr 2012) Log Message: ----------- Completed Meta Adding Script, inclusive of setable name for cognitive liberty of the sub function - All Tested and Working!! Added Paths: ----------- XoopsCore/branches/tasks/2.6.0-wishcraft/class/theme.php XoopsCore/branches/tasks/2.6.0-wishcraft/robots.txt Added: XoopsCore/branches/tasks/2.6.0-wishcraft/class/theme.php =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/class/theme.php (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/class/theme.php 2012-04-29 16:36:18 UTC (rev 9404) @@ -0,0 +1,879 @@ +<?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. +*/ + +/** + * XoopsTheme component class file + * + * @copyright The XOOPS project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @author Skalpa Keo <sk...@xo...> + * @author Taiwen Jiang <ph...@us...> + * @since 2.3.0 + * @package class + * @version $Id: theme.php 8629 2012-01-02 23:04:32Z mageg $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * XoopsThemeFactory + * + * @author Skalpa Keo + * @since 2.3.0 + */ +class XoopsThemeFactory +{ + /** + * @var string + */ + public $xoBundleIdentifier = 'XoopsThemeFactory'; + + /** + * Currently enabled themes (if empty, all the themes in themes/ are allowed) + * + * @var array + */ + public $allowedThemes = array(); + + /** + * Default theme to instantiate if none specified + * + * @var string + */ + public $defaultTheme = 'default'; + + /** + * If users are allowed to choose a custom theme + * + * @var bool + */ + public $allowUserSelection = true; + + /** + * Instantiate the specified theme + * + * @param array $options + * + * @return null|XoopsTheme + */ + public function createInstance($options = array()) + { + $xoops = Xoops::getInstance(); + // Grab the theme folder from request vars if present + if (empty($options['folderName'])) { + if (($req = @$_REQUEST['xoops_theme_select']) && $this->isThemeAllowed($req)) { + $options['folderName'] = $req; + if (isset($_SESSION) && $this->allowUserSelection) { + $_SESSION[$this->xoBundleIdentifier]['defaultTheme'] = $req; + } + } else { + if (isset($_SESSION[$this->xoBundleIdentifier]['defaultTheme'])) { + $options['folderName'] = $_SESSION[$this->xoBundleIdentifier]['defaultTheme']; + } else { + if (empty($options['folderName']) || !$this->isThemeAllowed($options['folderName'])) { + $options['folderName'] = $this->defaultTheme; + } + } + } + $xoops->setConfig('theme_set', $options['folderName']); + } + $options['path'] = XOOPS_THEME_PATH . '/' . $options['folderName']; + $inst = null; + $inst = new XoopsTheme(); + foreach ($options as $k => $v) { + $inst->$k = $v; + } + $inst->xoInit(); + return $inst; + } + + /** + * Checks if the specified theme is enabled or not + * + * @param string $name + * + * @return bool + */ + public function isThemeAllowed($name) + { + return (empty($this->allowedThemes) || in_array($name, $this->allowedThemes)); + } +} + +/** + * XoopsAdminThemeFactory + * + * @author Andricq Nicolas (AKA MusS) + * @author trabis + * @since 2.4.0 + */ +class XoopsAdminThemeFactory extends XoopsThemeFactory +{ + public function createInstance($options = array()) + { + $options["plugins"] = array(); + $options['renderBanner'] = false; + $inst = parent::createInstance($options); + $inst->path = XOOPS_ADMINTHEME_PATH . '/' . $inst->folderName; + $inst->url = XOOPS_ADMINTHEME_URL . '/' . $inst->folderName; + $inst->template->assign(array( + 'theme_path' => $inst->path, + 'theme_tpl' => $inst->path . '/xotpl', + 'theme_url' => $inst->url, + 'theme_img' => $inst->url . '/img', + 'theme_icons' => $inst->url . '/icons', + 'theme_css' => $inst->url . '/css', + 'theme_js' => $inst->url . '/js', + 'theme_lang' => $inst->url . '/language', + )); + + return $inst; + } +} + +class XoopsTheme +{ + /** + * Should we render banner? Not for redirect pages or admin side + * + * @var bool + */ + public $renderBanner = true; + + /** + * The name of this theme + * + * @var string + */ + public $folderName = ''; + + /** + * Physical path of this theme folder + * + * @var string + */ + public $path = ''; + + /** + * @var string + */ + public $url = ''; + + /** + * Whether or not the theme engine should include the output generated by php + * + * @var string + */ + public $bufferOutput = true; + + /** + * Canvas-level template to use + * + * @var string + */ + public $canvasTemplate = 'theme.html'; + + /** + * Theme folder path + * + * @var string + */ + public $themesPath = 'themes'; + + /** + * Content-level template to use + * + * @var string + */ + public $contentTemplate = ''; + + /** + * @var int + */ + public $contentCacheLifetime = 0; + + /** + * @var string + */ + public $contentCacheId = null; + + /** + * Text content to display right after the contentTemplate output + * + * @var string + */ + public $content = ''; + + /** + * Page construction plug-ins to use + * + * @var array + * @access public + */ + public $plugins = array('XoopsThemeBlocksPlugin'); + + /** + * @var int + */ + public $renderCount = 0; + + /** + * Pointer to the theme template engine + * + * @var XoopsTpl + */ + public $template = false; + + /** + * Array containing the document meta-information + * + * @var array + */ + public $metas = array( + 'meta' => array(), + 'link' => array(), + 'script' => array() + ); + + /** + * Array of strings to be inserted in the head tag of HTML documents + * + * @var array + */ + public $htmlHeadStrings = array(); + + /** + * Custom variables that will always be assigned to the template + * + * @var array + */ + public $templateVars = array(); + + /** + * User extra information for cache id, like language, user groups + * + * @var boolean + */ + public $use_extra_cache_id = true; + + /** + * Engine used for caching headers information + * Default is 'file', you can choose 'model' for database storage + * or any other cache engine available in the class/cache folder + * + * @var boolean + */ + public $headersCacheEngine = 'file'; + + /** + * *#@- + */ + + /** + * *#@+ + * @tasktype 10 Initialization + */ + /** + * Initializes this theme + * Upon initialization, the theme creates its template engine and instanciates the + * plug-ins from the specified {@link $plugins} list. If the theme is a 2.0 theme, that does not + * display redirection messages, the HTTP redirections system is disabled to ensure users will + * see the redirection screen. + * + * @return bool + */ + public function xoInit() + { + $xoops = Xoops::getInstance(); + $this->path = XOOPS_THEME_PATH . '/' . $this->folderName; + $this->url = XOOPS_THEME_URL . '/' . $this->folderName; + $this->template = null; + $this->template = new XoopsTpl(); + $this->template->currentTheme = $this; + $this->template->assign_by_ref('xoTheme', $this); + $this->template->assign(array( + 'xoops_theme' => $xoops->getConfig('theme_set'), + 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoops->getConfig('theme_set') . '/', + 'xoops_themecss' => $xoops->getCss($xoops->getConfig('theme_set')), + 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), + 'xoops_sitename' => htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES), + 'xoops_slogan' => htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES), + 'xoops_dirname' => $xoops->moduleDirname, + 'xoops_banner' => $this->renderBanner ? $xoops->getBanner() : ' ', + 'xoops_pagetitle' => $xoops->isModule() ? $xoops->module->getVar('name') : htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES) + )); + + if ($xoops->isUser()) { + $this->template->assign(array( + 'xoops_isuser' => true, + 'xoops_avatar' => XOOPS_UPLOAD_URL . "/" . $xoops->user->getVar('user_avatar'), + 'xoops_userid' => $xoops->user->getVar('uid'), + 'xoops_uname' => $xoops->user->getVar('uname'), + 'xoops_name' => $xoops->user->getVar('name'), + 'xoops_isadmin' => $xoops->isAdmin(), + 'xoops_usergroups' => $xoops->user->getGroups() + )); + } else { + $this->template->assign(array( + 'xoops_isuser' => false, + 'xoops_isadmin' => false, + 'xoops_usergroups' => array(XOOPS_GROUP_ANONYMOUS) + )); + } + + // Meta tags + $config_handler = $xoops->getHandlerConfig(); + $criteria = new CriteriaCompo(new Criteria('conf_modid', 0)); + $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER)); + $config = $config_handler->getConfigs($criteria, true); + foreach (array_keys($config) as $i) { + $name = $config[$i]->getVar('conf_name', 'n'); + $value = $config[$i]->getVar('conf_value', 'n'); + if (substr($name, 0, 5) == 'meta_') { + $this->addMeta('meta', substr($name, 5), $value); + } else { + // prefix each tag with 'xoops_' + $this->template->assign("xoops_$name", $value); + } + } + // Load global javascript + $this->addScript('include/xoops.js'); + $this->loadLocalization(); + + if ($this->bufferOutput) { + ob_start(); + } + $xoops->theme = $this; + $xoops->tpl = $this->template; + $GLOBALS['xoTheme'] =& $xoops->theme; + $GLOBALS['xoopsTpl'] =& $xoops->tpl; + + // Instanciate and initialize all the theme plugins + foreach ($this->plugins as $k => $bundleId) { + if (!is_object($bundleId)) { + /* @var $plugin XoopsThemePlugin */ + $plugin = new $bundleId(); + $plugin->theme = $this; + $plugin->xoInit(); + + $this->plugins[$bundleId] = null; + $this->plugins[$bundleId] = $plugin; + unset($this->plugins[$k]); + } + } + return true; + } + + /** + * Generate cache id based on extra information of language and user groups + * User groups other than anonymous should be detected to avoid disclosing group sensitive contents + * + * @param string $cache_id raw cache id + * @param string $extraString extra string + * + * @return string complete cache id + */ + function generateCacheId($cache_id, $extraString = '') + { + $xoops = Xoops::getInstance(); + static $extra_string; + if (!$this->use_extra_cache_id) { + return $cache_id; + } + + if (empty($extraString)) { + if (empty($extra_string)) { + // Generate language section + $extra_string = $xoops->getConfig('language'); + // Generate group section + if (!$xoops->isUser()) { + $extra_string .= '-' . XOOPS_GROUP_ANONYMOUS; + } else { + $groups = $xoops->user->getGroups(); + sort($groups); + // Generate group string for non-anonymous groups, + // XOOPS_DB_PASS and XOOPS_DB_NAME (before we find better variables) are used to protect group sensitive contents + $extra_string .= '-' . substr(md5(implode('-', $groups)), 0, 8) . '-' . substr(md5(XOOPS_DB_PASS . XOOPS_DB_NAME . XOOPS_DB_USER), 0, 8); + } + } + $extraString = $extra_string; + } + $cache_id .= '-' . $extraString; + return $cache_id; + } + + /** + * XoopsTheme::checkCache() + * + * @return bool + */ + public function checkCache() + { + if ($_SERVER['REQUEST_METHOD'] != 'POST' && $this->contentCacheLifetime) { + $template = $this->contentTemplate ? $this->contentTemplate : 'module:system|system_dummy.html'; + $this->template->caching = 2; + $this->template->cache_lifetime = $this->contentCacheLifetime; + $uri = str_replace(XOOPS_URL, '', $_SERVER['REQUEST_URI']); + // Clean uri by removing session id + if (defined('SID') && SID && strpos($uri, SID)) { + $uri = preg_replace("/([\?&])(" . SID . "$|" . SID . "&)/", "\\1", $uri); + } + $this->contentCacheId = $this->generateCacheId('page_' . substr(md5($uri), 0, 8)); + if ($this->template->is_cached($template, $this->contentCacheId)) { + XoopsLogger::getInstance() + ->addExtra($template, sprintf('Cached (regenerates every %d seconds)', $this->contentCacheLifetime)); + $this->render(null, null, $template); + return true; + } + } + return false; + } + + /** + * Render the page + * The theme engine builds pages from 2 templates: canvas and content. + * A module can call this method directly and specify what templates the theme engine must use. + * If render() hasn't been called before, the theme defaults will be used for the canvas and + * page template (and xoopsOption['template_main'] for the content). + * + * @param string $canvasTpl The canvas template, if different from the theme default + * @param string $pageTpl The page template, if different from the theme default (unsupported, 2.3+ only) + * @param string $contentTpl The content template + * @param array $vars Template variables to send to the template engine + * + * @return bool + */ + public function render($canvasTpl = null, $pageTpl = null, $contentTpl = null, $vars = array()) + { + if ($this->renderCount) { + return false; + } + $xoops = Xoops::getInstance(); + $xoops->logger->startTime('Page rendering'); + + $cache = XoopsCache::getInstance(); + + //Get meta information for cached pages + if ($this->contentCacheLifetime && $this->contentCacheId && $content = $cache->read($this->contentCacheId, $this->headersCacheEngine)) { + //we need to merge metas set by blocks with the module cached meta + $this->htmlHeadStrings = array_merge($this->htmlHeadStrings, $content['htmlHeadStrings']); + foreach ($content['metas'] as $type => $value) { + $this->metas[$type] = array_merge($this->metas[$type], $content['metas'][$type]); + } + $xoops->setOption('xoops_pagetitle', $content['xoops_pagetitle']); + $xoops->setOption('xoops_module_header', $content['header']); + } + + if ($xoops->getOption('xoops_pagetitle')) { + $this->template->assign('xoops_pagetitle', $xoops->getOption('xoops_pagetitle')); + } + $header = !$xoops->getOption('xoops_module_header') ? $this->template->get_template_vars('xoops_module_header') : $xoops->getOption('xoops_module_header'); + + //save meta information of cached pages + if ($this->contentCacheLifetime && $this->contentCacheId && !$contentTpl) { + $content['htmlHeadStrings'] = (array)$this->htmlHeadStrings; + $content['metas'] = (array)$this->metas; + $content['xoops_pagetitle'] = $this->template->get_template_vars('xoops_pagetitle'); + $content['header'] = $header; + $cache = XoopsCache::getInstance(); + $cache->write($this->contentCacheId, $content, $this->headersCacheEngine); + } + + // @internal : Lame fix to ensure the metas specified in the xoops config page don't appear twice + $old = array('robots', 'keywords', 'description', 'rating', 'author', 'copyright'); + foreach ($this->metas['meta'] as $name => $value) { + if (in_array($name, $old)) { + $this->template->assign("xoops_meta_$name", htmlspecialchars($value, ENT_QUOTES)); + unset($this->metas['meta'][$name]); + } + } + + // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and $this->template->get_template_vars( 'xoops_module_header' ) ? + $this->template->assign('xoops_module_header', $this->renderMetas(null, true) . "\n" . $header); + + if ($canvasTpl) { + $this->canvasTemplate = $canvasTpl; + } + if ($contentTpl) { + $this->contentTemplate = $contentTpl; + } + if (!empty($vars)) { + $this->template->assign($vars); + } + if ($this->contentTemplate) { + $this->content = $this->template->fetch($this->contentTemplate, $this->contentCacheId); + } + if ($this->bufferOutput) { + $this->content .= ob_get_contents(); + ob_end_clean(); + } + + $this->template->assign_by_ref('xoops_contents', $this->content); + + // Do not cache the main (theme.html) template output + $this->template->caching = 0; + $this->template->display($this->path . '/' . $this->canvasTemplate); + $this->renderCount++; + $xoops->logger->stopTime('Page rendering'); + return true; + } + + /** + * Load localization information + * Folder structure for localization: + * <ul>themes/themefolder/english + * <li>main.php - language definitions</li> + * <li>style.css - localization stylesheet</li> + * <li>script.js - localization script</li> + * </ul> + * + * @param string $type + * + * @return bool + */ + public function loadLocalization($type = "main") + { + $xoops = Xoops::getInstance(); + $language = $xoops->getConfig('language'); + // Load global localization stylesheet if available + if (file_exists($xoops->path('language/' . $language . '/style.css'))) { + $this->addStylesheet($xoops->url('language/' . $language . '/style.css')); + } + $this->addLanguage($type); + // Load theme localization stylesheet and scripts if available + if (file_exists($this->path . '/language/' . $language . '/script.js')) { + $this->addScript($this->url . '/language/' . $language . '/script.js'); + } + if (file_exists($this->path . '/language/' . $language . '/style.css')) { + $this->addStylesheet($this->url . '/language/' . $language . '/style.css'); + } + return true; + } + + /** + * Load theme specific language constants + * + * @param string $type language type, like 'main', 'admin'; Needs to be declared in theme xo-info.php + * @param string $language specific language + * + * @return bool|mixed + */ + public function addLanguage($type = "main", $language = null) + { + $xoops = Xoops::getInstance(); + $language = is_null($language) ? $xoops->getConfig('language') : $language; + if (!file_exists($file = $xoops->path($this->resourcePath("/language/{$language}/{$type}.php")))) { + if (!file_exists($file = $xoops->path($this->resourcePath("/language/english/{$type}.php")))) { + return false; + } + } + $ret = include_once $file; + return $ret; + } + + /** + * *#@+ + * @tasktype 20 Manipulating page meta-information + */ + /** + * Adds script code to the document head + * This methods allows the insertion of an external script file (if $src is provided), or + * of a script snippet. The file URI is parsed to take benefit of the theme resource + * overloading system. + * The $attributes parameter allows you to specify the attributes that will be added to the + * inserted <script> tag. If unspecified, the <var>type</var> attribute value will default to + * 'text/javascript'. + * <code> + * // Add an external script using a physical path + * $theme->addScript( 'www/script.js', null, '' ); + * $theme->addScript( 'modules/newbb/script.js', null, '' ); + * // Specify attributes for the <script> tag + * $theme->addScript( 'mod_xoops_SiteManager#common.js', array( 'type' => 'application/x-javascript' ), '' ); + * // Insert a code snippet + * $theme->addScript( null, array( 'type' => 'application/x-javascript' ), 'window.open("Hello world");' ); + * </code> + * + * @param string $src path to an external script file + * @param array $attributes hash of attributes to add to the <script> tag + * @param string $content Code snippet to output within the <script> tag + * + * @return void + */ + public function addScript($src = '', $attributes = array(), $content = '', $name = '') + { + $xoops = Xoops::getInstance(); + if (empty($attributes)) { + $attributes = array(); + } + if (!empty($src)) { + $attributes['src'] = $xoops->url($this->resourcePath($src));; + } + if (!empty($content)) { + $attributes['_'] = $content; + } + if (!isset($attributes['type'])) { + $attributes['type'] = 'text/javascript'; + } + if (empty($name)) { + if (!empty($src)) { + $name = md5($xoops->url($this->resourcePath($src))); + } else { + $name = md5($content); + } + } + $this->addMeta('script', $name, $attributes); + } + + /** + * Add StyleSheet or CSS code to the document head + * + * @param string|null $src path to .css file + * @param array|null $attributes name => value paired array of attributes such as title + * @param string $content CSS code to output between the <style> tags (in case $src is empty) + * + * @return void + */ + public function addStylesheet($src = '', $attributes = array(), $content = '', $name = '') + { + $xoops = Xoops::getInstance(); + if (empty($attributes)) { + $attributes = array(); + } + if (!empty($src)) { + $attributes['href'] = $xoops->url($this->resourcePath($src)); + } + if (!isset($attributes['type'])) { + $attributes['type'] = 'text/css'; + } + if (!empty($content)) { + $attributes['_'] = $content; + } + if (empty($name)) { + if (!empty($src)) { + $name = md5($xoops->url($this->resourcePath($src))); + } else { + $name = md5($content); + } + } + $this->addMeta('stylesheet', $name, $attributes); + } + + /** + * Add a <link> to the header + * + * @param string $rel Relationship from the current doc to the anchored one + * @param string $href URI of the anchored document + * @param array $attributes Additional attributes to add to the <link> element + */ + public function addLink($rel, $href = '', $attributes = array(), $name = '') + { + if (empty($attributes)) { + $attributes = array(); + } + if (!empty($href)) { + $attributes['href'] = $href; + } + $attributes['rel'] = $rel; + if (empty($name)) { + if (!empty($rel)) { + $name = md5($rel.$href); + } else { + $name = md5($href); + } + } + $this->addMeta('link', $name, $attributes); + } + + /** + * Set a meta http-equiv value + * + * @param string $name + * @param null $value + * + * @return bool|string + */ + public function addHttpMeta($name, $value = null) + { + if (isset($value)) { + return $this->addMeta('http', $name, $value); + } + unset($this->metas['http'][$name]); + return false; + } + + /** + * Change output page meta-information + * + * @param string $type + * @param string $name + * @param string $value + * + * @return string + */ + public function addMeta($type = 'meta', $name = '', $value = '') + { + if (!isset($this->metas[$type])) { + $this->metas[$type] = array(); + } + if (!empty($name)) { + $this->metas[$type][$name] = $value; + } else { + $this->metas[$type][md5(serialize(array($value)))] = $value; + } + return $value; + } + + /** + * XoopsTheme::headContent() + * + * @param $params + * @param $content + * @param $smarty + * @param $repeat + * + * @return void + */ + public function headContent($params, $content, &$smarty, &$repeat) + { + if (!$repeat) { + $this->htmlHeadStrings[] = $content; + } + } + + /** + * XoopsTheme::renderMetas() + * + * @param null $type + * @param bool|string $return + * + * @return bool|string + */ + public function renderMetas($type = null, $return = false) + { + $str = ''; + if (!isset($type)) { + foreach (array_keys($this->metas) as $type) { + $str .= $this->renderMetas($type, true); + } + $str .= implode("\n", $this->htmlHeadStrings); + } else { + switch ($type) { + case 'script': + foreach ($this->metas[$type] as $attrs) { + $str .= "<script" . $this->renderAttributes($attrs) . ">"; + if (@$attrs['_']) { + $str .= "\n//<![CDATA[\n" . $attrs['_'] . "\n//]]>"; + } + $str .= "</script>\n"; + } + break; + case 'link': + foreach ($this->metas[$type] as $attrs) { + $rel = $attrs['rel']; + unset($attrs['rel']); + $str .= '<link rel="' . $rel . '"' . $this->renderAttributes($attrs) . " />\n"; + } + break; + case 'stylesheet': + foreach ($this->metas[$type] as $attrs) { + if (@$attrs['_']) { + $str .= '<style' . $this->renderAttributes($attrs) . ">\n/* <![CDATA[ */\n" . $attrs['_'] . "\n/* //]]> */\n</style>"; + } else { + $str .= '<link rel="stylesheet"' . $this->renderAttributes($attrs) . " />\n"; + } + } + break; + case 'http': + foreach ($this->metas[$type] as $name => $content) { + $str .= '<meta http-equiv="' . htmlspecialchars($name, ENT_QUOTES) . '" content="' . htmlspecialchars($content, ENT_QUOTES) . "\" />\n"; + } + break; + default: + foreach ($this->metas[$type] as $name => $content) { + $str .= '<meta name="' . htmlspecialchars($name, ENT_QUOTES) . '" content="' . htmlspecialchars($content, ENT_QUOTES) . "\" />\n"; + } + break; + } + } + if ($return) { + return $str; + } + echo $str; + return true; + } + + /** + * Generates a unique element ID + * + * @param string $tagName + * + * @return string + */ + public function genElementId($tagName = 'xos') + { + static $cache = array(); + if (!isset($cache[$tagName])) { + $cache[$tagName] = 1; + } + return $tagName . '-' . $cache[$tagName]++; + } + + /** + * Transform an attributes collection to an XML string + * + * @param array $coll + * + * @return string + */ + public function renderAttributes($coll) + { + $str = ''; + foreach ($coll as $name => $val) { + if ($name != '_') { + $str .= ' ' . $name . '="' . htmlspecialchars($val, ENT_QUOTES) . '"'; + } + } + return $str; + } + + /** + * Return a themable file resource path + * + * @param string $path + * + * @return string + */ + public function resourcePath($path) + { + if (substr($path, 0, 1) == '/') { + $path = substr($path, 1); + } + + if (file_exists(XOOPS_ROOT_PATH . "/{$this->themesPath}/{$this->folderName}/{$path}")) { + return "{$this->themesPath}/{$this->folderName}/{$path}"; + } + + if (file_exists(XOOPS_ROOT_PATH . "/themes/{$this->folderName}/{$path}")) { + return "themes/{$this->folderName}/{$path}"; + } + return $path; + } +} + +abstract class XoopsThemePlugin +{ + /** + * @var XoopsTheme + */ + public $theme = false; + + abstract function xoInit(); +} \ No newline at end of file Added: XoopsCore/branches/tasks/2.6.0-wishcraft/robots.txt =================================================================== --- XoopsCore/branches/tasks/2.6.0-wishcraft/robots.txt (rev 0) +++ XoopsCore/branches/tasks/2.6.0-wishcraft/robots.txt 2012-04-29 16:36:18 UTC (rev 9404) @@ -0,0 +1,14 @@ +User-agent: * +Sitemap: /sitemap.php +Disallow: /cgi-bin/ +Disallow: /tmp/ +Disallow: /cache/ +Disallow: /class/ +Disallow: /images/ +Disallow: /include/ +Disallow: /install/ +Disallow: /kernel/ +Disallow: /language/ +Disallow: /templates_c/ +Disallow: /themes/ +Disallow: /uploads/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |