[UseBook-Checkins] UseBook/sources core.php,1.3,1.4 functions.php,1.3,1.4
Status: Inactive
Brought to you by:
pc_freak
|
From: Vandamme S. <kid...@us...> - 2005-07-07 16:41:01
|
Update of /cvsroot/usebook/UseBook/sources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9234/sources Modified Files: core.php functions.php Log Message: - Implented posts per page - Added New posts on top or bottom of pages - Fixed posts id bug - Added friendly url's Index: functions.php =================================================================== RCS file: /cvsroot/usebook/UseBook/sources/functions.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions.php 3 Jun 2005 15:32:10 -0000 1.3 --- functions.php 7 Jul 2005 16:40:42 -0000 1.4 *************** *** 390,393 **** --- 390,443 ---- return $this->config[$value]; } + + // + // Interactive URL builder + // + function make_url($filename, $vars=array(), $html=true) { + + + if ( $this->get_config('friendly_urls') && $filename != 'admin.php' ) { + + $url = str_replace('.php', '', $filename); + foreach ( $vars as $key => $val ) { + + if ( in_array($key, array('index')) ) + $url .= '-'.$key.$val; + else + $url .= '-'.$val; + + } + if ( $filename == 'rss.php' ) + return $url.'.xml'; + else + return $url.'.html'; + + } + + $url = $filename; + $vars = ( is_array($vars) ) ? $vars : array(); + + if ( count($vars) ) { + + $url .= '?'; + + if ( $html ) { + + foreach ( $vars as $key => $val ) + $safe[] = urlencode($key).'='.urlencode($val); + $url .= join('&', $safe); + + } else { + + foreach ( $vars as $key => $val ) + $safe[] = $key.'='.$val; + $url .= join('&', $safe); + + } + + } + return $url; + + } } Index: core.php =================================================================== RCS file: /cvsroot/usebook/UseBook/sources/core.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** core.php 3 Jun 2005 15:32:10 -0000 1.3 --- core.php 7 Jul 2005 16:40:42 -0000 1.4 *************** *** 58,64 **** // require(ROOT_PATH.'config.php'); ! require('functions.php'); ! require('template.php'); ! require('admin.php'); // --- 58,64 ---- // require(ROOT_PATH.'config.php'); ! require(ROOT_PATH.'sources/functions.php'); ! require(ROOT_PATH.'sources/template.php'); ! require(ROOT_PATH.'sources/admin.php'); // *************** *** 67,71 **** define('TABLE_PREFIX', $database['prefix']); define('COOKIE_PREFIX', $config['cookie_prefix']); ! define('USEBOOK_VERSION', '0.2'); define('USER_PREG', '#^[A-Za-z0-9_\-]+$#'); define('EMAIL_PREG', '#^[a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+$#'); --- 67,71 ---- define('TABLE_PREFIX', $database['prefix']); define('COOKIE_PREFIX', $config['cookie_prefix']); ! define('USEBOOK_VERSION', '0.3-CVS'); define('USER_PREG', '#^[A-Za-z0-9_\-]+$#'); define('EMAIL_PREG', '#^[a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+$#'); |