public function __construct($envParams, $kmigpath, $integId)
 {
     foreach ($envParams as $k => $v) {
         putenv($k . '=' . $v);
     }
     $container = array();
     if (file_exists($kmigpath . '/phpmig.php')) {
         $this->_hasPhpmig = true;
         require $kmigpath . '/phpmig.php';
         if (empty($container)) {
             throw new Exception('invalid container, make sure the relevant phpmig.php file sets a $container variable');
         }
         $this->_container = $container;
         $datafilename = KmsCi_Kmig_IntegrationHelper::getInstanceByIntegrationId($integId)->getKmigPhpmigDataFileName();
         if (file_Exists($datafilename)) {
             $this->_hasKmigData = true;
             \Kmig\Helper\Phpmig\KmigAdapter::setContainerValuesFromDataFile($this->_container, $datafilename);
         }
         $this->_command = new KmsCi_Environment_PhpmigHelper_Command();
         $this->_command->kmig_container = $this->_container;
         $this->_allMigrations = $this->_command->kmig_getMigrations();
         /** @var \Kmig\Helper\Phpmig\KmigAdapter $adapter */
         $adapter = $this->_container['phpmig.adapter'];
         $this->_allVersions = $adapter->fetchAll();
     }
 }
Beispiel #2
0
 public function testFilePath()
 {
     $path = File::generateFilepath('activemongo');
     $this->assertTrue(file_Exists($path));
     $this->assertTrue(preg_match("@" . DIRECTORY_SEPARATOR . "activemongo" . DIRECTORY_SEPARATOR . "@", $path) > 0);
     $this->assertTrue(is_writable($path));
     $this->assertEquals($path, File::generateFilepath('activemongo'));
     $this->assertNotEquals($path, File::generateFilepath('activemongo', 'mongo://'));
 }
Beispiel #3
0
function __autoload($class)
{
    if (file_Exists($file = rm_class2file($class))) {
        require_once $file;
    } else {
        echo "<PRE>";
        debug_print_backtrace();
        echo "</PRE>";
    }
}
 public function destroyImage(ProductImage $productImage, $id)
 {
     $image = $productImage->find($id);
     if (file_Exists(public_path() . '/uploads/' . $image->id . '.' . $image->extension)) {
         Storage::disk('public_local')->delete($image->id . '.' . $image->extension);
     }
     $product = $image->product;
     $image->delete();
     return redirect()->route('products.images', ['id' => $product->id]);
 }
Beispiel #5
0
 /**
  * This ugly methods allows you to have a 'managed' catch-all html template system.
  */
 function init($p1 = '', $p2 = '', $p3 = '', $p4 = '', $p5 = '', $p6 = '')
 {
     $parts = array($p1, $p2, $p3, $p4, $p5, $p6);
     $dir = implode("/", $parts);
     $path = pathinfo($dir);
     $file = MAIN_DIR . "/content/" . $path['dirname'] . "/" . $path['filename'] . ".html";
     if (file_Exists($file)) {
         $content = file_get_contents($file);
         return $content;
     }
 }
Beispiel #6
0
 public function testCompile()
 {
     define('file', __DIR__ . '/generated/' . __CLASS__ . '.php');
     $gen = new Generator();
     $this->assertFalse(file_Exists(file));
     $gen->addDirectory(__DIR__ . '/input');
     $gen->setOutput(file);
     $gen->generate();
     $this->assertTrue(file_Exists(file));
     // add mockup cache class
     require __DIR__ . "/input/cache_class.php";
 }
Beispiel #7
0
 public function testCompile()
 {
     $gen = new Generator();
     $file = __DIR__ . '/generated/' . __CLASS__ . '.php';
     $this->assertFalse(file_Exists($file));
     $gen->addDirectory(__DIR__ . '/input');
     $gen->setNamespace(__CLASS__);
     $gen->setOutput($file);
     $gen->generate();
     $this->assertTrue(file_Exists($file));
     require $file;
     // add mockup cache class
     require __DIR__ . "/input/cache_class.php";
 }
