<?php
if (!defined('_VALID_MOS') && !defined('_JEXEC')) die('Direct Access to ' . basename(__FILE__) . ' is not allowed.');
/**
 *
 * @package simpleMembership
 * @copyright Andrey Kvasnevskiy-OrdaSoft(akbet@mail.ru); Anton Getman(ljanton@mail.ru);
 * Homepage: http://www.ordasoft.com
 * @version: 5.5.0 FREE
 * @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007; see LICENSE.txt
 *
 */
class mos_alUserOthers {
    /**
     * Sets the parametes for connecting to a webservice via a
     * @param the array of parameters
     */
    static function setParams() {
        global $user_configuration;
        // Prepare settings
        // Using single quotes is easier because you don't have to escape them. For every setting, add a line.
        $settings = "<?php\n";
        $settings.= "// Do not edit this file. Generated by admin script.\n";
        $settings.= "// simplemembershiplibrary Configuration file\n";
        $settings.= "\$user_configuration['release']['version']='" . $user_configuration['release']['version'] . "';\n";
        $settings.= "\$user_configuration['release']['date']='" . $user_configuration['release']['date'] . "';\n";
        $settings.= "\$user_configuration['acl_group_set']='" . $user_configuration['acl_group_set'] . "';\n";
        $settings.= "\$user_configuration['acl_group_set_email']='" . $user_configuration['acl_group_set_email'] . "';\n";
        $settings.= "\$user_configuration['useradd_notification_email']='" . $user_configuration['useradd_notification_email'] . "';\n";
        $settings.= "\$user_configuration['senders_email']='" . $user_configuration['senders_email'] . "';\n";

        $settings.= "\$user_configuration['auto_enabled']='" . $user_configuration['auto_enabled'] . "';\n";
        $settings.= "\$user_configuration['allow_registration']='" . $user_configuration['allow_registration'] . "';\n";
        $settings.= "\$user_configuration['allow_fieldsets']='" . $user_configuration['allow_fieldsets'] . "';\n";
        $settings.= "\$user_configuration['show_def_jgroup']='" . $user_configuration['show_def_jgroup'] . "';\n";

        $settings.= "\$user_configuration['preregister']='" . $user_configuration['preregister'] . "';\n";
        $settings.= "\$user_configuration['activationmsg']='" . $user_configuration['activationmsg'] . "';\n";
        $settings.= "\$user_configuration['admin_created_msg']='" . $user_configuration['admin_created_msg'] . "';\n";
        $settings.= "\$user_configuration['user_created_msg']='" . $user_configuration['user_created_msg'] . "';\n";
        $settings.= "\$user_configuration['user_enabled_msg']='" . $user_configuration['user_enabled_msg'] . "';\n";
        $settings.= "\$user_configuration['user_approve_msg']='" . $user_configuration['user_approve_msg'] . "';\n";
        $settings.= "\$user_configuration['user_disapprove_msg']='" . $user_configuration['user_disapprove_msg'] . "';\n";
        $settings.= "\$user_configuration['default_group']='" . $user_configuration['default_group'] . "';\n";
        $settings.= "\$user_configuration['other_profiles']='" . $user_configuration['other_profiles'] . "';\n";
        $settings.="\$user_configuration['before_end_notify'] = '" .$user_configuration['before_end_notify']."';\n";
        $settings.="\$user_configuration['before_end_notify_days'] = '" .$user_configuration['before_end_notify_days']."';\n";
        $settings.="\$user_configuration['before_end_notify_email'] = '" .$user_configuration['before_end_notify_email']."';\n";
        $settings.="\$user_configuration['admin_created_msg_for_user'] = '" .$user_configuration['admin_created_msg_for_user']."';\n";
        $settings.="\$user_configuration['admin_created_msg_for_admin']= '" .$user_configuration['admin_created_msg_for_admin']."';\n";

        $settings.= "?>\n";
        // Write out new initialization file
        $fd = fopen("./components/com_simplemembership/admin.simplemembership.class.conf.php", "w") or die("Cannot create configuration file.");
        fwrite($fd, $settings);
        fclose($fd);
    }
    /**
     * Rating Array
     * @return array an Array containing the information of all Rating
     * possibilities
     */
    static function getRatingArray() {
        $i = 0;
        $retVal = array();
        while ($i < 5) {
            //erster teil x,0
            $tmp = $i * 2;
            array_push($retVal, array($tmp, $i . ",0"));
            //zweiter teil x,5
            $tmp++;
            array_push($retVal, array($tmp, $i . ",5"));
            $i++;
        }
        array_push($retVal, array(10, "10,0"));
        return $retVal;
    }
    /**
     * Language Array - defined in the language files!
     * @return array an Array containing the information of all Language
     * possibilities
     */
    static function getLanguageArray() {
        $retVal = array();
        array_push($retVal, array("Not specified",  JText::_("COM_SIMPLEMEMBERSHIP_LANGUAGE_NOT_USED") ));
        array_push($retVal, array("English",  JText::_("COM_SIMPLEMEMBERSHIP_LANGUAGE_ENG") ));
        array_push($retVal, array("Russian",  JText::_("COM_SIMPLEMEMBERSHIP_LANGUAGE_RUS") ));
        return $retVal;
    }
}
?>
