]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '1.0.x' into testing
authorEvan Prodromou <evan@status.net>
Fri, 10 Jun 2011 20:51:07 +0000 (16:51 -0400)
committerEvan Prodromou <evan@status.net>
Fri, 10 Jun 2011 20:51:07 +0000 (16:51 -0400)
66 files changed:
actions/apiaccountupdateprofilebackgroundimage.php [deleted file]
actions/apiaccountupdateprofilecolors.php [deleted file]
actions/blockedfromgroup.php
actions/designadminpanel.php [deleted file]
actions/editapplication.php
actions/editgroup.php
actions/editpeopletag.php
actions/groupdesignsettings.php [deleted file]
actions/grouplogo.php
actions/groupmembers.php
actions/groupqueue.php
actions/invite.php
actions/newapplication.php
actions/pathsadminpanel.php
actions/peopletagged.php
actions/peopletagsbyuser.php
actions/peopletagsforuser.php
actions/peopletagsubscribers.php
actions/peopletagsubscriptions.php
actions/recoverpassword.php
actions/replies.php
actions/showapplication.php
actions/showfavorites.php
actions/showgroup.php
actions/shownotice.php
actions/siteadminpanel.php
actions/userdesignsettings.php [deleted file]
classes/Design.php [deleted file]
classes/User.php
classes/User_group.php
db/core.php
lib/action.php
lib/adminpanelaction.php
lib/adminpanelnav.php
lib/apiaction.php
lib/currentuserdesignaction.php [deleted file]
lib/default.php
lib/designform.php [deleted file]
lib/designsettings.php [deleted file]
lib/groupaction.php [new file with mode: 0644]
lib/groupdesignaction.php [deleted file]
lib/groupnav.php
lib/groupsbymemberssection.php
lib/groupsbypostssection.php
lib/mailbox.php
lib/ownerdesignaction.php [deleted file]
lib/profileaction.php
lib/router.php
lib/settingsaction.php
lib/settingsnav.php
lib/statusnet.php
plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php
plugins/DomainStatusNetwork/actions/globallogin.php [new file with mode: 0644]
plugins/DomainStatusNetwork/actions/globalrecover.php [new file with mode: 0644]
plugins/DomainStatusNetwork/actions/globalregister.php [new file with mode: 0644]
plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php [deleted file]
plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php [new file with mode: 0644]
plugins/DomainStatusNetwork/lib/globalapiaction.php [new file with mode: 0644]
plugins/DomainStatusNetwork/scripts/installforemail.php
plugins/FacebookBridge/FacebookBridgePlugin.php
plugins/GroupPrivateMessage/groupinbox.php
plugins/Mapstraction/map.php
plugins/ModPlus/remoteprofileaction.php
plugins/QnA/actions/qnashowanswer.php
plugins/QnA/actions/qnashowquestion.php
theme/neo/css/display.css

