예제 #1
0
    function register_form($option, $custom_task = '')
    {
        global $Itemid, $JLMS_CONFIG;
        global $ueConfig;
        $usersConfig =& JComponentHelper::getParams('com_users');
        $allowUserRegistration = $usersConfig->get('allowUserRegistration');
        if (!$allowUserRegistration && !$ueConfig['reg_admin_allowcbregistration']) {
            return '';
        }
        $doc =& JFactory::getDocument();
        $page_title = $doc->getTitle();
        $is_cb = $JLMS_CONFIG->get('is_cb_installed');
        $validate = josSpoofValue(1);
        $one_more_string_to_replace = '    <tr>
      <td colspan="2" width="100%"><div class="componentheading">Registration</div></td>
    </tr>';
        $one_more_string_to_replace2 = '		<div class="componentheading">
			Registration		</div>';
        if ($is_cb) {
            //ob_start();
            require_once $JLMS_CONFIG->get('absolute_path') . '/components/com_comprofiler/comprofiler.html.php';
            require_once $JLMS_CONFIG->get('absolute_path') . '/components/com_comprofiler/comprofiler.php';
            //@ob_end_clean();
            ob_start();
            registerForm('com_joomla_lms', isset($ueConfig['emailpass']) ? $ueConfig['emailpass'] : '******', '&nbsp;');
            $form = ob_get_contents();
            ob_end_clean();
            /*SoulPowerUniversity_MOD*/
            $form = str_replace("index.php?option=com_comprofiler", "index.php?option=com_comprofiler&vc=1", $form);
            /*SoulPowerUniversity_MOD*/
            $form = str_replace('saveregisters', $custom_task . '_cb', $form);
            $form = str_replace('"com_comprofiler"', '"com_joomla_lms"', $form);
            $form = str_replace('</form>', '<input type="hidden" value="' . $Itemid . '" name="Itemid"></form>', $form);
            $form = str_replace($one_more_string_to_replace, '', $form);
            echo $form;
            if ($ueConfig['reg_admin_approval'] || $ueConfig['reg_confirmation']) {
            } else {
                ?>
			<script type="text/javascript" language="javascript">
			<!--
			var cb_form = document.adminForm;
			cb_form.option.value = 'com_joomla_lms';
			-->	
			</script>
			<?php 
            }
        } else {
            if ($allowUserRegistration) {
                if (JLMS_Jversion() == 2) {
                    if (JLMS_J16version()) {
                        $lang =& JFactory::getLanguage();
                        $lang->load('com_users');
                        require_once $JLMS_CONFIG->get('absolute_path') . '/components/com_users/controller.php';
                        jimport('joomla.form.form');
                        JForm::addFormPath(JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'models' . DS . 'forms');
                        JForm::addFieldPath(JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'models' . DS . 'fields');
                        $usersConfig = array('base_path' => $JLMS_CONFIG->get('absolute_path') . DS . 'components' . DS . 'com_users');
                        // Create the controller
                        $usersController = UsersController::getInstance('Users', $usersConfig);
                        $usersView = $usersController->getView('registration', $doc->getType());
                        $usersView->addTemplatePath(JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'views' . DS . 'registration' . DS . 'tmpl');
                        $oldView = JRequest::getCmd('view');
                        JRequest::setVar('view', 'registration');
                        ob_start();
                        $usersController->display();
                        $form = ob_get_contents();
                        ob_end_clean();
                        JRequest::setVar('view', $oldView);
                        $form = str_replace('"com_users"', 'com_joomla_lms', $form);
                        $form = str_replace('registration.register', $custom_task, $form);
                        $form = str_replace(JRoute::_('index.php?option=com_users'), $JLMS_CONFIG->get('live_site') . "/index.php?option=com_joomla_lms&Itemid=" . $Itemid, $form);
                    } else {
                        $lang =& JFactory::getLanguage();
                        $lang->load('com_user');
                        require_once $JLMS_CONFIG->get('absolute_path') . '/components/com_user/controller.php';
                        require_once $JLMS_CONFIG->get('absolute_path') . '/components/com_user/views/register/view.html.php';
                        // Create the controller
                        $controller = new UserController();
                        // Perform the Request task
                        $controller->_basePath = $JLMS_CONFIG->get('absolute_path') . '/components/com_user';
                        ob_start();
                        $controller->execute('register');
                        $form = ob_get_contents();
                        ob_end_clean();
                        $form = str_replace('"com_user"', 'com_joomla_lms', $form);
                        $form = str_replace('register_save', $custom_task, $form);
                        $form = str_replace(JRoute::_('index.php?option=com_user'), $JLMS_CONFIG->get('live_site') . "/index.php?option=com_joomla_lms&Itemid=" . $Itemid, $form);
                    }
                    $form = str_replace($one_more_string_to_replace, '', $form);
                    echo $form;
                }
            }
        }
        $doc->setTitle($page_title);
    }