예제 #1
0
파일: Application.php 프로젝트: visor/nano
 /**
  * @return \Nano\Application
  *
  * @throws \Nano\Application\Exception\InvalidConfiguration
  */
 public function configure()
 {
     if (!$this->offsetExists('configFormat')) {
         throw new Application\Exception\InvalidConfiguration('Configuration format not specified');
     }
     \Nano::setApplication($this);
     if (!$this->offsetExists('rootDir')) {
         $this->withRootDir(getCwd());
     }
     if (!$this->offsetExists('publicDir')) {
         $this->withPublicDir($this->rootDir . DIRECTORY_SEPARATOR . self::PUBLIC_DIR_NAME);
     }
     if (!$this->offsetExists('modulesDir')) {
         $this->withModulesDir($this->rootDir . DIRECTORY_SEPARATOR . self::MODULES_DIR_NAME);
     }
     if (!$this->offsetExists('sharedModulesDir')) {
         $this->withSharedModulesDir($this->nanoRootDir . DIRECTORY_SEPARATOR . self::MODULES_DIR_NAME);
     }
     if ('cli' !== php_sapi_name()) {
         $this->errorHandler = new Application\ErrorHandler();
     }
     $this->readOnly('config', new Application\Config($this->rootDir . DIRECTORY_SEPARATOR . 'settings', $this->configFormat));
     $this->setupErrorReporting();
     return $this;
 }
예제 #2
0
파일: Abstract.php 프로젝트: visor/nano
 protected function setUp()
 {
     $this->app->backup();
     $this->workingDir = getCwd();
     chDir($GLOBALS['application']->rootDir);
     $this->application = new \Nano\Application();
 }
예제 #3
0
 protected function setUp()
 {
     $this->app->backup();
     ob_start();
     $this->setUseOutputBuffering(true);
     $this->appRoot = dirName(__DIR__) . '/Application/_files';
     $this->cwd = getCwd();
     $this->cli = new \Nano\Cli();
     chDir($this->appRoot);
     $this->cli->run(array());
 }
예제 #4
0
파일: Pest.php 프로젝트: aichingm/Pest
 public function __construct($name, $options = null)
 {
     $this->name = $name;
     if ($options != null) {
         $this->options = $options;
     }
     if ($this->options & self::OPTION_CHDIR) {
         $this->workingDir = getCwd();
         $newCwd = dirname(debug_backtrace()[0]['file']);
         chdir($newCwd);
     }
 }
예제 #5
0
파일: CommonTest.php 프로젝트: visor/nano
 protected function setUp()
 {
     $this->app->backup();
     ob_start();
     $this->setUseOutputBuffering(true);
     $application = new \Nano\Application();
     $application->withRootDir($GLOBALS['application']->rootDir)->withConfigurationFormat('php')->configure();
     $this->appRoot = dirName(__DIR__) . '/Application/_files';
     $this->nanoRoot = $application->nanoRootDir;
     $this->cwd = getCwd();
     $this->cli = new \Nano\Cli();
     chDir($this->appRoot);
 }
예제 #6
0
파일: module.php 프로젝트: visor/nano
 /**
  * @return void
  * @param string[] $args
  */
 public function run(array $args)
 {
     $this->path = isset($args[0]) ? $args[0] : getCwd();
     if (!file_exists($this->path)) {
         mkDir($this->path, 0755, true);
     }
     if (!is_dir($this->path)) {
         $this->stop($this->path . ' is not directory', 1);
     }
     if (!is_writable($this->path)) {
         $this->stop('Cannot write into directory ' . $this->path, 1);
     }
     echo 'Creating module skeleton in ' . $this->path, PHP_EOL;
     $this->defaults = __DIR__ . DIRECTORY_SEPARATOR . 'app';
     $this->createDirectoryStructure();
     echo 'Done.', PHP_EOL;
 }
