Merge branch 'master' into calendar_repeat
This commit is contained in:
commit
24a1ab8c15
4 changed files with 33 additions and 4 deletions
|
@ -82,6 +82,7 @@ if(is_array($value)) {
|
|||
$value = strip_tags($value);
|
||||
}
|
||||
|
||||
/* preprocessing value */
|
||||
switch($name) {
|
||||
case 'BDAY':
|
||||
$date = New DateTime($value);
|
||||
|
@ -94,6 +95,8 @@ switch($name) {
|
|||
case 'N':
|
||||
case 'ORG':
|
||||
case 'NOTE':
|
||||
$value = str_replace('\n', ' \\n', $value);
|
||||
break;
|
||||
case 'NICKNAME':
|
||||
// TODO: Escape commas and semicolons.
|
||||
break;
|
||||
|
@ -105,8 +108,14 @@ switch($name) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
$property = $vcard->addProperty($name, $value); //, $parameters);
|
||||
switch($name) {
|
||||
case 'NOTE':
|
||||
$vcard->setString('NOTE', $value);
|
||||
break;
|
||||
default:
|
||||
$property = $vcard->addProperty($name, $value); //, $parameters);
|
||||
break;
|
||||
}
|
||||
|
||||
$line = count($vcard->children) - 1;
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
|||
if(!$this->configured) {
|
||||
return array();
|
||||
}
|
||||
if(is_null($this->_groups)) {
|
||||
if(empty($this->_groups)) {
|
||||
$ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
|
||||
$this->_groups = OC_LDAP::ownCloudGroupNames($ldap_groups);
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ elseif(OC_User::isLoggedIn()) {
|
|||
if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) {
|
||||
//OC_Log::write('core',"Logged in with HTTP Authentication",OC_Log::DEBUG);
|
||||
OC_User::unsetMagicInCookie();
|
||||
$_REQUEST['redirect_url'] = (isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'');
|
||||
OC_Util::redirectToDefaultPage();
|
||||
}else{
|
||||
$error = true;
|
||||
|
|
21
lib/util.php
Normal file → Executable file
21
lib/util.php
Normal file → Executable file
|
@ -332,7 +332,8 @@ class OC_Util {
|
|||
* Redirect to the user default page
|
||||
*/
|
||||
public static function redirectToDefaultPage(){
|
||||
if(isset($_REQUEST['redirect_url']) && substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT) {
|
||||
OC_Log::write('core','redirectToDefaultPage',OC_Log::DEBUG);
|
||||
if(isset($_REQUEST['redirect_url']) && (substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT || $_REQUEST['redirect_url'][0] == '/')) {
|
||||
header( 'Location: '.$_REQUEST['redirect_url']);
|
||||
} else {
|
||||
header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', '?app=files'));
|
||||
|
@ -358,12 +359,30 @@ class OC_Util {
|
|||
* Todo: Write howto
|
||||
*/
|
||||
public static function callRegister(){
|
||||
//mamimum time before token exires
|
||||
$maxtime=(60*60); // 1 hour
|
||||
|
||||
// generate a random token.
|
||||
$token=mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000);
|
||||
|
||||
// store the token together with a timestamp in the session.
|
||||
$_SESSION['requesttoken-'.$token]=time();
|
||||
|
||||
// cleanup old tokens garbage collector
|
||||
// only run every 20th time so we don´t waste cpu cycles
|
||||
if(rand(0,20)==0) {
|
||||
foreach($_SESSION as $key=>$value) {
|
||||
// search all tokens in the session
|
||||
if(substr($key,0,12)=='requesttoken') {
|
||||
if($value+$maxtime<time()){
|
||||
// remove outdated tokens
|
||||
unset($_SESSION[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return the token
|
||||
return($token);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue