diff options
Diffstat (limited to 'mod')
-rwxr-xr-x | mod/events.php | 43 | ||||
-rw-r--r-- | mod/feed.php | 1 | ||||
-rwxr-xr-x | mod/setup.php | 2 | ||||
-rw-r--r-- | mod/siteinfo.php | 100 | ||||
-rw-r--r-- | mod/siteinfo_json.php | 8 | ||||
-rw-r--r-- | mod/update_channel.php | 2 | ||||
-rw-r--r-- | mod/update_display.php | 4 | ||||
-rw-r--r-- | mod/update_home.php | 4 | ||||
-rw-r--r-- | mod/update_network.php | 4 | ||||
-rw-r--r-- | mod/update_public.php | 4 | ||||
-rw-r--r-- | mod/update_search.php | 4 |
11 files changed, 45 insertions, 131 deletions
diff --git a/mod/events.php b/mod/events.php index d55d22f44..74b44906c 100755 --- a/mod/events.php +++ b/mod/events.php @@ -90,8 +90,12 @@ function events_post(&$a) { linkify_tags($a, $desc, local_channel()); linkify_tags($a, $location, local_channel()); - $action = ($event_hash == '') ? 'new' : "event/" . $event_hash; - $onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type"; + //$action = ($event_hash == '') ? 'new' : "event/" . $event_hash; + + //fixme: this url gives a wsod if there is a linebreak detected in one of the variables ($desc or $location) + //$onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type"; + $onerror_url = $a->get_baseurl() . "/events"; + if(strcmp($finish,$start) < 0 && !$nofinish) { notice( t('Event can not end before it has started.') . EOL); if(intval($_REQUEST['preview'])) { @@ -366,37 +370,30 @@ function events_content(&$a) { $sdt = ((x($orig_event)) ? $orig_event['start'] : 'now'); - $fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now'); + $fdt = ((x($orig_event)) ? $orig_event['finish'] : '+1 hour'); $tz = date_default_timezone_get(); if(x($orig_event)) $tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC'); -// $syear = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'Y') : '0000'); -// $smonth = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'm') : '00'); -// $sday = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'd') : '00'); - $syear = datetime_convert('UTC', $tz, $sdt, 'Y'); $smonth = datetime_convert('UTC', $tz, $sdt, 'm'); $sday = datetime_convert('UTC', $tz, $sdt, 'd'); + $shour = datetime_convert('UTC', $tz, $sdt, 'H'); + $sminute = datetime_convert('UTC', $tz, $sdt, 'i'); - $shour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'H') : '00'); - $sminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'i') : '00'); $stext = datetime_convert('UTC',$tz,$sdt); $stext = substr($stext,0,14) . "00:00"; -// $fyear = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'Y') : '0000'); -// $fmonth = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'm') : '00'); -// $fday = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'd') : '00'); - $fyear = datetime_convert('UTC', $tz, $fdt, 'Y'); $fmonth = datetime_convert('UTC', $tz, $fdt, 'm'); $fday = datetime_convert('UTC', $tz, $fdt, 'd'); + $fhour = datetime_convert('UTC', $tz, $fdt, 'H'); + $fminute = datetime_convert('UTC', $tz, $fdt, 'i'); - $fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : '00'); - $fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : '00'); $ftext = datetime_convert('UTC',$tz,$fdt); $ftext = substr($ftext,0,14) . "00:00"; + $type = ((x($orig_event)) ? $orig_event['type'] : 'event'); $f = get_config('system','event_input_format'); @@ -437,22 +434,22 @@ function events_content(&$a) { '$xchan' => $event_xchan, '$mid' => $mid, '$event_hash' => $event_id, - '$summary' => array('summary', t('Event Title'), $t_orig, t('Required'), '*'), + '$summary' => array('summary', (($event_id) ? t('Edit event titel') : t('Event titel')), $t_orig, t('Required'), '*'), '$catsenabled' => $catsenabled, '$placeholdercategory' => t('Categories (comma-separated list)'), - '$c_text' => t('Category'), + '$c_text' => (($event_id) ? t('Edit Category') : t('Category')), '$category' => $category, '$required' => '<span class="required" title="' . t('Required') . '">*</span>', - '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"), t('Start date and time'), 'start_text',true,true,'','',true,$first_day), + '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"), (($event_id) ? t('Edit start date and time') : t('Start date and time')), 'start_text',true,true,'','',true,$first_day), '$n_text' => t('Finish date and time are not known or not relevant'), '$n_checked' => $n_checked, - '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"), t('Finish date and time'),'finish_text',true,true,'start_text','',false,$first_day), + '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"), (($event_id) ? t('Edit finish date and time') : t('Finish date and time')),'finish_text',true,true,'start_text','',false,$first_day), '$nofinish' => array('nofinish', t('Finish date and time are not known or not relevant'), $n_checked, '', array(t('No'),t('Yes')), 'onclick="enableDisableFinishDate();"'), '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'), array(t('No'),t('Yes'))), '$a_text' => t('Adjust for viewer timezone'), - '$d_text' => t('Description'), + '$d_text' => (($event_id) ? t('Edit Description') : t('Description')), '$d_orig' => $d_orig, - '$l_text' => t('Location'), + '$l_text' => (($event_id) ? t('Edit Location') : t('Location')), '$l_orig' => $l_orig, '$t_orig' => $t_orig, '$sh_text' => t('Share this event'), @@ -596,7 +593,7 @@ function events_content(&$a) { $last_date = $d; - $edit = array($a->get_baseurl().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'',''); + $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array($a->get_baseurl().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false); $drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); @@ -651,7 +648,7 @@ function events_content(&$a) { $o = replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), - '$new_event' => array($a->get_baseurl().'/events/new',t('New Event'),'',''), + '$new_event' => array($a->get_baseurl().'/events',(($event_id) ? t('Edit Event') : t('Create Event')),'',''), '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''), diff --git a/mod/feed.php b/mod/feed.php index 3b622fc17..eb72af9cf 100644 --- a/mod/feed.php +++ b/mod/feed.php @@ -15,6 +15,7 @@ function feed_init(&$a) { $params['start'] = ((x($params,'start')) ? intval($params['start']) : 0); $params['records'] = ((x($params,'records')) ? intval($params['records']) : 40); $params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc'); + $params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : ''); $channel = ''; if(argc() > 1) { diff --git a/mod/setup.php b/mod/setup.php index e5ac25965..5c9e988d9 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -14,7 +14,7 @@ $install_wizard_pass = 1; * * @param[in,out] App &$a */ -function setup_init(&$a){ +function setup_init(&$a) { // Ensure that if somebody hasn't read the install documentation and doesn't have all // the required modules or has a totally borked shared hosting provider and they can't diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 231427290..4c5782abe 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -1,104 +1,10 @@ <?php function siteinfo_init(&$a) { - global $db; - - if ($a->argv[1]=="json"){ - $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); - $directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_SECONDARY','DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_STANDALONE'); - - $sql_extra = ''; - - $r = q("select * from channel left join account on account_id = channel_account_id where ( account_roles & 4096 )>0 and account_default_channel = channel_id"); - - - if($r) { - $admin = array(); - foreach($r as $rr) { - if($rr['channel_pageflags'] & PAGE_HUBADMIN) - $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']); - } - if(! $admin) { - foreach($r as $rr) { - $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']); - } - } - } - else { - $admin = false; - } - $def_service_class = get_config('system','default_service_class'); - if($def_service_class) - $service_class = get_config('service_class',$def_service_class); - else - $service_class = false; - - $visible_plugins = array(); - if(is_array($a->plugins) && count($a->plugins)) { - $r = q("select * from addon where hidden = 0"); - if(count($r)) - foreach($r as $rr) - $visible_plugins[] = $rr['name']; - } - sort($visible_plugins); - - if(@is_dir('.git') && function_exists('shell_exec')) - $commit = trim(@shell_exec('git log -1 --format="%h"')); - if(! isset($commit) || strlen($commit) > 16) - $commit = ''; - - $site_info = get_config('system','info'); - $site_name = get_config('system','sitename'); - if(! get_config('system','hidden_version_siteinfo')) { - $version = RED_VERSION; - if(@is_dir('.git') && function_exists('shell_exec')) { - $commit = trim( @shell_exec('git log -1 --format="%h"')); - if(! get_config('system','hidden_tag_siteinfo')) - $tag = trim( @shell_exec('git describe --tags --abbrev=0')); - else - $tag = ''; - } - if(! isset($commit) || strlen($commit) > 16) - $commit = ''; - } - else { - $version = $commit = ''; - } - - //Statistics - $channels_total_stat = intval(get_config('system','channels_total_stat')); - $channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat')); - $channels_active_monthly_stat = intval(get_config('system','channels_active_monthly_stat')); - $local_posts_stat = intval(get_config('system','local_posts_stat')); - $hide_in_statistics = intval(get_config('system','hide_in_statistics')); - $site_expire = intval(get_config('system', 'default_expire_days')); - - - $data = Array( - 'version' => $version, - 'version_tag' => $tag, - 'commit' => $commit, - 'url' => z_root(), - 'plugins' => $visible_plugins, - 'register_policy' => $register_policy[get_config('system','register_policy')], - 'directory_mode' => $directory_mode[get_config('system','directory_mode')], - 'language' => get_config('system','language'), - 'rss_connections' => get_config('system','feed_contacts'), - 'expiration' => $site_expire, - 'default_service_restrictions' => $service_class, - 'admin' => $admin, - 'site_name' => (($site_name) ? $site_name : ''), - 'platform' => PLATFORM_NAME, - 'dbdriver' => $db->getdriver(), - 'lastpoll' => get_config('system','lastpoll'), - 'info' => (($site_info) ? $site_info : ''), - 'channels_total' => $channels_total_stat, - 'channels_active_halfyear' => $channels_active_halfyear_stat, - 'channels_active_monthly' => $channels_active_monthly_stat, - 'local_posts' => $local_posts_stat, - 'hide_in_statistics' => $hide_in_statistics - ); + + if (argv(1) === 'json') { + $data = get_site_info(); json_return_and_die($data); } } diff --git a/mod/siteinfo_json.php b/mod/siteinfo_json.php new file mode 100644 index 000000000..35697917c --- /dev/null +++ b/mod/siteinfo_json.php @@ -0,0 +1,8 @@ +<?php + +function siteinfo_json_init(&$a) { + + $data = get_site_info(); + json_return_and_die($data); + +} diff --git a/mod/update_channel.php b/mod/update_channel.php index 5f4436d59..63a3735ea 100644 --- a/mod/update_channel.php +++ b/mod/update_channel.php @@ -39,6 +39,7 @@ function update_channel_content(&$a) { $replace = "<img\${1} dst=\"\${2}\""; // $text = preg_replace($pattern, $replace, $text); +/* if(! $load) { $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />'; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; @@ -50,6 +51,7 @@ function update_channel_content(&$a) { $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; $text = preg_replace($pattern, $replace, $text); } +*/ /** * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well diff --git a/mod/update_display.php b/mod/update_display.php index d41e2e5cb..b448c76ee 100644 --- a/mod/update_display.php +++ b/mod/update_display.php @@ -20,7 +20,7 @@ function update_display_content(&$a) { $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; // $text = preg_replace($pattern, $replace, $text); - +/* if(! $load) { $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />'; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; @@ -32,7 +32,7 @@ function update_display_content(&$a) { $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; $text = preg_replace($pattern, $replace, $text); } - +*/ echo str_replace("\t",' ',$text); echo (($_GET['msie'] == 1) ? '</div>' : '</section>'); echo "</body></html>\r\n"; diff --git a/mod/update_home.php b/mod/update_home.php index 80ae2438f..4a8000bdb 100644 --- a/mod/update_home.php +++ b/mod/update_home.php @@ -16,7 +16,7 @@ function update_home_content(&$a) { $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; // $text = preg_replace($pattern, $replace, $text); - +/* if(! $load) { $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />'; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; @@ -28,7 +28,7 @@ function update_home_content(&$a) { $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; $text = preg_replace($pattern, $replace, $text); } - +*/ echo str_replace("\t",' ',$text); echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>'); echo "</body></html>\r\n"; diff --git a/mod/update_network.php b/mod/update_network.php index acd5ccdc8..03c12312c 100644 --- a/mod/update_network.php +++ b/mod/update_network.php @@ -18,7 +18,7 @@ function update_network_content(&$a) { $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; // $text = preg_replace($pattern, $replace, $text); - +/* if(! $load) { $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />'; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; @@ -30,7 +30,7 @@ function update_network_content(&$a) { $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; $text = preg_replace($pattern, $replace, $text); } - +*/ echo str_replace("\t",' ',$text); echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>'); echo "</body></html>\r\n"; diff --git a/mod/update_public.php b/mod/update_public.php index bac1ccf15..fcec792f6 100644 --- a/mod/update_public.php +++ b/mod/update_public.php @@ -16,7 +16,7 @@ function update_public_content(&$a) { $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; // $text = preg_replace($pattern, $replace, $text); - +/* if(! $load) { $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />'; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; @@ -28,7 +28,7 @@ function update_public_content(&$a) { $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; $text = preg_replace($pattern, $replace, $text); } - +*/ echo str_replace("\t",' ',$text); echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>'); echo "</body></html>\r\n"; diff --git a/mod/update_search.php b/mod/update_search.php index de29e89bd..25bcffcb6 100644 --- a/mod/update_search.php +++ b/mod/update_search.php @@ -41,7 +41,7 @@ function update_search_content(&$a) { $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; // $text = preg_replace($pattern, $replace, $text); - +/* if(! $load) { $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />'; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; @@ -53,7 +53,7 @@ function update_search_content(&$a) { $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; $text = preg_replace($pattern, $replace, $text); } - +*/ /** * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well */ |