X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=nucleus%2Flibs%2Fglobalfunctions.php;h=37f2114dba95147feba1523d65ed9d24537cb8b3;hb=4c51c079da7c0ecc731f0fae7e239d1d2336059e;hp=2746adb9f2d671b131f4085800bec7d5ceab1f47;hpb=60ccbc00ed321ea8315a0162ab93fccf358dd5d1;p=nucleus-jp%2Fnucleus-jp-ancient.git diff --git a/nucleus/libs/globalfunctions.php b/nucleus/libs/globalfunctions.php index 2746adb..37f2114 100755 --- a/nucleus/libs/globalfunctions.php +++ b/nucleus/libs/globalfunctions.php @@ -1,1544 +1,2095 @@ - 0) { - $nucleus['version'] .= '/' . getNucleusPatchLevel(); -} - -// Avoid notices -if (!isset($CONF['installscript'])) { - $CONF['installscript'] = 0; -} - -// we will use postVar, getVar, ... methods instead of HTTP_GET_VARS or _GET -if ($CONF['installscript'] != 1) { // vars were already included in install.php - if (phpversion() >= '4.1.0') { - include_once($DIR_LIBS . 'vars4.1.0.php'); - } else { - include_once($DIR_LIBS . 'vars4.0.6.php'); - } -} - -// get all variables that can come from the request and put them in the global scope -$blogid = requestVar('blogid'); -$itemid = intRequestVar('itemid'); -$catid = intRequestVar('catid'); -$skinid = requestVar('skinid'); -$memberid = requestVar('memberid'); -$archivelist = requestVar('archivelist'); -$imagepopup = requestVar('imagepopup'); -$archive = requestVar('archive'); -$query = requestVar('query'); -$highlight = requestVar('highlight'); -$amount = requestVar('amount'); -$action = requestVar('action'); -$nextaction = requestVar('nextaction'); -$maxresults = requestVar('maxresults'); -$startpos = intRequestVar('startpos'); -$errormessage = ''; -$error = ''; - -if (!headers_sent() ) { - header('Generator: Nucleus CMS ' . $nucleus['version']); -} - -// include core classes that are needed for login & plugin handling -include($DIR_LIBS . 'mysql.php'); -include($DIR_LIBS . 'MEMBER.php'); -include($DIR_LIBS . 'ACTIONLOG.php'); -include($DIR_LIBS . 'MANAGER.php'); -include($DIR_LIBS . 'PLUGIN.php'); - -$manager =& MANAGER::instance(); - -// make sure there's no unnecessary escaping: -set_magic_quotes_runtime(0); - -// Avoid notices -if (!isset($CONF['UsingAdminArea'])) { - $CONF['UsingAdminArea'] = 0; -} - -// only needed when updating logs -if ($CONF['UsingAdminArea']) { - include($DIR_LIBS . 'xmlrpc.inc.php'); // XML-RPC client classes - include_once($DIR_LIBS . 'ADMIN.php'); -} - -// connect to database -sql_connect(); -$SQLCount = 0; - -// makes sure database connection gets closed on script termination -register_shutdown_function('sql_disconnect'); - -// read config -getConfig(); - -// automatically use simpler toolbar for mozilla -if (($CONF['DisableJsTools'] == 0) && strstr(serverVar('HTTP_USER_AGENT'), 'Mozilla/5.0') && strstr(serverVar('HTTP_USER_AGENT'), 'Gecko') ) { - $CONF['DisableJsTools'] = 2; -} - -// login if cookies set -$member = new MEMBER(); - -// login/logout when required or renew cookies -if ($action == 'login') { - // Form Authentication - $login = postVar('login'); - $pw = postVar('password'); - $shared = intPostVar('shared'); // shared computer or not - - if ($member->login($login, $pw) ) { - - $member->newCookieKey(); - $member->setCookies($shared); - - // allows direct access to parts of the admin area after logging in - if ($nextaction) { - $action = $nextaction; - } - - $manager->notify('LoginSuccess', array('member' => &$member) ); - $errormessage = ''; - ACTIONLOG::add(INFO, "Login successful for $login (sharedpc=$shared)"); - } else { - // errormessage for [%errordiv%] - $errormessage = 'Login failed for ' . $login; - - $manager->notify('LoginFailed', array('username' => $login) ); - ACTIONLOG::add(INFO, $errormessage); - } -/* - -Backed out for now: See http://forum.nucleuscms.org/viewtopic.php?t=3684 for details - -} elseif (serverVar('PHP_AUTH_USER') && serverVar('PHP_AUTH_PW')) { - // HTTP Authentication - $login = serverVar('PHP_AUTH_USER'); - $pw = serverVar('PHP_AUTH_PW'); - - if ($member->login($login, $pw) ) { - $manager->notify('LoginSuccess',array('member' => &$member)); - ACTIONLOG::add(INFO, "HTTP authentication successful for $login"); - } else { - $manager->notify('LoginFailed',array('username' => $login)); - ACTIONLOG::add(INFO, 'HTTP authentication failed for ' . $login); - - //Since bad credentials, generate an apropriate error page - header("WWW-Authenticate: Basic realm=\"Nucleus CMS {$nucleus['version']}\""); - header('HTTP/1.0 401 Unauthorized'); - echo 'Invalid username or password'; - exit; - } -*/ - -} elseif (($action == 'logout') && (!headers_sent() ) && cookieVar($CONF['CookiePrefix'] . 'user') ) { - // remove cookies on logout - setcookie($CONF['CookiePrefix'] . 'user', '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']); - setcookie($CONF['CookiePrefix'] . 'loginkey', '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']); - $manager->notify('Logout', array('username' => cookieVar($CONF['CookiePrefix'] . 'user') ) ); -} elseif (cookieVar($CONF['CookiePrefix'] . 'user') ) { - // Cookie Authentication - $res = $member->cookielogin(cookieVar($CONF['CookiePrefix'] . 'user'), cookieVar($CONF['CookiePrefix'] . 'loginkey') ); - - // renew cookies when not on a shared computer - if ($res && (cookieVar($CONF['CookiePrefix'] . 'sharedpc') != 1) && (!headers_sent() ) ) { - $member->setCookies(); - } -} - -// login completed -$manager->notify('PostAuthentication', array('loggedIn' => $member->isLoggedIn() ) ); - -// first, let's see if the site is disabled or not. always allow admin area access. -if ($CONF['DisableSite'] && !$member->isAdmin() && !$CONF['UsingAdminArea']) { - redirect($CONF['DisableSiteURL']); - exit; -} - -// load other classes -include($DIR_LIBS . 'PARSER.php'); -include($DIR_LIBS . 'SKIN.php'); -include($DIR_LIBS . 'TEMPLATE.php'); -include($DIR_LIBS . 'BLOG.php'); -include($DIR_LIBS . 'COMMENTS.php'); -include($DIR_LIBS . 'COMMENT.php'); -//include($DIR_LIBS . 'ITEM.php'); -include($DIR_LIBS . 'NOTIFICATION.php'); -include($DIR_LIBS . 'BAN.php'); -include($DIR_LIBS . 'PAGEFACTORY.php'); -include($DIR_LIBS . 'SEARCH.php'); -include($DIR_LIBS . 'entity.php'); - - -// set lastVisit cookie (if allowed) -if (!headers_sent() ) { - if ($CONF['LastVisit']) { - setcookie($CONF['CookiePrefix'] . 'lastVisit', time(), time() + 2592000, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']); - } else { - setcookie($CONF['CookiePrefix'] . 'lastVisit', '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']); - } -} - -// read language file, only after user has been initialized -$language = getLanguageName(); -include($DIR_LANG . ereg_replace( '[\\|/]', '', $language) . '.php'); - -/* - Backed out for now: See http://forum.nucleuscms.org/viewtopic.php?t=3684 for details - -// To remove after v2.5 is released and language files have been updated. -// Including this makes sure that language files for v2.5beta can still be used for v2.5final -// without having weird _SETTINGS_EXTAUTH string showing up in the admin area. -if (!defined('_MEMBERS_BYPASS')) -{ - define('_SETTINGS_EXTAUTH', 'Enable External Authentication'); - define('_WARNING_EXTAUTH', 'Warning: Enable only if needed.'); - define('_MEMBERS_BYPASS', 'Use External Authentication'); -} - -*/ - -// make sure the archivetype skinvar keeps working when _ARCHIVETYPE_XXX not defined -if (!defined('_ARCHIVETYPE_MONTH') ) { - define('_ARCHIVETYPE_DAY', 'day'); - define('_ARCHIVETYPE_MONTH', 'month'); -} - -// decode path_info -if ($CONF['URLMode'] == 'pathinfo') { - // initialize keywords if this hasn't been done before - if ($CONF['ItemKey'] == '') { - $CONF['ItemKey'] = 'item'; - } - - if ($CONF['ArchiveKey'] == '') { - $CONF['ArchiveKey'] = 'archive'; - } - - if ($CONF['ArchivesKey'] == '') { - $CONF['ArchivesKey'] = 'archives'; - } - - if ($CONF['MemberKey'] == '') { - $CONF['MemberKey'] = 'member'; - } - - if ($CONF['BlogKey'] == '') { - $CONF['BlogKey'] = 'blog'; - } - - if ($CONF['CategoryKey'] == '') { - $CONF['CategoryKey'] = 'category'; - } - - $parsed = false; - $manager->notify( - 'ParseURL', - array( - 'type' => basename(serverVar('SCRIPT_NAME') ), // e.g. item, blog, ... - 'info' => serverVar('PATH_INFO'), - 'complete' => &$parsed - ) - ); - - if (!$parsed) { - // default implementation - $data = explode("/", serverVar('PATH_INFO') ); - for ($i = 0; $i < sizeof($data); $i++) { - switch ($data[$i]) { - case $CONF['ItemKey']: // item/1 (blogid) - $i++; - - if ($i < sizeof($data) ) { - $itemid = intval($data[$i]); - } - break; - - case $CONF['ArchivesKey']: // archives/1 (blogid) - $i++; - - if ($i < sizeof($data) ) { - $archivelist = intval($data[$i]); - } - break; - - case $CONF['ArchiveKey']: // two possibilities: archive/yyyy-mm or archive/1/yyyy-mm (with blogid) - if ((($i + 1) < sizeof($data) ) && (!strstr($data[$i + 1], '-') ) ) { - $blogid = intval($data[++$i]); - } - - $i++; - - if ($i < sizeof($data) ) { - $archive = $data[$i]; - } - break; - - case 'blogid': // blogid/1 - case $CONF['BlogKey']: // blog/1 - $i++; - - if ($i < sizeof($data) ) { - $blogid = intval($data[$i]); - } - break; - - case $CONF['CategoryKey']: // category/1 (catid) - case 'catid': - $i++; - - if ($i < sizeof($data) ) { - $catid = intval($data[$i]); - } - break; - - case $CONF['MemberKey']: - $i++; - - if ($i < sizeof($data) ) { - $memberid = intval($data[$i]); - } - break; - - default: - // skip... - } - } - } -} - -function intPostVar($name) { - return intval(postVar($name) ); -} - -function intGetVar($name) { - return intval(getVar($name) ); -} - -function intRequestVar($name) { - return intval(requestVar($name) ); -} - -function intCookieVar($name) { - return intval(cookieVar($name) ); -} - -/** - * returns the currently used version (100 = 1.00, 101 = 1.01, etc...) - */ -function getNucleusVersion() { - return 330; -} - -/** - * power users can install patches in between nucleus releases. These patches - * usually add new functionality in the plugin API and allow those to - * be tested without having to install CVS. - */ -function getNucleusPatchLevel() { - return 0; -} - -/** - * Connects to mysql server - */ -function sql_connect() { - global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_CONN; - - $MYSQL_CONN = @mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD) or startUpError('
Could not connect to MySQL database.
', 'Connect Error'); - mysql_select_db($MYSQL_DATABASE) or startUpError('Could not select database: ' . mysql_error() . '
', 'Connect Error'); - - return $MYSQL_CONN; -} - -/** - * returns a prefixed nucleus table name - */ -function sql_table($name) { - global $MYSQL_PREFIX; - - if ($MYSQL_PREFIX) { - return $MYSQL_PREFIX . 'nucleus_' . $name; - } else { - return 'nucleus_' . $name; - } -} - -function sendContentType($contenttype, $pagetype = '', $charset = _CHARSET) { - global $manager, $CONF; - - if (!headers_sent() ) { - // if content type is application/xhtml+xml, only send it to browsers - // that can handle it (IE6 cannot). Otherwise, send text/html - - // v2.5: For admin area pages, keep sending text/html (unless it's a debug version) - // application/xhtml+xml still causes too much problems with the javascript implementations - - // v3.3: ($CONF['UsingAdminArea'] && !$CONF['debug']) gets removed, - // application/xhtml+xml seems to be working, so we're going to use it if we can. - if ( - ($contenttype == 'application/xhtml+xml') - && (!stristr(serverVar('HTTP_ACCEPT'), 'application/xhtml+xml') ) - ) { - $contenttype = 'text/html'; - } - - $manager->notify( - 'PreSendContentType', - array( - 'contentType' => &$contenttype, - 'charset' => &$charset, - 'pageType' => $pagetype - ) - ); - - // strip strange characters - $contenttype = preg_replace('|[^a-z0-9-+./]|i', '', $contenttype); - $charset = preg_replace('|[^a-z0-9-_]|i', '', $charset); - - if ($charset != '') { - header('Content-Type: ' . $contenttype . '; charset=' . $charset); - } else { - header('Content-Type: ' . $contenttype); - } - } -} - -/** - * Errors before the database connection has been made - */ -function startUpError($msg, $title) { - ?> - -' . $hsFile . '
line ' . $hsLine . '
';
- } else {
- $extraInfo = '';
- }
-
- startUpError(
- 'The page headers have already been sent out' . $extraInfo . '. This could cause Nucleus not to work in the expected way.
Usually, this is caused by spaces or newlines at the end of the config.php
file, at the end of the language file or at the end of a plugin file. Please check this and try again.
If you don\'t want to see this error message again, without solving the problem, set $CONF[\'alertOnHeadersSent\']
in globalfunctions.php
to 0
' . $msg . "
\n"; -} - -// shortcut -function addToLog($level, $msg) { - ACTIONLOG::add($level, $msg); -} - -// shows a link to help file -function help($id) { - echo helpHtml($id); -} - -function helpHtml($id) { - return helplink($id) . ''; -} - -function helplink($id) { - return ''; -} - -function getMailFooter() { - $message = "\n\n-----------------------------"; - $message .= "\n Powered by Nucleus CMS"; - $message .= "\n(http://www.nucleuscms.org/)"; - return $message; -} - -/** - * Returns the name of the language to use - * preference priority: member - site - * defaults to english when no good language found - * - * checks if file exists, etc... - */ -function getLanguageName() { - global $CONF, $member; - - if ($member && $member->isLoggedIn() ) { - // try to use members language - $memlang = $member->getLanguage(); - - if (($memlang != '') && (checkLanguage($memlang) ) ) { - return $memlang; - } - } - - // use default language - if (checkLanguage($CONF['Language']) ) { - return $CONF['Language']; - } else { - return 'english'; - } -} - -/** - * Includes a PHP file. This method can be called while parsing templates and skins - */ -function includephp($filename) { - // make predefined variables global, so most simple scripts can be used here - - // apache (names taken from PHP doc) - global $GATEWAY_INTERFACE, $SERVER_NAME, $SERVER_SOFTWARE, $SERVER_PROTOCOL; - global $REQUEST_METHOD, $QUERY_STRING, $DOCUMENT_ROOT, $HTTP_ACCEPT; - global $HTTP_ACCEPT_CHARSET, $HTTP_ACCEPT_ENCODING, $HTTP_ACCEPT_LANGUAGE; - global $HTTP_CONNECTION, $HTTP_HOST, $HTTP_REFERER, $HTTP_USER_AGENT; - global $REMOTE_ADDR, $REMOTE_PORT, $SCRIPT_FILENAME, $SERVER_ADMIN; - global $SERVER_PORT, $SERVER_SIGNATURE, $PATH_TRANSLATED, $SCRIPT_NAME; - global $REQUEST_URI; - - // php (taken from PHP doc) - global $argv, $argc, $PHP_SELF, $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS; - global $HTTP_POST_FILES, $HTTP_ENV_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS; - - // other - global $PATH_INFO, $HTTPS, $HTTP_RAW_POST_DATA, $HTTP_X_FORWARDED_FOR; - - if (@file_exists($filename) ) { - include($filename); - } -} - -/** - * Checks if a certain language/plugin exists - */ -function checkLanguage($lang) { - global $DIR_LANG ; - return file_exists($DIR_LANG . ereg_replace( '[\\|/]', '', $lang) . '.php'); -} - -function checkPlugin($plug) { - global $DIR_PLUGINS; - return file_exists($DIR_PLUGINS . ereg_replace( '[\\|/]', '', $plug) . '.php'); -} - -/** - * Centralisation of the functions that generate links - */ -function createItemLink($itemid, $extra = '') { - return createLink('item', array('itemid' => $itemid, 'extra' => $extra) ); -} - -function createMemberLink($memberid, $extra = '') { - return createLink('member', array('memberid' => $memberid, 'extra' => $extra) ); -} - -function createCategoryLink($catid, $extra = '') { - return createLink('category', array('catid' => $catid, 'extra' => $extra) ); -} - -function createArchiveListLink($blogid = '', $extra = '') { - return createLink('archivelist', array('blogid' => $blogid, 'extra' => $extra) ); -} - -function createArchiveLink($blogid, $archive, $extra = '') { - return createLink('archive', array('blogid' => $blogid, 'archive' => $archive, 'extra' => $extra) ); -} - -function createBlogidLink($blogid, $params = '') { - return createLink('blog', array('blogid' => $blogid, 'extra' => $params) ); -} - -function createLink($type, $params) { - global $manager, $CONF; - - $generatedURL = ''; - $usePathInfo = ($CONF['URLMode'] == 'pathinfo'); - - // ask plugins first - $created = false; - - if ($usePathInfo) { - $manager->notify( - 'GenerateURL', - array( - 'type' => $type, - 'params' => $params, - 'completed' => &$created, - 'url' => &$url - ) - ); - } - - // if a plugin created the URL, return it - if ($created) { - return $url; - } - - // default implementation - switch ($type) { - case 'item': - if ($usePathInfo) { - $url = $CONF['ItemURL'] . '/' . $CONF['ItemKey'] . '/' . $params['itemid']; - } else { - $url = $CONF['ItemURL'] . '?itemid=' . $params['itemid']; - } - break; - - case 'member': - if ($usePathInfo) { - $url = $CONF['MemberURL'] . '/' . $CONF['MemberKey'] . '/' . $params['memberid']; - } else { - $url = $CONF['MemberURL'] . '?memberid=' . $params['memberid']; - } - break; - - case 'category': - if ($usePathInfo) { - $url = $CONF['CategoryURL'] . '/' . $CONF['CategoryKey'] . '/' . $params['catid']; - } else { - $url = $CONF['CategoryURL'] . '?catid=' . $params['catid']; - } - break; - - case 'archivelist': - if (!$params['blogid']) { - $params['blogid'] = $CONF['DefaultBlog']; - } - - if ($usePathInfo) { - $url = $CONF['ArchiveListURL'] . '/' . $CONF['ArchivesKey'] . '/' . $params['blogid']; - } else { - $url = $CONF['ArchiveListURL'] . '?archivelist=' . $params['blogid']; - } - break; - - case 'archive': - if ($usePathInfo) { - $url = $CONF['ArchiveURL'] . '/' . $CONF['ArchiveKey'] . '/'.$params['blogid'].'/' . $params['archive']; - } else { - $url = $CONF['ArchiveURL'] . '?blogid='.$params['blogid'].'&archive=' . $params['archive']; - } - break; - - case 'blog': - if ($usePathInfo) { - $url = $CONF['BlogURL'] . '/' . $CONF['BlogKey'] . '/' . $params['blogid']; - } else { - $url = $CONF['BlogURL'] . '?blogid=' . $params['blogid']; - } - break; - } - - return addLinkParams($url, (isset($params['extra'])? $params['extra'] : null)); -} - -function createBlogLink($url, $params) { - return addLinkParams($url . '?', $params); -} - -function addLinkParams($link, $params) { - global $CONF; - - if (is_array($params) ) { - - if ($CONF['URLMode'] == 'pathinfo') { - - foreach ($params as $param => $value) { - $link .= '/' . $param . '/' . urlencode($value); - } - - } else { - - foreach ($params as $param => $value) { - $link .= '&' . $param . '=' . urlencode($value); - } - - } - } - - return $link; -} - -/** - * @param $querystr - * querystring to alter (e.g. foo=1&bar=2&x=y) - * @param $param - * name of parameter to change (e.g. 'foo') - * @param $value - * New value for that parameter (e.g. 3) - * @result - * altered query string (for the examples above: foo=3&bar=2&x=y) - */ -function alterQueryStr($querystr, $param, $value) { - $vars = explode('&', $querystr); - $set = false; - - for ($i = 0; $i < count($vars); $i++) { - $v = explode('=', $vars[$i]); - - if ($v[0] == $param) { - $v[1] = $value; - $vars[$i] = implode('=', $v); - $set = true; - break; - } - } - - if (!$set) { - $vars[] = $param . '=' . $value; - } - - return ltrim(implode('&', $vars), '&'); -} - -// passes one variable as hidden input field (multiple fields for arrays) -// @see passRequestVars in varsx.x.x.php -function passVar($key, $value) { - // array ? - if (is_array($value) ) { - for ($i = 0; $i < sizeof($value); $i++) { - passVar($key . '[' . $i . ']', $value[$i]); - } - - return; - } - - // other values: do stripslashes if needed - ?>getTimeOffset() * 3600 : 0; - $offset = date('Z', $timestamp) + $boffset; - - switch ($format) { - case 'rfc822': - if ($offset >= 0) { - $tz = '+'; - } else { - $tz = '-'; - $offset = -$offset; - } - - $tz .= sprintf("%02d%02d", floor($offset / 3600), round(($offset % 3600) / 60) ); - return date('D, j M Y H:i:s ', $timestamp) . $tz; - - case 'rfc822GMT': - $timestamp -= $offset; - return date('D, j M Y H:i:s ', $timestamp) . 'GMT'; - - case 'utc': - $timestamp -= $offset; - return date('Y-m-d\TH:i:s\Z', $timestamp); - - case 'iso8601': - if ($offset >= 0) { - $tz = '+'; - } else { - $tz = '-'; - $offset = -$offset; - } - - $tz .= sprintf("%02d:%02d", floor($offset / 3600), round(($offset % 3600) / 60) ); - return date('Y-m-d\TH:i:s', $timestamp) . $tz; - - default : - return strftime($format ? $format : $defaultFormat, $timestamp); - } -} - -function checkVars($aVars) { - global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES, $HTTP_SESSION_VARS; - - foreach ($aVars as $varName) { - - if (phpversion() >= '4.1.0') { - - if ( isset($_GET[$varName]) - || isset($_POST[$varName]) - || isset($_COOKIE[$varName]) - || isset($_ENV[$varName]) - || isset($_SESSION[$varName]) - || isset($_FILES[$varName]) - ) { - die('Sorry. An error occurred.'); - } - - } else { - - if ( isset($HTTP_GET_VARS[$varName]) - || isset($HTTP_POST_VARS[$varName]) - || isset($HTTP_COOKIE_VARS[$varName]) - || isset($HTTP_ENV_VARS[$varName]) - || isset($HTTP_SESSION_VARS[$varName]) - || isset($HTTP_POST_FILES[$varName]) - ) { - die('Sorry. An error occurred.'); - } - - } - } -} - -/** - * Stops processing the request and redirects to the given URL. - * - no actual contents should have been sent to the output yet - * - the URL will be stripped of illegal or dangerous characters - */ -function redirect($url) { - $url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:@%]|i', '', $url); - header('Location: ' . $url); - exit; -} - -/** - * Strip HTML tags from a string - * This function is a bit more intelligent than a regular call to strip_tags(), - * because it also deletes the contents of certain tags and cleans up any - * unneeded whitespace. - */ -function stringStripTags ($string) { - $string = preg_replace("/