function init($cfg) { //! defaults if (empty($cfg["sqldir"])) { $cfg["sqldir"] = "data/temp"; } if (empty($cfg["pagesdir"])) { $cfg["pagesdir"] = "pages"; } $this->pagesdir = $cfg["pagesdir"]; //! if it's a special sql refresh request if (Core::$core->url == "sqlrefresh" || isset($_REQUEST["sqlrefresh"])) { //look data source if (!DS::db()) { die("ERROR: no db"); } //read the changes $sqlFiles = @glob($cfg["sqldir"] . "/sqlchanges-*.sql"); foreach ($sqlFiles as $sf) { //get sql commands from file $sqls = str_getcsv(@file_get_contents($sf), ";"); @unlink($sf); //execute one by one foreach ($sqls as $query) { DS::exec($query); } } die("OK"); } //! check if there's a CMS generated file for the url //! if so, add route for it $c = @explode("/", Core::$core->url); while (!empty($c)) { $f = implode("-SLASH-", $c); if (file_exists($cfg["pagesdir"] . "/" . $f . ".php")) { self::$page = $cfg["pagesdir"] . "/" . $f . ".php"; Http::route(Core::$core->url, "\\PHPPE\\EplosCMS"); break; } //if not found, put last part in parameters array self::$params[] = array_pop($c); } //reverse the parameters as they were popped in reverse order self::$params = @array_reverse(self::$params); return true; }
/** * PHP Portal Engine v3.0.0 * https://github.com/bztsrc/phppe3/ * * Copyright LGPL 2016 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/MultiServer/init.php * @author bzt * @date 22 May 2016 * @brief */ namespace PHPPE; Http::route("ms/add", "MultiServer", "addAction"); Http::route("ms/remove", "MultiServer", "removeAction"); Http::route("ms/set", "MultiServer", "setAction"); //! return your service class here return new MultiServer();
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/Developer/init.php * @author bzt * @date 1 Jan 2016 * @brief Initialize Developer extension */ /*!SKIPAUTOLOAD!*/ namespace PHPPE; //! register menu View::menu(L("Developer"), [L("Tests") => "tests", L("Benchmarks") => "benchmark"]); //! this is needed for test cases Http::route("tests/httptest", "Developer", "action_httpget", "get"); Http::route("tests/httptest", "Developer", "action_httppost", "post"); //! register url routes. Http::route("tests", "Developer"); Http::route("benchmark", "BenchmarkController"); //! these are CLI only Http::route("mkrepo", "MkRepoController"); Http::route("minify", "MinifyController"); Http::route("create", "CreateController"); Http::route("lang", "LangController"); Http::route("pretty", "PrettyController"); //for event testing return new Testing();
public static function dump() { Http::mime('text/plain', false); print_r(self::$o); print_r($_SERVER); print_r(Http::route()); die; }
/** * PHP Portal Engine v3.0.0 * https://github.com/bztsrc/phppe3/ * * Copyright LGPL 2016 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/ClusterCli/init.php * @author bzt * @date 27 Sep 2016 * @brief */ namespace PHPPE; //! add your routes here Http::route("cluster/client", "\\PHPPE\\Ctrl\\ClusterCli", "client"); Http::route("cluster/bindcfg", "\\PHPPE\\Ctrl\\ClusterCli", "bindcfg"); //! return your service class here return new ClusterCli();
<?php /** * PHP Portal Engine v3.0.0 * https://github.com/bztsrc/phppe3/ * * Copyright LGPL 2016 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/DataLibrary/init.php * @author bzt * @date 27 May 2016 * @brief */ namespace PHPPE; Http::route("download", "DataLibrary", "action"); return new DataLibrary();
* * Copyright LGPL 2016 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/ClusterSrv/init.php * @author bzt * @date 27 Sep 2016 * @brief */ namespace PHPPE; //! add your routes here Http::route("cluster/server", "\\PHPPE\\Ctrl\\ClusterSrv", "server"); Http::route("cluster/takeover", "\\PHPPE\\Ctrl\\ClusterSrv", "takeover"); Http::route("cluster/flush", "\\PHPPE\\Ctrl\\ClusterSrv", "flush"); Http::route("cluster/deploy", "\\PHPPE\\Ctrl\\ClusterSrv", "deploy"); Http::route("cluster/help", "\\PHPPE\\Ctrl\\ClusterSrv", "help"); Http::route("cluster", "\\PHPPE\\Ctrl\\ClusterSrv", "action"); //! return your service class here //return new ClusterSrv;