From 8dc10a8d7ede46f4f6a18ca09d3c867a1d62bcfe Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Wed, 29 Feb 2012 09:31:24 +0900 Subject: [PATCH] =?utf8?q?CHANGE:=20=E3=83=95=E3=82=A3=E3=83=BC=E3=83=89?= =?utf8?q?=E3=81=A8=E3=82=B2=E3=82=B9=E3=83=88=E3=82=A2=E3=82=AB=E3=82=A6?= =?utf8?q?=E3=83=B3=E3=83=88=E4=BD=9C=E6=88=90=E3=83=95=E3=82=A9=E3=83=BC?= =?utf8?q?=E3=83=A0=E3=81=AE=E3=81=9F=E3=82=81=E3=81=AE=E3=82=B9=E3=82=AF?= =?utf8?q?=E3=83=AA=E3=83=97=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit atom.php/rsd.php/xml-rss2.phpの各スクリプトのコードをフォーマットした。 ACTION::createAccount()の返り値を修正し。 返り値を評価して処理を分岐するようcreateaccount.phpを修正。加えて、より単純なスクリプトに修正した。 --- action.php | 8 +- atom.php | 26 +++---- benchmark.inc | 1 - createaccount.php | 195 +++++++++++++++++++----------------------------- index.php | 2 - nucleus/libs/ACTION.php | 12 +-- rsd.php | 2 - xml-rss2.php | 58 +++++++------- 8 files changed, 118 insertions(+), 186 deletions(-) diff --git a/action.php b/action.php index 42f6d1c..6363426 100644 --- a/action.php +++ b/action.php @@ -20,17 +20,13 @@ $CONF = array(); require('./config.php'); - -// common functions -//include_once($DIR_LIBS . 'ACTION.php'); include_libs('ACTION.php',true,false); $action = requestVar('action'); $a = new ACTION(); $errorInfo = $a->doAction($action); -if ($errorInfo) { +if ( $errorInfo ) +{ doError($errorInfo['message'], new SKIN($errorInfo['skinid']) ); } - -?> \ No newline at end of file diff --git a/atom.php b/atom.php index 0c8c5a9..9a3f95a 100644 --- a/atom.php +++ b/atom.php @@ -20,32 +20,30 @@ header('Pragma: no-cache'); $CONF = array(); -$CONF['Self'] = 'atom.php'; - include('./config.php'); -if (!$CONF['DisableSite']) { +if ( !$CONF['DisableSite'] ) +{ // get feed into $feed ob_start(); - selectSkin('feeds/atom'); - selector(); - $feed = ob_get_contents(); + selectSkin('feeds/atom'); + selector(); + $feed = ob_get_contents(); ob_end_clean(); - + // create ETAG (hash of feed) // (HTTP_IF_NONE_MATCH has quotes around it) $eTag = '"' . md5($feed) . '"'; header('Etag: ' . $eTag); - + // compare Etag to what we got - if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) { + if ( $eTag == serverVar('HTTP_IF_NONE_MATCH') ) + { header('HTTP/1.0 304 Not Modified'); header('Content-Length: 0'); - } else { - // dump feed + } + else + { echo $feed; } - } - -?> \ No newline at end of file diff --git a/benchmark.inc b/benchmark.inc index 99fe504..ec4b7d8 100644 --- a/benchmark.inc +++ b/benchmark.inc @@ -12,4 +12,3 @@ if (!function_exists('getmtime')) // For benchmarking global $StartTime; $StartTime = getmtime(); -?> diff --git a/createaccount.php b/createaccount.php index f46ea12..32a378a 100644 --- a/createaccount.php +++ b/createaccount.php @@ -17,136 +17,93 @@ * @version $Id: createaccount.php 1624 2012-01-09 11:36:20Z sakamocchi $ */ - require_once "./config.php"; - //include $DIR_LIBS."ACTION.php"; - include_libs('ACTION.php',false,false); - - if (isset ($_POST['showform']) && $_POST['showform']==1) { - $showform = 1; - } - else { - $showform = 0; - } - sendContentType('text/html', 'createaccount'); -?> - - - - Create Member Account - - - +require_once "./config.php"; +include_libs('ACTION.php',false,false); -

Create Account

- - +sendContentType('text/html', 'createaccount'); +echo "\n"; +echo "\n"; +echo "\n"; +echo "Create Member Account\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

Create Account

