diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-12-25 14:29:29 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-12-25 14:29:29 +0100 |
commit | 7e36f730ecfe452681f44771b28d1d3c4a5535df (patch) | |
tree | 578e604c170219151239e2da345d332b079ed920 /lib/util.php | |
parent | bf05ff351faa693337107ed4a316e36e9aacd296 (diff) | |
parent | 5d59ac07391841677e204958ea20be3fe05cd8ef (diff) | |
download | nextcloud-server-7e36f730ecfe452681f44771b28d1d3c4a5535df.tar.gz nextcloud-server-7e36f730ecfe452681f44771b28d1d3c4a5535df.zip |
merge master into filesystem
Diffstat (limited to 'lib/util.php')
-rwxr-xr-x | lib/util.php | 102 |
1 files changed, 45 insertions, 57 deletions
diff --git a/lib/util.php b/lib/util.php index 4411b327310..4ebc2564d1c 100755 --- a/lib/util.php +++ b/lib/util.php @@ -146,7 +146,7 @@ class OC_Util { * @param int timestamp $timestamp * @param bool dateOnly option to omit time from the result */ - public static function formatDate( $timestamp, $dateOnly=false) { + public static function formatDate( $timestamp, $dateOnly=false) { if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it $systemTimeZone = intval(date('O')); $systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100); @@ -156,37 +156,8 @@ class OC_Util { } $l=OC_L10N::get('lib'); return $l->l($dateOnly ? 'date' : 'datetime', $timestamp); - } - - /** - * Shows a pagenavi widget where you can jump to different pages. - * - * @param int $pagecount - * @param int $page - * @param string $url - * @return OC_Template - */ - public static function getPageNavi($pagecount, $page, $url) { - - $pagelinkcount=8; - if ($pagecount>1) { - $pagestart=$page-$pagelinkcount; - if($pagestart<0) $pagestart=0; - $pagestop=$page+$pagelinkcount; - if($pagestop>$pagecount) $pagestop=$pagecount; - - $tmpl = new OC_Template( '', 'part.pagenavi', '' ); - $tmpl->assign('page', $page); - $tmpl->assign('pagecount', $pagecount); - $tmpl->assign('pagestart', $pagestart); - $tmpl->assign('pagestop', $pagestop); - $tmpl->assign('url', $url); - return $tmpl; - } } - - /** * check if the current server configuration is suitable for ownCloud * @return array arrays with error messages and hints @@ -577,6 +548,18 @@ class OC_Util { /** + * Check if the setlocal call doesn't work. This can happen if the right local packages are not available on the server. + */ + public static function issetlocaleworking() { + $result=setlocale(LC_ALL, 'en_US.UTF-8'); + if($result==false) { + return(false); + }else{ + return(true); + } + } + + /** * Check if the ownCloud server can connect to the internet */ public static function isinternetconnectionworking() { @@ -678,34 +661,39 @@ class OC_Util { * If not, file_get_element is used. */ - public static function getUrlContent($url){ + public static function getUrlContent($url){ - if (function_exists('curl_init')) { - - $curl = curl_init(); - - curl_setopt($curl, CURLOPT_HEADER, 0); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler"); - $data = curl_exec($curl); - curl_close($curl); - - } else { - - $ctx = stream_context_create( - array( - 'http' => array( - 'timeout' => 10 - ) - ) - ); - $data=@file_get_contents($url, 0, $ctx); - - } - - return $data; + if (function_exists('curl_init')) { + + $curl = curl_init(); + + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler"); + if(OC_Config::getValue('proxy','')<>'') { + curl_setopt($curl, CURLOPT_PROXY, OC_Config::getValue('proxy')); + } + if(OC_Config::getValue('proxyuserpwd','')<>'') { + curl_setopt($curl, CURLOPT_PROXYUSERPWD, OC_Config::getValue('proxyuserpwd')); + } + $data = curl_exec($curl); + curl_close($curl); + + } else { + + $ctx = stream_context_create( + array( + 'http' => array( + 'timeout' => 10 + ) + ) + ); + $data=@file_get_contents($url, 0, $ctx); + + } + return $data; } } |