summaryrefslogtreecommitdiffstats
path: root/lib/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.php')
-rwxr-xr-xlib/util.php102
1 files changed, 45 insertions, 57 deletions
diff --git a/lib/util.php b/lib/util.php
index fc50123b4fe..4170de2125a 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -166,7 +166,7 @@ class OC_Util {
* @param int timestamp $timestamp
* @param bool dateOnly option to ommit 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);
@@ -176,37 +176,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
@@ -583,6 +554,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() {
@@ -684,34 +667,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;
}
}