Пример #1
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;
 }
Пример #2
0
 /**
  * Writes a serialized copy of the $contentVariable to the database, under the packvar
  * variable name of $varName.
  *
  * @param string $varName The packvar to create
  * @param mixed $contentVariable Any variable to serialize (e.g. object, array, other variables, etc) 
  */
 function SerializeVar($varName, &$contentVariable)
 {
     $serialized = serialize($contentVariable);
     JoomlapackTables::WriteVar($varName, $serialized);
 }