Merge branch 'stable4' of git://gitorious.org/owncloud/owncloud into stable4

This commit is contained in:
Thomas Tanghus 2012-06-25 16:22:19 +02:00
commit ddf321d534
15 changed files with 65 additions and 46 deletions

View File

@ -28,7 +28,7 @@ $dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) { switch($dtstart->getDateType()) {
case Sabre_VObject_Property_DateTime::UTC: case Sabre_VObject_Property_DateTime::UTC:
$timeOffset = OC_Calendar_App::$tz*60; $timeOffset = $_SESSION['timezone']*60;
$newDT = $dtstart->getDateTime(); $newDT = $dtstart->getDateTime();
$newDT->add(new DateInterval("PT" . $timeOffset . "M")); $newDT->add(new DateInterval("PT" . $timeOffset . "M"));
$dtstart->setDateTime($newDT); $dtstart->setDateTime($newDT);

View File

@ -661,10 +661,12 @@ function ListView(element, calendar) {
if (delta) { if (delta) {
if (delta < 0){ if (delta < 0){
addDays(t.start, -7); addDays(t.start, -7);
addDays(t.end, -7);
if (!opt('weekends')) { if (!opt('weekends')) {
skipWeekend(t.start, delta < 0 ? -1 : 1); skipWeekend(t.start, delta < 0 ? -1 : 1);
} }
}else{ }else{
addDays(t.start, 7);
addDays(t.end, 7); addDays(t.end, 7);
if (!opt('weekends')) { if (!opt('weekends')) {
skipWeekend(t.end, delta < 0 ? -1 : 1); skipWeekend(t.end, delta < 0 ? -1 : 1);

View File

@ -1,22 +1,11 @@
#editor{ #editor{
position: fixed; position: fixed;
display: block; display: block;
top: 6.5em; top: 6.8em;
left: 12.5em; left: 12.5em;
} z-index: 20;
#editorwrapper{
position: absolute;
height: 0;
width: 0;
top: 41px;
left: 160px;
display: none;
} }
#editor_save{ #editor_save{
margin-left: 7px; margin-left: 7px;
float: left; float: left;
} }
#saving_icon{
margin-top: 3px;
float: left;
}

View File

@ -88,7 +88,10 @@ class ThumbnailsManager {
} }
public function delete($path) { public function delete($path) {
unlink(\OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser()."/gallery".$path); $thumbnail = \OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser()."/gallery".$path;
if (file_exists($thumbnail)) {
unlink($thumbnail);
}
} }
private function __construct() {} private function __construct() {}

View File

@ -141,7 +141,7 @@ class TileStack extends TileBase {
} }
public function get() { public function get() {
$r = '<div class="title gallery_div">'.htmlentities($this->stack_name).'</div>'; $r = '<div class="title gallery_div">'. \OCP\Util::sanitizeHTML($this->stack_name).'</div>';
for ($i = 0; $i < count($this->tiles_array); $i++) { for ($i = 0; $i < count($this->tiles_array); $i++) {
$top = rand(-5, 5); $top = rand(-5, 5);
$left = rand(-5, 5); $left = rand(-5, 5);

View File

@ -14,7 +14,7 @@ div.visible { opacity: 0.8;}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
var root = "<?php echo htmlentities($root); ?>"; var root = "<?php echo $root; ?>";
function explode(element) { function explode(element) {
$('div', element).each(function(index, elem) { $('div', element).each(function(index, elem) {
@ -64,7 +64,7 @@ $(document).ready(function() {
for ($i = 0; $i < count($paths); $i++) { for ($i = 0; $i < count($paths); $i++) {
$path .= urlencode($paths[$i]).'/'; $path .= urlencode($paths[$i]).'/';
$classess = 'crumb'.($i == count($paths)-1?' last':''); $classess = 'crumb'.($i == count($paths)-1?' last':'');
echo '<div class="'.$classess.'" style="background-image:url(\''.\OCP\image_path('core','breadcrumb.png').'\')"><a href="'.\OCP\Util::linkTo('gallery', 'index.php').'&root='.$path.'">'.$paths[$i].'</a></div>'; echo '<div class="'.$classess.'" style="background-image:url(\''.\OCP\image_path('core','breadcrumb.png').'\')"><a href="'.\OCP\Util::linkTo('gallery', 'index.php').'&root='.$path.'">'.\OCP\Util::sanitizeHTML($paths[$i]).'</a></div>';
} }
} }

View File

@ -104,7 +104,7 @@ class OC_MEDIA_COLLECTION{
return self::$albumIdCache[$artistId][$albumId][$name]; return self::$albumIdCache[$artistId][$albumId][$name];
}else{ }else{
$uid=$_SESSION['user_id']; $uid=$_SESSION['user_id'];
$query=OCP\DB::prepare("SELECT song_id FROM *PREFIX*media_songs WHERE song_user=? AND song_name LIKE ? AND song_artist=? AND song_album=?"); $query=OCP\DB::prepare("SELECT song_id FROM *PREFIX*media_songs WHERE song_user=? AND lower(song_name) LIKE ? AND song_artist=? AND song_album=?");
$songs=$query->execute(array($uid,$name,$artistId,$albumId))->fetchAll(); $songs=$query->execute(array($uid,$name,$artistId,$albumId))->fetchAll();
if(is_array($songs) and isset($songs[0])){ if(is_array($songs) and isset($songs[0])){
self::$albumIdCache[$artistId][$albumId][$name]=$songs[0]['song_id']; self::$albumIdCache[$artistId][$albumId][$name]=$songs[0]['song_id'];
@ -277,7 +277,7 @@ class OC_MEDIA_COLLECTION{
$query=self::$queries['addsong']; $query=self::$queries['addsong'];
} }
$query->execute(array($name,$artist,$album,$path,$uid,$length,$track,$size)); $query->execute(array($name,$artist,$album,$path,$uid,$length,$track,$size));
$songId=OCP\DB::insertid('*PREFIX*media_songs'); $songId=OCP\DB::insertid('*PREFIX*media_songs_song');
// self::setLastUpdated(); // self::setLastUpdated();
return self::getSongId($name,$artist,$album); return self::getSongId($name,$artist,$album);
} }

View File

@ -449,7 +449,7 @@ class OC_LDAP {
if(isset($result[$attr]) && $result[$attr]['count'] > 0){ if(isset($result[$attr]) && $result[$attr]['count'] > 0){
$values = array(); $values = array();
for($i=0;$i<$result[$attr]['count'];$i++) { for($i=0;$i<$result[$attr]['count'];$i++) {
$values[] = $result[$attr][$i]; $values[] = self::resemblesDN($attr) ? self::sanitizeDN($result[$attr][$i]) : $result[$attr][$i];
} }
return $values; return $values;
} }
@ -521,7 +521,7 @@ class OC_LDAP {
$key = strtolower($key); $key = strtolower($key);
if(isset($item[$key])) { if(isset($item[$key])) {
if($key != 'dn'){ if($key != 'dn'){
$selection[$i][$key] = $item[$key][0]; $selection[$i][$key] = self::resemblesDN($key) ? self::sanitizeDN($item[$key][0]) : $item[$key][0];
} else { } else {
$selection[$i][$key] = self::sanitizeDN($item[$key]); $selection[$i][$key] = self::sanitizeDN($item[$key]);
} }
@ -534,7 +534,7 @@ class OC_LDAP {
$key = strtolower($attr[0]); $key = strtolower($attr[0]);
if(isset($item[$key])) { if(isset($item[$key])) {
if($key == 'dn') { if(self::resemblesDN($key)) {
$selection[] = self::sanitizeDN($item[$key]); $selection[] = self::sanitizeDN($item[$key]);
} else { } else {
$selection[] = $item[$key]; $selection[] = $item[$key];
@ -549,6 +549,15 @@ class OC_LDAP {
return $findings; return $findings;
} }
static private function resemblesDN($attr) {
$resemblingAttributes = array(
'dn',
'uniquemember',
'member'
);
return in_array($attr, $resemblingAttributes);
}
static private function sanitizeDN($dn) { static private function sanitizeDN($dn) {
//OID sometimes gives back DNs with whitespace after the comma a la "uid=foo, cn=bar, dn=..." We need to tackle this! //OID sometimes gives back DNs with whitespace after the comma a la "uid=foo, cn=bar, dn=..." We need to tackle this!
$dn = preg_replace('/([^\\\]),(\s+)/','\1,',$dn); $dn = preg_replace('/([^\\\]),(\s+)/','\1,',$dn);

View File

@ -124,9 +124,19 @@ class OC_USER_LDAP extends OC_User_Backend {
* @return boolean * @return boolean
*/ */
public function userExists($uid){ public function userExists($uid){
return in_array($uid, $this->getUsers()); //getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking.
$dn = OC_LDAP::username2dn($uid);
if(!$dn) {
return false;
}
//if user really still exists, we will be able to read his cn
$cn = OC_LDAP::readAttribute($dn, 'cn');
if(!$cn || empty($cn)) {
return false;
}
return true;
} }
} }
?>

View File

@ -33,7 +33,7 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
protected function validateUserPass($username, $password){ protected function validateUserPass($username, $password){
OC_Util::setUpFS();//login hooks may need early access to the filesystem OC_Util::setUpFS();//login hooks may need early access to the filesystem
if(OC_User::login($username,$password)){ if(OC_User::login($username,$password)){
OC_Util::setUpFS(); OC_Util::setUpFS($username);
return true; return true;
} }
else{ else{

View File

@ -86,7 +86,7 @@ class OC_FileCache{
} }
$path=$root.$path; $path=$root.$path;
$parent=self::getParentId($path); $parent=self::getParentId($path);
$id=self::getId($path,''); $id=self::getFileId($path);
if(isset(OC_FileCache::$savedData[$path])){ if(isset(OC_FileCache::$savedData[$path])){
$data=array_merge(OC_FileCache::$savedData[$path],$data); $data=array_merge(OC_FileCache::$savedData[$path],$data);
unset(OC_FileCache::$savedData[$path]); unset(OC_FileCache::$savedData[$path]);
@ -129,7 +129,12 @@ class OC_FileCache{
$queryParts=array(); $queryParts=array();
foreach(array('size','mtime','ctime','mimetype','encrypted','versioned','writable') as $attribute){ foreach(array('size','mtime','ctime','mimetype','encrypted','versioned','writable') as $attribute){
if(isset($data[$attribute])){ if(isset($data[$attribute])){
//Convert to int it args are false
if($data[$attribute] === false){
$arguments[] = 0;
}else{
$arguments[] = $data[$attribute]; $arguments[] = $data[$attribute];
}
$queryParts[]=$attribute.'=?'; $queryParts[]=$attribute.'=?';
} }
} }
@ -262,7 +267,7 @@ class OC_FileCache{
} }
$path=$root.$path; $path=$root.$path;
$parent=self::getFileId($path); $parent=self::getFileId($path);
if($path==-1){ if($parent==-1){
return array(); return array();
} }
$query=OC_DB::prepare('SELECT name,ctime,mtime,mimetype,size,encrypted,versioned,writable FROM *PREFIX*fscache WHERE parent=? AND (mimetype LIKE ? OR mimetype = ?)'); $query=OC_DB::prepare('SELECT name,ctime,mtime,mimetype,size,encrypted,versioned,writable FROM *PREFIX*fscache WHERE parent=? AND (mimetype LIKE ? OR mimetype = ?)');

View File

@ -287,7 +287,7 @@ class OC_Installer{
* This function installs all apps found in the 'apps' directory that should be enabled by default; * This function installs all apps found in the 'apps' directory that should be enabled by default;
*/ */
public static function installShippedApps(){ public static function installShippedApps(){
$dir = opendir( OC::$APPSROOT."/apps" ); if($dir = opendir( OC::$APPSROOT."/apps" )){
while( false !== ( $filename = readdir( $dir ))){ while( false !== ( $filename = readdir( $dir ))){
if( substr( $filename, 0, 1 ) != '.' and is_dir(OC::$APPSROOT."/apps/$filename") ){ if( substr( $filename, 0, 1 ) != '.' and is_dir(OC::$APPSROOT."/apps/$filename") ){
if( file_exists( OC::$APPSROOT."/apps/$filename/appinfo/app.php" )){ if( file_exists( OC::$APPSROOT."/apps/$filename/appinfo/app.php" )){
@ -304,6 +304,7 @@ class OC_Installer{
} }
closedir( $dir ); closedir( $dir );
} }
}
/** /**
* install an app already placed in the app folder * install an app already placed in the app folder

View File

@ -83,7 +83,7 @@ class OC_Util {
* @return array * @return array
*/ */
public static function getVersion(){ public static function getVersion(){
return array(4,00,2); return array(4,00,3);
} }
/** /**
@ -91,7 +91,7 @@ class OC_Util {
* @return string * @return string
*/ */
public static function getVersionString(){ public static function getVersionString(){
return '4.0.2'; return '4.0.3a';
} }
/** /**

View File

@ -39,7 +39,7 @@ OC.Log={
row.append(appTd); row.append(appTd);
var messageTd=$('<td/>'); var messageTd=$('<td/>');
messageTd.text(entry.message); messageTd.html(entry.message);
row.append(messageTd); row.append(messageTd);
var timeTd=$('<td/>'); var timeTd=$('<td/>');

View File

@ -42,7 +42,7 @@ if(!$_['htaccessworking']) {
<?php echo $entry->app;?> <?php echo $entry->app;?>
</td> </td>
<td> <td>
<?php echo htmlentities($entry->message);?> <?php echo $entry->message;?>
</td> </td>
<td> <td>
<?php echo OC_Util::formatDate($entry->time);?> <?php echo OC_Util::formatDate($entry->time);?>