package cPanel::CMS::Xoops;

use strict;
use warnings;

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

our $meta_info = {
    adminuser_pass => 1, 
    admin_email    => 1, 
    installdir     => 'xoops',
    description    => q{PHP/MySQL based CMS. <b>If you'd like the Xoops->User Menu->[View | Edit]Accounts buttons to work instead of giving a "Fatal error: Call to a member function getVar() on a non-object in */class/theme.php on line 49*" error then:</b> install the "USERMANAGEMENT" module at Xoops->Administration Menu->Module->Administration}, # required
    security       => 'Configuration has to be world readable and writable, requires 777 directories. Subject to all common PHP security problems',
    version        => '2.2.3a-Final', # required
    security_rank  => 1, 
    website        => 'http://www.xoops.org/', 
    config_files   => ['mainfile.php'],
    mysql          => ['xoops'],
    table_prefix   => 'xoops', 
    install_fields_hook => sub {
        my ($input_hr, $error_ref, $cpo) = @_;
        ${$error_ref} .= 'Invalid peristent connection option.'
            if $input_hr->{'use_persistent'} ne '1' && $input_hr->{'use_persistent'} ne '0';
        ${$error_ref} .= 'Display name must be numbers, letter, underscores, or spaces only'
            if $input_hr->{'admin_display'} !~ m/^[\w\s?]+$/;
    },
    install_fields => {
        use_persistent => {
           label    => 'Use Peristent Connections?',
           value    => { '0' => 'No', '1' => 'Yes', },
           defvalue => '0',
           attr     => '',
           type     => 'radio'
        },
        admin_display => {
           label    => 'Admin display name',
           value => '',
           defvalue => '0',
           attr     => '',
           type     => 'text'
        },
    },
    chmod => {
        '0777' => [qw(cache/ uploads/ templates_c/)], 
    },
};

#### action functions ##
sub install { shift->stdinstall(@_) }
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;
