コード例 #1
0
 static function checkSafePath($safePath = 0)
 {
     if ($safePath == 0) {
         $safePath = VmConfig::get('forSale_path', 0);
         if (self::$tested) {
             return $safePath;
         }
     }
     $warn = FALSE;
     $uri = JFactory::getURI();
     $configlink = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
     VmConfig::loadJLang('com_virtuemart');
     if (empty($safePath)) {
         $warn = 'COM_VIRTUEMART_WARN_NO_SAFE_PATH_SET';
     } else {
         $exists = JFolder::exists($safePath);
         if (!$exists) {
             $warn = 'COM_VIRTUEMART_WARN_SAFE_PATH_WRONG';
         } else {
             if (!is_writable($safePath)) {
                 VmConfig::loadJLang('com_virtuemart_config');
                 VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NOT_WRITEABLE', JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath, $configlink);
             } else {
                 if (!is_writable(self::getInvoicePath($safePath))) {
                     VmConfig::loadJLang('com_virtuemart_config');
                     VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_INV_NOT_WRITEABLE', JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath, $configlink);
                 }
             }
         }
     }
     if ($warn) {
         self::$tested = true;
         $suggestedPath = shopFunctions::getSuggestedSafePath();
         VmConfig::loadJLang('com_virtuemart_config');
         VmWarn($warn, JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $suggestedPath, $configlink);
         return FALSE;
     }
     return $safePath;
 }