localise event calendar
This commit is contained in:
@@ -398,6 +398,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// The 'update' option sets db values without uploading a new attachment
|
// The 'update' option sets db values without uploading a new attachment
|
||||||
// 'replace' replaces the existing uploaded data
|
// 'replace' replaces the existing uploaded data
|
||||||
// 'revision' creates a new revision with new upload data
|
// 'revision' creates a new revision with new upload data
|
||||||
@@ -415,21 +416,13 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
$filename = basename($_FILES['userfile']['name']);
|
$filename = basename($_FILES['userfile']['name']);
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
$filesize = intval($_FILES['userfile']['size']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$existing_size = 0;
|
$existing_size = 0;
|
||||||
|
|
||||||
if($options === 'replace') {
|
if($options === 'replace') {
|
||||||
/** @BUG $replace is undefined here */
|
|
||||||
$x = q("select id, hash, filesize from attach where id = %d and uid = %d limit 1",
|
$x = q("select id, hash, filesize from attach where id = %d and uid = %d limit 1",
|
||||||
intval($replace),
|
intval($arr['id']),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
if(! $x) {
|
if(! $x) {
|
||||||
@@ -457,33 +450,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
$hash = $x[0]['hash'];
|
$hash = $x[0]['hash'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check storage limits
|
|
||||||
if($options !== 'update') {
|
|
||||||
$maxfilesize = get_config('system','maxfilesize');
|
|
||||||
|
|
||||||
if(($maxfilesize) && ($filesize > $maxfilesize)) {
|
|
||||||
$ret['message'] = sprintf( t('File exceeds size limit of %d'), $maxfilesize);
|
|
||||||
@unlink($src);
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
$limit = service_class_fetch($channel_id, 'attach_upload_limit');
|
|
||||||
|
|
||||||
if($limit !== false) {
|
|
||||||
$r = q("select sum(filesize) as total from attach where aid = %d ",
|
|
||||||
intval($channel['channel_account_id'])
|
|
||||||
);
|
|
||||||
if(($r) && (($r[0]['total'] + $filesize) > ($limit - $existing_size))) {
|
|
||||||
$ret['message'] = upgrade_message(true) . sprintf(t("You have reached your limit of %1$.0f Mbytes attachment storage."), $limit / 1024000);
|
|
||||||
@unlink($src);
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$mimetype = z_mime_content_type($filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(! $hash)
|
|
||||||
$hash = random_string();
|
|
||||||
|
|
||||||
|
|
||||||
$is_photo = 0;
|
$is_photo = 0;
|
||||||
@@ -524,6 +491,23 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
$folder_hash = '';
|
$folder_hash = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! $options) {
|
||||||
|
|
||||||
|
// A freshly uploaded file. Check for duplicate and resolve with the channel's overwrite settings.
|
||||||
|
|
||||||
|
$r = q("select filename, id, hash, filesize from attach where filename = '%s' and folder = '%s' ",
|
||||||
|
dbesc($filename),
|
||||||
|
dbesc($folder_hash)
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
$overwrite = get_pconfig($channel_id,'system','overwrite_dup_files');
|
||||||
|
if($overwrite) {
|
||||||
|
$options = 'replace';
|
||||||
|
$existing_id = $x[0]['id'];
|
||||||
|
$existing_size = intval($x[0]['filesize']);
|
||||||
|
$hash = $x[0]['hash'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
$r = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder = '%s' ",
|
$r = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder = '%s' ",
|
||||||
dbesc($filename),
|
dbesc($filename),
|
||||||
dbesc($filename . '(%)'),
|
dbesc($filename . '(%)'),
|
||||||
@@ -547,6 +531,37 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
while($found);
|
while($found);
|
||||||
$filename = $filename . '(' . $x . ')';
|
$filename = $filename . '(' . $x . ')';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! $hash)
|
||||||
|
$hash = random_string();
|
||||||
|
|
||||||
|
// Check storage limits
|
||||||
|
if($options !== 'update') {
|
||||||
|
$maxfilesize = get_config('system','maxfilesize');
|
||||||
|
|
||||||
|
if(($maxfilesize) && ($filesize > $maxfilesize)) {
|
||||||
|
$ret['message'] = sprintf( t('File exceeds size limit of %d'), $maxfilesize);
|
||||||
|
@unlink($src);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
$limit = service_class_fetch($channel_id, 'attach_upload_limit');
|
||||||
|
|
||||||
|
if($limit !== false) {
|
||||||
|
$r = q("select sum(filesize) as total from attach where aid = %d ",
|
||||||
|
intval($channel['channel_account_id'])
|
||||||
|
);
|
||||||
|
if(($r) && (($r[0]['total'] + $filesize) > ($limit - $existing_size))) {
|
||||||
|
$ret['message'] = upgrade_message(true) . sprintf(t("You have reached your limit of %1$.0f Mbytes attachment storage."), $limit / 1024000);
|
||||||
|
@unlink($src);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$mimetype = z_mime_content_type($filename);
|
||||||
|
}
|
||||||
|
|
||||||
$os_basepath = 'store/' . $channel['channel_address'] . '/' ;
|
$os_basepath = 'store/' . $channel['channel_address'] . '/' ;
|
||||||
$os_relpath = '';
|
$os_relpath = '';
|
||||||
@@ -560,6 +575,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
|
|
||||||
$os_relpath .= $hash;
|
$os_relpath .= $hash;
|
||||||
|
|
||||||
|
if($src)
|
||||||
@file_put_contents($os_basepath . $os_relpath,@file_get_contents($src));
|
@file_put_contents($os_basepath . $os_relpath,@file_get_contents($src));
|
||||||
|
|
||||||
$created = datetime_convert();
|
$created = datetime_convert();
|
||||||
|
@@ -39,7 +39,50 @@ function js_strings() {
|
|||||||
'$t14' => t('about a year'),
|
'$t14' => t('about a year'),
|
||||||
'$t15' => t('%d years'),
|
'$t15' => t('%d years'),
|
||||||
'$t16' => t(' '), // wordSeparator
|
'$t16' => t(' '), // wordSeparator
|
||||||
'$t17' => ((t('timeago.numbers') != 'timeago.numbers') ? t('timeago.numbers') : '[]')
|
'$t17' => ((t('timeago.numbers') != 'timeago.numbers') ? t('timeago.numbers') : '[]'),
|
||||||
|
|
||||||
|
'$January' => t('January'),
|
||||||
|
'$February' => t('February'),
|
||||||
|
'$March' => t('March'),
|
||||||
|
'$April' => t('April'),
|
||||||
|
'$May' => t('May','long'),
|
||||||
|
'$June' => t('June'),
|
||||||
|
'$July' => t('July'),
|
||||||
|
'$August' => t('August'),
|
||||||
|
'$September' => t('September'),
|
||||||
|
'$October' => t('October'),
|
||||||
|
'$November' => t('November'),
|
||||||
|
'$December' => t('December'),
|
||||||
|
'$Jan' => t('Jan'),
|
||||||
|
'$Feb' => t('Feb'),
|
||||||
|
'$Mar' => t('Mar'),
|
||||||
|
'$Apr' => t('Apr'),
|
||||||
|
'$MayShort' => t('May','short'),
|
||||||
|
'$Jun' => t('Jun'),
|
||||||
|
'$Jul' => t('Jul'),
|
||||||
|
'$Aug' => t('Aug'),
|
||||||
|
'$Sep' => t('Sep'),
|
||||||
|
'$Oct' => t('Oct'),
|
||||||
|
'$Nov' => t('Nov'),
|
||||||
|
'$Dec' => t('Dec'),
|
||||||
|
'$Sunday' => t('Sunday'),
|
||||||
|
'$Monday' => t('Monday'),
|
||||||
|
'$Tuesday' => t('Tuesday'),
|
||||||
|
'$Wednesday' => t('Wednesday'),
|
||||||
|
'$Thursday' => t('Thursday'),
|
||||||
|
'$Friday' => t('Friday'),
|
||||||
|
'$Saturday' => t('Saturday'),
|
||||||
|
'$Sun' => t('Sun'),
|
||||||
|
'$Mon' => t('Mon'),
|
||||||
|
'$Tue' => t('Tue'),
|
||||||
|
'$Wed' => t('Wed'),
|
||||||
|
'$Thu' => t('Thu'),
|
||||||
|
'$Fri' => t('Fri'),
|
||||||
|
'$Sat' => t('Sat'),
|
||||||
|
'$today' => t('today','calendar'),
|
||||||
|
'$month' => t('month','calendar'),
|
||||||
|
'$week' => t('week','calendar'),
|
||||||
|
'$day' => t('day','calendar'),
|
||||||
|
'$allday' => t('All day','calendar')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,21 @@
|
|||||||
center: 'title',
|
center: 'title',
|
||||||
right: 'month,agendaWeek,agendaDay'
|
right: 'month,agendaWeek,agendaDay'
|
||||||
},
|
},
|
||||||
|
monthNames: aStr['monthNames'],
|
||||||
|
monthNamesShort: aStr['monthNamesShort'],
|
||||||
|
dayNames: aStr['dayNames'],
|
||||||
|
dayNamesShort: aStr['dayNamesShort'],
|
||||||
|
buttonText: {
|
||||||
|
prev: "<span class='fc-text-arrow'>‹</span>",
|
||||||
|
next: "<span class='fc-text-arrow'>›</span>",
|
||||||
|
prevYear: "<span class='fc-text-arrow'>«</span>",
|
||||||
|
nextYear: "<span class='fc-text-arrow'>»</span>",
|
||||||
|
today: aStr['today'],
|
||||||
|
month: aStr['month'],
|
||||||
|
week: aStr['week'],
|
||||||
|
day: aStr['day']
|
||||||
|
},
|
||||||
|
allDayText: aStr['allday'],
|
||||||
timeFormat: 'H(:mm)',
|
timeFormat: 'H(:mm)',
|
||||||
eventClick: function(calEvent, jsEvent, view) {
|
eventClick: function(calEvent, jsEvent, view) {
|
||||||
showEvent(calEvent.id);
|
showEvent(calEvent.id);
|
||||||
|
@@ -40,6 +40,16 @@
|
|||||||
't15' : "{{$t15}}",
|
't15' : "{{$t15}}",
|
||||||
't16' : "{{$t16}}",
|
't16' : "{{$t16}}",
|
||||||
't17' : "{{$t17}}",
|
't17' : "{{$t17}}",
|
||||||
|
|
||||||
|
'monthNames' : [ "{{$January}}","{{$February}}","{{$March}}","{{$April}}","{{$May}}","{{$June}}","{{$July}}","{{$August}}","{{$September}}","{{$October}}","{{$November}}","{{$December}}" ],
|
||||||
|
'monthNamesShort' : [ "{{$Jan}}","{{$Feb}}","{{$Mar}}","{{$Apr}}","{{$MayShort}}","{{$Jun}}","{{$Jul}}","{{$Aug}}","{{$Sep}}","{{$Oct}}","{{$Nov}}","{{$Dec}}" ],
|
||||||
|
'dayNames' : ["{{$Sunday}}","{{$Monday}}","{{$Tuesday}}","{{$Wednesday}}","{{$Thursday}}","{{$Friday}}","{{$Saturday}}"],
|
||||||
|
'dayNamesShort' : ["{{$Sun}}","{{$Mon}}","{{$Tue}}","{{$Wed}}","{{$Thu}}","{{$Fri}}","{{$Sat}}"],
|
||||||
|
'today' : "{{$today}}",
|
||||||
|
'month' : "{{$month}}",
|
||||||
|
'week' : "{{$week}}",
|
||||||
|
'day' : "{{$day}}",
|
||||||
|
'allday' : "{{$allday}}"
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user