From b7345f833dea849e94f2ce23fdbe6ab58ba98be3 Mon Sep 17 00:00:00 2001 From: cweiske Date: Sat, 3 Oct 2009 14:08:25 +0000 Subject: more file renamings git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@387 b3834d28-1941-0410-a4f8-b48e95affb8f --- src/SemanticScuttle/functions.inc.php | 207 ---------------------------------- 1 file changed, 207 deletions(-) delete mode 100644 src/SemanticScuttle/functions.inc.php (limited to 'src/SemanticScuttle/functions.inc.php') diff --git a/src/SemanticScuttle/functions.inc.php b/src/SemanticScuttle/functions.inc.php deleted file mode 100644 index 08d5f33..0000000 --- a/src/SemanticScuttle/functions.inc.php +++ /dev/null @@ -1,207 +0,0 @@ -isAdmin()) { - return $defaultPerPageForAdmins; - } else { - return $defaultPerPage; - } -} - -function getSortOrder($override = NULL) { - global $defaultOrderBy; - - if (isset($_GET['sort'])) { - return $_GET['sort']; - } else if (isset($override)) { - return $override; - } else { - return $defaultOrderBy; - } -} - -function multi_array_search($needle, $haystack) { - if (is_array($haystack)) { - foreach(array_keys($haystack) as $key) { - $value =& $haystack[$key]; - $result = multi_array_search($needle, $value); - if (is_array($result)) { - $return = $result; - array_unshift($return, $key); - return $return; - } elseif ($result == true) { - $return[] = $key; - return $return; - } - } - return false; - } else { - if ($needle === $haystack) { - return true; - } else { - return false; - } - } -} - -function createURL($page = '', $ending = '') { - global $cleanurls; - if (!$cleanurls && $page != '') { - $page .= '.php'; - } - if(strlen($ending)>0) { - return ROOT . $page .'/'. $ending; - } else { - return ROOT . $page; - } -} - -/* Shorten a string like a URL for example by cutting the middle of it */ -function shortenString($string, $maxSize=75) { - $output = ''; - if(strlen($string) > $maxSize) { - $output = substr($string, 0, $maxSize/2).'...'.substr($string, -$maxSize/2); - } else { - $output = $string; - } - return $output; -} - -/* Check url format and check online if the url is a valid page (Not a 404 error for example) */ -function checkUrl($url, $checkOnline = true) { - //check format - if(!preg_match("#(ht|f)tp(s?)\://\S+\.\S+#i",$url)) { - return false; - } - - if($checkOnline) { - //look if the page doesn't return a void or 40X or 50X HTTP code error - $h = @get_headers($url); - if(is_array($h) && strpos($h[0], '40') === false && strpos($h[0], '50') === false) { - return true; - } else { - return false; - } - } else { - return true; - } -} - -/* Returns a concatenated String - * including all the tags from the array $arrayTags (excepted of the $exceptedTag) - * separated by the $separator. - * */ -function aggregateTags($arrayTags, $separator = ' + ', $exceptedTag = '') { - $output = ''; - - for($i = 0; $isql_error(); - $debug_text = ''; - - if ($sql_error['message'] != '') - $debug_text .= '

'. T_('SQL Error') .' : '. $sql_error['code'] .' '. $sql_error['message']; - - if ($sql_store != '') - $debug_text .= '

'. $sql_store; - - if ($err_line != '' && $err_file != '') - $debug_text .= '

'. T_('Line') .' : '. $err_line .'
'. T_('File') .' :'. $err_file; - } - - switch($msg_code) { - case GENERAL_MESSAGE: - if ($msg_title == '') - $msg_title = T_('Information'); - break; - - case CRITICAL_MESSAGE: - if ($msg_title == '') - $msg_title = T_('Critical Information'); - break; - - case GENERAL_ERROR: - if ($msg_text == '') - $msg_text = T_('An error occured'); - - if ($msg_title == '') - $msg_title = T_('General Error'); - break; - - case CRITICAL_ERROR: - // Critical errors mean we cannot rely on _ANY_ DB information being - // available so we're going to dump out a simple echo'd statement - - if ($msg_text == '') - $msg_text = T_('An critical error occured'); - - if ($msg_title == '') - $msg_title = T_('Critical Error'); - break; - } - - // Add on DEBUG_MODE info if we've enabled debug mode and this is an error. This - // prevents debug info being output for general messages should DEBUG_MODE be - // set TRUE by accident (preventing confusion for the end user!) - if (DEBUG_MODE && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) { - if ($debug_text != '') - $msg_text = $msg_text . '

'. T_('DEBUG MODE') .''. $debug_text; - } - - echo "\n\n". $msg_title ."\n

\n". $msg_text ."\n"; - exit; -} -?> -- cgit v1.2.3-54-g00ecf