Beispiel #1
0
    function echoHTML()
    {
        jpimport('helpers.lang');
        $errorStack = array();
        // Initialize an errors stack
        // Cleanup locks
        jpimport('classes.core.cube');
        JoomlapackCUBE::cleanup();
        // Test for the existence of a default temporary folder
        if (!is_dir(JPATH_COMPONENT_ADMINISTRATOR . DS . 'backup')) {
            // Temp dir doesn't exist; try to create one
            if (!@mkdir(JPATH_COMPONENT_ADMINISTRATOR . DS . 'backup')) {
                $errorStack[] = JoomlapackLangManager::_('UNLOCK_CANTCREATEDIR');
            } else {
                // Try creating a deafult .htaccess
                $htaccess = <<<END
Deny from all
END;
                $fp = @fopen(JPATH_COMPONENT_ADMINISTRATOR . DS . 'backup' . DS . '.htaccess');
                if ($fp === false) {
                    $errorStack[] = JoomlapackLangManager::_('UNLOCK_CANTCREATEHTACCESS');
                } else {
                    @fputs($fp, $htaccess);
                    @fclose($fp);
                }
            }
        }
        // Get some more HTML fragments
        echo JoomlapackCommonHTML::getAdminHeadingHTML(JoomlapackLangManager::_('CPANEL_UNLOCK'));
        ?>
		<p>
		<?php 
        if (count($errorStack) == 0) {
            echo JoomlapackLangManager::_('UNLOCK_DONE');
        } else {
            foreach ($errorStack as $error) {
                echo "<p class=\"error\">{$error}</p>";
            }
        }
        ?>
		</p>
		<?php 
    }
Beispiel #2
0
 /**
  * The public interface of JoomlapackCUBE, tick() does a single chunk of processing and returns a
  * CUBE Return Array.
  *
  * @return array
  */
 function tick()
 {
     if (!$this->_isFinished) {
         JoomlapackTables::WriteVar('CUBELock', time());
         // Update lock timestamp
         switch ($this->_runAlgorithm()) {
             case 0:
                 // more work to do, return OK
                 JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: More work required in domain '" . $this->_currentDomain);
                 break;
             case 1:
                 // Engine part finished
                 JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: Domain '" . $this->_currentDomain . "' has finished");
                 $this->_getNextObject();
                 if ($this->_currentDomain == "finale") {
                     // We have finished the whole process.
                     JoomlapackCUBE::cleanup();
                     JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: Just finished");
                 }
                 break;
             case 2:
                 JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: Error occured in domain '" . $this->_currentDomain);
                 // An error occured...
                 JoomlapackCUBE::cleanup();
                 break;
         }
         // switch
         return $this->_makeCUBEArray();
     }
 }