print_r("<h1>Step 1: Requirements</h1>");
                print_r(caclInstaller::checkRequirements());
                print_r(caclInstaller::updateCACL_tables());
                break;
            case 2:
                print_r("<h1>Step 2: Install Joomla Plugin</h1>");
                print_r(caclInstaller::installJoomla_Plugin());
                break;
            case 3:
                print_r("<h1>Step 3: Install Patch files</h1>");
                print_r(caclInstaller::installPatch_files());
                break;
            case 4:
                if (file_exists($comprofiler_filepath)) {
                    print_r("<h1>Step 4: Install Community Builder Plugin</h1>");
                    print_r(caclInstaller::installCB_Plugin());
                    break;
                }
            case 5:
                $mainframe->redirect('index.php?option=com_community_acl&task=about', JText::_('Community ACL installed successfully.'));
                break;
            default:
                //To do
                break;
        }
        break;
    default:
        cacl_html::about(_COMMUNITY_ACL_COMP_NAME);
        break;
}
function fixIt()
     return JFile::move($source, $destination);
 }
 function updateCB_db()
 {
     $db =& JFactory::getDBO();
     $cbVersion = caclInstaller::get_xml_tag_value('version', 'com_comprofiler');
     if (version_compare($cbVersion, '1.2.2', '>=')) {
         $query = "ALTER TABLE `#__comprofiler` ADD `cb_caclmembertype` VARCHAR(255) NOT NULL DEFAULT ''";
     } else {
         $query = "ALTER TABLE `#__comprofiler` ADD `cb_caclmembertype` INT( 11 ) NOT NULL DEFAULT '0'";
     }
     $db->setQuery($query);
     $db->query();
     $cb_caclmemebertype_search = NULL;
     $query = "SELECT `fieldid` FROM `#__comprofiler_fields` WHERE `tablecolumns` = 'cb_caclmembertype' AND `table` = '#__comprofiler' ";
     $db->setQuery($query);
     $cb_caclmemebertype_search = $db->loadResult();
     if (is_null($cb_caclmemebertype_search)) {
         //Disable the Dropdown list
         $query = "INSERT INTO `#__comprofiler_fields` (`fieldid`, `name`, `tablecolumns`, `table`, `title`, `description`, `type`, `maxlength`, `size`, `required`, `tabid`, `ordering`, `cols`, `rows`, `value`, `default`, `published`, `registration`, `profile`, `displaytitle`, `readonly`, `searchable`, `calculated`, `sys`, `pluginid`, `params`) VALUES\r\n\t\t\t\t\t\t('', 'cb_caclmembertype', 'cb_caclmembertype', '#__comprofiler', 'Registration Membership Type', '', 'select', 0, 0, 0, 11, -27, 0, 0, NULL, '1', 1, 1, 1, 1, 0, 0, 0, 0, 1, '');\r\n\t\t\t\t\t\t\t";
         $db->setQuery($query);
         $db->query();
     } else {
         //Enable the Dropdown list
         $query = "UPDATE `#__comprofiler_fields` SET published = '1' " . " WHERE `tablecolumns` = 'cb_caclmembertype' AND `table` = '#__comprofiler' ";
         $db->setQuery($query);
         $db->query();
Пример #3
0
 function installCB_Plugin()
 {
     $html = '';
     $message = '';
     $autoSubmit = '';
     $errorMsg = '';
     $db =& JFactory::getDBO();
     $this->frontendPath = JPATH_ROOT . DS . 'components' . DS . 'com_community_acl' . DS;
     $this->backendPath = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community_acl' . DS;
     $html = '<div id="timer" style="display:none"></div>';
     $html .= '<div id="installSuccesMsg"><div id="timer"></div><div style="width:100%; float:left;">' . JText::_('Extracting Files...') . '</div><br/>';
     $default_link = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_community_acl&task=install&step=5';
     $installCB_link = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_community_acl&task=install&step=4&installCB=yes';
     $installCB = JRequest::getVar('installCB');
     if ($installCB != 'yes') {
         $autoSubmit .= caclInstaller::getAutoSubmitFunction();
         $html .= $autoSubmit;
         $html .= "</div>\n\t\t\t<table><tr><td><h3>Would you like to install Community Builder Plugin?</h3></td></tr>\n\t\t\t<tr><td><input type=\"button\" id=\"btnYes\" name=\"btnYes\" value=\"Yes\" onclick=\"window.location='" . $installCB_link . "'\" /></td>\n\t\t\t<td><input type=\"button\" id=\"btnNo\" name=\"btnNo\" value=\"No\" onclick=\"window.location='" . $default_link . "'\" /></td></tr>\n\t\t\t</table>";
     }
     if ($installCB == 'yes') {
         //Install CB Plugin
         $cb_plugin_zip = $this->frontendPath . 'plug_cacl_userreg.zip';
         #unzip Joomla File
         $destination = JPATH_ROOT . DS . 'components' . DS . 'com_comprofiler/plugin/user/';
         $plg_destination = $destination;
         if (caclInstaller::extractArchive($cb_plugin_zip, $plg_destination)) {
             $autoSubmit .= caclInstaller::getAutoSubmitFunction();
             $message .= $autoSubmit . $html;
             //Inject the Insert query into DB
             $query = "SELECT element FROM #__comprofiler_plugin WHERE `element` = 'userreg'";
             $db->setQuery($query);
             $element = $db->loadResult();
             if ($element) {
                 //it exists
                 #- Delete the record
                 $query = "DELETE FROM #__comprofiler_plugin WHERE `element` = 'userreg'";
                 $db->setQuery($query);
                 $db->query();
             }
             #- Insert record into DB
             $query = "INSERT INTO `#__comprofiler_plugin` \n\t\t\t\t\t\t\t(`id`, `name`, `element`, `type`, `folder`, `backend_menu`, `access`, `ordering`, `published`, `iscore`, \n\t\t\t\t\t\t\t\t`client_id`, `checked_out`, `checked_out_time`, `params`) \n\t\t\t\t\t\t\t\t\tVALUES ('', 'Community ACL Registration Plugin', 'userreg', \n\t\t\t\t\t\t\t\t\t\t'user', 'plug_cacl_userreg', '', 0, 99, 1, 0, 0, 0, '0000-00-00 00:00:00', '')";
             $db->setQuery($query);
             $db->query();
         } else {
             $errorMsg .= "<p style='color:red'>Unable to extract plug_cacl_userreg.zip</p>";
             $message .= $html . $errorMsg;
         }
         #Patch the Plugin Authentication File
         $plugin_name = $this->frontendPath . 'plug_redirect_acl.zip';
         $destination = JPATH_ROOT . DS . 'plugins/authentication/';
         if (caclInstaller::extractArchive($plugin_name, $destination)) {
             $autoSubmit .= caclInstaller::getAutoSubmitFunction();
             $message = $autoSubmit . $html;
             //Inject the Insert query into DB
             $query = "SELECT element FROM #__plugin WHERE `element` = 'community_acl' AND `folder` = 'authentication'";
             $db->setQuery($query);
             $element = $db->loadResult();
             if ($element) {
                 //it exists
                 #- Delete the record
                 $query = "DELETE FROM #__plugin WHERE `element` = 'community_acl' AND `folder` = 'authentication'";
                 $db->setQuery($query);
                 $db->query();
             }
             #- Insert record into DB
             $query = "INSERT INTO `#__plugins` (`id`, `name`, `element`, `folder`, `access`, `ordering`, `published`, `iscore`, `client_id`, `checked_out`, `checked_out_time`, `params`) VALUES\n\t\t\t\t\t\t\t('', 'User - Community ACL', 'community_acl', 'authentication', 0, 0, 1, 0, 0, 0, '0000-00-00 00:00:00', '')";
             $db->setQuery($query);
             $db->query();
         } else {
             $errorMsg .= "<p style='color:red'>Unable to extract plug_redirect_acl.zip</p>";
             $message .= $html . $errorMsg;
         }
         $link = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_community_acl&task=install&step=5';
         $inputbox = "</div></div><div ><table width=\"100%\" border=\"0\"><tr><td><input type=\"button\" class=\"button-next\" onclick=\"window.location = '" . $link . "'\" value=\"Next\"/>\n\t\t\t\t\t\t</td></tr></table></div>";
         $message .= $inputbox;
     }
     return $html . $message;
 }
Пример #4
0
            case 2:
                print_r("<h1>Step 2: Install Joomla Plugin</h1>");
                print_r(caclInstaller::installJoomla_Plugin());
                break;
            case 3:
                print_r("<h1>Step 3: Install Patch files</h1>");
                print_r(caclInstaller::installPatch_files());
                break;
            case 4:
                if (file_exists($comprofiler_filepath)) {
                    print_r("<h1>Step 4: Install Community Builder Plugin</h1>");
                    print_r(caclInstaller::installCB_Plugin());
                    break;
                }
            case 5:
                caclInstaller::updateCACL_usersDB();
                $mainframe->redirect('index.php?option=com_community_acl&task=about', JText::_('Community ACL installed successfully.'));
                break;
            default:
                //To do
                break;
        }
        break;
    default:
        cacl_html::about(_COMMUNITY_ACL_COMP_NAME);
        break;
}
function fixIt()
{
    global $mainframe;
    $mode = JRequest::getCmd('mode');