\n"; -
- -
- - +// show form only if Visitors are allowed to create a Member Account +if ( $CONF['AllowMemberCreate'] == 1 ) +{ + $name = ''; + $realname =''; + $email = ''; + $url = ''; - Login Name (required): -
- (only a-z, 0-9) -
-
- Real Name (required): -
- -
-
- Email (required): -
- (must be valid, because an activation link will be sent over there) -
-
- URL: -
- -
- notify('RegistrationFormExtraFields', array('type' => 'createaccount.php', 'prelabel' => '', 'postlabel' => '
', 'prefield' => '', 'postfield' => '

')); - // add a Captcha challenge or something else - global $manager; - $manager->notify('FormExtra', array('type' => 'membermailform-notloggedin')); - ?> -
-
- -
- -
-createAccount(); - - echo ''.$message.'

'; -?> + if ( $message != 1 ) + { + echo '

' . $message . "

\n"; + } + else + { + echo '

' . _MSG_ACTIVATION_SENT . "

\n"; + echo "

Return to {$CONF['SiteName']}

\n"; + echo "\n"; + echo "\n"; + exit; + } + } -
- -
- - + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "
(only a-z, 0-9)
\n"; + echo "
\n"; + echo "
\n"; + echo "
\n"; + echo "
(must be valid, because an activation link will be sent over there)
\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + // add extra fields from Plugins, like NP_Profile + $manager->notify('RegistrationFormExtraFields', array('type' => 'createaccount.php', 'prelabel' => '', 'postlabel' => '
', 'prefield' => '', 'postfield' => '

')); - Login Name (required): -
- /> (only a-z, 0-9) -
-
- Real Name (required): -
- /> -
-
- Email (required): -
- /> (must be valid, because an activation link will be sent over there) -
-
- URL: -
- /> -
- notify('RegistrationFormExtraFields', array('type' => 'createaccount.php', 'prelabel' => '', 'postlabel' => '
', 'prefield' => '', 'postfield' => '

')); - // add a Captcha challenge or something else - global $manager; - $manager->notify('FormExtra', array('type' => 'membermailform-notloggedin')); - ?> -
-
- -
- -
-notify('FormExtra', array('type' => 'membermailform-notloggedin')); + echo "\n"; + echo "\n"; + echo "\n"; } -else { +else +{ + echo "

\n"; echo 'Visitors are not allowed to create a Member Account.

'; echo 'Please contact the website administrator for more information.'; + echo "

\n"; } -?> - - - \ No newline at end of file +echo "\n"; +echo "\n"; diff --git a/index.php b/index.php index c3bf487..31c1abd 100644 --- a/index.php +++ b/index.php @@ -9,5 +9,3 @@ $CONF['Self'] = 'index.php'; include('./config.php'); selector(); - -?> diff --git a/nucleus/libs/ACTION.php b/nucleus/libs/ACTION.php index c402041..44f4809 100644 --- a/nucleus/libs/ACTION.php +++ b/nucleus/libs/ACTION.php @@ -286,17 +286,9 @@ class ACTION { redirect(postVar('desturl') ); } - else - { - echo _MSG_ACTIVATION_SENT; - echo '

Return to '.$CONF['SiteName'].''; - echo "\n\n"; - } - - exit; + return 1; } - - + /** * Sends a new password */ diff --git a/rsd.php b/rsd.php index d9134bf..74c6af2 100644 --- a/rsd.php +++ b/rsd.php @@ -4,5 +4,3 @@ $CONF = array(); include('./config.php'); selectSkin('xml/rsd'); selector(); - -?> \ No newline at end of file diff --git a/xml-rss2.php b/xml-rss2.php index 26486c0..9ee70e7 100644 --- a/xml-rss2.php +++ b/xml-rss2.php @@ -21,51 +21,45 @@ header('Pragma: no-cache'); $CONF = array(); -// removed $CONF['Self'] to let it be set in globalfunctions.php. -// Having value here makes all links (normal or fancy urlmodes) look like xml-rss2.php?itemid=# -//$CONF['Self'] = 'xml-rss2.php'; - include('./config.php'); -if (!$CONF['DisableSite']) { - +if ( !$CONF['DisableSite'] ) +{ // get feed into $feed ob_start(); selectSkin('feeds/rss20'); selector(); $feed = ob_get_contents(); ob_end_clean(); - - // create ETAG (hash of feed) - // (HTTP_IF_NONE_MATCH has quotes around it) + + /* + * create ETAG (hash of feed) + * (HTTP_IF_NONE_MATCH has quotes around it) + */ $eTag = '"' . md5($feed) . '"'; header('Etag: ' . $eTag); - + // compare Etag to what we got - if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) { + if ( $eTag == serverVar('HTTP_IF_NONE_MATCH') ) + { header('HTTP/1.0 304 Not Modified'); header('Content-Length: 0'); - } else { - // dump feed + } + else + { echo $feed; } - -} else { - // output empty RSS file... - // (because site is disabled) - - echo '<' . '?xml version="1.0" encoding="' . i18n::get_current_charset() . '"?' . '>'; - - ?> - - - <?php echo ENTITY::hsc($CONF['SiteName']); ?> - - - http://backend.userland.com/rss - - - \ No newline at end of file +// site is disabled, output empty RSS file +else +{ + echo '' . "\n"; + echo "\n"; + echo "\n"; + echo '' . ENTITY::hsc($CONF['SiteName']) . "\n"; + echo "" . ENTITY::hsc($CONF['IndexURL']) . "\n"; + echo "\n"; + echo "http://backend.userland.com/rss\n"; + echo "\n"; + echo "\n"; +} -- 2.11.0