Example #1
0
 /**
  * Install webtools
  *
  * @param  string     $path
  * @return void
  * @throws \Exception if document root cannot be located
  */
 public static function install($path)
 {
     $path = rtrim(realpath($path), '/') . '/';
     $tools = realpath(__DIR__ . '/../../../');
     if (PHP_OS == 'WINNT') {
         $path = str_replace("\\", '/', $path);
         $tools = str_replace("\\", '/', $tools);
     }
     if (!is_dir($path . 'public/')) {
         throw new \Exception('Document root cannot be located');
     }
     TBootstrap::install($path);
     CodeMirror::install($path);
     copy($tools . '/webtools.php', $path . 'public/webtools.php');
     if (!file_exists($configPath = $path . 'public/webtools.config.php')) {
         $template = file_get_contents(TEMPLATE_PATH . '/webtools.config.php');
         $code = str_replace('@@PATH@@', $tools, $template);
         file_put_contents($configPath, $code);
     }
 }
Example #2
0
 /**
  * Installs webtools
  *
  */
 public static function install($path)
 {
     $path = rtrim(realpath($path), '/') . '/';
     $tools = realpath(__DIR__ . '/../../../');
     if (PHP_OS == 'WINNT') {
         $path = str_replace("\\", '/', $path);
         $tools = str_replace("\\", '/', $tools);
     }
     if (!is_dir($path . 'public/')) {
         throw new \Exception('Document root cannot be located');
     }
     TBootstrap::install($path);
     CodeMirror::install($path);
     copy($tools . '/webtools.php', $path . 'public/webtools.php');
     if (!file_exists($configPath = $path . 'public/webtools.config.php')) {
         $code = "<?php\ndefine('PTOOLSPATH', '{$tools}');\n/* you can set ADMINIP as IP 192.168.0.1 or SUBNET 192. or 10.0.2. or 86.84.124. */\ndefine('ADMINIP', '192.168.');\n";
         file_put_contents($configPath, $code);
     }
 }
Example #3
0
 /**
  * Install webtools
  *
  * @param  string     $path
  * @return bool
  * @throws Exception if document root cannot be located
  */
 public static function install($path)
 {
     $path = realpath($path) . DIRECTORY_SEPARATOR;
     if (!($tools = getenv('PTOOLSPATH'))) {
         $tools = realpath(__DIR__ . '/../../../');
     }
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $path = str_replace("\\", DIRECTORY_SEPARATOR, $path);
         $tools = str_replace("\\", DIRECTORY_SEPARATOR, $tools);
     }
     if (!is_dir($path . 'public' . DIRECTORY_SEPARATOR)) {
         throw new Exception('Document root cannot be located');
     }
     $bootstrap = new Bootstrap();
     $bootstrap->install($path);
     $codeMirror = new CodeMirror();
     $codeMirror->install($path);
     $jQuery = new JQuery();
     $jQuery->install($path);
     copy($tools . '/webtools.php', $path . 'public/webtools.php');
     if (!file_exists($configPath = $path . 'public/webtools.config.php')) {
         $template = file_get_contents(TEMPLATE_PATH . '/webtools.config.php');
         $code = str_replace('@@PATH@@', $tools, $template);
         file_put_contents($configPath, $code);
     }
     return true;
 }
Example #4
0
 /**
  * Installs webtools
  *
  */
 public static function install($path)
 {
     if (!is_dir('public/')) {
         throw new \Exception("Document root cannot be located");
     }
     TBootstrap::install($path);
     CodeMirror::install($path);
     copy($path . 'webtools.php', 'public/webtools.php');
     $webToolsConfigPath = "public/webtools.config.php";
     if (PHP_OS == "WINNT") {
         $pToolsPath = str_replace("\\", "/", $path);
     } else {
         $pToolsPath = $path;
     }
     $code = "<?php\n\ndefine(\"PTOOLSPATH\", \"" . realpath($pToolsPath) . "\");\n\n";
     if (!file_exists($webToolsConfigPath)) {
         file_put_contents($webToolsConfigPath, $code);
     }
 }