diff --git a/actions/apiaccountupdateprofilebackgroundimage.php b/actions/apiaccountupdateprofilebackgroundimage.php
deleted file mode 100644 (file)
index bb0cef5..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Update the authenticating user's profile background image
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  API
- * @package   StatusNet
- * @author    Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET')) {
-    exit(1);
-}
-
-require_once INSTALLDIR . '/lib/apiauth.php';
-
-/**
- * Update the authenticating user's profile background image
- *
- * @category API
- * @package  StatusNet
- * @author   Zach Copley <zach@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- */
-class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
-{
-    var $tile = false;
-
-    /**
-     * Take arguments for running
-     *
-     * @param array $args $_REQUEST args
-     *
-     * @return boolean success flag
-     *
-     */
-    function prepare($args)
-    {
-        parent::prepare($args);
-
-        $this->user  = $this->auth_user;
-        $this->tile  = $this->arg('tile');
-
-        return true;
-    }
-
-    /**
-     * Handle the request
-     *
-     * Check whether the credentials are valid and output the result
-     *
-     * @param array $args $_REQUEST data (unused)
-     *
-     * @return void
-     */
-    function handle($args)
-    {
-        parent::handle($args);
-
-        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->clientError(
-                // TRANS: Client error. POST is a HTTP command. It should not be translated.
-                _('This method requires a POST.'),
-                400, $this->format
-            );
-            return;
-        }
-
-        if (!in_array($this->format, array('xml', 'json'))) {
-            $this->clientError(
-                // TRANS: Client error displayed when coming across a non-supported API method.
-                _('API method not found.'),
-                404,
-                $this->format
-            );
-            return;
-        }
-
-        // Workaround for PHP returning empty $_POST and $_FILES when POST
-        // length > post_max_size in php.ini
-
-        if (empty($_FILES)
-            && empty($_POST)
-            && ($_SERVER['CONTENT_LENGTH'] > 0)
-        ) {
-             // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
-             // TRANS: %s is the number of bytes of the CONTENT_LENGTH.
-             $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
-                      'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
-                      intval($_SERVER['CONTENT_LENGTH']));
-
-            $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
-            return;
-        }
-
-        if (empty($this->user)) {
-            // TRANS: Client error when user not found updating a profile background image.
-            $this->clientError(_('No such user.'), 404, $this->format);
-            return;
-        }
-
-        $design = $this->user->getDesign();
-
-        // XXX: This is kinda gross, but before we can add a background
-        // img we have to make sure there's a Design because design ID
-        // is part of the img filename.
-
-        if (empty($design)) {
-            $this->user->query('BEGIN');
-
-            // save new design
-            $design = new Design();
-            $id = $design->insert();
-
-            if (empty($id)) {
-                common_log_db_error($id, 'INSERT', __FILE__);
-                // TRANS: Client error displayed when saving design settings fails because of an empty id.
-                $this->clientError(_('Unable to save your design settings.'));
-                return;
-            }
-
-            $original              = clone($this->user);
-            $this->user->design_id = $id;
-            $result                = $this->user->update($original);
-
-            if (empty($result)) {
-                common_log_db_error($original, 'UPDATE', __FILE__);
-                // TRANS: Client error displayed when saving design settings fails because of an empty result.
-                $this->clientError(_('Unable to save your design settings.'));
-                $this->user->query('ROLLBACK');
-                return;
-            }
-
-            $this->user->query('COMMIT');
-        }
-
-        // Okay, now get the image and add it to the design
-
-        try {
-            $imagefile = ImageFile::fromUpload('image');
-        } catch (Exception $e) {
-            $this->clientError($e->getMessage(), 400, $this->format);
-            return;
-        }
-
-        $filename = Design::filename(
-            $design->id,
-            image_type_to_extension($imagefile->type),
-            common_timestamp()
-        );
-
-        $filepath = Design::path($filename);
-
-        move_uploaded_file($imagefile->filepath, $filepath);
-
-        // delete any old backround img laying around
-
-        if (isset($design->backgroundimage)) {
-            @unlink(Design::path($design->backgroundimage));
-        }
-
-        $original = clone($design);
-        $design->backgroundimage = $filename;
-        $design->setDisposition(true, false, ($this->tile == 'true'));
-
-        $result = $design->update($original);
-
-        if ($result === false) {
-            common_log_db_error($design, 'UPDATE', __FILE__);
-            // TRANS: Error displayed when updating design settings fails.
-            $this->showForm(_('Could not update your design.'));
-            return;
-        }
-
-        $profile = $this->user->getProfile();
-
-        if (empty($profile)) {
-            // TRANS: Error message displayed when referring to a user without a profile.
-            $this->clientError(_('User has no profile.'));
-            return;
-        }
-
-        $twitter_user = $this->twitterUserArray($profile, true);
-
-        if ($this->format == 'xml') {
-            $this->initDocument('xml');
-            $this->showTwitterXmlUser($twitter_user, 'user', true);
-            $this->endDocument('xml');
-        } elseif ($this->format == 'json') {
-            $this->initDocument('json');
-            $this->showJsonObjects($twitter_user);
-            $this->endDocument('json');
-        }
-    }
-}
diff --git a/actions/apiaccountupdateprofilecolors.php b/actions/apiaccountupdateprofilecolors.php
deleted file mode 100644 (file)
index 4fa85c6..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Update a user's design colors
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  API
- * @package   StatusNet
- * @author    Zach Copley <zach@status.net>
- * @copyright 2009-2010 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET')) {
-    exit(1);
-}
-
-require_once INSTALLDIR . '/lib/apiauth.php';
-
-/**
- * Sets one or more hex values that control the color scheme of the
- * authenticating user's design
- *
- * @category API
- * @package  StatusNet
- * @author   Zach Copley <zach@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- */
-class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
-{
-    var $profile_background_color     = null;
-    var $profile_text_color           = null;
-    var $profile_link_color           = null;
-    var $profile_sidebar_fill_color   = null;
-    var $profile_sidebar_border_color = null;
-
-    /**
-     * Take arguments for running
-     *
-     * @param array $args $_REQUEST args
-     *
-     * @return boolean success flag
-     */
-    function prepare($args)
-    {
-        parent::prepare($args);
-
-        $this->user   = $this->auth_user;
-
-        $this->profile_background_color
-            = $this->trimmed('profile_background_color');
-        $this->profile_text_color
-            = $this->trimmed('profile_text_color');
-        $this->profile_link_color
-            = $this->trimmed('profile_link_color');
-        $this->profile_sidebar_fill_color
-            = $this->trimmed('profile_sidebar_fill_color');
-
-        // XXX: we don't support changing the sidebar border color
-        // in our designs.
-
-        $this->profile_sidebar_border_color
-            = $this->trimmed('profile_sidebar_border_color');
-
-        // XXX: Unlike Twitter, we do allow people to change the 'content color'
-
-        $this->profile_content_color = $this->trimmed('profile_content_color');
-
-        return true;
-    }
-
-    /**
-     * Handle the request
-     *
-     * Try to save the user's colors in her design. Create a new design
-     * if the user doesn't already have one.
-     *
-     * @param array $args $_REQUEST data (unused)
-     *
-     * @return void
-     */
-    function handle($args)
-    {
-        parent::handle($args);
-
-        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->clientError(
-                // TRANS: Client error. POST is a HTTP command. It should not be translated.
-                _('This method requires a POST.'),
-                400, $this->format
-            );
-            return;
-        }
-
-        if (!in_array($this->format, array('xml', 'json'))) {
-            $this->clientError(
-                // TRANS: Client error displayed when coming across a non-supported API method.
-                _('API method not found.'),
-                404,
-                $this->format
-            );
-            return;
-        }
-
-        $design = $this->user->getDesign();
-
-        if (!empty($design)) {
-            $original = clone($design);
-
-            try {
-                $this->setColors($design);
-            } catch (WebColorException $e) {
-                $this->clientError($e->getMessage(), 400, $this->format);
-                return false;
-            }
-
-            $result = $design->update($original);
-
-            if ($result === false) {
-                common_log_db_error($design, 'UPDATE', __FILE__);
-                // TRANS: Client error displayed when a database error occurs updating profile colours.
-                $this->clientError(_('Could not update your design.'));
-                return;
-            }
-        } else {
-            $this->user->query('BEGIN');
-
-            // save new design
-            $design = new Design();
-
-            try {
-                $this->setColors($design);
-            } catch (WebColorException $e) {
-                $this->clientError($e->getMessage(), 400, $this->format);
-                return false;
-            }
-
-            $id = $design->insert();
-
-            if (empty($id)) {
-                common_log_db_error($id, 'INSERT', __FILE__);
-                // TRANS: Client error displayed when a database error occurs inserting profile colours.
-                $this->clientError(_('Unable to save your design settings.'));
-                return;
-            }
-
-            $original              = clone($this->user);
-            $this->user->design_id = $id;
-            $result                = $this->user->update($original);
-
-            if (empty($result)) {
-                common_log_db_error($original, 'UPDATE', __FILE__);
-                // TRANS: Client error displayed when a database error occurs updating profile colours.
-                $this->clientError(_('Unable to save your design settings.'));
-                $this->user->query('ROLLBACK');
-                return;
-            }
-
-            $this->user->query('COMMIT');
-        }
-
-        $profile = $this->user->getProfile();
-
-        if (empty($profile)) {
-            // TRANS: Error message displayed when referring to a user without a profile.
-            $this->clientError(_('User has no profile.'));
-            return;
-        }
-
-        $twitter_user = $this->twitterUserArray($profile, true);
-
-        if ($this->format == 'xml') {
-            $this->initDocument('xml');
-            $this->showTwitterXmlUser($twitter_user, 'user', true);
-            $this->endDocument('xml');
-        } elseif ($this->format == 'json') {
-            $this->initDocument('json');
-            $this->showJsonObjects($twitter_user);
-            $this->endDocument('json');
-        }
-    }
-
-    /**
-     * Sets the user's design colors based on the request parameters
-     *
-     * @param Design $design the user's Design
-     *
-     * @return void
-     */
-    function setColors($design)
-    {
-        $bgcolor = empty($this->profile_background_color) ?
-            null : new WebColor($this->profile_background_color);
-        $tcolor  = empty($this->profile_text_color) ?
-            null : new WebColor($this->profile_text_color);
-        $sbcolor = empty($this->profile_sidebar_fill_color) ?
-            null : new WebColor($this->profile_sidebar_fill_color);
-        $lcolor  = empty($this->profile_link_color) ?
-            null : new WebColor($this->profile_link_color);
-        $ccolor  = empty($this->profile_content_color) ?
-            null : new WebColor($this->profile_content_color);
-
-        if (!empty($bgcolor)) {
-            $design->backgroundcolor = $bgcolor->intValue();
-        }
-
-        if (!empty($ccolor)) {
-            $design->contentcolor = $ccolor->intValue();
-        }
-
-        if (!empty($sbcolor)) {
-            $design->sidebarcolor = $sbcolor->intValue();
-        }
-
-        if (!empty($tcolor)) {
-            $design->textcolor = $tcolor->intValue();
-        }
-
-        if (!empty($lcolor)) {
-            $design->linkcolor = $lcolor->intValue();
-        }
-
-        return true;
-    }
-}
index dd916b170a09a88ece9b565caefcf64efc592266..07ed41e4142642d76f27b17aafeb53751915be26 100644 (file)
@@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class BlockedfromgroupAction extends GroupDesignAction
+class BlockedfromgroupAction extends GroupAction
 {
     var $page = null;
 
diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php
deleted file mode 100644 (file)
index a77b842..0000000
+++ /dev/null
@@ -1,738 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Design administration panel
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Settings
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @author    Zach Copley <zach@status.net>
- * @author    Sarven Capadisli <csarven@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET')) {
-    exit(1);
-}
-
-/**
- * Administer design settings
- *
- * @category Admin
- * @package  StatusNet
- * @author   Evan Prodromou <evan@status.net>
- * @author   Zach Copley <zach@status.net>
- * @author   Sarven Capadisli <csarven@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- */
-class DesignadminpanelAction extends AdminPanelAction
-{
-    /* The default site design */
-    var $design = null;
-
-    /**
-     * Returns the page title
-     *
-     * @return string page title
-     */
-    function title()
-    {
-        // TRANS: Message used as title for design settings for the site.
-        return _('Design');
-    }
-
-    /**
-     * Instructions for using this form.
-     *
-     * @return string instructions
-     */
-    function getInstructions()
-    {
-        // TRANS: Instructions for design adminsitration panel.
-        return _('Design settings for this StatusNet site');
-    }
-
-    /**
-     * Get the default design and show the design admin panel form
-     *
-     * @return void
-     */
-    function showForm()
-    {
-        $this->design = Design::siteDesign();
-        $form = new DesignAdminPanelForm($this);
-        $form->show();
-        return;
-    }
-
-    /**
-     * Save settings from the form
-     *
-     * @return void
-     */
-    function saveSettings()
-    {
-        if ($this->arg('save')) {
-            $this->saveDesignSettings();
-        } else if ($this->arg('defaults')) {
-            $this->restoreDefaults();
-        } else {
-            // TRANS: Client error displayed when the submitted form contains unexpected data.
-            $this->clientError(_('Unexpected form submission.'));
-        }
-    }
-
-    /**
-     * Save the new design settings
-     *
-     * @return void
-     */
-    function saveDesignSettings()
-    {
-        // Workaround for PHP returning empty $_POST and $_FILES when POST
-        // length > post_max_size in php.ini
-
-        if (empty($_FILES)
-            && empty($_POST)
-            && ($_SERVER['CONTENT_LENGTH'] > 0)
-        ) {
-            // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
-            // TRANS: %s is the number of bytes of the CONTENT_LENGTH.
-            $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
-                      'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
-                      intval($_SERVER['CONTENT_LENGTH']));
-            $this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
-            return;
-        }
-
-        // check for file uploads
-
-        $bgimage = $this->saveBackgroundImage();
-        $customTheme = $this->saveCustomTheme();
-
-        $oldtheme = common_config('site', 'theme');
-        if ($customTheme) {
-            // This feels pretty hacky :D
-            $this->args['theme'] = $customTheme;
-            $themeChanged = true;
-        } else {
-            $themeChanged = ($this->trimmed('theme') != $oldtheme);
-        }
-
-        static $settings = array('theme', 'logo', 'ssllogo');
-
-        $values = array();
-
-        foreach ($settings as $setting) {
-            $values[$setting] = $this->trimmed($setting);
-        }
-
-        $this->validate($values);
-
-        $config = new Config();
-
-        $config->query('BEGIN');
-
-        if ($themeChanged) {
-            // If the theme has changed, reset custom colors and let them pick
-            // up the new theme's defaults.
-            $colors = array('background', 'content', 'sidebar', 'text', 'link');
-            foreach ($colors as $colorKey) {
-                // Clear from global config so we see defaults on this page...
-                $GLOBALS['config']['design'][$colorKey . 'color'] = false;
-
-                // And remove old settings from DB...
-                $this->deleteSetting('design', $colorKey . 'color');
-            }
-        } else {
-            // Only save colors from the form if the theme has not changed.
-            //
-            // @fixme a future more ajaxy form should allow theme switch
-            // and color customization in one step.
-
-            $bgcolor = new WebColor($this->trimmed('design_background'));
-            $ccolor  = new WebColor($this->trimmed('design_content'));
-            $sbcolor = new WebColor($this->trimmed('design_sidebar'));
-            $tcolor  = new WebColor($this->trimmed('design_text'));
-            $lcolor  = new WebColor($this->trimmed('design_links'));
-
-            Config::save('design', 'backgroundcolor', $bgcolor->intValue());
-            Config::save('design', 'contentcolor', $ccolor->intValue());
-            Config::save('design', 'sidebarcolor', $sbcolor->intValue());
-            Config::save('design', 'textcolor', $tcolor->intValue());
-            Config::save('design', 'linkcolor', $lcolor->intValue());
-        }
-
-        $onoff = $this->arg('design_background-image_onoff');
-
-        $on   = false;
-        $off  = false;
-
-        if ($onoff == 'on') {
-            $on = true;
-        } else {
-            $off = true;
-        }
-
-        $tile = $this->boolean('design_background-image_repeat');
-
-        // Hack to use Design's bit setter
-        $scratch = new Design();
-        $scratch->setDisposition($on, $off, $tile);
-
-        Config::save('design', 'disposition', $scratch->disposition);
-
-        foreach ($settings as $setting) {
-            Config::save('site', $setting, $values[$setting]);
-        }
-
-        if (isset($bgimage)) {
-            Config::save('design', 'backgroundimage', $bgimage);
-        }
-
-        if (common_config('custom_css', 'enabled')) {
-            $css = $this->arg('css');
-            if ($css != common_config('custom_css', 'css')) {
-                Config::save('custom_css', 'css', $css);
-            }
-        }
-
-        $config->query('COMMIT');
-    }
-
-    /**
-     * Restore the default design
-     *
-     * @return void
-     */
-    function restoreDefaults()
-    {
-        $this->deleteSetting('site', 'logo');
-        $this->deleteSetting('site', 'ssllogo');
-        $this->deleteSetting('site', 'theme');
-
-        $settings = array(
-            'theme', 'backgroundimage', 'backgroundcolor', 'contentcolor',
-            'sidebarcolor', 'textcolor', 'linkcolor', 'disposition'
-        );
-
-        foreach ($settings as $setting) {
-            $this->deleteSetting('design', $setting);
-        }
-
-        // XXX: Should we restore the default dir settings, etc.? --Z
-
-        // XXX: I can't get it to show the new settings without forcing
-        // this terrible reload -- FIX ME!
-        common_redirect(common_local_url('designadminpanel'), 303);
-    }
-
-    /**
-     * Save the background image if the user uploaded one
-     *
-     * @return string $filename the filename of the image
-     */
-    function saveBackgroundImage()
-    {
-        $filename = null;
-        if (isset($_FILES['design_background-image_file']['error']) &&
-            $_FILES['design_background-image_file']['error'] ==
-            UPLOAD_ERR_OK) {
-
-            $filepath = null;
-
-            try {
-                $imagefile =
-                    ImageFile::fromUpload('design_background-image_file');
-            } catch (Exception $e) {
-                $this->clientError('Unable to save background image.');
-                return;
-            }
-
-            // Note: site design background image has a special filename
-
-            $filename = Design::filename('site-design-background',
-                image_type_to_extension($imagefile->type),
-                    common_timestamp());
-
-            $filepath = Design::path($filename);
-
-            move_uploaded_file($imagefile->filepath, $filepath);
-
-            // delete any old backround img laying around
-
-            if (isset($this->design->backgroundimage)) {
-                @unlink(Design::path($design->backgroundimage));
-            }
-
-            return $filename;
-        }
-    }
-
-    /**
-     * Save the custom theme if the user uploaded one.
-     *
-     * @return mixed custom theme name, if succesful, or null if no theme upload.
-     * @throws ClientException for invalid theme archives
-     * @throws ServerException if trouble saving the theme files
-     */
-    function saveCustomTheme()
-    {
-        if (common_config('theme_upload', 'enabled') &&
-            $_FILES['design_upload_theme']['error'] == UPLOAD_ERR_OK) {
-
-            $upload = ThemeUploader::fromUpload('design_upload_theme');
-            $basedir = common_config('local', 'dir');
-            if (empty($basedir)) {
-                $basedir = INSTALLDIR . '/local';
-            }
-            $name = 'custom'; // @todo allow multiples, custom naming?
-            $outdir = $basedir . '/theme/' . $name;
-            $upload->extract($outdir);
-            return $name;
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Attempt to validate setting values
-     *
-     * @return void
-     */
-    function validate(&$values)
-    {
-        if (!empty($values['logo']) &&
-            !Validate::uri($values['logo'], array('allowed_schemes' => array('http', 'https')))) {
-            // TRANS: Client error displayed when a logo URL does is not valid.
-            $this->clientError(_('Invalid logo URL.'));
-        }
-
-        if (!empty($values['ssllogo']) &&
-            !Validate::uri($values['ssllogo'], array('allowed_schemes' => array('https')))) {
-            // TRANS: Client error displayed when an SSL logo URL is invalid.
-            $this->clientError(_('Invalid SSL logo URL.'));
-        }
-
-        if (!in_array($values['theme'], Theme::listAvailable())) {
-            // TRANS: Client error displayed when a theme is submitted through the form that is not in the theme list.
-            // TRANS: %s is the chosen unavailable theme.
-            $this->clientError(sprintf(_('Theme not available: %s.'), $values['theme']));
-        }
-    }
-
-    /**
-     * Add the Farbtastic stylesheet
-     *
-     * @return void
-     */
-    function showStylesheets()
-    {
-        parent::showStylesheets();
-        $this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv');
-    }
-
-    /**
-     * Add the Farbtastic scripts
-     *
-     * @return void
-     */
-    function showScripts()
-    {
-        parent::showScripts();
-
-        $this->script('farbtastic/farbtastic.js');
-        $this->script('userdesign.go.js');
-
-        $this->autofocus('design_background-image_file');
-    }
-
-}
-
-class DesignAdminPanelForm extends AdminForm
-{
-
-    /**
-     * ID of the form
-     *
-     * @return int ID of the form
-     */
-    function id()
-    {
-        return 'form_design_admin_panel';
-    }
-
-    /**
-     * class of the form
-     *
-     * @return string class of the form
-     */
-    function formClass()
-    {
-        return 'form_settings';
-    }
-
-    /**
-     * HTTP method used to submit the form
-     *
-     * For image data we need to send multipart/form-data
-     * so we set that here too
-     *
-     * @return string the method to use for submitting
-     */
-    function method()
-    {
-        $this->enctype = 'multipart/form-data';
-
-        return 'post';
-    }
-
-    /**
-     * Action of the form
-     *
-     * @return string URL of the action
-     */
-    function action()
-    {
-        return common_local_url('designadminpanel');
-    }
-
-    /**
-     * Data elements of the form
-     *
-     * @return void
-     */
-    function formData()
-    {
-        $this->showLogo();
-        $this->showTheme();
-        $this->showBackground();
-        $this->showColors();
-        $this->showAdvanced();
-    }
-
-    function showLogo()
-    {
-        $this->out->elementStart('fieldset', array('id' => 'settings_design_logo'));
-        // TRANS: Fieldset legend for form to change logo.
-        $this->out->element('legend', null, _('Change logo'));
-
-        $this->out->elementStart('ul', 'form_data');
-
-        $this->li();
-        $this->input('logo',
-                     // TRANS: Field label for StatusNet site logo.
-                     _('Site logo'),
-                     // TRANS: Title for field label for StatusNet site logo.
-                     'Logo for the site (full URL).');
-        $this->unli();
-
-        $this->li();
-        $this->input('ssllogo',
-                     // TRANS: Field label for SSL StatusNet site logo.
-                     _('SSL logo'),
-                     // TRANS: Title for field label for SSL StatusNet site logo.
-                     'Logo to show on SSL pages.');
-        $this->unli();
-
-        $this->out->elementEnd('ul');
-
-        $this->out->elementEnd('fieldset');
-
-    }
-
-    function showTheme()
-    {
-        $this->out->elementStart('fieldset', array('id' => 'settings_design_theme'));
-        // TRANS: Fieldset legend for form change StatusNet site's theme.
-        $this->out->element('legend', null, _('Change theme'));
-
-        $this->out->elementStart('ul', 'form_data');
-
-        $themes = Theme::listAvailable();
-
-        // XXX: listAvailable() can return an empty list if you
-        // screw up your settings, so just in case:
-
-        if (empty($themes)) {
-            $themes = array('default', 'default');
-        }
-
-        asort($themes);
-        $themes = array_combine($themes, $themes);
-
-        $this->li();
-        // TRANS: Field label for dropdown to choose site theme.
-        $this->out->dropdown('theme', _('Site theme'),
-                             // TRANS: Title for field label for dropdown to choose site theme.
-                             $themes, _('Theme for the site.'),
-                             false, $this->value('theme'));
-        $this->unli();
-
-        if (common_config('theme_upload', 'enabled')) {
-            $this->li();
-            // TRANS: Field label for uploading a cutom theme.
-            $this->out->element('label', array('for' => 'design_upload_theme'), _('Custom theme'));
-            $this->out->element('input', array('id' => 'design_upload_theme',
-                                               'name' => 'design_upload_theme',
-                                               'type' => 'file'));
-            // TRANS: Form instructions for uploading a cutom StatusNet theme.
-            $this->out->element('p', 'form_guide', _('You can upload a custom StatusNet theme as a .ZIP archive.'));
-            $this->unli();
-        }
-
-        $this->out->elementEnd('ul');
-
-        $this->out->elementEnd('fieldset');
-    }
-
-    function showBackground()
-    {
-        $design = $this->out->design;
-
-        $this->out->elementStart('fieldset', array('id' =>
-            'settings_design_background-image'));
-        // TRANS: Fieldset legend for theme background image.
-        $this->out->element('legend', null, _('Change background image'));
-        $this->out->elementStart('ul', 'form_data');
-
-        $this->li();
-        $this->out->element('input', array('name' => 'MAX_FILE_SIZE',
-                                          'type' => 'hidden',
-                                          'id' => 'MAX_FILE_SIZE',
-                                          'value' => ImageFile::maxFileSizeInt()));
-        $this->out->element('label', array('for' => 'design_background-image_file'),
-                               // TRANS: Field label for background image on theme designer page.
-                                _('Background'));
-        $this->out->element('input', array('name' => 'design_background-image_file',
-                                     'type' => 'file',
-                                     'id' => 'design_background-image_file'));
-        $this->out->element('p', 'form_guide',
-            // TRANS: Form guide for background image upload form on theme designer page.
-            sprintf(_('You can upload a background image for the site. ' .
-              'The maximum file size is %1$s.'), ImageFile::maxFileSize()));
-        $this->unli();
-
-        if (!empty($design->backgroundimage)) {
-
-            $this->out->elementStart('li', array('id' =>
-                'design_background-image_onoff'));
-
-            $this->out->element('img', array('src' =>
-                Design::url($design->backgroundimage)));
-
-            $attrs = array('name' => 'design_background-image_onoff',
-                           'type' => 'radio',
-                           'id' => 'design_background-image_on',
-                           'class' => 'radio',
-                           'value' => 'on');
-
-            if ($design->disposition & BACKGROUND_ON) {
-                $attrs['checked'] = 'checked';
-            }
-
-            $this->out->element('input', $attrs);
-
-            $this->out->element('label', array('for' => 'design_background-image_on',
-                                          'class' => 'radio'),
-                                          // TRANS: Used as radio button label to add a background image.
-                                          _('On'));
-
-            $attrs = array('name' => 'design_background-image_onoff',
-                           'type' => 'radio',
-                           'id' => 'design_background-image_off',
-                           'class' => 'radio',
-                           'value' => 'off');
-
-            if ($design->disposition & BACKGROUND_OFF) {
-                $attrs['checked'] = 'checked';
-            }
-
-            $this->out->element('input', $attrs);
-
-            $this->out->element('label', array('for' => 'design_background-image_off',
-                                          'class' => 'radio'),
-                                          // TRANS: Used as radio button label to not add a background image.
-                                          _('Off'));
-            // TRANS: Form guide for turning background image on or off on theme designer page.
-            $this->out->element('p', 'form_guide', _('Turn background image on or off.'));
-            $this->unli();
-
-            $this->li();
-            $this->out->checkbox('design_background-image_repeat',
-                            // TRANS: Checkbox label to title background image on theme designer page.
-                            _('Tile background image'),
-                            ($design->disposition & BACKGROUND_TILE) ? true : false);
-            $this->unli();
-        }
-
-        $this->out->elementEnd('ul');
-        $this->out->elementEnd('fieldset');
-    }
-
-    function showColors()
-    {
-        $design = $this->out->design;
-
-        $this->out->elementStart('fieldset', array('id' => 'settings_design_color'));
-        // TRANS: Fieldset legend for theme colors.
-        $this->out->element('legend', null, _('Change colors'));
-
-        $this->out->elementStart('ul', 'form_data');
-
-        try {
-            // @fixme avoid loop unrolling in non-performance-critical contexts like this
-
-            $bgcolor = new WebColor($design->backgroundcolor);
-
-            $this->li();
-            // TRANS: Field label for background color selector.
-            $this->out->element('label', array('for' => 'swatch-1'), _('Background'));
-            $this->out->element('input', array('name' => 'design_background',
-                                          'type' => 'text',
-                                          'id' => 'swatch-1',
-                                          'class' => 'swatch',
-                                          'maxlength' => '7',
-                                          'size' => '7',
-                                          'value' => ''));
-            $this->unli();
-
-            $ccolor = new WebColor($design->contentcolor);
-
-            $this->li();
-            // TRANS: Field label for content color selector.
-            $this->out->element('label', array('for' => 'swatch-2'), _('Content'));
-            $this->out->element('input', array('name' => 'design_content',
-                                          'type' => 'text',
-                                          'id' => 'swatch-2',
-                                          'class' => 'swatch',
-                                          'maxlength' => '7',
-                                          'size' => '7',
-                                          'value' => ''));
-            $this->unli();
-
-            $sbcolor = new WebColor($design->sidebarcolor);
-
-            $this->li();
-            // TRANS: Field label for sidebar color selector.
-            $this->out->element('label', array('for' => 'swatch-3'), _('Sidebar'));
-            $this->out->element('input', array('name' => 'design_sidebar',
-                                        'type' => 'text',
-                                        'id' => 'swatch-3',
-                                        'class' => 'swatch',
-                                        'maxlength' => '7',
-                                        'size' => '7',
-                                        'value' => ''));
-            $this->unli();
-
-            $tcolor = new WebColor($design->textcolor);
-
-            $this->li();
-            // TRANS: Field label for text color selector.
-            $this->out->element('label', array('for' => 'swatch-4'), _('Text'));
-            $this->out->element('input', array('name' => 'design_text',
-                                        'type' => 'text',
-                                        'id' => 'swatch-4',
-                                        'class' => 'swatch',
-                                        'maxlength' => '7',
-                                        'size' => '7',
-                                        'value' => ''));
-            $this->unli();
-
-            $lcolor = new WebColor($design->linkcolor);
-
-            $this->li();
-            // TRANS: Field label for link color selector.
-            $this->out->element('label', array('for' => 'swatch-5'), _('Links'));
-            $this->out->element('input', array('name' => 'design_links',
-                                         'type' => 'text',
-                                         'id' => 'swatch-5',
-                                         'class' => 'swatch',
-                                         'maxlength' => '7',
-                                         'size' => '7',
-                                         'value' => ''));
-            $this->unli();
-
-        } catch (WebColorException $e) {
-            // @fixme normalize them individually!
-            common_log(LOG_ERR, 'Bad color values in site design: ' .
-                $e->getMessage());
-        }
-
-        $this->out->elementEnd('fieldset');
-
-        $this->out->elementEnd('ul');
-    }
-
-    function showAdvanced()
-    {
-        if (common_config('custom_css', 'enabled')) {
-            $this->out->elementStart('fieldset', array('id' => 'settings_design_advanced'));
-            // TRANS: Fieldset legend for advanced theme design settings.
-            $this->out->element('legend', null, _('Advanced'));
-            $this->out->elementStart('ul', 'form_data');
-
-            $this->li();
-            // TRANS: Field label for custom CSS.
-            $this->out->element('label', array('for' => 'css'), _('Custom CSS'));
-            $this->out->element('textarea', array('name' => 'css',
-                                            'id' => 'css',
-                                            'cols' => '50',
-                                            'rows' => '10'),
-                                strval(common_config('custom_css', 'css')));
-            $this->unli();
-
-            $this->out->elementEnd('fieldset');
-            $this->out->elementEnd('ul');
-        }
-    }
-
-    /**
-     * Action elements
-     *
-     * @return void
-     */
-
-    function formActions()
-    {
-        // TRANS: Button text for resetting theme settings.
-        $this->out->submit('defaults', _m('BUTTON','Use defaults'), 'submit form_action-default',
-                // TRANS: Title for button for resetting theme settings.
-                'defaults', _('Restore default designs.'));
-
-        $this->out->element('input', array('id' => 'settings_design_reset',
-                                         'type' => 'reset',
-                                         // TRANS: Button text for resetting theme settings.
-                                         'value' => 'Reset',
-                                         'class' => 'submit form_action-primary',
-                                         // TRANS: Title for button for resetting theme settings.
-                                         'title' => _('Reset back to default.')));
-
-        $this->out->submit('save',
-                           // TRANS: Button text for saving theme settings.
-                           _m('BUTTON','Save'),
-                           'submit form_action-secondary',
-                           'save',
-                           // TRANS: Title for button for saving theme settings.
-                           _('Save design.'));
-    }
-}
index 02fae3eb49f4828dfc0612370a38347ba6150277..2ba5f6b313f6ef46c55aaa95e6dc418b5e8b6f22 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Applications
  * @package   StatusNet
  * @author    Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class EditApplicationAction extends OwnerDesignAction
+class EditApplicationAction extends Action
 {
     var $msg   = null;
     var $owner = null;
index e46b1481d0d2ae717e933100aa56d94e3e73b460..8405dbe2927180a541cf715431c80c98dcaf6b55 100644 (file)
@@ -23,8 +23,8 @@
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
  * @author    Sarven Capadisli <csarven@status.net>
- * @author   Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @author    Zach Copley <zach@status.net>
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -45,7 +45,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class EditgroupAction extends GroupDesignAction
+class EditgroupAction extends GroupAction
 {
     var $msg;
 
index 115049f7abf6a48289932aec7ea65a8cff5490df..00d1fc3a77b6f1db3289712d801d02e9ff07cadb 100644 (file)
@@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @link     http://status.net/
  */
 
-class EditpeopletagAction extends OwnerDesignAction
+class EditpeopletagAction extends Action
 {
     var $msg, $confirm, $confirm_args=array();
 
diff --git a/actions/groupdesignsettings.php b/actions/groupdesignsettings.php
deleted file mode 100644 (file)
index 798064d..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Saves a design for a given group.
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Settings
- * @package   StatusNet
- * @author    Sarven Capadisli <csarven@status.net>
- * @author    Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR . '/lib/designsettings.php';
-
-/**
- * Set a group's design
- *
- * Saves a design for a given group
- *
- * @category Settings
- * @package  StatusNet
- * @author   Zach Copley <zach@status.net>
- * @author   Sarven Capadisli <csarven@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- */
-class GroupDesignSettingsAction extends DesignSettingsAction
-{
-    var $group = null;
-
-    /**
-     * Sets the right action for the form, and passes request args into
-     * the base action
-     *
-     * @param array $args misc. arguments
-     *
-     * @return boolean true
-     */
-    function prepare($args)
-    {
-        parent::prepare($args);
-
-        if (!common_logged_in()) {
-            // TRANS: Client error displayed trying to change group design settings while not logged in.
-            $this->clientError(_('You must be logged in to edit a group.'));
-            return false;
-        }
-
-        $nickname_arg = $this->trimmed('nickname');
-        $nickname     = common_canonical_nickname($nickname_arg);
-
-        // Permanent redirect on non-canonical nickname
-
-        if ($nickname_arg != $nickname) {
-            $args = array('nickname' => $nickname);
-            common_redirect(common_local_url('groupdesignsettings', $args), 301);
-            return false;
-        }
-
-        if (!$nickname) {
-            // TRANS: Client error displayed trying to change group design settings without providing a group nickname.
-            $this->clientError(_('No nickname.'), 404);
-            return false;
-        }
-
-        $groupid = $this->trimmed('groupid');
-
-        if ($groupid) {
-            $this->group = User_group::staticGet('id', $groupid);
-        } else {
-            $local = Local_group::staticGet('nickname', $nickname);
-            if ($local) {
-                $this->group = User_group::staticGet('id', $local->group_id);
-            }
-        }
-
-        if (!$this->group) {
-            // TRANS: Client error displayed trying to change group design settings while providing a nickname for a non-existing group.
-            $this->clientError(_('No such group.'), 404);
-            return false;
-        }
-
-        $cur = common_current_user();
-
-        if (!$cur->isAdmin($this->group)) {
-            // TRANS: Client error displayed trying to change group design settings without being a (group) admin.
-            $this->clientError(_('You must be an admin to edit the group.'), 403);
-            return false;
-        }
-
-        $this->submitaction = common_local_url('groupdesignsettings',
-            array('nickname' => $this->group->nickname));
-
-        return true;
-    }
-
-    /**
-     * A design for this action
-     *
-     * if the group attribute has been set, returns that group's
-     * design.
-     *
-     * @return Design a design object to use
-     */
-    function getDesign()
-    {
-
-        if (empty($this->group)) {
-            return null;
-        }
-
-        return $this->group->getDesign();
-    }
-
-    /**
-     * Title of the page
-     *
-     * @return string Title of the page
-     */
-
-    function title()
-    {
-        // TRANS: Title group design settings page.
-        return _('Group design');
-    }
-
-    /**
-     * Instructions for use
-     *
-     * @return instructions for use
-     */
-    function getInstructions()
-    {
-        // TRANS: Instructions for group design settings page.
-        return _('Customize the way your group looks ' .
-        'with a background image and a colour palette of your choice.');
-    }
-
-    /**
-     * Override to show group nav stuff
-     *
-     * @return nothing
-     */
-    function showObjectNav()
-    {
-        $nav = new GroupNav($this, $this->group);
-        $nav->show();
-    }
-
-    /**
-     * Override to show default nav stuff
-     *
-     * @return nothing
-     */
-    function showLocalNav()
-    {
-        Action::showLocalNav();
-    }
-
-    /**
-     * Get the design we want to edit
-     *
-     * @return Design
-     */
-    function getWorkingDesign()
-    {
-        $design = null;
-
-        if (isset($this->group)) {
-            $design = $this->group->getDesign();
-        }
-
-        return $design;
-    }
-
-    /**
-     * Content area of the page
-     *
-     * Shows a form for changing the design
-     *
-     * @return void
-     */
-    function showContent()
-    {
-        $design = $this->getWorkingDesign();
-
-        if (empty($design)) {
-            $design = Design::siteDesign();
-        }
-
-        $this->showDesignForm($design);
-    }
-
-    /**
-     * Save or update the group's design settings
-     *
-     * @return void
-     */
-    function saveDesign()
-    {
-        try {
-            $bgcolor = new WebColor($this->trimmed('design_background'));
-            $ccolor  = new WebColor($this->trimmed('design_content'));
-            $sbcolor = new WebColor($this->trimmed('design_sidebar'));
-            $tcolor  = new WebColor($this->trimmed('design_text'));
-            $lcolor  = new WebColor($this->trimmed('design_links'));
-        } catch (WebColorException $e) {
-            $this->showForm($e->getMessage());
-            return;
-        }
-
-        $onoff = $this->arg('design_background-image_onoff');
-
-        $on   = false;
-        $off  = false;
-        $tile = false;
-
-        if ($onoff == 'on') {
-            $on = true;
-        } else {
-            $off = true;
-        }
-
-        $repeat = $this->boolean('design_background-image_repeat');
-
-        if ($repeat) {
-            $tile = true;
-        }
-
-        $design = $this->group->getDesign();
-
-        if (!empty($design)) {
-            // update design
-
-            $original = clone($design);
-
-            $design->backgroundcolor = $bgcolor->intValue();
-            $design->contentcolor    = $ccolor->intValue();
-            $design->sidebarcolor    = $sbcolor->intValue();
-            $design->textcolor       = $tcolor->intValue();
-            $design->linkcolor       = $lcolor->intValue();
-
-            $design->setDisposition($on, $off, $tile);
-
-            $result = $design->update($original);
-
-            if ($result === false) {
-                common_log_db_error($design, 'UPDATE', __FILE__);
-                // TRANS: Form validation error displayed when group design settings could not be updated because of an application issue.
-                $this->showForm(_('Unable to update your design settings.'));
-                return;
-            }
-        } else {
-            $this->group->query('BEGIN');
-
-            // save new design
-
-            $design = new Design();
-
-            $design->backgroundcolor = $bgcolor->intValue();
-            $design->contentcolor    = $ccolor->intValue();
-            $design->sidebarcolor    = $sbcolor->intValue();
-            $design->textcolor       = $tcolor->intValue();
-            $design->linkcolor       = $lcolor->intValue();
-
-            $design->setDisposition($on, $off, $tile);
-
-            $id = $design->insert();
-
-            if (empty($id)) {
-                common_log_db_error($id, 'INSERT', __FILE__);
-                // TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
-                $this->showForm(_('Unable to save your design settings.'));
-                return;
-            }
-
-            $original               = clone($this->group);
-            $this->group->design_id = $id;
-            $result                 = $this->group->update($original);
-
-            if (empty($result)) {
-                common_log_db_error($original, 'UPDATE', __FILE__);
-                // TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
-                $this->showForm(_('Unable to save your design settings.'));
-                $this->group->query('ROLLBACK');
-                return;
-            }
-
-            $this->group->query('COMMIT');
-        }
-
-        $this->saveBackgroundImage($design);
-
-        // TRANS: Form text to confirm saved group design settings.
-        $this->showForm(_('Design preferences saved.'), true);
-    }
-}
index a6694cd837c929327da53689ea267058a8ccca92..c5a106520d710bb50414e1aed924be80264b9791 100644 (file)
@@ -23,7 +23,7 @@
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
  * @author    Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -49,7 +49,7 @@ define('MAX_ORIGINAL', 480);
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class GrouplogoAction extends GroupDesignAction
+class GrouplogoAction extends GroupAction
 {
     var $mode = null;
     var $imagefile = null;
index 2bb35ceddc7eada48df9c5573895a0c135f029b2..df949206e762e4fd0b3b9f10599701aa37296e1c 100644 (file)
@@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class GroupmembersAction extends GroupDesignAction
+class GroupmembersAction extends GroupAction
 {
     var $page = null;
 
index 7cc32a9c6932deaee5264eaf7c6a4de4af07a2a1..2a7239400e442bfe1401355c2b252d1c03431e5e 100644 (file)
@@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class GroupqueueAction extends GroupDesignAction
+class GroupqueueAction extends GroupAction
 {
     var $page = null;
 
index 1bfc9f76d31b5da30a3b20b0969443ee473e1768..75800aa8585430854c4dd92425cf4d62f32e4b02 100644 (file)
@@ -20,7 +20,7 @@
 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 
 // @todo XXX: Add documentation.
-class InviteAction extends CurrentUserDesignAction
+class InviteAction extends Action
 {
     var $mode = null;
     var $error = null;
index 93ef417f63900064c133651c3fd3de56ff68d177..7c0a6551b2e67dc6bf4c76bfe3c571a34676dd3a 100644 (file)
@@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class NewApplicationAction extends OwnerDesignAction
+class NewApplicationAction extends Action
 {
     var $msg;
 
index 0b4a5ff952615876320b6abcf7169fc7660695a3..83ab776a60fe69614702820ade878adf502d99fd 100644 (file)
@@ -364,61 +364,7 @@ class PathsAdminPanelForm extends AdminForm
         $this->out->elementEnd('fieldset');
 
         $this->out->elementStart('fieldset', array('id' =>
-                                                   'settings_design_background-paths'));
-        // TRANS: Fieldset legend in Paths admin panel.
-        $this->out->element('legend', null, _('Backgrounds'));
-        $this->out->elementStart('ul', 'form_data');
-
-        $this->li();
-        $this->input('server',
-                     // TRANS: Field label in Paths admin panel.
-                     _('Server'),
-                     // TRANS: Tooltip for field label in Paths admin panel.
-                     _('Server for backgrounds.'),
-                     'background');
-        $this->unli();
-
-        $this->li();
-        $this->input('path',
-                     // TRANS: Field label in Paths admin panel.
-                     _('Path'),
-                     // TRANS: Tooltip for field label in Paths admin panel.
-                     _('Web path to backgrounds.'),
-                     'background');
-        $this->unli();
-
-        $this->li();
-        $this->input('sslserver',
-                     // TRANS: Field label in Paths admin panel.
-                     _('SSL server'),
-                     // TRANS: Tooltip for field label in Paths admin panel.
-                     _('Server for backgrounds on SSL pages.'),
-                     'background');
-        $this->unli();
-
-        $this->li();
-        $this->input('sslpath',
-                     // TRANS: Field label in Paths admin panel.
-                     _('SSL path'),
-                     // TRANS: Tooltip for field label in Paths admin panel.
-                     _('Web path to backgrounds on SSL pages.'),
-                     'background');
-        $this->unli();
-
-        $this->li();
-        $this->input('dir',
-                     // TRANS: Field label in Paths admin panel.
-                     _('Directory'),
-                     // TRANS: Tooltip for field label in Paths admin panel.
-                     _('Directory where backgrounds are located.'),
-                     'background');
-        $this->unli();
-
-        $this->out->elementEnd('ul');
-        $this->out->elementEnd('fieldset');
-
-        $this->out->elementStart('fieldset', array('id' =>
-                                                   'settings_design_attachments-paths'));
+                                                   'settings_attachments-paths'));
 
         // TRANS: Fieldset legens in Paths admin panel.
         $this->out->element('legend', null, _('Attachments'));
index ea25c8675ba907f1b4a3a70ce3fc98e244e2bbb0..424bf2dcbe3fc59eec5afc3835f10f1c75d42aef 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Group
  * @package   StatusNet
  * @author    Shashi Gowda <connect2shashi@gmail.com>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -42,7 +42,7 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class PeopletaggedAction extends OwnerDesignAction
+class PeopletaggedAction extends Action
 {
     var $page = null;
     var $peopletag = null;
index d348585c900354e365e3b970e40d8d135257ca09..0d9bd50faa28533902d3d9f7c145fb25a540f588 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Personal
  * @package   StatusNet
  * @author    Shashi Gowda <connect2shashi@gmail.com>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 
 require_once INSTALLDIR.'/lib/peopletaglist.php';
 
-class PeopletagsbyuserAction extends OwnerDesignAction
+class PeopletagsbyuserAction extends Action
 {
     var $page = null;
     var $tagger = null;
index 9883bd3657dc8170a9f6b1910917711629acb9cc..cc281339400d1f2e033b97ea18055b7f4208e977 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Personal
  * @package   StatusNet
  * @author    Shashi Gowda <connect2shashi@gmail.com>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 
 require_once INSTALLDIR.'/lib/peopletaglist.php';
 
-class PeopletagsforuserAction extends OwnerDesignAction
+class PeopletagsforuserAction extends Action
 {
     var $page = null;
     var $tagged = null;
index ebc3a9f494e5b40838fbd75b5c5779dc2d801839..e371799efb520052610de8906bcfb8e6ea8d1307 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Group
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -42,7 +42,7 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class PeopletagsubscribersAction extends OwnerDesignAction
+class PeopletagsubscribersAction extends Action
 {
     var $page = null;
     var $peopletag = null;
index b65542e074b846b3cca331cbff9153b940a6dbe4..d857fb235615bc7a32f97bc9b3ac829ef4fb7e69 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Personal
  * @package   StatusNet
  * @author    Shashi Gowda <connect2shashi@gmail.com>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 
 require_once INSTALLDIR.'/lib/peopletaglist.php';
 
-class PeopletagsubscriptionsAction extends OwnerDesignAction
+class PeopletagsubscriptionsAction extends Action
 {
     var $page = null;
     var $profile = null;
index 47a947dc0c786dc77df89581262fdaf149f1830c..8d731cb871cb3fbe9d11f2e0ca8334ef25aca19b 100644 (file)
@@ -273,109 +273,25 @@ class RecoverpasswordAction extends Action
     function recoverPassword()
     {
         $nore = $this->trimmed('nicknameoremail');
+
         if (!$nore) {
             // TRANS: Form instructions for password recovery form.
             $this->showForm(_('Enter a nickname or email address.'));
             return;
         }
 
-        $user = User::staticGet('email', common_canonical_email($nore));
-
-        if (!$user) {
-            try {
-                $user = User::staticGet('nickname', common_canonical_nickname($nore));
-            } catch (NicknameException $e) {
-                // invalid
-            }
-        }
-
-        // See if it's an unconfirmed email address
-
-        if (!$user) {
-            // Warning: it may actually be legit to have multiple folks
-            // who have claimed, but not yet confirmed, the same address.
-            // We'll only send to the first one that comes up.
-            $confirm_email = new Confirm_address();
-            $confirm_email->address = common_canonical_email($nore);
-            $confirm_email->address_type = 'email';
-            $confirm_email->find();
-            if ($confirm_email->fetch()) {
-                $user = User::staticGet($confirm_email->user_id);
-            } else {
-                $confirm_email = null;
-            }
-        } else {
-            $confirm_email = null;
-        }
-
-        if (!$user) {
-            // TRANS: Information on password recovery form if no known username or e-mail address was specified.
-            $this->showForm(_('No user with that email address or username.'));
-            return;
-        }
-
-        // Try to get an unconfirmed email address if they used a user name
-
-        if (!$user->email && !$confirm_email) {
-            $confirm_email = new Confirm_address();
-            $confirm_email->user_id = $user->id;
-            $confirm_email->address_type = 'email';
-            $confirm_email->find();
-            if (!$confirm_email->fetch()) {
-                $confirm_email = null;
-            }
-        }
-
-        if (!$user->email && !$confirm_email) {
-            // TRANS: Client error displayed on password recovery form if a user does not have a registered e-mail address.
-            $this->clientError(_('No registered email address for that user.'));
-            return;
+        try {
+            User::recoverPassword($nore);
+            $this->mode = 'sent';
+            // TRANS: User notification after an e-mail with instructions was sent from the password recovery form.
+            $this->msg = _('Instructions for recovering your password ' .
+                           'have been sent to the email address registered to your ' .
+                           'account.');
+            $this->success = true;
+            $this->showPage();
+        } catch (Exception $e) {
+            $this->success = false;
         }
-
-        // Success! We have a valid user and a confirmed or unconfirmed email address
-
-        $confirm = new Confirm_address();
-        $confirm->code = common_confirmation_code(128);
-        $confirm->address_type = 'recover';
-        $confirm->user_id = $user->id;
-        $confirm->address = (!empty($user->email)) ? $user->email : $confirm_email->address;
-
-        if (!$confirm->insert()) {
-            common_log_db_error($confirm, 'INSERT', __FILE__);
-            // TRANS: Server error displayed if e-mail address confirmation fails in the database on the password recovery form.
-            $this->serverError(_('Error saving address confirmation.'));
-            return;
-        }
-
-         // @todo FIXME: needs i18n.
-        $body = "Hey, $user->nickname.";
-        $body .= "\n\n";
-        $body .= 'Someone just asked for a new password ' .
-                 'for this account on ' . common_config('site', 'name') . '.';
-        $body .= "\n\n";
-        $body .= 'If it was you, and you want to confirm, use the URL below:';
-        $body .= "\n\n";
-        $body .= "\t".common_local_url('recoverpassword',
-                                   array('code' => $confirm->code));
-        $body .= "\n\n";
-        $body .= 'If not, just ignore this message.';
-        $body .= "\n\n";
-        $body .= 'Thanks for your time, ';
-        $body .= "\n";
-        $body .= common_config('site', 'name');
-        $body .= "\n";
-
-        $headers = _mail_prepare_headers('recoverpassword', $user->nickname, $user->nickname);
-        // TRANS: Subject for password recovery e-mail.
-        mail_to_user($user, _('Password recovery requested'), $body, $headers, $confirm->address);
-
-        $this->mode = 'sent';
-        // TRANS: User notification after an e-mail with instructions was sent from the password recovery form.
-        $this->msg = _('Instructions for recovering your password ' .
-                          'have been sent to the email address registered to your ' .
-                          'account.');
-        $this->success = true;
-        $this->showPage();
     }
 
     function resetPassword()
index 385ca4c6cc11157db80f98008db01fc04b65c755..cf248a7785c49e0c89ece25321bca148443026d3 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Personal
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class RepliesAction extends OwnerDesignAction
+class RepliesAction extends Action
 {
     var $page = null;
     var $notice;
index c9cdbf184870074f5fede8f4e80a37ea820c50e9..f41c57643ed32767339d5b575b9fd1865ea95551 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Application
  * @package   StatusNet
  * @author    Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class ShowApplicationAction extends OwnerDesignAction
+class ShowApplicationAction extends Action
 {
     /**
      * Application to show
index 67ee914a914a7283b83076b4e31cb8bc816641d7..65bb8f1bebae77207013e65b9741360a96aabbfd 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Personal
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class ShowfavoritesAction extends OwnerDesignAction
+class ShowfavoritesAction extends Action
 {
     /** User we're getting the faves of */
     var $user = null;
index 5bb90e86dd2daaf77d1cadeea6dfef831ebb4cb3..530deff622ff21a8b0cdf1668afb3245cbcb59a0 100644 (file)
@@ -23,7 +23,7 @@
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
  * @author    Sarven Capadisli <csarven@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -46,7 +46,7 @@ define('MEMBERS_PER_SECTION', 27);
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class ShowgroupAction extends GroupDesignAction
+class ShowgroupAction extends Action
 {
     /** page we're viewing. */
     var $page = null;
index ea9041efb50bd6bf2e52218c44c861cfd20dd667..5501a0af42b0c6f38f566dda03b84f3cb8e2892e 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Personal
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class ShownoticeAction extends OwnerDesignAction
+class ShownoticeAction extends Action
 {
     /**
      * Notice object to show
index 29813ca3b976021fd6d642d93450b79e96b01ad0..11636b0b5c8a6cc685487c3529bc2d17a25075c3 100644 (file)
@@ -24,7 +24,7 @@
  * @author    Evan Prodromou <evan@status.net>
  * @author    Zach Copley <zach@status.net>
  * @author    Sarven Capadisli <csarven@status.net>
- * @copyright 2008-2010 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -88,9 +88,19 @@ class SiteadminpanelAction extends AdminPanelAction
     function saveSettings()
     {
         static $settings = array(
-            'site' => array('name', 'broughtby', 'broughtbyurl',
-            'email', 'timezone', 'language',
-            'site', 'textlimit', 'dupelimit'),
+            'site' => array(
+                'name',
+                'broughtby',
+                'broughtbyurl',
+                'email',
+                'timezone',
+                'language',
+                'site',
+                'textlimit',
+                'dupelimit',
+                'logo',
+                'ssllogo'
+            )
         );
 
         $values = array();
@@ -144,6 +154,19 @@ class SiteadminpanelAction extends AdminPanelAction
             $this->clientError(_('Not a valid email address.'));
         }
 
+        // Validate logos
+        if (!empty($values['site']['logo']) &&
+            !Validate::uri($values['site']['logo'], array('allowed_schemes' => array('http', 'https')))) {
+            // TRANS: Client error displayed when a logo URL does is not valid.
+            $this->clientError(_('Invalid logo URL.'));
+        }
+
+        if (!empty($values['site']['ssllogo']) &&
+            !Validate::uri($values['site']['ssllogo'], array('allowed_schemes' => array('https')))) {
+            // TRANS: Client error displayed when an SSL logo URL is invalid.
+            $this->clientError(_('Invalid SSL logo URL.'));
+        }
+
         // Validate timezone
 
         if (is_null($values['site']['timezone']) ||
@@ -251,6 +274,8 @@ class SiteAdminPanelForm extends AdminForm
         $this->out->elementEnd('ul');
         $this->out->elementEnd('fieldset');
 
+        $this->showLogo();
+
         $this->out->elementStart('fieldset', array('id' => 'settings_admin_local'));
         // TRANS: Fieldset legend on site settings panel.
         $this->out->element('legend', null, _m('LEGEND','Local'));
@@ -307,6 +332,35 @@ class SiteAdminPanelForm extends AdminForm
         $this->out->elementEnd('fieldset');
     }
 
+    function showLogo()
+    {
+        $this->out->elementStart('fieldset', array('id' => 'settings_site_logo'));
+        // TRANS: Fieldset legend for form to change logo.
+        $this->out->element('legend', null, _('Logo'));
+
+        $this->out->elementStart('ul', 'form_data');
+
+        $this->li();
+        $this->input('logo',
+                     // TRANS: Field label for StatusNet site logo.
+                     _('Site logo'),
+                     // TRANS: Title for field label for StatusNet site logo.
+                     'Logo for the site (full URL).');
+        $this->unli();
+
+        $this->li();
+        $this->input('ssllogo',
+                     // TRANS: Field label for SSL StatusNet site logo.
+                     _('SSL logo'),
+                     // TRANS: Title for field label for SSL StatusNet site logo.
+                     'Logo to show on SSL pages (full URL).');
+        $this->unli();
+
+        $this->out->elementEnd('ul');
+
+        $this->out->elementEnd('fieldset');
+    }
+
     /**
      * Action elements
      *
diff --git a/actions/userdesignsettings.php b/actions/userdesignsettings.php
deleted file mode 100644 (file)
index c838154..0000000
+++ /dev/null
@@ -1,365 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Change user password
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Settings
- * @package   StatusNet
- * @author    Sarven Capadisli <csarven@status.net>
- * @author    Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR . '/lib/designsettings.php';
-
-/**
- * Set a user's design
- *
- * Saves a design for a given user
- *
- * @category Settings
- * @package  StatusNet
- * @author   Zach Copley <zach@status.net>
- * @author   Sarven Capadisli <csarven@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- */
-class UserDesignSettingsAction extends DesignSettingsAction
-{
-    /**
-     * Sets the right action for the form, and passes request args into
-     * the base action
-     *
-     * @param array $args misc. arguments
-     *
-     * @return boolean true
-     */
-
-    function prepare($args)
-    {
-        parent::prepare($args);
-        $this->submitaction = common_local_url('userdesignsettings');
-        return true;
-    }
-
-    /**
-     * Title of the page
-     *
-     * @return string Title of the page
-     */
-    function title()
-    {
-        // TRANS: Title for profile design page.
-        return _('Profile design');
-    }
-
-    /**
-     * Instructions for use
-     *
-     * @return instructions for use
-     */
-    function getInstructions()
-    {
-        // TRANS: Instructions for Profile design page.
-        return _('Customize the way your profile looks ' .
-        'with a background image and a colour palette of your choice.');
-    }
-
-    /**
-     * Get the design we want to edit
-     *
-     * @return Design
-     */
-    function getWorkingDesign()
-    {
-        $user   = common_current_user();
-        $design = $user->getDesign();
-        return $design;
-    }
-
-    /**
-     * Content area of the page
-     *
-     * Shows a form for changing the design
-     *
-     * @return void
-     */
-    function showContent()
-    {
-        $design = $this->getWorkingDesign();
-
-        if (empty($design)) {
-            $design = Design::siteDesign();
-        }
-
-        $this->showDesignForm($design);
-    }
-
-    /**
-     * Shows the design settings form
-     *
-     * @param Design $design a working design to show
-     *
-     * @return nothing
-     */
-
-    function showDesignForm($design)
-    {
-        $form = new UserDesignForm($this, $design, $this->submitaction);
-        $form->show();
-    }
-
-    /**
-     * Save or update the user's design settings
-     *
-     * @return void
-     */
-    function saveDesign()
-    {
-        $this->saveDesignPreferences();
-
-        foreach ($this->args as $key => $val) {
-            if (preg_match('/(#ho|ho)Td.*g/i', $val)) {
-                $this->sethd();
-                return;
-            }
-        }
-
-        try {
-            $bgcolor = new WebColor($this->trimmed('design_background'));
-            $ccolor  = new WebColor($this->trimmed('design_content'));
-            $sbcolor = new WebColor($this->trimmed('design_sidebar'));
-            $tcolor  = new WebColor($this->trimmed('design_text'));
-            $lcolor  = new WebColor($this->trimmed('design_links'));
-        } catch (WebColorException $e) {
-            $this->showForm($e->getMessage());
-            return;
-        }
-
-        $onoff = $this->arg('design_background-image_onoff');
-
-        $on   = false;
-        $off  = false;
-        $tile = false;
-
-        if ($onoff == 'on') {
-            $on = true;
-        } else {
-            $off = true;
-        }
-
-        $repeat = $this->boolean('design_background-image_repeat');
-
-        if ($repeat) {
-            $tile = true;
-        }
-
-        $user = common_current_user();
-
-        $design = $user->getDesign();
-
-        if (!empty($design)) {
-            $original = clone($design);
-
-            $design->backgroundcolor = $bgcolor->intValue();
-            $design->contentcolor    = $ccolor->intValue();
-            $design->sidebarcolor    = $sbcolor->intValue();
-            $design->textcolor       = $tcolor->intValue();
-            $design->linkcolor       = $lcolor->intValue();
-
-            $design->setDisposition($on, $off, $tile);
-
-            $result = $design->update($original);
-
-            if ($result === false) {
-                common_log_db_error($design, 'UPDATE', __FILE__);
-                // TRANS: Form validation error on Profile design page when updating design settings has failed.
-                $this->showForm(_('Could not update your design.'));
-                return;
-            }
-            // update design
-        } else {
-            $user->query('BEGIN');
-
-            // save new design
-            $design = new Design();
-
-            $design->backgroundcolor = $bgcolor->intValue();
-            $design->contentcolor    = $ccolor->intValue();
-            $design->sidebarcolor    = $sbcolor->intValue();
-            $design->textcolor       = $tcolor->intValue();
-            $design->linkcolor       = $lcolor->intValue();
-
-            $design->setDisposition($on, $off, $tile);
-
-            $id = $design->insert();
-
-            if (empty($id)) {
-                common_log_db_error($id, 'INSERT', __FILE__);
-                // TRANS: Form validation error on Profile design page when saving design settings has failed.
-                $this->showForm(_('Unable to save your design settings.'));
-                return;
-            }
-
-            $original        = clone($user);
-            $user->design_id = $id;
-            $result          = $user->update($original);
-
-            if (empty($result)) {
-                common_log_db_error($original, 'UPDATE', __FILE__);
-                // TRANS: Form validation error on Profile design page when saving design settings has failed.
-                $this->showForm(_('Unable to save your design settings.'));
-                $user->query('ROLLBACK');
-                return;
-            }
-
-            $user->query('COMMIT');
-
-        }
-
-        $this->saveBackgroundImage($design);
-
-        // TRANS: Confirmation message on Profile design page when saving design settings has succeeded.
-        $this->showForm(_('Design preferences saved.'), true);
-    }
-
-    /**
-     * Alternate default colors
-     *
-     * @return nothing
-     */
-    function sethd()
-    {
-        $user   = common_current_user();
-        $design = $user->getDesign();
-
-        $user->query('BEGIN');
-
-        // alternate colors
-        $design = new Design();
-
-        $design->backgroundcolor = 16184329;
-        $design->contentcolor    = 16059904;
-        $design->sidebarcolor    = 16059904;
-        $design->textcolor       = 0;
-        $design->linkcolor       = 16777215;
-
-        $design->setDisposition(false, true, false);
-
-        $id = $design->insert();
-
-        if (empty($id)) {
-            common_log_db_error($id, 'INSERT', __FILE__);
-            // TRANS: Form validation error on Profile design page when saving design settings has failed.
-            $this->showForm(_('Unable to save your design settings.'));
-            return;
-        }
-
-        $original        = clone($user);
-        $user->design_id = $id;
-        $result          = $user->update($original);
-
-        if (empty($result)) {
-            common_log_db_error($original, 'UPDATE', __FILE__);
-            // TRANS: Form validation error on Profile design page when updating design settings has failed.
-            $this->showForm(_('Unable to save your design settings.'));
-            $user->query('ROLLBACK');
-            return;
-        }
-
-        $user->query('COMMIT');
-
-        $this->saveBackgroundImage($design);
-
-        // TRANS: Succes message on Profile design page when finding an easter egg.
-        $this->showForm(_('Enjoy your hotdog!'), true);
-    }
-
-    function saveDesignPreferences()
-    {
-        $viewdesigns = $this->boolean('viewdesigns');
-
-        $user = common_current_user();
-
-        $original = clone($user);
-
-        $user->viewdesigns = $viewdesigns;
-
-        $result = $user->update($original);
-
-        if ($result === false) {
-            common_log_db_error($user, 'UPDATE', __FILE__);
-            // TRANS: Server exception thrown on Profile design page when updating design settings fails.
-            throw new ServerException(_('Could not update user.'));
-        }
-    }
-}
-
-class UserDesignForm extends DesignForm
-{
-    function __construct($out, $design, $actionurl)
-    {
-        parent::__construct($out, $design, $actionurl);
-    }
-
-    /**
-     * Legend of the Form
-     *
-     * @return void
-     */
-    function formLegend()
-    {
-        // TRANS: Form legend on Profile design page.
-        $this->out->element('legend', null, _('Design settings'));
-    }
-
-    /**
-     * Data elements of the form
-     *
-     * @return void
-     */
-
-    function formData()
-    {
-        $user = common_current_user();
-
-        $this->out->elementStart('ul', 'form_data');
-        $this->out->elementStart('li');
-        // TRANS: Checkbox label on Profile design page.
-        $this->out->checkbox('viewdesigns', _('View profile designs'),
-                                                  // TRANS: Title for checkbox on Profile design page.
-                         -                        $user->viewdesigns, _('Show or hide profile designs.'));
-        $this->out->elementEnd('li');
-        $this->out->elementEnd('ul');
-
-        $this->out->elementEnd('fieldset');
-
-        $this->out->elementStart('fieldset');
-        // TRANS: Form legend on Profile design page for form to choose a background image.
-        $this->out->element('legend', null, _('Background file'));
-
-        parent::formData();
-    }
-}
diff --git a/classes/Design.php b/classes/Design.php
deleted file mode 100644 (file)
index 464e244..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-<?php
-/*
- * StatusNet - the distributed open-source microblogging tool
- * Copyright (C) 2009-2011, StatusNet, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-define('BACKGROUND_ON', 1);
-define('BACKGROUND_OFF', 2);
-define('BACKGROUND_TILE', 4);
-
-/**
- * Table Definition for design
- */
-
-require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
-require_once INSTALLDIR . '/lib/webcolor.php';
-
-class Design extends Memcached_DataObject
-{
-    ###START_AUTOCODE
-    /* the code below is auto generated do not remove the above tag */
-
-    public $__table = 'design';                          // table name
-    public $id;                              // int(4)  primary_key not_null
-    public $backgroundcolor;                 // int(4)
-    public $contentcolor;                    // int(4)
-    public $sidebarcolor;                    // int(4)
-    public $textcolor;                       // int(4)
-    public $linkcolor;                       // int(4)
-    public $backgroundimage;                 // varchar(255)
-    public $disposition;                     // tinyint(1)   default_1
-
-    /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); }
-
-    /* the code above is auto generated do not remove the tag below */
-    ###END_AUTOCODE
-
-    function showCSS($out)
-    {
-        $css = '';
-
-        $bgcolor = Design::toWebColor($this->backgroundcolor);
-
-        if (!empty($bgcolor)) {
-            $css .= 'body { background-color: #' . $bgcolor->hexValue() . ' }' . "\n";
-        }
-
-        $ccolor  = Design::toWebColor($this->contentcolor);
-
-        if (!empty($ccolor)) {
-            $css .= '#content { background-color: #';
-            $css .= $ccolor->hexValue() . '} '."\n";
-        }
-
-        $sbcolor = Design::toWebColor($this->sidebarcolor);
-
-        if (!empty($sbcolor)) {
-            $css .= '#aside_primary_wrapper, #site_nav_local_views_wrapper { background-color: #'. $sbcolor->hexValue() . ' }' . "\n";
-        }
-
-        $tcolor  = Design::toWebColor($this->textcolor);
-
-        if (!empty($tcolor)) {
-            $css .= 'html body { color: #'. $tcolor->hexValue() . ' }'. "\n";
-        }
-
-        $lcolor  = Design::toWebColor($this->linkcolor);
-
-        if (!empty($lcolor)) {
-            $css .= 'a { color: #' . $lcolor->hexValue() . ' }' . "\n";
-        }
-
-        if (!empty($this->backgroundimage) &&
-            $this->disposition & BACKGROUND_ON) {
-
-           $repeat = ($this->disposition & BACKGROUND_TILE) ?
-               'background-repeat:repeat;' :
-               'background-repeat:no-repeat;';
-
-            $css .= 'body { background-image:url(' .
-                Design::url($this->backgroundimage) .
-                '); ' . $repeat . ' background-attachment:fixed; }' . "\n";
-        }
-
-        if (0 != mb_strlen($css)) {
-            $out->style($css);
-        }
-    }
-
-    static function toWebColor($color)
-    {
-        if ($color === null || $color === '') {
-            return null;
-        }
-
-        try {
-            return new WebColor($color);
-        } catch (WebColorException $e) {
-            // This shouldn't happen
-            common_log(LOG_ERR, "Unable to create web color for $color",
-                __FILE__);
-            return null;
-        }
-    }
-
-    static function filename($id, $extension, $extra=null)
-    {
-        return $id . (($extra) ? ('-' . $extra) : '') . $extension;
-    }
-
-    static function path($filename)
-    {
-        $dir = common_config('background', 'dir');
-
-        if ($dir[strlen($dir)-1] != '/') {
-            $dir .= '/';
-        }
-
-        return $dir . $filename;
-    }
-
-    static function url($filename)
-    {
-        if (StatusNet::isHTTPS()) {
-
-            $sslserver = common_config('background', 'sslserver');
-
-            if (empty($sslserver)) {
-                // XXX: this assumes that background dir == site dir + /background/
-                // not true if there's another server
-                if (is_string(common_config('site', 'sslserver')) &&
-                    mb_strlen(common_config('site', 'sslserver')) > 0) {
-                    $server = common_config('site', 'sslserver');
-                } else if (common_config('site', 'server')) {
-                    $server = common_config('site', 'server');
-                }
-                $path   = common_config('site', 'path') . '/background/';
-            } else {
-                $server = $sslserver;
-                $path   = common_config('background', 'sslpath');
-                if (empty($path)) {
-                    $path = common_config('background', 'path');
-                }
-            }
-
-            $protocol = 'https';
-
-        } else {
-
-            $path = common_config('background', 'path');
-
-            $server = common_config('background', 'server');
-
-            if (empty($server)) {
-                $server = common_config('site', 'server');
-            }
-
-            $protocol = 'http';
-        }
-
-        if ($path[strlen($path)-1] != '/') {
-            $path .= '/';
-        }
-
-        if ($path[0] != '/') {
-            $path = '/'.$path;
-        }
-
-        return $protocol.'://'.$server.$path.$filename;
-    }
-
-    function setDisposition($on, $off, $tile)
-    {
-        if ($on) {
-            $this->disposition |= BACKGROUND_ON;
-        } else {
-            $this->disposition &= ~BACKGROUND_ON;
-        }
-
-        if ($off) {
-            $this->disposition |= BACKGROUND_OFF;
-        } else {
-            $this->disposition &= ~BACKGROUND_OFF;
-        }
-
-        if ($tile) {
-            $this->disposition |= BACKGROUND_TILE;
-        } else {
-            $this->disposition &= ~BACKGROUND_TILE;
-        }
-    }
-
-    /**
-     * Return a design object based on the configured site design.
-     *
-     * @return Design a singleton design object for the site.
-     */
-
-    static function siteDesign()
-    {
-        static $siteDesign = null;
-
-        if (empty($siteDesign)) {
-
-            $siteDesign = new Design();
-
-            $attrs = array('backgroundcolor',
-                           'contentcolor',
-                           'sidebarcolor',
-                           'textcolor',
-                           'linkcolor',
-                           'backgroundimage',
-                           'disposition');
-
-            foreach ($attrs as $attr) {
-                $val = common_config('design', $attr);
-                if ($val !== false) {
-                    $siteDesign->$attr = $val;
-                }
-            }
-        }
-
-        return $siteDesign;
-    }
-}
index 9f7954932738909aabe3c4f64600605744cb1b5d..d15c2c0ae6979c3fe96f5a553d1d8378eba07da4 100644 (file)
@@ -61,8 +61,6 @@ class User extends Memcached_DataObject
     public $subscribe_policy;                // tinyint(1)
     public $urlshorteningservice;            // varchar(50)   default_ur1.ca
     public $inboxed;                         // tinyint(1)
-    public $design_id;                       // int(4)
-    public $viewdesigns;                     // tinyint(1)   default_1
     public $private_stream;                  // tinyint(1)   default_0
     public $created;                         // datetime()   not_null
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
@@ -293,7 +291,6 @@ class User extends Memcached_DataObject
         $user->emailmicroid = 1;
         $user->emailpost = 1;
         $user->jabbermicroid = 1;
-        $user->viewdesigns = 1;
 
         $user->created = common_sql_now();
 
@@ -714,11 +711,6 @@ class User extends Memcached_DataObject
         return $profile;
     }
 
-    function getDesign()
-    {
-        return Design::staticGet('id', $this->design_id);
-    }
-
     function hasRight($right)
     {
         $profile = $this->getProfile();
@@ -1008,4 +1000,97 @@ class User extends Memcached_DataObject
         $skip = array('_profile');
         return array_diff($vars, $skip);
     }
+
+    static function recoverPassword($nore)
+    {
+        $user = User::staticGet('email', common_canonical_email($nore));
+
+        if (!$user) {
+            try {
+                $user = User::staticGet('nickname', common_canonical_nickname($nore));
+            } catch (NicknameException $e) {
+                // invalid
+            }
+        }
+
+        // See if it's an unconfirmed email address
+
+        if (!$user) {
+            // Warning: it may actually be legit to have multiple folks
+            // who have claimed, but not yet confirmed, the same address.
+            // We'll only send to the first one that comes up.
+            $confirm_email = new Confirm_address();
+            $confirm_email->address = common_canonical_email($nore);
+            $confirm_email->address_type = 'email';
+            $confirm_email->find();
+            if ($confirm_email->fetch()) {
+                $user = User::staticGet($confirm_email->user_id);
+            } else {
+                $confirm_email = null;
+            }
+        } else {
+            $confirm_email = null;
+        }
+
+        if (!$user) {
+            // TRANS: Information on password recovery form if no known username or e-mail address was specified.
+            throw new ClientError(_('No user with that email address or username.'));
+            return;
+        }
+
+        // Try to get an unconfirmed email address if they used a user name
+
+        if (!$user->email && !$confirm_email) {
+            $confirm_email = new Confirm_address();
+            $confirm_email->user_id = $user->id;
+            $confirm_email->address_type = 'email';
+            $confirm_email->find();
+            if (!$confirm_email->fetch()) {
+                $confirm_email = null;
+            }
+        }
+
+        if (!$user->email && !$confirm_email) {
+            // TRANS: Client error displayed on password recovery form if a user does not have a registered e-mail address.
+            throw new ClientException(_('No registered email address for that user.'));
+            return;
+        }
+
+        // Success! We have a valid user and a confirmed or unconfirmed email address
+
+        $confirm = new Confirm_address();
+        $confirm->code = common_confirmation_code(128);
+        $confirm->address_type = 'recover';
+        $confirm->user_id = $user->id;
+        $confirm->address = (!empty($user->email)) ? $user->email : $confirm_email->address;
+
+        if (!$confirm->insert()) {
+            common_log_db_error($confirm, 'INSERT', __FILE__);
+            // TRANS: Server error displayed if e-mail address confirmation fails in the database on the password recovery form.
+            throw new ServerException(_('Error saving address confirmation.'));
+            return;
+        }
+
+         // @todo FIXME: needs i18n.
+        $body = "Hey, $user->nickname.";
+        $body .= "\n\n";
+        $body .= 'Someone just asked for a new password ' .
+                 'for this account on ' . common_config('site', 'name') . '.';
+        $body .= "\n\n";
+        $body .= 'If it was you, and you want to confirm, use the URL below:';
+        $body .= "\n\n";
+        $body .= "\t".common_local_url('recoverpassword',
+                                   array('code' => $confirm->code));
+        $body .= "\n\n";
+        $body .= 'If not, just ignore this message.';
+        $body .= "\n\n";
+        $body .= 'Thanks for your time, ';
+        $body .= "\n";
+        $body .= common_config('site', 'name');
+        $body .= "\n";
+
+        $headers = _mail_prepare_headers('recoverpassword', $user->nickname, $user->nickname);
+        // TRANS: Subject for password recovery e-mail.
+        mail_to_user($user, _('Password recovery requested'), $body, $headers, $confirm->address);
+    }
 }
index 75de535bd139d6ca058bf7f020d3d786555b7bbb..6168f219b998d51a022a9bb93d6efd51ae2c8724 100644 (file)
@@ -22,7 +22,6 @@ class User_group extends Memcached_DataObject
     public $homepage_logo;                   // varchar(255)
     public $stream_logo;                     // varchar(255)
     public $mini_logo;                       // varchar(255)
-    public $design_id;                       // int(4)
     public $created;                         // datetime   not_null default_0000-00-00%2000%3A00%3A00
     public $modified;                        // timestamp   not_null default_CURRENT_TIMESTAMP
     public $uri;                             // varchar(255)  unique_key
@@ -339,11 +338,6 @@ class User_group extends Memcached_DataObject
         return null;
     }
 
-    function getDesign()
-    {
-        return Design::staticGet('id', $this->design_id);
-    }
-
     function getUserMembers()
     {
         // XXX: cache this
index fe9f4735d9b4467e7cad71eb326d0bf4ff3f8123..a9632fe8d4dbb4a6bcb21b032e467d22b1392318 100644 (file)
@@ -121,8 +121,6 @@ $schema['user'] = array(
         'subscribe_policy' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'),
         'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
         'inboxed' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'has an inbox been created for this user?'),
-        'design_id' => array('type' => 'int', 'description' => 'id of a design'),
-        'viewdesigns' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'whether to view user-provided designs'),
         'private_stream' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to limit all notices to followers only'),
 
         'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
@@ -139,7 +137,6 @@ $schema['user'] = array(
     'foreign keys' => array(
         'user_id_fkey' => array('profile', array('id' => 'id')),
         'user_carrier_fkey' => array('sms_carrier', array('carrier' => 'id')),
-        'user_design_id_fkey' => array('design', array('design_id' => 'id')),
     ),
     'indexes' => array(
         'user_smsemail_idx' => array('smsemail'),
@@ -721,7 +718,6 @@ $schema['user_group'] = array(
         'homepage_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'homepage (profile) size logo'),
         'stream_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'stream-sized logo'),
         'mini_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'mini logo'),
-        'design_id' => array('type' => 'int', 'description' => 'id of a design'),
 
         'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
         'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
@@ -735,9 +731,6 @@ $schema['user_group'] = array(
     'unique keys' => array(
         'user_group_uri_key' => array('uri'),
     ),
-    'foreign keys' => array(
-        'user_group_design_id_fkey' => array('design', array('design_id' => 'id')),
-    ),
     'indexes' => array(
         'user_group_nickname_idx' => array('nickname'),
     ),
@@ -886,20 +879,6 @@ $schema['file_to_post'] = array(
     ),
 );
 
-$schema['design'] = array(
-    'fields' => array(
-        'id' => array('type' => 'serial', 'not null' => true, 'description' => 'design ID'),
-        'backgroundcolor' => array('type' => 'int', 'description' => 'main background color'),
-        'contentcolor' => array('type' => 'int', 'description' => 'content area background color'),
-        'sidebarcolor' => array('type' => 'int', 'description' => 'sidebar background color'),
-        'textcolor' => array('type' => 'int', 'description' => 'text color'),
-        'linkcolor' => array('type' => 'int', 'description' => 'link color'),
-        'backgroundimage' => array('type' => 'varchar', 'length' => 255, 'description' => 'background image, if any'),
-        'disposition' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'),
-    ),
-    'primary key' => array('id'),
-);
-
 $schema['group_block'] = array(
     'fields' => array(
         'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
index 81aa8eb12c2b5bf26510cfa0b10137fac839fbc2..21e5f78db13567c0e406c922ca77382c2e62d54b 100644 (file)
@@ -246,20 +246,6 @@ class Action extends HTMLOutputter // lawsuit
                 Event::handle('EndShowUAStyles', array($this));
             }
 
-            if (Event::handle('StartShowDesign', array($this))) {
-
-                $user = common_current_user();
-
-                if (empty($user) || $user->viewdesigns) {
-                    $design = $this->getDesign();
-
-                    if (!empty($design)) {
-                        $design->showCSS($this);
-                    }
-                }
-
-                Event::handle('EndShowDesign', array($this));
-            }
             Event::handle('EndShowStyles', array($this));
 
             if (common_config('custom_css', 'enabled')) {
@@ -1365,13 +1351,16 @@ class Action extends HTMLOutputter // lawsuit
     {
         // Added @id to li for some control.
         // XXX: We might want to move this to htmloutputter.php
-        $lattrs = array();
+        $lattrs  = array();
+        $classes = array();
         if ($class !== null) {
-            $lattrs['class'] = $class;
-            if ($is_selected) {
-                $lattrs['class'] = trim('current ' . $lattrs['class']);
-            }
+            $classes[] = trim($class);
         }
+        if ($is_selected) {
+            $classes[] = 'current';
+        }
+
+        $lattrs['class'] = implode(' ', $classes);
 
         (is_null($id)) ? $lattrs : $lattrs['id'] = $id;
 
@@ -1442,16 +1431,6 @@ class Action extends HTMLOutputter // lawsuit
         return null;
     }
 
-    /**
-     * A design for this action
-     *
-     * @return Design a design object to use
-     */
-    function getDesign()
-    {
-        return Design::siteDesign();
-    }
-
     /**
      * Check the session token.
      *
index 5642c68d629139c382d8cdc2056a8894ea7eff98..4868e9d492de116af2ba5b785f1185d7af17ca3c 100644 (file)
@@ -251,35 +251,6 @@ class AdminPanelAction extends Action
         return;
     }
 
-    /**
-     * Delete a design setting
-     *
-     * // XXX: Maybe this should go in Design? --Z
-     *
-     * @return mixed $result false if something didn't work
-     */
-    function deleteSetting($section, $setting)
-    {
-        $config = new Config();
-
-        $config->section = $section;
-        $config->setting = $setting;
-
-        if ($config->find(true)) {
-            $result = $config->delete();
-            if (!$result) {
-                common_log_db_error($config, 'DELETE', __FILE__);
-                // TRANS: Client error message thrown if design settings could not be deleted in
-                // TRANS: the admin panel Design.
-                $this->clientError(_("Unable to delete design setting."));
-                return null;
-            }
-            return $result;
-        }
-
-        return null;
-    }
-
     function canAdmin($name)
     {
         $isOK = false;
index 245438c614d9af798a06318931b87fcd279d9d9d..40c4889f27afd6fd6905a363b1e38a69514fa3b6 100644 (file)
@@ -94,14 +94,6 @@ class AdminPanelNav extends Menu
                                      $menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
             }
 
-            if (AdminPanelAction::canAdmin('design')) {
-                // TRANS: Menu item title in administrator navigation panel.
-                $menu_title = _('Design configuration');
-                // TRANS: Menu item in administrator navigation panel.
-                $this->out->menuItem(common_local_url('designadminpanel'), _m('MENU', 'Design'),
-                                     $menu_title, $action_name == 'designadminpanel', 'nav_design_admin_panel');
-            }
-
             if (AdminPanelAction::canAdmin('user')) {
                 // TRANS: Menu item title in administrator navigation panel.
                 $menu_title = _('User configuration');
@@ -163,7 +155,7 @@ class AdminPanelNav extends Menu
                 $menu_title = _('Plugins configuration');
                 // TRANS: Menu item in administrator navigation panel.
                 $this->out->menuItem(common_local_url('pluginsadminpanel'), _m('MENU','Plugins'),
-                                     $menu_title, $action_name == 'pluginsadminpanel', 'nav_design_admin_panel');
+                                     $menu_title, $action_name == 'pluginsadminpanel', 'nav_plugin_admin_panel');
             }
 
             Event::handle('EndAdminPanelNav', array($this));
index c0e5095fd5030153ed71275f34e477bba47f64db..64b4284f6aa1e2eb4e57ddc00efa3e0e88ea7d2b 100644 (file)
@@ -218,30 +218,8 @@ class ApiAction extends Action
         $twitter_user['protected'] = ($user->private_stream) ? true : false;
         $twitter_user['followers_count'] = $profile->subscriberCount();
 
-        $design = null;
-
         // Note: some profiles don't have an associated user
 
-        $defaultDesign = Design::siteDesign();
-
-        if (!empty($user)) {
-            $design = $user->getDesign();
-        }
-
-        if (empty($design)) {
-            $design = $defaultDesign;
-        }
-
-        $color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor);
-        $twitter_user['profile_background_color'] = ($color == null) ? '' : '#'.$color->hexValue();
-        $color = Design::toWebColor(empty($design->textcolor) ? $defaultDesign->textcolor : $design->textcolor);
-        $twitter_user['profile_text_color'] = ($color == null) ? '' : '#'.$color->hexValue();
-        $color = Design::toWebColor(empty($design->linkcolor) ? $defaultDesign->linkcolor : $design->linkcolor);
-        $twitter_user['profile_link_color'] = ($color == null) ? '' : '#'.$color->hexValue();
-        $color = Design::toWebColor(empty($design->sidebarcolor) ? $defaultDesign->sidebarcolor : $design->sidebarcolor);
-        $twitter_user['profile_sidebar_fill_color'] = ($color == null) ? '' : '#'.$color->hexValue();
-        $twitter_user['profile_sidebar_border_color'] = '';
-
         $twitter_user['friends_count'] = $profile->subscriptionCount();
 
         $twitter_user['created_at'] = $this->dateTwitter($profile->created);
@@ -259,15 +237,6 @@ class ApiAction extends Action
 
         $twitter_user['utc_offset'] = $t->format('Z');
         $twitter_user['time_zone'] = $timezone;
-
-        $twitter_user['profile_background_image_url']
-            = empty($design->backgroundimage)
-            ? '' : ($design->disposition & BACKGROUND_ON)
-            ? Design::url($design->backgroundimage) : '';
-
-        $twitter_user['profile_background_tile']
-            = (bool)($design->disposition & BACKGROUND_TILE);
-
         $twitter_user['statuses_count'] = $profile->noticeCount();
 
         // Is the requesting user following this user?
diff --git a/lib/currentuserdesignaction.php b/lib/currentuserdesignaction.php
deleted file mode 100644 (file)
index e84c777..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Base class for actions that use the current user's design
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Action
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @copyright 2009-2010 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-/**
- * Base class for actions that use the current user's design
- *
- * Some pages (settings in particular) use the current user's chosen
- * design. This superclass returns that design.
- *
- * @category Action
- * @package  StatusNet
- * @author   Evan Prodromou <evan@status.net>
- * @author   Zach Copley    <zach@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- *
- */
-class CurrentUserDesignAction extends Action
-{
-
-    protected $cur = null; // The current user
-
-    /**
-     * For initializing members of the class. Set a the
-     * current user here.
-     *
-     * @param array $argarray misc. arguments
-     *
-     * @return boolean true
-     */
-    function prepare($argarray)
-    {
-        parent::prepare($argarray);
-
-        $this->cur = common_current_user();
-
-       return true;
-    }
-
-    /**
-     * A design for this action
-     *
-     * Returns the design preferences for the current user.
-     *
-     * @return Design a design object to use
-     */
-    function getDesign()
-    {
-        if (!empty($this->cur)) {
-
-            $design = $this->cur->getDesign();
-
-            if (!empty($design)) {
-                return $design;
-            }
-        }
-
-        return parent::getDesign();
-    }
-
-    function getCurrentUser()
-    {
-       return $this->cur;
-    }
-}
-
index cdd8e5460da7bd5bfeb5db2d0113e11cb5cb1074..938716b3a4361cda496a94946eae67fa8ef444e0 100644 (file)
@@ -286,17 +286,6 @@ $default =
         array('handle' => false,   // whether to handle sessions ourselves
               'debug' => false,    // debugging output for sessions
               'gc_limit' => 1000), // max sessions to expire at a time
-        'design' =>
-        array('backgroundcolor' => null, // null -> 'use theme default'
-              'contentcolor' => null,
-              'sidebarcolor' => null,
-              'textcolor' => null,
-              'linkcolor' => null,
-              'backgroundimage' => null,
-              'disposition' => null),
-        'custom_css' =>
-        array('enabled' => true,
-              'css' => ''),
         'notice' =>
         array('contentlimit' => null,
               'defaultscope' => 0), // set to 0 for default open
@@ -330,7 +319,7 @@ $default =
               ),
         'pluginlist' => array(),
         'admin' =>
-        array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license', 'plugins')),
+        array('panels' => array('site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license', 'plugins')),
         'singleuser' =>
         array('enabled' => false,
               'nickname' => null),
diff --git a/lib/designform.php b/lib/designform.php
deleted file mode 100644 (file)
index a584b61..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Form for choosing a design
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Form
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @author    Sarven Capadisli <csarven@status.net>
- * @copyright 2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-/**
- * Form for choosing a design
- *
- * Used for choosing a site design, user design, or group design.
- *
- * @category Form
- * @package  StatusNet
- * @author   Evan Prodromou <evan@status.net>
- * @author   Sarven Capadisli <csarven@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- *
- */
-class DesignForm extends Form
-{
-    /**
-     * Return-to args
-     */
-
-    var $design     = null;
-    var $actionurl  = null;
-
-    /**
-     * Constructor
-     *
-     * @param HTMLOutputter $out       output channel
-     * @param Design        $design    initial design
-     * @param Design        $actionurl url of action (for form posting)
-     */
-    function __construct($out, $design, $actionurl)
-    {
-        parent::__construct($out);
-
-        $this->design     = $design;
-        $this->actionurl = $actionurl;
-    }
-
-    /**
-     * ID of the form
-     *
-     * @return int ID of the form
-     */
-    function id()
-    {
-        return 'design';
-    }
-
-    /**
-     * class of the form
-     *
-     * @return string class of the form
-     */
-    function formClass()
-    {
-        return 'form_design';
-    }
-
-    /**
-     * Action of the form
-     *
-     * @return string URL of the action
-     */
-    function action()
-    {
-        return $this->actionurl;
-    }
-
-    /**
-     * Legend of the Form
-     *
-     * @return void
-     */
-    function formLegend()
-    {
-        // TRANS: Form legend of form for changing the page design.
-        $this->out->element('legend', null, _('Change design'));
-    }
-
-    /**
-     * Data elements of the form
-     *
-     * @return void
-     */
-    function formData()
-    {
-        $this->backgroundData();
-
-        $this->out->elementEnd('fieldset');
-
-        $this->out->elementStart('fieldset', array('id' => 'settings_design_color'));
-        // TRANS: Fieldset legend on profile design page to change profile page colours.
-        $this->out->element('legend', null, _('Change colours'));
-        $this->colourData();
-        $this->out->elementEnd('fieldset');
-
-        $this->out->elementStart('fieldset');
-
-        // TRANS: Button text on profile design page to immediately reset all colour settings to default.
-        $this->out->submit('defaults', _('Use defaults'), 'submit form_action-default',
-                           // TRANS: Title for button on profile design page to reset all colour settings to default.
-                           'defaults', _('Restore default designs.'));
-
-        $this->out->element('input', array('id' => 'settings_design_reset',
-                                           'type' => 'reset',
-                                           // TRANS: Button text on profile design page to reset all colour settings to default without saving.
-                                           'value' => _m('BUTTON', 'Reset'),
-                                           'class' => 'submit form_action-primary',
-                                           // TRANS: Title for button on profile design page to reset all colour settings to default without saving.
-                                           'title' => _('Reset back to default.')));
-    }
-
-    function backgroundData()
-    {
-        $this->out->elementStart('ul', 'form_data');
-        $this->out->elementStart('li');
-        $this->out->element('label', array('for' => 'design_background-image_file'),
-                            // TRANS: Label in form on profile design page.
-                            // TRANS: Field contains file name on user's computer that could be that user's custom profile background image.
-                            _('Upload file'));
-        $this->out->element('input', array('name' => 'design_background-image_file',
-                                           'type' => 'file',
-                                           'id' => 'design_background-image_file'));
-        // TRANS: Instructions for form on profile design page.
-        $this->out->element('p', 'form_guide', _('You can upload your personal ' .
-                                                 'background image. The maximum file size is 2MB.'));
-        $this->out->element('input', array('name' => 'MAX_FILE_SIZE',
-                                           'type' => 'hidden',
-                                           'id' => 'MAX_FILE_SIZE',
-                                           'value' => ImageFile::maxFileSizeInt()));
-        $this->out->elementEnd('li');
-
-        if (!empty($this->design->backgroundimage)) {
-
-            $this->out->elementStart('li', array('id' =>
-                                                 'design_background-image_onoff'));
-
-            $this->out->element('img', array('src' =>
-                                             Design::url($this->design->backgroundimage)));
-
-            $attrs = array('name' => 'design_background-image_onoff',
-                           'type' => 'radio',
-                           'id' => 'design_background-image_on',
-                           'class' => 'radio',
-                           'value' => 'on');
-
-            if ($this->design->disposition & BACKGROUND_ON) {
-                $attrs['checked'] = 'checked';
-            }
-
-            $this->out->element('input', $attrs);
-
-            $this->out->element('label', array('for' => 'design_background-image_on',
-                                               'class' => 'radio'),
-                                // TRANS: Radio button on profile design page that will enable use of the uploaded profile image.
-                                _m('RADIO', 'On'));
-
-            $attrs = array('name' => 'design_background-image_onoff',
-                           'type' => 'radio',
-                           'id' => 'design_background-image_off',
-                           'class' => 'radio',
-                           'value' => 'off');
-
-            if ($this->design->disposition & BACKGROUND_OFF) {
-                $attrs['checked'] = 'checked';
-            }
-
-            $this->out->element('input', $attrs);
-
-            $this->out->element('label', array('for' => 'design_background-image_off',
-                                               'class' => 'radio'),
-                                // TRANS: Radio button on profile design page that will disable use of the uploaded profile image.
-                                _m('RADIO', 'Off'));
-            // TRANS: Form guide for a set of radio buttons on the profile design page that will enable or disable
-            // TRANS: use of the uploaded profile image.
-            $this->out->element('p', 'form_guide', _('Turn background image on or off.'));
-            $this->out->elementEnd('li');
-
-            $this->out->elementStart('li');
-            $this->out->checkbox('design_background-image_repeat',
-                                 // TRANS: Checkbox label on profile design page that will cause the profile image to be tiled.
-                                 _('Tile background image'),
-                                 ($this->design->disposition & BACKGROUND_TILE) ? true : false);
-            $this->out->elementEnd('li');
-        }
-
-        $this->out->elementEnd('ul');
-    }
-
-    function colourData()
-    {
-        $this->out->elementStart('ul', 'form_data');
-
-        try {
-
-            $bgcolor = new WebColor($this->design->backgroundcolor);
-
-            $this->out->elementStart('li');
-            // TRANS: Label on profile design page for setting a profile page background colour.
-            $this->out->element('label', array('for' => 'swatch-1'), _('Background'));
-            $this->out->element('input', array('name' => 'design_background',
-                                               'type' => 'text',
-                                               'id' => 'swatch-1',
-                                               'class' => 'swatch',
-                                               'maxlength' => '7',
-                                               'size' => '7',
-                                               'value' => ''));
-            $this->out->elementEnd('li');
-
-            $ccolor = new WebColor($this->design->contentcolor);
-
-            $this->out->elementStart('li');
-            // TRANS: Label on profile design page for setting a profile page content colour.
-            $this->out->element('label', array('for' => 'swatch-2'), _('Content'));
-            $this->out->element('input', array('name' => 'design_content',
-                                               'type' => 'text',
-                                               'id' => 'swatch-2',
-                                               'class' => 'swatch',
-                                               'maxlength' => '7',
-                                               'size' => '7',
-                                               'value' => ''));
-            $this->out->elementEnd('li');
-
-            $sbcolor = new WebColor($this->design->sidebarcolor);
-
-            $this->out->elementStart('li');
-            // TRANS: Label on profile design page for setting a profile page sidebar colour.
-            $this->out->element('label', array('for' => 'swatch-3'), _('Sidebar'));
-            $this->out->element('input', array('name' => 'design_sidebar',
-                                               'type' => 'text',
-                                               'id' => 'swatch-3',
-                                               'class' => 'swatch',
-                                               'maxlength' => '7',
-                                               'size' => '7',
-                                               'value' => ''));
-            $this->out->elementEnd('li');
-
-            $tcolor = new WebColor($this->design->textcolor);
-
-            $this->out->elementStart('li');
-            // TRANS: Label on profile design page for setting a profile page text colour.
-            $this->out->element('label', array('for' => 'swatch-4'), _('Text'));
-            $this->out->element('input', array('name' => 'design_text',
-                                               'type' => 'text',
-                                               'id' => 'swatch-4',
-                                               'class' => 'swatch',
-                                               'maxlength' => '7',
-                                               'size' => '7',
-                                               'value' => ''));
-            $this->out->elementEnd('li');
-
-            $lcolor = new WebColor($this->design->linkcolor);
-
-            $this->out->elementStart('li');
-            // TRANS: Label on profile design page for setting a profile page links colour.
-            $this->out->element('label', array('for' => 'swatch-5'), _('Links'));
-            $this->out->element('input', array('name' => 'design_links',
-                                               'type' => 'text',
-                                               'id' => 'swatch-5',
-                                               'class' => 'swatch',
-                                               'maxlength' => '7',
-                                               'size' => '7',
-                                               'value' => ''));
-            $this->out->elementEnd('li');
-
-        } catch (WebColorException $e) {
-            common_log(LOG_ERR, 'Bad color values in design ID: ' .$this->design->id);
-        }
-
-        $this->out->elementEnd('ul');
-    }
-
-    /**
-     * Action elements
-     *
-     * @return void
-     */
-
-    function formActions()
-    {
-        // TRANS: Button text on profile design page to save settings.
-        $this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary',
-                           // TRANS: Title for button on profile design page to save settings.
-                           'save', _('Save design.'));
-    }
-}
diff --git a/lib/designsettings.php b/lib/designsettings.php
deleted file mode 100644 (file)
index cb65ca1..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Change user password
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Settings
- * @package   StatusNet
- * @author    Sarven Capadisli <csarven@status.net>
- * @author    Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-/**
- * Base class for setting a user or group design
- *
- * Shows the design setting form and also handles some things like saving
- * background images, and fetching a default design
- *
- * @category Settings
- * @package  StatusNet
- * @author   Zach Copley <zach@status.net>
- * @author   Sarven Capadisli <csarven@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- */
-
-class DesignSettingsAction extends SettingsAction
-{
-    var $submitaction = null;
-
-    /**
-     * Title of the page
-     *
-     * @return string Title of the page
-     */
-    function title()
-    {
-        // TRANS: Page title for profile design page.
-        return _('Profile design');
-    }
-
-    /**
-     * Instructions for use
-     *
-     * @return instructions for use
-     */
-    function getInstructions()
-    {
-        // TRANS: Instructions for profile design page.
-        return _('Customize the way your profile looks ' .
-        'with a background image and a colour palette of your choice.');
-    }
-
-    /**
-     * Shows the design settings form
-     *
-     * @param Design $design a working design to show
-     *
-     * @return nothing
-     */
-    function showDesignForm($design)
-    {
-        $form = new DesignForm($this, $design, $this->selfUrl());
-        $form->show();
-
-    }
-
-    /**
-     * Handle a post
-     *
-     * Validate input and save changes. Reload the form with a success
-     * or error message.
-     *
-     * @return void
-     */
-    function handlePost()
-    {
-        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-
-            // Workaround for PHP returning empty $_POST and $_FILES when POST
-            // length > post_max_size in php.ini
-
-            if (empty($_FILES)
-                && empty($_POST)
-                && ($_SERVER['CONTENT_LENGTH'] > 0)
-            ) {
-                // TRANS: Form validation error in design settings form. POST should remain untranslated.
-                $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
-                          'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
-                          intval($_SERVER['CONTENT_LENGTH']));
-
-                $this->showForm(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
-                return;
-            }
-        }
-
-        // CSRF protection
-        $token = $this->trimmed('token');
-        if (!$token || $token != common_session_token()) {
-            // TRANS: Client error displayed when the session token does not match or is not given.
-            $this->showForm(_('There was a problem with your session token. '.
-                              'Try again, please.'));
-            return;
-        }
-
-        if ($this->arg('save')) {
-            $this->saveDesign();
-        } else if ($this->arg('defaults')) {
-            $this->restoreDefaults();
-        } else {
-            // TRANS: Unknown form validation error in design settings form.
-            $this->showForm(_('Unexpected form submission.'));
-        }
-    }
-
-    /**
-     * Add the Farbtastic stylesheet
-     *
-     * @return void
-     */
-    function showStylesheets()
-    {
-        parent::showStylesheets();
-        $this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv');
-    }
-
-    /**
-     * Add the Farbtastic scripts
-     *
-     * @return void
-     */
-    function showScripts()
-    {
-        parent::showScripts();
-
-        $this->script('farbtastic/farbtastic.js');
-        $this->script('userdesign.go.js');
-
-        $this->autofocus('design_background-image_file');
-    }
-
-    /**
-     * Save the background image, if any, and set its disposition
-     *
-     * @param Design $design a working design to attach the img to
-     *
-     * @return nothing
-     */
-    function saveBackgroundImage($design)
-    {
-        // Now that we have a Design ID we can add a file to the design.
-        // XXX: This is an additional DB hit, but figured having the image
-        // associated with the Design rather than the User was worth
-        // it. -- Zach
-
-        if (array_key_exists('design_background-image_file', $_FILES) &&
-          $_FILES['design_background-image_file']['error'] == UPLOAD_ERR_OK) {
-
-            $filepath = null;
-
-            try {
-                $imagefile = ImageFile::fromUpload('design_background-image_file');
-            } catch (Exception $e) {
-                $this->showForm($e->getMessage());
-                return;
-            }
-
-            $filename = Design::filename($design->id,
-                                         image_type_to_extension($imagefile->type),
-                                         common_timestamp());
-
-            $filepath = Design::path($filename);
-
-            move_uploaded_file($imagefile->filepath, $filepath);
-
-            // delete any old backround img laying around
-
-            if (isset($design->backgroundimage)) {
-                @unlink(Design::path($design->backgroundimage));
-            }
-
-            $original = clone($design);
-
-            $design->backgroundimage = $filename;
-
-            // default to on, no tile
-
-            $design->setDisposition(true, false, false);
-
-            $result = $design->update($original);
-
-            if ($result === false) {
-                common_log_db_error($design, 'UPDATE', __FILE__);
-                // TRANS: Error message displayed if design settings could not be saved.
-                $this->showForm(_('Could not update your design.'));
-                return;
-            }
-        }
-    }
-
-    /**
-     * Restore the user or group design to system defaults
-     *
-     * @return nothing
-     */
-    function restoreDefaults()
-    {
-        $design = $this->getWorkingDesign();
-
-        if (!empty($design)) {
-
-            $result = $design->delete();
-
-            if ($result === false) {
-                common_log_db_error($design, 'DELETE', __FILE__);
-                // TRANS: Error message displayed if design settings could not be saved after clicking "Use defaults".
-                $this->showForm(_('Could not update your design.'));
-                return;
-            }
-        }
-
-        // TRANS: Success message displayed if design settings were saved after clicking "Use defaults".
-        $this->showForm(_('Design defaults restored.'), true);
-    }
-}
diff --git a/lib/groupaction.php b/lib/groupaction.php
new file mode 100644 (file)
index 0000000..d9eea44
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Base class for group actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Action
+ * @package   StatusNet
+ * @author    Zach Copley <zach@status.net>
+ * @copyright 2009-2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Base class for group actions, similar to ProfileAction
+ *
+ * @category Action
+ * @package  StatusNet
+ * @author   Zach Copley <zach@status.net>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://status.net/
+ *
+ */
+class GroupAction extends Action {
+
+    function showProfileBlock()
+    {
+        $block = new GroupProfileBlock($this, $this->group);
+        $block->show();
+    }
+}
diff --git a/lib/groupdesignaction.php b/lib/groupdesignaction.php
deleted file mode 100644 (file)
index 44f35f6..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Base class for actions that use the current user's design
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Action
- * @package   StatusNet
- * @author    Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-/**
- * Base class for actions that use a group's design
- *
- * Pages related to groups can be themed with a design.
- * This superclass returns that design.
- *
- * @category Action
- * @package  StatusNet
- * @author   Zach Copley <zach@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- *
- */
-class GroupDesignAction extends Action {
-
-    /** The group in question */
-    var $group = null;
-
-    /**
-     * A design for this action
-     *
-     * if the group attribute has been set, returns that group's
-     * design.
-     *
-     * @return Design a design object to use
-     */
-
-    function getDesign()
-    {
-        if (!empty($this->group)) {
-            $design = $this->group->getDesign();
-            if (!empty($design)) {
-                return $design;
-            }
-        }
-        return parent::getDesign();
-    }
-
-    function showProfileBlock()
-    {
-        $block = new GroupProfileBlock($this, $this->group);
-        $block->show();
-    }
-}
index 13795721aed3e376aed601acd14e31b7441b11ec..33f77bef9b066235e498617cf2347bc61e68a902 100644 (file)
@@ -137,15 +137,6 @@ class GroupNav extends Menu
                                      sprintf(_m('TOOLTIP','Add or edit %s logo'), $nickname),
                                      $action_name == 'grouplogo',
                                      'nav_group_logo');
-                $this->out->menuItem(common_local_url('groupdesignsettings', array('nickname' =>
-                                                                      $nickname)),
-                                     // TRANS: Menu item in the group navigation page. Only shown for group administrators.
-                                     _m('MENU','Design'),
-                                     // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
-                                     // TRANS: %s is the nickname of the group.
-                                     sprintf(_m('TOOLTIP','Add or edit %s design'), $nickname),
-                                     $action_name == 'groupdesignsettings',
-                                     'nav_group_design');
             }
             Event::handle('EndGroupGroupNav', array($this));
         }
index 4cb8ed46f07bf040655222f55f8d7a76dbb99c8e..9b1bac21545b275e6e84b6683769dcea4d6de14d 100644 (file)
@@ -47,7 +47,7 @@ class GroupsByMembersSection extends GroupSection
         $qry = 'SELECT user_group.*, count(*) as value ' .
           'FROM user_group JOIN group_member '.
           'ON user_group.id = group_member.group_id ' .
-          'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
+          'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
           'ORDER BY value DESC ';
 
         $limit = GROUPS_PER_SECTION;
index c338ab7e9717f0a74df1ba2ba8111a3142d2221d..d0fadcb4506eccce19a9af4c65ce493c2fe664bf 100644 (file)
@@ -47,7 +47,7 @@ class GroupsByPostsSection extends GroupSection
         $qry = 'SELECT user_group.*, count(*) as value ' .
           'FROM user_group JOIN group_inbox '.
           'ON user_group.id = group_inbox.group_id ' .
-          'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
+          'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
           'ORDER BY value DESC ';
 
         $limit = GROUPS_PER_SECTION;
index 7c6567c6c1c0511997eb84c8ddf5d3f848b582ad..db686a255a757f8b75a845dc82a8e0f3ea8e7815 100644 (file)
@@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @see      InboxAction
  * @see      OutboxAction
  */
-class MailboxAction extends CurrentUserDesignAction
+class MailboxAction extends Action
 {
     var $page = null;
 
diff --git a/lib/ownerdesignaction.php b/lib/ownerdesignaction.php
deleted file mode 100644 (file)
index d557f10..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Base class for actions that use the page owner's design
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Action
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @copyright 2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-/**
- * Base class for actions that use the page owner's design
- *
- * Some pages have a clear "owner" -- like the profile page, subscriptions
- * pages, etc. This superclass uses that owner's chosen design for the page
- * design.
- *
- * @category Action
- * @package  StatusNet
- * @author   Evan Prodromou <evan@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- *
- */
-
-class OwnerDesignAction extends Action {
-
-    /** The user for this page. */
-
-    var $user = null;
-
-    /**
-     * A design for this action
-     *
-     * if the user attribute has been set, returns that user's
-     * design.
-     *
-     * @return Design a design object to use
-     */
-
-    function getDesign()
-    {
-        if (!empty($this->user)) {
-
-            $design = $this->user->getDesign();
-
-            if (!empty($design)) {
-                return $design;
-            }
-        }
-
-        return parent::getDesign();
-    }
-}
index 09ebcc5de088736384dc0f432e71be15da7a056d..eaf515e04a45005e26e3d83c630125d608e9bf28 100644 (file)
@@ -23,7 +23,7 @@
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
  * @author    Sarven Capadisli <csarven@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -46,7 +46,7 @@ require_once INSTALLDIR.'/lib/groupminilist.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class ProfileAction extends OwnerDesignAction
+class ProfileAction extends Action
 {
     var $page    = null;
     var $profile = null;
index 9ba80515224f6edaed3db2547ce406e87387749e..dbf3aaeb9732cfe7c66ee55de63aee0362a8f3da 100644 (file)
@@ -269,7 +269,7 @@ class Router
             // settings
 
             foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
-                           'oauthapps', 'email', 'sms', 'userdesign', 'url') as $s) {
+                           'oauthapps', 'email', 'sms', 'url') as $s) {
                 $m->connect('settings/'.$s, array('action' => $s.'settings'));
             }
 
@@ -383,7 +383,7 @@ class Router
                             array('id' => '[0-9]+'));
             }
 
-            foreach (array('members', 'logo', 'rss', 'designsettings') as $n) {
+            foreach (array('members', 'logo', 'rss') as $n) {
                 $m->connect('group/:nickname/'.$n,
                             array('action' => 'group'.$n),
                             array('nickname' => Nickname::DISPLAY_FMT));
@@ -626,12 +626,6 @@ class Router
             $m->connect('api/account/update_profile_image.:format',
                         array('action' => 'ApiAccountUpdateProfileImage'));
 
-            $m->connect('api/account/update_profile_background_image.:format',
-                        array('action' => 'ApiAccountUpdateProfileBackgroundImage'));
-
-            $m->connect('api/account/update_profile_colors.:format',
-                        array('action' => 'ApiAccountUpdateProfileColors'));
-
             $m->connect('api/account/update_delivery_device.:format',
                         array('action' => 'ApiAccountUpdateDeliveryDevice'));
 
@@ -875,7 +869,6 @@ class Router
             // Admin
 
             $m->connect('panel/site', array('action' => 'siteadminpanel'));
-            $m->connect('panel/design', array('action' => 'designadminpanel'));
             $m->connect('panel/user', array('action' => 'useradminpanel'));
                $m->connect('panel/access', array('action' => 'accessadminpanel'));
             $m->connect('panel/paths', array('action' => 'pathsadminpanel'));
index c70a5ffa8d7a3fd7b4b52d8c1a1c605aff4012c5..560534065f65c55a3149ce30d77496db9791c045 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @see      Widget
  */
 
-class SettingsAction extends CurrentUserDesignAction
+class SettingsAction extends Action
 {
     /**
      * A message for the user.
index f8c78ec6f180fa5a4d5ac79e999babb0b136bfc5..f403d4bdcdb0c3d386f607783a6deb2919674fef 100644 (file)
@@ -112,13 +112,6 @@ class SettingsNav extends Menu
                                     _('Change email handling'),
                                     $actionName == 'emailsettings');
 
-            $this->action->menuItem(common_local_url('userdesignsettings'),
-                                    // TRANS: Menu item in settings navigation panel.
-                                    _m('MENU','Design'),
-                                    // TRANS: Menu item title in settings navigation panel.
-                                    _('Design your profile'),
-                                    $actionName == 'userdesignsettings');
-
             $this->action->menuItem(common_local_url('urlsettings'),
                                     // TRANS: Menu item in settings navigation panel.
                                     _m('MENU','URL'),
index 292f074199e52923b01a99b1773b2d1e27ba5d74..73185b16926a8304e6424000e4ec778cafccda57 100644 (file)
@@ -296,10 +296,6 @@ class StatusNet
 
         $config['db'] = $default['db'];
 
-        // Backward compatibility
-
-        $config['site']['design'] =& $config['design'];
-
         if (function_exists('date_default_timezone_set')) {
             /* Work internally in UTC */
             date_default_timezone_set('UTC');
index 9390a6e08353b3cdf441af4d9a3a5092251cbde2..a923ac4c30fd352ad64583f1ec6052f321c73f64 100644 (file)
@@ -97,8 +97,16 @@ class DomainStatusNetworkPlugin extends Plugin
 
         switch ($cls)
         {
+        case 'GlobalregisterAction':
+        case 'GloballoginAction':
+        case 'GlobalrecoverAction':
+            include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
+            return false;
         case 'DomainStatusNetworkInstaller':
-            include_once $dir . '/' . strtolower($cls) . '.php';
+            include_once $dir . '/lib/' . strtolower($cls) . '.php';
+            return false;
+        case 'GlobalApiAction':
+            include_once $dir . '/lib/' . strtolower($cls) . '.php';
             return false;
         default:
             return true;
@@ -138,6 +146,26 @@ class DomainStatusNetworkPlugin extends Plugin
         return true;
     }
 
+    function onRouterInitialized($m)
+    {
+        if (common_config('globalapi', 'enabled')) {
+            foreach (array('register', 'login', 'recover') as $method) {
+                $m->connect('api/statusnet/global/'.$method,
+                            array('action' => 'global'.$method));
+            }
+        }
+        return true;
+    }
+
+    function onLoginAction($action, &$login) {
+        $this->debug($action);
+        if (in_array($action, array('globalregister', 'globallogin', 'globalrecover'))) {
+            $login = true;
+            return false;
+        }
+        return true;
+    }
+
     static function nicknameForDomain($domain)
     {
         $registered = self::registeredDomain($domain);
@@ -195,6 +223,103 @@ class DomainStatusNetworkPlugin extends Plugin
                             _m('A plugin that maps a single status_network to an email domain.'));
         return true;
     }
+
+    static function userExists($email)
+    {
+        $domain = self::toDomain($email);
+
+        $sn = self::siteForDomain($domain);
+
+        if (empty($sn)) {
+            return false;
+        }
+
+        StatusNet::switchSite($sn->nickname);
+
+        $user = User::staticGet('email', $email);
+
+        return !empty($user);
+    }
+
+    static function registerEmail($email, $sendWelcome, $template)
+    {
+        $domain = self::toDomain($email);
+
+        $sn = self::siteForDomain($domain);
+
+        if (empty($sn)) {
+            $installer = new DomainStatusNetworkInstaller($domain);
+
+            // Do the thing
+            $installer->main();
+
+            $sn = $installer->getStatusNetwork();
+
+            $config = $installer->getConfig();
+
+            Status_network::$wildcard = $config['WILDCARD'];
+        }
+
+        StatusNet::switchSite($sn->nickname);
+
+        $confirm = EmailRegistrationPlugin::registerEmail($email);
+
+        return $confirm;
+    }
+
+    static function login($email, $password)
+    {
+        $domain = self::toDomain($email);
+
+        $sn = self::siteForDomain($domain);
+
+        if (empty($sn)) {
+            throw new ClientException(_("No such site."));
+        }
+
+        StatusNet::switchSite($sn->nickname);
+
+        $user = common_check_user($email, $password);
+
+        if (empty($user)) {
+            // TRANS: Form validation error displayed when trying to log in with incorrect credentials.
+            throw new ClientException(_('Incorrect username or password.'));
+        }
+
+        $loginToken = Login_token::makeNew($user);
+
+        if (empty($loginToken)) {
+            throw new ServerException(sprintf(_('Could not create new login token for user %s'), $user->nickname));
+        }
+
+        $url = common_local_url('otp', array('user_id' => $loginToken->user_id,
+                                             'token' => $loginToken->token));
+
+        if (empty($url)) {
+            throw new ServerException(sprintf(_('Could not create new OTP URL for user %s'), $user->nickname));
+        }
+
+        return $url;
+    }
+
+    static function recoverPassword($email)
+    {
+        $domain = self::toDomain($email);
+
+        $sn = self::siteForDomain($domain);
+
+        if (empty($sn)) {
+            throw new NoSuchUserException(array('email' => $email));
+        }
+
+        StatusNet::switchSite($sn->nickname);
+
+        $user = User::staticGet('email', $email);
+        
+        if (empty($user)) {
+            throw new ClientException(_('No such user.'));
+        }
+    }
 }
 
 // The way addPlugin() works, this global variable gets disappeared.
diff --git a/plugins/DomainStatusNetwork/actions/globallogin.php b/plugins/DomainStatusNetwork/actions/globallogin.php
new file mode 100644 (file)
index 0000000..f843392
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+/**
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2011, StatusNet, Inc.
+ *
+ * Log into a site globally
+ * 
+ * PHP version 5
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  DomainStatusNetwork
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+    // This check helps protect against security problems;
+    // your code file can't be executed directly from the web.
+    exit(1);
+}
+
+/**
+ * Login to a site
+ *
+ * @category  Action
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+class GloballoginAction extends GlobalApiAction
+{
+    var $password;
+
+    /**
+     * For initializing members of the class.
+     *
+     * @param array $argarray misc. arguments
+     *
+     * @return boolean true
+     */
+
+    function prepare($argarray)
+    {
+        parent::prepare($argarray);
+
+        $password = $this->trimmed('password');
+
+        if (empty($password)) {
+            throw new ClientException(_('No password.'));
+        }
+
+        $this->password = $password;
+
+        return true;
+    }
+
+    /**
+     * Handler method
+     *
+     * @param array $argarray is ignored since it's now passed in in prepare()
+     *
+     * @return void
+     */
+
+    function handle($argarray=null)
+    {
+        try {
+            $url = DomainStatusNetworkPlugin::login($email, $password);
+            $this->showSuccess(array('url' => $url));
+        } catch (ClientException $ce) {
+            $this->showError($ce->getMessage());
+        } catch (Exception $e) {
+            common_log(LOG_ERR, $e->getMessage());
+            $this->showError(_('An internal error occurred.'));
+        }
+        return;
+    }
+}
diff --git a/plugins/DomainStatusNetwork/actions/globalrecover.php b/plugins/DomainStatusNetwork/actions/globalrecover.php
new file mode 100644 (file)
index 0000000..9b688cb
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2011, StatusNet, Inc.
+ *
+ * Recover a password
+ * 
+ * PHP version 5
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  DomainStatusNetwork
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+    // This check helps protect against security problems;
+    // your code file can't be executed directly from the web.
+    exit(1);
+}
+
+/**
+ * Recover a password
+ *
+ * @category  Action
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+class GlobalrecoverAction extends GlobalApiAction
+{
+    /**
+     * For initializing members of the class.
+     *
+     * @param array $argarray misc. arguments
+     *
+     * @return boolean true
+     */
+
+    function prepare($argarray)
+    {
+        parent::prepare($argarray);
+        return true;
+    }
+
+    /**
+     * Handler method
+     *
+     * @param array $argarray is ignored since it's now passed in in prepare()
+     *
+     * @return void
+     */
+
+    function handle($argarray=null)
+    {
+        try {
+            DomainStatusNetworkPlugin::recoverPassword($email);
+            $this->showSuccess();
+        } catch (ClientException $ce) {
+            $this->showError($ce->getMessage());
+        } catch (Exception $e) {
+            common_log(LOG_ERR, $e->getMessage());
+            $this->showError(_('An internal error occurred.'));
+        }
+        return;
+    }
+}
diff --git a/plugins/DomainStatusNetwork/actions/globalregister.php b/plugins/DomainStatusNetwork/actions/globalregister.php
new file mode 100644 (file)
index 0000000..ed9bfc3
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+/**
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2011, StatusNet, Inc.
+ *
+ * Register a user to a site by their email address
+ * 
+ * PHP version 5
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  DomainStatusNetwork
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+    // This check helps protect against security problems;
+    // your code file can't be executed directly from the web.
+    exit(1);
+}
+
+/**
+ * An action to globally register a new user
+ *
+ * @category  Action
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+class GlobalregisterAction extends GlobalApiAction
+{
+    /**
+     * For initializing members of the class.
+     *
+     * @param array $argarray misc. arguments
+     *
+     * @return boolean true
+     */
+
+    function prepare($argarray)
+    {
+        try {
+            parent::prepare($argarray);
+            return true;
+        } catch (ClientException $e) {
+            $this->showError($e->getMessage(), $e->getCode());
+            return false;
+        } catch (Exception $e) {
+            common_log(LOG_ERR, $e->getMessage());
+            $this->showError(_('An internal error occurred.'), 500);
+            return false;
+        }
+    }
+
+    /**
+     * Handler method
+     *
+     * @param array $argarray is ignored since it's now passed in in prepare()
+     *
+     * @return void
+     */
+
+    function handle($argarray=null)
+    {
+        try {
+            DomainStatusNetworkPlugin::registerEmail($this->email, true);
+            $this->showSuccess();
+        } catch (ClientException $e) {
+            $this->showError($e->getMessage(), $e->getCode());
+        } catch (Exception $e) {
+            common_log(LOG_ERR, $e->getMessage());
+            $this->showError(_('An internal error occurred.'), 500);
+        }
+
+        return;
+    }
+}
diff --git a/plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php b/plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php
deleted file mode 100644 (file)
index b2e988b..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-<?php
-/**
- * StatusNet - the distributed open-source microblogging tool
- * Copyright (C) 2011, StatusNet, Inc.
- *
- * Installer class for domain-based multi-homing systems
- *
- * PHP version 5
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  DomainStatusNetwork
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @copyright 2011 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET')) {
-    // This check helps protect against security problems;
-    // your code file can't be executed directly from the web.
-    exit(1);
-}
-
-/**
- * Installer class for domain-based multi-homing systems
- *
- * @category  DomainStatusNetwork
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @copyright 2011 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
- * @link      http://status.net/
- */
-class DomainStatusNetworkInstaller extends Installer
-{
-    protected $domain   = null;
-    protected $rootname = null;
-    protected $sitedb   = null;
-    protected $rootpass = null;
-    protected $nickname = null;
-    protected $sn       = null;
-
-    public $verbose     = false;
-
-    function __construct($domain)
-    {
-        $this->domain = $domain;
-    }
-
-    /**
-     * Go for it!
-     * @return boolean success
-     */
-    function main()
-    {
-        // We don't check prereqs. Check 'em before setting up a
-        // multi-home system, kthxbi
-        if ($this->prepare()) {
-            return $this->handle();
-        } else {
-            $this->showHelp();
-            return false;
-        }
-    }
-
-    /**
-     * Get our input parameters...
-     * @return boolean success
-     */
-    function prepare()
-    {
-        $config = $this->getConfig();
-
-        $this->nickname = DomainStatusNetworkPlugin::nicknameForDomain($this->domain);
-
-        // XXX make this configurable
-
-        $this->sitename = sprintf('The %s Status Network', $this->domain);
-
-        $this->server   = $this->nickname.'.'.$config['WILDCARD'];
-        $this->path     = null;
-        $this->fancy    = true;
-
-        $datanick = $this->databaseize($this->nickname);
-
-        $this->host     = $config['DBHOSTNAME'];
-        $this->database = $datanick.$config['DBBASE'];
-        $this->dbtype   = 'mysql'; // XXX: support others... someday
-        $this->username = $datanick.$config['USERBASE'];
-
-        // Max size for MySQL
-
-        if (strlen($this->username) > 16) {
-            $this->username = sprintf('%s%08x', substr($this->username, 0, 8), crc32($this->username));
-        }
-
-        $pwgen = $config['PWDGEN'];
-
-        $password = `$pwgen`;
-
-        $this->password = trim($password);
-
-        // For setting up the database
-
-        $this->rootname = $config['ADMIN'];
-        $this->rootpass = $config['ADMINPASS'];
-        $this->sitehost = $config['DBHOST'];
-        $this->sitedb   = $config['SITEDB'];
-
-        $tagstr = $config['TAGS'];
-
-        if (!empty($tagstr)) {
-            $this->tags = preg_split('/[\s,]+/', $tagstr);
-        } else {
-            $this->tags = array();
-        }
-
-        // Explicitly empty
-
-        $this->adminNick    = null;
-        $this->adminPass    = null;
-        $this->adminEmail   = null;
-        $this->adminUpdates = null;
-
-        /** Should we skip writing the configuration file? */
-        $this->skipConfig = true;
-
-        if (!$this->validateDb()) {
-            return false;
-        }
-
-        return true;
-    }
-
-    function handle()
-    {
-        return $this->doInstall();
-    }
-
-    function setupDatabase()
-    {
-        $this->updateStatus('Creating database...');
-        $this->createDatabase();
-        parent::setupDatabase();
-        $this->updateStatus('Creating file directories...');
-        $this->createDirectories();
-        $this->updateStatus('Saving status network...');
-        $this->saveStatusNetwork();
-        $this->updateStatus('Checking schema for plugins...');
-        $this->checkSchema();
-    }
-
-    function saveStatusNetwork()
-    {
-        Status_network::setupDB($this->sitehost,
-                                $this->rootname,
-                                $this->rootpass,
-                                $this->sitedb, array());
-
-        $sn = new Status_network();
-
-        $sn->nickname = $this->nickname;
-        $sn->dbhost   = $this->host;
-        $sn->dbuser   = $this->username;
-        $sn->dbpass   = $this->password;
-        $sn->dbname   = $this->database;
-        $sn->sitename = $this->sitename;
-
-        $result = $sn->insert();
-
-        if (!$result) {
-            throw new ServerException("Could not create status_network: " . print_r($sn, true));
-        }
-
-        // Re-fetch; stupid auto-increment integer isn't working
-
-        $sn = Status_network::staticGet('nickname', $sn->nickname);
-
-        if (empty($sn)) {
-            throw new ServerException("Created {$this->nickname} status_network and could not find it again.");
-        }
-
-        // Set default tags
-
-        $tags = $this->tags;
-
-        // Add domain tag
-
-        $tags[] = 'domain='.$this->domain;
-
-        $sn->setTags($tags);
-
-        $this->sn = $sn;
-    }
-
-    function checkSchema()
-    {
-        $config = $this->getConfig();
-
-        Status_network::$wildcard = $config['WILDCARD'];
-
-        StatusNet::switchSite($this->nickname);
-
-        // We need to initialize the schema_version stuff to make later setup easier
-
-        $schema = array();
-        require INSTALLDIR.'/db/core.php';
-        $tableDefs = $schema;
-
-        $schema = Schema::get();
-        $schemaUpdater = new SchemaUpdater($schema);
-
-        foreach ($tableDefs as $table => $def) {
-            $schemaUpdater->register($table, $def);
-        }
-
-        $schemaUpdater->checkSchema();
-
-        Event::handle('CheckSchema');
-    }
-
-    function getStatusNetwork()
-    {
-        return $this->sn;
-    }
-
-    function createDirectories()
-    {
-        $config = $this->getConfig();
-
-        foreach (array('AVATARBASE', 'BACKGROUNDBASE', 'FILEBASE') as $key) {
-            $base = $config[$key];
-            $dirname = $base.'/'.$this->nickname;
-
-            // Make sure our bits are set
-            $mask = umask(0);
-            mkdir($dirname, 0770, true);
-            umask($mask);
-
-            // If you set the setuid bit on your base dirs this should be
-            // unnecessary, but just in case. You must be root for this
-            // to work.
-
-            if (array_key_exists('WEBUSER', $config)) {
-                chown($dirname, $config['WEBUSER']);
-            }
-            if (array_key_exists('WEBGROUP', $config)) {
-                chgrp($dirname, $config['WEBGROUP']);
-            }
-        }
-    }
-
-    function createDatabase()
-    {
-        // Create the New DB
-        $res = mysql_connect($this->host, $this->rootname, $this->rootpass);
-        if (!$res) {
-            throw new ServerException("Cannot connect to {$this->host} as {$this->rootname}.");
-        }
-
-        mysql_query("CREATE DATABASE ". mysql_real_escape_string($this->database), $res);
-
-        $return = mysql_select_db($this->database, $res);
-
-        if (!$return) {
-            throw new ServerException("Unable to connect to {$this->database} on {$this->host}.");
-        }
-
-        foreach (array('localhost', '%') as $src) {
-            mysql_query("GRANT ALL ON " .
-                        mysql_real_escape_string($this->database).".* TO '" .
-                        $this->username . "'@'".$src."' ".
-                        "IDENTIFIED BY '".$this->password."'", $res);
-        }
-
-        mysql_close($res);
-    }
-
-    function getConfig()
-    {
-        static $config;
-
-        $cfg_file = "/etc/statusnet/setup.cfg";
-
-        if (empty($config)) {
-            $result = parse_ini_file($cfg_file);
-
-            $config = array();
-            foreach ($result as $key => $value) {
-                $key = str_replace('export ', '', $key);
-                $config[$key] = $value;
-            }
-        }
-
-        return $config;
-    }
-
-    function showHelp()
-    {
-    }
-
-    function warning($message, $submessage='')
-    {
-        print $this->html2text($message) . "\n";
-        if ($submessage != '') {
-            print "  " . $this->html2text($submessage) . "\n";
-        }
-        print "\n";
-    }
-
-    function updateStatus($status, $error=false)
-    {
-        if ($this->verbose || $error) {
-            if ($error) {
-                print "ERROR: ";
-            }
-            print $this->html2text($status);
-            print "\n";
-        }
-    }
-
-    private function html2text($html)
-    {
-        // break out any links for text legibility
-        $breakout = preg_replace('/<a[^>+]\bhref="(.*)"[^>]*>(.*)<\/a>/',
-                                 '\2 &lt;\1&gt;',
-                                 $html);
-        return html_entity_decode(strip_tags($breakout), ENT_QUOTES, 'UTF-8');
-    }
-
-    function databaseize($nickname)
-    {
-        $nickname = str_replace('-', '_', $nickname);
-        return $nickname;
-    }
-}
diff --git a/plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php b/plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php
new file mode 100644 (file)
index 0000000..b2e988b
--- /dev/null
@@ -0,0 +1,349 @@
+<?php
+/**
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2011, StatusNet, Inc.
+ *
+ * Installer class for domain-based multi-homing systems
+ *
+ * PHP version 5
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  DomainStatusNetwork
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+    // This check helps protect against security problems;
+    // your code file can't be executed directly from the web.
+    exit(1);
+}
+
+/**
+ * Installer class for domain-based multi-homing systems
+ *
+ * @category  DomainStatusNetwork
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+class DomainStatusNetworkInstaller extends Installer
+{
+    protected $domain   = null;
+    protected $rootname = null;
+    protected $sitedb   = null;
+    protected $rootpass = null;
+    protected $nickname = null;
+    protected $sn       = null;
+
+    public $verbose     = false;
+
+    function __construct($domain)
+    {
+        $this->domain = $domain;
+    }
+
+    /**
+     * Go for it!
+     * @return boolean success
+     */
+    function main()
+    {
+        // We don't check prereqs. Check 'em before setting up a
+        // multi-home system, kthxbi
+        if ($this->prepare()) {
+            return $this->handle();
+        } else {
+            $this->showHelp();
+            return false;
+        }
+    }
+
+    /**
+     * Get our input parameters...
+     * @return boolean success
+     */
+    function prepare()
+    {
+        $config = $this->getConfig();
+
+        $this->nickname = DomainStatusNetworkPlugin::nicknameForDomain($this->domain);
+
+        // XXX make this configurable
+
+        $this->sitename = sprintf('The %s Status Network', $this->domain);
+
+        $this->server   = $this->nickname.'.'.$config['WILDCARD'];
+        $this->path     = null;
+        $this->fancy    = true;
+
+        $datanick = $this->databaseize($this->nickname);
+
+        $this->host     = $config['DBHOSTNAME'];
+        $this->database = $datanick.$config['DBBASE'];
+        $this->dbtype   = 'mysql'; // XXX: support others... someday
+        $this->username = $datanick.$config['USERBASE'];
+
+        // Max size for MySQL
+
+        if (strlen($this->username) > 16) {
+            $this->username = sprintf('%s%08x', substr($this->username, 0, 8), crc32($this->username));
+        }
+
+        $pwgen = $config['PWDGEN'];
+
+        $password = `$pwgen`;
+
+        $this->password = trim($password);
+
+        // For setting up the database
+
+        $this->rootname = $config['ADMIN'];
+        $this->rootpass = $config['ADMINPASS'];
+        $this->sitehost = $config['DBHOST'];
+        $this->sitedb   = $config['SITEDB'];
+
+        $tagstr = $config['TAGS'];
+
+        if (!empty($tagstr)) {
+            $this->tags = preg_split('/[\s,]+/', $tagstr);
+        } else {
+            $this->tags = array();
+        }
+
+        // Explicitly empty
+
+        $this->adminNick    = null;
+        $this->adminPass    = null;
+        $this->adminEmail   = null;
+        $this->adminUpdates = null;
+
+        /** Should we skip writing the configuration file? */
+        $this->skipConfig = true;
+
+        if (!$this->validateDb()) {
+            return false;
+        }
+
+        return true;
+    }
+
+    function handle()
+    {
+        return $this->doInstall();
+    }
+
+    function setupDatabase()
+    {
+        $this->updateStatus('Creating database...');
+        $this->createDatabase();
+        parent::setupDatabase();
+        $this->updateStatus('Creating file directories...');
+        $this->createDirectories();
+        $this->updateStatus('Saving status network...');
+        $this->saveStatusNetwork();
+        $this->updateStatus('Checking schema for plugins...');
+        $this->checkSchema();
+    }
+
+    function saveStatusNetwork()
+    {
+        Status_network::setupDB($this->sitehost,
+                                $this->rootname,
+                                $this->rootpass,
+                                $this->sitedb, array());
+
+        $sn = new Status_network();
+
+        $sn->nickname = $this->nickname;
+        $sn->dbhost   = $this->host;
+        $sn->dbuser   = $this->username;
+        $sn->dbpass   = $this->password;
+        $sn->dbname   = $this->database;
+        $sn->sitename = $this->sitename;
+
+        $result = $sn->insert();
+
+        if (!$result) {
+            throw new ServerException("Could not create status_network: " . print_r($sn, true));
+        }
+
+        // Re-fetch; stupid auto-increment integer isn't working
+
+        $sn = Status_network::staticGet('nickname', $sn->nickname);
+
+        if (empty($sn)) {
+            throw new ServerException("Created {$this->nickname} status_network and could not find it again.");
+        }
+
+        // Set default tags
+
+        $tags = $this->tags;
+
+        // Add domain tag
+
+        $tags[] = 'domain='.$this->domain;
+
+        $sn->setTags($tags);
+
+        $this->sn = $sn;
+    }
+
+    function checkSchema()
+    {
+        $config = $this->getConfig();
+
+        Status_network::$wildcard = $config['WILDCARD'];
+
+        StatusNet::switchSite($this->nickname);
+
+        // We need to initialize the schema_version stuff to make later setup easier
+
+        $schema = array();
+        require INSTALLDIR.'/db/core.php';
+        $tableDefs = $schema;
+
+        $schema = Schema::get();
+        $schemaUpdater = new SchemaUpdater($schema);
+
+        foreach ($tableDefs as $table => $def) {
+            $schemaUpdater->register($table, $def);
+        }
+
+        $schemaUpdater->checkSchema();
+
+        Event::handle('CheckSchema');
+    }
+
+    function getStatusNetwork()
+    {
+        return $this->sn;
+    }
+
+    function createDirectories()
+    {
+        $config = $this->getConfig();
+
+        foreach (array('AVATARBASE', 'BACKGROUNDBASE', 'FILEBASE') as $key) {
+            $base = $config[$key];
+            $dirname = $base.'/'.$this->nickname;
+
+            // Make sure our bits are set
+            $mask = umask(0);
+            mkdir($dirname, 0770, true);
+            umask($mask);
+
+            // If you set the setuid bit on your base dirs this should be
+            // unnecessary, but just in case. You must be root for this
+            // to work.
+
+            if (array_key_exists('WEBUSER', $config)) {
+                chown($dirname, $config['WEBUSER']);
+            }
+            if (array_key_exists('WEBGROUP', $config)) {
+                chgrp($dirname, $config['WEBGROUP']);
+            }
+        }
+    }
+
+    function createDatabase()
+    {
+        // Create the New DB
+        $res = mysql_connect($this->host, $this->rootname, $this->rootpass);
+        if (!$res) {
+            throw new ServerException("Cannot connect to {$this->host} as {$this->rootname}.");
+        }
+
+        mysql_query("CREATE DATABASE ". mysql_real_escape_string($this->database), $res);
+
+        $return = mysql_select_db($this->database, $res);
+
+        if (!$return) {
+            throw new ServerException("Unable to connect to {$this->database} on {$this->host}.");
+        }
+
+        foreach (array('localhost', '%') as $src) {
+            mysql_query("GRANT ALL ON " .
+                        mysql_real_escape_string($this->database).".* TO '" .
+                        $this->username . "'@'".$src."' ".
+                        "IDENTIFIED BY '".$this->password."'", $res);
+        }
+
+        mysql_close($res);
+    }
+
+    function getConfig()
+    {
+        static $config;
+
+        $cfg_file = "/etc/statusnet/setup.cfg";
+
+        if (empty($config)) {
+            $result = parse_ini_file($cfg_file);
+
+            $config = array();
+            foreach ($result as $key => $value) {
+                $key = str_replace('export ', '', $key);
+                $config[$key] = $value;
+            }
+        }
+
+        return $config;
+    }
+
+    function showHelp()
+    {
+    }
+
+    function warning($message, $submessage='')
+    {
+        print $this->html2text($message) . "\n";
+        if ($submessage != '') {
+            print "  " . $this->html2text($submessage) . "\n";
+        }
+        print "\n";
+    }
+
+    function updateStatus($status, $error=false)
+    {
+        if ($this->verbose || $error) {
+            if ($error) {
+                print "ERROR: ";
+            }
+            print $this->html2text($status);
+            print "\n";
+        }
+    }
+
+    private function html2text($html)
+    {
+        // break out any links for text legibility
+        $breakout = preg_replace('/<a[^>+]\bhref="(.*)"[^>]*>(.*)<\/a>/',
+                                 '\2 &lt;\1&gt;',
+                                 $html);
+        return html_entity_decode(strip_tags($breakout), ENT_QUOTES, 'UTF-8');
+    }
+
+    function databaseize($nickname)
+    {
+        $nickname = str_replace('-', '_', $nickname);
+        return $nickname;
+    }
+}
diff --git a/plugins/DomainStatusNetwork/lib/globalapiaction.php b/plugins/DomainStatusNetwork/lib/globalapiaction.php
new file mode 100644 (file)
index 0000000..cd0c7f9
--- /dev/null
@@ -0,0 +1,131 @@
+<?php
+/**
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2011, StatusNet, Inc.
+ *
+ * An action that requires an API key
+ * 
+ * PHP version 5
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  DomainStatusNetwork
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+    // This check helps protect against security problems;
+    // your code file can't be executed directly from the web.
+    exit(1);
+}
+
+/**
+ * An action that requires an API key
+ *
+ * @category  General
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link      http://status.net/
+ */
+
+class GlobalApiAction extends Action
+{
+    var $email;
+
+    /**
+     * Check for an API key, and throw an exception if it's not set
+     *
+     * @param array $args URL and POST params
+     *
+     * @return boolean continuation flag
+     */
+
+    function prepare($args)
+    {
+        StatusNet::setApi(true); // reduce exception reports to aid in debugging
+
+        parent::prepare($args);
+
+        if (!common_config('globalapi', 'enabled')) {
+            throw new ClientException(_('Global API not enabled.'), 403);
+        }
+
+        $apikey = $this->trimmed('apikey');
+
+        if (empty($apikey)) {
+            throw new ClientException(_('No API key.'), 403);
+        }
+
+        $expected = common_config('globalapi', 'key');
+
+        if ($expected != $apikey) {
+            // FIXME: increment a counter by IP address to prevent brute-force
+            // attacks on the key.
+            throw new ClientException(_('Bad API key.'), 403);
+        }
+
+        $email = common_canonical_email($this->trimmed('email'));
+
+        if (empty($email)) {
+            throw new ClientException(_('No email address.'));
+        }
+
+        if (!Validate::email($email, common_config('email', 'check_domain'))) {
+            throw new ClientException(_('Invalid email address.'));
+        }
+
+        $this->email = $email;
+
+        return true;
+    }
+
+    function showError($message, $code=400)
+    {
+        $this->showOutput(array('error' => $message), $code);
+    }
+
+    function showSuccess($values=null, $code=200)
+    {
+        if (empty($values)) {
+            $values = array();
+        }
+        $values['success'] = 1;
+        $this->showOutput($values, $code);
+    }
+
+    function showOutput($values, $code)
+    {
+        if (array_key_exists($code, ClientErrorAction::$status)) {
+            $status_string = ClientErrorAction::$status[$code];
+        } else if (array_key_exists($code, ServerErrorAction::$status)) {
+            $status_string = ServerErrorAction::$status[$code];
+        } else {
+            // bad code!
+            $code = 500;
+            $status_string = ServerErrorAction::$status[$code];
+        }
+
+        header('HTTP/1.1 '.$code.' '.$status_string);
+
+        header('Content-Type: application/json; charset=utf-8');
+        print(json_encode($values));
+        print("\n");
+    }
+}
index 98ce620c28cb24fcfa1fd50d7cf145eacaf32a8c..f773094a74c426e9ccc023b43468d08e5a61cef2 100644 (file)
@@ -39,39 +39,24 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
 
 $email = $args[0];
 
-$domain = DomainStatusNetworkPlugin::toDomain($email);
+$sendWelcome = have_option('w', 'welcome');
 
-$sn = DomainStatusNetworkPlugin::siteForDomain($domain);
-
-if (empty($sn)) {
-    $installer = new DomainStatusNetworkInstaller($domain);
-
-    $installer->verbose = have_option('v', 'verbose');
-
-    // Do the thing
-    $installer->main();
-
-    $sn = $installer->getStatusNetwork();
-
-    $config = $installer->getConfig();
-
-    Status_network::$wildcard = $config['WILDCARD'];
+if ($sendWelcome && have_option('t', 'template')) {
+    $template = get_option_value('t', 'template');
 }
 
-StatusNet::switchSite($sn->nickname);
+try {
 
-$confirm = EmailRegistrationPlugin::registerEmail($email);
+    $confirm = DomainStatusNetworkPlugin::registerEmail($email);
 
-if (have_option('w', 'welcome')) {
-    if (have_option('t', 'template')) {
-        // use the provided template
-        EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template'));
-    } else {
-        // use the default template
-        EmailRegistrationPlugin::sendConfirmEmail($confirm);
+    if ($sendWelcome) {
+        EmailRegistrationPlugin::sendConfirmEmail($confirm, $template);
     }
-}
 
-$confirmUrl = common_local_url('register', array('code' => $confirm->code));
+    $confirmUrl = common_local_url('register', array('code' => $confirm->code));
 
-print $confirmUrl."\n";
+    print $confirmUrl."\n";
+
+} catch (Exception $e) {
+    print "ERROR: " . $e->getMessage() . "\n";
+}
index d893baf62d9f703054ea853a21c47dd4038706f9..62ae3813311fea419c2b2efdf1a3408c2c198a7e 100644 (file)
@@ -277,8 +277,7 @@ class FacebookBridgePlugin extends Plugin
         if ($this->hasApplication()) {
             $action_name = $action->trimmed('action');
 
-            // CurrentUserDesignAction stores the current user in $cur
-            $user = $action->getCurrentUser();
+            $user = common_current_user();
 
             $flink = null;
 
index 3464a1202a2cff6b01623047630031d773a578e5..b6308c663f9382d9e0efc42b3577cc2b263ec883 100644 (file)
@@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  * @link      http://status.net/
  */
-class GroupinboxAction extends GroupDesignAction
+class GroupinboxAction extends GroupAction
 {
     var $gm;
 
index 2ccf1642d746fe4cb1a6b89de354e5395eab6461..856e00e159e51d6a81e4a948466a2993c3b666a2 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Mapstraction
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -42,7 +42,7 @@ if (!defined('STATUSNET')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class MapAction extends OwnerDesignAction
+class MapAction extends Action
 {
     var $profile = null;
     var $page    = null;
index 8e2fcad284518ebb8c9b051f6391dade8426ef5e..7c9a4d14739bc23b7d7ed369064046efc1ea9d55 100644 (file)
@@ -8,7 +8,7 @@ class RemoteProfileAction extends ShowstreamAction
 {
     function prepare($args)
     {
-        OwnerDesignAction::prepare($args); // skip the ProfileAction code and replace it...
+        Action::prepare($args); // skip the ProfileAction code and replace it...
 
         $id = $this->arg('id');
         $this->user = false;
index 30ce406739238f430da9c077be78698df996d668..85b39d0053bda45a64c534c648978950ed3c215f 100644 (file)
@@ -57,7 +57,7 @@ class QnashowanswerAction extends ShownoticeAction
      */
     function prepare($argarray)
     {
-        OwnerDesignAction::prepare($argarray);
+        Action::prepare($argarray);
 
         $this->id = $this->trimmed('id');
 
index 14be3a64437f7696e7f29ce449122fe7e73e8faa..edea032b388486c98d0e689b5d003ac226ef2d17 100644 (file)
@@ -57,7 +57,7 @@ class QnashowquestionAction extends ShownoticeAction
      */
     function prepare($argarray)
     {
-        OwnerDesignAction::prepare($argarray);
+        Action::prepare($argarray);
 
         $this->id = $this->trimmed('id');
 
index 797015527882b28b5f405f96d220236432f83142..ed7c22b1e6cd53103da37bf21e26078f8c099b2d 100644 (file)
@@ -1903,4 +1903,35 @@ li.notice-answer + li.notice {
     padding-left: 20px;
 }
 
+/* SNOD CompanyLogo styling */
+
+#site_nav_local_views a.company_logo {
+    width: 138px;
+    padding: 0px;
+    font-weight: bold;
+    text-transform: none;
+    line-height: 1em;
+    margin-bottom: 30px;
+}
+
+#site_nav_local_views a.company_logo:hover {
+    background: none;
+    color: blue;
+    text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.5);
+}
+
+.company_logo img {
+    max-width: 96px;
+    margin-bottom: 10px;
+}
+
+.company_logo span {
+    display: block;
+}
+
+a.company_logo:hover span {
+    text-decoration: underline;
+}
+
+
 }/*end of @media screen, projection, tv*/