function _route() { // check permission to access to cp if (Tld !== 'dev') { parent::_permission('cp'); } // // Restrict unwanted module // if(!$this->cpModlueList()) // \lib\error::page(T_("Not found!")); $exist = false; $mymodule = $this->cpModule('table'); $cpModule = $this->cpModule('raw'); // var_dump($this->child()); $this->display_name = 'content_cp/templates/raw.html'; switch ($this->child()) { case 'dbtables': $exist = true; echo \lib\utility\dbTables::create(); break; case 'db': $exist = true; if (\lib\utility::get('upgrade')) { // do upgrade $result = \lib\db::install(true); } elseif (\lib\utility::get('backup')) { $result = \lib\db::backup(true); } echo '<pre>'; print_r($result); echo '</pre>'; break; case 'twigtrans': $exist = true; $mypath = \lib\utility::get('path'); $myupdate = \lib\utility::get('update'); echo \lib\utility\twigTrans::extract($mypath, $myupdate); break; case 'phpinfo': $exist = true; phpinfo(); break; case 'server': $exist = true; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && !class_exists("COM")) { ob_start(); echo "<!DOCTYPE html><meta charset='UTF-8'/><title>Extract text form twig files</title><body style='padding:0 1%;margin:0 1%;direction:ltr;overflow:hidden'>"; echo "<h1>" . T_("First you need to enable COM on windows") . "</h1>"; echo "<a target='_blank' href='http://www.php.net/manual/en/class.com.php'>" . T_("Read More") . "</a>"; break; } \lib\utility\tools::linfo(); $this->display_name = 'content_cp/templates/raw-all.html'; break; case 'twitter': $a = \lib\utility\socialNetwork::twitter('hello! test #api'); // var_dump($a); break; case 'mergefiles': $exist = true; echo \lib\utility\tools::mergefiles('merged-project.php'); if (\lib\utility::get('type') === 'all') { echo \lib\utility\tools::mergefiles('merged-saloos-lib.php', core . lib); echo \lib\utility\tools::mergefiles('merged-saloos-cp.php', addons . 'content_cp/'); echo \lib\utility\tools::mergefiles('merged-saloos-account.php', addons . 'content_account/'); echo \lib\utility\tools::mergefiles('merged-saloos-includes.php', addons . 'includes/'); } break; case 'sitemap': $exist = true; $site_url = \lib\router::get_storage('url_site'); $sitemap = new \lib\utility\sitemap($site_url, root . 'public_html/', 'sitemap'); // echo "<pre>"; // add posts foreach ($this->model()->sitemap('posts', 'post') as $row) { $sitemap->addItem($row['post_url'], '0.8', 'daily', $row['post_publishdate']); } // add pages foreach ($this->model()->sitemap('posts', 'page') as $row) { $sitemap->addItem($row['post_url'], '0.6', 'weekly', $row['post_publishdate']); } // add attachments foreach ($this->model()->sitemap('posts', 'attachment') as $row) { $sitemap->addItem($row['post_url'], '0.2', 'weekly', $row['post_publishdate']); } // add books foreach ($this->model()->sitemap('posts', 'book') as $row) { $sitemap->addItem($row['post_url'], '0.6', 'yearly', $row['post_publishdate']); } // add cats and tags foreach ($this->model()->sitemap('terms') as $row) { $sitemap->addItem($row['term_url'], '0.4', 'weekly', $row['date_modified']); } $sitemap->createSitemapIndex(); echo "<p class='alert alert-success'>Create sitemap Successfully!</p>"; // echo "Create Successful"; break; case 'git': // declare variables $exist = true; $rep = null; $result = []; $location = '../../'; $name = \lib\utility::get('name'); $output = null; // switch by name of repository switch ($name) { case 'saloos': $location .= 'saloos'; $rep .= "https://github.com/Ermile/Saloos.git"; break; case 'addons': $location .= 'saloos/saloos-addons'; $rep .= "https://github.com/Ermile/Saloos-Addons.git"; break; default: $exist = false; return; break; } // change location to address of requested chdir($location); // start show result $output = "<pre>"; $output .= 'Repository address: ' . getcwd() . '<br/>'; $output .= 'Remote address: ' . $rep . '<hr/>'; $command = 'git pull ' . $rep . ' 2>&1'; // Print the exec output inside of a pre element exec($command, $result); if (!$result) { $output .= T_('Not Work!'); } foreach ($result as $line) { $output .= $line . "\n"; } $output .= "</pre>"; echo $output; break; case null: $mypath = $this->url('path', '_'); if (is_file(addons . 'content_cp/templates/static_' . $mypath . '.html')) { $this->display_name = 'content_cp/templates/static_' . $mypath . '.html'; } // $this->display_name = 'content_cp/templates/static_'.$mypath.'.html'; break; default: $this->display_name = 'content_cp/templates/static_tools.html'; return; break; } // $this->get()->ALL(); if ($exist) { $this->model()->_processor(object(array("force_json" => false, "force_stop" => true))); } return; }
<html> <head> <meta charset="UTF-8"/> <title>Install</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no"/> <link rel="shortcut icon" href="/static/images/favicon-error.png"/> <style type="text/css">*{font-family:sans-serif;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;}body{width:90%;height:94%;margin:0 auto;padding:3% 5%;background-color:rgba(61, 174, 255, 0.1);;color:#3DAEFF}a{color:#0091D6;}.slash{padding: 0 2px;}ol{direction:ltr;font-size: 14px;}li{padding-bottom:5px}.addr{font-size: 11px; font-weight: normal;}#no{z-index:-1;position:absolute;bottom:5%;right:5%;opacity:0.9;width: 250px}#smile{font-size:7em}img{max-width: 100%;}.btn{position:relative;width:300px;margin:100px auto 0;font-size:1em}.btn a{text-decoration:none;background-color:#0091D6;color:#fff;font-size:1.5em;text-align:center;padding:5px 10%;border-radius:10px;position:relative;display:block;width:100%;z-index:1}.btn span{background-color:#222;color:#fff;font-size:.8em;text-align:center;padding:5px 10%;position:absolute;width:90%;right:0;left:0;margin:0 auto;max-width:100%;overflow:hidden;transition:.5s}.btn .top{top:0;border-top-right-radius:10px;border-top-left-radius:10px}.btn:hover .top{top:-60%}.btn .bottom{bottom:0;border-bottom-right-radius:10px;border-bottom-left-radius:10px}.btn:hover .bottom{bottom:-60%}.btn span:hover{overflow:visible}pre{overflow:auto;background-color:#eee;font-size:0.7em;padding:1%;} </style> </head> <body> <h1>Saloos Installation</h1> <p>Welcome to saloos installation process.</p> <p>First of all set database connection detail on <b>config.php</b> then we do others!</p> <?php if (isset($_GET['install']) && $_GET['install'] === 'go' && isset($_GET['time']) && $_GET['time'] === 'first_time') { $result = \lib\db::install(); if ($result) { ?> <div class="btn"> <span class="top">Install Successfully:)</span> <a href="/">Lets GO!</a> </div> <pre class="result"> <?php $sqlFiles = \lib\utility\dbTables::create(); if (DEBUG) { print_r($result); echo $sqlFiles; } ?> </pre>