예제 #7
0
 public function __construct($theClass = '', $name = '')
 {
     $this->setName(get_class($this));
     $zendPath = getCwd();
     chdir(realpath(dirname(__FILE__)));
     require_once 'PHPUnit/Util/Configuration.php';
     // test phpUnit version
     if (version_compare(PHPUnit_Runner_Version::id(), '3.4', '>=')) {
         $configuration = PHPUnit_Util_Configuration::getInstance('phpunit.xml');
     } else {
         $configuration = new PHPUnit_Util_Configuration('phpunit.xml');
     }
     $testSuite = $configuration->getTestSuiteConfiguration(false);
     chdir($zendPath);
     foreach ($testSuite->tests() as $test) {
         if (!$test instanceof PHPUnit_Framework_Warning) {
             $this->addTestSuite($test);
         }
     }
 }
예제 #8
0
 * PHP version 5
 *
 * @category  PHP
 * @package   PHP_CodeSniffer
 * @author    Benjamin Pearson <*****@*****.**>
 * @author    Greg Sherwood <*****@*****.**>
 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
 * @link      http://pear.php.net/package/PHP_CodeSniffer
 */
error_reporting(E_ALL | E_STRICT);
if (ini_get('phar.readonly') === '1') {
    echo 'Unable to build, phar.readonly in php.ini is set to read only.' . PHP_EOL;
    exit(1);
}
$cwd = getCwd();
require_once __DIR__ . '/../CodeSniffer.php';
$scripts = array('phpcs', 'phpcbf');
foreach ($scripts as $script) {
    echo "Building {$script} phar" . PHP_EOL;
    $pharFile = $cwd . '/' . $script . '.phar';
    echo "\t=> {$pharFile}" . PHP_EOL;
    if (file_exists($pharFile) === true) {
        echo "\t** file exists, removing **" . PHP_EOL;
        unlink($pharFile);
    }
    $phar = new Phar($pharFile, 0, $script . '.phar');
    echo "\t=> adding files from package.xml... ";
    buildFromPackage($phar);
    echo 'done' . PHP_EOL;
    echo "\t=> adding stub... ";
예제 #9
0
                include $file;
                pre_uninstall();
            }
            break;
        default:
            break;
    }
}
//
// perform the action
//
for ($iii = 0; $iii < $_REQUEST['copy_count']; $iii++) {
    if (isset($_REQUEST["copy_" . $iii]) && $_REQUEST["copy_" . $iii] != "") {
        $file_to_copy = $_REQUEST["copy_" . $iii];
        $src_file = clean_path("{$unzip_dir}/{$zip_from_dir}/{$file_to_copy}");
        $sugar_home_dir = getCwd();
        $dest_file = clean_path("{$sugar_home_dir}/{$zip_to_dir}/{$file_to_copy}");
        if ($zip_to_dir != '.') {
            $rest_file = clean_path("{$rest_dir}/{$zip_to_dir}/{$file_to_copy}");
        } else {
            $rest_file = clean_path("{$rest_dir}/{$file_to_copy}");
        }
        switch ($mode) {
            case "Install":
                mkdir_recursive(dirname($dest_file));
                if ($install_type == "patch" && is_file($dest_file)) {
                    if (!is_dir(dirname($rest_file))) {
                        mkdir_recursive(dirname($rest_file));
                    }
                    copy($dest_file, $rest_file);
                    sugar_touch($rest_file, filemtime($dest_file));
예제 #10
0
<?php

function e($str, $rtn = false)
{
    if ($rtn === false) {
        echo htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
    } else {
        return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
    }
}
?>
<html>
<title><?php 
e(getCwd());
?>
</title>
<body>
<h1>Index of <?php 
e(getCwd());
?>
</h1> 
<hr>
<?php 
foreach (glob('*') as $filename) {
    echo "<a href='" . e($filename, 1) . "'>" . e($filename, 1) . "</a><br>";
}
?>
</body>
</html>
예제 #11
0
파일: dependencies.php 프로젝트: visor/nano
 /**
  * @return string
  */
 protected function checkDestinationFolder()
 {
     echo 'Checking destination directory', PHP_EOL;
     $destination = getCwd() . DIRECTORY_SEPARATOR . self::DIR_DEPENCIES;
     if (file_exists($destination) && !is_dir($destination)) {
         echo '   Not directory, ignore', PHP_EOL;
         exit;
     }
     if (!file_exists($destination)) {
         mkDir($destination, 0755, true);
     }
     echo 'Done', PHP_EOL;
     return $destination;
 }
예제 #12
0
<?php

phpinfo();
include "inc/conf.php";
echo "<center><table>";
echo "<tr><td>LxO Pfad:</td><td>" . getCwd() . "</td></tr>";
?>
</table>
<a href="status.php">Status</a>
</center>
예제 #13
0
파일: Cli.php 프로젝트: visor/nano
 /**
  * @return boolean
  */
 protected function detectApplicationDirectory()
 {
     $dir = getCwd();
     $found = false;
     do {
         if (file_exists($dir . DS . self::BOOTSTRAP)) {
             $found = true;
             $this->applicationDir = $dir;
         } else {
             $dir = dirName($dir);
         }
     } while (!$found && strLen($dir) > 1);
     if ($found) {
         $this->loadApplication();
     }
 }
예제 #14
0
 public function testDetectingDefaultApplicationRootDir()
 {
     self::assertFalse($this->application->offsetExists('rootDir'));
     $this->application->withConfigurationFormat('php')->configure();
     self::assertEquals(getCwd(), $this->application->rootDir);
 }
예제 #15
0
function findAllFilesRelative($the_dir, $the_array)
{
    $original_dir = getCwd();
    chdir($the_dir);
    $the_array = findAllFiles(".", $the_array);
    chdir($original_dir);
    return $the_array;
}
예제 #16
0
function findAllFilesRelative($the_dir, $the_array)
{
    if (!is_dir($the_dir)) {
        return $the_array;
    }
    $original_dir = getCwd();
    if (is_dir($the_dir)) {
        chdir($the_dir);
        $the_array = findAllFiles(".", $the_array);
        if (is_dir($original_dir)) {
            chdir($original_dir);
        }
    }
    return $the_array;
}
예제 #17
0
<?php

// SET COOKIES TO PERSIST FOR A WEEK (UNLESS MANUALLY LOGGED OUT)
// VITAL FOR MOBILE - OTHERWISE PERSON GETS LOGGED OUT EVERY TIME THEY CLOSE THE APP
ini_set('session.cookie_lifetime', 60 * 60 * 24 * 7);
// 7 day cookie lifetime
session_start();
global $app;
$config = array();
if (strpos(getCwd(), "var") !== false) {
    $environment = "prod";
} else {
    $environment = "local";
}
switch ($environment) {
    // localhost configuration
    case "local":
        $config["database"] = array("servername" => 'localhost', "username" => "root", "password" => "root", "database" => "whym");
        $config['facebook_secret'] = '71304a0e6f282f03280c799f10e5238e';
        $config["client"] = array('base_url' => 'http://www.localhost.com/biz/whym/app', "facebook" => array("appId" => '583531605136818'));
        break;
        // development environment configuration
    // development environment configuration
    case "prod":
        $config["database"] = array("servername" => "localhost", "username" => "root", "password" => "mFFf6rbfOh", "database" => "whym");
        $config['facebook_secret'] = 'a58d2f9b42477bb9a207d601cd2078a5';
        $config["client"] = array('base_url' => 'http://whymtech.com/', "facebook" => array("appId" => '1590175971308287'));
        break;
}
$config['client']['redirect_url'] = $config['client']['base_url'];
if ($app == 'admin') {
예제 #18
0
 public static function path($sPath)
 {
     return implode(DIRECTORY_SEPARATOR, array_merge(explode(DIRECTORY_SEPARATOR, getCwd()), explode(DIRECTORY_SEPARATOR, $sPath)));
 }