From 3b14b7901c65144835d74b712279d0492c267c0c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 May 2008 11:47:01 -0400 Subject: [PATCH] fixes to make it all lint Ran everything through php -l, found out that it didn't compile. So: fixed the am-I-running-in-Laconica check at the top of each file. Some syntax fixes in shownotice, showstream, common. darcs-hash:20080517154701-84dde-8d38da89c5b9cb3b40704adb04a4de880c204181.gz --- actions/all.php | 2 +- actions/avatar.php | 2 +- actions/login.php | 2 +- actions/logout.php | 2 +- actions/newnotice.php | 2 +- actions/password.php | 2 +- actions/profilesettings.php | 2 +- actions/public.php | 2 +- actions/register.php | 2 +- actions/shownotice.php | 6 +++--- actions/showstream.php | 4 ++-- actions/subscribe.php | 2 +- actions/subscribed.php | 2 +- actions/subscriptions.php | 2 +- classes/Notice.php | 2 +- classes/Profile.php | 2 +- classes/Remote_profile.php | 2 +- classes/Subscription.php | 2 +- classes/User.php | 2 +- index.php | 4 +--- lib/action.php | 2 +- lib/common.php | 19 +++++++++++-------- lib/settingsaction.php | 2 +- lib/stream.php | 2 +- 24 files changed, 37 insertions(+), 36 deletions(-) diff --git a/actions/all.php b/actions/all.php index 8efaa5a82a..f1a2229f03 100644 --- a/actions/all.php +++ b/actions/all.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class AllAction extends ShowstreamAction { diff --git a/actions/avatar.php b/actions/avatar.php index b715e02dee..2244e7c782 100644 --- a/actions/avatar.php +++ b/actions/avatar.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class AvatarAction extends SettingsAction { diff --git a/actions/login.php b/actions/login.php index c37f92b79c..3f096dc0c6 100644 --- a/actions/login.php +++ b/actions/login.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class LoginAction extends Action { diff --git a/actions/logout.php b/actions/logout.php index 3b6914411b..b2f0628f21 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class LogoutAction extends Action { function handle($args) { diff --git a/actions/newnotice.php b/actions/newnotice.php index 40a196a236..b15232dec4 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class NewnoticeAction extends Action { diff --git a/actions/password.php b/actions/password.php index 3fd94b66ad..fb670ecc9e 100644 --- a/actions/password.php +++ b/actions/password.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class PasswordAction extends SettingsAction { diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 95462133ee..f46045dde4 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class ProfilesettingsAction extends SettingsAction { diff --git a/actions/public.php b/actions/public.php index 8cb854fec1..698f991952 100644 --- a/actions/public.php +++ b/actions/public.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class PublicAction extends StreamAction { diff --git a/actions/register.php b/actions/register.php index 753c79ecb6..80cc6aa7e2 100644 --- a/actions/register.php +++ b/actions/register.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class RegisterAction extends Action { diff --git a/actions/shownotice.php b/actions/shownotice.php index 2e14963bb5..21784e4fd2 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class ShownoticeAction extends Action { @@ -64,8 +64,8 @@ class ShownoticeAction extends Action { common_start_element('a', array('href' => $profile->profileurl, 'class' => 'nickname', 'title' => - ($profile->fullname) ? $profile->fullname : - $profile->nickname)), + ($profile->fullname) ? $profile->fullname : + $profile->nickname), $profile->nickname); # FIXME: URL, image, video, audio common_element('span', array('class' => 'content'), diff --git a/actions/showstream.php b/actions/showstream.php index 8272e10384..c477ae29b7 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } define('SUBSCRIPTIONS_PER_ROW', 5); define('SUBSCRIPTIONS', 80); @@ -169,7 +169,7 @@ class ShowstreamAction extends StreamAction { } common_element('a', array('href' => common_local_url('subscriptions', - array('profile' => $profile->nickname)) + array('profile' => $profile->nickname)), 'class' => 'moresubscriptions'), _t('All subscriptions')); diff --git a/actions/subscribe.php b/actions/subscribe.php index aab6c4b155..68fdd24e98 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class SubscribeAction extends Action { function handle($args) { diff --git a/actions/subscribed.php b/actions/subscribed.php index f24470f029..d28ff237d8 100644 --- a/actions/subscribed.php +++ b/actions/subscribed.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class SubscribedAction extends Action { diff --git a/actions/subscriptions.php b/actions/subscriptions.php index 87b8a4e485..60ceb0c983 100644 --- a/actions/subscriptions.php +++ b/actions/subscriptions.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class SubscriptionsAction extends Action { diff --git a/classes/Notice.php b/classes/Notice.php index 538ae9c01b..24c8133308 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } /** * Table Definition for notice diff --git a/classes/Profile.php b/classes/Profile.php index 4f756856ec..686a791630 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } /** * Table Definition for profile diff --git a/classes/Remote_profile.php b/classes/Remote_profile.php index e9e4094b3b..0aa727ad15 100644 --- a/classes/Remote_profile.php +++ b/classes/Remote_profile.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } /** * Table Definition for remote_profile diff --git a/classes/Subscription.php b/classes/Subscription.php index caa0553cba..ca2b21c025 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } /** * Table Definition for subscription diff --git a/classes/User.php b/classes/User.php index 2b8610a652..9453096383 100644 --- a/classes/User.php +++ b/classes/User.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } /** * Table Definition for user */ diff --git a/index.php b/index.php index 812239e3d5..9d27eef2d5 100644 --- a/index.php +++ b/index.php @@ -28,10 +28,8 @@ $actionfile = INSTALLDIR."/actions/$action.php"; if (file_exists($actionfile)) { require_once($actionfile); $action_class = ucfirst($action) . "Action"; - if (function_exists($action_function)) { - call_user_func($action_function); + call_user_func(array($action_class, 'handle'), $_REQUEST); } else { common_user_error(_t('Unknown action')); } -?> \ No newline at end of file diff --git a/lib/action.php b/lib/action.php index 049885acd0..f8442a1f02 100644 --- a/lib/action.php +++ b/lib/action.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class Action { // lawsuit diff --git a/lib/common.php b/lib/common.php index 0695410264..0d734e2b4d 100644 --- a/lib/common.php +++ b/lib/common.php @@ -20,7 +20,7 @@ /* XXX: break up into separate modules (HTTP, HTML, user, files) */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); @@ -41,10 +41,11 @@ $config = 'path' => '/'), 'avatar' => array('directory' => INSTALLDIR . 'files', - 'path' => '/files'), - 'db' => &PEAR::getStaticProperty('DB_DataObject','options'), + 'path' => '/files') ); +$config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); + $config['db'] = array('database' => 'YOU HAVE TO SET THIS IN config.php', 'schema_location' => $INSTALLDIR . '/classes', @@ -279,10 +280,10 @@ function commmon_date_string($dt) { } function common_redirect($url, $code=307) { - static $status = (301 => "Moved Permanently", - 302 => "Found", - 303 => "See Other", - 307 => "Temporary Redirect"); + static $status = array(301 => "Moved Permanently", + 302 => "Found", + 303 => "See Other", + 307 => "Temporary Redirect"); header("Status: ${code} $status[$code]"); header("Location: $url"); common_element('a', array('href' => $url), $url); @@ -299,4 +300,6 @@ function common_broadcast_notices($id) { // XXX: set up gettext -function _t($str) { $str } +function _t($str) { + return $str; +} diff --git a/lib/settingsaction.php b/lib/settingsaction.php index 1795969f90..d74e226d85 100644 --- a/lib/settingsaction.php +++ b/lib/settingsaction.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } class SettingsAction extends Action { diff --git a/lib/stream.php b/lib/stream.php index 6b2ab24ff0..2b8361a735 100644 --- a/lib/stream.php +++ b/lib/stream.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1) } +if (!defined('LACONICA')) { exit(1); } define('NOTICES_PER_PAGE', 20); -- 2.39.5