Merge branch 'working'

This commit is contained in:
Florian Pritz 2011-09-24 18:43:02 +02:00
commit 793e29e124
46 changed files with 211 additions and 116 deletions

View File

@ -70,20 +70,20 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
$this->setValue($dt->format('Ymd\\THis'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('VALUE','DATE-TIME');
break;
case self::UTC :
$dt->setTimeZone(new DateTimeZone('UTC'));
$this->setValue($dt->format('Ymd\\THis\\Z'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('VALUE','DATE-TIME');
break;
case self::LOCALTZ :
$this->setValue($dt->format('Ymd\\THis'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('TZID', $dt->getTimeZone()->getName());
break;
case self::DATE :

View File

@ -60,7 +60,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
$val[] = $i->format('Ymd\\THis');
}
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('VALUE','DATE-TIME');
break;
case Sabre_VObject_Element_DateTime::UTC :
$val = array();
@ -69,7 +69,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
$val[] = $i->format('Ymd\\THis\\Z');
}
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('VALUE','DATE-TIME');
break;
case Sabre_VObject_Element_DateTime::LOCALTZ :
$val = array();
@ -77,7 +77,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
$val[] = $i->format('Ymd\\THis');
}
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('TZID', $dt[0]->getTimeZone()->getName());
break;
case Sabre_VObject_Element_DateTime::DATE :

View File

@ -1365,7 +1365,7 @@ class XML_RPC_Message extends XML_RPC_Base
!preg_match('@^HTTP/[0-9\.]+ 10[0-9]([A-Za-z ]+)?[\r\n]+HTTP/[0-9\.]+ 200@', $data))
{
$errstr = substr($data, 0, strpos($data, "\n") - 1);
error_log('HTTP error, got response: ' . $errstr);
if(defined("DEBUG") && DEBUG) {error_log('HTTP error, got response: ' . $errstr);}
$r = new XML_RPC_Response(0, $XML_RPC_err['http_error'],
$XML_RPC_str['http_error'] . ' (' .
$errstr . ')');
@ -1396,7 +1396,7 @@ class XML_RPC_Message extends XML_RPC_Base
xml_error_string(xml_get_error_code($parser_resource)),
xml_get_current_line_number($parser_resource));
}
error_log($errstr);
if(defined("DEBUG") && DEBUG) {error_log($errstr);}
$r = new XML_RPC_Response(0, $XML_RPC_err['invalid_return'],
$XML_RPC_str['invalid_return']);
xml_parser_free($parser_resource);

View File

@ -70,7 +70,8 @@ $query = OC_DB::prepare('
ELSE \' \'
END
AS tags
FROM *PREFIX*bookmarks, *PREFIX*bookmarks_tags
FROM *PREFIX*bookmarks
LEFT JOIN *PREFIX*bookmarks_tags ON 1=1
WHERE (*PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
OR *PREFIX*bookmarks.id NOT IN (
SELECT *PREFIX*bookmarks_tags.bookmark_id FROM *PREFIX*bookmarks_tags

View File

@ -9,7 +9,12 @@ function getURLMetadata($url) {
}
$metadata['url'] = $url;
$page = file_get_contents($url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($ch);
curl_close($ch);
@preg_match( "/<title>(.*)<\/title>/si", $page, $match );
$metadata['title'] = htmlspecialchars_decode(@$match[1]);

View File

@ -0,0 +1,30 @@
<?php
/**
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
$l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
$id = $_POST['id'];
$data = OC_Calendar_Object::find($id);
if (!$data)
{
echo json_encode(array('status'=>'error'));
exit;
}
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
if($calendar['userid'] != OC_User::getUser()){
echo json_encode(array('status'=>'error'));
exit;
}
$result = OC_Calendar_Object::delete($id);
echo json_encode(array('status' => 'success'));
?>

View File

@ -300,6 +300,19 @@ Calendar={
$('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/editeventform.php?id=' + id, Calendar.UI.startEventDialog);
}
},
submitDeleteEventForm:function(url){
var post = $( "#event_form" ).serialize();
$("#errorbox").html("");
$.post(url, post, function(data){
if(data.status == 'success'){
$('#event').dialog('destroy').remove();
Calendar.UI.loadEvents();
} else {
$("#errorbox").html("Deletion failed");
}
}, "json");
},
validateEventForm:function(url){
var post = $( "#event_form" ).serialize();
$("#errorbox").html("");

View File

@ -115,7 +115,7 @@ class OC_Calendar_Object{
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' );
$result = $stmt->execute(array($type,$startdate,$enddate,$repeating,$summary,$data,time(),$id));
OC_Calendar_Calendar::touchCalendar($id);
OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']);
return true;
}
@ -147,8 +147,10 @@ class OC_Calendar_Object{
* @return boolean
*/
public static function delete($id){
$oldobject = self::find($id);
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE id = ?' );
$stmt->execute(array($id));
OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']);
return true;
}
@ -424,7 +426,7 @@ class OC_Calendar_Object{
{
$title = $request["title"];
$location = $request["location"];
$categories = $request["categories"];
$categories = isset($request["categories"]) ? $request["categories"] : null;
$allday = isset($request["allday"]);
$from = $request["from"];
$fromtime = $request["fromtime"];
@ -488,8 +490,7 @@ class OC_Calendar_Object{
}
if($description != ""){
$des = str_replace("\n","\\n", $description);
$vevent->DESCRIPTION = $des;
$vevent->DESCRIPTION = $description;
}else{
unset($vevent->DESCRIPTION);
}

View File

@ -5,6 +5,7 @@
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
<span id="actions">
<input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/editevent.php');">
<input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/deleteevent.php');">
</span>
</form>
</div>

View File

@ -2,13 +2,13 @@
<tr>
<th width="75px"><?php echo $l->t("Title");?>:</th>
<td>
<input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Title of the Event");?>" value="<?php echo $_['title'] ?>" maxlength="100" name="title"/>
<input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Title of the Event");?>" value="<?php echo isset($_['title']) ? $_['title'] : '' ?>" maxlength="100" name="title"/>
</td>
</tr>
<tr>
<th width="75px"><?php echo $l->t("Location");?>:</th>
<td>
<input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Location of the Event");?>" value="<?php echo $_['location'] ?>" maxlength="100" name="location" />
<input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Location of the Event");?>" value="<?php echo isset($_['location']) ? $_['location'] : '' ?>" maxlength="100" name="location" />
</td>
</tr>
</table>
@ -19,6 +19,7 @@
<select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>">
<?php
foreach($_['category_options'] as $category){
if (!isset($_['categories'])) {$_['categories'] = array();}
echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
}
?>
@ -28,6 +29,7 @@
<select style="width:140px;" name="calendar">
<?php
foreach($_['calendar_options'] as $calendar){
if (!isset($_['calendar'])) {$_['calendar'] = false;}
echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>';
}
?>
@ -64,8 +66,10 @@
<td>
<select name="repeat" style="width:350px;">
<?php
foreach($_['repeat_options'] as $id => $label){
echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>';
if (isset($_['repeat_options'])) {
foreach($_['repeat_options'] as $id => $label){
echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>';
}
}
?>
</select></td>
@ -82,6 +86,6 @@
<table>
<tr>
<th width="75px" style="vertical-align: top;"><?php echo $l->t("Description");?>:</th>
<td><textarea style="width:350px;height: 150px;" placeholder="<?php echo $l->t("Description of the Event");?>" name="description"><?php echo $_['description'] ?></textarea></td>
<td><textarea style="width:350px;height: 150px;" placeholder="<?php echo $l->t("Description of the Event");?>" name="description"><?php echo isset($_['description']) ? $_['description'] : '' ?></textarea></td>
</tr>
</table>

View File

@ -17,13 +17,13 @@
<option value="adr_work"><?php echo $l->t('Work'); ?></option>
<option value="adr_home" selected="selected"><?php echo $l->t('Home'); ?></option>
</select>
<?php echo $l->t('PO Box'); ?> <input type="text" name="value[0]" value="">
<?php echo $l->t('Extended'); ?> <input type="text" name="value[1]" value="">
<?php echo $l->t('Street'); ?> <input type="text" name="value[2]" value="">
<?php echo $l->t('City'); ?> <input type="text" name="value[3]" value="">
<?php echo $l->t('Region'); ?> <input type="text" name="value[4]" value="">
<?php echo $l->t('Zipcode'); ?> <input type="text" name="value[5]" value="">
<?php echo $l->t('Country'); ?> <input type="text" name="value[6]" value="">
<p><label><?php echo $l->t('PO Box'); ?></label> <input type="text" name="value[0]" value=""></p>
<p><label><?php echo $l->t('Extended'); ?></label> <input type="text" name="value[1]" value=""></p>
<p><label><?php echo $l->t('Street'); ?></label> <input type="text" name="value[2]" value=""></p>
<p><label><?php echo $l->t('City'); ?></label> <input type="text" name="value[3]" value=""></p>
<p><label><?php echo $l->t('Region'); ?></label> <input type="text" name="value[4]" value=""></p>
<p><label><?php echo $l->t('Zipcode'); ?></label> <input type="text" name="value[5]" value=""></p>
<p><label><?php echo $l->t('Country'); ?></label> <input type="text" name="value[6]" value=""></p>
</div>
<div id="contacts_phonepart">
<select name="parameters[TYPE]" size="1">

View File

@ -27,9 +27,8 @@
<?php endif; ?>
<?php endforeach; ?>
</table>
<form>
<input type="button" id="contacts_deletecard" value="<?php echo $l->t('Delete');?>">
<input type="button" id="contacts_addproperty" value="<?php echo $l->t('Add Property');?>">
</form>
<?php endif; ?>
<form>
<input type="button" id="contacts_deletecard" value="<?php echo $l->t('Delete');?>">
<input type="button" id="contacts_addproperty" value="<?php echo $l->t('Add Property');?>">
</form>

View File

@ -14,7 +14,7 @@ class OC_PublicLink{
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
$this->token=$token;

View File

@ -56,9 +56,11 @@ if ($source !== false) {
$list->assign("files", $files);
$list->assign("baseURL", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&path=");
$list->assign("downloadURL", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&path=");
$list->assign("readonly", true);
$tmpl = new OC_Template("files", "index", "user");
$tmpl->assign("fileList", $list->fetchPage());
$tmpl->assign("breadcrumb", $breadcrumbNav->fetchPage());
$tmpl->assign("readonly", true);
$tmpl->printPage();
} else {
//get time mimetype and set the headers

View File

@ -29,9 +29,9 @@ $RUNTIME_NOSETUPFS=true;
require_once('../../../lib/base.php');
error_log($_GET['autoupdate']);
if(defined("DEBUG") && DEBUG) {error_log($_GET['autoupdate']);}
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
error_log((integer)$autoUpdate);
if(defined("DEBUG") && DEBUG) {error_log((integer)$autoUpdate);}
OC_Preferences::setValue(OC_User::getUser(),'media','autoupdate',(integer)$autoUpdate);

View File

@ -1006,7 +1006,7 @@ class getid3_lib
}
function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
$HTMLstring = '';
switch ($charset) {
@ -1187,7 +1187,7 @@ class getid3_lib
return (isset($ImageTypesLookup[$imagetypeid]) ? $ImageTypesLookup[$imagetypeid] : '');
}
function CopyTagsToComments(&$ThisFileInfo) {
static function CopyTagsToComments(&$ThisFileInfo) {
// Copy all entries from ['tags'] into common ['comments']
if (!empty($ThisFileInfo['tags'])) {

View File

@ -195,7 +195,7 @@ class OC_MEDIA_AMPACHE{
$filter=isset($params['filter'])?$params['filter']:'';
$exact=isset($params['exact'])?($params['exact']=='true'):false;
$artists=OC_MEDIA_COLLECTION::getArtists($filter,$exact);
error_log('artists found: '.print_r($artists,true));
if(defined("DEBUG") && DEBUG) {error_log('artists found: '.print_r($artists,true));}
echo('<root>');
foreach($artists as $artist){
self::printArtist($artist);

View File

@ -37,7 +37,7 @@ class OC_MEDIA{
*/
public static function loginListener($params){
if(isset($_POST['user']) and $_POST['password']){
error_log('postlogin');
if(defined("DEBUG") && DEBUG) {error_log('postlogin');}
$name=$_POST['user'];
$query=OC_DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?");
$uid=$query->execute(array($name))->fetchAll();

View File

@ -97,25 +97,25 @@ class OC_MEDIA_SCANNER{
$data=@self::$getID3->analyze($file);
getid3_lib::CopyTagsToComments($data);
if(!isset($data['comments'])){
error_log("error reading id3 tags in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading id3 tags in '$file'");}
return;
}
if(!isset($data['comments']['artist'])){
error_log("error reading artist tag in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading artist tag in '$file'");}
$artist='unknown';
}else{
$artist=stripslashes($data['comments']['artist'][0]);
$artist=utf8_encode($artist);
}
if(!isset($data['comments']['album'])){
error_log("error reading album tag in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading album tag in '$file'");}
$album='unknown';
}else{
$album=stripslashes($data['comments']['album'][0]);
$album=utf8_encode($album);
}
if(!isset($data['comments']['title'])){
error_log("error reading title tag in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading title tag in '$file'");}
$title='unknown';
}else{
$title=stripslashes($data['comments']['title'][0]);

View File

@ -36,7 +36,7 @@ foreach($arguments as &$argument){
}
ob_clean();
if(isset($arguments['action'])){
error_log($arguments['action']);
if(defined("DEBUG") && DEBUG) {error_log($arguments['action']);}
switch($arguments['action']){
case 'url_to_song':
OC_MEDIA_AMPACHE::url_to_song($arguments);

View File

@ -7,7 +7,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
$ret = array();
@ -24,7 +24,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
$ret = array();
@ -45,7 +45,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
}
@ -56,7 +56,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
}

View File

@ -26,14 +26,14 @@ OC_User::useBackend('openid');
//check for results from openid requests
if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
error_log('openid retured');
if(defined("DEBUG") && DEBUG) {error_log('openid retured');}
$openid = new SimpleOpenID;
$openid->SetIdentity($_GET['openid_identity']);
$openid_validation_result = $openid->ValidateWithServer();
if ($openid_validation_result == true){ // OK HERE KEY IS VALID
error_log('auth sucessfull');
if(defined("DEBUG") && DEBUG) {error_log('auth sucessfull');}
$identity=$openid->GetIdentity();
error_log("auth as $identity");
if(defined("DEBUG") && DEBUG) {error_log("auth as $identity");}
$user=OC_USER_OPENID::findUserForIdentity($identity);
if($user){
$_SESSION['user_id']=$user;
@ -41,13 +41,13 @@ if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
}
}else if($openid->IsError() == true){ // ON THE WAY, WE GOT SOME ERROR
$error = $openid->GetError();
error_log("ERROR CODE: " . $error['code']);
error_log("ERROR DESCRIPTION: " . $error['description']);
if(defined("DEBUG") && DEBUG) {error_log("ERROR CODE: " . $error['code']);}
if(defined("DEBUG") && DEBUG) {error_log("ERROR DESCRIPTION: " . $error['description']);}
}else{ // Signature Verification Failed
error_log("INVALID AUTHORIZATION");
if(defined("DEBUG") && DEBUG) {error_log("INVALID AUTHORIZATION");}
}
}else if (isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'cancel'){ // User Canceled your Request
error_log("USER CANCELED REQUEST");
if(defined("DEBUG") && DEBUG) {error_log("USER CANCELED REQUEST");}
return false;
}

View File

@ -1054,7 +1054,7 @@ function debug ($x, $m = null) {
$x .= "\n";
}
error_log($x . "\n", 3, $profile['logfile']);
if(defined("DEBUG") && DEBUG) {error_log($x . "\n", 3, $profile['logfile']);}
}
@ -1069,6 +1069,9 @@ function destroy_assoc_handle ( $id ) {
session_write_close();
session_id($id);
if (OC_Config::getValue( "forcessl", false )) {
ini_set("session.cookie_secure", "on");
}
session_start();
session_destroy();
@ -1194,6 +1197,9 @@ function new_assoc ( $expiration ) {
session_write_close();
}
if (OC_Config::getValue( "forcessl", false )) {
ini_set("session.cookie_secure", "on");
}
session_start();
session_regenerate_id('false');
@ -1265,6 +1271,9 @@ function secret ( $handle ) {
}
session_id($handle);
if (OC_Config::getValue( "forcessl", false )) {
ini_set("session.cookie_secure", "on");
}
session_start();
debug('Started session to acquire key: ' . session_id());
@ -1467,6 +1476,9 @@ function user_session () {
global $proto, $profile;
session_name('phpMyID_Server');
if (OC_Config::getValue( "forcessl", false )) {
ini_set("session.cookie_secure", "on");
}
@session_start();
$profile['authorized'] = (isset($_SESSION['auth_username'])
@ -1501,7 +1513,7 @@ function wrap_html ( $message ) {
</body>
</html>
';
error_log($html);
if(defined("DEBUG") && DEBUG) {error_log($html);}
echo $html;
exit(0);
}
@ -1653,8 +1665,8 @@ $profile['req_url'] = sprintf("%s://%s%s",
// $profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']);
// }
// error_log('inc id: '.$fullId);
// error_log('req url: '.$profile['req_url']);
// if(defined("DEBUG") && DEBUG) {error_log('inc id: '.$fullId);}
// if(defined("DEBUG") && DEBUG) {error_log('req url: '.$profile['req_url']);}
// Set the default allowance for testing
if (! array_key_exists('allow_test', $profile))

View File

@ -39,7 +39,7 @@ $RUNTIME_NOAPPS=false;
require_once '../../lib/base.php';
if(!OC_User::userExists($USERNAME)){
error_log($USERNAME.' doesn\'t exist');
if(defined("DEBUG") && DEBUG) {error_log($USERNAME.' doesn\'t exist');}
$USERNAME='';
}
$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;

View File

@ -1,5 +1,7 @@
<?php
define("DEBUG", true);
$CONFIG = array(
"installed" => false,
"dbtype" => "sqlite",

View File

@ -105,7 +105,8 @@ tbody tr:hover, tr:active { background-color:#f8f8f8; }
#body-settings .personalblock#quota { position:relative; margin-top:4.5em; padding:0; }
#body-settings #controls+.helpblock { position:relative; margin-top:7.3em; }
#quota div, div.jp-play-bar, div.jp-seek-bar { padding:.6em 1em; background:#e6e6e6; font-weight:normal; white-space:nowrap; -moz-border-radius-bottomleft:.4em; -webkit-border-bottom-left-radius:.4em; border-bottom-left-radius:.4em; -moz-border-radius-topleft:.4em; -webkit-border-top-left-radius:.4em; border-top-left-radius:.4em; }
#quota div, div.jp-play-bar, div.jp-seek-bar { padding:0; background:#e6e6e6; font-weight:normal; white-space:nowrap; -moz-border-radius-bottomleft:.4em; -webkit-border-bottom-left-radius:.4em; border-bottom-left-radius:.4em; -moz-border-radius-topleft:.4em; -webkit-border-top-left-radius:.4em; border-top-left-radius:.4em; }
#quotatext {padding: .6em 1em;}
div.jp-play-bar, div.jp-seek-bar { padding:0; }
.pager { list-style:none; float:right; display:inline; margin:.7em 12.7em 0 0; }

File diff suppressed because one or more lines are too long

4
core/js/jquery-1.6.4.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -32,7 +32,9 @@ if(isset($_POST['maxUploadSize'])){
$maxUploadFilesize=$_POST['maxUploadSize'];
OC_Files::setUploadLimit(OC_Helper::computerFileSize($maxUploadFilesize));
}else{
$maxUploadFilesize = ini_get('upload_max_filesize').'B';
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
}
OC_App::setActiveNavigationEntry( "files_administration" );

View File

@ -20,7 +20,7 @@ if($foldername == '') {
echo json_encode( array( "status" => "error", "data" => array( "message" => "Empty Foldername" )));
exit();
}
error_log('try to create ' . $foldername . ' in ' . $dir);
if(defined("DEBUG") && DEBUG) {error_log('try to create ' . $foldername . ' in ' . $dir);}
if(OC_Files::newFile($dir, $foldername, 'dir')) {
echo json_encode( array( "status" => "success", "data" => array()));
exit();

View File

@ -1,4 +1,6 @@
<?php
// FIXME: this should start a secure session if forcessl is enabled
// see lib/base.php for an example
session_start();
$_SESSION['timezone'] = $_GET['time'];
?>
?>

View File

@ -14,6 +14,24 @@ if( !OC_User::isLoggedIn()){
exit();
}
if (!isset($_FILES['files'])) {
echo json_encode( array( "status" => "error", "data" => array( "message" => "No file was uploaded. Unknown error" )));
exit();
}
foreach ($_FILES['files']['error'] as $error) {
if ($error != 0) {
$errors = array(
0=>$l->t("There is no error, the file uploaded with success"),
1=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini"),
2=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
3=>$l->t("The uploaded file was only partially uploaded"),
4=>$l->t("No file was uploaded"),
6=>$l->t("Missing a temporary folder")
);
echo json_encode( array( "status" => "error", "data" => array( "message" => $errors[$error] )));
exit();
}
}
$files=$_FILES['files'];
$dir = $_POST['dir'];

View File

@ -78,7 +78,9 @@ $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir="));
$maxUploadFilesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$tmpl = new OC_Template( "files", "index", "user" );
$tmpl->assign( "fileList", $list->fetchPage() );

View File

@ -1,5 +1,6 @@
<div id="controls">
<?php echo($_['breadcrumb']); ?>
<?php if (!isset($_['readonly']) || !$_['readonly']) {?>
<div class="actions">
<form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
@ -19,23 +20,30 @@
<div id="file_action_panel">
</div>
</div>
<?php
}
?>
<div id='notification'></div>
<div id="emptyfolder" <?php if(count($_['files'])) echo 'style="display:none;"';?>><?php echo $l->t('Nothing in here. Upload something!')?></div>
<?php
if (isset($_['files'])) {
if (!count($_['files'])) { ?>
<div id="emptyfolder"><?php echo $l->t('Nothing in here. Upload something!')?></div>
<?php }}?>
<table>
<thead>
<tr>
<th id='headerName'>
<input type="checkbox" id="select_all" />
<?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" id="select_all" /><?php } ?>
<span class='name'><?php echo $l->t( 'Name' ); ?></span>
<span class='selectedActions'>
<a href="" title="<?php echo $l->t('Download')?>" class="download"><img class='svg' alt="Download" src="../core/img/actions/download.svg" /></a>
<a href="" title="Share" class="share"><img class='svg' alt="Share" src="../core/img/actions/share.svg" /></a>
<a href="" title="<?php echo $l->t('Download')?>" class="download"><img class='svg' alt="Download" src="<?php echo image_path("core", "actions/download.svg"); ?>" /></a>
<a href="" title="Share" class="share"><img class='svg' alt="Share" src="<?php echo image_path("core", "actions/share.svg"); ?>" /></a>
</span>
</th>
<th id="headerSize"><?php echo $l->t( 'Size' ); ?></th>
<th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" title="Delete" class="delete"><img class="svg" alt="<?php echo $l->t('Delete')?>" src="../core/img/actions/delete.svg" /></a></span></th>
<th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" title="Delete" class="delete"><img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo image_path("core", "actions/delete.svg"); ?>" /></a></span></th>
</tr>
</thead>
<tbody id="fileList">

View File

@ -7,7 +7,7 @@
if($relative_date_color>200) $relative_date_color = 200; ?>
<tr data-file="<?php echo $file['name'];?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mime']?>" data-size='<?php echo $file['size'];?>'>
<td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo mimetype_icon('dir'); else echo mimetype_icon($file['mime']); ?>)">
<input type="checkbox" />
<?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?>
<a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$file['directory'].'/'.$file['name']; else echo $_['downloadURL'].$file['directory'].'/'.$file['name']; ?>" title="">
<span class="nametext">
<?php if($file['type'] == 'dir'):?>

View File

@ -55,7 +55,7 @@ elseif(OC_User::isLoggedIn()) {
// remember was checked after last login
elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) {
OC_App::loadApps();
error_log("Trying to login from cookie");
if(defined("DEBUG") && DEBUG) {error_log("Trying to login from cookie");}
// confirm credentials in cookie
if(OC_User::userExists($_COOKIE['oc_username']) &&
OC_Preferences::getValue($_COOKIE['oc_username'], "login", "token") == $_COOKIE['oc_token']) {
@ -72,7 +72,7 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) {
OC_App::loadApps();
if(OC_User::login($_POST["user"], $_POST["password"])) {
if(!empty($_POST["remember_login"])){
error_log("Setting remember login to cookie");
if(defined("DEBUG") && DEBUG) {error_log("Setting remember login to cookie");}
$token = md5($_POST["user"].time());
OC_Preferences::setValue($_POST['user'], 'login', 'token', $token);
OC_User::setMagicInCookie($_POST["user"], $token);

View File

@ -80,8 +80,6 @@ class OC{
date_default_timezone_set('Europe/Berlin');
ini_set('arg_separator.output','&amp;');
ini_set('session.cookie_httponly','1;');
session_start();
// calculate the documentroot
OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
@ -102,6 +100,7 @@ class OC{
// redirect to https site if configured
if( OC_Config::getValue( "forcessl", false )){
ini_set("session.cookie_secure", "on");
if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') {
$url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
header("Location: $url");
@ -109,8 +108,11 @@ class OC{
}
}
ini_set('session.cookie_httponly','1;');
session_start();
// Add the stuff we need always
OC_Util::addScript( "jquery-1.6.2.min" );
OC_Util::addScript( "jquery-1.6.4.min" );
OC_Util::addScript( "jquery-ui-1.8.14.custom.min" );
OC_Util::addScript( "jquery-showpassword" );
OC_Util::addScript( "jquery-tipsy" );

View File

@ -92,8 +92,8 @@ class OC_DB {
if( PEAR::isError( self::$DBConnection )){
echo( '<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>');
$error = self::$DBConnection->getMessage();
error_log( $error);
error_log( self::$DBConnection->getUserInfo());
if(defined("DEBUG") && DEBUG) {error_log( $error);}
if(defined("DEBUG") && DEBUG) {error_log( self::$DBConnection->getUserInfo());}
die( $error );
}
@ -129,7 +129,7 @@ class OC_DB {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$query.'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
@ -155,7 +155,7 @@ class OC_DB {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$query.'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}

View File

@ -44,6 +44,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
}
public function preFile_put_contents($path,$data){
if (is_resource($data)) {
$data = stream_get_contents($data);
}
return (strlen($data)<$this->getFreeSpace() or $this->getFreeSpace()==0);
}

View File

@ -195,7 +195,7 @@ class OC_Filestorage_Local extends OC_Filestorage{
}
private function delTree($dir) {
error_log('del'.$dir);
if(defined("DEBUG") && DEBUG) {error_log('del'.$dir);}
$dirRelative=$dir;
$dir=$this->datadir.$dir;
if (!file_exists($dir)) return true;

View File

@ -286,7 +286,7 @@ class OC_Filesystem{
return self::basicOperation('file_get_contents',$path,array('read'));
}
static public function file_put_contents($path,$data){
error_log($data);
if(defined("DEBUG") && DEBUG) {error_log($data);}
return self::basicOperation('file_put_contents',$path,array('create','write'),$data);
}
static public function unlink($path){
@ -393,7 +393,7 @@ class OC_Filesystem{
}
}
static public function fromUploadedFile($tmpFile,$path){
error_log('upload');
if(defined("DEBUG") && DEBUG) {error_log('upload');}
if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){
$run=true;
$exists=self::file_exists($path);
@ -403,7 +403,7 @@ class OC_Filesystem{
if($run){
OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run));
}
error_log('upload2');
if(defined("DEBUG") && DEBUG) {error_log('upload2');}
if($run){
$result=$storage->fromUploadedFile($tmpFile,self::getInternalPath($path));
if(!$exists){
@ -454,7 +454,7 @@ class OC_Filesystem{
* @return mixed
*/
private static function basicOperation($operation,$path,$hooks=array(),$extraParam=null){
if(OC_FileProxy::runPreProxies($operation,$path) and self::canRead($path) and $storage=self::getStorage($path)){
if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and self::canRead($path) and $storage=self::getStorage($path)){
$interalPath=self::getInternalPath($path);
$run=true;
foreach($hooks as $hook){

View File

@ -56,7 +56,7 @@ class OC_Installer{
*/
public static function installApp( $data = array()){
if(!isset($data['source'])){
error_log("No source specified when installing app");
if(defined("DEBUG") && DEBUG) {error_log("No source specified when installing app");}
return false;
}
@ -64,13 +64,13 @@ class OC_Installer{
if($data['source']=='http'){
$path=tempnam(sys_get_temp_dir(),'oc_installer_');
if(!isset($data['href'])){
error_log("No href specified when installing app from http");
if(defined("DEBUG") && DEBUG) {error_log("No href specified when installing app from http");}
return false;
}
copy($data['href'],$path);
}else{
if(!isset($data['path'])){
error_log("No path specified when installing app from local file");
if(defined("DEBUG") && DEBUG) {error_log("No path specified when installing app from local file");}
return false;
}
$path=$data['path'];
@ -85,7 +85,7 @@ class OC_Installer{
$zip->extractTo($extractDir);
$zip->close();
} else {
error_log("Failed to open archive when installing app");
if(defined("DEBUG") && DEBUG) {error_log("Failed to open archive when installing app");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -95,7 +95,7 @@ class OC_Installer{
//load the info.xml file of the app
if(!is_file($extractDir.'/appinfo/info.xml')){
error_log("App does not provide an info.xml file");
if(defined("DEBUG") && DEBUG) {error_log("App does not provide an info.xml file");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -107,7 +107,7 @@ class OC_Installer{
//check if an app with the same id is already installed
if(self::isInstalled( $info['id'] )){
error_log("App already installed");
if(defined("DEBUG") && DEBUG) {error_log("App already installed");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -117,7 +117,7 @@ class OC_Installer{
//check if the destination directory already exists
if(is_dir($basedir)){
error_log("App's directory already exists");
if(defined("DEBUG") && DEBUG) {error_log("App's directory already exists");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -131,7 +131,7 @@ class OC_Installer{
//copy the app to the correct place
if(!mkdir($basedir)){
error_log('Can\'t create app folder ('.$basedir.')');
if(defined("DEBUG") && DEBUG) {error_log('Can\'t create app folder ('.$basedir.')');}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);

View File

@ -140,7 +140,7 @@ class OC_Preferences{
// Check if the key does exist
$query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' );
$values=$query->execute(array($user,$app,$key))->fetchAll();
error_log(print_r($values,true));
if(defined("DEBUG") && DEBUG) {error_log(print_r($values,true));}
$exists=(count($values)>0);
if( !$exists ){

View File

@ -348,9 +348,10 @@ class OC_User {
* @param string $username username to be set
*/
public static function setMagicInCookie($username, $token){
setcookie("oc_username", $username, time()+60*60*24*15);
setcookie("oc_token", $token, time()+60*60*24*15);
setcookie("oc_remember_login", true, time()+60*60*24*15);
$secure_cookie = OC_Config::getValue("forcessl", false);
setcookie("oc_username", $username, time()+60*60*24*15, '', '', $secure_cookie);
setcookie("oc_token", $token, time()+60*60*24*15, '', '', $secure_cookie);
setcookie("oc_remember_login", true, time()+60*60*24*15, '', '', $secure_cookie);
}
/**

View File

@ -17,7 +17,7 @@ OC_App::setActiveNavigationEntry( "personal" );
$used=OC_Filesystem::filesize('/');
$free=OC_Filesystem::free_space();
$total=$free+$used;
$relative=round(($used/$total)*100);
$relative=round(($used/$total)*10000)/100;
$lang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', 'en' );
$languageCodes=OC_L10N::findAvailableLanguages();

View File

@ -5,7 +5,7 @@
*/?>
<div id="quota" class="personalblock"><div style="width:<?php echo $_['usage_relative'];?>%;">
<p><?php echo $l->t('You use');?> <strong><?php echo $_['usage'];?></strong> <?php echo $l->t('of the available');?> <strong><?php echo $_['total_space'];?></strong></p>
<p id="quotatext"><?php echo $l->t('You use');?> <strong><?php echo $_['usage'];?></strong> <?php echo $l->t('of the available');?> <strong><?php echo $_['total_space'];?></strong></p>
</div></div>
<form id="passwordform">