# cpanel - cpaddons/cPanel/CMS/E107.pm            Copyright(c) 2012 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

package cPanel::CMS::E107;

use strict;
use warnings;

our $VERSION = 0.1;
my $pkg = __PACKAGE__;

our $meta_info = {
    setphpsuexecvar        => 1,
    adminuser_pass         => 1,
    admin_user_pass_length => 5,
    admin_email            => 1,
    installdir             => 'e107',
    description            => q{e107 is a content management system written in php and using the popular open source mySQL database system for content storage.
      <br /><b>If you are upgrading from 0.6x series</b> please read, understand, and follow e107_docs/README_UPGRADE.html located in the installation directory.<br />
      This is important because much has changed and there is some very important security information. Also note the section about the "missing features" being plugins.
      No tables are dropped in the upgrade so that you can add the necessary plugins to get those features back. Note: the vendor says that 0.7 is a complete rewrite of 0.6 so there are huge differences in the way it behaves. If this is not acceptable for you use a fresh install or do not use e107.
      The following columns are no longer used in the user table but are not removed since you may want that data:
      <br />user_homepage,  user_icq, user_aim, user_msn, user_location, user_birthday
       <br />
      It is recomended to manually save that data for use elsewhere and then to remove the columns manually.
   },
    version       => '1.0.4',
    'security'    => 'Requires 777 directory permissions and world readable config files. Subject to all common PHP security problems.',
    security_rank => 1,
    website       => 'http://e107.org/',
    config_files  => ['e107_config.php'],
    chmod         => {
        '0777' => [qw(e107_files/cache/ e107_files/public/ e107_files/public/avatars/)],
        '0644' => [qw(e107_config.php)],
    },
    mysql        => ['e107'],
    table_prefix => 'e107',

    # '0.7.5' => {}, # maybe once its automated ...
    '0.6171' => {
        public_html_install_files => [
            qw(article.php backend.php banner.php chat.php class2.php comment.php content.php download.php e107_6171_readme.txt e107_config.php e107.htaccess email.php error.php forum.php forum_post.php forum_viewforum.php forum_viewtopic.php fpw.php index.php links.php login.php membersonly.php news.php oldpolls.php online.php print.php rate.php request.php robots.txt search.php signup.php sitedown.php sitemap.php stats.php subcontent.php submitnews.php top.php upgrade.php upload.php user.php userposts.php usersettings.php)
        ],
        public_html_install_dirs => [qw()],

        #e107 has a prefix on all of its directories, this makes uninstalling pretty simple
        public_html_install_unknown => [qw(e107_admin e107_docs e107_files e107_handlers e107_images e107_install e107_languages e107_plugins e107_themes)],
    },
};

if ( defined &Cpanel::cPAddons::proc_keys_named_after_version ) {
    Cpanel::cPAddons::proc_keys_named_after_version( $meta_info, __PACKAGE__ );
}

#### action functions ##
sub install {
    my $aoc = shift;
    $aoc->{url_to_install_length} = length( $aoc->{url_to_install} );
    $aoc->{username_length}       = length( $aoc->{username} );
    $aoc->{email_length}          = length( $aoc->{email} );
    $aoc->stdinstall(@_);
    $aoc->_do_phpsuexec_perms();
}
sub upgrade   { shift->stdupgrade(@_) }
sub uninstall { shift->stduninstall(@_) }

#### non action functions ##
sub installform   { print shift->{installform} }
sub upgradeform   { print shift->{upgradeform} }
sub uninstallform { print shift->{uninstallform} }

1;
