Exemplo n.º 1
0
 function renderExceptionMessage(\Exception $exception, $debug = false)
 {
     if ($debug) {
         echo ExceptionHandlerFormatter::format($exception, true);
     } else {
         $p = Main\IO\Path::convertRelativeToAbsolute("/error.php");
         if (Main\IO\File::isFileExists($p)) {
             include $p;
         } else {
             $context = Main\Application::getInstance();
             if ($context) {
                 echo Main\Localization\Loc::getMessage("eho_render_exception_message");
             } else {
                 echo "A error occurred during execution of this script. You can turn on extended error reporting in .settings.php file.";
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Search connection parameters (type, host, db, login and password) by connection name
  *
  * @param string $name Connection name
  * @return array('type' => string, 'host' => string, 'db_name' => string, 'login' => string, 'password' => string, "init_command" => string, "options" => string)|null
  * @throws \Freetrix\Main\ArgumentTypeException
  * @throws \Freetrix\Main\ArgumentNullException
  */
 private function searchConnectionParametersByName($name)
 {
     if (!is_string($name)) {
         throw new \Freetrix\Main\ArgumentTypeException("name", "string");
     }
     if ($name === "") {
         throw new \Freetrix\Main\ArgumentNullException("name");
     }
     if ($name === self::DEFAULT_CONNECTION) {
         $v = \Freetrix\Main\Config\Configuration::getValue(self::DEFAULT_CONNECTION_CONFIGURATION);
         if ($v != null) {
             return $v;
         }
         $DBType = "";
         $DBHost = "";
         $DBName = "";
         $DBLogin = "";
         $DBPassword = "";
         include \Freetrix\Main\IO\Path::convertRelativeToAbsolute("/freetrix/php_interface/dbconn.php");
         return array("type" => $DBType, "host" => $DBHost, "db_name" => $DBName, "login" => $DBLogin, "password" => $DBPassword);
     }
     /* TODO: реализовать */
     return null;
 }
Exemplo n.º 3
0
 /**
  * Reads the configuration.
  *
  * @return array
  */
 public function includeConfiguration()
 {
     if (!isset($this->options)) {
         $arHTMLPagesOptions = array();
         $configurationPath = Main\IO\Path::convertRelativeToAbsolute(Main\Application::getPersonalRoot() . "/html_pages/.config.php");
         if (file_exists($configurationPath)) {
             include $configurationPath;
         }
         $this->options = $arHTMLPagesOptions;
     }
     return $this->options;
 }
Exemplo n.º 4
0
	public static function OnChangeFile($path, $site)
	{
		$pagesDir = new IO\Directory(IO\Path::convertRelativeToAbsolute(Application::getPersonalRoot()."/html_pages"));
		if (!$pagesDir->isExists())
		{
			return;
		}

		$bytes = 0.0;
		$domainDirs = $pagesDir->getChildren();
		$cachedFile = \Freetrix\Main\Data\StaticHtmlCache::convertUriToPath($path);
		foreach ($domainDirs as $domainDir)
		{
			if ($domainDir->isDirectory())
			{
				$bytes += self::deleteRecursive("/".$domainDir->getName().$cachedFile);
			}
		}

		self::updateQuota(-$bytes);
	}