diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2005-08-07 17:38:46 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2005-08-07 17:38:46 +0000 |
| commit | 9c0bc34cd6ddd8b7ca3a3d5b3449e7fe2b8f8d7e (patch) | |
| tree | e42aa7231eee31693b9f0d6b3a6e333ec3c11a6f | |
| parent | d8ff95cda92d9edb30f1372492327a3904d194b7 (diff) | |
| download | kernel-9c0bc34cd6ddd8b7ca3a3d5b3449e7fe2b8f8d7e.tar.gz kernel-9c0bc34cd6ddd8b7ca3a3d5b3449e7fe2b8f8d7e.tar.bz2 kernel-9c0bc34cd6ddd8b7ca3a3d5b3449e7fe2b8f8d7e.zip | |
merge recent changes from R1 to HEAD
52 files changed, 856 insertions, 732 deletions
diff --git a/Bablotron.php b/Bablotron.php index 6c40a47..8eb5a51 100644 --- a/Bablotron.php +++ b/Bablotron.php @@ -1,6 +1,9 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/Bablotron.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ + * Spellcheck Library + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/Bablotron.php,v 1.3 2005/08/07 17:38:44 squareing Exp $ * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org @@ -8,22 +11,19 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: Bablotron.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ + * $Id: Bablotron.php,v 1.3 2005/08/07 17:38:44 squareing Exp $ * * A spell checking library. * * Currently used for BitBase. * @author lrargerich <lrargerich@yahoo.com> - * - * @package kernel + * created 2002/11/14 */ /** - * @package kernel - * @subpackage Bablotron - * - * created 2002/11/14 + * Spellcheck Library * + * @package kernel * @todo does not need to inherit BitBase class. Should hold a BitDb connection as a * global variable. */ @@ -124,7 +124,7 @@ class Bablotron extends BitBase $word = addslashes( ( trim( $word ) ) ); $sndx = substr($word, 0, 2); $query = "select `word` AS word from `$tbl` where `di`=?"; - @$result = $this->query($query, array($sndx)); + @$result = $this->mDb->query($query, array($sndx)); while ($res = $result->fetchRow() ) { $tword = $res["word"]; @@ -159,7 +159,7 @@ class Bablotron extends BitBase $tbl = 'babl_words_' . $this->lan; $word = addslashes( ( trim( $word ) ) ); $query = "select `word` AS word from `$tbl` where `word`=?"; - $result = $this->query($query,array($word)); + $result = $this->mDb->query($query,array($word)); return $result->numRows(); } /** diff --git a/BitBase.php b/BitBase.php index 07252e3..be919eb 100755 --- a/BitBase.php +++ b/BitBase.php @@ -1,24 +1,21 @@ <?php /** -* $Header: /cvsroot/bitweaver/_bit_kernel/BitBase.php,v 1.4 2005/08/01 18:40:32 squareing Exp $ -* -* Copyright (c) 2004 bitweaver.org -* All Rights Reserved. See copyright.txt for details and a complete list of authors. -* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -* -* $Id: BitBase.php,v 1.4 2005/08/01 18:40:32 squareing Exp $ -* -* Virtual base class (as much as one can have such things in PHP) for all -* derived tikiwiki classes that require database access. -* -* @package kernel -* -* created 2004/8/15 -* -* @author spider <spider@steelsun.com> -* -* @version $Revision: 1.4 $ $Date: 2005/08/01 18:40:32 $ $Author: squareing $ -*/ + * Virtual bitweaver base class + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitBase.php,v 1.5 2005/08/07 17:38:44 squareing Exp $ + * + * Copyright (c) 2004 bitweaver.org + * All Rights Reserved. See copyright.txt for details and a complete list of authors. + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details + * + * Virtual base class (as much as one can have such things in PHP) for all + * derived tikiwiki classes that require database access. + * + * created 2004/8/15 + * + * @author spider <spider@steelsun.com> + */ /** * required setup @@ -31,11 +28,11 @@ define( 'STORAGE_BINARY', 1 ); define( 'STORAGE_IMAGE', 2 ); /** -* @package kernel -* @subpackage BitBase -* Virtual base class (as much as one can have such things in PHP) for all -* derived bitweaver classes that require database access. -*/ + * Virtual base class (as much as one can have such things in PHP) for all + * derived bitweaver classes that require database access. + * + * @package kernel + */ class BitBase { /** @@ -64,6 +61,11 @@ class BitBase */ var $mDb; /** + * Used to store database type + * @private + */ + var $dType; + /** * Standard Query Cache Time. Variable can be set to 0 to flush particular queries * @private */ @@ -86,8 +88,9 @@ class BitBase if(is_object($gBitDb)) { $this->setDatabase($gBitDb); } - $this->mErrors = array(); + $this->mErrors = array(); } + /** * Sets database mechanism for the instance * @param pDB the instance of the database mechanism @@ -96,15 +99,36 @@ class BitBase { // set internal db and retrieve values $this->mDb = &$pDB; + $this->dType = $this->mDb->mType; } + /** - * Determines if there is a valide database connection - **/ + * Determines if there is a valide database connection + **/ function isDatabaseValid() { return( !empty( $this->mDb->mDb ) && $this->mDb->mDb->_connectionID ); } /** + * Return pointer to current Database + **/ + function getDb() { + return ( !empty( $this->mDb ) ? $this->mDb : NULL ); + } + + /** + * Switch debug level in database + * + **/ + function debug( $pLevel = 99 ) { + if( is_object( $this->mDb ) ) { + $this->mDb->debug( $pLevel ); + } + } + + // =-=-=-=-=-=-=-=-=-=-=- Non-DB related functions =-=-=-=-=-=-=-=-=-=-=-=-= + + /** * Determines if any given variable exists and is a number **/ function verifyId( $pId ) { @@ -150,108 +174,6 @@ class BitBase return $gBitSystem->getPreference( $pName, $pDefault ); } -/* - function get_user_preference($pUserId, $name, $default = '') { - global $user_preferences; - - if (!$pUserId) - return NULL; - - / **** Quick Hack **** - We need to convert all calls to get_user_preference so they pass the id and not the username - This will handle legacy calls until they are all changed - ********************* / - if (!is_numeric($pUserId)) { - $query = "SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` where `login` = ?"; - $result = $this->query($query, array($pUserId)); - $pUserId = $result->fields['user_id']; - if (!$pUserId) return NULL; - } - / **** End quick hack *** / - - if (!isset($user_preferences[$pUserId][$name])) { - $query = "select `value` - FROM `".BIT_DB_PREFIX."tiki_user_preferences` tup where `pref_name`=? AND tup.`user_id`= ?"; - - $result = $this->query($query, array( "$name", $pUserId)); - - if ($result->numRows()) { - $res = $result->fetchRow(); - - $user_preferences[$pUserId][$name] = $res["value"]; - } else { - $user_preferences[$pUserId][$name] = $default; - } - } - - return $user_preferences[$pUserId][$name]; - } -*/ - function debug( $pLevel = 99 ) { - if( is_object( $this->mDb ) ) { - $this->mDb->debug( $pLevel ); - } - } - - function query($pQuery, $pValues = NULL, $pNumRows =BIT_QUERY_DEFAULT, $pOffset=BIT_QUERY_DEFAULT, $pCacheTime=BIT_QUERY_DEFAULT ) { - return $this->mDb->query($pQuery, $pValues, $pNumRows, $pOffset, $pCacheTime); - } - - function getAssoc($pQuery, $pValues=FALSE, $pForceArray=FALSE, $pFirst2Cols=FALSE, $pCacheTime=BIT_QUERY_DEFAULT) { - return $this->mDb->getAssoc($pQuery, $pValues, $pForceArray, $pFirst2Cols,$pCacheTime); - } - - function getOne($pQuery, $pValues = NULL, $pNumRows = 0, $pOffset = 0, $pCacheTime=BIT_QUERY_DEFAULT) { - return $this->mDb->getOne($pQuery, $pValues, $pNumRows, $pOffset,$pCacheTime); - } - - function convert_binary() { - return $this->mDb->convert_binary(); - } - - function convert_sortmode($pSortMode) { - return $this->mDb->convert_sortmode($pSortMode); - - } - function sql_cast($pVar,$pType) { - return $this->mDb->sql_cast($pVar,$pType); - - } - - function associateInsert($insertTable, $insertData) { - return $this->mDb->associateInsert($insertTable, $insertData); - } - - function associateUpdate($updateTable, $updateData, $updateId) { - return $this->mDb->associateUpdate($updateTable, $updateData, $updateId); - } - - function GenID( $seqTitle ) { - return $this->mDb->GenID( $seqTitle ); - } - - /** Calls ADODB method to begin a transaction, calls can be nested - */ - function StartTrans() { - return $this->mDb->StartTrans(); - } - - /** Calls ADODB method to finalize a transaction, calls can be nested - */ - function CompleteTrans() { - return $this->mDb->CompleteTrans(); - } - - function RollbackTrans() { - return $this->mDb->RollbackTrans(); - } - - function MetaTables( $ttype = false, $showSchema = false, $mask=false ) { - return $this->mDb->MetaTables( $ttype, $showSchema, $mask ); - } - - // =-=-=-=-=-=-=-=-=-=-=- Non-DB related functions =-=-=-=-=-=-=-=-=-=-=-=-= - /** * Prepares parameters with default values for any getList function * @param pParamHash hash of parameters for any getList() function diff --git a/BitCache.php b/BitCache.php index 5b24dc1..4456746 100644 --- a/BitCache.php +++ b/BitCache.php @@ -1,34 +1,32 @@ <?php /** -* $Header: /cvsroot/bitweaver/_bit_kernel/BitCache.php,v 1.3 2005/08/04 12:21:58 lsces Exp $ -* -* Copyright (c) 2004 bitweaver.org -* Copyright (c) 2003 tikwiki.org -* Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. -* All Rights Reserved. See copyright.txt for details and a complete list of authors. -* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -* -* $Id: BitCache.php,v 1.3 2005/08/04 12:21:58 lsces Exp $ -* -* A basic library to handle caching of some Tiki Objects. Usage is simple and feel free to improve it. -* -* Currently used to cache user permissions only. Could be used to store blobs to files and other static -* database intensive queries. -* -* @package kernel -* -* created 2003/11/25 -* -* @author lrargerich <lrargerich@yahoo.com> -* -* @version $Revision: 1.3 $ $Date: 2005/08/04 12:21:58 $ $Author: lsces $ -* -* @todo Need to implement in more places -*/ + * Basic cache handling + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitCache.php,v 1.4 2005/08/07 17:38:44 squareing Exp $ + * + * Copyright (c) 2004 bitweaver.org + * Copyright (c) 2003 tikwiki.org + * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. + * All Rights Reserved. See copyright.txt for details and a complete list of authors. + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details + * + * A basic library to handle caching of some Tiki Objects. Usage is simple and feel free to improve it. + * + * Currently used to cache user permissions only. Could be used to store blobs to files and other static + * database intensive queries. + * + * created 2003/11/25 + * + * @author lrargerich <lrargerich@yahoo.com> + * + * @todo Need to implement in more places + */ /** + * A basic library to handle caching of some Tiki Objects. Usage is simple and feel free to improve it. + * * @package kernel - * @subpackage BitCache */ class BitCache { @@ -77,7 +75,7 @@ class BitCache $file = "$cache_folder/$pKey"; $x = serialize($pData); if(!function_exists("file_put_contents")) - require_once(UTIL_PKG_PATH."PHP_Compat/Compat/Function/file_put_contents.php"); + require_once("PHP_Compat/Compat/Function/file_put_contents.php"); file_put_contents($file,$x); } else diff --git a/BitDate.php b/BitDate.php index 441975d..7a7fa6a 100644 --- a/BitDate.php +++ b/BitDate.php @@ -1,11 +1,12 @@ <?php /** + * Date Handling Class + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitDate.php,v 1.3 2005/08/07 17:38:44 squareing Exp $ * * Created by: Jeremy Jongsma (jjongsma@tickchat.com) * Created on: Sat Jul 26 11:51:31 CDT 2003 - * - * @package kernel - * @subpackage BitDate */ /** @@ -19,11 +20,10 @@ * - Display dates will be computed based on the preferred * display offset specified in the constructor * + * @package kernel + * * @todo As of 1.7, dates are still stored in server local time. * This should be changed for 1.7.1 (requires many module changes). - * - * @package kernel - * @subpackage BitDate */ class BitDate { /** @@ -1,19 +1,18 @@ <?php /** -* @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/BitDb.php,v 1.7 2005/07/25 20:02:08 squareing Exp $ -* -* @package kernel -* -* @author spider <spider@steelsun.com> -* -* Copyright (c) 2004 bitweaver.org -* Copyright (c) 2003 tikwiki.org -* Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. -* All Rights Reserved. See copyright.txt for details and a complete list of authors. -* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -* -* $Id: BitDb.php,v 1.7 2005/07/25 20:02:08 squareing Exp $ -*/ + * ADOdb Library interface Class + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/BitDb.php,v 1.8 2005/08/07 17:38:44 squareing Exp $ + * + * Copyright (c) 2004 bitweaver.org + * Copyright (c) 2003 tikwiki.org + * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. + * All Rights Reserved. See copyright.txt for details and a complete list of authors. + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details + * + * @author spider <spider@steelsun.com> + */ /** * ensure your AdoDB install is a subdirectory off your include path @@ -23,17 +22,14 @@ require_once( KERNEL_PKG_PATH.'bit_error_inc.php' ); define( 'BIT_QUERY_DEFAULT', -1 ); /** -* This class is used for database access and provides a number of functions to help -* with database portability. -* -* Currently used as a base class, this class should be optional to ensure bitweaver -* continues to function correctly, without a valid database connection. -* -* created -* -* @package kernel -* @subpackage BitDb -*/ + * This class is used for database access and provides a number of functions to help + * with database portability. + * + * Currently used as a base class, this class should be optional to ensure bitweaver + * continues to function correctly, without a valid database connection. + * + * @package kernel + */ class BitDb { /** @@ -311,6 +307,7 @@ class BitDb { return $this->mDb->qstr($pStr); } + /** Queries the database, returning an error if one occurs, rather * than exiting while printing the error. -rlpowell * @param pQuery the SQL query. Use backticks (`) to quote all table @@ -341,6 +338,7 @@ class BitDb //$this->debugger_log($pQuery, $pValues); return $result; } + /** Queries the database reporting an error if detected * than exiting while printing the error. -rlpowell * @param pQuery the SQL query. Use backticks (`) to quote all table @@ -386,10 +384,23 @@ class BitDb return $result; } - // ADODB compatibility functions for bitcommerce + /** + * ADODB compatibility functions for bitcommerce + */ function Execute($pQuery, $pNumRows = false, $zf_cache = false, $pCacheTime=0) { return $this->query( $pQuery, NULL, $pNumRows, BIT_QUERY_DEFAULT, $pCacheTime ); } + + /** + * List columns in a database as an array of ADOFieldObjects. + * See top of file for definition of object. + * + * @param table table name to query + * @param upper uppercase table name (required by some databases) + * schema is optional database schema to use - not supported by all databases. + * + * @return array of ADOFieldObjects for current table. + */ function MetaColumns($table,$normalize=true) { return $this->mDb->MetaColumns( $table, $normalize ); } @@ -405,6 +416,7 @@ class BitDb * @return the associative array, or false if an error occurs * @todo not currently used anywhere */ + function getCol( $pQuery, $pValues=FALSE, $pTrim=FALSE ) { if( empty( $this->mDb ) ) { @@ -439,6 +451,7 @@ class BitDb $this->queryComplete(); return $result; } + /** Executes the SQL and returns the first row as an array. The recordset and remaining rows are discarded for you automatically. If an error occurs, false is returned. * See AdoDB GetRow() function for more detail. * @param pQuery the SQL query. Use backticks (`) to quote all table @@ -462,6 +475,9 @@ class BitDb return $result; } + /** + * Used to start query timer if in debug mode + */ function queryStart() { global $gDebug; if( $gDebug ) { @@ -471,6 +487,9 @@ class BitDb } } + /** + * Used to stop query tracking and output results if in debug mode + */ function queryComplete() { global $num_queries; //count the number of queries made @@ -507,9 +526,15 @@ class BitDb list($key, $value) = each($res); return $value; } - // This function will take a set of fields identified by an associative array - $insertData - // generate a suitable SQL script - // and insert the data into the specified table - $insertTable + + /** + * This function will take a set of fields identified by an associative array - $insertData + * generate a suitable SQL script + * and insert the data into the specified table - $insertTable + * @param insertTable Name of the table to be inserted into + * @param insertData Array of data to be inserted. Array keys provide the field names + * @return Error status of the insert + */ function associateInsert( $insertTable, $insertData ) { $setSql = ( '`'.implode( array_keys( $insertData ), '`, `' ).'`' ); //stupid little loop to generate question marks. Start at one, and tack at the end to ease dealing with comma @@ -528,10 +553,17 @@ class BitDb $result = $this->query( $query, array_values( $insertData ) ); } - // This function will take a set of fields identified by an associative array - $updateData - // generate a suitable SQL script - // update the data into the specified table - $insertTable - // at the location identified in updateId which holds a name and value entry + /** + * This function will take a set of fields identified by an associative array - $updateData + * generate a suitable SQL script + * update the data into the specified table + * at the location identified in updateId which holds a name and value entry + * @param updateTable Name of the table to be updated + * @param updateData Array of data to be changed. Array keys provide the field names + * @param updateId Array identifying the record to update. + * Array key 'name' provide the field name, and 'value' the record key + * @return Error status of the insert + */ function associateUpdate( $updateTable, $updateData, $updateId ) { $setSql = ( '`'.implode( array_keys( $updateData ), '`=?, `' ).'`=?' ); $bindVars = array_values( $updateData ); @@ -543,6 +575,14 @@ class BitDb $query = "UPDATE $updateTable SET $setSql WHERE `".$updateId["name"]."`=?"; $result = $this->query( $query, $bindVars ); } + + /** + * A database portable Sequence management function. + * + * @param pSequenceName Name of the sequence to be used + * It will be created if it does not already exist + * @return 0 if not supported, otherwise a sequence id + */ function GenID( $pSequenceName ) { if( empty( $this->mDb ) ) { return FALSE; @@ -550,7 +590,24 @@ class BitDb return $this->mDb->GenID( str_replace("`","",BIT_DB_PREFIX).$pSequenceName ); } - /** A database portable IFNULL function. + /** + * A database portable Sequence management function. + * + * @param pSequenceName Name of the sequence to be used + * It will be created if it does not already exist + * @param pStartID Allows setting the initial value of the sequence + * @return 0 if not supported, otherwise a sequence id + * @todo To be combined with GenID + */ + function CreateSequence($seqname='adodbseq',$startID=1) + { + if (empty($this->_genSeqSQL)) return FALSE; + return $this->mDb->Execute(sprintf($this->_genSeqSQL,$seqname,$startID)); + } + + /** + * A database portable IFNULL function. + * * @param pField argument to compare to NULL * @param pNullRepl the NULL replacement value * @return a string that represents the function that checks whether @@ -561,6 +618,7 @@ class BitDb { return $this->mDb->ifNull($pField, $pNullRepl); } + /** Format the timestamp in the format the database accepts. * @param pDate a Unix integer timestamp or an ISO format Y-m-d H:i:s * @return the timestamp as a quoted string. @@ -573,9 +631,27 @@ class BitDb //return preg_replace("/'/","", $this->mDb->DBTimeStamp($pDate)); return $this->mDb->DBTimeStamp($pDate); } + + /** + * Format date column in sql string given an input format that understands Y M D + */ function SQLDate($pDateFormat, $pBaseDate=false) { return $this->mDb->SQLDate($pDateFormat, $pBaseDate) ; } + + /** + * Calculate the offset of a date for a particular database and generate + * appropriate SQL. Useful for calculating future/past dates and storing + * in a database. + * @param pDays Number of days to offset by + * If dayFraction=1.5 means 1.5 days from now, 1.0/24 for 1 hour. + * @param pColumn Value to be offset + * If NULL an offset from the current time is supplied + * @return New number of days + * + * @todo Not currently used - this is database specific and uses TIMESTAMP + * rather than unix seconds + */ function OffsetDate( $pDays, $pColumn=NULL ) { return $this->mDb->OffsetDate( $pDays, $pColumn ); } @@ -619,6 +695,7 @@ class BitDb } } } + /** Converts field sorting abbreviation to SQL * @param pSortMode fieldname and sort order string (eg name_asc) * @return the correctly quoted SQL ORDER statement @@ -655,8 +732,17 @@ class BitDb switch ($this->mType) { case "firebird": + // Use of alias in order by is not supported because of optimizer processing if ( $pSortMode == 'page_name_asc' ) $pSortMode = 'title_asc'; if ( $pSortMode == 'page_name_desc' ) $pSortMode = 'title_desc'; + if ( $pSortMode == 'creator_user_asc' ) $pSortMode = 'uuc.login_asc'; + if ( $pSortMode == 'creator_user_desc' ) $pSortMode = 'uuc.login_desc'; + if ( $pSortMode == 'creator_real_name_asc' ) $pSortMode = 'uuc.real_name_asc'; + if ( $pSortMode == 'creator_real_name_desc' ) $pSortMode = 'uuc.real_name_desc'; + if ( $pSortMode == 'modifier_user_asc' ) $pSortMode = 'uue.login_asc'; + if ( $pSortMode == 'modifier_user_desc' ) $pSortMode = 'uue.login_desc'; + if ( $pSortMode == 'modifier_real_name_asc' ) $pSortMode = 'uue.real_name_asc'; + if ( $pSortMode == 'modifier_real_name_desc' ) $pSortMode = 'uue.real_name_desc'; case "oci8": case "sybase": case "mssql": @@ -678,6 +764,7 @@ class BitDb } return $pSortMode; } + /** Returns the keyword to force a column comparison to be case sensitive * for none case-sensitive databases (eg MySQL) * @return the SQL keyword @@ -697,6 +784,7 @@ class BitDb break; } } + /** Used to cast variable types for certain databases (ie SyBase & MSSQL) * @param pVar the variable value to cast * @param pType the current variable type @@ -801,24 +889,61 @@ class BitDb return $ret; } - /** Calls ADODB method to begin a transaction - */ + /** + * Improved method of initiating a transaction. Used together with CompleteTrans(). + * Advantages include: + * + * a. StartTrans/CompleteTrans is nestable, unlike BeginTrans/CommitTrans/RollbackTrans. + * Only the outermost block is treated as a transaction.<br> + * b. CompleteTrans auto-detects SQL errors, and will rollback on errors, commit otherwise.<br> + * c. All BeginTrans/CommitTrans/RollbackTrans inside a StartTrans/CompleteTrans block + * are disabled, making it backward compatible. + */ function StartTrans() { return $this->mDb->StartTrans(); } + /** + * Used together with StartTrans() to end a transaction. Monitors connection + * for sql errors, and will commit or rollback as appropriate. + * + * autoComplete if true, monitor sql errors and commit and rollback as appropriate, + * and if set to false force rollback even if no SQL error detected. + * @returns true on commit, false on rollback. + */ function CompleteTrans() { return $this->mDb->CompleteTrans(); } + /** + * If database does not support transactions, rollbacks always fail, so return false + * otherwise returns true if the Rollback was successful + * + * @return true/false. + */ function RollbackTrans() { return $this->mDb->RollbackTrans(); } + /** + * Create a list of tables available in the current database + * + * @param ttype can either be 'VIEW' or 'TABLE' or false. + * If false, both views and tables are returned. + * "VIEW" returns only views + * "TABLE" returns only tables + * @param showSchema returns the schema/user with the table name, eg. USER.TABLE + * @param mask is the input mask - only supported by oci8 and postgresql + * + * @return array of tables for current database. + */ function MetaTables( $ttype = false, $showSchema = false, $mask=false ) { return $this->mDb->MetaTables( $ttype, $showSchema, $mask ); } + /** + * Check for Postgres specific extensions + */ function isAdvancedPostgresEnabled() { // This code makes use of the badass /usr/share/pgsql/contrib/tablefunc.sql // contribution that you have to install like: psql foo < /usr/share/pgsql/contrib/tablefunc.sql diff --git a/BitPreferences.php b/BitPreferences.php index abcfb1b..6d40b06 100755 --- a/BitPreferences.php +++ b/BitPreferences.php @@ -1,33 +1,33 @@ <?php /** -* $Header: /cvsroot/bitweaver/_bit_kernel/Attic/BitPreferences.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ -* -* Copyright (c) 2004 bitweaver.org -* Copyright (c) 2003 tikwiki.org -* Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. -* All Rights Reserved. See copyright.txt for details and a complete list of authors. -* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -* -* $Id: BitPreferences.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ -* -* A class used to store and retrieve preferences. Defaults are set -* programmatically. Storage can be with or without a database. -* -* Currently use to store sitewide preferences -* -* @package kernel -* -* created 2004/8/15 -* -* @author wolff_borg <wolff_borg@yahoo.com.au> -* -* @version $Revision: 1.2 $ $Date: 2005/06/28 07:45:45 $ $Author: spiderr $ -* @todo Could be subclassed to store user preferences. -*/ + * Preferences Management Class + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/BitPreferences.php,v 1.3 2005/08/07 17:38:44 squareing Exp $ + * + * Copyright (c) 2004 bitweaver.org + * Copyright (c) 2003 tikwiki.org + * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. + * All Rights Reserved. See copyright.txt for details and a complete list of authors. + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details + * + * A class used to store and retrieve preferences. Defaults are set + * programmatically. Storage can be with or without a database. + * + * Currently use to store sitewide preferences + * + * created 2004/8/15 + * + * @author wolff_borg <wolff_borg@yahoo.com.au> + * + * @todo Could be subclassed to store user preferences. + */ /** + * A class used to store and retrieve preferences. Defaults are set + * programmatically. Storage can be with or without a database. + * * @package kernel - * @subpackage BitPreferences */ class BitPreferences { diff --git a/BitSmarty.php b/BitSmarty.php index a2ddd7a..84adc36 100755 --- a/BitSmarty.php +++ b/BitSmarty.php @@ -1,8 +1,10 @@ <?php /** -* @version $Header: /cvsroot/bitweaver/_bit_kernel/BitSmarty.php,v 1.4 2005/08/01 18:40:32 squareing Exp $ -* @package Smarty -*/ + * Smarty Library Inteface Class + * + * @package Smarty + * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitSmarty.php,v 1.5 2005/08/07 17:38:44 squareing Exp $ + */ // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // All Rights Reserved. See copyright.txt for details and a complete list of authors. @@ -25,9 +27,10 @@ if( file_exists( SMARTY_DIR.'Smarty.class.php' ) ) { require_once($smartyIncFile); /** -* @package Smarty -* @subpackage PermissionCheck -*/ + * PermissionCheck + * + * @package kernel + */ class PermissionCheck { function check( $perm ) { global $gBitUser; @@ -36,9 +39,10 @@ class PermissionCheck { } /** -* @package Smarty -* @subpackage BitSmarty -*/ + * BitSmarty + * + * @package kernel + */ class BitSmarty extends Smarty { function BitSmarty() diff --git a/BitSystem.php b/BitSystem.php index 2f46a82..0d93eff 100755 --- a/BitSystem.php +++ b/BitSystem.php @@ -1,9 +1,11 @@ <?php /** -* @package kernel -* @author spider <spider@steelsun.com> -* @version $Revision: 1.11 $ -*/ + * Main bitweaver systems functions + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitSystem.php,v 1.12 2005/08/07 17:38:44 squareing Exp $ + * @author spider <spider@steelsun.com> + */ // +----------------------------------------------------------------------+ // | PHP version 4.?? // +----------------------------------------------------------------------+ @@ -17,9 +19,6 @@ // | -> see http://pear.php.net/manual/en/standards.comments.php // | and http://www.phpdoc.org/ // +----------------------------------------------------------------------+ -// | Authors: spider <spider@steelsun.com> -// +----------------------------------------------------------------------+ -// $Id: BitSystem.php,v 1.11 2005/08/01 18:40:32 squareing Exp $ /** * required setup @@ -46,16 +45,11 @@ define('HOMEPAGE_LAYOUT', 'home'); * is Package specific should be moved into that package * * @author spider <spider@steelsun.com> - * @version $Revision: 1.11 $ + * * @package kernel - * @subpackage BitSystem */ class BitSystem extends BitBase { /** - * @package BitSystem - */ - // === properties - /** * * Array of * */ var $mAppMenu; @@ -92,7 +86,7 @@ class BitSystem extends BitBase $this->checkEnvironment(); $this->mAppMenu = array(); - $this->mTimer = new TikiTimer(); + $this->mTimer = new BitTimer(); $this->mTimer->start(); $this->initSmarty(); @@ -154,7 +148,7 @@ class BitSystem extends BitBase if ( empty( $this->mPrefs ) ) { $query = "SELECT `name` ,`value` FROM `" . BIT_DB_PREFIX . "tiki_preferences` " . $whereClause; - $rs = $this->query($query, $queryVars, -1, -1 ); + $rs = $this->mDb->query($query, $queryVars, -1, -1 ); if ($rs) { while (!$rs->EOF) { $this->mPrefs[$rs->fields['name']] = $rs->fields['value']; @@ -177,7 +171,6 @@ class BitSystem extends BitBase * @access public **/ function storePreference( $name, $value, $pPackageName=NULL ) { - global $gBitSystem; global $gMultisites; global $gRefreshSitePrefs; global $bitdomain; @@ -191,13 +184,13 @@ class BitSystem extends BitBase // store the preference in multisites, if used if( !empty( $gMultisites->mMultisiteId ) && isset( $gMultisites->mPrefs[$name] ) ) { $query = "UPDATE `".BIT_DB_PREFIX."tiki_multisite_preferences` SET `value`=? WHERE `multisite_id`=? AND `name`=?"; - $result = $this->query( $query, array( empty( $value ) ? '' : $value, $gMultisites->mMultisiteId, $name ) ); + $result = $this->mDb->query( $query, array( empty( $value ) ? '' : $value, $gMultisites->mMultisiteId, $name ) ); } else { $query = "DELETE FROM `".BIT_DB_PREFIX."tiki_preferences` WHERE `name`=?"; - $result = $this->query( $query, array( $name ) ); + $result = $this->mDb->query( $query, array( $name ) ); if( isset( $value ) ) { $query = "INSERT INTO `".BIT_DB_PREFIX."tiki_preferences`(`name`,`value`,`package`) VALUES (?,?,?)"; - $result = $this->query( $query, array( $name, $value, strtolower( $pPackageName ) ) ); + $result = $this->mDb->query( $query, array( $name, $value, strtolower( $pPackageName ) ) ); } } @@ -230,7 +223,7 @@ class BitSystem extends BitBase function expungePackagePreferences( $pPackageName ) { if( !empty( $pPackageName ) ) { $query = "DELETE FROM `".BIT_DB_PREFIX."tiki_preferences` WHERE `package`=?"; - $result = $this->query( $query, array( strtolower( $pPackageName ) ) ); + $result = $this->mDb->query( $query, array( strtolower( $pPackageName ) ) ); // let's force a reload of the prefs unset( $this->mPrefs ); $this->loadPreferences(); @@ -337,21 +330,20 @@ class BitSystem extends BitBase */ function preDisplay($pMid) { - global $gCenterPieces, $fHomepage, $gBitSmarty, $gBitUser, $gBitLoc, $gPreviewStyle; + global $gCenterPieces, $fHomepage, $gBitSmarty, $gBitUser, $gPreviewStyle; // setup our theme style and check if a preview theme has been picked if( $gPreviewStyle !== FALSE ) { $this->setStyle( $gPreviewStyle ); } - if (empty($gBitLoc['styleSheet'])) { - $gBitLoc['styleSheet'] = $this->getStyleCss(); + if (empty($this->mStyles['styleSheet'])) { + $this->mStyles['styleSheet'] = $this->getStyleCss(); } - $gBitLoc['headerIncFiles'] = $this->getHeaderIncFiles(); - $gBitLoc['browserStyleSheet'] = $this->getBrowserStyleCss(); - $gBitLoc['customStyleSheet'] = $this->getCustomStyleCss(); - $gBitLoc['altStyleSheets'] = $this->getAltStyleCss(); - $gBitLoc['THEMES_STYLE_URL'] = $this->getStyleUrl(); - $gBitLoc['JSCALENDAR_PKG_URL'] = UTIL_PKG_URL.'jscalendar/'; - $gBitSmarty->assign_by_ref("gBitLoc", $gBitLoc); + $this->mStyles['headerIncFiles'] = $this->getHeaderIncFiles(); + $this->mStyles['browserStyleSheet'] = $this->getBrowserStyleCss(); + $this->mStyles['customStyleSheet'] = $this->getCustomStyleCss(); + $this->mStyles['altStyleSheets'] = $this->getAltStyleCss(); + define( 'THEMES_STYLE_URL', $this->getStyleUrl() ); + define( 'JSCALENDAR_PKG_URL', UTIL_PKG_URL.'jscalendar/' ); // dont forget to assign slideshow stylesheet if we are viewing page as slideshow // $gBitSmarty->assign('slide_style', $this->getStyleCss("slide_style")); @@ -403,8 +395,7 @@ class BitSystem extends BitBase * @return array of paths to existing header_inc.tpl files */ function getHeaderIncFiles() { - global $gBitSystem, $gBitLoc; - foreach( $gBitSystem->mPackages as $package => $info ) { + foreach( $this->mPackages as $package => $info ) { $file = $info['path'].'templates/header_inc.tpl'; if( is_readable( $file ) ) { $ret[] = $file; @@ -459,8 +450,15 @@ class BitSystem extends BitBase if (defined( (strtoupper( $pPackageName ).'_PKG_NAME') ) ) { $name = strtolower( @constant( (strtoupper( $pPackageName ).'_PKG_NAME') ) ); if( $name ) { - // we have migrated the old tikiwiki feature_<package> to package_<package> just for (de)activating packages - $ret = ($this->getPreference('package_'.$name) == 'y'); + // kernel always active + if ($name == 'kernel') { + $ret = 1; + } + else { + // we have migrated the old tikiwiki feature_<pac + $ret = ($this->getPreference('package_'.$name) == 'y'); + } + } } @@ -505,7 +503,7 @@ class BitSystem extends BitBase $sql .= ' WHERE `package` = ? '; array_push( $bindVars, substr($pPackageName,0,100)); } - $ret = $this->getAssoc( $sql, $bindVars ); + $ret = $this->mDb->getAssoc( $sql, $bindVars ); return $ret; } @@ -626,27 +624,22 @@ class BitSystem extends BitBase if( empty( $this->mPackages ) ) { $this->mPackages = array(); } - global $gBitLoc; $pkgName = str_replace( ' ', '_', strtoupper( $pPackageName ) ); $pkgNameKey = strtolower( $pkgName ); // Define <PACKAGE>_PKG_PATH $pkgDefine = $pkgName.'_PKG_PATH'; - if (!defined($pkgDefine)) - { + if (!defined($pkgDefine)) { define($pkgDefine, $pPackagePath); } - $gBitLoc[$pkgDefine] = $pPackagePath; $this->mPackages[$pkgNameKey]['url'] = BIT_ROOT_URL . basename( $pPackagePath ) . '/'; $this->mPackages[$pkgNameKey]['path'] = BIT_ROOT_PATH . basename( $pPackagePath ) . '/'; // Define <PACKAGE>_PKG_URL $pkgDefine = $pkgName.'_PKG_URL'; - if (!defined($pkgDefine)) - { + if (!defined($pkgDefine)) { define($pkgDefine, BIT_ROOT_URL . basename( $pPackagePath ) . '/'); } - $gBitLoc[$pkgDefine] = BIT_ROOT_URL . basename( $pPackagePath ) . '/'; // Define <PACKAGE>_PKG_NAME $pkgDefine = $pkgName.'_PKG_NAME'; @@ -674,7 +667,6 @@ class BitSystem extends BitBase $pPackageName = $_SERVER['ACTIVE_PACKAGE']; } define('ACTIVE_PACKAGE', $pPackageName); - $gBitLoc['ACTIVE_PACKAGE'] = $pPackageName; $this->mActivePackage = $pPackageName; } } @@ -850,12 +842,7 @@ class BitSystem extends BitBase */ function scanPackages($pScanFile = 'bit_setup_inc.php', $pOnce=TRUE ) { - global $gBitLoc, $gPreScan; - if( empty( $gBitLoc ) ) { - $gBitLoc = array(); - } - $gBitLoc['BIT_ROOT_URL'] = BIT_ROOT_URL; - + global $gPreScan; if (!empty($gPreScan) && is_array($gPreScan)) { foreach($gPreScan as $pkgName) { $this->mRegisterCalled = FALSE; @@ -903,9 +890,6 @@ class BitSystem extends BitBase define('ACTIVE_PACKAGE', 'kernel'); // when in doubt, assume the kernel } - $gBitLoc['kernel_url'] = KERNEL_PKG_URL; - $gBitLoc['kernel_path'] = KERNEL_PKG_PATH; - if( !defined( 'BIT_STYLES_PATH' ) && defined( 'THEMES_PKG_PATH' ) ) { define('BIT_STYLES_PATH', THEMES_PKG_PATH . 'styles/'); } @@ -928,11 +912,15 @@ asort( $this->mAppMenu ); global $gBitDbType; $this->scanPackages( 'admin/schema_inc.php' ); if( $this->isDatabaseValid() ) { - $lastQuote = strrpos( BIT_DB_PREFIX, '`' ); - if( $lastQuote != FALSE ) { - $lastQuote++; + if (strlen(BIT_DB_PREFIX) > 0) { + $lastQuote = strrpos( BIT_DB_PREFIX, '`' ); + if( $lastQuote != FALSE ) { + $lastQuote++; + } + $prefix = substr( BIT_DB_PREFIX, $lastQuote ); + } else { + $prefix = ''; } - $prefix = substr( BIT_DB_PREFIX, $lastQuote ); $showTables = ( $prefix ? $prefix.'%' : NULL ); if( $dbTables = $this->mDb->MetaTables('TABLES', FALSE, $showTables ) ) { foreach( array_keys( $this->mPackages ) as $package ) { @@ -1115,7 +1103,7 @@ asort( $this->mAppMenu ); * @return none * @access public */ - function getStyleCss($pStyle = null, $pUserId = NULL) + function getStyleCss($pStyle = NULL, $pUserId = NULL) { global $gBitUser; if (empty($pStyle)) @@ -1129,9 +1117,9 @@ asort( $this->mAppMenu ); $homepageUser = new BitUser($pUserId); $homepageUser->load(); // Path to the user-customized css file - $cssPath = $homepageUser->getStoragePath('theme',$homepageUser->mUserId,null).'custom.css'; + $cssPath = $homepageUser->getStoragePath('theme',$homepageUser->mUserId,NULL).'custom.css'; if (file_exists($cssPath)) { - $ret = $homepageUser->getStorageURL('theme',$homepageUser->mUserId,null).'custom.css'; + $ret = $homepageUser->getStorageURL('theme',$homepageUser->mUserId,NULL).'custom.css'; } } else { if( $gBitUser->verifyStorageFile( $pStyle.'.css',$pStyle,$gBitUser->mUserId,'stylist' ) ) { @@ -1175,13 +1163,12 @@ asort( $this->mAppMenu ); * @return path to browser specific css file * @access public */ - function getBrowserStyleCss() - { - global $gBitLoc, $gSniffer; - $gBitLoc['browser']['client'] = $gSniffer->property( 'browser' ); - $gBitLoc['browser']['version'] = $gSniffer->property( 'version' ); + function getBrowserStyleCss() { + global $gSniffer; + $gSniffer->mBrowserInfo['client'] = $gSniffer->property( 'browser' ); + $gSniffer->mBrowserInfo['version'] = $gSniffer->property( 'version' ); $style = $this->getStyle(); - $ret = ''; + $ret = NULL; if( file_exists( $this->getStylePath().$this->getStyle().'_'.$gSniffer->property( 'browser' ).'.css' ) ) { $ret = $this->getStyleUrl().$this->getStyle().'_'.$gSniffer->property( 'browser' ).'.css'; } @@ -1281,7 +1268,7 @@ asort( $this->mAppMenu ); } $query = "SELECT tl.`user_id` FROM `" . BIT_DB_PREFIX . "tiki_layouts` tl $whereClause "; - $result = $this->query($query, array($pUserMixed)); + $result = $this->mDb->query($query, array($pUserMixed)); if ($result->fields['user_id']) { $layoutUserId = $result->fields['user_id']; } @@ -1292,7 +1279,7 @@ asort( $this->mAppMenu ); // This saves a count() query to see if the ACTIVE_PACKAGE has a layout, since it usually probably doesn't // I don't know if it's better or not to save the count() query and retrieve more data - my gut says so, // but i've done no research - spiderr - if ($pLayout != DEFAULT_PACKAGE && $pFallback && $this->mDb->mType != 'firebird' && $this->mDb->mType != 'mssql') { + if ($pLayout != DEFAULT_PACKAGE && $pFallback && $this->dType != 'firebird' && $this->dType != 'mssql') { // ORDER BY comparison is crucial so current layout modules come up first $whereClause .= " (tl.`layout`=? OR tl.`layout`=? ) ORDER BY tl.`layout`=? DESC, "; array_push($bindVars, $pLayout); @@ -1308,8 +1295,8 @@ asort( $this->mAppMenu ); array_push($bindVars, $pLayout); } $query = "SELECT tl.`ord`, tl.`user_id`, tl.`layout`, tl.`position`, tl.`params` AS `section_params`, tlm.*, tmm.`module_rsrc` FROM `" . BIT_DB_PREFIX . "tiki_layouts` tl, `" . BIT_DB_PREFIX . "tiki_layouts_modules` tlm, `" . BIT_DB_PREFIX . "tiki_module_map` tmm - WHERE tl.`module_id`=tlm.`module_id` AND tl.`user_id`=? AND tmm.`module_id`=tlm.`module_id` $whereClause " . $this->convert_sortmode("ord_asc"); - $result = $this->query($query, $bindVars); + WHERE tl.`module_id`=tlm.`module_id` AND tl.`user_id`=? AND tmm.`module_id`=tlm.`module_id` $whereClause " . $this->mDb->convert_sortmode("ord_asc"); + $result = $this->mDb->query($query, $bindVars); // CHeck to see if we have ACTIVE_PACKAGE modules at the top of the results if (isset($result->fields['layout']) && ($result->fields['layout'] != DEFAULT_PACKAGE) && (ACTIVE_PACKAGE != DEFAULT_PACKAGE)) { $skipDefaults = true; @@ -1660,10 +1647,10 @@ Proceed to the installer <b>at <a href=\"".BIT_ROOT_URL."install/install.php\">" $bindvars=array(); } - $query = "select `cache_id` ,`url`,`refresh` from `".BIT_DB_PREFIX."tiki_link_cache` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select `cache_id` ,`url`,`refresh` from `".BIT_DB_PREFIX."tiki_link_cache` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_link_cache` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { @@ -1680,20 +1667,20 @@ Proceed to the installer <b>at <a href=\"".BIT_ROOT_URL."install/install.php\">" $query = "select `url` from `".BIT_DB_PREFIX."tiki_link_cache` where `cache_id`=?"; - $url = $this->getOne($query, array( $cache_id ) ); + $url = $this->mDb->getOne($query, array( $cache_id ) ); $data = tp_http_request($url); $refresh = date("U"); $query = "update `".BIT_DB_PREFIX."tiki_link_cache` set `data`=?, `refresh`=? where `cache_id`=? "; - $result = $this->query($query, array( $data, $refresh, $cache_id) ); + $result = $this->mDb->query($query, array( $data, $refresh, $cache_id) ); return true; } function remove_cache($cache_id) { $query = "delete from `".BIT_DB_PREFIX."tiki_link_cache` where `cache_id`=?"; - $result = $this->query($query, array( $cache_id ) ); + $result = $this->mDb->query($query, array( $cache_id ) ); return true; } @@ -1701,7 +1688,7 @@ Proceed to the installer <b>at <a href=\"".BIT_ROOT_URL."install/install.php\">" $query = "select * from `".BIT_DB_PREFIX."tiki_link_cache` where `cache_id`=?"; - $result = $this->query($query, array( $cache_id ) ); + $result = $this->mDb->query($query, array( $cache_id ) ); $res = $result->fetchRow(); return $res; } @@ -2225,10 +2212,11 @@ function installError($pMsg = null) } /** + * Basic processes timer + * * @package kernel - * @subpackage TikiTimer */ -class TikiTimer +class BitTimer { function parseMicro($micro) { diff --git a/admin/admin_modules_inc.php b/admin/admin_modules_inc.php index 93d39fe..24f734b 100644 --- a/admin/admin_modules_inc.php +++ b/admin/admin_modules_inc.php @@ -1,6 +1,6 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_kernel/admin/Attic/admin_modules_inc.php,v 1.2 2005/08/01 18:40:34 squareing Exp $ +// $Header: /cvsroot/bitweaver/_bit_kernel/admin/Attic/admin_modules_inc.php,v 1.3 2005/08/07 17:38:45 squareing Exp $ // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // All Rights Reserved. See copyright.txt for details and a complete list of authors. @@ -37,7 +37,7 @@ $gBitSmarty->assign_by_ref( 'all_modules', $all_mods ); $all_centers = &$modlib->getAllModules( 'templates', 'center_' ); // Get all center templates $gBitSmarty->assign_by_ref( 'all_centers', $all_centers ); -$all_mods = $all_mods + $all_centers; // Merge them all back into one array +$all_mods = array_merge_recursive($all_mods,$all_centers); // Merge them all back into one array // this wierdness is due to changes in getAllModules() to create a nicer layout. it's needed to keep the js working... $all_modules = array(); diff --git a/admin/db_performance.php b/admin/db_performance.php index cfe2261..bfd5256 100644 --- a/admin/db_performance.php +++ b/admin/db_performance.php @@ -28,6 +28,6 @@ For more information, see the <a href="http://phplens.com/lens/adodb/docs-perf.h </p> <?php - $perf =& NewPerfMonitor( $gBitSystem->mDb->mDb ); + $perf =& NewPerfMonitor( $gBitSystem->getDb ); $perf->UI($pollsecs=5); ?> diff --git a/admin_lib.php b/admin_lib.php index ca3ae5f..f588bbc 100644 --- a/admin_lib.php +++ b/admin_lib.php @@ -1,11 +1,15 @@ <?php /** + * Administration Library + * * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/admin_lib.php,v 1.3 2005/08/07 17:38:45 squareing Exp $ */ /** + * Administration Library + * * @package kernel - * @subpackage AdminLib */ class AdminLib extends BitBase { function AdminLib() { @@ -24,10 +28,10 @@ class AdminLib extends BitBase { $mid = ""; } - $query = "select * from `".BIT_DB_PREFIX."tiki_dsn` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_dsn` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_dsn` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { @@ -45,22 +49,22 @@ class AdminLib extends BitBase { $bindvars=array($name,$dsn_id); if ($dsn_id) { $query = "update `".BIT_DB_PREFIX."tiki_dsn` set `dsn`='$dsn',`name`=? where `dsn_id`=?"; - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); } else { $query = "delete from `".BIT_DB_PREFIX."tiki_dsn`where `name`=? and `dsn`=?"; - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); $query = "insert into `".BIT_DB_PREFIX."tiki_dsn`(`name`,`dsn`) values(?,?)"; - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); } // And now replace the perm if not created $perm_name = 'bit_p_dsn_' . $name; $query = "delete from `".BIT_DB_PREFIX."users_permissions` where `perm_name`=?"; - $this->query($query,array($perm_name)); + $this->mDb->query($query,array($perm_name)); $query = "insert into `".BIT_DB_PREFIX."users_permissions`(`perm_name`,`perm_desc`,`type`,`level`) values (?,?,?,?)"; - $this->query($query,array($perm_name,'Can use dsn $dsn','dsn','editor')); + $this->mDb->query($query,array($perm_name,'Can use dsn $dsn','dsn','editor')); return true; } @@ -69,16 +73,16 @@ class AdminLib extends BitBase { $perm_name = 'bit_p_dsn_' . $info['name']; $query = "delete from `".BIT_DB_PREFIX."users_permissions` where `perm_name`=?"; - $this->query($query,array($perm_name)); + $this->mDb->query($query,array($perm_name)); $query = "delete from `".BIT_DB_PREFIX."tiki_dsn` where `dsn_id`=?"; - $this->query($query,array($dsn_id)); + $this->mDb->query($query,array($dsn_id)); return true; } function get_dsn($dsn_id) { $query = "select * from `".BIT_DB_PREFIX."tiki_dsn` where `dsn_id`=?"; - $result = $this->query($query,array($dsn_id)); + $result = $this->mDb->query($query,array($dsn_id)); if (!$result->numRows()) return false; @@ -98,10 +102,10 @@ class AdminLib extends BitBase { $mid = ""; } - $query = "select * from `".BIT_DB_PREFIX."tiki_extwiki` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_extwiki` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_extwiki` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { @@ -118,23 +122,23 @@ class AdminLib extends BitBase { // Check the name if ($extwiki_id) { $query = "update `".BIT_DB_PREFIX."tiki_extwiki` set `extwiki`=?,`name`=? where `extwiki_id`=?"; - $result = $this->query($query,array($extwiki,$name,$extwiki_id)); + $result = $this->mDb->query($query,array($extwiki,$name,$extwiki_id)); } else { $query = "delete from `".BIT_DB_PREFIX."tiki_extwiki` where `name`=? and `extwiki`=?"; $bindvars=array($name,$extwiki); - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); $query = "insert into `".BIT_DB_PREFIX."tiki_extwiki`(`name`,`extwiki`) values(?,?)"; - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); } // And now replace the perm if not created $perm_name = 'bit_p_extwiki_' . $name; $query = "delete from `".BIT_DB_PREFIX."users_permissions`where `perm_name`=?"; - $this->query($query,array($perm_name)); + $this->mDb->query($query,array($perm_name)); $query = "insert into `".BIT_DB_PREFIX."users_permissions`(`perm_name`,`perm_desc`,`type`,`level`) values (?,?,?,?)"; - $this->query($query,array($perm_name,'Can use extwiki $extwiki','extwiki','editor')); + $this->mDb->query($query,array($perm_name,'Can use extwiki $extwiki','extwiki','editor')); return true; } @@ -143,16 +147,16 @@ class AdminLib extends BitBase { $perm_name = 'bit_p_extwiki_' . $info['name']; $query = "delete from `".BIT_DB_PREFIX."users_permissions` where `perm_name`=?"; - $this->query($query,array($perm_name)); + $this->mDb->query($query,array($perm_name)); $query = "delete from `".BIT_DB_PREFIX."tiki_extwiki` where `extwiki_id`=?"; - $this->query($query,array($extwiki_id)); + $this->mDb->query($query,array($extwiki_id)); return true; } function get_extwiki($extwiki_id) { $query = "select * from `".BIT_DB_PREFIX."tiki_extwiki` where `extwiki_id`=?"; - $result = $this->query($query,array($extwiki_id)); + $result = $this->mDb->query($query,array($extwiki_id)); if (!$result->numRows()) return false; @@ -166,7 +170,7 @@ class AdminLib extends BitBase { // Find images in tiki_pages $query = "select `data` from `".BIT_DB_PREFIX."tiki_pages`"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); while ($res = $result->fetchRow()) { preg_match_all("/src=\"([^\"]+)\"/", $res["data"], $reqs1); @@ -179,7 +183,7 @@ class AdminLib extends BitBase { // Find images in Tiki articles $query = "select `body` from `".BIT_DB_PREFIX."tiki_articles`"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); while ($res = $result->fetchRow()) { preg_match_all("/src=\"([^\"]+)\"/", $res["body"], $reqs1); @@ -192,7 +196,7 @@ class AdminLib extends BitBase { // Find images in tiki_submissions $query = "select `body` from `".BIT_DB_PREFIX."tiki_submissions`"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); while ($res = $result->fetchRow()) { preg_match_all("/src=\"([^\"]+)\"/", $res["body"], $reqs1); @@ -205,7 +209,7 @@ class AdminLib extends BitBase { // Find images in tiki_blog_posts $query = "select `data` from `".BIT_DB_PREFIX."tiki_blog_posts`"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); while ($res = $result->fetchRow()) { preg_match_all("/src=\"([^\"]+)\"/", $res["data"], $reqs1); @@ -227,7 +231,7 @@ class AdminLib extends BitBase { } $query = "select `image_id` from `".BIT_DB_PREFIX."tiki_images` where `gallery_id`=0"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); while ($res = $result->fetchRow()) { $id = $res["image_id"]; @@ -241,7 +245,7 @@ class AdminLib extends BitBase { function tag_exists($tag) { $query = "select distinct `tag_name` from `".BIT_DB_PREFIX."tiki_tags` where `tag_name` = ?"; - $result = $this->query($query,array($tag)); + $result = $this->mDb->query($query,array($tag)); return $result->numRows($result); } @@ -250,12 +254,12 @@ class AdminLib extends BitBase { $this->mDb->StartTrans(); $query = "delete from `".BIT_DB_PREFIX."tiki_tags` where `tag_name`=?"; - $result = $this->query($query,array($tagname)); + $result = $this->mDb->query($query,array($tagname)); $action = "removed tag: $tagname"; $t = date("U"); - $homePageId = $this->getOne( "SELECT `page_id` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON(tp.`content_id`=tc.`content_id`) WHERE tc.`title`=?", array( $wikiHomePage ) ); + $homePageId = $this->mDb->getOne( "SELECT `page_id` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON(tp.`content_id`=tc.`content_id`) WHERE tc.`title`=?", array( $wikiHomePage ) ); $query = "insert into `".BIT_DB_PREFIX."tiki_actionlog` (`page_id`, `action`, `page_name`, `last_modified`, `user_id`, `ip`, `comment`) values ( ?,?,?,?,?,?,? )"; - $result = $this->query($query,array($homePageId, $action,$wikiHomePage,$t,$gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],'')); + $result = $this->mDb->query($query,array($homePageId, $action,$wikiHomePage,$t,$gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],'')); $this->mDb->CompleteTrans(); return true; } @@ -263,7 +267,7 @@ class AdminLib extends BitBase { function get_tags() { $query = "select distinct `tag_name` from `".BIT_DB_PREFIX."tiki_tags`"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); $ret = array(); while ($res = $result->fetchRow()) { @@ -280,23 +284,23 @@ class AdminLib extends BitBase { $this->mDb->StartTrans(); $query = "select * from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON( tp.`content_id`=tc.`content_id` )"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); while ($res = $result->fetchRow()) { $data = $res["data"]; $description = $res["description"]; $query = "delete from `".BIT_DB_PREFIX."tiki_tags`where `tag_name`=? and `page_id`=?"; - $this->query($query,array($tagname,$res["page_id"])); + $this->mDb->query($query,array($tagname,$res["page_id"])); $query = "insert into `".BIT_DB_PREFIX."tiki_tags`(`page_id`,`tag_name`,`page_name`,`hits`,`data`,`last_modified`,`comment`,`version`,`user_id`,`ip`,`flag`,`description`) values(?,?,?,?,?,?,?,?,?,?,?,?)"; - $result2 = $this->query($query,array($res["page_id"],$tagname,$res["title"],$res["hits"],$data,$res["last_modified"],$res["comment"],$res["version"],$res["user_id"],$res["ip"],$res["flag"],$description)); + $result2 = $this->mDb->query($query,array($res["page_id"],$tagname,$res["title"],$res["hits"],$data,$res["last_modified"],$res["comment"],$res["version"],$res["user_id"],$res["ip"],$res["flag"],$description)); } - $homePageId = $this->getOne( "SELECT `page_id` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON(tp.`content_id`=tc.`content_id`) WHERE tc.`title`=?", array( $wikiHomePage ) ); + $homePageId = $this->mDb->getOne( "SELECT `page_id` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON(tp.`content_id`=tc.`content_id`) WHERE tc.`title`=?", array( $wikiHomePage ) ); $action = "created tag: $tagname"; $t = date("U"); $query = "insert into `".BIT_DB_PREFIX."tiki_actionlog`(`page_id`,`action`,`page_name`,`last_modified`,`user_id`,`ip`,`comment`) values(?,?,?,?,?,?,?)"; - $result = $this->query($query,array($homePageId,$action,$wikiHomePage,$t,$gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],$comment)); + $result = $this->mDb->query($query,array($homePageId,$action,$wikiHomePage,$t,$gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],$comment)); $this->mDb->CompleteTrans(); return true; } @@ -309,20 +313,20 @@ class AdminLib extends BitBase { $this->mDb->StartTrans(); $query = "update `".BIT_DB_PREFIX."tiki_pages` set `cache_timestamp`=0"; - $this->query($query,array()); + $this->mDb->query($query,array()); $query = "select *, `data` AS `edit`, `page_name` AS `title` FROM `".BIT_DB_PREFIX."tiki_tags` where `tag_name`=?"; - $result = $this->query($query,array($tagname)); + $result = $this->mDb->query($query,array($tagname)); while ($res = $result->fetchRow()) { $tagPage = new BitPage( $res["page_id"] ); $tagPage->store( $res ); } - $homePageId = $this->getOne( "SELECT `page_id` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON(tp.`content_id`=tc.`content_id`) WHERE tc.`title`=?", array( $wikiHomePage ) ); + $homePageId = $this->mDb->getOne( "SELECT `page_id` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON(tp.`content_id`=tc.`content_id`) WHERE tc.`title`=?", array( $wikiHomePage ) ); $action = "recovered tag: $tagname"; $t = date("U"); $query = "insert into `".BIT_DB_PREFIX."tiki_actionlog`(`page_id`, `action`, `page_name`, `last_modified`, `user_id`, `ip`, `comment`) values (?,?,?,?,?,?,?)"; - $result = $this->query($query,array($homePageId,$action,$wikiHomePage,$t, $gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],'')); + $result = $this->mDb->query($query,array($homePageId,$action,$wikiHomePage,$t, $gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],'')); $this->mDb->CompleteTrans(); return true; } diff --git a/backups_lib.php b/backups_lib.php index bc24ef3..33ad880 100644 --- a/backups_lib.php +++ b/backups_lib.php @@ -1,11 +1,15 @@ <?php /** + * Database Backup Library + * * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/backups_lib.php,v 1.6 2006/01/10 21:12:46 squareing Exp $ */ /** + * Database Backup Library + * * @package kernel - * @subpackage BackupLib */ class BackupLib extends BitBase { function BackupLib() { @@ -16,7 +20,7 @@ class BackupLib extends BitBase { global $gBitDbType; // Get the password before it's too late $query = "select `hash` from `".BIT_DB_PREFIX."users_users` where `user_id`=?"; - $pwd = $this->getOne($query,array(ROOT_USER_ID)); + $pwd = $this->mDb->getOne($query,array(ROOT_USER_ID)); switch ($gBitDbType) { case "postgres": @@ -26,7 +30,7 @@ class BackupLib extends BitBase { $query = "show tables"; } - $result = $this->query($query); + $result = $this->mDb->query($query); $sql = ''; $part = ''; @@ -36,12 +40,12 @@ class BackupLib extends BitBase { if (!strstr($val, 'babl')) { // Now delete the table contents $query2 = "delete from `$val`"; - $result2 = $this->query($query2); + $result2 = $this->mDb->query($query2); } } // $query = "update `".BIT_DB_PREFIX."users_users` set `hash`=? where `login`=?"; -// $result = $this->query($query,array($pwd,'admin')); +// $result = $this->mDb->query($query,array($pwd,'admin')); @$fp = fopen($filename, "rb"); if (!$fp) return false; @@ -58,7 +62,7 @@ class BackupLib extends BitBase { // $line = $this->RC4($pwd, $line); // EXECUTE SQL SENTENCE HERE - $result = $this->query($line,array()); + $result = $this->mDb->query($line,array()); } fclose ($fp); @@ -116,7 +120,7 @@ class BackupLib extends BitBase { ini_set("max_execution_time", "3000"); $query = "select `hash` from `".BIT_DB_PREFIX."users_users` where `user_id`=?"; - $pwd = $this->getOne($query,array(ROOT_USER_ID)); + $pwd = $this->mDb->getOne($query,array(ROOT_USER_ID)); @$fp = fopen($filename, "w"); if (!$fp) @@ -130,7 +134,7 @@ class BackupLib extends BitBase { $query = "show tables"; } - $result = $this->query($query); + $result = $this->mDb->query($query); $sql = ''; $part = ''; @@ -141,7 +145,7 @@ class BackupLib extends BitBase { // Now dump the table $query2 = "select * from `$val`"; - $result2 = $this->query($query2); + $result2 = $this->mDb->query($query2); while ($res2 = $result2->fetchRow()) { $sentence = "values("; diff --git a/ban_lib.php b/ban_lib.php index dc866b0..2c2580b 100644 --- a/ban_lib.php +++ b/ban_lib.php @@ -1,11 +1,15 @@ <?php /** + * User access Banning Library + * * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/ban_lib.php,v 1.3 2005/08/07 17:38:45 squareing Exp $ */ /** + * User access Banning Library + * * @package kernel - * @subpackage BanLib */ class BanLib extends BitBase { function BanLib() { @@ -15,11 +19,11 @@ class BanLib extends BitBase { function get_rule($ban_id) { $query = "select * from `".BIT_DB_PREFIX."tiki_banning` where `ban_id`=?"; - $result = $this->query($query,array($ban_id)); + $result = $this->mDb->query($query,array($ban_id)); $res = $result->fetchRow(); $aux = array(); $query2 = "select `section` from `".BIT_DB_PREFIX."tiki_banning_sections` where `ban_id`=?"; - $result2 = $this->query($query2,array($ban_id)); + $result2 = $this->mDb->query($query2,array($ban_id)); $aux = array(); while ($res2 = $result2->fetchRow()) { @@ -33,9 +37,9 @@ class BanLib extends BitBase { function remove_rule($ban_id) { $query = "delete from `".BIT_DB_PREFIX."tiki_banning` where `ban_id`=?"; - $this->query($query,array($ban_id)); + $this->mDb->query($query,array($ban_id)); $query = "delete from `".BIT_DB_PREFIX."tiki_banning_sections` where `ban_id`=?"; - $this->query($query,array($ban_id)); + $this->mDb->query($query,array($ban_id)); } function list_rules($offset, $maxRecords, $sort_mode, $find, $where = '') { @@ -58,17 +62,17 @@ class BanLib extends BitBase { } } - $query = "select * from `".BIT_DB_PREFIX."tiki_banning` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_banning` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_banning` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { $aux = array(); $query2 = "select * from `".BIT_DB_PREFIX."tiki_banning_sections` where `ban_id`=?"; - $result2 = $this->query($query2,array($res['ban_id'])); + $result2 = $this->mDb->query($query2,array($res['ban_id'])); while ($res2 = $result2->fetchRow()) { $aux[] = $res2; @@ -83,7 +87,7 @@ class BanLib extends BitBase { $retval["cant"] = $cant; $now = date("U"); $query = "select `ban_id` from `".BIT_DB_PREFIX."tiki_banning` where `use_dates`=? and `date_to` < ?"; - $result = $this->query($query,array('y',$now)); + $result = $this->mDb->query($query,array('y',$now)); while ($res = $result->fetchRow()) { $this->remove_rule($res['ban_id']); @@ -125,23 +129,23 @@ class BanLib extends BitBase { where `ban_id`=? "; - $this->query($query,array($title,$ip1,$ip2,$ip3,$ip4,$user,$date_from,$date_to,$use_dates,$message,$ban_id)); + $this->mDb->query($query,array($title,$ip1,$ip2,$ip3,$ip4,$user,$date_from,$date_to,$use_dates,$message,$ban_id)); } else { $now = date("U"); $query = "insert into `".BIT_DB_PREFIX."tiki_banning`(`mode`,`title`,`ip1`,`ip2`,`ip3`,`ip4`,`user`,`date_from`,`date_to`,`use_dates`,`message`,`created`) values(?,?,?,?,?,?,?,?,?,?,?,?)"; - $this->query($query,array($mode,$title,$ip1,$ip2,$ip3,$ip4,$user,$date_from,$date_to,$use_dates,$message,$now)); - $ban_id = $this->getOne("select max(`ban_id`) from `".BIT_DB_PREFIX."tiki_banning` where `created`=?",array($now)); + $this->mDb->query($query,array($mode,$title,$ip1,$ip2,$ip3,$ip4,$user,$date_from,$date_to,$use_dates,$message,$now)); + $ban_id = $this->mDb->getOne("select max(`ban_id`) from `".BIT_DB_PREFIX."tiki_banning` where `created`=?",array($now)); } $query = "delete from `".BIT_DB_PREFIX."tiki_banning_sections` where `ban_id`=?"; - $this->query($query,array($ban_id)); + $this->mDb->query($query,array($ban_id)); foreach ($sections as $section) { $query = "insert into `".BIT_DB_PREFIX."tiki_banning_sections`(`ban_id`,`section`) values(?,?)"; - $this->query($query,array($ban_id,$section)); + $this->mDb->query($query,array($ban_id,$section)); } } } diff --git a/bit_error_inc.php b/bit_error_inc.php index cae63e3..5dc2d33 100755 --- a/bit_error_inc.php +++ b/bit_error_inc.php @@ -1,7 +1,9 @@ <?php /** + * Custom ADODB Error Handler. This will be called with the following params + * * @package kernel - * @subpackage function + * @subpackage functions * @version V3.94 13 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, @@ -54,7 +56,7 @@ function bit_error_handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnecti $subject = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : 'BITWEAVER'; $fatal = FALSE; - if ( ($fn == 'EXECUTE') && ($thisConnection->MetaError() != -5) && $gBitDb->isFatalActive() ) { + if ( ($fn == 'EXECUTE') && ($thisConnection->MetaError() != -5) && $gBitSystem->mDb->isFatalActive() ) { $subject .= ' FATAL'; $fatal = TRUE; } else { diff --git a/comm_lib.php b/comm_lib.php index b7db873..becd193 100644 --- a/comm_lib.php +++ b/comm_lib.php @@ -1,11 +1,16 @@ <?php /** + * Communications Library + * * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/comm_lib.php,v 1.3 2005/08/07 17:38:45 squareing Exp $ */ /** + * Communications Library + * Send and receive article content + * * @package kernel - * @subpackage RankLib */ class CommLib extends BitBase { function CommLib() { BitBase::BitBase(); @@ -20,7 +25,7 @@ class CommLib extends BitBase { $now = date("U"); $this->create_page($info["page_name"], 0, $info["data"], $now, $info["comment"], $info["received_from_user"], $info["received_from_site"], $info["description"]); $query = "delete from `".BIT_DB_PREFIX."tiki_received_pages` where `received_page_id`=?"; - $result = $this->query($query,array((int)$received_page_id)); + $result = $this->mDb->query($query,array((int)$received_page_id)); return true; } @@ -32,7 +37,7 @@ class CommLib extends BitBase { $info["heading"], $info["body"], $info["publish_date"], $info["expire_date"], $info["author"], 0, $info["image_x"], $info["image_y"], $info["type"], $info["rating"]); $query = "delete from `".BIT_DB_PREFIX."tiki_received_articles` where `received_article_id`=?"; - $result = $this->query($query,array((int)$received_article_id)); + $result = $this->mDb->query($query,array((int)$received_article_id)); return true; } @@ -46,10 +51,10 @@ class CommLib extends BitBase { $mid = ""; } - $query = "select * from `".BIT_DB_PREFIX."tiki_received_articles` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_received_articles` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_received_articles` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { @@ -64,22 +69,22 @@ class CommLib extends BitBase { function remove_received_page($received_page_id) { $query = "delete from `".BIT_DB_PREFIX."tiki_received_pages` where `received_page_id`=?"; - $result = $this->query($query,array((int)$received_page_id)); + $result = $this->mDb->query($query,array((int)$received_page_id)); } function remove_received_article($received_article_id) { $query = "delete from `".BIT_DB_PREFIX."tiki_received_articles` where `received_article_id`=?"; - $result = $this->query($query,array((int)$received_article_id)); + $result = $this->mDb->query($query,array((int)$received_article_id)); } function rename_received_page($received_page_id, $name) { $query = "update `".BIT_DB_PREFIX."tiki_received_pages` set `page_name`=? where `received_page_id`=?"; - $result = $this->query($query,array($name,(int)$received_page_id)); + $result = $this->mDb->query($query,array($name,(int)$received_page_id)); } function get_received_page($received_page_id) { $query = "select * from `".BIT_DB_PREFIX."tiki_received_pages` where `received_page_id`=?"; - $result = $this->query($query,array((int)$received_page_id)); + $result = $this->mDb->query($query,array((int)$received_page_id)); if (!$result->numRows()) return false; $res = $result->fetchRow(); return $res; @@ -87,7 +92,7 @@ class CommLib extends BitBase { function get_received_article($received_article_id) { $query = "select * from `".BIT_DB_PREFIX."tiki_received_articles` where `received_article_id`=?"; - $result = $this->query($query,array((int)$received_article_id)); + $result = $this->mDb->query($query,array((int)$received_article_id)); if (!$result->numRows()) return false; $res = $result->fetchRow(); return $res; @@ -98,24 +103,24 @@ class CommLib extends BitBase { $hash = md5($title . $heading . $body); $query = "update `".BIT_DB_PREFIX."tiki_received_articles` set `title`=?, `author_name`=?, `heading`=?, `body`=?, `size`=?, `hash`=?, `use_image`=?, `image_x`=?, "; $query.= " `image_y`=?, `publish_date`=?, `expire_date`=?, `type`=?, `rating`=? where `received_article_id`=?"; - $result = $this->query($query, + $result = $this->mDb->query($query, array($title,$author_name,$heading,$body,(int)$size,$hash,$use_image,(int)$image_x,(int)$image_y,(int)$publish_date,$expire_date,$type,(int)$rating,(int)$received_article_id)); } function update_received_page($received_page_id, $page_name, $data, $comment) { $query = "update `".BIT_DB_PREFIX."tiki_received_pages` set `page_name`=?, `data`=?, `comment`=? where `received_page_id`=?"; - $result = $this->query($query,array($page_name,$data,$comment,(int)$received_page_id)); + $result = $this->mDb->query($query,array($page_name,$data,$comment,(int)$received_page_id)); } function receive_article($site, $user, $title, $author_name, $size, $use_image, $image_name, $image_type, $image_size, $image_x, $image_y, $image_data, $publish_date, $expire_date, $created, $heading, $body, $hash, $author, $type, $rating) { $now = date("U"); $query = "delete from `".BIT_DB_PREFIX."tiki_received_articles` where `title`=? and `receivedFromSite`=? and `received_from_user`=?"; - $result = $this->query($query,array($title,$site,$user)); + $result = $this->mDb->query($query,array($title,$site,$user)); $query = "insert into `".BIT_DB_PREFIX."tiki_received_articles`(`received_date`,`received_from_site`,`received_from_user`,`title`,`author_name`,`size`, "; $query.= " `use_image`,`image_name`,`image_type`,`image_size`,`image_x`,`image_y`,`image_data`,`publish_date`,`expire_date`,`created`,`heading`,`body`,`hash`,`author`,`type`,`rating`) "; $query.= " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $result = $this->query($query,array((int)$now,$site,$user,$title,$author_name,(int)$size,$use_image,$image_name,$image_type,$image_size, + $result = $this->mDb->query($query,array((int)$now,$site,$user,$title,$author_name,(int)$size,$use_image,$image_name,$image_type,$image_size, $image_x,$image_y,$image_data,(int)$publish_date,(int)$expire_date,(int)$created,$heading,$body,$hash,$author,$type,(int)$rating)); } @@ -123,10 +128,10 @@ class CommLib extends BitBase { $now = date("U"); // Remove previous page sent from the same site-user (an update) $query = "delete from `".BIT_DB_PREFIX."tiki_received_pages` where `page_name`=? and `receivedFromSite`=? and `received_from_user`=?"; - $result = $this->query($query,array($page_name,$site,$user)); + $result = $this->mDb->query($query,array($page_name,$site,$user)); // Now insert the page $query = "insert into `".BIT_DB_PREFIX."tiki_received_pages`(`page_name`,`data`,`comment`,`received_from_site`, `received_from_user`, `received_date`,`description`) values(?,?,?,?,?,?,?)"; - $result = $this->query($query,array($page_name,$data,$comment,$site,$user,(int)$now,$description)); + $result = $this->mDb->query($query,array($page_name,$data,$comment,$site,$user,(int)$now,$description)); } // Functions for the communication center end //// diff --git a/menu_lib.php b/menu_lib.php index cb49c5b..ce8b459 100644 --- a/menu_lib.php +++ b/menu_lib.php @@ -1,12 +1,15 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/menu_lib.php,v 1.3 2005/08/01 18:40:33 squareing Exp $ + * Menu Management Library + * * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/menu_lib.php,v 1.4 2005/08/07 17:38:45 squareing Exp $ */ /** + * tiki format Menu Management Library + * * @package kernel - * @subpackage MenuLib */ class MenuLib extends BitBase { function MenuLib() { @@ -15,7 +18,7 @@ class MenuLib extends BitBase { function get_menu($menu_id) { $query = "select * from `".BIT_DB_PREFIX."tiki_menus` where `menu_id`=?"; - $result = $this->query($query,array((int)$menu_id)); + $result = $this->mDb->query($query,array((int)$menu_id)); if (!$result->numRows()) return false; $res = $result->fetchRow(); return $res; @@ -33,15 +36,15 @@ class MenuLib extends BitBase { $bindvars=array(); } - $query = "select * from `".BIT_DB_PREFIX."tiki_menus` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_menus` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_menus` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { $query = "select count(*) from `".BIT_DB_PREFIX."tiki_menu_options` where `menu_id`=?"; - $res["options"] = $this->getOne($query,array((int)$res["menu_id"])); + $res["options"] = $this->mDb->getOne($query,array((int)$res["menu_id"])); $ret[] = $res; } @@ -62,14 +65,14 @@ class MenuLib extends BitBase { $bindvars=array($name,$description,$type); } - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); return true; } function get_max_option($menu_id) { $query = "select max(`position`) from `".BIT_DB_PREFIX."tiki_menu_options` where `menu_id`=?"; - $max = $this->getOne($query,array((int)$menu_id)); + $max = $this->mDb->getOne($query,array((int)$menu_id)); return $max; } @@ -82,30 +85,30 @@ class MenuLib extends BitBase { $bindvars=array((int)$menu_id,$name,$url,$type,(int)$position,$section,$perm,$groupname); } - $result = $this->query($query, $bindvars); + $result = $this->mDb->query($query, $bindvars); return true; } function remove_menu($menu_id) { $query = "delete from `".BIT_DB_PREFIX."tiki_menus` where `menu_id`=?"; - $result = $this->query($query,array((int)$menu_id)); + $result = $this->mDb->query($query,array((int)$menu_id)); $query = "delete from `".BIT_DB_PREFIX."tiki_menu_options` where `menu_id`=?"; - $result = $this->query($query,array((int)$menu_id)); + $result = $this->mDb->query($query,array((int)$menu_id)); return true; } function remove_menu_option($option_id) { $query = "delete from `".BIT_DB_PREFIX."tiki_menu_options` where `option_id`=?"; - $result = $this->query($query,array((int)$option_id)); + $result = $this->mDb->query($query,array((int)$option_id)); return true; } function get_menu_option($option_id) { $query = "select * from `".BIT_DB_PREFIX."tiki_menu_options` where `option_id`=?"; - $result = $this->query($query,array((int)$option_id)); + $result = $this->mDb->query($query,array((int)$option_id)); if (!$result->numRows()) return false; @@ -127,10 +130,10 @@ class MenuLib extends BitBase { } else { $mid = " where `menu_id`=? "; } - $query = "select * from `".BIT_DB_PREFIX."tiki_menu_options` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_menu_options` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_menu_options` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); while ($res = $result->fetchRow()) { if (!$full) { $display = true; diff --git a/mod_lib.php b/mod_lib.php index ba2c939..fe52e06 100644 --- a/mod_lib.php +++ b/mod_lib.php @@ -1,12 +1,15 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/mod_lib.php,v 1.4 2005/07/25 20:02:08 squareing Exp $ + * Modules Management Library + * * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/mod_lib.php,v 1.5 2005/08/07 17:38:45 squareing Exp $ */ /** + * Modules Management Library + * * @package kernel - * @subpackage ModLib */ class ModLib extends BitBase { function ModLib() { @@ -17,10 +20,10 @@ class ModLib extends BitBase { if ((!empty($name)) && (!empty($title)) && (!empty($data))) { $query = "delete from `".BIT_DB_PREFIX."tiki_user_modules` where `name`=?"; - $result = $this->query($query,array($name)); + $result = $this->mDb->query($query,array($name)); $query = "insert into `".BIT_DB_PREFIX."tiki_user_modules`(`name`,`title`,`data`) values(?,?,?)"; - $result = $this->query($query,array($name,$title,$data)); + $result = $this->mDb->query($query,array($name,$title,$data)); return true; } } @@ -49,7 +52,7 @@ class ModLib extends BitBase { if( empty( $pHash['module_id'] ) || !is_numeric( $pHash['module_id'] ) ) { $query = "SELECT `module_id` FROM `".BIT_DB_PREFIX."tiki_module_map` WHERE `module_rsrc`=?"; - $result = $this->query( $query, array( $pHash['module_rsrc'] ) ); + $result = $this->mDb->query( $query, array( $pHash['module_rsrc'] ) ); $pHash['module_id'] = $result->fields['module_id']; } @@ -59,18 +62,18 @@ class ModLib extends BitBase { function storeModule( &$pHash ) { if( $this->verifyModuleParams( $pHash ) ) { $query = "SELECT `module_id` FROM `".BIT_DB_PREFIX."tiki_module_map` WHERE `module_rsrc`=?"; - $result = $this->query($query,array($pHash['module_rsrc'])); + $result = $this->mDb->query($query,array($pHash['module_rsrc'])); if (empty($result->fields)) { // If this module is not listed in the module map... $query = "INSERT INTO `".BIT_DB_PREFIX."tiki_module_map` (`module_rsrc`) VALUES ( ? )"; // Insert a row for this module - $result = $this->query($query,array($pHash['module_rsrc'])); + $result = $this->mDb->query($query,array($pHash['module_rsrc'])); $query = "SELECT `module_id` FROM `".BIT_DB_PREFIX."tiki_module_map` WHERE `module_rsrc`=?"; // Get the module_id assigned to it - $result = $this->query($query,array($pHash['module_rsrc'])); + $result = $this->mDb->query($query,array($pHash['module_rsrc'])); } $pHash['module_id'] = $result->fields['module_id']; $query = "SELECT COUNT(*) AS `count` FROM `".BIT_DB_PREFIX."tiki_layouts_modules` WHERE `module_id`=?"; - $result = $this->query($query,array($pHash['module_id'])); + $result = $this->mDb->query($query,array($pHash['module_id'])); if( empty( $pHash['groups'] ) ) { $pHash['groups'] = NULL; } @@ -86,10 +89,10 @@ class ModLib extends BitBase { ( `availability`, `title`, `cache_time`, `rows`, `groups`, `module_id` ) VALUES ( ?, ?, ?, ?, ?, ? )"; } - $result = $this->query( $query, $bindVars ); + $result = $this->mDb->query( $query, $bindVars ); if( !isset($pHash['layout']) || $pHash['layout'] == 'kernel' ) { - $this->query( "UPDATE `".BIT_DB_PREFIX."tiki_layouts_modules` SET `params`=? WHERE `module_id`=?", array( $pHash['params'], $pHash['module_id'] ) ); + $this->mDb->query( "UPDATE `".BIT_DB_PREFIX."tiki_layouts_modules` SET `params`=? WHERE `module_id`=?", array( $pHash['params'], $pHash['module_id'] ) ); } // `cache_time`, `groups`, `params`, `rows`, `type`, @@ -108,7 +111,7 @@ class ModLib extends BitBase { if( (empty( $pHash['module_id'] ) || !is_numeric( $pHash['module_id'] )) && isset( $pHash['module_rsrc'] ) ) { $query = "SELECT `module_id` FROM `".BIT_DB_PREFIX."tiki_module_map` WHERE `module_rsrc`=?"; - $result = $this->query( $query, array( $pHash['module_rsrc'] ) ); + $result = $this->mDb->query( $query, array( $pHash['module_rsrc'] ) ); $pHash['module_id'] = $result->fields['module_id']; } @@ -122,7 +125,7 @@ class ModLib extends BitBase { function storeLayout( $pHash ) { if( $this->verifyLayoutParams( $pHash ) ) { $query = "DELETE FROM `".BIT_DB_PREFIX."tiki_layouts` WHERE `user_id`=? AND `layout`=? AND `module_id`=?"; - $result = $this->query( $query, array( $pHash['user_id'], $pHash['layout'], (int)$pHash['module_id'] ) ); + $result = $this->mDb->query( $query, array( $pHash['user_id'], $pHash['layout'], (int)$pHash['module_id'] ) ); //check for valid values // kernel layout (site default) params are stored in tiki_layouts_modules if( $pHash['layout'] == 'kernel' ) { @@ -136,7 +139,7 @@ class ModLib extends BitBase { $query = "INSERT INTO `".BIT_DB_PREFIX."tiki_layouts` (`user_id`, `module_id`, `position`, `ord`, `params`, `layout`) VALUES (?,?,?,?,?,?)"; - $result = $this->query( $query, array( $pHash['user_id'], $pHash['module_id'], $pHash['pos'], (int)$pHash['ord'], $pHash['params'], $pHash['layout'] ) ); + $result = $this->mDb->query( $query, array( $pHash['user_id'], $pHash['module_id'], $pHash['pos'], (int)$pHash['ord'], $pHash['params'], $pHash['layout'] ) ); } return true; } @@ -144,7 +147,7 @@ class ModLib extends BitBase { function getAssignedModules( $name ) { $query = "select tlm.*, count() from `".BIT_DB_PREFIX."tiki_modules` where `name`=?"; - $result = $this->query($query,array($name)); + $result = $this->mDb->query($query,array($name)); $res = $result->fetchRow(); // handle old style serialized group names for legacy data @@ -172,11 +175,11 @@ class ModLib extends BitBase { function disableModule( $pModuleName ) { $query = "SELECT `module_id` FROM `".BIT_DB_PREFIX."tiki_module_map` WHERE `module_rsrc`=?"; - $result = $this->query($query,array($pModuleName)); + $result = $this->mDb->query($query,array($pModuleName)); if (!empty($result->fields)) { $module_id = $result->fields['module_id']; $query = "DELETE FROM `".BIT_DB_PREFIX."tiki_layouts_modules` WHERE `module_id`=?"; - $result = $this->query($query,array($module_id)); + $result = $this->mDb->query($query,array($module_id)); } } @@ -186,7 +189,7 @@ class ModLib extends BitBase { if( ($bit_p_admin || $securityOK || ( $gBitUser->mUserId==$pUserId )) && is_numeric( $pModuleId ) ) { $this->unassignModule( $pModuleId, $pUserId, $pLayout ); $query = "INSERT INTO `".BIT_DB_PREFIX."tiki_layouts` (`user_id`, `module_id`, `layout`, `position`, `ord`) VALUES(?,?,?,?,?)"; - $result = $this->query( $query, array( $pUserId, (int)$pModuleId, $pLayout, $pPosition, $pOrder ) ); + $result = $this->mDb->query( $query, array( $pUserId, (int)$pModuleId, $pLayout, $pPosition, $pOrder ) ); } } @@ -194,7 +197,7 @@ class ModLib extends BitBase { global $bit_p_admin, $gBitUser; if ( ($bit_p_admin || $securityOK || ( $gBitUser->mUserId == $pUserId )) && ($pUserId && $pLayout)) { $query = "DELETE FROM `".BIT_DB_PREFIX."tiki_layouts` WHERE `user_id` = ? AND `layout` = ?"; - $result = $this->query( $query, array($pUserId, $pLayout)); + $result = $this->mDb->query( $query, array($pUserId, $pLayout)); } } @@ -225,14 +228,14 @@ class ModLib extends BitBase { // security check if( ($gBitUser->isAdmin() || ( $pUserId && $gBitUser->mUserId==$pUserId )) && is_numeric( $pModuleId ) ) { $query = "DELETE FROM `".BIT_DB_PREFIX."tiki_layouts` where `module_id`=? $userSql $layoutSql"; - $result = $this->query( $query, $binds ); + $result = $this->mDb->query( $query, $binds ); /* // count to see if we still have this module in other layouts $query = "SELECT COUNT(*) AS exists FROM `".BIT_DB_PREFIX."tiki_layouts` WHERE `name`=?"; - $result = $this->query( $query, array( $pName ) ); + $result = $this->mDb->query( $query, array( $pName ) ); if( !$result->fields['exists'] ) { $query = "DELETE FROM `".BIT_DB_PREFIX."tiki_user_assigned_modules` WHERE `name`=?"; - $result = $this->query( $query,array( $pName ) ); + $result = $this->mDb->query( $query,array( $pName ) ); } */ } @@ -242,7 +245,7 @@ class ModLib extends BitBase { function get_rows($mod_rsrc, $user_id = NULL, $default = 5) { / *$query = "select `rows` from `".BIT_DB_PREFIX."tiki_layouts_modules` where `name`=?"; - $rows = $this->getOne($query,array($name)); + $rows = $this->mDb->getOne($query,array($name)); if ($rows == 0) $rows = 10;* / @@ -251,7 +254,7 @@ class ModLib extends BitBase { $query = "SELECT tl.`rows` FROM `".BIT_DB_PREFIX."tiki_layouts` tl, `".BIT_DB_PREFIX."tiki_module_map` tmm WHERE tmm.`module_rsrc` = ? AND tl.`user_id` = ? AND tl.`module_id` = tmm.`module_id`"; - $result = $this->query($query,array($mod_rsrc, $user_id)); + $result = $this->mDb->query($query,array($mod_rsrc, $user_id)); } if (!$user_id || !$result->fields['rows']) { @@ -259,7 +262,7 @@ class ModLib extends BitBase { $query = "SELECT tlm.`rows` FROM `".BIT_DB_PREFIX."tiki_layouts_modules` tlm, `".BIT_DB_PREFIX."tiki_module_map` tmm WHERE tmm.`module_rsrc` = ? AND tmm.`module_id` = tlm.`module_id`"; - $result = $this->query($query,array($mod_rsrc)); + $result = $this->mDb->query($query,array($mod_rsrc)); } $rows = $result->fields['rows']; if ($rows <= 0) @@ -276,10 +279,10 @@ class ModLib extends BitBase { if ($user_id) { $query = "UPDATE `".BIT_DB_PREFIX."tiki_layouts` SET `rows` = ? WHERE `module_id` = ? AND `user_id` = ?"; - $result = $this->query($query, array($rows, $module_id, $user_id)); + $result = $this->mDb->query($query, array($rows, $module_id, $user_id)); } else { $query = "UPDATE `".BIT_DB_PREFIX."tiki_layouts_modules` SET `rows` = ? WHERE `module_id` = ?"; - $result = $this->query($query, array($rows, $module_id)); + $result = $this->mDb->query($query, array($rows, $module_id)); } return TRUE; @@ -288,7 +291,7 @@ class ModLib extends BitBase { function moduleUp( $pModuleId, $pUserId, $pLayout ) { if( is_numeric( $pModuleId ) ) { $query = "update `".BIT_DB_PREFIX."tiki_layouts` SET `ord`=`ord`-1 WHERE `module_id`=? AND `user_id`=? AND `layout`=?"; - $result = $this->query( $query, array( $pModuleId, $pUserId, $pLayout ) ); + $result = $this->mDb->query( $query, array( $pModuleId, $pUserId, $pLayout ) ); } return true; } @@ -296,7 +299,7 @@ class ModLib extends BitBase { function moduleDown( $pModuleId, $pUserId, $pLayout ) { if( is_numeric( $pModuleId ) ) { $query = "UPDATE `".BIT_DB_PREFIX."tiki_layouts` SET `ord`=`ord`+1 WHERE `module_id`=? AND `user_id`=? AND `layout`=?"; - $result = $this->query( $query, array( $pModuleId, $pUserId, $pLayout ) ); + $result = $this->mDb->query( $query, array( $pModuleId, $pUserId, $pLayout ) ); } return true; } @@ -304,7 +307,7 @@ class ModLib extends BitBase { function modulePosition( $pModuleId, $pUserId, $pLayout, $pPosition ) { if( is_numeric( $pModuleId ) ) { $query = "UPDATE `".BIT_DB_PREFIX."tiki_layouts` SET `position`=? WHERE `module_id`=? AND `user_id`=? AND `layout`=?"; - $result = $this->query( $query, array( $pPosition, $pModuleId, $pUserId, $pLayout ) ); + $result = $this->mDb->query( $query, array( $pPosition, $pModuleId, $pUserId, $pLayout ) ); } } @@ -316,7 +319,7 @@ class ModLib extends BitBase { FROM `".BIT_DB_PREFIX."tiki_layouts` tl, `".BIT_DB_PREFIX."users_users` uu WHERE tl.`user_id`=uu.`user_id` AND uu.`login`=?"; } - $result = $this->getOne( $query, array( $iUserMixed ) ); + $result = $this->mDb->getOne( $query, array( $iUserMixed ) ); return $result; } @@ -329,7 +332,7 @@ class ModLib extends BitBase { $query = "SELECT tmm.`module_rsrc`, tlm.* FROM `".BIT_DB_PREFIX."tiki_layouts_modules` tlm, `".BIT_DB_PREFIX."tiki_module_map` tmm WHERE tmm.`module_id` = tlm.`module_id` ORDER BY `module_rsrc`"; - $result = $this->query( $query ); + $result = $this->mDb->query( $query ); while( !$result->EOF ) { if( preg_match( '/center_/', $result->fields['module_rsrc'] ) ) { $subArray = 'center'; @@ -454,14 +457,14 @@ class ModLib extends BitBase { /*shared*/ function is_user_module($name) { $query = "select `name` from `".BIT_DB_PREFIX."tiki_user_modules` where `name`=?"; - $result = $this->query($query,array($name)); + $result = $this->mDb->query($query,array($name)); return $result->numRows(); } /*shared*/ function get_user_module($name) { $query = "select * from `".BIT_DB_PREFIX."tiki_user_modules` where `name`=?"; - $result = $this->query($query,array($name)); + $result = $this->mDb->query($query,array($name)); $res = $result->fetchRow(); return $res; } @@ -472,9 +475,9 @@ class ModLib extends BitBase { if ($moduleId) { $this->unassignModule($moduleId); $query = " delete from `".BIT_DB_PREFIX."tiki_user_modules` where `name`=?"; - $result = $this->query($query,array($name)); + $result = $this->mDb->query($query,array($name)); $query = " DELETE FROM `".BIT_DB_PREFIX."tiki_layouts_modules` where `module_id` = ?"; - $result = $this->query($query, array($moduleId)); + $result = $this->mDb->query($query, array($moduleId)); } return true; @@ -483,9 +486,9 @@ class ModLib extends BitBase { function list_user_modules() { $query = "select * from `".BIT_DB_PREFIX."tiki_user_modules`"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_user_modules`"; - $cant = $this->getOne($query_cant,array()); + $cant = $this->mDb->getOne($query_cant,array()); $ret = array(); while ($res = $result->fetchRow()) { @@ -503,7 +506,7 @@ class ModLib extends BitBase { $query = "SELECT tl.`params`, tl.`rows` FROM `".BIT_DB_PREFIX."tiki_layouts` tl, `".BIT_DB_PREFIX."tiki_module_map` tmm WHERE tmm.`module_rsrc` = ? AND tl.`user_id` = ? AND tmm.`module_id` = tl.`module_id`"; - $result = $this->query($query,array($mod_rsrc, $user_id)); + $result = $this->mDb->query($query,array($mod_rsrc, $user_id)); $paramsStr = $result->fields['params']; $params = array(); @@ -513,7 +516,7 @@ class ModLib extends BitBase { $query = "SELECT tlm.`params`, tlm.`rows` FROM `".BIT_DB_PREFIX."tiki_layouts_modules` tlm, `".BIT_DB_PREFIX."tiki_module_map` tmm WHERE tmm.`module_rsrc` = ? AND tmm.`module_id` = tlm.`module_id`"; - $result = $this->query($query,array($mod_rsrc)); + $result = $this->mDb->query($query,array($mod_rsrc)); $paramsStr = $result->fields['params']; } if ($paramsStr) { @@ -549,10 +552,10 @@ class ModLib extends BitBase { if ($user_id) { $query = "UPDATE `".BIT_DB_PREFIX."tiki_layouts` SET `params` = ? WHERE `module_id` = ? AND `user_id` = ?"; - $result = $this->query($query, array($paramsStr, $module_id, $user_id)); + $result = $this->mDb->query($query, array($paramsStr, $module_id, $user_id)); } else { $query = "UPDATE `".BIT_DB_PREFIX."tiki_layouts_modules` SET `params` = ? WHERE `module_id` = ?"; - $result = $this->query($query, array($paramsStr, $module_id)); + $result = $this->mDb->query($query, array($paramsStr, $module_id)); } return TRUE; @@ -562,7 +565,7 @@ class ModLib extends BitBase { $query = "SELECT `module_id` FROM `".BIT_DB_PREFIX."tiki_module_map` WHERE `module_rsrc` = ?"; - $result = $this->query($query, array($mod_rsrc)); + $result = $this->mDb->query($query, array($mod_rsrc)); $ret = (!empty($result->fields['module_id']) ? $result->fields['module_id'] : NULL); @@ -582,7 +585,7 @@ class ModLib extends BitBase { $bindVars[] = $iLayout; $sql .= " AND `layout` = ?"; } - $ret = (bool)$this->getOne($sql, $bindVars); + $ret = (bool)$this->mDb->getOne($sql, $bindVars); } return $ret; } @@ -590,6 +593,9 @@ class ModLib extends BitBase { } +/** + * @global ModLib Module library + */ global $modlib; $modlib = new ModLib(); diff --git a/modules/mod_application_menu.tpl b/modules/mod_application_menu.tpl index ecdc927..eeef942 100644 --- a/modules/mod_application_menu.tpl +++ b/modules/mod_application_menu.tpl @@ -1,13 +1,13 @@ -{* $Header: /cvsroot/bitweaver/_bit_kernel/modules/mod_application_menu.tpl,v 1.3 2005/07/17 17:36:06 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_kernel/modules/mod_application_menu.tpl,v 1.4 2005/08/07 17:38:45 squareing Exp $ *} {strip} {bitmodule title="$moduleTitle" name="application_menu"} <div class="menu"> <ul> - <li><a class="item" href="{$gBitLoc.BIT_ROOT_URL}">{$siteTitle} {tr}Home{/tr}</a></li> + <li><a class="item" href="{$smarty.const.BIT_ROOT_URL}">{$siteTitle} {tr}Home{/tr}</a></li> {if $gBitUser->isAdmin()} - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php">{tr}Administration{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php">{tr}Administration{/tr}</a></li> {/if} </ul> </div> @@ -48,7 +48,7 @@ <li> {if $gBitSystem->isFeatureActive( 'feature_cssmenus' )} {if $menu.title} - <a class="head" href="{$gBitLoc.USERS_PKG_URL}menu.php">{tr}User Menu{/tr}</a> + <a class="head" href="{$smarty.const.USERS_PKG_URL}menu.php">{tr}User Menu{/tr}</a> {/if} {if count($usr_user_menus) gt 0} <ul> diff --git a/modules/mod_package_menu.tpl b/modules/mod_package_menu.tpl index 51cfe47..8162e4e 100644 --- a/modules/mod_package_menu.tpl +++ b/modules/mod_package_menu.tpl @@ -1,4 +1,4 @@ -{* $Header: /cvsroot/bitweaver/_bit_kernel/modules/mod_package_menu.tpl,v 1.3 2005/07/17 17:36:06 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_kernel/modules/mod_package_menu.tpl,v 1.4 2005/08/07 17:38:45 squareing Exp $ *} {strip} {if $packageMenu} @@ -7,7 +7,7 @@ {include file=$packageMenu.template} </div> {/bitmodule} -{elseif $gBitLoc.ACTIVE_PACKAGE and $gBitUser->isAdmin()} +{elseif $smarty.const.ACTIVE_PACKAGE and $gBitUser->isAdmin()} {bitmodule title="$moduleTitle" name="package_menu"} {foreach key=key item=menu from=$adminMenu} <div class="menu {$key}menu"> diff --git a/notification_lib.php b/notification_lib.php index e8eac90..fcb8090 100644 --- a/notification_lib.php +++ b/notification_lib.php @@ -1,15 +1,18 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_kernel/notification_lib.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ + * eMail Notification Library + * + * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/notification_lib.php,v 1.3 2005/08/07 17:38:45 squareing Exp $ + * @author awcolley + * + * created 2003/06/03 * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details - * - * $Id: notification_lib.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ - * @package kernel */ /** @@ -18,12 +21,6 @@ * Currently used in articles, trackers, users register and wiki. * * @package kernel - * @subpackage NotificationLib - * - * created 2003/06/03 - * @author awcolley - * - * @version $Revision: 1.2 $ $Date: 2005/06/28 07:45:45 $ $Author: spiderr $ * @todo does not need to inherit BitBase class. Should hold a BitDb connection as a * global variable. */ @@ -57,10 +54,10 @@ class NotificationLib extends BitBase $mid = " "; $bindvars=array(); } - $query = "select * from `".BIT_DB_PREFIX."tiki_mail_events` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_mail_events` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_mail_events` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { @@ -81,7 +78,7 @@ class NotificationLib extends BitBase function add_mail_event($event, $object, $email) { $query = "insert into `".BIT_DB_PREFIX."tiki_mail_events`(`event`,`object`,`email`) values(?,?,?)"; - $result = $this->query($query, array($event,$object,$email) ); + $result = $this->mDb->query($query, array($event,$object,$email) ); } /** * Removes an email address for a specified event notification @@ -92,8 +89,9 @@ class NotificationLib extends BitBase function remove_mail_event($event, $object, $email) { $query = "delete from `".BIT_DB_PREFIX."tiki_mail_events` where `event`=? and `object`=? and `email`=?"; - $result = $this->query($query,array($event,$object,$email)); + $result = $this->mDb->query($query,array($event,$object,$email)); } + /** * Retrieves the email addresses for a specific event * @param event the specified event @@ -103,7 +101,7 @@ class NotificationLib extends BitBase function get_mail_events($event, $object) { $query = "select `email` from `".BIT_DB_PREFIX."tiki_mail_events` where `event`=? and (`object`=? or `object`='*')"; - $result = $this->query($query, array($event,$object) ); + $result = $this->mDb->query($query, array($event,$object) ); $ret = array(); while ($res = $result->fetchRow()) { @@ -111,7 +109,64 @@ class NotificationLib extends BitBase } return $ret; } + + /** + * Post changes to registered email addresses related to a change event + * @param object number of the content item being updated + * @param object content_type of the item + * @param object the package that is being updated + * @param object the name of the object + * @param object the name of user making the change + * @param object any comment added to the change + * @param object the content of the change + * + * @todo Improve the generic handling of the messages + * Param information probably needs to be passed as an array, or accessed from Content directly + */ + function post_content_event($contentid, $type, $package, $name, $user, $comment, $data) + { global $gBitSystem; + + $emails = $this->get_mail_events($package.'_page_changes', $type . $contentid); + + foreach ($emails as $email) { + global $gBitSmarty; + $gBitSmarty->assign('mail_site', $_SERVER["SERVER_NAME"]); + $gBitSmarty->assign('mail_page', $name ); + $gBitSmarty->assign('mail_date', date("U")); + $gBitSmarty->assign('mail_user', $user ); + $gBitSmarty->assign('mail_comment', $comment ); + $gBitSmarty->assign('mail_last_version', 1); + $gBitSmarty->assign('mail_data', $data ); + $gBitSmarty->assign('mail_machine', httpPrefix()); + $gBitSmarty->assign('mail_pagedata', $data ); + $mail_data = $gBitSmarty->fetch('bitpackage:'.$package.'/'.$package.'_change_notification.tpl'); + + @mail($email, $package . tra(' page'). ' ' . $name . ' ' . tra('changed'), $mail_data, "From: ".$gBitSystem->getPreference( 'sender_email' )."\r\nContent-type: text/plain;charset=utf-8\r\n" ); + } + } + + /** + * Notifies registered list of eMail recipients of new user registrations + * @param object name of the new user + */ + function post_new_user_event( $user ) + { global $gBitSystem, $gBitSmarty; + $emails = $this->get_mail_events('user_registers','*'); + foreach($emails as $email) { + $gBitSmarty->assign('mail_user',$user); + $gBitSmarty->assign('mail_date',date("U")); + $gBitSmarty->assign('mail_site',$_SERVER["SERVER_NAME"]); + $mail_data = $gBitSmarty->fetch('bitpackage:users/new_user_notification.tpl'); + + mail( $email, tra('New user registration'),$mail_data,"From: ".$gBitSystem->getPreference('sender_email')."\r\nContent-type: text/plain;charset=utf-8\r\n"); + } + } + } + +/** + * @global NotificationLib Notification library + */ global $notificationlib; $notificationlib = new NotificationLib(); ?> diff --git a/rank_lib.php b/rank_lib.php index 82e1f16..8bec82f 100644 --- a/rank_lib.php +++ b/rank_lib.php @@ -1,12 +1,16 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/rank_lib.php,v 1.3 2005/07/17 17:36:05 squareing Exp $ + * Content Ranking Library + * + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/rank_lib.php,v 1.4 2005/08/07 17:38:45 squareing Exp $ * @package kernel */ /** + * Content Ranking Library + * * @package kernel - * @subpackage RankLib + * @todo This needs reviewing and the legacy dependencies removed - still using tiki specific tables */ class RankLib extends BitBase { function RankLib() { @@ -15,7 +19,7 @@ class RankLib extends BitBase { function wiki_ranking_top_pages($limit) { $query = "select tc.`title` as `page_name`, `hits` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`) order by `hits` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -37,7 +41,7 @@ class RankLib extends BitBase { // $this->page_rank(); $query = "select tc.`title` as `page_name`, `page_rank` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`) order by `page_rank` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -59,7 +63,7 @@ class RankLib extends BitBase { $query = "select tc.`title` as `page_name`, `last_modified`, `hits` from `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`) order by `last_modified` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -80,10 +84,10 @@ class RankLib extends BitBase { global $gBitSystem; $query = "select * from `".BIT_DB_PREFIX."tiki_comments`,`".BIT_DB_PREFIX."tiki_forums` where - `object`=".$this->sql_cast("`forum_id`","string")." and `object_type` = 'forum' and + `object`=".$this->mDb->sql_cast("`forum_id`","string")." and `object_type` = 'forum' and `parent_id`=0 order by `comment_date` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -107,7 +111,7 @@ class RankLib extends BitBase { `object`=`forum_id` and `object_type` = 'forum' and `parent_id`=0 order by tc.`hits` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -131,7 +135,7 @@ class RankLib extends BitBase { `object`=`forum_id` and `object_type` = 'forum' and `parent_id`=0 order by tc.`average` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -151,7 +155,7 @@ class RankLib extends BitBase { function forums_ranking_most_visited_forums($limit) { $query = "select * from `".BIT_DB_PREFIX."tiki_forums` order by `hits` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -171,7 +175,7 @@ class RankLib extends BitBase { function forums_ranking_most_commented_forum($limit) { $query = "select * from `".BIT_DB_PREFIX."tiki_forums` order by `comments` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -191,7 +195,7 @@ class RankLib extends BitBase { function gal_ranking_top_galleries($limit) { $query = "select * from `".BIT_DB_PREFIX."tiki_galleries` where `visible`=? order by `hits` desc"; - $result = $this->query($query,array('y'),$limit,0); + $result = $this->mDb->query($query,array('y'),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -211,7 +215,7 @@ class RankLib extends BitBase { function filegal_ranking_top_galleries($limit) { $query = "select * from `".BIT_DB_PREFIX."tiki_file_galleries` where `visible`=? order by `hits` desc"; - $result = $this->query($query,array('y'),$limit,0); + $result = $this->mDb->query($query,array('y'),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -231,7 +235,7 @@ class RankLib extends BitBase { function gal_ranking_top_images($limit) { $query = "select `image_id`,`name`,`hits` from `".BIT_DB_PREFIX."tiki_images` order by `hits` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -251,7 +255,7 @@ class RankLib extends BitBase { function filegal_ranking_top_files($limit) { $query = "select `file_id`,`filename`,`downloads` from `".BIT_DB_PREFIX."tiki_files` order by `downloads` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -272,7 +276,7 @@ class RankLib extends BitBase { global $gBitSystem; $query = "select `image_id`,`name`,`created` from `".BIT_DB_PREFIX."tiki_images` order by `created` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -293,7 +297,7 @@ class RankLib extends BitBase { global $gBitSystem; $query = "select `file_id`,`filename`,`created` from `".BIT_DB_PREFIX."tiki_files` order by `created` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -313,7 +317,7 @@ class RankLib extends BitBase { function cms_ranking_top_articles($limit) { $query = "select * from `".BIT_DB_PREFIX."tiki_articles` order by `reads` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -333,7 +337,7 @@ class RankLib extends BitBase { function blog_ranking_top_blogs($limit) { $query = "select * from `".BIT_DB_PREFIX."tiki_blogs` order by `hits` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -353,7 +357,7 @@ class RankLib extends BitBase { function blog_ranking_top_active_blogs($limit) { $query = "select * from `".BIT_DB_PREFIX."tiki_blogs` order by `activity` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { @@ -374,13 +378,13 @@ class RankLib extends BitBase { global $gBitSystem; $query = "select * from `".BIT_DB_PREFIX."tiki_blog_posts` order by `post_id` desc"; - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); while ($res = $result->fetchRow()) { $q = "select title, created from `".BIT_DB_PREFIX."tiki_blogs` where `blog_id`="; $q.= $res["blog_id"]; - $result2 = $this->query($q,array(),$limit,0); + $result2 = $this->mDb->query($q,array(),$limit,0); $res2 = $result2->fetchRow(); $aux["name"] = $res2["title"]; $aux["hits"] = $gBitSystem->get_long_datetime($res2["created"]); @@ -396,9 +400,9 @@ class RankLib extends BitBase { function wiki_ranking_top_authors($limit) { - $query = "select distinct users.`login` as `user`, count(*) as `numb` from `".BIT_DB_PREFIX."users_users` users INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`user_id` = users.`user_id`) where tc.`content_type_guid`='".BITPAGE_CONTENT_TYPE_GUID."' group by `user` order by ".$this->convert_sortmode("numb_desc"); + $query = "select distinct users.`login` as `user`, count(*) as `numb` from `".BIT_DB_PREFIX."users_users` users INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`user_id` = users.`user_id`) where tc.`content_type_guid`='".BITPAGE_CONTENT_TYPE_GUID."' group by `user` order by ".$this->mDb->convert_sortmode("numb_desc"); - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); $retu = array(); @@ -415,9 +419,9 @@ class RankLib extends BitBase { } function cms_ranking_top_authors($limit) { - $query = "select distinct `author`, count(*) as `numb` from `".BIT_DB_PREFIX."tiki_articles` group by `author` order by ".$this->convert_sortmode("numb_desc"); + $query = "select distinct `author`, count(*) as `numb` from `".BIT_DB_PREFIX."tiki_articles` group by `author` order by ".$this->mDb->convert_sortmode("numb_desc"); - $result = $this->query($query,array(),$limit,0); + $result = $this->mDb->query($query,array(),$limit,0); $ret = array(); $retu = array(); diff --git a/setup_inc.php b/setup_inc.php index 8abcca5..82049f8 100644 --- a/setup_inc.php +++ b/setup_inc.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_kernel/setup_inc.php,v 1.10 2005/08/01 18:40:33 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_kernel/setup_inc.php,v 1.11 2005/08/07 17:38:45 squareing Exp $ * @package kernel * @subpackage functions */ @@ -17,7 +17,7 @@ error_reporting( BIT_PHP_ERROR_REPORTING ); define( 'BIT_MAJOR_VERSION', '1' ); define( 'BIT_MINOR_VERSION', '0' ); -define( 'BIT_SUB_VERSION', '3' ); +define( 'BIT_SUB_VERSION', '4' ); define( 'BIT_LEVEL', 'beta' ); // 'beta' or 'dev' or 'rc' etc.. define( 'BIT_PKG_PATH', BIT_ROOT_PATH ); @@ -102,8 +102,7 @@ if (!function_exists('array_fill')) global $num_queries; $num_queries = 0; -// a bit hackish for now, but works. -if( $gBitDb->isValid() ) { +if( $gBitSystem->isDatabaseValid() ) { $gBitSystem->loadPreferences(); if ($gBitSystem->getPreference('feature_obzip') == 'y') { @@ -205,8 +204,6 @@ if( $gBitDb->isValid() ) { $gBitSmarty->assign_by_ref("gBitSystem", $gBitSystem); $gBitSmarty->assign_by_ref("gBitSystemPackages", $gBitSystem->mPackages); - global $gBitLoc; - $gBitSmarty->assign_by_ref("gBitLoc", $gBitLoc); // check to see if admin has closed the site if ( $gBitSystem->isFeatureActive('site_closed' ) && !$gBitUser->hasPermission('bit_p_access_closed_site') && !isset($bypass_siteclose_check) && $_SERVER['SCRIPT_URL'] != USERS_PKG_URL.'validate.php' ) { $_REQUEST['error'] = $gBitSystem->getPreference('site_closed_msg', 'Site is closed for maintainance; please come back later.'); diff --git a/smarty_bit/function.formfeedback.php b/smarty_bit/function.formfeedback.php index a5fd829..8f1c5ed 100644 --- a/smarty_bit/function.formfeedback.php +++ b/smarty_bit/function.formfeedback.php @@ -47,7 +47,7 @@ function smarty_function_formfeedback( $params,&$gBitSmarty ) { $html = ''; if( !empty( $feedback ) ) { - $html = '<div class="formfeedback">'; + $html = '<div class="clear formfeedback">'; $html .= $feedback; $html .= '</div>'; } diff --git a/smarty_bit/function.smartlink.php b/smarty_bit/function.smartlink.php index c5b9ab2..4a80b87 100644 --- a/smarty_bit/function.smartlink.php +++ b/smarty_bit/function.smartlink.php @@ -39,7 +39,7 @@ * - {smartlink ititle="Page Name" isort="title" iorder="desc" idefault=1} * setting iorder and idefault here, makes this link sort in a descending order by default (iorder) * and it is highlighted when $isort_mode ( or $_REQUEST['sort_mode'] ) is not set (idefault) - * @Note Don't use this plugin if ititle is generated dynamically since it is passed through tra() + * Note Don't use this plugin if ititle is generated dynamically since it is passed through tra() */ function smarty_function_smartlink( $params, &$gBitSmarty ) { if( !empty( $params['ihash'] ) ) { diff --git a/smarty_bit/modifier.avatarize.php b/smarty_bit/modifier.avatarize.php index 4f0fb94..2bb3177 100644 --- a/smarty_bit/modifier.avatarize.php +++ b/smarty_bit/modifier.avatarize.php @@ -17,7 +17,7 @@ function smarty_modifier_avatarize($user) { global $gBitSystem; $avatar = $gBitSystem->get_user_avatar($user); - if($gBitUser->userNameExists($user)&&$gBitSystem->get_user_preference($user,'user_information','public')=='public') { + if($gBitUser->userNameExists($user)&&$gBitSystem->getPreference('user_information','public',$user)=='public') { $avatar = '<a title="'.$user.'" href="'.USERS_PKG_URL.'index.php?home='.$user.'">'.$avatar.'</a>'; } return $avatar; diff --git a/smarty_bit/modifier.countryflag.php b/smarty_bit/modifier.countryflag.php index c93aa7d..447dc0e 100644 --- a/smarty_bit/modifier.countryflag.php +++ b/smarty_bit/modifier.countryflag.php @@ -16,7 +16,7 @@ function smarty_modifier_countryflag($user) { global $gBitSystem; - $flag = $gBitSystem->get_user_preference($user,'country','Other'); + $flag = $gBitSystem->getPreference('country','Other',$user); return "<img alt='flag' src='".IMG_PKG_URL."flags/".$flag.".gif' />"; } diff --git a/tagline_lib.php b/tagline_lib.php index b9a2c1b..aad9114 100644 --- a/tagline_lib.php +++ b/tagline_lib.php @@ -1,16 +1,16 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/tagline_lib.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ + * Tagline Management Library + * * @package kernel + * @version $Header: /cvsroot/bitweaver/_bit_kernel/Attic/tagline_lib.php,v 1.3 2005/08/07 17:38:45 squareing Exp $ + * @author awcolley * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details - * - * $Id: tagline_lib.php,v 1.2 2005/06/28 07:45:45 spiderr Exp $ - * */ /** @@ -18,15 +18,11 @@ * * Currently used for cookies. * - * @package kernel - * @subpackage TagLineLib - * * created 2003/06/19 * - * @author awcolley - * + * @package kernel * @todo does not need to inherit BitBase class. Should hold a BitDb connection as a - * global variable. + * global variable. */ class TagLineLib extends BitBase { @@ -57,10 +53,10 @@ class TagLineLib extends BitBase $mid = ""; $bindvars = array(); } - $query = "select * from `".BIT_DB_PREFIX."tiki_cookies` $mid order by ".$this->convert_sortmode($sort_mode); + $query = "select * from `".BIT_DB_PREFIX."tiki_cookies` $mid order by ".$this->mDb->convert_sortmode($sort_mode); $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_cookies` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->mDb->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->mDb->getOne($query_cant,$bindvars); $ret = array(); while ($res = $result->fetchRow()) { @@ -90,10 +86,10 @@ class TagLineLib extends BitBase { $bindvars = array($cookie); $query = "delete from `".BIT_DB_PREFIX."tiki_cookies` where `cookie`=?"; - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); $query = "insert into `".BIT_DB_PREFIX."tiki_cookies`(`cookie`) values(?)"; } - $result = $this->query($query,$bindvars); + $result = $this->mDb->query($query,$bindvars); return true; } /** @@ -103,7 +99,7 @@ class TagLineLib extends BitBase function remove_cookie($cookieId) { $query = "delete from `".BIT_DB_PREFIX."tiki_cookies` where `cookieId`=?"; - $result = $this->query($query,array((int)$cookieId)); + $result = $this->mDb->query($query,array((int)$cookieId)); return true; } /** @@ -114,7 +110,7 @@ class TagLineLib extends BitBase function get_cookie($cookieId) { $query = "select * from `".BIT_DB_PREFIX."tiki_cookies` where `cookieId`=?"; - $result = $this->query($query,array((int)$cookieId)); + $result = $this->mDb->query($query,array((int)$cookieId)); if (!$result->numRows()) return false; $res = $result->fetchRow(); return $res; @@ -125,16 +121,16 @@ class TagLineLib extends BitBase function remove_all_cookies() { $query = "delete from `".BIT_DB_PREFIX."tiki_cookies`"; - $result = $this->query($query,array()); + $result = $this->mDb->query($query,array()); } /*shared*/ function pick_cookie() { - $cant = $this->getOne("select count(*) from `".BIT_DB_PREFIX."tiki_cookies`",array()); + $cant = $this->mDb->getOne("select count(*) from `".BIT_DB_PREFIX."tiki_cookies`",array()); if (!$cant) return ''; $bid = rand(0, $cant - 1); - //$cookie = $this->getOne("select `cookie` from `".BIT_DB_PREFIX."tiki_cookies` limit $bid,1"); getOne seems not to work with limit - $result = $this->query("select `cookie` from `".BIT_DB_PREFIX."tiki_cookies`",array(),1,$bid); + //$cookie = $this->mDb->getOne("select `cookie` from `".BIT_DB_PREFIX."tiki_cookies` limit $bid,1"); getOne seems not to work with limit + $result = $this->mDb->query("select `cookie` from `".BIT_DB_PREFIX."tiki_cookies`",array(),1,$bid); if ($res = $result->fetchRow()) { $cookie = str_replace("\n", "", $res['cookie']); return '<i>"' . $cookie . '"</i>'; @@ -144,6 +140,10 @@ class TagLineLib extends BitBase } } + +/** + * @global TagLineLib Cookie manangement library + */ global $taglinelib; $taglinelib = new TagLineLib(); ?> diff --git a/templates/admin_banning.tpl b/templates/admin_banning.tpl index d8f9a96..f0034c2 100644 --- a/templates/admin_banning.tpl +++ b/templates/admin_banning.tpl @@ -1,7 +1,7 @@ -<a class="pagetitle" href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php">{tr}Banning system{/tr}</a> +<a class="pagetitle" href="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php">{tr}Banning system{/tr}</a> <h2>{tr}Add or edit a rule{/tr}</h2> -<form action="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php" method="post"> +<form action="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php" method="post"> <input type="hidden" name="ban_id" value="{$ban_id|escape}" /> <table class="panel"> <tr> @@ -85,14 +85,14 @@ </table> </form> -<form method="post" action="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php"> +<form method="post" action="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php"> <input type="hidden" name="offset" value="{$offset|escape}" /> <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" /> <label for="banning-find">{tr}Find{/tr}:</label><input type="text" name="find" id="banning-find" value="{$find|escape}" /> </form> <h2>{tr}Rules{/tr}:</h2> -<form method="post" action="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php"> +<form method="post" action="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php"> <input type="hidden" name="offset" value="{$offset|escape}" /> <input type="hidden" name="find" value="{$find|escape}" /> <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" /> @@ -109,7 +109,7 @@ {section name=user loop=$items} <tr class="{cycle}"><td> <input type="checkbox" name="delsec[{$items[user].ban_id}]" /></td><td> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php?ban_id={$items[user].ban_id}">{$items[user].title}</a></td><td> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php?ban_id={$items[user].ban_id}">{$items[user].title}</a></td><td> {if $items[user].mode eq 'user'} {$items[user].user} {else} @@ -118,7 +118,7 @@ {section name=ix loop=$items[user].sections} {$items[user].sections[ix].section}{if not $smarty.section.ix.last},{/if} {/section}</td><td> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php?offset={$offset}&sort_mode={$sort_mode}&find={$find}&remove={$items[user].ban_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this rule?{/tr}')" title="Delete this rule">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php?offset={$offset}&sort_mode={$sort_mode}&find={$find}&remove={$items[user].ban_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this rule?{/tr}')" title="Delete this rule">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> </td></tr> {sectionelse} <tr class="norecords"><td colspan="5">{tr}No records found{/tr}</td></tr> @@ -128,17 +128,17 @@ <div class="pagination"> {if $prev_offset >= 0} -[<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php?offset={$prev_offset}&find={$find}">{tr}prev{/tr}</a>] +[<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php?offset={$prev_offset}&find={$find}">{tr}prev{/tr}</a>] {/if} {tr}Page{/tr}: {$actual_page}/{$cant_pages} {if $next_offset >= 0} - [<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php?offset={$next_offset}&find={$find}">{tr}next{/tr}</a>] + [<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php?offset={$next_offset}&find={$find}">{tr}next{/tr}</a>] {/if} {if $direct_pagination eq 'y'} <br /> {section loop=$cant_pages name=foo} {assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords} -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php offset=$selector_offset"> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php offset=$selector_offset"> {$smarty.section.foo.index_next}</a> {/section} {/if} diff --git a/templates/admin_cookies.tpl b/templates/admin_cookies.tpl index 1ef2028..f71e19a 100644 --- a/templates/admin_cookies.tpl +++ b/templates/admin_cookies.tpl @@ -8,7 +8,7 @@ <div class="body"> <h2>{tr}Create/edit cookies{/tr}</h2> -<form action="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php" method="post"> +<form action="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php" method="post"> <input type="hidden" name="cookie_id" value="{$cookie_id|escape}" /> <table class="panel"> <tr><td> @@ -20,7 +20,7 @@ </form> <h2>{tr}Upload Cookies from textfile{/tr}</h2> -<form enctype="multipart/form-data" action="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php" method="post"> +<form enctype="multipart/form-data" action="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php" method="post"> <table class="panel"> <tr><td>{tr}Upload from disk:{/tr}</td><td> <input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /> @@ -33,7 +33,7 @@ <table class="find"> <tr><td>{tr}Find{/tr}</td> <td> - <form method="get" action="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php"> + <form method="get" action="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php"> <input type="text" name="find" value="{$find|escape}" /> <input type="submit" value="{tr}find{/tr}" name="search" /> <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" /> @@ -44,8 +44,8 @@ <table class="data"> <tr> -<th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={if $sort_mode eq 'cookie_id_desc'}cookie_id_asc{else}cookie_id_desc{/if}">{tr}ID{/tr}</a></th> -<th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={if $sort_mode eq 'cookie_desc'}cookie_asc{else}cookie_desc{/if}">{tr}cookie{/tr}</a></th> +<th><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={if $sort_mode eq 'cookie_id_desc'}cookie_id_asc{else}cookie_id_desc{/if}">{tr}ID{/tr}</a></th> +<th><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={if $sort_mode eq 'cookie_desc'}cookie_asc{else}cookie_desc{/if}">{tr}cookie{/tr}</a></th> <th>{tr}action{/tr}</th> </tr> {cycle values="even,odd" print=false} @@ -54,8 +54,8 @@ <td>{$channels[user].cookie_id}</td> <td>{$channels[user].cookie}</td> <td align="right"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].cookie_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this cookie?{/tr}')" title="{tr}Delete this cookie{/tr}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={$sort_mode}&cookie_id={$channels[user].cookie_id}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].cookie_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this cookie?{/tr}')" title="{tr}Delete this cookie{/tr}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?offset={$offset}&sort_mode={$sort_mode}&cookie_id={$channels[user].cookie_id}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> </td> </tr> {sectionelse} @@ -66,22 +66,22 @@ </div> {* end .body *} <div class="navbar"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?removeall=1">{tr}Remove all cookies{/tr}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?removeall=1">{tr}Remove all cookies{/tr}</a> </div> <div class="pagination"> {if $prev_offset >= 0} -[<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?find={$find}&offset={$prev_offset}&sort_mode={$sort_mode}">{tr}prev{/tr}</a>] +[<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?find={$find}&offset={$prev_offset}&sort_mode={$sort_mode}">{tr}prev{/tr}</a>] {/if} {tr}Page{/tr}: {$actual_page}/{$cant_pages} {if $next_offset >= 0} - [<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?find={$find}&offset={$next_offset}&sort_mode={$sort_mode}">{tr}next{/tr}</a>] + [<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?find={$find}&offset={$next_offset}&sort_mode={$sort_mode}">{tr}next{/tr}</a>] {/if} {if $direct_pagination eq 'y'} <br /> {section loop=$cant_pages name=foo} {assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords} -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php?find={$find}&offset={$selector_offset}&sort_mode={$sort_mode}"> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php?find={$find}&offset={$selector_offset}&sort_mode={$sort_mode}"> {$smarty.section.foo.index_next}</a> {/section} {/if} diff --git a/templates/admin_custom_modules.tpl b/templates/admin_custom_modules.tpl index 70fac6c..9cc3350 100644 --- a/templates/admin_custom_modules.tpl +++ b/templates/admin_custom_modules.tpl @@ -1,4 +1,4 @@ -{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/Attic/admin_custom_modules.tpl,v 1.1 2005/06/19 04:52:54 bitweaver Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/Attic/admin_custom_modules.tpl,v 1.2 2005/08/07 17:38:46 squareing Exp $ *} {strip} <a name="editcreate"></a> @@ -32,7 +32,7 @@ <div class="row submit"> <input type="submit" name="um_update" value="{tr}Save{/tr}" /> {if $um_name ne ''} - <br /><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=custom_modules#editcreate">{tr}Create new custom module{/tr}</a> + <br /><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=custom_modules#editcreate">{tr}Create new custom module{/tr}</a> {/if} </div> {/form} @@ -83,9 +83,9 @@ <td>{$user_modules[user].name}</td> <td>{$user_modules[user].title}</td> <td style="text-align:right"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=layout&module_name=_custom%3Acustom%2F{$user_modules[user].name}">{biticon ipackage=liberty iname=assign iexplain=assign}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=custom_modules&um_edit={$user_modules[user].name}#editcreate">{biticon ipackage=liberty iname=edit iexplain=edit}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=custom_modules&um_remove={$user_modules[user].name}">{biticon ipackage=liberty iname=delete iexplain=delete}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=layout&module_name=_custom%3Acustom%2F{$user_modules[user].name}">{biticon ipackage=liberty iname=assign iexplain=assign}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=custom_modules&um_edit={$user_modules[user].name}#editcreate">{biticon ipackage=liberty iname=edit iexplain=edit}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=custom_modules&um_remove={$user_modules[user].name}">{biticon ipackage=liberty iname=delete iexplain=delete}</a> </td> </tr> {sectionelse} @@ -93,5 +93,5 @@ {/section} </table> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_system.php">{tr}Clear Modules Cache{/tr}</a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_system.php">{tr}Clear Modules Cache{/tr}</a> {/strip} diff --git a/templates/admin_dsn.tpl b/templates/admin_dsn.tpl index 3937a4c..0e487db 100644 --- a/templates/admin_dsn.tpl +++ b/templates/admin_dsn.tpl @@ -8,7 +8,7 @@ <div class="body"> <h2>{tr}Create/edit DSN{/tr}</h2> -<form action="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php" method="post"> +<form action="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php" method="post"> <input type="hidden" name="dsn_id" value="{$dsn_id|escape}" /> <table class="panel"> <tr><td>{tr}name{/tr}:</td><td><input type="text" maxlength="255" size="10" name="name" value="{$info.name|escape}" /></td></tr> @@ -20,8 +20,8 @@ <h2>{tr}DSN{/tr}</h2> <table class="data"> <tr> -<th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={if $sort_mode eq 'name_desc'}name_asc{else}name_desc{/if}">{tr}Name{/tr}</a></th> -<th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={if $sort_mode eq 'dsn_desc'}dsn_asc{else}dsn_desc{/if}">{tr}DSN{/tr}</a></th> +<th><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={if $sort_mode eq 'name_desc'}name_asc{else}name_desc{/if}">{tr}Name{/tr}</a></th> +<th><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={if $sort_mode eq 'dsn_desc'}dsn_asc{else}dsn_desc{/if}">{tr}DSN{/tr}</a></th> <th>{tr}action{/tr}</th> </tr> {cycle values="even,odd" print=false} @@ -30,8 +30,8 @@ <td>{$channels[user].name}</td> <td>{$channels[user].dsn}</td> <td align="right"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].dsn_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this dsn?{/tr}')" title="Delete this DSN">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={$sort_mode}&dsn_id={$channels[user].dsn_id}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].dsn_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this dsn?{/tr}')" title="Delete this DSN">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php?offset={$offset}&sort_mode={$sort_mode}&dsn_id={$channels[user].dsn_id}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> </td> </tr> {sectionelse} @@ -43,17 +43,17 @@ <div class="pagination"> {if $prev_offset >= 0} -[<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php?find={$find}&offset={$prev_offset}&sort_mode={$sort_mode}">{tr}prev{/tr}</a>] +[<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php?find={$find}&offset={$prev_offset}&sort_mode={$sort_mode}">{tr}prev{/tr}</a>] {/if} {tr}Page{/tr}: {$actual_page}/{$cant_pages} {if $next_offset >= 0} - [<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php?find={$find}&offset={$next_offset}&sort_mode={$sort_mode}">{tr}next{/tr}</a>] + [<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php?find={$find}&offset={$next_offset}&sort_mode={$sort_mode}">{tr}next{/tr}</a>] {/if} {if $direct_pagination eq 'y'} <br /> {section loop=$cant_pages name=foo} {assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords} -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php?find={$find}&offset={$selector_offset}&sort_mode={$sort_mode}"> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php?find={$find}&offset={$selector_offset}&sort_mode={$sort_mode}"> {$smarty.section.foo.index_next}</a> {/section} {/if} diff --git a/templates/admin_include_anchors.tpl b/templates/admin_include_anchors.tpl index 60d6b45..8123826 100644 --- a/templates/admin_include_anchors.tpl +++ b/templates/admin_include_anchors.tpl @@ -1,18 +1,18 @@ -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=features" title="{tr}Features{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_features.png" alt="{tr}Features{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=general" title="{tr}General{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_general.png" alt="{tr}General{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=login" title="{tr}Login{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_login.png" alt="{tr}Login{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=wiki" title="{tr}Wiki{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_wiki.png" alt="{tr}Wiki{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=gal" title="{tr}Image Galleries{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_imagegal.png" alt="{tr}Image Galleries{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=fgal" title="{tr}File Galleries{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_filegal.png" alt="{tr}File Galleries{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=blogs" title="{tr}Blogs{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_blogs.png" alt="{tr}Blogs{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=forums" title="{tr}Forums{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_forums.png" alt="{tr}Forums{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=polls" title="{tr}Polls{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_polls.png" alt="{tr}Polls{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=rss" title="{tr}RSS{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_rss.png" alt="{tr}RSS{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=cms" title="{tr}Articles{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_articles.png" alt="{tr}Articles{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=faqs" title="{tr}FAQs{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_faqs.png" alt="{tr}FAQs{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=trackers" title="{tr}Trackers{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_trackers.png" alt="{tr}Trackers{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=webmail" title="{tr}Webmail{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_webmail.png" alt="{tr}Webmail{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=directory" title="{tr}Directory{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_directory.png" alt="{tr}Directory{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=userfiles" title="{tr}User files{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_userfiles.png" alt="{tr}User files{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=maps" title="{tr}Maps{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_maps.png" alt="{tr}Maps{/tr}" /></a> -<a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=search" title="{tr}Search{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_search.png" alt="{tr}Search{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=features" title="{tr}Features{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_features.png" alt="{tr}Features{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=general" title="{tr}General{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_general.png" alt="{tr}General{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=login" title="{tr}Login{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_login.png" alt="{tr}Login{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=wiki" title="{tr}Wiki{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_wiki.png" alt="{tr}Wiki{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=gal" title="{tr}Image Galleries{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_imagegal.png" alt="{tr}Image Galleries{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=fgal" title="{tr}File Galleries{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_filegal.png" alt="{tr}File Galleries{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=blogs" title="{tr}Blogs{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_blogs.png" alt="{tr}Blogs{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=forums" title="{tr}Forums{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_forums.png" alt="{tr}Forums{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=polls" title="{tr}Polls{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_polls.png" alt="{tr}Polls{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=rss" title="{tr}RSS{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_rss.png" alt="{tr}RSS{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=cms" title="{tr}Articles{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_articles.png" alt="{tr}Articles{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=faqs" title="{tr}FAQs{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_faqs.png" alt="{tr}FAQs{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=trackers" title="{tr}Trackers{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_trackers.png" alt="{tr}Trackers{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=webmail" title="{tr}Webmail{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_webmail.png" alt="{tr}Webmail{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=directory" title="{tr}Directory{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_directory.png" alt="{tr}Directory{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=userfiles" title="{tr}User files{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_userfiles.png" alt="{tr}User files{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=maps" title="{tr}Maps{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_maps.png" alt="{tr}Maps{/tr}" /></a> +<a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=search" title="{tr}Search{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_search.png" alt="{tr}Search{/tr}" /></a> diff --git a/templates/admin_menu_options.tpl b/templates/admin_menu_options.tpl index 50cb7ef..cbde053 100644 --- a/templates/admin_menu_options.tpl +++ b/templates/admin_menu_options.tpl @@ -77,24 +77,26 @@ {/form} <div class="navbar"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=menus">{tr}List menus{/tr}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=menus&menu_id={$menu_id}">{tr}Edit this menu{/tr}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=menus">{tr}List menus{/tr}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=menus&menu_id={$menu_id}">{tr}Edit this menu{/tr}</a> </div> </td> </tr> </table> -<h2>{tr}Menu options{/tr}</h2> +{minifind menu_id=$menu_id sort_mode=$sort_mode page=$page} + <table class="data"> + <caption>{tr}Menu Options{/tr}</caption> <tr> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'option_id_desc'}option_id_asc{else}option_id_desc{/if}">{tr}ID{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'position_desc'}position_asc{else}position_desc{/if}">{tr}Position{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'name_desc'}name_asc{else}name_desc{/if}">{tr}Name{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'url_desc'}url_asc{else}url_desc{/if}">{tr}URL{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'type_desc'}type_asc{else}type_desc{/if}">{tr}Type{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'section_desc'}section_asc{else}section_desc{/if}">{tr}Sections{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'perm_desc'}perm_asc{else}perm_desc{/if}">{tr}Permissions{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'groupnam_desc'}groupname_asc{else}groupname_desc{/if}">{tr}Group{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'option_id_desc'}option_id_asc{else}option_id_desc{/if}">{tr}ID{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'position_desc'}position_asc{else}position_desc{/if}">{tr}Position{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'name_desc'}name_asc{else}name_desc{/if}">{tr}Name{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'url_desc'}url_asc{else}url_desc{/if}">{tr}URL{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'type_desc'}type_asc{else}type_desc{/if}">{tr}Type{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'section_desc'}section_asc{else}section_desc{/if}">{tr}Sections{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'perm_desc'}perm_asc{else}perm_desc{/if}">{tr}Permissions{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={if $sort_mode eq 'groupnam_desc'}groupname_asc{else}groupname_desc{/if}">{tr}Group{/tr}</a></th> <th>{tr}Action{/tr}</th> </tr> {cycle values="even,odd" print=false} @@ -109,8 +111,8 @@ <td>{$channels[user].perm}</td> <td>{$channels[user].groupname}</td> <td align="right"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].option_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this menu item?{/tr}')" title="{tr}Delete this menu{/tr}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={$sort_mode}&option_id={$channels[user].option_id}" title="Edit this menu">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].option_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this menu item?{/tr}')" title="{tr}Delete this menu{/tr}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&menu_id={$menu_id}&offset={$offset}&sort_mode={$sort_mode}&option_id={$channels[user].option_id}" title="Edit this menu">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> </td> </tr> {sectionelse} @@ -120,6 +122,4 @@ {pagination menu_id=$menu_id page=$page} -{minifind menu_id=$menu_id sort_mode=$sort_mode page=$page} - {/strip} diff --git a/templates/admin_menus.tpl b/templates/admin_menus.tpl index 1616fac..fb25819 100644 --- a/templates/admin_menus.tpl +++ b/templates/admin_menus.tpl @@ -7,7 +7,7 @@ {jstab title="Create new Menu"} {/if} {if $menu_id > 0} - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}">{tr}Create new Menu{/tr}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}">{tr}Create new Menu{/tr}</a> {/if} {form legend="Edit/Create new Menu"} <input type="hidden" name="page" value="{$page}" /> @@ -45,14 +45,15 @@ </div> {/form} - <h2>{tr}List of configured menus{/tr}</h2> + {minifind sort_mode=$sort_mode page=$page} <table class="data"> + <caption>{tr}List of configured menus{/tr}</caption> <tr> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'menu_id_asc'}menu_id_desc{else}menu_id_asc{/if}">{tr}ID{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'name_asc'}name_desc{else}name_asc{/if}">{tr}Name{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'description_asc'}description_desc{else}description_asc{/if}">{tr}Description{/tr}</a></th> - <th><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'type_asc'}type_desc{else}type_asc{/if}">{tr}Type{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'menu_id_asc'}menu_id_desc{else}menu_id_asc{/if}">{tr}ID{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'name_asc'}name_desc{else}name_asc{/if}">{tr}Name{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'description_asc'}description_desc{else}description_asc{/if}">{tr}Description{/tr}</a></th> + <th><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={if $sort_mode eq 'type_asc'}type_desc{else}type_asc{/if}">{tr}Type{/tr}</a></th> <th>{tr}Options{/tr}</th> <th>{tr}Action{/tr}</th> </tr> @@ -66,9 +67,9 @@ <td>{$channels[user].type}</td> <td>{$channels[user].options}</td> <td class="actionicon"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={$sort_mode}&menu_id={$channels[user].menu_id}" title="{tr}Edit this menu{/tr}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=menu_options&menu_id={$channels[user].menu_id}" title="{tr}Configure this menu{/tr}">{biticon ipackage=liberty iname="config" iexplain="configure"}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].menu_id}" + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={$sort_mode}&menu_id={$channels[user].menu_id}" title="{tr}Edit this menu{/tr}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=menu_options&menu_id={$channels[user].menu_id}" title="{tr}Configure this menu{/tr}">{biticon ipackage=liberty iname="config" iexplain="configure"}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$page}&offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].menu_id}" onclick="return confirm('{tr}Are you sure you want to delete this menu?{/tr}')" title="{tr}Delete this menu{/tr}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> </td> </tr> @@ -79,8 +80,6 @@ {pagination page=$page} - {minifind sort_mode=$sort_mode page=$page} - {/jstab} {jstab title="Global Menu Settings"} diff --git a/templates/admin_notifications.tpl b/templates/admin_notifications.tpl index 3bd7939..6b863c3 100644 --- a/templates/admin_notifications.tpl +++ b/templates/admin_notifications.tpl @@ -39,6 +39,8 @@ </div> {/form} + {minifind sort_mode=$sort_mode find=$find} + <table class="data"> <caption>{tr}Active Notifications{/tr}</caption> <tr> @@ -60,8 +62,6 @@ {/section} </table> - {minifind sort_mode=$sort_mode find=$find} - {pagination} </div><!-- end .body --> </div><!-- end .notifications --> diff --git a/templates/admin_packages.tpl b/templates/admin_packages.tpl index 35dfe08..803014b 100644 --- a/templates/admin_packages.tpl +++ b/templates/admin_packages.tpl @@ -1,4 +1,4 @@ -{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/admin_packages.tpl,v 1.2 2005/07/17 17:36:06 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/admin_packages.tpl,v 1.3 2005/08/07 17:38:46 squareing Exp $ *} {strip} @@ -59,7 +59,7 @@ <br /> {box title="How to install bitweaver Packages"} - {tr}To install more packages, please run the <a href='{$gBitLoc.INSTALL_PKG_URL}install.php?step=3'>installer</a> to choose your desired packages.{/tr} + {tr}To install more packages, please run the <a href='{$smarty.const.INSTALL_PKG_URL}install.php?step=3'>installer</a> to choose your desired packages.{/tr} <br /> <small><strong>{tr}Note{/tr}</strong> : {tr}you might have to rename your 'install/install.done' file back to 'install/install.php' to be able to install more packages{/tr}</small> {/box} diff --git a/templates/admin_system.tpl b/templates/admin_system.tpl index 262721b..708b7ec 100644 --- a/templates/admin_system.tpl +++ b/templates/admin_system.tpl @@ -12,22 +12,22 @@ <th colspan="4">{tr}Exterminator{/tr}</th> </tr> <tr class="odd"> - <td style="width:55%;"><strong>{$gBitLoc.TEMP_PKG_PATH}lang/</strong></td> + <td style="width:55%;"><strong>{$smarty.const.TEMP_PKG_PATH}lang/</strong></td> <td style="width:15%; text-align:right;">{tr}{$du.lang.cant} files{/tr}</td> <td style="width:15%; text-align:right;">{$du.lang.total|kbsize}</td> - <td style="width:15%; text-align:right;"><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_system.php?do=lang_cache">{tr}Empty{/tr}</a></td> + <td style="width:15%; text-align:right;"><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_system.php?do=lang_cache">{tr}Empty{/tr}</a></td> </tr> <tr class="even"> - <td><strong>{$gBitLoc.TEMP_PKG_PATH}templates_c/</strong></td> + <td><strong>{$smarty.const.TEMP_PKG_PATH}templates_c/</strong></td> <td style="text-align:right;">{tr}{$du.templates_c.cant} files{/tr}</td> <td style="text-align:right;">{$du.templates_c.total|kbsize}</td> - <td style="text-align:right;"><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_system.php?do=templates_c">{tr}Empty{/tr}</a></td> + <td style="text-align:right;"><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_system.php?do=templates_c">{tr}Empty{/tr}</a></td> </tr> <tr class="odd"> - <td><strong>{$gBitLoc.TEMP_PKG_PATH}modules/cache/</strong></td> + <td><strong>{$smarty.const.TEMP_PKG_PATH}modules/cache/</strong></td> <td style="text-align:right;">{tr}{$du.modules.cant} files{/tr}</td> <td style="text-align:right;">{$du.modules.total|kbsize}</td> - <td style="text-align:right;"><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_system.php?do=modules_cache">{tr}Empty{/tr}</a></td> + <td style="text-align:right;"><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_system.php?do=modules_cache">{tr}Empty{/tr}</a></td> </tr> </table> @@ -40,7 +40,7 @@ <td style="width:55%;"><strong>{$key}</strong></td> <td style="width:15%; text-align:right;">{tr}{$item.cant} files{/tr}</td> <td style="width:15%; text-align:right;">{$item.total|kbsize}</td> - <td style="width:15%; text-align:right;"><a href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_system.php?compiletemplates={$key}">{tr}Compile{/tr}</a></td> + <td style="width:15%; text-align:right;"><a href="{$smarty.const.KERNEL_PKG_URL}admin/admin_system.php?compiletemplates={$key}">{tr}Compile{/tr}</a></td> </tr> {/foreach} </table> diff --git a/templates/anchors.tpl b/templates/anchors.tpl index a5cc93f..61788e4 100644 --- a/templates/anchors.tpl +++ b/templates/anchors.tpl @@ -1,6 +1,6 @@ {assign var="i" value="1"} {foreach name=admin_panels key=key item=item from=$admin_panels} {if $item.adminPanel} - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$item.adminPanel}" title="{tr}{$item.title}{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_{$item.adminPanel}.png" alt="{tr}{$item.title}{/tr}" /></a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$item.adminPanel}" title="{tr}{$item.title}{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_{$item.adminPanel}.png" alt="{tr}{$item.title}{/tr}" /></a> {/if} {/foreach} diff --git a/templates/backup.tpl b/templates/backup.tpl index cd969ed..def4670 100644 --- a/templates/backup.tpl +++ b/templates/backup.tpl @@ -7,7 +7,7 @@ <div class="body"> {if $restore eq 'y'} - {formfeedback warning="Restoring a backup will erase all existing data before populating it with the data in the restore file. If something goes wrong you might loose all your data. We recommend that you first back up your existing database using an external tool.<br /><a href=\"`$gBitLoc.KERNEL_PKG_URL`admin/backup.php?rrestore=`$restorefile`\">Click here to restore the selected database</a>"} + {formfeedback warning="Restoring a backup will erase all existing data before populating it with the data in the restore file. If something goes wrong you might loose all your data. We recommend that you first back up your existing database using an external tool.<br /><a href=\"`$smarty.const.KERNEL_PKG_URL`admin/backup.php?rrestore=`$restorefile`\">Click here to restore the selected database</a>"} {/if} {jstabs} @@ -51,12 +51,12 @@ {cycle values="even,odd" print=false} {section name=user loop=$backups} <tr class="{cycle}"> - <td><a href="{$gBitLoc.STORAGE_PKG_URL}backups/{$backups[user].filename}" title="{$backups[user].filename}">{$backups[user].filename|truncate:20:"...":true}</a></td> + <td><a href="{$smarty.const.STORAGE_PKG_URL}backups/{$backups[user].filename}" title="{$backups[user].filename}">{$backups[user].filename|truncate:20:"...":true}</a></td> <td>{$backups[user].created|bit_short_datetime}</td> <td>{$backups[user].size|string_format:"%.2f"} Mb</td> <td class="actionicon"> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/backup.php?remove={$backups[user].filename}">{tr}remove{/tr}</a> - <a href="{$gBitLoc.KERNEL_PKG_URL}admin/backup.php?restore={$backups[user].filename}">{tr}restore{/tr}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/backup.php?remove={$backups[user].filename}">{tr}remove{/tr}</a> + <a href="{$smarty.const.KERNEL_PKG_URL}admin/backup.php?restore={$backups[user].filename}">{tr}restore{/tr}</a> </td> </tr> {sectionelse} diff --git a/templates/bitweaver.tpl b/templates/bitweaver.tpl index 6f7f791..caaf172 100644 --- a/templates/bitweaver.tpl +++ b/templates/bitweaver.tpl @@ -17,6 +17,7 @@ <td id="tikimain"> <div id="tikimainfx"> {include file="bitpackage:liberty/display_structure.tpl"} + <a style="padding:0;margin:0;border:0;" name="content"></a> {if $pageError} <div class="error">{$pageError}</div> {/if} diff --git a/templates/error.tpl b/templates/error.tpl index 5b15db8..532eed2 100644 --- a/templates/error.tpl +++ b/templates/error.tpl @@ -13,7 +13,7 @@ {/if} {if $page and ( $gBitUser->isAdmin() or $gBitUser->hasPermission( 'bit_p_admin_wiki' ) )} - <p>{tr}Create the page{/tr}: <a href="{$gBitLoc.WIKI_PKG_URL}edit.php?page={$page}">{$page}</a></p> + <p>{tr}Create the page{/tr}: <a href="{$smarty.const.WIKI_PKG_URL}edit.php?page={$page}">{$page}</a></p> {/if} <p><a href="javascript:history.back()">{tr}Go back{/tr}</a></p> diff --git a/templates/header.tpl b/templates/header.tpl index 4d32a63..121576b 100644 --- a/templates/header.tpl +++ b/templates/header.tpl @@ -1,18 +1,18 @@ -{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/header.tpl,v 1.8 2005/07/17 17:36:06 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/header.tpl,v 1.9 2005/08/07 17:38:46 squareing Exp $ *} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>{$browserTitle} - {$siteTitle}</title> {* get custom header files from individual packages *} - {foreach from=$gBitLoc.headerIncFiles item=file} + {foreach from=$gBitSystem->mStyles.headerIncFiles item=file} {include file=$file} {/foreach} </head> <body> {if $minical_reminders>100} - <iframe width="0" height="0" border="0" src="{$gBitLoc.CALENDAR_PKG_URL}minical_reminders.php" /> + <iframe width="0" height="0" border="0" src="{$smarty.const.CALENDAR_PKG_URL}minical_reminders.php" /> {/if} {if $gBitSystem->isFeatureActive( 'feature_helppopup' )} - {popup_init src="`$gBitLoc.THEMES_PKG_URL`js/overlib.js"} + {popup_init src="`$smarty.const.THEMES_PKG_URL`js/overlib.js"} {/if} diff --git a/templates/header_inc.tpl b/templates/header_inc.tpl index c349d73..799f1ec 100644 --- a/templates/header_inc.tpl +++ b/templates/header_inc.tpl @@ -1,32 +1,32 @@ -{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/header_inc.tpl,v 1.2 2005/07/17 17:36:07 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/header_inc.tpl,v 1.3 2005/08/07 17:38:46 squareing Exp $ *} {strip} <meta name="generator" content="bitweaver - http://www.bitweaver.org" /> <meta name="description" content="{$gBitSystemPrefs.site_description}" /> <meta name="keywords" content="{$gBitSystemPrefs.site_keywords}" /> - <link rel="shortcut icon" href="{$gBitLoc.BIT_ROOT_URL}favicon.ico" type="image/x-icon" /> - <link rel="start" title="{$siteTitle} {tr}Home Page{/tr}" href="{$gBitLoc.BIT_ROOT_URL}" /> + <link rel="shortcut icon" href="{$smarty.const.BIT_ROOT_URL}favicon.ico" type="image/x-icon" /> + <link rel="start" title="{$siteTitle} {tr}Home Page{/tr}" href="{$smarty.const.BIT_ROOT_URL}" /> <link rel="help" title="{tr}Help{/tr}" href="http://www.bitweaver.org/" /> {/strip} <script type="text/javascript"><!-- - var tikiCookiePath = "{$gBitLoc.cookie_path}"; - var tikiCookieDomain = "{$gBitLoc.cookie_domain}"; - var tikiIconDir = "{$gBitLoc.LIBERTY_PKG_URL}icons"; - var tikiRootUrl = "{$gBitLoc.BIT_ROOT_URL}"; + var tikiCookiePath = "{$gBitSystem->mPrefs.cookie_path}"; + var tikiCookieDomain = "{$gBitSystem->mPrefs.cookie_domain}"; + var tikiIconDir = "{$smarty.const.LIBERTY_PKG_URL}icons"; + var tikiRootUrl = "{$smarty.const.BIT_ROOT_URL}"; //alert( tikiCookiePath ); //alert( tikiCookieDomain ); --></script> -<script type="text/javascript" src="{$gBitLoc.KERNEL_PKG_URL}bitweaver.js"></script> +<script type="text/javascript" src="{$smarty.const.KERNEL_PKG_URL}bitweaver.js"></script> {include file="bitpackage:kernel/bidi.tpl"} {* --- jscalendar block --- *} {if $gBitSystem->isFeatureActive( 'feature_jscalendar' )} - <link rel="StyleSheet" type="text/css" media="all" href="{$gBitLoc.JSCALENDAR_PKG_URL}calendar-system.css" title="system" /> - <script type="text/javascript" src="{$gBitLoc.JSCALENDAR_PKG_URL}calendar.js"></script> - <script type="text/javascript" src="{$gBitLoc.JSCALENDAR_PKG_URL}lang/calendar-en.js"></script> - <script type="text/javascript" src="{$gBitLoc.JSCALENDAR_PKG_URL}calendar-setup.js"></script> + <link rel="StyleSheet" type="text/css" media="all" href="{$smarty.const.JSCALENDAR_PKG_URL}calendar-system.css" title="system" /> + <script type="text/javascript" src="{$smarty.const.JSCALENDAR_PKG_URL}calendar.js"></script> + <script type="text/javascript" src="{$smarty.const.JSCALENDAR_PKG_URL}lang/calendar-en.js"></script> + <script type="text/javascript" src="{$smarty.const.JSCALENDAR_PKG_URL}calendar-setup.js"></script> {/if} {$trl} diff --git a/templates/list_cache.tpl b/templates/list_cache.tpl index 7ce93a7..8188789 100644 --- a/templates/list_cache.tpl +++ b/templates/list_cache.tpl @@ -10,7 +10,7 @@ <table class="find"> <tr><td>{tr}Find{/tr}</td> <td> - <form method="get" action="{$gBitLoc.THEMES_PKG_URL}list_cache.php"> + <form method="get" action="{$smarty.const.THEMES_PKG_URL}list_cache.php"> <input type="text" name="find" value="{$find|escape}" /> <input type="submit" value="{tr}find{/tr}" name="search" /> <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" /> @@ -21,8 +21,8 @@ <table class="data"> <tr> -<th><a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={if $sort_mode eq 'url_desc'}url_asc{else}url_desc{/if}">{tr}URL{/tr}</a></th> -<th><a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={if $sort_mode eq 'refresh_desc'}refresh_asc{else}refresh_desc{/if}">{tr}Last updated{/tr}</a></th> +<th><a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={if $sort_mode eq 'url_desc'}url_asc{else}url_desc{/if}">{tr}URL{/tr}</a></th> +<th><a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={if $sort_mode eq 'refresh_desc'}refresh_asc{else}refresh_desc{/if}">{tr}Last updated{/tr}</a></th> <th>{tr}Action{/tr}</th> </tr> {section name=changes loop=$listpages} @@ -30,17 +30,17 @@ {if $smarty.section.changes.index % 2} <td><a href="{$listpages[changes].url}">{$listpages[changes].url}</a></td> <td>{$listpages[changes].refresh|bit_short_datetime}</td> -<td><a href="{$gBitLoc.THEMES_PKG_URL}view_cache.php?cache_id={$listpages[changes].cache_id}">{tr}view{/tr}</a><br /> -<a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&remove={$listpages[changes].cache_id}">{tr}remove{/tr}</a><br /> -<a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&refresh={$listpages[changes].cache_id}">{tr}refresh{/tr}</a></td> +<td><a href="{$smarty.const.THEMES_PKG_URL}view_cache.php?cache_id={$listpages[changes].cache_id}">{tr}view{/tr}</a><br /> +<a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&remove={$listpages[changes].cache_id}">{tr}remove{/tr}</a><br /> +<a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&refresh={$listpages[changes].cache_id}">{tr}refresh{/tr}</a></td> </tr> {else} <tr class="even"> <td><a href="{$listpages[changes].url}">{$listpages[changes].url}</a></td> <td>{$listpages[changes].refresh|bit_short_datetime}</td> -<td><a href="{$gBitLoc.THEMES_PKG_URL}view_cache.php?cache_id={$listpages[changes].cache_id}">{tr}view{/tr}</a><br /> -<a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&remove={$listpages[changes].cache_id}">{tr}remove{/tr}</a><br /> -<a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&refresh={$listpages[changes].cache_id}">{tr}refresh{/tr}</a></td> +<td><a href="{$smarty.const.THEMES_PKG_URL}view_cache.php?cache_id={$listpages[changes].cache_id}">{tr}view{/tr}</a><br /> +<a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&remove={$listpages[changes].cache_id}">{tr}remove{/tr}</a><br /> +<a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?offset={$offset}&sort_mode={$sort_mode}&refresh={$listpages[changes].cache_id}">{tr}refresh{/tr}</a></td> </tr> {/if} {sectionelse} @@ -52,17 +52,17 @@ <div class="pagination"> {if $prev_offset >= 0} -[<a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?find={$find}&offset={$prev_offset}&sort_mode={$sort_mode}">{tr}prev{/tr}</a>] +[<a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?find={$find}&offset={$prev_offset}&sort_mode={$sort_mode}">{tr}prev{/tr}</a>] {/if} {tr}Page{/tr}: {$actual_page}/{$cant_pages} {if $next_offset >= 0} - [<a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?find={$find}&offset={$next_offset}&sort_mode={$sort_mode}">{tr}next{/tr}</a>] + [<a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?find={$find}&offset={$next_offset}&sort_mode={$sort_mode}">{tr}next{/tr}</a>] {/if} {if $direct_pagination eq 'y'} <br /> {section loop=$cant_pages name=foo} {assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords} -<a href="{$gBitLoc.THEMES_PKG_URL}list_cache.php?find={$find}&offset={$selector_offset}&sort_mode={$sort_mode}">{$smarty.section.foo.index_next}</a> +<a href="{$smarty.const.THEMES_PKG_URL}list_cache.php?find={$find}&offset={$selector_offset}&sort_mode={$sort_mode}">{$smarty.section.foo.index_next}</a> {/section} {/if} </div> diff --git a/templates/list_sections.tpl b/templates/list_sections.tpl index 624fca4..20c4e30 100644 --- a/templates/list_sections.tpl +++ b/templates/list_sections.tpl @@ -5,7 +5,7 @@ {assign var="i" value="1"} {foreach name=admin_panels key=key item=item from=$admin_panels} {if $item.adminPanel} - <td width="25%" style="text-align:center;vertical-align:top;"><a href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page={$item.adminPanel}" title="{tr}{$item.title}{/tr}"><img class="icon" src="{$gBitLoc.IMG_PKG_URL}icons/admin_{$item.adminPanel}.png" alt="{tr}{$item.title}{/tr}" /><br />{tr}{$item.title}{/tr}</a></td> + <td width="25%" style="text-align:center;vertical-align:top;"><a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page={$item.adminPanel}" title="{tr}{$item.title}{/tr}"><img class="icon" src="{$smarty.const.IMG_PKG_URL}icons/admin_{$item.adminPanel}.png" alt="{tr}{$item.title}{/tr}" /><br />{tr}{$item.title}{/tr}</a></td> {if not ($i++ mod 4)} </tr><tr> {/if} diff --git a/templates/menu_admin.tpl b/templates/menu_admin.tpl index 597fa1c..5480500 100644 --- a/templates/menu_admin.tpl +++ b/templates/menu_admin.tpl @@ -7,37 +7,37 @@ {sortlinks} {if $gBitSystem->isFeatureActive( 'feature_live_support' ) and ($gBitUser->hasPermission( 'bit_p_live_support_admin' ) or $user_is_operator eq 'y')} - <li><a class="item" href="{$gBitLoc.LIVE_SUPPORT_PKG_URL}admin/index.php">{tr}Live support{/tr}</a></li> + <li><a class="item" href="{$smarty.const.LIVE_SUPPORT_PKG_URL}admin/index.php">{tr}Live support{/tr}</a></li> {/if} {if $gBitSystem->isFeatureActive( 'feature_calendar' ) and ($gBitUser->hasPermission( 'bit_p_admin_calendar' ))} - <li><a class="item" href="{$gBitLoc.CALENDAR_PKG_URL}admin/index.php">{tr}Calendar{/tr}</a></li> + <li><a class="item" href="{$smarty.const.CALENDAR_PKG_URL}admin/index.php">{tr}Calendar{/tr}</a></li> {/if} {if $gBitUser->isAdmin()} {if $gBitSystem->isFeatureActive( 'feature_featuredLinks' )} - <li><a class="item" href="{$gBitLoc.FEATURED_LINKS_PKG_URL}admin/index.php">{tr}Links{/tr}</a></li> + <li><a class="item" href="{$smarty.const.FEATURED_LINKS_PKG_URL}admin/index.php">{tr}Links{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_polls' )} - <li><a class="item" href="{$gBitLoc.POLLS_PKG_URL}edit.php">{tr}Polls{/tr}</a></li> + <li><a class="item" href="{$smarty.const.POLLS_PKG_URL}edit.php">{tr}Polls{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_theme_control' )} - <li><a class="item" href="{$gBitLoc.THEMES_PKG_URL}theme_control.php">{tr}Theme control{/tr}</a></li> + <li><a class="item" href="{$smarty.const.THEMES_PKG_URL}theme_control.php">{tr}Theme control{/tr}</a></li> {/if} {/if}{if $gBitSystem->isFeatureActive( 'feature_chat' ) and $gBitUser->hasPermission( 'bit_p_admin_chat' )} - <li><a class="item" href="{$gBitLoc.CHAT_PKG_URL}admin/index.php">{tr}Chat{/tr}</a></li> + <li><a class="item" href="{$smarty.const.CHAT_PKG_URL}admin/index.php">{tr}Chat{/tr}</a></li> {/if}{if $gBitSystem->isPackageActive( 'categories' ) and $gBitUser->hasPermission( 'bit_p_admin_categories' )} - <li><a class="item" href="{$gBitLoc.CATEGORIES_PKG_URL}admin/index.php">{tr}Categories{/tr}</a></li> + <li><a class="item" href="{$smarty.const.CATEGORIES_PKG_URL}admin/index.php">{tr}Categories{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_banners' ) and $gBitUser->hasPermission( 'bit_p_admin_banners' )} - <li><a class="item" href="{$gBitLoc.BANNERS_PKG_URL}admin/index.php">{tr}Banners{/tr}</a></li> + <li><a class="item" href="{$smarty.const.BANNERS_PKG_URL}admin/index.php">{tr}Banners{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_drawings' ) and $gBitUser->hasPermission( 'bit_p_admin_drawings' )} - <li><a class="item" href="{$gBitLoc.DRAWINGS_PKG_URL}admin/index.php">{tr}Drawings{/tr}</a></li> + <li><a class="item" href="{$smarty.const.DRAWINGS_PKG_URL}admin/index.php">{tr}Drawings{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_dynamic_content' ) and $gBitUser->hasPermission( 'bit_p_admin_dynamic' )} - <li><a class="item" href="{$gBitLoc.DCS_PKG_URL}index.php">{tr}Dynamic content{/tr}</a></li> + <li><a class="item" href="{$smarty.const.DCS_PKG_URL}index.php">{tr}Dynamic content{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_webmail' ) and $gBitUser->hasPermission( 'bit_p_admin_mailin' )} - <li><a class="item" href="{$gBitLoc.WEBMAIL_PKG_URL}admin/admin_mailin.php">{tr}Mail-in{/tr}</a></li> + <li><a class="item" href="{$smarty.const.WEBMAIL_PKG_URL}admin/admin_mailin.php">{tr}Mail-in{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_html_pages' ) and $gBitUser->hasPermission( 'bit_p_edit_html_pages' )} - <li><a class="item" href="{$gBitLoc.HTML_PKG_URL}admin/admin_html_pages.php">{tr}HTML pages{/tr}</a></li> + <li><a class="item" href="{$smarty.const.HTML_PKG_URL}admin/admin_html_pages.php">{tr}HTML pages{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_referer_stats' ) and $gBitUser->hasPermission( 'bit_p_view_referer_stats' )} - <li><a class="item" href="{$gBitLoc.STATS_PKG_URL}referer_stats.php">{tr}Referer stats{/tr}</a></li> + <li><a class="item" href="{$smarty.const.STATS_PKG_URL}referer_stats.php">{tr}Referer stats{/tr}</a></li> {/if}{if $gBitSystem->isFeatureActive( 'feature_integrator' ) and $gBitUser->hasPermission( 'bit_p_admin_integrator' )} - <li><a class="item" href="{$gBitLoc.INTEGRATOR_PKG_URL}admin/index.php">{tr}Integrator{/tr}</a></li> + <li><a class="item" href="{$smarty.const.INTEGRATOR_PKG_URL}admin/index.php">{tr}Integrator{/tr}</a></li> {/if} {/sortlinks} diff --git a/templates/menu_global.tpl b/templates/menu_global.tpl index edf2134..b19d26b 100644 --- a/templates/menu_global.tpl +++ b/templates/menu_global.tpl @@ -1,9 +1,14 @@ {strip} -<ul> - {if $gBitSystem->isFeatureActive( 'feature_contact' )} - <li><a class="item" href="{$gBitLoc.MESSU_PKG_URL}contact.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Contact us{/tr}</a></li> - {/if} - <li><a class="item" href="{$gBitLoc.LIBERTY_PKG_URL}list_content.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}All available Content{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}index.php">{biticon ipackage=users iname=users iforce=icon} {tr}Users List{/tr}</a></li> -</ul> +{if $gBitSystem->isFeatureActive( 'feature_contact' ) or $gBitUser->isRegistered()} + <ul> + {if $gBitSystem->isFeatureActive( 'feature_contact' )} + <li><a class="item" href="{$smarty.const.MESSU_PKG_URL}contact.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Contact us{/tr}</a></li> + {/if} + + {if $gBitUser->isRegistered()} + <li><a class="item" href="{$smarty.const.LIBERTY_PKG_URL}list_content.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}All available Content{/tr}</a></li> + <li><a class="item" href="{$smarty.const.USERS_PKG_URL}index.php">{biticon ipackage=users iname=users iforce=icon} {tr}Users List{/tr}</a></li> + {/if} + </ul> +{/if} {/strip} diff --git a/templates/menu_kernel_admin.tpl b/templates/menu_kernel_admin.tpl index d1aeeb6..c55acf5 100644 --- a/templates/menu_kernel_admin.tpl +++ b/templates/menu_kernel_admin.tpl @@ -1,30 +1,30 @@ {strip} <ul> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=packages" title="{tr}Packages{/tr}" >{tr}Packages{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=features" title="{tr}Features{/tr}" >{tr}Features{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=general" title="{tr}General{/tr}" >{tr}General Settings{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=server" title="{tr}Server{/tr}" >{tr}Server Settings{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=packages" title="{tr}Packages{/tr}" >{tr}Packages{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=features" title="{tr}Features{/tr}" >{tr}Features{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=general" title="{tr}General{/tr}" >{tr}General Settings{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=server" title="{tr}Server{/tr}" >{tr}Server Settings{/tr}</a></li> {if $gBitUser->hasPermission( 'bit_p_edit_content_templates' )} - <li><a class="item" href="{$gBitLoc.THEMES_PKG_URL}admin/admin_content_templates.php">{tr}Content templates{/tr}</a></li> + <li><a class="item" href="{$smarty.const.THEMES_PKG_URL}admin/admin_content_templates.php">{tr}Content templates{/tr}</a></li> {/if} - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/backup.php">{tr}Backups{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/backup.php">{tr}Backups{/tr}</a></li> {if $gBitSystem->isFeatureActive( 'feature_banning' ) and ($gBitUser->hasPermission( 'bit_p_admin_banning' ))} - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_banning.php">{tr}Banning{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/admin_banning.php">{tr}Banning{/tr}</a></li> {/if} - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/db_performance.php">{tr}Database Performance{/tr}</a></li> - {* unused - spiderr <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_dsn.php">{tr}DSN{/tr}</a></li> *} - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_system.php">{tr}System Cache{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/list_cache.php">{tr}Link Cache{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/phpinfo.php">{tr}PHPinfo{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_notifications.php">{tr}Notification{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/db_performance.php">{tr}Database Performance{/tr}</a></li> + {* unused - spiderr <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/admin_dsn.php">{tr}DSN{/tr}</a></li> *} + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/admin_system.php">{tr}System Cache{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/list_cache.php">{tr}Link Cache{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/phpinfo.php">{tr}PHPinfo{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/admin_notifications.php">{tr}Notification{/tr}</a></li> {if $gBitUser->hasPermission( 'bit_p_edit_cookies' )} - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/admin_cookies.php">{tr}Cookies{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/admin_cookies.php">{tr}Cookies{/tr}</a></li> {/if} {if $gBitSystem->isFeatureActive( 'feature_debug_console' )} <li><a class="item" href="javascript:toggle('debugconsole');">{tr}Debugger console{/tr}</a></li> {/if} - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?version_check=1">{tr}Check Version{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?version_check=1">{tr}Check Version{/tr}</a></li> </ul> {/strip} diff --git a/templates/menu_layout_admin.tpl b/templates/menu_layout_admin.tpl index 4f7058a..c5313e2 100644 --- a/templates/menu_layout_admin.tpl +++ b/templates/menu_layout_admin.tpl @@ -1,9 +1,9 @@ {strip} <ul> - <li><a class="item" href="{$gBitLoc.THEMES_PKG_URL}admin/admin_themes_manager.php">{tr}Themes Manager{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=layout" >{tr}Layout{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=modules">{tr}Module Settings{/tr}</a></li> - <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=custom_modules">{tr}Custom Modules{/tr}</a></li> -{* <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=menus">{tr}Menus{/tr}</a></li>*} + <li><a class="item" href="{$smarty.const.THEMES_PKG_URL}admin/admin_themes_manager.php">{tr}Themes Manager{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=layout" >{tr}Layout{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=modules">{tr}Module Settings{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=custom_modules">{tr}Custom Modules{/tr}</a></li> +{* <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=menus">{tr}Menus{/tr}</a></li>*} </ul> {/strip} diff --git a/templates/object_permissions.tpl b/templates/object_permissions.tpl index 74b6912..8827dbb 100644 --- a/templates/object_permissions.tpl +++ b/templates/object_permissions.tpl @@ -15,7 +15,7 @@ <tr class="{cycle}"><td> {$page_perms[pg].group_name}</td><td> {$page_perms[pg].perm_name}</td><td align="right"> -<a href="{$gBitLoc.KERNEL_PKG_URL}object_permissions.php?referer={$referer}&action=remove&objectName={$objectName}&object_id={$object_id}&object_type={$object_type}&permType={$permType}&page_id={$pageInfo.page_id}&perm={$page_perms[pg].perm_name}&group={$page_perms[pg].group_name}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> +<a href="{$smarty.const.KERNEL_PKG_URL}object_permissions.php?referer={$referer}&action=remove&objectName={$objectName}&object_id={$object_id}&object_type={$object_type}&permType={$permType}&page_id={$pageInfo.page_id}&perm={$page_perms[pg].perm_name}&group={$page_perms[pg].group_name}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a> </td></tr> {sectionelse} <tr class="norecords"><td colspan="3">{tr}No individual permissions, global permissions apply{/tr}</td></tr> @@ -25,7 +25,7 @@ <br /> <h2>{tr}Assign permissions to this object{/tr}</h2> -<form method="post" action="{$gBitLoc.KERNEL_PKG_URL}object_permissions.php"> +<form method="post" action="{$smarty.const.KERNEL_PKG_URL}object_permissions.php"> <input type="hidden" name="page" value="{$page|escape}" /> <input type="hidden" name="referer" value="{$referer|escape}" /> <input type="hidden" name="objectName" value="{$objectName|escape}" /> diff --git a/templates/top.tpl b/templates/top.tpl index 11a77bf..dfa5eac 100644 --- a/templates/top.tpl +++ b/templates/top.tpl @@ -5,11 +5,11 @@ {if $gBitUser->isRegistered()} {tr}Welcome{/tr}, <b>{displayname hash=$gBitUser->mInfo}</b> - <a href="{$gBitLoc.USERS_PKG_URL}logout.php">{tr}logout{/tr}</a> + <a href="{$smarty.const.USERS_PKG_URL}logout.php">{tr}logout{/tr}</a> {else} - <a href="{$gBitLoc.USERS_PKG_URL}login.php">{tr}login{/tr}</a> + <a href="{$smarty.const.USERS_PKG_URL}login.php">{tr}login{/tr}</a> {if $gBitSystem->isFeatureActive( 'allowRegister' )} - | <a href="{$gBitLoc.USERS_PKG_URL}register.php">{tr}register{/tr}</a> + | <a href="{$smarty.const.USERS_PKG_URL}register.php">{tr}register{/tr}</a> {/if} {/if} @@ -18,7 +18,7 @@ {/if} {if $gBitSystem->isFeatureActive( 'feature_calendar' ) and $gBitUser->hasPermission( 'bit_p_view_calendar' )} - <a href="{$gBitLoc.CALENDAR_PKG_URL}index.php">{$smarty.now|bit_short_datetime}</a> + <a href="{$smarty.const.CALENDAR_PKG_URL}index.php">{$smarty.now|bit_short_datetime}</a> {else} {$smarty.now|bit_short_datetime} {/if} diff --git a/templates/top_bar.tpl b/templates/top_bar.tpl index 6ca4680..4effcf8 100644 --- a/templates/top_bar.tpl +++ b/templates/top_bar.tpl @@ -1,24 +1,23 @@ {strip} +<a class="skip" style="position:absolute;top:0;left:-999em;" href="#content">{tr}Skip Navigation{/tr}</a> <div id="bittopbar"> - {* this link is for textbrowsers *} - <a style="display:none;position:absolute;top:0px;left:0px;" href="#top">{tr}go to top{/tr}</a> <ul id="nav" class="menu hor"> {if $use_custom_top_bar and $gBitSystemPrefs.top_bar_position eq 'replace'} - {include file="`$gBitLoc.TEMP_PKG_PATH`nexus/modules/top_bar_inc.tpl"} + {include file="`$smarty.const.TEMP_PKG_PATH`nexus/modules/top_bar_inc.tpl"} {else} {if $use_custom_top_bar and $gBitSystemPrefs.top_bar_position eq 'left'} - {include file="`$gBitLoc.TEMP_PKG_PATH`nexus/modules/top_bar_inc.tpl"} + {include file="`$smarty.const.TEMP_PKG_PATH`nexus/modules/top_bar_inc.tpl"} {/if} <li class="m-home"> - <a class="head" href="{$gBitLoc.BIT_ROOT_URL}">{tr}{$siteTitle|default:"Home"}{/tr}</a> + <a class="head" accesskey="h" href="{$smarty.const.BIT_ROOT_URL}">{tr}{$siteTitle|default:"Home"}{/tr}</a> {include file="bitpackage:kernel/menu_global.tpl"} </li> {foreach key=key item=menu from=$appMenu} {if $menu.title && $menu.titleUrl && $menu.template} - <li class="m-{$key}{if $gBitLoc.ACTIVE_PACKAGE eq $menu.adminPanel} current{/if}"> - <a class="{if $gBitSystem->isFeatureActive( 'feature_top_bar_dropdown' )}head{else}item{/if}{if $gBitLoc.ACTIVE_PACKAGE eq $menu.adminPanel} selected{/if}" href="{$menu.titleUrl}">{tr}{$menu.title}{/tr}</a> + <li class="m-{$key}{if $smarty.const.ACTIVE_PACKAGE eq $menu.adminPanel} current{/if}"> + <a accesskey="{$key|regex_replace:"/(.).*/":"\$1"}" class="{if $gBitSystem->isFeatureActive( 'feature_top_bar_dropdown' )}head{else}item{/if}{if $smarty.const.ACTIVE_PACKAGE eq $menu.adminPanel} selected{/if}" href="{$menu.titleUrl}">{tr}{$menu.title}{/tr}</a> {if $gBitSystem->isFeatureActive( 'feature_top_bar_dropdown' )} {include file="`$menu.template`"} {/if} @@ -27,18 +26,18 @@ {/foreach} {if $gBitUser->isAdmin()} - <li class="m-admin{if $gBitLoc.ACTIVE_PACKAGE eq 'kernel'} current{/if}"> - <a class="{if $gBitSystem->isFeatureActive( 'feature_top_bar_dropdown' )}head{else}item{/if}{if $gBitLoc.ACTIVE_PACKAGE eq 'kernel'} selected{/if}" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php">{tr}Administration{/tr}</a> + <li class="m-admin{if $smarty.const.ACTIVE_PACKAGE eq 'kernel'} current{/if}"> + <a accesskey="A" class="{if $gBitSystem->isFeatureActive( 'feature_top_bar_dropdown' )}head{else}item{/if}{if $smarty.const.ACTIVE_PACKAGE eq 'kernel'} selected{/if}" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php">{tr}Administration{/tr}</a> {if $gBitSystem->isFeatureActive( 'feature_top_bar_dropdown' )} <ul> {foreach key=key item=menu from=$adminMenu} <li> - <a class="head" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php">{tr}{$key|capitalize}{/tr}</a> + <a class="head" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php">{tr}{$key|capitalize}{/tr}</a> {include file=`$menu.tpl`} </li> {/foreach} <li> - <a class="head" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php">{tr}Layout and Design{/tr}</a> + <a class="head" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php">{tr}Layout and Design{/tr}</a> {include file="bitpackage:kernel/menu_layout_admin.tpl"} </li> </ul> @@ -47,11 +46,10 @@ {/if} {if $use_custom_top_bar and ( !$gBitSystemPrefs.top_bar_position or $gBitSystemPrefs.top_bar_position eq 'right' )} - {include file="`$gBitLoc.TEMP_PKG_PATH`nexus/modules/top_bar_inc.tpl"} + {include file="`$smarty.const.TEMP_PKG_PATH`nexus/modules/top_bar_inc.tpl"} {/if} {/if} </ul> <div class="clear"></div> - <a style="padding:0;margin:0;border:0;" name="top"></a> </div> {/strip} |
