From 365ff94137166f63211b9632c204a05a5cee7035 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 23 Feb 2011 01:37:15 -0800 Subject: [PATCH 1/2] push directory on register - if permitted --- include/datetime.php | 2 +- mod/register.php | 8 ++++++++ mod/regmod.php | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/datetime.php b/include/datetime.php index 724eec933..f7be5bdb1 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -275,7 +275,7 @@ function cal($y = 0,$m = 0, $links = false) { $o = ''; $o .= ""; for($a = 0; $a < 7; $a ++) - $o .= ''; + $o .= ''; $o .= ''; while($d <= $l) { diff --git a/mod/register.php b/mod/register.php index 5c41fbfad..d97b3e0cd 100644 --- a/mod/register.php +++ b/mod/register.php @@ -346,6 +346,14 @@ function register_post(&$a) { goaway($a->get_baseurl()); } + } + + if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) { + $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); + $url = $a->get_baseurl() . "/profile/$nickname"; + if($url && strlen(get_config('system','directory_submit_url'))) + proc_run($php_path,"include/directory.php","$url"); + } return; }} diff --git a/mod/regmod.php b/mod/regmod.php index eabbec090..f662902d8 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -70,6 +70,16 @@ function regmod_content(&$a) { intval($register[0]['uid']) ); + $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1", + intval($user[0]['uid']) + ); + if(count($r) && $r[0]['net-publish']) { + $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); + $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname']; + if($url && strlen(get_config('system','directory_submit_url'))) + proc_run($php_path,"include/directory.php","$url"); + } + $email_tpl = load_view_file("view/register_open_eml.tpl"); $email_tpl = replace_macros($email_tpl, array( '$sitename' => $a->config['sitename'], From b6ba303f4b7649454bbee9a4f798f74b1f49c871 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 23 Feb 2011 03:03:33 -0800 Subject: [PATCH 2/2] minor proc_run issues encountered during mass directory update. Unclear if it affects "normal" operation but suspect it does. --- boot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index d4398a11a..530baa7b9 100644 --- a/boot.php +++ b/boot.php @@ -2430,13 +2430,13 @@ function prepare_body($item) { * $cmd and string args are surrounded with "" */ -if(! function_exists('run_proc')) { +if(! function_exists('proc_run')) { function proc_run($cmd){ $args = func_get_args(); call_hooks("proc_run", $args); - foreach ($args as &$arg){ - if(is_string($arg)) $arg='"'.$arg.'"'; + foreach ($args as $arg){ + $arg = escapeshellarg($arg); } $cmdline = implode($args," "); proc_close(proc_open($cmdline." &",array(),$foo));
$str_month $y
' . substr(day_translate($dn[$a]),0,3) . '' . mb_substr(day_translate($dn[$a]),0,3,'UTF-8') . '