Beispiel #8
0
 protected function init()
 {
     include_once "sfYaml/sfYaml.class.php";
     define('R2T_TEMP_DIR', R2T_PROJECT_DIR . "/tmp/");
     if (!file_Exists(R2T_TEMP_DIR)) {
         if (!mkdir(R2T_TEMP_DIR)) {
             die("Could not create " . R2T_TEMP_DIR);
         }
     }
     $yaml = file_get_contents(R2T_PROJECT_DIR . '/conf/defaults.yml');
     $yaml .= file_get_contents(R2T_PROJECT_DIR . '/conf/feeds.yml');
     $f = sfYAML::Load($yaml);
     if ($f['feeds']) {
         $this->feeds = $f['feeds'];
     }
     $this->defaults = $f['defaults'];
 }
Beispiel #9
0
function doJSONArrayDecode($string)
{
    $result = array();
    if (function_exists("json_decode")) {
        try {
            $result = json_decode($string);
        } catch (Exception $e) {
            $result = null;
        }
    } elseif (file_Exists("json.php")) {
        require_once 'json.php';
        $json = new Services_JSON();
        $result = $json->decode($string);
        if (!is_array($result)) {
            $result = array();
        }
    }
    return $result;
}
 /**
  * Create a new Hyphenator-Object for a certain locale
  *
  * To determine the storage of the dictionaries we either use the set
  * default configuration-file or we take the provided file and set the
  * home-path from the information within that file.
  *
  * @param string $path   The path to the configuration-file to use
  * @param string $locale The locale to be used
  *
  * @return Hyphenator
  */
 public static function factory($path = null, $locale = null)
 {
     $hyphenator = new Hyphenator();
     if (null !== $path && file_Exists($path)) {
         $hyphenator->setHomePath($path);
     }
     if (null !== $locale) {
         $hyphenator->getOptions()->setDefaultLocale($locale);
     }
     return $hyphenator;
 }
Beispiel #11
0
 public function testCompile()
 {
     $file = __DIR__ . '/generated/' . __CLASS__ . '.php';
     define('xfile', $file);
     $router = new Dispatcher\Router($file);
     $router->addFile(__FILE__)->setNamespace(__CLASS__);
     $this->assertFalse(file_Exists($file));
     $router->load();
     $this->assertTrue(file_Exists($file));
 }
Beispiel #12
0
<?php

