Example #1
0
 function installPatch_files()
 {
     $html = '';
     $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/>';
     #Unzip and Patch Files
     #Unzip Joomla Patch for Administrator
     $plg_destination = JPATH_ROOT . "/administrator/modules/mod_menu/";
     $joomla_patch_zip = $this->frontendPath . "joomla_patch_administrator.zip";
     $html .= '<div style="width:100%; float:left;">' . JText::_('Patching Mod_menu...') . '</div><br/>';
     $autoSubmit = '';
     $message = '';
     $errorMsg = '';
     if (caclInstaller::extractArchive($joomla_patch_zip, $plg_destination)) {
         $autoSubmit .= caclInstaller::getAutoSubmitFunction();
         $message .= $autoSubmit . $html;
         #move the file over
         $plg_destination = JPATH_ROOT . "/administrator/modules/mod_menu/";
         $filename = JPATH_ROOT . "/administrator/modules/mod_menu/joomla_patch_administrator/helper.php";
         if (caclInstaller::moveFile($filename, $plg_destination)) {
             $autoSubmit .= caclInstaller::getAutoSubmitFunction();
             $message = $autoSubmit . $html;
         } else {
             $errorMsg .= "<p style='color:red'>Unable to move Helper.php file over to mod_menu</p>";
             $message .= $html . $errorMsg;
         }
     } else {
         $errorMsg = "<p style='color:red'>Unable to patch Mod_menu - Please manually patch helper.php file located at this path:" . $joomla_patch_zip . " using the file located in the zip file: joomla_patch_administrator.zip </p>";
         $message = $html . $errorMsg;
     }
     #Unzip Joomla Patch for Modules
     #Check to make that Mod_mainmenu exists first of all.
     if (file_exists(JPATH_ROOT . "modules/mod_mainmenu/helper.php")) {
         #Unzip and Patch the Libraries
         $plg_destination = JPATH_ROOT . "/libraries/joomla/application/module/";
         $joomla_patch_zip = $this->frontendPath . "joomla_patch_libraries.zip";
         $html = '<div style="width:100%; float:left;">' . JText::_('Patching Library modules...') . '</div><br/>';
         if (caclInstaller::extractArchive($joomla_patch_zip, $plg_destination)) {
             $autoSubmit .= caclInstaller::getAutoSubmitFunction();
             $message = $autoSubmit . $html;
             #move the file over
             $plg_destination = JPATH_ROOT . "/libraries/joomla/application/module/";
             $filename = JPATH_ROOT . "/libraries/joomla/application/module/joomla_patch_libraries/helper.php";
             if (caclInstaller::moveFile($filename, $plg_destination)) {
                 $autoSubmit .= caclInstaller::getAutoSubmitFunction();
                 $message = $autoSubmit . $html;
             } else {
                 $errorMsg .= "<p style='color:red'>Unable to move Helper.php file over to mod_mainmenu</p>";
                 $message .= $html . $errorMsg;
             }
         } else {
             $errorMsg .= "<p style='color:red'>Unable to patch libraries</p>";
             $message .= $html . $errorMsg;
         }
         #Unzip and Patch the Modules
         $plg_destination = JPATH_ROOT . "/modules/mod_mainmenu/";
         $joomla_patch_zip = $this->frontendPath . "joomla_patch_modules.zip";
         $html = '<div style="width:100%; float:left;">' . JText::_('Patching Main menu module...') . '</div><br/>';
         if (caclInstaller::extractArchive($joomla_patch_zip, $plg_destination)) {
             $autoSubmit .= caclInstaller::getAutoSubmitFunction();
             $message = $autoSubmit . $html;
             #move the file over
             $plg_destination = JPATH_ROOT . "/modules/mod_mainmenu/";
             $filename = JPATH_ROOT . "/modules/mod_mainmenu/joomla_patch_libraries/helper.php";
             if (caclInstaller::moveFile($filename, $plg_destination)) {
                 $autoSubmit .= caclInstaller::getAutoSubmitFunction();
                 $message = $autoSubmit . $html;
             } else {
                 $errorMsg .= "<p style='color:red'>Unable to move Helper.php file over to mod_mainmenu</p>";
                 $message .= $html . $errorMsg;
             }
             #-Legacy file
             $filename = JPATH_ROOT . "/modules/mod_mainmenu/joomla_patch_libraries/legacy.php";
             if (caclInstaller::moveFile($filename, $plg_destination)) {
                 $autoSubmit .= caclInstaller::getAutoSubmitFunction();
                 $message = $autoSubmit . $html;
             } else {
                 $errorMsg .= "<p style='color:red'>Unable to move Legacy.php file over to mod_mainmenu</p>";
                 $message .= $html . $errorMsg;
             }
         } else {
             $errorMsg .= "<p style='color:red'>Unable to patch Mod_mainmenu</p>";
             $message .= $html . $errorMsg;
         }
         $message .= "</div>";
     } else {
         $errorMsg .= "</div><p style='color:blue'>Community ACL can not find the Joomla! mod_mainmenu module to patch. Will this cause issues for your installation? NO! - \n\t\t\tThis just means that any menus you disallow will be visible to your users - they will however not have access to the what you have blocked the user from doing.</p><p style='color:green'>It is safe to continue forward.</p>";
         $message .= $errorMsg;
     }
     $link = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_community_acl&task=install&step=4';
     $inputbox = "</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>";
     return $message . $inputbox;
 }