function guessWebpath() { $path = dirname($_SERVER['SCRIPT_NAME']); if (preg_match('#/www/admin$#', $path)) { // User has web root configured as Openads' root directory so can guess at all locations $subpath = preg_replace('#/www/admin$#', '', $path); $basepath = OX_getHostNameWithPort() . $subpath . '/www/'; $this->setValue('webpath', 'admin', $basepath . 'admin'); $this->setValue('webpath', 'delivery', $basepath . 'delivery'); $this->setValue('webpath', 'deliverySSL', $basepath . 'delivery'); $this->setValue('webpath', 'images', $basepath . 'images'); $this->setValue('webpath', 'imagesSSL', $basepath . 'images'); } else { if (preg_match('#/admin$#', $path)) { // User has web root configured as Openads' /www directory so can guess at all locations $subpath = preg_replace('#/admin$#', '', $path); $basepath = OX_getHostName() . $subpath . ''; $this->setValue('webpath', 'admin', $basepath . '/admin'); $this->setValue('webpath', 'delivery', $basepath . '/delivery'); $this->setValue('webpath', 'deliverySSL', $basepath . '/delivery'); $this->setValue('webpath', 'images', $basepath . '/images'); $this->setValue('webpath', 'imagesSSL', $basepath . '/images'); } else { // User has web root configured as Openads' www/admin directory so can only guess the admin location $this->setValue('webpath', 'admin', OX_getHostName()); $this->setValue('webpath', 'delivery', OX_getHostName()); $this->setValue('webpath', 'images', OX_getHostName()); $this->setValue('webpath', 'deliverySSL', OX_getHostName()); $this->setValue('webpath', 'imagesSSL', OX_getHostName()); } } }
/** * Returns base url for the request. * * @return string */ public function getBaseUrl() { if ($this->baseUrl == null) { $baseUrl = 'http' . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ? 's' : '') . '://'; $baseUrl .= OX_getHostNameWithPort() . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1); $this->baseUrl = $baseUrl; } return $this->baseUrl; }
$DO_DIR = opendir($path . '/var/plugins/DataObjects/'); while ($file = readdir($DO_DIR)) { if (!is_file($path . '/var/plugins/DataObjects/' . $file)) { continue; } @copy($path . '/var/plugins/DataObjects/' . $file, MAX_PATH . '/var/plugins/DataObjects/' . $file); } } else { $importErrors = true; } } } if (!$importErrors) { // Use current url as base path for calling install-plugin $baseInstalUrl = 'http' . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ? 's' : '') . '://'; $baseInstalUrl .= OX_getHostNameWithPort() . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1); if ($_COOKIE['oat'] == OA_UPGRADE_UPGRADE) { foreach ($GLOBALS['_MAX']['CONF']['plugins'] as $name => $enabled) { $aUrls[] = array('name' => $name, 'url' => $baseInstalUrl . 'install-plugin.php?status=1&plugin=' . $name); } } // get the list of bundled plugins, retain order include MAX_PATH . '/etc/default_plugins.php'; if ($aDefaultPlugins) { foreach ($aDefaultPlugins as $idx => $aPlugin) { if (!array_key_exists($aPlugin['name'], $GLOBALS['_MAX']['CONF']['plugins'])) { $url = $baseInstalUrl . 'install-plugin.php?status=0&plugin=' . $aPlugin['name']; if (!empty($aPlugin['disabled'])) { $url .= '&disabled=1'; } $aUrls[] = array('name' => $aPlugin['name'], 'url' => $url);