if (!file_Exists(dirname(__FILE__) . '/inc.var.php')) {
    echo "to run ownStaGram follow these few steps:<br/><br/>";
    echo "1) create a new database and set user permissions.<br/><br/>";
    echo "2) rename <i>inc.var.php.dist</i> to <i>inc.var.php</i> and set database-credentials.<br/><br/>";
    echo "3) change line <i>define('ownStaGramAdmin', '*****@*****.**');</i> to your prefered email-address.<br/><br/>";
    echo "4) make data-folder writable for apache/php.<br/><br/>";
    echo "5) reload this page and register with the emailaddress you set as ownStaGramAdmin.<br/><br/>";
    exit;
}
define('projectPath', dirname(__FILE__));
include_once 'resources/inc.common.php';
error_reporting(-1);
if (!defined('DEBUGMODE') || !DEBUGMODE) {
    ini_set('display_errors', 'off');
    //Debugmode disabled
} else {
    ini_set('display_errors', 'on');
    //Debugmode enabled
}
if (isset($_GET['O'])) {
    $_REQUEST["action"] = $_GET["action"] = "detail";
    $_REQUEST["id"] = $_GET["id"] = $_GET["O"];
}
$settings = $own->getSettings();
$tpl = new template();
$tpl->setVariable($settings);
$tplContent = new template();
$tplContent->setVariable($settings);
if (isset($_GET['id'])) {
include_once "code/userscript.php";
include_once "code/url/url_to_absolute.php";
include_once "code/apk/ApkParser.php";
$response = array();
$build = $_REQUEST['build'];
$mobile = isset($_REQUEST['mobile']) && $_REQUEST['mobile'];
$details = array('jonatkins' => array('path' => 'release', 'name' => 'Stable release build', 'web' => 'http://iitc.jonatkins.com/?page=download', 'mobileweb' => 'http://iitc.jonatkins.com/?page=mobile'), 'jonatkins-test' => array('path' => 'test', 'name' => 'Test build', 'web' => 'http://iitc.jonatkins.com/?page=test', 'mobileweb' => 'http://iitc.jonatkins.com/?page=test#test-mobile'), 'jonatkins-experimental' => array('path' => 'experimental', 'name' => 'Experimental build', 'web' => 'http://iitc.jonatkins.com/?page=test&build=experimental', 'mobileweb' => 'http://iitc.jonatkins.com/?page=test&build=experimental#test-mobile'), 'jonatkins-dev' => array('path' => 'dev', 'name' => 'Development builds - not for public use', 'web' => 'http://iitc.jonatkins.com/?page=test&build=dev', 'mobileweb' => 'http://iitc.jonatkins.com/?page=test&build=dev#test-mobile'), 'local' => array('path' => NULL, 'name' => 'Local build - no update check available'));
if (array_key_exists($build, $details)) {
    $info = $details[$build];
    $pageurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $response['name'] = $info['name'];
    $dir = $info['path'];
    if ($mobile) {
        $apkfile = $dir . '/IITC_Mobile-' . $dir . '.apk';
        if (file_Exists($apkfile)) {
            $apkinfo = new ApkParser($apkfile);
            $manifest = $apkinfo->getManifest();
            $response['mobile'] = array('versionstr' => $manifest->getVersionName(), 'versioncode' => $manifest->getVersionCode(), 'downloadurl' => url_to_absolute($pageurl, $apkfile), 'pageurl' => $info['mobileweb']);
            $archive = $apkinfo->getApkArchive();
            $stream = $archive->getStream("assets/total-conversion-build.user.js");
            if ($stream) {
                $header = loadUserScriptHeader($stream);
                $response['mobile']['iitc_version'] = $header['@version'];
            }
        } else {
            $response['error'] = 'Failed to find .apk file ' . $apkfile;
        }
    } else {
        // desktop - .user.js scripts
        // load main script version
Beispiel #14
0
 public function unlinkOld()
 {
     $G = glob(projectPath . '/data/cache/*.jpg');
     for ($i = 0; $i < count($G); $i++) {
         if (filemtime($G[$i]) < time() - 60 * 60 * 24 * 30) {
             if (file_Exists($G[$i]) && is_file($G[$i])) {
                 unlink($G[$i]);
             }
         }
     }
 }
Beispiel #15
0
include 'Items.php';
// Them we instantiate the server
// Using the rewrite rule on .htaccess file the request url is passed into $_GET['q']
// Therefore we pass this parameter to restserver
// If app is running on root and .htacces working, them restserver can guess the url
$server = new Rest\Server($_GET["q"]);
// The server handles proper mime-types, * is for no extension
$server->setAccept(array("*", "application/json"));
// Using the "setParameter" we can have some globaly available vars
// This var will be accessible to all requests handlers
// Here I define a salt for the user authentication
$server->setParameter("salt", "&dcalsd-09o");
// Since this is just a demo I don't want to get much into
// Logic and stuff, so I'm creating a database on sqlite on
// the fly just to run something
$create = !file_Exists("data.db");
if ($create) {
    touch("data.db");
}
$db = new PDO("sqlite:data.db");
if ($create) {
    $db->query(file_get_contents("schema.sql"));
}
// Again using the server to setup some global database
$server->setParameter("db", $db);
// This is a dummy authentication function receiving
// a server instance (exactly like the handlers will receive)
function authenticate($server)
{
    // First we recover the global parameters
    $db = $server->getParameter("db");
Beispiel #16
0
function data_idlist($db_name, $table_name, $ID, $is_add = true)
{
    $result = false;
    $idlist_file = jsondb_file($db_name, $table_name, 'idlist.json');
    if (!file_Exists($idlist_file)) {
        exec("echo -n \"[\nnull]\" > {$idlist_file}");
    }
    $output = [];
    $return_val = 0;
    if ($is_add === true) {
        exec("grep \"{$ID},\" {$idlist_file}", $output, $return_val);
        //如果没有发现,则添加
        if ($return_val === 1) {
            exec("sed -i '2s/^/{$ID},\\n/' {$idlist_file}", $output, $return_val);
            $result = $return_val === 0;
        }
    } else {
        //直接执行删除,不管原来存在与否
        exec("sed -i '/^{$ID},\$/d' {$idlist_file}", $output, $return_val);
        $result = $return_val === 0;
    }
    return $result;
}
Beispiel #17
0
 protected function doJSONArrayDecode($string)
 {
     $result = array();
     if (function_exists("json_decode")) {
         try {
             $result = json_decode($string);
         } catch (Exception $e) {
             error_log("AYAH::doJSONArrayDecode() - Exception when calling json_decode: " . $e->getMessage());
             $result = null;
         }
     } elseif (file_Exists("json.php")) {
         $json = new Services_JSON();
         $result = $json->decode($string);
         if (!is_array($result)) {
             error_log("AYAH::doJSONArrayDecode: Expected array; got something else: {$result}");
             $result = array();
         }
     } else {
         error_log("AYAH::doJSONArrayDecode: No JSON decode function available.");
     }
     return $result;
 }
Beispiel #18
0
function main_showampdblog($eventData)
{
    global $env, $hui_mainframe, $amp_locale, $hui_mainstatus, $hui_titlebar, $hui_mainvertgroup;
    $hui_vgroup = new HuiVertGroup('vgroup');
    $log_content = '';
    if (file_exists(AMP_DBLOG)) {
        $log_toolbar = new HuiToolBar('logbar');
        $cleanlog_action = new HuiEventsCall();
        $cleanlog_action->AddEvent(new HuiEvent('main', 'showampdblog', ''));
        $cleanlog_action->AddEvent(new HuiEvent('pass', 'cleanampdblog', ''));
        $cleanlog_button = new HuiButton('cleanlogbutton', array('label' => $amp_locale->GetStr('cleanlog_button'), 'themeimage' => 'editdelete', 'action' => $cleanlog_action->GetEventsCallString()));
        $log_toolbar->AddChild($cleanlog_button);
        $log_frame = new HuiHorizFrame('logframe');
        $log_frame->AddChild($log_toolbar);
        $hui_mainvertgroup->AddChild($log_frame);
        if (file_Exists(AMP_DBLOG)) {
            $log_content = file_get_contents(AMP_DBLOG);
        }
    }
    $hui_vgroup->AddChild(new HuiText('ampdblog', array('disp' => 'pass', 'readonly' => 'true', 'value' => htmlentities($log_content), 'rows' => '20', 'cols' => '120')), 0, 1);
    $hui_mainframe->AddChild($hui_vgroup);
    $hui_titlebar->mTitle .= ' - ' . $amp_locale->GetStr('ampdblog_title');
}
 private function loadMoHConfig()
 {
     $path = $this->FreePBX->Config->get('ASTETCDIR');
     if (file_Exists($path . "/musiconhold_additional.conf")) {
         $lc = $this->FreePBX->LoadConfig("musiconhold_additional.conf");
         return $lc->ProcessedConfig;
     } else {
         return array();
     }
 }
 /**
  * Internal function - does does JSON decoding of data from server.
  *
  * @param string $string - json to decode
  * @return object
  */
 protected function JSONDecode($string)
 {
     $result = array();
     if (function_exists("json_decode")) {
         try {
             $result = json_decode($string);
         } catch (Exception $e) {
             $this->msgLog("ERROR", "Exception when calling json_decode: " . $e->getMessage());
             $result = null;
         }
     } else {
         if (file_Exists($this->funcaptcha_json_path)) {
             require_once $this->funcaptcha_json_path;
             $json = new Services_JSON();
             $result = $json->decode($string);
         } else {
             $this->msgLog("ERROR", "No JSON decode function available.");
         }
     }
     return $result;
 }
 /**
  * Check whether composer is available or not
  *
  * If composer is not available we try to fetch our own composer installation
  *
  * @return bool
  */
 protected function checkForComposer()
 {
     $composerPath = __DIR__ . '/../bin/composer';
     exec('which composer', $output, $returnValue);
     if ($returnValue == 0) {
         $this->composer = $output[0];
         return true;
     }
     if (is_executable($composerPath)) {
         $this->composer = $composerPath;
         return true;
     }
     if (!file_Exists(dirname($composerPath))) {
         mkdir(dirname($composerPath));
     }
     $url = 'https://getcomposer.org/composer.phar';
     $fp = fopen($composerPath, 'w+');
     $ch = curl_init(str_replace(" ", "%20", $url));
     curl_setopt($ch, CURLOPT_TIMEOUT, 50);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_exec($ch);
     curl_close($ch);
     fclose($fp);
     chmod($composerPath, 0755);
     $this->composer = realpath($composerPath);
     return true;
 }
                padding-right: 6pt;
                border-right: 1px solid gray;}

            body {margin: 0px; margin-left: 5px;}
            td {vertical-align: top;}
            code {white-space: nowrap;}
        </style>   
    </head>

    <body>
        <?
       
        $ar = array('config.php', 'index.php', 'functions.php');    //array with files to denie
        $file = $_SERVER['CONTEXT_DOCUMENT_ROOT'] . $_GET['file']; 
       // iniziate the variable
        if (file_Exists($file)) {
            if (!in_array($file, $ar)) {    // check if it is prohibited
                highlight_num($file); //highlight file
            } else {     // prohibited file
                echo "You do not have permision to see the " . $file . " file.";
            }
        } else {    // file doesnt exist
            echo "That file does not exist.";
        }

        function highlight_num($file) {
            $lines = implode(range(1, count(file($file))), '<br />');
            $content = highlight_file($file, true);

            echo "<table><tr><td class=\"num\">\n$lines\n</td><td>\n$content\n</td></tr></table>";
        }
Beispiel #23
0
foreach ($sources as $src_name => $src_url) {
    echo "Will get " . $src_name . " " . $src_url . "\n";
    if (!preg_match('/^[a-zA-Z0-9]+$/', $src_name)) {
        echo "Bad name " . $src_name . "\n";
        continue;
    }
    // creates db if not exists
    if (!file_exists($data . "/" . $src_name . ".db")) {
        $create = true;
    } else {
        $create = false;
    }
    file_put_contents($data . "/status", "downloading");
    // download
    echo "Downloading...\n";
    if (file_Exists($data . '/dwca.zip')) {
        unlink($data . '/dwca.zip');
    }
    $command = 'curl ' . $src_url . ' -o ' . $data . '/dwca.zip';
    system($command);
    echo "Downloaded.\n";
    file_put_contents($data . "/status", "unziping");
    // Unzing
    echo "Unzipping...\n";
    $dst = $data . "/dwca";
    if (!file_exists($dst)) {
        mkdir($dst);
    }
    $zip = new ZipArchive();
    if ($zip->open($data . "/dwca.zip") === TRUE) {
        $zip->extractTo($dst);
Beispiel #24
0
 public function testCompile()
 {
     $file = __DIR__ . '/generated/' . __CLASS__ . '.php';
     $router = new Dispatcher\Router($file);
     $router->addFile(__FILE__)->setNamespace(__CLASS__);
     $this->assertFalse(file_Exists($file));
     $router->load();
     $this->assertTrue(file_Exists($file));
     $this->assertTrue($router->newRequest() instanceof QuickTest\Request);
 }
 public function testParsingDicFilesWorks()
 {
     Dictionary::setFileLocation(__DIR__ . '/share/');
     @unlink(__DIR__ . '/share/de_TE.ini');
     $dict = Dictionary::parseFile('de_TE');
     $this->assertTrue(file_Exists($dict));
     $this->assertTrue('UTF-8' == mb_detect_encoding(file_get_contents($dict)));
     $this->assertEquals(file_get_contents(__DIR__ . '/share/de_TE.default.ini'), file_get_contents($dict));
     try {
         $dict = Dictionary::parseFile('foobar');
         $this->fail('This should have raised an exception!');
     } catch (\Org\Heigl\Hyphenator\Exception\PathNotFoundException $exception) {
         $this->assertTrue(true);
     }
 }
 /**
  * parse a dictionary-file to create an ini-file from it.
  *
  * @param string $locale Parse the file for the given locale
  *
  * @throws \Org\Heigl\Hyphenator\Exception\PathNotFoundException
  * @return string
  */
 public static function parseFile($locale)
 {
     $path = self::$_fileLocation . DIRECTORY_SEPARATOR;
     $file = $path . 'hyph_' . $locale . '.dic';
     if (!file_Exists($file)) {
         throw new \Org\Heigl\Hyphenator\Exception\PathNotFoundException('The given Path does not exist');
     }
     $items = file($file);
     $source = trim($items[0]);
     if (0 === strpos($source, 'ISO8859')) {
         $source = str_Replace('ISO8859', 'ISO-8859', $source);
     }
     unset($items[0]);
     $fh = fopen($path . $locale . '.ini', 'w+');
     foreach ($items as $item) {
         // Remove comment-lines starting with '#' or '%'.
         if (in_array(mb_substr($item, 0, 1), array('#', '%'))) {
             continue;
         }
         // Ignore empty lines.
         if ('' == trim($item)) {
             continue;
         }
         // Remove all Upper-case items as they are OOo-specific
         if ($item === mb_strtoupper($item)) {
             continue;
         }
         // Ignore lines containing an '=' sign as these are specific
         // instructions for non-standard-hyphenations. These will be
         // implemented later.
         if (false !== mb_strpos($item, '=')) {
             continue;
         }
         $item = mb_convert_Encoding($item, 'UTF-8', $source);
         $result = Pattern::factory($item);
         $string = '@:' . $result->getText() . ' = "' . $result->getPattern() . '"' . "\n";
         fwrite($fh, $string);
     }
     fclose($fh);
     return $path . $locale . '.ini';
 }
Beispiel #27
0
 protected function doJSONArrayDecode($string)
 {
     $result = array();
     if (function_exists("json_decode")) {
         try {
             $result = json_decode($string);
         } catch (Exception $e) {
             $this->__log("ERROR", __FUNCTION__, "Exception when calling json_decode: " . $e->getMessage());
             $result = null;
         }
     } elseif (file_Exists("json.php")) {
         require_once 'json.php';
         $json = new Services_JSON();
         $result = $json->decode($string);
         if (!is_array($result)) {
             $this->__log("ERROR", __FUNCTION__, "Expected array; got something else: {$result}");
             $result = array();
         }
     } else {
         $this->__log("ERROR", __FUNCTION__, "No JSON decode function available.");
     }
     return $result;
 }
Beispiel #28
0
 function getlog($type)
 {
     $return = array();
     if (is_numeric($type)) {
         if ($type == 1) {
             $folder = 'filehash';
         } else {
             $folder = 'notify';
         }
     } else {
         $folder = basename($folder);
     }
     $a = self::glob(iswaf_database . '*.ini');
     $logid = 0;
     $num = array();
     foreach ($a as $k) {
         if (preg_match('/' . $folder . '(\\d+).ini/', $k, $test)) {
             if ($logid == 0) {
                 $logid = $test[1];
             } else {
                 if ($test[1] < $logid) {
                     $logid = $test[1];
                 }
             }
         }
     }
     $logfile = iswaf_database . $folder . $logid . '.ini';
     $tmp = self::readfile($logfile);
     $t = explode("\n", $tmp);
     $gzcompress = 0;
     if (function_exists('gzcompress')) {
         $gzcompress = 1;
     }
     foreach ($t as $string) {
         $tmp = self::authcode($string);
         if (trim($string)) {
             $return[] = @unserialize($gzcompress ? gzuncompress($tmp) : $tmp);
         }
     }
     file_Exists($logfile) ? @unlink($logfile) : '';
     return $return;
 }
Beispiel #29
0
 public function data(array $data = null)
 {
     if (null === $this->data) {
         if (!isset($this->data)) {
             $this->data = array();
         }
         $this->data['DIR'] = getcwd() . DIRECTORY_SEPARATOR;
         $this->data['CONFIGFILE'] = $this->data['DIR'] . 'config.frdl.php';
         $this->data['o'] = new \stdclass();
         $this->data['data_out'] = new \stdclass();
         $this->data['config'] = array();
         $this->data['settings'] = new \stdclass();
         $this->data['settings']->cli = array('frdl' => array('cli.cmd.cli' => 'frdl', 'cli.class' => '\\frdl\\ApplicationComposer\\Console', 'cli.class.required.parent' => '\\frdl\\aSQL\\Engines\\Terminal\\CLI'));
         $this->data['tpl_data'] = array('FILE' => htmlentities(__FILE__), 'URI_DIR_API' => self::URI_DIR_API, 'LOCATION' => 'http://' . $_SERVER['SERVER_NAME'] . implode('/', \webdof\wURI::getInstance()->getU()->dirs) . '/' . \webdof\wURI::getInstance()->getU()->file, 'URL' => '', 'EXTRA_PMX_URL' => '');
         $h = parse_url($this->data['tpl_data']['LOCATION']);
         $pu = \webdof\wURI::parse_uri($h['scheme'], $h['host'], $h['path']);
         $path = '/';
         foreach ($pu->dirs as $num => $dir) {
             $path .= $dir . '/';
         }
         $this->data['installed'] = false;
         $this->data['index'] = 'Main Template';
         if (is_array($data) || is_object($data)) {
             foreach ($data as $k => $v) {
                 if (isset($this->data[$k])) {
                     $this->data[$k] = $v;
                 }
             }
         }
         \webfan\App::God()->{'?session_started'}(true);
         //		   $sessionKey = __CLASS__. sha1( $h['host'] );
         $sessionKey = __CLASS__;
         if (!isset($_SESSION[$sessionKey])) {
             $_SESSION[$sessionKey] = array();
         }
         $this->aSess =& $_SESSION[$sessionKey];
         $this->data['config_new'] = $this->readFile('config.json');
         $this->data['config'] = $this->data['config_new'];
         if (file_exists($this->data['CONFIGFILE'])) {
             require $this->data['CONFIGFILE'];
             $this->data['installed'] = "1";
         } else {
             $this->data['installed'] = "0";
         }
         $this->data['config_new'] = (array) $this->data['config_new'];
         $this->data['config'] = array_merge($this->data['config_new'], (array) $this->data['config']);
         $this->data['config']['INSTALLED'] = $this->data['installed'];
         if (base64_decode('eyRfX0xPQ0FUSU9OX19ffQ==') === $this->data['config']['URL']) {
             $this->data['config']['URL'] = $this->data['tpl_data']['LOCATION'];
             if (true === $this->debug) {
                 trigger_error(self::HINT_NOTINSTALLED, E_USER_WARNING);
             }
         }
         $this->data['tpl_data']['URL'] =& $this->data['config']['URL'];
         $this->data['tpl_data']['URL'] = str_replace('setup.phpsetup.php', 'setup.php', $this->data['tpl_data']['URL']);
         $this->data['tpl_data']['URI_DIR_API'] = $this->data['tpl_data']['URL'] . 'api.php';
         $this->data['config']['URL_API_ORIGINAL'] = $this->data['tpl_data']['URI_DIR_API'];
         $this->data['config']['URL_API_ORIGINAL'] = str_replace('setup.phpapi.php', 'api.php', $this->data['config']['URL_API_ORIGINAL']);
         $this->data['tpl_data']['URI_DIR_API'] = str_replace('setup.phpapi.php', 'api.php', $this->data['tpl_data']['URI_DIR_API']);
         /*
          	    $this->data['tpl_data']['PACKAGE'] = function(){
          	       return $this->data['config']['PACKAGE'];
          	    };
          	    $this->data['tpl_data']['VERSION'] = function(){
          	       return $this->data['config']['VERSION'];
          	    }; 
          	    $this->data['tpl_data']['INSTALLED'] = function(){
          	       return $this->data['config']['INSTALLED'];
          	    }; 
          	    $this->data['tpl_data']['REGISTERED'] = function(){
          	       return $this->data['config']['REGISTERED'];
          	    }; 
           	    $this->data['tpl_data']['UNAME'] = function(){
          	       return $this->data['config']['UNAME'];
          	    }; 
           	    $this->data['tpl_data']['UID'] =  function(){
          	       return $this->data['config']['UID'];	  
          	    };   
         */
         $this->data['INSTALLER_PHAR_AVAILABLE'] = '0';
         $this->data['tpl_data']['EXTRA_PHAR_URL'] = '';
         $this->data['tpl_data']['INSTALLER'] = '';
         if (function_exists('frdl_install_rewrite_function') || file_exists($this->data['DIR'] . 'install.phar') || file_exists($this->data['DIR'] . 'install.php')) {
             $this->_installFromPhar(\webdof\wURI::getInstance());
         }
         /*   
         	   $this->data['tpl_data']['INSTALLER_PHAR_AVAILABLE'] = function(){
          	       return $this->data['INSTALLER_PHAR_AVAILABLE'];
          	    };   
         */
     } else {
         if (is_array($data)) {
             foreach ($data as $k => $v) {
                 $this->data[$k] = $v;
             }
         }
     }
     if (!isset($path)) {
         $h = parse_url($this->data['tpl_data']['LOCATION']);
         $pu = \webdof\wURI::parse_uri($h['scheme'], $h['host'], $h['path']);
         $path = '/';
         foreach ($pu->dirs as $num => $dir) {
             $path .= $dir . '/';
         }
     }
     $this->data['config']['EXTRA'] = $this->_extra($this->data);
     $this->data['tpl_data']['EXTRA_IS_PMX'] = true === $this->data['config']['EXTRA']['extra']['pragmamx']['main'] ? 'yes' : 'no';
     $this->data['tpl_data']['EXTRA_IS_WP'] = true === $this->data['config']['EXTRA']['extra']['wordpress']['main'] ? 'yes' : 'no';
     $this->data['template_main_options'] = array('Title' => 'Webfan - Application Composer', 'css' => array(), 'meta' => array(array('http-equiv' => 'content-type', 'content' => 'text/html; charset=utf-8'), array('http-equiv' => 'content-style-type', 'content' => 'text/css'), array('http-equiv' => 'content-script-type', 'content' => 'text/javascript'), array('http-equiv' => 'content-script-type', 'content' => 'text/javascript'), array('name' => 'mobile-web-app-capable', 'content' => 'yes'), array('name' => 'apple-mobile-web-app-capable', 'content' => 'yes'), array('name' => 'apple-mobile-web-app-status-bar-style', 'content' => 'lightblue'), array('name' => 'HandheldFriendly', 'content' => 'true'), array('name' => 'MobileOptimized', 'content' => '320'), array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0, user-scalable=yes'), array('name' => 'flow.component.frdl.webfan.api.url', 'content' => $this->data['tpl_data']['URI_DIR_API']), array('name' => 'flow.component.frdl.webfan.api.url.initial', 'content' => $this->data['tpl_data']['URI_DIR_API']), array('name' => 'webfan-registration-key', 'content' => isset($this->data['config']['REGISTRATIONKEY']) ? $this->data['config']['REGISTRATIONKEY'] : isset($this->data['config_new']['REGISTRATIONKEY']) ? $this->data['config_new']['REGISTRATIONKEY'] : '')), 'link' => array(array('rel' => 'package', 'type' => 'application/package', 'href' => 'https://github.com/frdl/webfan/archive/master.zip'), array('rel' => 'manifest', 'type' => 'application/manifest+json', 'href' => str_replace('setup.php', '', $this->data['config']['URL']) . 'manifest.webapp'), array('rel' => 'shortcut icon', 'type' => 'image/x-icon', 'href' => str_replace('setup.php', '', $this->data['config']['URL']) . '/favicon.ico')), 'js' => array('phar' !== $this->data['tpl_data']['INSTALLER'] && file_Exists($this->data['CONFIGFILE']) && file_exists($this->data['DIR'] . 'js' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'flow.js') ? 'js/lib/flow.js' : 'http://api.webfan.de/api-d/4/js-api/library.js'));
     if (isset($_GET['intents'])) {
         $this->data['template_main_options']['js'][] = 'http://webfan.de/cdn/frdl/flow/components/webfan/webfat/js/intents.js';
     }
     return $this->data;
 }
 /**
  * Create an Option-Object by parsing a given file.
  *
  * @param string $file The config-file to be parsed
  *
  * @throws \Org\Heigl\Hyphenator\Exception\PathNotFoundException
  * @throws \Org\Heigl\Hyphenator\Exception\InvalidArgumentException
  * @return \Org\Heigl\Hyphenator\Options
  */
 public static function factory($file)
 {
     if (!file_Exists($file)) {
         $file = $file . '.dist';
         if (!file_exists($file)) {
             throw new \Org\Heigl\Hyphenator\Exception\PathNotFoundException($file);
         }
     }
     $params = parse_ini_file($file);
     if (!is_array($params) || 1 > count($params)) {
         throw new \Org\Heigl\Hyphenator\Exception\InvalidArgumentException($file . ' is not a parseable file');
     }
     $option = new Options();
     foreach ($params as $key => $val) {
         if (!method_Exists($option, 'set' . $key)) {
             continue;
         }
         call_user_Func(array($option, 'set' . $key), $val);
     }
     return $option;
 }