Пример #1
0
 function _checkCollision()
 {
     jpimport('classes.core.utility.configuration');
     $lastLock = JoomlapackTables::ReadVar('CUBELock');
     // Expire CUBE lock after two minutes of inactivity
     if (is_null($lastLock)) {
         $noLock = true;
     } else {
         $now = time();
         $noLock = $now - $lastLock > 120;
     }
     if (!$noLock) {
         die(JoomlapackLangManager::_('FRONTEND_STATUS501'));
     }
 }
Пример #2
0
 function unregisterAndDeleteTempFile($fileName, $removePrefix = false)
 {
     $configuration =& JoomlapackConfiguration::getInstance();
     if ($removePrefix) {
         $fileName = str_replace($configuration->get('TempDirectory'), '', $fileName);
         if (substr($fileName, 1, 1) == '/' || substr($fileName, 1, 1) == '\\') {
             $fileName = substr($fileName, 2, strlen($fileName) - 1);
         }
     }
     if (JoomlapackTables::CountVar('CUBETempFiles') >= 1) {
         $serialized = JoomlapackTables::ReadVar('CUBETempFiles');
         $tempFiles = unserialize($serialized);
         $newTempFiles = array();
         if (is_array($tempFiles)) {
             $aFile = array_shift($tempFiles);
             while (!is_null($aFile)) {
                 if ($aFile != $fileName) {
                     $newTempFiles[] = $aFile;
                 }
                 $aFile = array_shift($tempFiles);
             }
         }
         if (count($newTempFiles) == 0) {
             JoomlapackTables::DeleteVar('CUBETempFiles');
         } else {
             $serialized = serialize($newTempFiles);
             JoomlapackTables::WriteVar('CUBETempFiles', $serialized);
         }
     }
     $file = $configuration->get('TempDirectory') . DS . $fileName;
     return file_exists($file) ? @unlink($file) : false;
 }
Пример #3
0
 /**
  * Reads and unserializes a packvar variable (combo function)
  *
  * @param string $varName The variable name to read
  * @param mixed $default The default unserialized data to return if the $varName doesn't exist
  * @return mixed The unserialized value read from database
  */
 function UnserializeVar($varName, $default = null)
 {
     if (JoomlapackTables::CountVar($varName) >= 1) {
         $serialized = JoomlapackTables::ReadVar($varName);
         return unserialize($serialized);
     } else {
         return $default;
     }
 }