Merge pull request #1966 from annando/1510-event-guid
Issue 1561: Deleting events (And some other event stuff)
This commit is contained in:
commit
d640128dc9
7 changed files with 120 additions and 57 deletions
|
@ -1210,7 +1210,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
||||||
// start which is always required). Allow desc with a missing summary for compatibility.
|
// start which is always required). Allow desc with a missing summary for compatibility.
|
||||||
|
|
||||||
if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
|
if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
|
||||||
$sub = format_event_html($ev);
|
$sub = format_event_html($ev, $simplehtml);
|
||||||
|
|
||||||
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
|
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
|
||||||
$Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
|
$Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
|
||||||
|
|
|
@ -43,18 +43,18 @@ function select_timezone($current = 'America/Los_Angeles') {
|
||||||
if($continent != t('Miscellaneous')) {
|
if($continent != t('Miscellaneous')) {
|
||||||
$o .= '</optgroup>';
|
$o .= '</optgroup>';
|
||||||
$continent = t('Miscellaneous');
|
$continent = t('Miscellaneous');
|
||||||
$o .= '<optgroup label="' . t($continent) . '">';
|
$o .= '<optgroup label="' . t($continent) . '">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$city = str_replace('_', ' ', t($city));
|
$city = str_replace('_', ' ', t($city));
|
||||||
$selected = (($value == $current) ? " selected=\"selected\" " : "");
|
$selected = (($value == $current) ? " selected=\"selected\" " : "");
|
||||||
$o .= "<option value=\"$value\" $selected >$city</option>";
|
$o .= "<option value=\"$value\" $selected >$city</option>";
|
||||||
}
|
}
|
||||||
$o .= '</optgroup></select>';
|
$o .= '</optgroup></select>';
|
||||||
return $o;
|
return $o;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
// return a select using 'field_select_raw' template, with timezones
|
// return a select using 'field_select_raw' template, with timezones
|
||||||
// groupped (primarily) by continent
|
// groupped (primarily) by continent
|
||||||
// arguments follow convetion as other field_* template array:
|
// arguments follow convetion as other field_* template array:
|
||||||
// 'name', 'label', $value, 'help'
|
// 'name', 'label', $value, 'help'
|
||||||
|
@ -63,12 +63,12 @@ function field_timezone($name='timezone', $label='', $current = 'America/Los_Ang
|
||||||
$options = select_timezone($current);
|
$options = select_timezone($current);
|
||||||
$options = str_replace('<select id="timezone_select" name="timezone">','', $options);
|
$options = str_replace('<select id="timezone_select" name="timezone">','', $options);
|
||||||
$options = str_replace('</select>','', $options);
|
$options = str_replace('</select>','', $options);
|
||||||
|
|
||||||
$tpl = get_markup_template('field_select_raw.tpl');
|
$tpl = get_markup_template('field_select_raw.tpl');
|
||||||
return replace_macros($tpl, array(
|
return replace_macros($tpl, array(
|
||||||
'$field' => array($name, $label, $current, $help, $options),
|
'$field' => array($name, $label, $current, $help, $options),
|
||||||
));
|
));
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
// General purpose date parse/convert function.
|
// General purpose date parse/convert function.
|
||||||
|
@ -92,8 +92,8 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
|
||||||
|
|
||||||
// Slight hackish adjustment so that 'zero' datetime actually returns what is intended
|
// Slight hackish adjustment so that 'zero' datetime actually returns what is intended
|
||||||
// otherwise we end up with -0001-11-30 ...
|
// otherwise we end up with -0001-11-30 ...
|
||||||
// add 32 days so that we at least get year 00, and then hack around the fact that
|
// add 32 days so that we at least get year 00, and then hack around the fact that
|
||||||
// months and days always start with 1.
|
// months and days always start with 1.
|
||||||
|
|
||||||
if(substr($s,0,10) == '0000-00-00') {
|
if(substr($s,0,10) == '0000-00-00') {
|
||||||
$d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
|
$d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
|
||||||
|
@ -203,13 +203,25 @@ function timesel($format, $h, $m, $id='timepicker') {
|
||||||
* set maximum date from picker with id $maxfrom (none by default)
|
* set maximum date from picker with id $maxfrom (none by default)
|
||||||
* @param boolean $required default false
|
* @param boolean $required default false
|
||||||
* @return string Parsed HTML output.
|
* @return string Parsed HTML output.
|
||||||
*
|
*
|
||||||
* @todo Once browser support is better this could probably be replaced with
|
* @todo Once browser support is better this could probably be replaced with
|
||||||
* native HTML5 date picker.
|
* native HTML5 date picker.
|
||||||
*/
|
*/
|
||||||
if(! function_exists('datetimesel')) {
|
if(! function_exists('datetimesel')) {
|
||||||
function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) {
|
function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) {
|
||||||
|
|
||||||
|
$a = get_app();
|
||||||
|
|
||||||
|
// First day of the week (0 = Sunday)
|
||||||
|
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
|
||||||
|
if ($firstDay === false) $firstDay=0;
|
||||||
|
|
||||||
|
$lang = substr(get_browser_language(), 0, 2);
|
||||||
|
|
||||||
|
// Check if the detected language is supported by the picker
|
||||||
|
if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu")))
|
||||||
|
$lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
$dateformat = '';
|
$dateformat = '';
|
||||||
if($pickdate) $dateformat .= 'Y-m-d';
|
if($pickdate) $dateformat .= 'Y-m-d';
|
||||||
|
@ -217,16 +229,17 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
|
||||||
if($picktime) $dateformat .= 'H:i';
|
if($picktime) $dateformat .= 'H:i';
|
||||||
$minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : '';
|
$minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : '';
|
||||||
$maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : '';
|
$maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : '';
|
||||||
|
|
||||||
$input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : '';
|
$input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : '';
|
||||||
$defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : '';
|
$defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : '';
|
||||||
$pickers = '';
|
$pickers = '';
|
||||||
if(!$pickdate) $pickers .= ',datepicker: false';
|
if(!$pickdate) $pickers .= ',datepicker: false';
|
||||||
if(!$picktime) $pickers .= ',timepicker: false';
|
if(!$picktime) $pickers .= ',timepicker: false';
|
||||||
$extra_js = '';
|
$extra_js = '';
|
||||||
if($minfrom != '')
|
$pickers .= ",dayOfWeekStart: ".$firstDay.",lang:'".$lang."'";
|
||||||
|
if($minfrom != '')
|
||||||
$extra_js .= "\$('#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})";
|
$extra_js .= "\$('#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})";
|
||||||
if($maxfrom != '')
|
if($maxfrom != '')
|
||||||
$extra_js .= "\$('#$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})";
|
$extra_js .= "\$('#$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})";
|
||||||
$readable_format = $dateformat;
|
$readable_format = $dateformat;
|
||||||
$readable_format = str_replace('Y','yyyy',$readable_format);
|
$readable_format = str_replace('Y','yyyy',$readable_format);
|
||||||
|
@ -236,7 +249,9 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
|
||||||
$readable_format = str_replace('i','MM',$readable_format);
|
$readable_format = str_replace('i','MM',$readable_format);
|
||||||
$o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />";
|
$o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />";
|
||||||
$o .= '</div>';
|
$o .= '</div>';
|
||||||
$o .= "<script type='text/javascript'>\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs}); $extra_js})</script>";
|
$o .= "<script type='text/javascript'>";
|
||||||
|
$o .= "\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs}); $extra_js})";
|
||||||
|
$o .= "</script>";
|
||||||
return $o;
|
return $o;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -248,27 +263,27 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
|
||||||
if(! function_exists('relative_date')) {
|
if(! function_exists('relative_date')) {
|
||||||
function relative_date($posted_date,$format = null) {
|
function relative_date($posted_date,$format = null) {
|
||||||
|
|
||||||
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
|
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
|
||||||
|
|
||||||
$abs = strtotime($localtime);
|
$abs = strtotime($localtime);
|
||||||
|
|
||||||
if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
|
if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
|
||||||
return t('never');
|
return t('never');
|
||||||
}
|
}
|
||||||
|
|
||||||
$etime = time() - $abs;
|
$etime = time() - $abs;
|
||||||
|
|
||||||
if ($etime < 1) {
|
if ($etime < 1) {
|
||||||
return t('less than a second ago');
|
return t('less than a second ago');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$time_append = '';
|
$time_append = '';
|
||||||
if ($etime >= 86400) {
|
if ($etime >= 86400) {
|
||||||
$time_append = ' ('.$localtime.')';
|
$time_append = ' ('.$localtime.')';
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$a = array( 12 * 30 * 24 * 60 * 60 => array( t('year'), t('years')),
|
$a = array( 12 * 30 * 24 * 60 * 60 => array( t('year'), t('years')),
|
||||||
30 * 24 * 60 * 60 => array( t('month'), t('months')),
|
30 * 24 * 60 * 60 => array( t('month'), t('months')),
|
||||||
7 * 24 * 60 * 60 => array( t('week'), t('weeks')),
|
7 * 24 * 60 * 60 => array( t('week'), t('weeks')),
|
||||||
|
@ -277,7 +292,7 @@ function relative_date($posted_date,$format = null) {
|
||||||
60 => array( t('minute'), t('minutes')),
|
60 => array( t('minute'), t('minutes')),
|
||||||
1 => array( t('second'), t('seconds'))
|
1 => array( t('second'), t('seconds'))
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($a as $secs => $str) {
|
foreach ($a as $secs => $str) {
|
||||||
$d = $etime / $secs;
|
$d = $etime / $secs;
|
||||||
if ($d >= 1) {
|
if ($d >= 1) {
|
||||||
|
@ -295,13 +310,13 @@ function relative_date($posted_date,$format = null) {
|
||||||
// Returns age in years, given a date of birth,
|
// Returns age in years, given a date of birth,
|
||||||
// the timezone of the person whose date of birth is provided,
|
// the timezone of the person whose date of birth is provided,
|
||||||
// and the timezone of the person viewing the result.
|
// and the timezone of the person viewing the result.
|
||||||
// Why? Bear with me. Let's say I live in Mittagong, Australia, and my
|
// Why? Bear with me. Let's say I live in Mittagong, Australia, and my
|
||||||
// birthday is on New Year's. You live in San Bruno, California.
|
// birthday is on New Year's. You live in San Bruno, California.
|
||||||
// When exactly are you going to see my age increase?
|
// When exactly are you going to see my age increase?
|
||||||
// A: 5:00 AM Dec 31 San Bruno time. That's precisely when I start
|
// A: 5:00 AM Dec 31 San Bruno time. That's precisely when I start
|
||||||
// celebrating and become a year older. If you wish me happy birthday
|
// celebrating and become a year older. If you wish me happy birthday
|
||||||
// on January 1 (San Bruno time), you'll be a day late.
|
// on January 1 (San Bruno time), you'll be a day late.
|
||||||
|
|
||||||
function age($dob,$owner_tz = '',$viewer_tz = '') {
|
function age($dob,$owner_tz = '',$viewer_tz = '') {
|
||||||
if(! intval($dob))
|
if(! intval($dob))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -357,7 +372,7 @@ function get_first_dim($y,$m) {
|
||||||
|
|
||||||
// output a calendar for the given month, year.
|
// output a calendar for the given month, year.
|
||||||
// if $links are provided (array), e.g. $links[12] => 'http://mylink' ,
|
// if $links are provided (array), e.g. $links[12] => 'http://mylink' ,
|
||||||
// date 12 will be linked appropriately. Today's date is also noted by
|
// date 12 will be linked appropriately. Today's date is also noted by
|
||||||
// altering td class.
|
// altering td class.
|
||||||
// Months count from 1.
|
// Months count from 1.
|
||||||
|
|
||||||
|
@ -376,7 +391,7 @@ function cal($y = 0,$m = 0, $links = false, $class='') {
|
||||||
'April','May','June',
|
'April','May','June',
|
||||||
'July','August','September',
|
'July','August','September',
|
||||||
'October','November','December'
|
'October','November','December'
|
||||||
);
|
);
|
||||||
|
|
||||||
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
||||||
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
||||||
|
@ -427,8 +442,8 @@ function cal($y = 0,$m = 0, $links = false, $class='') {
|
||||||
if($dow)
|
if($dow)
|
||||||
for($a = $dow; $a < 7; $a ++)
|
for($a = $dow; $a < 7; $a ++)
|
||||||
$o .= '<td> </td>';
|
$o .= '<td> </td>';
|
||||||
$o .= '</tr></table>'."\r\n";
|
$o .= '</tr></table>'."\r\n";
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -452,10 +467,10 @@ function update_contact_birthdays() {
|
||||||
*
|
*
|
||||||
* $bdtext is just a readable placeholder in case the event is shared
|
* $bdtext is just a readable placeholder in case the event is shared
|
||||||
* with others. We will replace it during presentation to our $importer
|
* with others. We will replace it during presentation to our $importer
|
||||||
* to contain a sparkle link and perhaps a photo.
|
* to contain a sparkle link and perhaps a photo.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$bdtext = sprintf( t('%s\'s birthday'), $rr['name']);
|
$bdtext = sprintf( t('%s\'s birthday'), $rr['name']);
|
||||||
$bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]') ;
|
$bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]') ;
|
||||||
|
|
||||||
|
|
|
@ -2421,7 +2421,8 @@ function diaspora_profile($importer,$xml,$msg) {
|
||||||
|
|
||||||
$birthday = str_replace('1000','1901',$birthday);
|
$birthday = str_replace('1000','1901',$birthday);
|
||||||
|
|
||||||
$birthday = datetime_convert('UTC','UTC',$birthday,'Y-m-d');
|
if ($birthday != "")
|
||||||
|
$birthday = datetime_convert('UTC','UTC',$birthday,'Y-m-d');
|
||||||
|
|
||||||
// this is to prevent multiple birthday notifications in a single year
|
// this is to prevent multiple birthday notifications in a single year
|
||||||
// if we already have a stored birthday and the 'm-d' part hasn't changed, preserve the entry, which will preserve the notify year
|
// if we already have a stored birthday and the 'm-d' part hasn't changed, preserve the entry, which will preserve the notify year
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
require_once('include/map.php');
|
require_once('include/map.php');
|
||||||
|
|
||||||
function format_event_html($ev) {
|
function format_event_html($ev, $simple = false) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,32 @@ function format_event_html($ev) {
|
||||||
|
|
||||||
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
|
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
|
||||||
|
|
||||||
|
$event_start = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
|
||||||
|
$ev['start'] , $bd_format ))
|
||||||
|
: day_translate(datetime_convert('UTC', 'UTC',
|
||||||
|
$ev['start'] , $bd_format)));
|
||||||
|
|
||||||
|
$event_end = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
|
||||||
|
$ev['finish'] , $bd_format ))
|
||||||
|
: day_translate(datetime_convert('UTC', 'UTC',
|
||||||
|
$ev['finish'] , $bd_format )));
|
||||||
|
|
||||||
|
if ($simple) {
|
||||||
|
$o = "<h3>".bbcode($ev['summary'])."</h3>";
|
||||||
|
|
||||||
|
$o .= "<p>".bbcode($ev['desc'])."</p>";
|
||||||
|
|
||||||
|
$o .= "<h4>".t('Starts:')."</h4><p>".$event_start."</p>";
|
||||||
|
|
||||||
|
if(! $ev['nofinish'])
|
||||||
|
$o .= "<h4>".t('Finishes:')."</h4><p>".$event_end."</p>";
|
||||||
|
|
||||||
|
if(strlen($ev['location']))
|
||||||
|
$o .= "<h4>".t('Location:')."</h4><p>".$ev['location']."</p>";
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
$o = '<div class="vevent">' . "\r\n";
|
$o = '<div class="vevent">' . "\r\n";
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,33 +47,25 @@ function format_event_html($ev) {
|
||||||
|
|
||||||
$o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
|
$o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
|
||||||
. datetime_convert('UTC','UTC',$ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
. datetime_convert('UTC','UTC',$ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||||
. '" >'
|
. '" >'.$event_start
|
||||||
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
|
|
||||||
$ev['start'] , $bd_format ))
|
|
||||||
: day_translate(datetime_convert('UTC', 'UTC',
|
|
||||||
$ev['start'] , $bd_format)))
|
|
||||||
. '</abbr></p>' . "\r\n";
|
. '</abbr></p>' . "\r\n";
|
||||||
|
|
||||||
if(! $ev['nofinish'])
|
if(! $ev['nofinish'])
|
||||||
$o .= '<p class="event-end" >' . t('Finishes:') . ' <abbr class="dtend" title="'
|
$o .= '<p class="event-end" >' . t('Finishes:') . ' <abbr class="dtend" title="'
|
||||||
. datetime_convert('UTC','UTC',$ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
. datetime_convert('UTC','UTC',$ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||||
. '" >'
|
. '" >'.$event_end
|
||||||
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
|
|
||||||
$ev['finish'] , $bd_format ))
|
|
||||||
: day_translate(datetime_convert('UTC', 'UTC',
|
|
||||||
$ev['finish'] , $bd_format )))
|
|
||||||
. '</abbr></p>' . "\r\n";
|
. '</abbr></p>' . "\r\n";
|
||||||
|
|
||||||
if(strlen($ev['location'])){
|
if(strlen($ev['location'])){
|
||||||
$o .= '<p class="event-location"> ' . t('Location:') . ' <span class="location">'
|
$o .= '<p class="event-location"> ' . t('Location:') . ' <span class="location">'
|
||||||
. bbcode($ev['location'])
|
. bbcode($ev['location'])
|
||||||
. '</span></p>' . "\r\n";
|
. '</span></p>' . "\r\n";
|
||||||
|
|
||||||
if (strpos($ev['location'], "[map")===False) {
|
if (strpos($ev['location'], "[map")===False) {
|
||||||
$map = generate_named_map($ev['location']);
|
$map = generate_named_map($ev['location']);
|
||||||
if ($map!==$ev['location']) $o.=$map;
|
if ($map!==$ev['location']) $o.=$map;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= '</div>' . "\r\n";
|
$o .= '</div>' . "\r\n";
|
||||||
|
@ -137,7 +155,7 @@ function format_event_bbcode($ev) {
|
||||||
|
|
||||||
if(($ev['finish']) && (! $ev['nofinish']))
|
if(($ev['finish']) && (! $ev['nofinish']))
|
||||||
$o .= '[event-finish]' . $ev['finish'] . '[/event-finish]';
|
$o .= '[event-finish]' . $ev['finish'] . '[/event-finish]';
|
||||||
|
|
||||||
if($ev['location'])
|
if($ev['location'])
|
||||||
$o .= '[event-location]' . $ev['location'] . '[/event-location]';
|
$o .= '[event-location]' . $ev['location'] . '[/event-location]';
|
||||||
|
|
||||||
|
@ -200,11 +218,17 @@ function ev_compare($a,$b) {
|
||||||
|
|
||||||
if($date_a === $date_b)
|
if($date_a === $date_b)
|
||||||
return strcasecmp($a['desc'],$b['desc']);
|
return strcasecmp($a['desc'],$b['desc']);
|
||||||
|
|
||||||
return strcmp($date_a,$date_b);
|
return strcmp($date_a,$date_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function event_delete($event_id) {
|
||||||
|
if ($event_id == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
q("DELETE FROM `event` WHERE `id` = %d", intval($event_id));
|
||||||
|
logger("Deleted event ".$event_id, LOGGER_DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
function event_store($arr) {
|
function event_store($arr) {
|
||||||
|
|
||||||
|
@ -324,7 +348,7 @@ function event_store($arr) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// New event. Store it.
|
// New event. Store it.
|
||||||
|
|
||||||
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
||||||
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
||||||
|
@ -362,6 +386,7 @@ function event_store($arr) {
|
||||||
$item_arr['contact-id'] = $arr['cid'];
|
$item_arr['contact-id'] = $arr['cid'];
|
||||||
$item_arr['uri'] = $arr['uri'];
|
$item_arr['uri'] = $arr['uri'];
|
||||||
$item_arr['parent-uri'] = $arr['uri'];
|
$item_arr['parent-uri'] = $arr['uri'];
|
||||||
|
$item_arr['guid'] = $arr['guid'];
|
||||||
$item_arr['type'] = 'activity';
|
$item_arr['type'] = 'activity';
|
||||||
$item_arr['wall'] = (($arr['cid']) ? 0 : 1);
|
$item_arr['wall'] = (($arr['cid']) ? 0 : 1);
|
||||||
$item_arr['contact-id'] = $contact['id'];
|
$item_arr['contact-id'] = $contact['id'];
|
||||||
|
|
|
@ -2558,6 +2558,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
if(! $item['deleted'])
|
if(! $item['deleted'])
|
||||||
logger('consume_feed: deleting item ' . $item['id'] . ' uri=' . $item['uri'], LOGGER_DEBUG);
|
logger('consume_feed: deleting item ' . $item['id'] . ' uri=' . $item['uri'], LOGGER_DEBUG);
|
||||||
|
|
||||||
|
if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
|
||||||
|
logger("Deleting event ".$item['event-id'], LOGGER_DEBUG);
|
||||||
|
event_delete($item['event-id']);
|
||||||
|
}
|
||||||
|
|
||||||
if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
|
if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
|
||||||
$xo = parse_xml_string($item['object'],false);
|
$xo = parse_xml_string($item['object'],false);
|
||||||
$xt = parse_xml_string($item['target'],false);
|
$xt = parse_xml_string($item['target'],false);
|
||||||
|
@ -2849,11 +2854,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
|
|
||||||
if((x($datarray,'object-type')) && ($datarray['object-type'] === ACTIVITY_OBJ_EVENT)) {
|
if((x($datarray,'object-type')) && ($datarray['object-type'] === ACTIVITY_OBJ_EVENT)) {
|
||||||
$ev = bbtoevent($datarray['body']);
|
$ev = bbtoevent($datarray['body']);
|
||||||
if(x($ev,'desc') && x($ev,'start')) {
|
if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
|
||||||
$ev['uid'] = $importer['uid'];
|
$ev['uid'] = $importer['uid'];
|
||||||
$ev['uri'] = $item_id;
|
$ev['uri'] = $item_id;
|
||||||
$ev['edited'] = $datarray['edited'];
|
$ev['edited'] = $datarray['edited'];
|
||||||
$ev['private'] = $datarray['private'];
|
$ev['private'] = $datarray['private'];
|
||||||
|
$ev['guid'] = $datarray['guid'];
|
||||||
|
|
||||||
if(is_array($contact))
|
if(is_array($contact))
|
||||||
$ev['cid'] = $contact['id'];
|
$ev['cid'] = $contact['id'];
|
||||||
|
@ -3543,6 +3549,11 @@ function local_delivery($importer,$data) {
|
||||||
|
|
||||||
logger('local_delivery: deleting item ' . $item['id'] . ' uri=' . $item['uri'], LOGGER_DEBUG);
|
logger('local_delivery: deleting item ' . $item['id'] . ' uri=' . $item['uri'], LOGGER_DEBUG);
|
||||||
|
|
||||||
|
if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
|
||||||
|
logger("Deleting event ".$item['event-id'], LOGGER_DEBUG);
|
||||||
|
event_delete($item['event-id']);
|
||||||
|
}
|
||||||
|
|
||||||
if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
|
if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
|
||||||
$xo = parse_xml_string($item['object'],false);
|
$xo = parse_xml_string($item['object'],false);
|
||||||
$xt = parse_xml_string($item['target'],false);
|
$xt = parse_xml_string($item['target'],false);
|
||||||
|
@ -4073,12 +4084,13 @@ function local_delivery($importer,$data) {
|
||||||
|
|
||||||
if((x($datarray,'object-type')) && ($datarray['object-type'] === ACTIVITY_OBJ_EVENT)) {
|
if((x($datarray,'object-type')) && ($datarray['object-type'] === ACTIVITY_OBJ_EVENT)) {
|
||||||
$ev = bbtoevent($datarray['body']);
|
$ev = bbtoevent($datarray['body']);
|
||||||
if(x($ev,'desc') && x($ev,'start')) {
|
if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
|
||||||
$ev['cid'] = $importer['id'];
|
$ev['cid'] = $importer['id'];
|
||||||
$ev['uid'] = $importer['uid'];
|
$ev['uid'] = $importer['uid'];
|
||||||
$ev['uri'] = $item_id;
|
$ev['uri'] = $item_id;
|
||||||
$ev['edited'] = $datarray['edited'];
|
$ev['edited'] = $datarray['edited'];
|
||||||
$ev['private'] = $datarray['private'];
|
$ev['private'] = $datarray['private'];
|
||||||
|
$ev['guid'] = $datarray['guid'];
|
||||||
|
|
||||||
$r = q("SELECT * FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($item_id),
|
dbesc($item_id),
|
||||||
|
|
|
@ -154,6 +154,7 @@ function events_post(&$a) {
|
||||||
if(! $cid)
|
if(! $cid)
|
||||||
proc_run('php',"include/notifier.php","event","$item_id");
|
proc_run('php',"include/notifier.php","event","$item_id");
|
||||||
|
|
||||||
|
goaway($_SESSION['return_url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,6 +166,9 @@ function events_content(&$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($a->argc == 1)
|
||||||
|
$_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
|
||||||
|
|
||||||
if(($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) {
|
if(($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) {
|
||||||
$r = q("update event set ignore = 1 where id = %d and uid = %d",
|
$r = q("update event set ignore = 1 where id = %d and uid = %d",
|
||||||
intval($a->argv[2]),
|
intval($a->argv[2]),
|
||||||
|
@ -505,7 +509,7 @@ function events_content(&$a) {
|
||||||
else
|
else
|
||||||
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
|
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
|
||||||
|
|
||||||
if($cid)
|
if($cid OR ($mode !== 'new'))
|
||||||
$sh_checked .= ' disabled="disabled" ';
|
$sh_checked .= ' disabled="disabled" ';
|
||||||
|
|
||||||
|
|
||||||
|
@ -536,6 +540,9 @@ function events_content(&$a) {
|
||||||
|
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
|
if ($mode === 'new')
|
||||||
|
$acl = (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user)));
|
||||||
|
|
||||||
$tpl = get_markup_template('event_form.tpl');
|
$tpl = get_markup_template('event_form.tpl');
|
||||||
|
|
||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
|
@ -563,7 +570,7 @@ function events_content(&$a) {
|
||||||
'$sh_text' => t('Share this event'),
|
'$sh_text' => t('Share this event'),
|
||||||
'$sh_checked' => $sh_checked,
|
'$sh_checked' => $sh_checked,
|
||||||
'$preview' => t('Preview'),
|
'$preview' => t('Preview'),
|
||||||
'$acl' => (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user))),
|
'$acl' => $acl,
|
||||||
'$submit' => t('Submit')
|
'$submit' => t('Submit')
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
|
@ -117,9 +117,12 @@ class Item extends BaseObject {
|
||||||
? t('Private Message')
|
? t('Private Message')
|
||||||
: false);
|
: false);
|
||||||
$shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false);
|
$shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false);
|
||||||
if(local_user() && link_compare($a->contact['url'],$item['author-link']))
|
if(local_user() && link_compare($a->contact['url'],$item['author-link'])) {
|
||||||
$edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
|
if ($item["event-id"] != 0)
|
||||||
else
|
$edpost = array($a->get_baseurl($ssl_state)."/events/event/".$item['event-id'], t("Edit"));
|
||||||
|
else
|
||||||
|
$edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
|
||||||
|
} else
|
||||||
$edpost = false;
|
$edpost = false;
|
||||||
if(($this->get_data_value('uid') == local_user()) || $this->is_visiting())
|
if(($this->get_data_value('uid') == local_user()) || $this->is_visiting())
|
||||||
$dropping = true;
|
$dropping = true;
|
||||||
|
|
Loading…
Reference in a new issue