public function UpdateStatus() { $contract = DataObject::get_one('Contract', 'ID = ' . $_GET['id'] . " and EchosignID = '" . $_GET['documentKey'] . "'"); $contract->Status = $_GET['status']; $contract->write(); mail('*****@*****.**', 'Contract Update' . $contract->EchosignID, json_encode($_GET)); die; $ESLoader = new SplClassLoader('EchoSign', realpath(__DIR__ . '/../../')); $ESLoader->register(); $client = new SoapClient(EchoSign\API::getWSDL()); $api = new EchoSign\API($client, 'PGRUY64K6T664Z'); $data = $api->getDocumentInfo($contract->EchosignID); mail('*****@*****.**', 'Contract Update' . $contract->EchosignID, json_encode($data)); }
public function __construct() { ini_set('display_errors', 1); error_reporting(E_ALL); require __DIR__ . '/lib/SplClassLoader.php'; $classLoader = new SplClassLoader('WebSocket', __DIR__ . '/lib'); $classLoader->register(); $this->server = new \WebSocket\Server('127.0.0.1', 7000, false); // host,port,ssl // server settings: $this->server->setCheckOrigin(true); $this->server->setAllowedOrigin('foo.lh'); $this->server->setMaxClients(100); $this->server->setMaxConnectionsPerIp(20); $this->server->setMaxRequestsPerMinute(1000); $this->server->registerApplication('demo', \WebSocket\Application\DemoApplication::getInstance()); $this->server->run(); }
<?php /* Automatically register all the paths under: /StructuredDynamics/structwsf/* This means that all the classes for structWSF and the structWSF-PHP-API will be automatically loaded. */ $wsf_folder = dirname(dirname(__FILE__)); $entries = scandir($wsf_folder . '/StructuredDynamics/structwsf/'); foreach ($entries as $entry) { if ($entry != '.' && $entry != '..' && is_dir($wsf_folder . '/StructuredDynamics/structwsf/' . $entry)) { $loader_core_framework = new SplClassLoader('StructuredDynamics\\structwsf\\' . $entry, $wsf_folder); $loader_core_framework->register(); } } /** * SplClassLoader implementation that implements the technical interoperability * standards for PHP 5.3 namespaces and class names. * * http://groups.google.com/group/php-standards/web/final-proposal * * // Example which loads classes for the Doctrine Common package in the * // Doctrine\Common namespace. * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine'); * $classLoader->register(); * * @author Jonathan H. Wage <*****@*****.**> * @author Roman S. Borschel <*****@*****.**> * @author Matthew Weier O'Phinney <*****@*****.**>
<?php set_include_path(__DIR__ . PATH_SEPARATOR . __DIR__ . DIRECTORY_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path()); include 'SplClassLoaderUser.php'; $v1 = new SplClassLoaderUser('vendor0'); $v1->register(); $v2 = new SplClassLoaderUser('vendor1'); $v2->register(); $v3 = new SplClassLoaderUser('vendor2'); $v3->register(); //$v4 = new SplClassLoaderUser('vendor3'); //$v4->register(); $g = new SplClassLoader(); $g->register(); include 'batch_instances.php'; echo 'done';
/** * Run an Akismet check for spam * @param array $comment Message data. Required keys: * permalink - the permanent location of the entry the comment was submitted to * comment_type - may be blank, comment, trackback, pingback, or a made up value like "registration" * comment_author - name submitted with the comment * comment_author_email - email address submitted with the comment * comment_author_url - URL submitted with comment * comment_content - the content that was submitted * @return bool true if spam */ public function akismetCheck($comment) { $loader = new SplClassLoader('Rzeka', __DIR__ . '/vendor/'); $loader->register(); $connector = new Rzeka\Service\Akismet\Connector\Curl(); $akismet = new Rzeka\Service\Akismet($connector); $api_key = $this->config['akismet_api_key']; $site_url = Config::get('site_url'); if (!$akismet->keyCheck($api_key, $site_url)) { Log::error('Invalid Akismet API key', 'raven'); return false; } return $akismet->check($comment); }
* * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ set_include_path(get_include_path() . PATH_SEPARATOR . realpath(__DIR__ . '/../src')); require_once 'SplClassLoader.php'; $l = new SplClassLoader('MaxTsepkov'); $l->register(); use MaxTsepkov\Markdown\Text; class BenchmarkTest extends PHPUnit_Framework_TestCase { const MD_SIZE = 1048576; // 1M protected static $_markdown; protected static $_timings = array(); /** * Generate a large markdown document. * */ public static function setUpBeforeClass() { $charset = "\n\t"; for ($i = 32; $i <= 126; $i++) {
function prepareExchangedData($data, $type) { //Load AES $aes = new SplClassLoader('Encryption\\Crypt', '../includes/libraries'); $aes->register(); if ($type == "encode") { if (isset($_SESSION['settings']['encryptClientServer']) && $_SESSION['settings']['encryptClientServer'] == 0) { return json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); } else { return Encryption\Crypt\aesctr::encrypt(json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP), $_SESSION['key'], 256); } } elseif ($type == "decode") { if (isset($_SESSION['settings']['encryptClientServer']) && $_SESSION['settings']['encryptClientServer'] == 0) { return json_decode($data, true); } else { return json_decode(Encryption\Crypt\aesctr::decrypt($data, $_SESSION['key'], 256), true); } } }
*/ require_once __DIR__ . '/vendor/Slim/Slim.php'; require_once __DIR__ . '/vendor/SplClassLoader.php'; \Slim\Slim::registerAutoloader(); /* |-------------------------------------------------------------------------- | Vendor libraries |------------------------------------------------------------------------- | | Load miscellaneous third-party dependencies. | */ $packages = array('Buzz', 'Carbon', 'emberlabs', 'Intervention', 'Michelf', 'Netcarver', 'Stampie', 'Symfony', 'Whoops', 'Zeuxisoo', 'erusev', 'Propel'); foreach ($packages as $package) { $loader = new SplClassLoader($package, __DIR__ . '/vendor/'); $loader->register(); } require_once __DIR__ . '/vendor/PHPMailer/PHPMailerAutoload.php'; require_once __DIR__ . '/vendor/Spyc/Spyc.php'; /* |-------------------------------------------------------------------------- | The Template Parser |-------------------------------------------------------------------------- | | Statamic uses a *highly* modified fork of the Lex parser, created by | Dan Horrigan. Kudos Dan! | */ require_once __DIR__ . '/vendor/Lex/Parser.php'; /* |--------------------------------------------------------------------------
/** * Cargar las clases de las extensiones de sysPass */ private static function loadExtensions() { // Utilizar un cargador de clases PSR-0 require EXTENSIONS_PATH . DIRECTORY_SEPARATOR . 'SplClassLoader.php'; $phpSecLoader = new \SplClassLoader('phpseclib', EXTENSIONS_PATH); $phpSecLoader->register(); }
/** * register autoloader * * @return void */ public static function register() { $loader = new \SplClassLoader('Selfish', __DIR__ . '/..'); $loader->register(); }
<?php require_once 'Lib/Autoloader.php'; $autoloader = new SplClassLoader('FrontController'); $autoloader->register(); $request = \FrontController\HttpRequest::createFromGlobals(); $testRoute = new \FrontController\HttpRoute('/', 'IndexController', 'index'); $testRoute2 = new \FrontController\HttpRoute('/foo', 'IndexController', 'foo'); $router = new \FrontController\HttpRouter(array($testRoute, $testRoute2)); $dispatcher = new \FrontController\HttpDispatcher(); $front = new FrontController\Front($router, $dispatcher); $front->run($request, new \FrontController\HttpResponse());
<?php error_reporting(E_ALL); require_once 'lib/SplClassLoader.php'; require_once 'opentrackr.config.php'; $appLoader = new SplClassLoader("opentrackr", __DIR__ . "/opentrackr"); $appLoader->register(); $morphLoader = new SplClassLoader("morph", __DIR__ . "lib/morph"); $morphLoader->register(); $request = new Request($_POST['request']); /*$data = '{"profile":"installous","format":"PlainText","request":"{\"args\":{\"deviceid\":1,\"showPageCount\":true,\"page\":1,\"category\":0,\"sort\":2,\"search\":\"hi\",\"appsPerPage\":15},\"object\":\"App\",\"action\":\"getList\"}"}'; $request = json_decode($data); $json = json_decode($request->{'request'}); $action = $json->{'action'}; //echo "action" . $action; if ($action == "getList") { $search = $json->{'args'}->{'search'}; if ($search == "hi") { echo '{"code":200,"data":"{\"apps\":[{\"id\":499511971,\"add_date\":1332402499,\"last_modification\":1338450153,\"name\":\"Angry Birds Space\",\"seller\":\"Rovio Mobile\",\"category\":8,\"latest_version\":\"1.2.0\",\"icon75\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/02\\\/2c\\\/7d\\\/022c7dc7-afd3-2e13-7af1-d78f2f2a0372\\\/mzl.pdpwypui.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/02\\\/2c\\\/7d\\\/022c7dc7-afd3-2e13-7af1-d78f2f2a0372\\\/mzl.pdpwypui.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/02\\\/2c\\\/7d\\\/022c7dc7-afd3-2e13-7af1-d78f2f2a0372\\\/mzl.pdpwypui.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/02\\\/2c\\\/7d\\\/022c7dc7-afd3-2e13-7af1-d78f2f2a0372\\\/mzl.pdpwypui.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/02\\\/2c\\\/7d\\\/022c7dc7-afd3-2e13-7af1-d78f2f2a0372\\\/mzl.pdpwypui.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/02\\\/2c\\\/7d\\\/022c7dc7-afd3-2e13-7af1-d78f2f2a0372\\\/mzl.pdpwypui.100x100-75.jpg\"},{\"id\":458023720,\"add_date\":1314488516,\"last_modification\":1337768881,\"name\":\"Angry Zombies 2 HD\",\"seller\":\"Si-Yeon Kim\",\"category\":8,\"latest_version\":\"1.03\",\"icon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/120\\\/Purple\\\/v4\\\/b6\\\/bf\\\/8f\\\/b6bf8f09-1cf3-8d05-3912-82e7d7709a71\\\/mzl.uftqbpiy.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/120\\\/Purple\\\/v4\\\/b6\\\/bf\\\/8f\\\/b6bf8f09-1cf3-8d05-3912-82e7d7709a71\\\/mzl.uftqbpiy.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/120\\\/Purple\\\/v4\\\/b6\\\/bf\\\/8f\\\/b6bf8f09-1cf3-8d05-3912-82e7d7709a71\\\/mzl.uftqbpiy.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/120\\\/Purple\\\/v4\\\/b6\\\/bf\\\/8f\\\/b6bf8f09-1cf3-8d05-3912-82e7d7709a71\\\/mzl.uftqbpiy.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/120\\\/Purple\\\/v4\\\/b6\\\/bf\\\/8f\\\/b6bf8f09-1cf3-8d05-3912-82e7d7709a71\\\/mzl.uftqbpiy.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/120\\\/Purple\\\/v4\\\/b6\\\/bf\\\/8f\\\/b6bf8f09-1cf3-8d05-3912-82e7d7709a71\\\/mzl.uftqbpiy.100x100-75.jpg\"},{\"id\":320013958,\"add_date\":1247723372,\"last_modification\":1337725072,\"name\":\"MUST.EAT.BIRDS.\",\"seller\":\"Mediatonic Ltd\",\"category\":8,\"latest_version\":\"1.24\",\"icon75\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/027\\\/Purple\\\/ed\\\/53\\\/ee\\\/mzl.ojiinovm.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/027\\\/Purple\\\/ed\\\/53\\\/ee\\\/mzl.ojiinovm.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/027\\\/Purple\\\/ed\\\/53\\\/ee\\\/mzl.ojiinovm.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/027\\\/Purple\\\/ed\\\/53\\\/ee\\\/mzl.ojiinovm.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/027\\\/Purple\\\/ed\\\/53\\\/ee\\\/mzl.ojiinovm.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a3.mzstatic.com\\\/us\\\/r1000\\\/027\\\/Purple\\\/ed\\\/53\\\/ee\\\/mzl.ojiinovm.100x100-75.jpg\"},{\"id\":343200656,\"add_date\":1262143746,\"last_modification\":1337709235,\"name\":\"Angry Birds\",\"seller\":\"Clickgamer Technologies Ltd\",\"category\":8,\"latest_version\":\"2.1.0\",\"icon75\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/088\\\/Purple\\\/v4\\\/6e\\\/48\\\/76\\\/6e487653-ad0a-a26c-8884-3a97896e3e23\\\/mzl.kcxliyzs.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/088\\\/Purple\\\/v4\\\/6e\\\/48\\\/76\\\/6e487653-ad0a-a26c-8884-3a97896e3e23\\\/mzl.kcxliyzs.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/088\\\/Purple\\\/v4\\\/6e\\\/48\\\/76\\\/6e487653-ad0a-a26c-8884-3a97896e3e23\\\/mzl.kcxliyzs.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/088\\\/Purple\\\/v4\\\/6e\\\/48\\\/76\\\/6e487653-ad0a-a26c-8884-3a97896e3e23\\\/mzl.kcxliyzs.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/088\\\/Purple\\\/v4\\\/6e\\\/48\\\/76\\\/6e487653-ad0a-a26c-8884-3a97896e3e23\\\/mzl.kcxliyzs.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/088\\\/Purple\\\/v4\\\/6e\\\/48\\\/76\\\/6e487653-ad0a-a26c-8884-3a97896e3e23\\\/mzl.kcxliyzs.100x100-75.jpg\"},{\"id\":428009148,\"add_date\":1301700572,\"last_modification\":1336866912,\"name\":\"Walkthrough for RIO Angry Birds\",\"seller\":\"Apperleft Ltd\",\"category\":20,\"latest_version\":\"1.6\",\"icon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/092\\\/Purple\\\/v4\\\/fe\\\/7b\\\/81\\\/fe7b8127-2d80-e183-e4a4-63f4f6391c44\\\/mza_8450962213447079421.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/092\\\/Purple\\\/v4\\\/fe\\\/7b\\\/81\\\/fe7b8127-2d80-e183-e4a4-63f4f6391c44\\\/mza_8450962213447079421.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/092\\\/Purple\\\/v4\\\/fe\\\/7b\\\/81\\\/fe7b8127-2d80-e183-e4a4-63f4f6391c44\\\/mza_8450962213447079421.57x57-100.jpg\",\"deviceid\":1,\"universal\":1,\"appleIcon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/092\\\/Purple\\\/v4\\\/fe\\\/7b\\\/81\\\/fe7b8127-2d80-e183-e4a4-63f4f6391c44\\\/mza_8450962213447079421.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/092\\\/Purple\\\/v4\\\/fe\\\/7b\\\/81\\\/fe7b8127-2d80-e183-e4a4-63f4f6391c44\\\/mza_8450962213447079421.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/092\\\/Purple\\\/v4\\\/fe\\\/7b\\\/81\\\/fe7b8127-2d80-e183-e4a4-63f4f6391c44\\\/mza_8450962213447079421.100x100-75.jpg\"},{\"id\":412789267,\"add_date\":1297294563,\"last_modification\":1336661133,\"name\":\"Walkthrough for Angry Birds Golden Eggs (Simple & Easy Instructions)\",\"seller\":\"Apperleft Ltd\",\"category\":20,\"latest_version\":\"1.4\",\"icon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/118\\\/Purple\\\/2b\\\/e9\\\/cb\\\/mzl.vtzyneee.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/118\\\/Purple\\\/2b\\\/e9\\\/cb\\\/mzl.vtzyneee.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/118\\\/Purple\\\/2b\\\/e9\\\/cb\\\/mzl.vtzyneee.57x57-100.jpg\",\"deviceid\":1,\"universal\":1,\"appleIcon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/118\\\/Purple\\\/2b\\\/e9\\\/cb\\\/mzl.vtzyneee.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/118\\\/Purple\\\/2b\\\/e9\\\/cb\\\/mzl.vtzyneee.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/118\\\/Purple\\\/2b\\\/e9\\\/cb\\\/mzl.vtzyneee.100x100-75.jpg\"},{\"id\":495654109,\"add_date\":1333905689,\"last_modification\":1336661014,\"name\":\"Lucky Birds City\",\"seller\":\"Articul Media\",\"category\":8,\"latest_version\":\"1.1\",\"icon75\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/099\\\/Purple\\\/v4\\\/28\\\/75\\\/c4\\\/2875c4a1-d913-ed8b-7e40-96c0197061ca\\\/mzm.dwpochdo.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/099\\\/Purple\\\/v4\\\/28\\\/75\\\/c4\\\/2875c4a1-d913-ed8b-7e40-96c0197061ca\\\/mzm.dwpochdo.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/099\\\/Purple\\\/v4\\\/28\\\/75\\\/c4\\\/2875c4a1-d913-ed8b-7e40-96c0197061ca\\\/mzm.dwpochdo.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/099\\\/Purple\\\/v4\\\/28\\\/75\\\/c4\\\/2875c4a1-d913-ed8b-7e40-96c0197061ca\\\/mzm.dwpochdo.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/099\\\/Purple\\\/v4\\\/28\\\/75\\\/c4\\\/2875c4a1-d913-ed8b-7e40-96c0197061ca\\\/mzm.dwpochdo.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a2.mzstatic.com\\\/us\\\/r1000\\\/099\\\/Purple\\\/v4\\\/28\\\/75\\\/c4\\\/2875c4a1-d913-ed8b-7e40-96c0197061ca\\\/mzm.dwpochdo.100x100-75.jpg\"},{\"id\":412263723,\"add_date\":1294876567,\"last_modification\":1336659721,\"name\":\"Walkthrough for Angry Birds (Ultimate Edition)\",\"seller\":\"EL AD VAKNIN\",\"category\":20,\"latest_version\":\"1.41\",\"icon75\":\"http:\\\/\\\/a1.mzstatic.com\\\/us\\\/r1000\\\/117\\\/Purple\\\/v4\\\/91\\\/83\\\/b1\\\/9183b1ec-8ff1-15d4-108a-f05c9aa5e0cd\\\/mzl.wbfmiklm.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a1.mzstatic.com\\\/us\\\/r1000\\\/117\\\/Purple\\\/v4\\\/91\\\/83\\\/b1\\\/9183b1ec-8ff1-15d4-108a-f05c9aa5e0cd\\\/mzl.wbfmiklm.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a1.mzstatic.com\\\/us\\\/r1000\\\/117\\\/Purple\\\/v4\\\/91\\\/83\\\/b1\\\/9183b1ec-8ff1-15d4-108a-f05c9aa5e0cd\\\/mzl.wbfmiklm.57x57-100.jpg\",\"deviceid\":1,\"universal\":1,\"appleIcon75\":\"http:\\\/\\\/a1.mzstatic.com\\\/us\\\/r1000\\\/117\\\/Purple\\\/v4\\\/91\\\/83\\\/b1\\\/9183b1ec-8ff1-15d4-108a-f05c9aa5e0cd\\\/mzl.wbfmiklm.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a1.mzstatic.com\\\/us\\\/r1000\\\/117\\\/Purple\\\/v4\\\/91\\\/83\\\/b1\\\/9183b1ec-8ff1-15d4-108a-f05c9aa5e0cd\\\/mzl.wbfmiklm.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a1.mzstatic.com\\\/us\\\/r1000\\\/117\\\/Purple\\\/v4\\\/91\\\/83\\\/b1\\\/9183b1ec-8ff1-15d4-108a-f05c9aa5e0cd\\\/mzl.wbfmiklm.100x100-75.jpg\"},{\"id\":406949812,\"add_date\":1298399409,\"last_modification\":1336327218,\"name\":\"Fluffy Birds\",\"seller\":\"GameDuell GmbH\",\"category\":8,\"latest_version\":\"1.3.3\",\"icon75\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/074\\\/Purple\\\/v4\\\/6c\\\/fa\\\/6d\\\/6cfa6d09-d38b-24b0-c115-2300ce3182bb\\\/mzl.cysqlkgx.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/074\\\/Purple\\\/v4\\\/6c\\\/fa\\\/6d\\\/6cfa6d09-d38b-24b0-c115-2300ce3182bb\\\/mzl.cysqlkgx.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/074\\\/Purple\\\/v4\\\/6c\\\/fa\\\/6d\\\/6cfa6d09-d38b-24b0-c115-2300ce3182bb\\\/mzl.cysqlkgx.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/074\\\/Purple\\\/v4\\\/6c\\\/fa\\\/6d\\\/6cfa6d09-d38b-24b0-c115-2300ce3182bb\\\/mzl.cysqlkgx.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/074\\\/Purple\\\/v4\\\/6c\\\/fa\\\/6d\\\/6cfa6d09-d38b-24b0-c115-2300ce3182bb\\\/mzl.cysqlkgx.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/074\\\/Purple\\\/v4\\\/6c\\\/fa\\\/6d\\\/6cfa6d09-d38b-24b0-c115-2300ce3182bb\\\/mzl.cysqlkgx.100x100-75.jpg\"},{\"id\":448305290,\"add_date\":1310695417,\"last_modification\":1335828544,\"name\":\"Bubble Birds premium\",\"seller\":\"Semyon Milbert\",\"category\":8,\"latest_version\":\"1.0\",\"icon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/112\\\/Purple\\\/d3\\\/40\\\/4d\\\/mzl.wsdmxqle.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/112\\\/Purple\\\/d3\\\/40\\\/4d\\\/mzl.wsdmxqle.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/112\\\/Purple\\\/d3\\\/40\\\/4d\\\/mzl.wsdmxqle.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/112\\\/Purple\\\/d3\\\/40\\\/4d\\\/mzl.wsdmxqle.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/112\\\/Purple\\\/d3\\\/40\\\/4d\\\/mzl.wsdmxqle.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/112\\\/Purple\\\/d3\\\/40\\\/4d\\\/mzl.wsdmxqle.100x100-75.jpg\"},{\"id\":518925192,\"add_date\":1335277041,\"last_modification\":1335277041,\"name\":\"Angry Skateboarder (Zombie Killer)\",\"seller\":\"Farid De ALba\",\"category\":8,\"latest_version\":\"1.0\",\"icon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/085\\\/Purple\\\/v4\\\/4e\\\/42\\\/16\\\/4e4216dc-de6f-eb24-044f-d01d0cfd3fb3\\\/jhZjrtd8NpJXSpEgAm4hqg-temp-upload.tjqrzapo.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/085\\\/Purple\\\/v4\\\/4e\\\/42\\\/16\\\/4e4216dc-de6f-eb24-044f-d01d0cfd3fb3\\\/jhZjrtd8NpJXSpEgAm4hqg-temp-upload.tjqrzapo.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/085\\\/Purple\\\/v4\\\/4e\\\/42\\\/16\\\/4e4216dc-de6f-eb24-044f-d01d0cfd3fb3\\\/jhZjrtd8NpJXSpEgAm4hqg-temp-upload.tjqrzapo.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/085\\\/Purple\\\/v4\\\/4e\\\/42\\\/16\\\/4e4216dc-de6f-eb24-044f-d01d0cfd3fb3\\\/jhZjrtd8NpJXSpEgAm4hqg-temp-upload.tjqrzapo.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/085\\\/Purple\\\/v4\\\/4e\\\/42\\\/16\\\/4e4216dc-de6f-eb24-044f-d01d0cfd3fb3\\\/jhZjrtd8NpJXSpEgAm4hqg-temp-upload.tjqrzapo.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/085\\\/Purple\\\/v4\\\/4e\\\/42\\\/16\\\/4e4216dc-de6f-eb24-044f-d01d0cfd3fb3\\\/jhZjrtd8NpJXSpEgAm4hqg-temp-upload.tjqrzapo.100x100-75.jpg\"},{\"id\":517196095,\"add_date\":1334763151,\"last_modification\":1334763151,\"name\":\"Angry Biker\",\"seller\":\"Kim Nguyen\",\"category\":8,\"latest_version\":\"1.0\",\"icon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/57\\\/eb\\\/a5\\\/57eba50c-34bb-ae0d-7e9d-8c93b1a1c2eb\\\/bnANM5xojxocVBAn35Ehzw-temp-upload.mpewbutf.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/57\\\/eb\\\/a5\\\/57eba50c-34bb-ae0d-7e9d-8c93b1a1c2eb\\\/bnANM5xojxocVBAn35Ehzw-temp-upload.mpewbutf.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/57\\\/eb\\\/a5\\\/57eba50c-34bb-ae0d-7e9d-8c93b1a1c2eb\\\/bnANM5xojxocVBAn35Ehzw-temp-upload.mpewbutf.57x57-100.jpg\",\"deviceid\":1,\"universal\":1,\"appleIcon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/57\\\/eb\\\/a5\\\/57eba50c-34bb-ae0d-7e9d-8c93b1a1c2eb\\\/bnANM5xojxocVBAn35Ehzw-temp-upload.mpewbutf.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/57\\\/eb\\\/a5\\\/57eba50c-34bb-ae0d-7e9d-8c93b1a1c2eb\\\/bnANM5xojxocVBAn35Ehzw-temp-upload.mpewbutf.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/100\\\/Purple\\\/v4\\\/57\\\/eb\\\/a5\\\/57eba50c-34bb-ae0d-7e9d-8c93b1a1c2eb\\\/bnANM5xojxocVBAn35Ehzw-temp-upload.mpewbutf.100x100-75.jpg\"},{\"id\":421793817,\"add_date\":1299901377,\"last_modification\":1333962834,\"name\":\"Angry Bomb 2\",\"seller\":\"Li Ying\",\"category\":8,\"latest_version\":\"1.0\",\"icon75\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/016\\\/Purple\\\/69\\\/13\\\/0e\\\/mzm.uawfaovc.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/016\\\/Purple\\\/69\\\/13\\\/0e\\\/mzm.uawfaovc.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/016\\\/Purple\\\/69\\\/13\\\/0e\\\/mzm.uawfaovc.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/016\\\/Purple\\\/69\\\/13\\\/0e\\\/mzm.uawfaovc.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/016\\\/Purple\\\/69\\\/13\\\/0e\\\/mzm.uawfaovc.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/016\\\/Purple\\\/69\\\/13\\\/0e\\\/mzm.uawfaovc.100x100-75.jpg\"},{\"id\":386451431,\"add_date\":1282714201,\"last_modification\":1333961744,\"name\":\"Angry Zombies !!\",\"seller\":\"Si-Yeon Kim\",\"category\":8,\"latest_version\":\"1.13\",\"icon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/094\\\/Purple\\\/e0\\\/ae\\\/ef\\\/mzm.hckdtzqh.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/094\\\/Purple\\\/e0\\\/ae\\\/ef\\\/mzm.hckdtzqh.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/094\\\/Purple\\\/e0\\\/ae\\\/ef\\\/mzm.hckdtzqh.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/094\\\/Purple\\\/e0\\\/ae\\\/ef\\\/mzm.hckdtzqh.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/094\\\/Purple\\\/e0\\\/ae\\\/ef\\\/mzm.hckdtzqh.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a4.mzstatic.com\\\/us\\\/r1000\\\/094\\\/Purple\\\/e0\\\/ae\\\/ef\\\/mzm.hckdtzqh.100x100-75.jpg\"},{\"id\":413650015,\"add_date\":1294943744,\"last_modification\":1333961693,\"name\":\"Angry Bomb\",\"seller\":\"Li Ying\",\"category\":8,\"latest_version\":\"1.3\",\"icon75\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/000\\\/Purple\\\/07\\\/4b\\\/1e\\\/mzi.qpikwqfa.75x75-65.jpg\",\"icon100\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/000\\\/Purple\\\/07\\\/4b\\\/1e\\\/mzi.qpikwqfa.100x100-75.jpg\",\"icon57\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/000\\\/Purple\\\/07\\\/4b\\\/1e\\\/mzi.qpikwqfa.57x57-100.jpg\",\"deviceid\":1,\"universal\":0,\"appleIcon75\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/000\\\/Purple\\\/07\\\/4b\\\/1e\\\/mzi.qpikwqfa.75x75-65.jpg\",\"appleIcon57\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/000\\\/Purple\\\/07\\\/4b\\\/1e\\\/mzi.qpikwqfa.57x57-100.jpg\",\"appleIcon100\":\"http:\\\/\\\/a5.mzstatic.com\\\/us\\\/r1000\\\/000\\\/Purple\\\/07\\\/4b\\\/1e\\\/mzi.qpikwqfa.100x100-75.jpg\"}],\"total_pages\":4}"}'; die(0); } } */
<?php require dirname(__FILE__) . '/SplClassLoader.php'; $autoLoader = new SplClassLoader('Ejsmont', dirname(__FILE__) . '/../src'); $autoLoader->register();
<?php require_once '../vendor/autoload.php'; $helperLoader = new SplClassLoader('Helpers', '../vendor'); $youtubeLoader = new SplClassLoader('Youtube', '../vendor'); $helperLoader->register(); $youtubeLoader->register(); use Helpers\Config; use Youtube\Youtube; $config = new Config(); $config->load('../config/config.php'); $youtube = new Youtube($config->get('youtube.apiKey')); header('Content-type: application/json'); if (!isset($_GET['id'])) { $data = array('status' => 'error', 'description' => 'Provide a valid video id.'); echo json_encode($data); } else { echo $youtube->getVideoInfo($_GET['id']); }
<?php require_once './vendor/autoload.php'; $helperLoader = new SplClassLoader('Helpers', './vendor'); $helperLoader->register(); use Helpers\Config; $config = new Config(); $config->load('./config/config.php'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Ajax contact form</title> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <div class="jumbotron"> <div class="container"> <h1>Ajax Contact Form</h1> <p>A simple ajax based contact form using pure JavaScript and PHP.</p> <p><a class="btn btn-primary btn-lg" href="https://github.com/pinceladasdaweb/Ajax-Contact-Form" role="button">Learn more »</a></p> </div> </div> <div class="col-md-6 col-md-offset-3"> <form enctype="application/x-www-form-urlencoded;" id="contact-form" class="form-horizontal" role="form" method="post"> <div class="form-group" id="name-field"> <label for="form-name" class="col-lg-2 control-label"><?php
/** * updateCacheTable() * * Update the CACHE table */ function updateCacheTable($action, $id = "") { global $db, $server, $user, $pass, $database, $pre, $port; require_once $_SESSION['settings']['cpassman_dir'] . '/sources/SplClassLoader.php'; //Connect to DB require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; DB::$host = $server; DB::$user = $user; DB::$password = $pass; DB::$dbName = $database; DB::$port = $port; DB::$error_handler = 'db_error_handler'; $link = mysqli_connect($server, $user, $pass, $database, $port); //Load Tree $tree = new SplClassLoader('Tree\\NestedTree', '../includes/libraries'); $tree->register(); $tree = new Tree\NestedTree\NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title'); // Rebuild full cache table if ($action == "reload") { // truncate table DB::query("TRUNCATE TABLE " . $pre . "cache"); // reload date $rows = DB::query("SELECT *\n FROM " . $pre . "items as i\n INNER JOIN " . $pre . "log_items as l ON (l.id_item = i.id)\n AND l.action = %s\n AND i.inactif = %i", 'at_creation', 0); foreach ($rows as $record) { // Get all TAGS $tags = ""; $itemTags = DB::query("SELECT tag FROM " . $pre . "tags WHERE item_id=%i", $record['id']); foreach ($itemTags as $itemTag) { if (!empty($itemTag['tag'])) { $tags .= $itemTag['tag'] . " "; } } // form id_tree to full foldername $folder = ""; $arbo = $tree->getPath($record['id_tree'], true); foreach ($arbo as $elem) { if ($elem->title == $_SESSION['user_id'] && $elem->nlevel == 1) { $elem->title = $_SESSION['login']; } if (empty($folder)) { $folder = stripslashes($elem->title); } else { $folder .= " » " . stripslashes($elem->title); } } // store data DB::insert($pre . "cache", array('id' => $record['id'], 'label' => $record['label'], 'description' => $record['description'], 'tags' => $tags, 'id_tree' => $record['id_tree'], 'perso' => $record['perso'], 'restricted_to' => $record['restricted_to'], 'login' => $record['login'] == null ? "" : $record['login'], 'folder' => $folder, 'author' => $record['id_user'])); } // UPDATE an item } elseif ($action == "update_value") { // get new value from db $data = DB::queryfirstrow("SELECT label, description, id_tree, perso, restricted_to, login\n FROM " . $pre . "items\n WHERE id=%i", $id); // Get all TAGS $tags = ""; $itemTags = DB::query("SELECT tag FROM " . $pre . "tags WHERE item_id=%i", $id); foreach ($itemTags as $itemTag) { if (!empty($itemTag['tag'])) { $tags .= $itemTag['tag'] . " "; } } // form id_tree to full foldername $folder = ""; $arbo = $tree->getPath($data['id_tree'], true); foreach ($arbo as $elem) { if ($elem->title == $_SESSION['user_id'] && $elem->nlevel == 1) { $elem->title = $_SESSION['login']; } if (empty($folder)) { $folder = stripslashes($elem->title); } else { $folder .= " » " . stripslashes($elem->title); } } // finaly update DB::update($pre . "cache", array('label' => $data['label'], 'description' => $data['description'], 'tags' => $tags, 'id_tree' => $data['id_tree'], 'perso' => $data['perso'], 'restricted_to' => $data['restricted_to'], 'login' => $data['login'], 'folder' => $folder, 'author' => $_SESSION['user_id']), "id = %i", $id); // ADD an item } elseif ($action == "add_value") { // get new value from db $data = DB::queryFirstRow("SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login\n FROM " . $pre . "items as i\n INNER JOIN " . $pre . "log_items as l ON (l.id_item = i.id)\n WHERE i.id = %i\n AND l.action = %s", $id, 'at_creation'); // Get all TAGS $tags = ""; $itemTags = DB::query("SELECT tag FROM " . $pre . "tags WHERE item_id = %i", $id); foreach ($itemTags as $itemTag) { if (!empty($itemTag['tag'])) { $tags .= $itemTag['tag'] . " "; } } // form id_tree to full foldername $folder = ""; $arbo = $tree->getPath($data['id_tree'], true); foreach ($arbo as $elem) { if ($elem->title == $_SESSION['user_id'] && $elem->nlevel == 1) { $elem->title = $_SESSION['login']; } if (empty($folder)) { $folder = stripslashes($elem->title); } else { $folder .= " » " . stripslashes($elem->title); } } // finaly update DB::insert($pre . "cache", array('id' => $data['id'], 'label' => $data['label'], 'description' => $data['description'], 'tags' => $tags, 'id_tree' => $data['id_tree'], 'perso' => $data['perso'], 'restricted_to' => $data['restricted_to'], 'login' => $data['login'], 'folder' => $folder, 'author' => $_SESSION['user_id'])); // DELETE an item } elseif ($action == "delete_value") { DB::delete($pre . "cache", "id = %i", $id); } }
/** * Loads the CSS from source/css/ into CSS Rule Saver to be used for code view */ protected function initializeCSSRuleSaver() { $loader = new \SplClassLoader('CSSRuleSaver', __DIR__ . '/../../lib'); $loader->register(); $this->cssRuleSaver = new \CSSRuleSaver\CSSRuleSaver(); foreach (glob($this->sd . "/css/*.css") as $filename) { $this->cssRuleSaver->loadCSS($filename); } }
<?php require_once '../vendor/autoload.php'; $helperLoader = new SplClassLoader('Helpers', '../vendor'); $youtubeLoader = new SplClassLoader('Youtube', '../vendor'); $templateLoader = new SplClassLoader('Broculo', '../vendor'); $helperLoader->register(); $youtubeLoader->register(); $templateLoader->register(); use Helpers\Config; use Youtube\Youtube; use Broculo\Template; $config = new Config(); $config->load('../config/config.php'); $youtube = new Youtube($config->get('youtube.apiKey')); $profile = $youtube->getUserProfile($config->get('youtube.user')); $playlist = $youtube->getUserVideos($profile['playlist'], $config->get('youtube.maxResults')); $featured = $youtube->getVideoInfo($playlist['ids'][0]); $featuredId = json_decode($featured); $videos = ''; unset($playlist['ids'][0]); $brandedTpl = new Template("../tpl/branded.tpl"); $featuredTpl = new Template("../tpl/featured.tpl"); $videosTpl = new Template("../tpl/shelf-items.tpl"); $brandedTpl->set("src", $profile['banner']); $brandedTpl->set("title", $profile['title']); $brandedTpl->set("img_profile", $profile['img_profile']); $brandedTpl->set("subscribers", $profile['subscribers']); $brandedTpl->set("videos", $profile['videos']); $featuredTpl->set("id", $featuredId->items[0]->id); $videosId = $playlist['ids'];
<?php require_once __DIR__ . "/SplClassLoader.php"; $splClassLoader = new SplClassLoader("Peach", __DIR__); $splClassLoader->register();
<?php // This is for my examples require '_system/config.php'; $relevant_code = array('\\PHPGoogleMaps\\Overlay\\Marker'); // Autoload stuff require '../PHPGoogleMaps/Core/Autoloader.php'; $map_loader = new SplClassLoader('PHPGoogleMaps', '../'); $map_loader->register(); $map = new \PHPGoogleMaps\Map(); $marker1 = \PHPGoogleMaps\Overlay\Marker::createFromLocation('New York, NY', array('title' => 'New York, NY', 'content' => 'New York marker')); $marker2 = \PHPGoogleMaps\Overlay\Marker::createFromPosition(new \PHPGoogleMaps\Core\LatLng(32.7153292, -117.1572551), array('title' => 'San Diego, CA', 'content' => 'San Diego marker')); $marker3 = \PHPGoogleMaps\Overlay\Marker::createFromLocation('Dallas, TX', array('title' => 'Dallas, TX', 'content' => 'Dallas marker')); $map->addObjects(array($marker1, $marker2, $marker3)); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Simple Sidebar - <?php echo PAGE_TITLE; ?> </title> <link rel="stylesheet" type="text/css" href="_css/style.css"> <style type="text/css"> #map, #map_sidebar { float: left } .sidebar { list-style:none; margin:0 0 0 10px;padding:0;width: 200px; } .sidebar li { margin-bottom: 2px; } .sidebar p { background-color: #eee;margin:0; padding: 5px;cursor: pointer; } .sidebar p:hover { background-color: #ddd; }
function rest_get() { $_SESSION['user_id'] = "'api'"; if (!@count($GLOBALS['request']) == 0) { $request_uri = $GLOBALS['_SERVER']['REQUEST_URI']; preg_match('/\\/api(\\/index.php|)\\/(.*)\\?apikey=(.*)/', $request_uri, $matches); if (count($matches) == 0) { rest_error('REQUEST_SENT_NOT_UNDERSTANDABLE'); } $GLOBALS['request'] = explode('/', $matches[2]); } if (apikey_checker($GLOBALS['apikey'])) { global $server, $user, $pass, $database, $pre, $link; teampass_connect(); $category_query = ""; if ($GLOBALS['request'][0] == "read") { if ($GLOBALS['request'][1] == "category") { // get ids if (strpos($GLOBALS['request'][2], ";") > 0) { $condition = "id_tree IN %ls"; $condition_value = explode(';', $GLOBALS['request'][2]); } else { $condition = "id_tree = %s"; $condition_value = $GLOBALS['request'][2]; } DB::debugMode(false); // get items in this module $response = DB::query("SELECT id,label,login,pw, pw_iv FROM " . prefix_table("items") . " WHERE " . $condition, $condition_value); foreach ($response as $data) { // prepare output $id = $data['id']; $json[$id]['label'] = mb_convert_encoding($data['label'], mb_detect_encoding($data['label']), 'UTF-8'); $json[$id]['login'] = mb_convert_encoding($data['login'], mb_detect_encoding($data['login']), 'UTF-8'); $json[$id]['pw'] = cryption($data['pw'], SALT, $data['pw_iv'], "decrypt"); } /* load folders */ $response = DB::query("SELECT id,parent_id,title,nleft,nright,nlevel FROM " . prefix_table("nested_tree") . " WHERE parent_id=%i ORDER BY `title` ASC", $GLOBALS['request'][2]); $rows = array(); $i = 0; foreach ($response as $row) { $response = DB::query("SELECT id,label,login,pw, pw_iv FROM " . prefix_table("items") . " WHERE id_tree=%i", $row['id']); foreach ($response as $data) { // prepare output $id = $data['id']; $json[$id]['label'] = mb_convert_encoding($data['label'], mb_detect_encoding($data['label']), 'UTF-8'); $json[$id]['login'] = mb_convert_encoding($data['login'], mb_detect_encoding($data['login']), 'UTF-8'); $json[$id]['pw'] = cryption($data['pw'], SALT, $data['pw_iv'], "decrypt"); } } } elseif ($GLOBALS['request'][1] == "items") { $array_items = explode(';', $GLOBALS['request'][2]); // check if not empty if (count($array_items) == 0) { rest_error('NO_ITEM'); } // only accepts numeric foreach ($array_items as $item) { if (!is_numeric($item)) { rest_error('ITEM_MALFORMED'); } } $response = DB::query("select id,label,login,pw, pw_iv, id_tree from " . prefix_table("items") . " where id IN %ls", $array_items); foreach ($response as $data) { // prepare output $id = $data['id']; $json[$id]['label'] = mb_convert_encoding($data['label'], mb_detect_encoding($data['label']), 'UTF-8'); $json[$id]['login'] = mb_convert_encoding($data['login'], mb_detect_encoding($data['login']), 'UTF-8'); $json[$id]['pw'] = cryption($data['pw'], SALT, $data['pw_iv'], "decrypt"); } } if (isset($json) && $json) { echo json_encode($json); } else { rest_error('EMPTY'); } } elseif ($GLOBALS['request'][0] == "find") { if ($GLOBALS['request'][1] == "item") { $array_category = explode(';', $GLOBALS['request'][2]); $item = $GLOBALS['request'][3]; foreach ($array_category as $category) { if (!preg_match_all("/^([\\w\\:\\'\\-\\sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ]+)\$/i", $category, $result)) { rest_error('CATEGORY_MALFORMED'); } } if (!preg_match_all("/^([\\w\\:\\'\\-\\sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ]+)\$/i", $item, $result)) { rest_error('ITEM_MALFORMED'); } elseif (empty($item) || count($array_category) == 0) { rest_error('MALFORMED'); } if (count($array_category) > 1 && count($array_category) < 5) { for ($i = count($array_category); $i > 0; $i--) { $slot = $i - 1; if (!$slot) { $category_query .= "select id from " . prefix_table("nested_tree") . " where title LIKE '" . $array_category[$slot] . "' AND parent_id = 0"; } else { $category_query .= "select id from " . prefix_table("nested_tree") . " where title LIKE '" . $array_category[$slot] . "' AND parent_id = ("; } } for ($i = 1; $i < count($array_category); $i++) { $category_query .= ")"; } } elseif (count($array_category) == 1) { $category_query = "select id from " . prefix_table("nested_tree") . " where title LIKE '" . $array_category[0] . "' AND parent_id = 0"; } else { rest_error('NO_CATEGORY'); } DB::debugMode(false); $response = DB::query("select id, label, login, pw, pw_iv, id_tree\n from " . prefix_table("items") . "\n where id_tree = (%s)\n and label LIKE %ss", $category_query, $item); foreach ($response as $data) { // prepare output $json['id'] = mb_convert_encoding($data['id'], mb_detect_encoding($data['id']), 'UTF-8'); $json['label'] = mb_convert_encoding($data['label'], mb_detect_encoding($data['label']), 'UTF-8'); $json['login'] = mb_convert_encoding($data['login'], mb_detect_encoding($data['login']), 'UTF-8'); $json['pw'] = cryption($data['pw'], SALT, $data['pw_iv'], "decrypt"); $json['folder_id'] = $data['id_tree']; $json['status'] = utf8_encode("OK"); } if (isset($json) && $json) { echo json_encode($json); } else { rest_error('EMPTY'); } } } elseif ($GLOBALS['request'][0] == "add") { if ($GLOBALS['request'][1] == "item") { // get item definition $array_item = explode(';', urldecode($GLOBALS['request'][2])); if (count($array_item) != 9) { rest_error('ITEMBADDEFINITION'); } $item_label = $array_item[0]; $item_pwd = $array_item[1]; $item_desc = $array_item[2]; $item_folder_id = $array_item[3]; $item_login = $array_item[4]; $item_email = $array_item[5]; $item_url = $array_item[6]; $item_tags = $array_item[7]; $item_anyonecanmodify = $array_item[8]; // added so one can sent data including the http or https ! // anyway we have to urlencode this data $item_url = urldecode($item_url); // same for the email $item_email = urldecode($item_email); // do some checks if (!empty($item_label) && !empty($item_pwd) && !empty($item_folder_id)) { // Check length if (strlen($item_pwd) > 50) { rest_error('PASSWORDTOOLONG'); } // Check Folder ID DB::query("SELECT * FROM " . prefix_table("nested_tree") . " WHERE id = %i", $item_folder_id); $counter = DB::count(); if ($counter == 0) { rest_error('NOSUCHFOLDER'); } // check if element doesn't already exist DB::query("SELECT * FROM " . prefix_table("items") . " WHERE label = %s AND inactif = %i", addslashes($item_label), "0"); $counter = DB::count(); if ($counter != 0) { $itemExists = 1; // prevent the error if the label already exists // so lets just add the time() as a random factor $item_label .= " (" . time() . ")"; } else { $itemExists = 0; } if ($itemExists == 0) { $encrypt = cryption($item_pwd, SALT, "", "encrypt"); if (empty($encrypt['string'])) { rest_error('PASSWORDEMPTY'); } // ADD item try { DB::insert(prefix_table("items"), array("label" => $item_label, "description" => $item_desc, 'pw' => $encrypt['string'], 'pw_iv' => $encrypt['iv'], "email" => $item_email, "url" => $item_url, "id_tree" => intval($item_folder_id), "login" => $item_login, "inactif" => 0, "restricted_to" => "", "perso" => 0, "anyone_can_modify" => intval($item_anyonecanmodify))); $newID = DB::InsertId(); // log DB::insert(prefix_table("log_items"), array("id_item" => $newID, "date" => time(), "id_user" => "9999999", "action" => "at_creation")); // Add tags $tags = explode(' ', $item_tags); foreach ((array) $tags as $tag) { if (!empty($tag)) { DB::insert(prefix_table("tags"), array("item_id" => $newID, "tag" => strtolower($tag))); } } // Update CACHE table DB::insert(prefix_table("cache"), array("id" => $newID, "label" => $item_label, "description" => $item_desc, "tags" => $item_tags, "id_tree" => $item_folder_id, "perso" => "0", "restricted_to" => "", "login" => $item_login, "folder" => "", "author" => "9999999")); echo '{"status":"item added"}'; } catch (PDOException $ex) { echo '<br />' . $ex->getMessage(); } } else { rest_error('ITEMEXISTS'); } } else { rest_error('ITEMMISSINGDATA'); } } elseif ($GLOBALS['request'][1] == "user") { // get user definition $array_user = explode(';', $GLOBALS['request'][2]); if (count($array_user) != 11) { rest_error('USERBADDEFINITION'); } $login = $array_user[0]; $name = $array_user[1]; $lastname = $array_user[2]; $password = $array_user[3]; $email = $array_user[4]; $adminby = $array_user[5]; $isreadonly = $array_user[6]; $roles = $array_user[7]; $isadmin = $array_user[8]; $ismanager = $array_user[9]; $haspf = $array_user[10]; // Empty user if (mysqli_escape_string($link, htmlspecialchars_decode($login)) == "") { rest_error('USERLOGINEMPTY'); } // Check if user already exists $data = DB::query("SELECT id, fonction_id, groupes_interdits, groupes_visibles FROM " . prefix_table("users") . "\n WHERE login LIKE %ss", mysqli_escape_string($link, stripslashes($login))); if (DB::count() == 0) { try { // find AdminRole code in DB $resRole = DB::queryFirstRow("SELECT id\n FROM " . prefix_table("roles_title") . "\n WHERE title LIKE %ss", mysqli_escape_string($link, stripslashes($adminby))); // get default language $lang = DB::queryFirstRow("SELECT `valeur` FROM " . prefix_table("misc") . " WHERE type = %s AND intitule = %s", "admin", "default_language"); // prepare roles list $rolesList = ""; foreach (explode('|', $roles) as $role) { echo $role . "-"; $tmp = DB::queryFirstRow("SELECT `id` FROM " . prefix_table("roles_title") . " WHERE title = %s", $role); if (empty($rolesList)) { $rolesList = $tmp['id']; } else { $rolesList .= ";" . $tmp['id']; } } // Add user in DB DB::insert(prefix_table("users"), array('login' => $login, 'name' => $name, 'lastname' => $lastname, 'pw' => bCrypt(stringUtf8Decode($password), COST), 'email' => $email, 'admin' => intval($isadmin), 'gestionnaire' => intval($ismanager), 'read_only' => intval($isreadonly), 'personal_folder' => intval($haspf), 'user_language' => $lang['valeur'], 'fonction_id' => $rolesList, 'groupes_interdits' => '0', 'groupes_visibles' => '0', 'isAdministratedByRole' => empty($resRole) ? '0' : $resRole['id'])); $new_user_id = DB::insertId(); // Create personnal folder if (intval($haspf) == 1) { DB::insert(prefix_table("nested_tree"), array('parent_id' => '0', 'title' => $new_user_id, 'bloquer_creation' => '0', 'bloquer_modification' => '0', 'personal_folder' => '1')); } // Send email to new user @sendEmail($LANG['email_subject_new_user'], str_replace(array('#tp_login#', '#tp_pw#', '#tp_link#'), array(" " . addslashes($login), addslashes($password), $_SESSION['settings']['email_server_url']), $LANG['email_new_user_mail']), $email); // update LOG logEvents('user_mngt', 'at_user_added', 'api - ' . $GLOBALS['apikey'], $new_user_id); echo '{"status":"user added"}'; } catch (PDOException $ex) { echo '<br />' . $ex->getMessage(); } } else { rest_error('USERALREADYEXISTS'); } } } elseif ($GLOBALS['request'][0] == "auth") { /* ** FOR SECURITY PURPOSE, it is mandatory to use SSL to connect your teampass instance. The user password is not encrypted! ** ** ** Expected call format: .../api/index.php/auth/<PROTOCOL>/<URL>/<login>/<password>?apikey=<VALID API KEY> ** Example: https://127.0.0.1/teampass/api/index.php/auth/http/www.zadig-tge.adp.com/U1/test/76?apikey=chahthait5Aidood6johh6Avufieb6ohpaixain ** RESTRICTIONS: ** - <PROTOCOL> ==> http|https|ftp|... ** - <URL> ==> encode URL without protocol (example: http://www.teampass.net becomes www.teampass.net) ** - <login> ==> user's login ** - <password> ==> currently clear password ** ** RETURNED ANSWER: ** - format sent back is JSON ** - Example: {"<item_id>":{"label":"<pass#1>","login":"******","pw":"<pwd#1>"},"<item_id>":{"label":"<pass#2>","login":"******","pw":"<pwd#2>"}} ** */ // get user credentials if (isset($GLOBALS['request'][3]) && isset($GLOBALS['request'][4])) { // get url if (isset($GLOBALS['request'][1]) && isset($GLOBALS['request'][2])) { // is user granted? $user = DB::queryFirstRow("SELECT `id`, `pw`, `groupes_interdits`, `groupes_visibles`, `fonction_id` FROM " . $pre . "users WHERE login = %s", $GLOBALS['request'][3]); // load passwordLib library $_SESSION['settings']['cpassman_dir'] = ".."; require_once '../sources/SplClassLoader.php'; $pwdlib = new SplClassLoader('PasswordLib', '../includes/libraries'); $pwdlib->register(); $pwdlib = new PasswordLib\PasswordLib(); if ($pwdlib->verifyPasswordHash($GLOBALS['request'][4], $user['pw']) === true) { // define the restriction of "id_tree" of this user $userDef = DB::queryOneColumn('folder_id', "SELECT DISTINCT folder_id \n FROM " . prefix_table("roles_values") . "\n WHERE type IN ('R', 'W') ", empty($user['groupes_interdits']) ? "" : "\n AND folder_id NOT IN (" . str_replace(";", ",", $user['groupes_interdits']) . ")", " \n AND role_id IN %ls \n GROUP BY folder_id", explode(";", $user['groupes_interdits'])); // complete with "groupes_visibles" foreach (explode(";", $user['groupes_visibles']) as $v) { array_push($userDef, $v); } // find the item associated to the url $response = DB::query("SELECT id, label, login, pw, pw_iv, id_tree, restricted_to\n FROM " . prefix_table("items") . " \n WHERE url LIKE %s\n AND id_tree IN (" . implode(",", $userDef) . ")\n ORDER BY id DESC", $GLOBALS['request'][1] . "://" . urldecode($GLOBALS['request'][2] . '%')); $counter = DB::count(); if ($counter > 0) { $json = ""; foreach ($response as $data) { // check if item visible if (empty($data['restricted_to']) || $data['restricted_to'] != "" && in_array($user['id'], explode(";", $data['restricted_to']))) { // prepare export $json[$data['id']]['label'] = mb_convert_encoding($data['label'], mb_detect_encoding($data['label']), 'UTF-8'); $json[$data['id']]['login'] = mb_convert_encoding($data['login'], mb_detect_encoding($data['login']), 'UTF-8'); $json[$data['id']]['pw'] = cryption($data['pw'], SALT, $data['pw_iv'], "decrypt"); } } // prepare answer. If no access then inform if (empty($json)) { rest_error('AUTH_NO_DATA'); } else { echo json_encode($json); } } else { rest_error('AUTH_NO_DATA'); } } else { rest_error('AUTH_NOT_GRANTED'); } } else { rest_error('AUTH_NO_URL'); } } else { rest_error('AUTH_NO_IDENTIFIER'); } } elseif ($GLOBALS['request'][0] == "set") { /* * Expected call format: .../api/index.php/set/<login_to_save>/<password_to_save>/<url>/<user_login>/<user_password>?apikey=<VALID API KEY> * Example: https://127.0.0.1/teampass/api/index.php/auth/myLogin/myPassword/USER1/test/76?apikey=chahthait5Aidood6johh6Avufieb6ohpaixain * * NEW ITEM WILL BE STORED IN SPECIFIC FOLDER */ // get user credentials if (isset($GLOBALS['request'][4]) && isset($GLOBALS['request'][5])) { // get url if (isset($GLOBALS['request'][1]) && isset($GLOBALS['request'][2]) && isset($GLOBALS['request'][3])) { // is user granted? $user = DB::queryFirstRow("SELECT `id`, `pw`, `groupes_interdits`, `groupes_visibles`, `fonction_id` FROM " . $pre . "users WHERE login = %s", $GLOBALS['request'][4]); // load passwordLib library $_SESSION['settings']['cpassman_dir'] = ".."; require_once '../sources/SplClassLoader.php'; $pwdlib = new SplClassLoader('PasswordLib', '../includes/libraries'); $pwdlib->register(); $pwdlib = new PasswordLib\PasswordLib(); // is user identified? if ($pwdlib->verifyPasswordHash($GLOBALS['request'][5], $user['pw']) === true) { // does the personal folder of this user exists? DB::queryFirstRow("SELECT `id`\n FROM " . $pre . "nested_tree\n WHERE title = %s AND personal_folder = 1", $user['id']); if (DB::count() > 0) { // check if "teampass-connect" folder exists // if not create it $folder = DB::queryFirstRow("SELECT `id`\n FROM " . $pre . "nested_tree\n WHERE title = %s", "teampass-connect"); if (DB::count() == 0) { DB::insert(prefix_table("nested_tree"), array('parent_id' => '0', 'title' => "teampass-connect")); $tpc_folder_id = DB::insertId(); //Add complexity DB::insert(prefix_table("misc"), array('type' => 'complex', 'intitule' => $tpc_folder_id, 'valeur' => '0')); // rebuild tree $tree = new Tree\NestedTree\NestedTree(prefix_table("nested_tree"), 'id', 'parent_id', 'title'); $tree->rebuild(); } else { $tpc_folder_id = $folder['id']; } // encrypt password $encrypt = cryption($GLOBALS['request'][2], SALT, "", "encrypt"); // add new item DB::insert(prefix_table("items"), array('label' => "Credentials for " . urldecode($GLOBALS['request'][3] . '%'), 'description' => "Imported with Teampass-Connect", 'pw' => $encrypt['string'], 'pw_iv' => $encrypt['iv'], 'email' => "", 'url' => urldecode($GLOBALS['request'][3] . '%'), 'id_tree' => $tpc_folder_id, 'login' => $GLOBALS['request'][1], 'inactif' => '0', 'restricted_to' => $user['id'], 'perso' => '0', 'anyone_can_modify' => '0', 'complexity_level' => '0')); $newID = DB::insertId(); // log logItems($newID, "Credentials for " . urldecode($GLOBALS['request'][3] . '%'), $user['id'], 'at_creation', $GLOBALS['request'][1]); $json['status'] = "ok"; // prepare answer. If no access then inform if (empty($json)) { rest_error('AUTH_NO_DATA'); } else { echo json_encode($json); } } else { rest_error('NO_PF_EXIST_FOR_USER'); } } else { rest_error('AUTH_NOT_GRANTED'); } } else { rest_error('SET_NO_DATA'); } } else { rest_error('AUTH_NO_IDENTIFIER'); } } else { rest_error('METHOD'); } } }
<?php error_reporting(E_ALL); require __DIR__ . '/lib/SplClassLoader.php'; $classLoader = new SplClassLoader('WebSocket', __DIR__ . '/lib'); $classLoader->register(); $server = new \WebSocket\Server('localhost', 8000); $server->registerApplication('echo', \WebSocket\Application\EchoApplication::getInstance()); $server->run();
require_once 'main.functions.php'; require_once $_SESSION['settings']['cpassman_dir'] . '/sources/SplClassLoader.php'; //Connect to DB require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; DB::$host = $server; DB::$user = $user; DB::$password = $pass; DB::$dbName = $database; DB::$port = $port; DB::$encoding = $encoding; DB::$error_handler = 'db_error_handler'; $link = mysqli_connect($server, $user, $pass, $database, $port); $link->set_charset($encoding); //Build tree $tree = new SplClassLoader('Tree\\NestedTree', $_SESSION['settings']['cpassman_dir'] . '/includes/libraries'); $tree->register(); $tree = new Tree\NestedTree\NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title'); if (!empty($_POST['type'])) { switch ($_POST['type']) { #CASE adding a new role case "add_new_role": //Check if role already exist : No similar roles $tmp = DB::query("SELECT * FROM " . prefix_table("roles_title") . " WHERE title = %s", stripslashes($_POST['name'])); $counter = DB::count(); if ($counter == 0) { DB::insert(prefix_table("roles_title"), array('title' => stripslashes($_POST['name']), 'complexity' => $_POST['complexity'], 'creator_id' => $_SESSION['user_id'])); $role_id = DB::insertId(); if ($role_id != 0) { //Actualize the variable $_SESSION['nb_roles']++; echo '[ { "error" : "no" } ]';
$necessaryConfigValues = array('jcr.url', 'jcr.user', 'jcr.pass', 'jcr.workspace', 'jcr.transport'); foreach ($necessaryConfigValues as $val) { if (empty($GLOBALS[$val])) { die('Please set ' . $val . ' in your phpunit.xml.' . "\n"); } } require_once dirname(__FILE__) . '/../SplClassLoader.php'; // Midgard2CR is in the src dir $midgard2crAutoloader = new SplClassLoader('Midgard2CR', dirname(__FILE__) . '/../src'); $midgard2crAutoloader->register(); // Midgard2CR\Query $midgard2crQAutoloader = new SplClassLoader('Midgard2CR\\Query', dirname(__FILE__) . '/../src/Midgard2CR/Query'); $midgard2crQAutoloader->register(); // PHPCR is in a submodule in lib/PHPCR $phpcrAutoloader = new SplClassLoader('PHPCR', dirname(__FILE__) . '/../lib/PHPCR/src'); $phpcrAutoloader->register(); function getRepository($config) { $factory = new Midgard2CR\RepositoryFactory(); return $factory->getRepository(); } /** * @param user The user name for the credentials * @param password The password for the credentials * @return the simple credentials instance for this implementation with the specified username/password */ function getSimpleCredentials($user, $password) { return new \PHPCR\SimpleCredentials($user, $password); } /**
function identifyUser($sentData) { global $debugLdap, $debugDuo, $k; include $_SESSION['settings']['cpassman_dir'] . '/includes/settings.php'; header("Content-type: text/html; charset=utf-8"); error_reporting(E_ERROR); require_once $_SESSION['settings']['cpassman_dir'] . '/sources/main.functions.php'; require_once $_SESSION['settings']['cpassman_dir'] . '/sources/SplClassLoader.php'; if ($debugDuo == 1) { $dbgDuo = fopen($_SESSION['settings']['path_to_files_folder'] . "/duo.debug.txt", "a"); } /* if (empty($sentData) && isset($_COOKIE['TeamPassC'])) { $sentData = prepareExchangedData($_COOKIE['TeamPassC'], "encode"); setcookie('TeamPassC', "", time()-3600); } */ if ($debugDuo == 1) { fputs($dbgDuo, "Content of data sent '" . $sentData . "'\n"); } // connect to the server require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; DB::$host = $server; DB::$user = $user; DB::$password = $pass; DB::$dbName = $database; DB::$port = $port; DB::$encoding = $encoding; DB::$error_handler = 'db_error_handler'; $link = mysqli_connect($server, $user, $pass, $database, $port); $link->set_charset($encoding); //Load AES $aes = new SplClassLoader('Encryption\\Crypt', '../includes/libraries'); $aes->register(); // load passwordLib library $pwdlib = new SplClassLoader('PasswordLib', '../includes/libraries'); $pwdlib->register(); $pwdlib = new PasswordLib\PasswordLib(); // User's language loading $k['langage'] = @$_SESSION['user_language']; require_once $_SESSION['settings']['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; // decrypt and retreive data in JSON format $dataReceived = prepareExchangedData($sentData, "decode"); // Prepare variables $passwordClear = htmlspecialchars_decode($dataReceived['pw']); $passwordOldEncryption = encryptOld(htmlspecialchars_decode($dataReceived['pw'])); $username = htmlspecialchars_decode($dataReceived['login']); $logError = ""; if ($debugDuo == 1) { fputs($dbgDuo, "Starting authentication of '" . $username . "'\n"); } // GET SALT KEY LENGTH if (strlen(SALT) > 32) { $_SESSION['error']['salt'] = true; } $_SESSION['user_language'] = $k['langage']; $ldapConnection = false; /* LDAP connection */ if ($debugLdap == 1) { // create temp file $dbgLdap = fopen($_SESSION['settings']['path_to_files_folder'] . "/ldap.debug.txt", "w"); fputs($dbgLdap, "Get all LDAP params : \n" . 'mode : ' . $_SESSION['settings']['ldap_mode'] . "\n" . 'type : ' . $_SESSION['settings']['ldap_type'] . "\n" . 'base_dn : ' . $_SESSION['settings']['ldap_domain_dn'] . "\n" . 'search_base : ' . $_SESSION['settings']['ldap_search_base'] . "\n" . 'bind_dn : ' . $_SESSION['settings']['ldap_bind_dn'] . "\n" . 'bind_passwd : ' . $_SESSION['settings']['ldap_bind_passwd'] . "\n" . 'user_attribute : ' . $_SESSION['settings']['ldap_user_attribute'] . "\n" . 'account_suffix : ' . $_SESSION['settings']['ldap_suffix'] . "\n" . 'domain_controllers : ' . $_SESSION['settings']['ldap_domain_controler'] . "\n" . 'use_ssl : ' . $_SESSION['settings']['ldap_ssl'] . "\n" . 'use_tls : ' . $_SESSION['settings']['ldap_tls'] . "\n*********\n\n"); } if ($debugDuo == 1) { fputs($dbgDuo, "LDAP status: " . $_SESSION['settings']['ldap_mode'] . "\n"); } if (isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 1 && $username != "admin") { //Multiple Domain Names if (strpos(html_entity_decode($username), '\\') == true) { $ldap_suffix = "@" . substr(html_entity_decode($username), 0, strpos(html_entity_decode($username), '\\')); $username = substr(html_entity_decode($username), strpos(html_entity_decode($username), '\\') + 1); } if ($_SESSION['settings']['ldap_type'] == 'posix-search') { $ldapconn = ldap_connect($_SESSION['settings']['ldap_domain_controler']); if ($debugLdap == 1) { fputs($dbgLdap, "LDAP connection : " . ($ldapconn ? "Connected" : "Failed") . "\n"); } ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); if ($ldapconn) { $ldapbind = ldap_bind($ldapconn, $_SESSION['settings']['ldap_bind_dn'], $_SESSION['settings']['ldap_bind_passwd']); if ($debugLdap == 1) { fputs($dbgLdap, "LDAP bind : " . ($ldapbind ? "Bound" : "Failed") . "\n"); } if ($ldapbind) { $filter = "(&(" . $_SESSION['settings']['ldap_user_attribute'] . "={$username})(objectClass=posixAccount))"; $result = ldap_search($ldapconn, $_SESSION['settings']['ldap_search_base'], $filter, array('dn')); if ($debugLdap == 1) { fputs($dbgLdap, 'Search filter : ' . $filter . "\n" . 'Results : ' . print_r(ldap_get_entries($ldapconn, $result), true) . "\n"); } if (ldap_count_entries($ldapconn, $result)) { // try auth $result = ldap_get_entries($ldapconn, $result); $user_dn = $result[0]['dn']; $ldapbind = ldap_bind($ldapconn, $user_dn, $passwordClear); if ($ldapbind) { $ldapConnection = true; } else { $ldapConnection = false; } } } else { $ldapConnection = false; } } else { $ldapConnection = false; } } else { if ($debugLdap == 1) { fputs($dbgLdap, "Get all ldap params : \n" . 'base_dn : ' . $_SESSION['settings']['ldap_domain_dn'] . "\n" . 'account_suffix : ' . $_SESSION['settings']['ldap_suffix'] . "\n" . 'domain_controllers : ' . $_SESSION['settings']['ldap_domain_controler'] . "\n" . 'use_ssl : ' . $_SESSION['settings']['ldap_ssl'] . "\n" . 'use_tls : ' . $_SESSION['settings']['ldap_tls'] . "\n*********\n\n"); } $adldap = new SplClassLoader('LDAP\\adLDAP', '../includes/libraries'); $adldap->register(); // Posix style LDAP handles user searches a bit differently if ($_SESSION['settings']['ldap_type'] == 'posix') { $ldap_suffix = ',' . $_SESSION['settings']['ldap_suffix'] . ',' . $_SESSION['settings']['ldap_domain_dn']; } elseif ($_SESSION['settings']['ldap_type'] == 'windows' and $ldap_suffix == '') { //Multiple Domain Names $ldap_suffix = $_SESSION['settings']['ldap_suffix']; } $adldap = new LDAP\adLDAP\adLDAP(array('base_dn' => $_SESSION['settings']['ldap_domain_dn'], 'account_suffix' => $ldap_suffix, 'domain_controllers' => explode(",", $_SESSION['settings']['ldap_domain_controler']), 'use_ssl' => $_SESSION['settings']['ldap_ssl'], 'use_tls' => $_SESSION['settings']['ldap_tls'])); if ($debugLdap == 1) { fputs($dbgLdap, "Create new adldap object : " . $adldap->get_last_error() . "\n\n\n"); //Debug } // openLDAP expects an attribute=value pair if ($_SESSION['settings']['ldap_type'] == 'posix') { $auth_username = $_SESSION['settings']['ldap_user_attribute'] . '=' . $username; } else { $auth_username = $username; } // authenticate the user if ($adldap->authenticate($auth_username, html_entity_decode($passwordClear))) { $ldapConnection = true; //update user's password $data['pw'] = $pwdlib->createPasswordHash($passwordClear); DB::update(prefix_table('users'), array('pw' => $data['pw']), "login=%s", $username); } else { $ldapConnection = false; } if ($debugLdap == 1) { fputs($dbgLdap, "After authenticate : " . $adldap->get_last_error() . "\n\n\n" . "ldap status : " . $ldapConnection . "\n\n\n"); //Debug } } } else { if (isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 2) { // nothing } } // Check if user exists $data = DB::queryFirstRow("SELECT * FROM " . prefix_table("users") . " WHERE login=%s_login", array('login' => $username)); $counter = DB::count(); if ($debugDuo == 1) { fputs($dbgDuo, "USer exists: " . $counter . "\n"); } // Check PSK if (isset($_SESSION['settings']['psk_authentication']) && $_SESSION['settings']['psk_authentication'] == 1 && $data['admin'] != 1) { $psk = htmlspecialchars_decode($dataReceived['psk']); $pskConfirm = htmlspecialchars_decode($dataReceived['psk_confirm']); if (empty($psk)) { echo '[{"value" : "psk_required"}]'; exit; } elseif (empty($data['psk'])) { if (empty($pskConfirm)) { echo '[{"value" : "bad_psk_confirmation"}]'; exit; } else { $_SESSION['my_sk'] = $psk; } } elseif ($pwdlib->verifyPasswordHash($psk, $data['psk']) === true) { echo '[{"value" : "bad_psk"}]'; exit; } } $proceedIdentification = false; if ($counter > 0) { $proceedIdentification = true; } elseif ($counter == 0 && $ldapConnection == true && isset($_SESSION['settings']['ldap_elusers']) && $_SESSION['settings']['ldap_elusers'] == 0) { // If LDAP enabled, create user in CPM if doesn't exist $data['pw'] = $pwdlib->createPasswordHash($passwordClear); // create passwordhash DB::insert(prefix_table('users'), array('login' => $username, 'pw' => $data['pw'], 'email' => "", 'admin' => '0', 'gestionnaire' => '0', 'personal_folder' => $_SESSION['settings']['enable_pf_feature'] == "1" ? '1' : '0', 'fonction_id' => '0', 'groupes_interdits' => '0', 'groupes_visibles' => '0', 'last_pw_change' => time(), 'user_language' => $_SESSION['settings']['default_language'])); $newUserId = DB::insertId(); // Create personnal folder if ($_SESSION['settings']['enable_pf_feature'] == "1") { DB::insert(prefix_table("nested_tree"), array('parent_id' => '0', 'title' => $newUserId, 'bloquer_creation' => '0', 'bloquer_modification' => '0', 'personal_folder' => '1')); } // Get info for user //$sql = "SELECT * FROM ".prefix_table("users")." WHERE login = '******'"; //$row = $db->query($sql); $proceedIdentification = true; } // Check if user exists (and has been created in case of new LDAP user) $data = DB::queryFirstRow("SELECT * FROM " . prefix_table("users") . " WHERE login=%s_login", array('login' => $username)); $counter = DB::count(); if ($counter == 0) { echo '[{"value" : "user_not_exists", "text":""}]'; exit; } if ($debugDuo == 1) { fputs($dbgDuo, "USer exists (confirm): " . $counter . "\n"); } // check GA code if (isset($_SESSION['settings']['2factors_authentication']) && $_SESSION['settings']['2factors_authentication'] == 1 && $username != "admin") { if (isset($dataReceived['GACode']) && !empty($dataReceived['GACode'])) { include_once $_SESSION['settings']['cpassman_dir'] . "/includes/libraries/Authentication/GoogleAuthenticator/FixedBitNotation.php"; include_once $_SESSION['settings']['cpassman_dir'] . "/includes/libraries/Authentication/GoogleAuthenticator/GoogleAuthenticator.php"; $g = new Authentication\GoogleAuthenticator\GoogleAuthenticator(); if ($g->checkCode($data['ga'], $dataReceived['GACode'])) { $proceedIdentification = true; } else { $proceedIdentification = false; $logError = "ga_code_wrong"; } } else { $proceedIdentification = false; $logError = "ga_code_wrong"; } } if ($debugDuo == 1) { fputs($dbgDuo, "Proceed with Ident: " . $proceedIdentification . "\n"); } if ($proceedIdentification === true) { // User exists in the DB //$data = $db->fetchArray($row); //v2.1.17 -> change encryption for users password if ($passwordOldEncryption == $data['pw'] && !empty($data['pw'])) { //update user's password $data['pw'] = bCrypt($passwordClear, COST); DB::update(prefix_table('users'), array('pw' => $data['pw']), "id=%i", $data['id']); } if (crypt($passwordClear, $data['pw']) == $data['pw'] && !empty($data['pw'])) { //update user's password $data['pw'] = $pwdlib->createPasswordHash($passwordClear); DB::update(prefix_table('users'), array('pw' => $data['pw']), "id=%i", $data['id']); } // check the given password if ($pwdlib->verifyPasswordHash($passwordClear, $data['pw']) === true) { $userPasswordVerified = true; } else { $userPasswordVerified = false; } if ($debugDuo == 1) { fputs($dbgDuo, "User's password verified: " . $userPasswordVerified . "\n"); } // Can connect if // 1- no LDAP mode + user enabled + pw ok // 2- LDAP mode + user enabled + ldap connection ok + user is not admin // 3- LDAP mode + user enabled + pw ok + usre is admin // This in order to allow admin by default to connect even if LDAP is activated if (isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 0 && $userPasswordVerified == true && $data['disabled'] == 0 || isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 1 && $ldapConnection == true && $data['disabled'] == 0 && $username != "admin" || isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 2 && $ldapConnection == true && $data['disabled'] == 0 && $username != "admin" || isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 1 && $username == "admin" && $userPasswordVerified == true && $data['disabled'] == 0) { $_SESSION['autoriser'] = true; // Generate a ramdom ID $key = $pwdlib->getRandomToken(50); if ($debugDuo == 1) { fputs($dbgDuo, "User's token: " . $key . "\n"); } // Log into DB the user's connection if (isset($_SESSION['settings']['log_connections']) && $_SESSION['settings']['log_connections'] == 1) { logEvents('user_connection', 'connection', $data['id']); } // Save account in SESSION $_SESSION['login'] = stripslashes($username); $_SESSION['name'] = stripslashes($data['name']); $_SESSION['lastname'] = stripslashes($data['lastname']); $_SESSION['user_id'] = $data['id']; $_SESSION['user_admin'] = $data['admin']; $_SESSION['user_manager'] = $data['gestionnaire']; $_SESSION['user_read_only'] = $data['read_only']; $_SESSION['last_pw_change'] = $data['last_pw_change']; $_SESSION['last_pw'] = $data['last_pw']; $_SESSION['can_create_root_folder'] = $data['can_create_root_folder']; $_SESSION['key'] = $key; $_SESSION['personal_folder'] = $data['personal_folder']; $_SESSION['user_language'] = $data['user_language']; $_SESSION['user_email'] = $data['email']; $_SESSION['user_ga'] = $data['ga']; $_SESSION['user_avatar'] = $data['avatar']; $_SESSION['user_avatar_thumb'] = $data['avatar_thumb']; $_SESSION['user_upgrade_needed'] = $data['upgrade_needed']; // manage session expiration $serverTime = time(); if ($dataReceived['TimezoneOffset'] > 0) { $userTime = $serverTime + $dataReceived['TimezoneOffset']; } else { $userTime = $serverTime; } $_SESSION['fin_session'] = $userTime + $dataReceived['duree_session'] * 60; /* If this option is set user password MD5 is used as personal SALTKey */ if (isset($_SESSION['settings']['use_md5_password_as_salt']) && $_SESSION['settings']['use_md5_password_as_salt'] == 1) { $_SESSION['my_sk'] = md5($passwordClear); setcookie("TeamPass_PFSK_" . md5($_SESSION['user_id']), encrypt($_SESSION['my_sk'], ""), time() + 60 * 60 * 24 * $_SESSION['settings']['personal_saltkey_cookie_duration'], '/'); } @syslog(LOG_WARNING, "User logged in - " . $_SESSION['user_id'] . " - " . date("Y/m/d H:i:s") . " {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})"); if (empty($data['last_connexion'])) { $_SESSION['derniere_connexion'] = time(); } else { $_SESSION['derniere_connexion'] = $data['last_connexion']; } if (!empty($data['latest_items'])) { $_SESSION['latest_items'] = explode(';', $data['latest_items']); } else { $_SESSION['latest_items'] = array(); } if (!empty($data['favourites'])) { $_SESSION['favourites'] = explode(';', $data['favourites']); } else { $_SESSION['favourites'] = array(); } if (!empty($data['groupes_visibles'])) { $_SESSION['groupes_visibles'] = @implode(';', $data['groupes_visibles']); } else { $_SESSION['groupes_visibles'] = array(); } if (!empty($data['groupes_interdits'])) { $_SESSION['groupes_interdits'] = @implode(';', $data['groupes_interdits']); } else { $_SESSION['groupes_interdits'] = array(); } // User's roles $_SESSION['fonction_id'] = $data['fonction_id']; $_SESSION['user_roles'] = explode(";", $data['fonction_id']); // build array of roles $_SESSION['user_pw_complexity'] = 0; $_SESSION['arr_roles'] = array(); foreach (array_filter(explode(';', $_SESSION['fonction_id'])) as $role) { $resRoles = DB::queryFirstRow("SELECT title, complexity FROM " . prefix_table("roles_title") . " WHERE id=%i", $role); $_SESSION['arr_roles'][$role] = array('id' => $role, 'title' => $resRoles['title']); // get highest complexity if ($_SESSION['user_pw_complexity'] < $resRoles['complexity']) { $_SESSION['user_pw_complexity'] = $resRoles['complexity']; } } // build complete array of roles $_SESSION['arr_roles_full'] = array(); $rows = DB::query("SELECT id, title FROM " . prefix_table("roles_title") . " ORDER BY title ASC"); foreach ($rows as $record) { $_SESSION['arr_roles_full'][$record['id']] = array('id' => $record['id'], 'title' => $record['title']); } // Set some settings $_SESSION['user']['find_cookie'] = false; $_SESSION['settings']['update_needed'] = ""; // Update table DB::update(prefix_table('users'), array('key_tempo' => $_SESSION['key'], 'last_connexion' => time(), 'timestamp' => time(), 'disabled' => 0, 'no_bad_attempts' => 0, 'session_end' => $_SESSION['fin_session'], 'psk' => $pwdlib->createPasswordHash(htmlspecialchars_decode($psk))), "id=%i", $data['id']); if ($debugDuo == 1) { fputs($dbgDuo, "Preparing to identify the user rights\n"); } // Get user's rights identifyUserRights($data['groupes_visibles'], $_SESSION['groupes_interdits'], $data['admin'], $data['fonction_id'], false); // Get some more elements $_SESSION['screenHeight'] = $dataReceived['screenHeight']; // Get last seen items $_SESSION['latest_items_tab'][] = ""; foreach ($_SESSION['latest_items'] as $item) { if (!empty($item)) { $data = DB::queryFirstRow("SELECT id,label,id_tree FROM " . prefix_table("items") . " WHERE id=%i", $item); $_SESSION['latest_items_tab'][$item] = array('id' => $item, 'label' => $data['label'], 'url' => 'index.php?page=items&group=' . $data['id_tree'] . '&id=' . $item); } } // send back the random key $return = $dataReceived['randomstring']; // Send email if (isset($_SESSION['settings']['enable_send_email_on_user_login']) && $_SESSION['settings']['enable_send_email_on_user_login'] == 1 && $_SESSION['user_admin'] != 1) { // get all Admin users $receivers = ""; $rows = DB::query("SELECT email FROM " . prefix_table("users") . " WHERE admin = %i", 1); foreach ($rows as $record) { if (empty($receivers)) { $receivers = $record['email']; } else { $receivers = "," . $record['email']; } } // Add email to table DB::insert(prefix_table("emails"), array('timestamp' => time(), 'subject' => $LANG['email_subject_on_user_login'], 'body' => str_replace(array('#tp_user#', '#tp_date#', '#tp_time#'), array(" " . $_SESSION['login'], date($_SESSION['settings']['date_format'], $_SESSION['derniere_connexion']), date($_SESSION['settings']['time_format'], $_SESSION['derniere_connexion'])), $LANG['email_body_on_user_login']), 'receivers' => $receivers, 'status' => "not sent")); } } elseif ($data['disabled'] == 1) { // User and password is okay but account is locked $return = "user_is_locked"; } else { // User exists in the DB but Password is false // check if user is locked $userIsLocked = 0; $nbAttempts = intval($data['no_bad_attempts'] + 1); if ($_SESSION['settings']['nb_bad_authentication'] > 0 && intval($_SESSION['settings']['nb_bad_authentication']) < $nbAttempts) { $userIsLocked = 1; // log it if (isset($_SESSION['settings']['log_connections']) && $_SESSION['settings']['log_connections'] == 1) { logEvents('user_locked', 'connection', $data['id']); } } DB::update(prefix_table('users'), array('key_tempo' => $_SESSION['key'], 'last_connexion' => time(), 'disabled' => $userIsLocked, 'no_bad_attempts' => $nbAttempts), "id=%i", $data['id']); // What return shoulb we do if ($userIsLocked == 1) { $return = "user_is_locked"; } elseif ($_SESSION['settings']['nb_bad_authentication'] == 0) { $return = "false"; } else { $return = $nbAttempts; } } } else { $return = "false"; } if ($debugDuo == 1) { fputs($dbgDuo, "\n\n----\n" . "Identified : " . $return . "\n"); } echo '[{"value" : "' . $return . '", "user_admin":"', isset($_SESSION['user_admin']) ? $_SESSION['user_admin'] : "", '", "initial_url" : "' . @$_SESSION['initial_url'] . '", "error" : "' . $logError . '"}]'; $_SESSION['initial_url'] = ""; if ($_SESSION['settings']['cpassman_dir'] == "..") { $_SESSION['settings']['cpassman_dir'] = "."; } }
DB::$host = $server; DB::$user = $user; DB::$password = $pass; DB::$dbName = $database; DB::$port = $port; DB::$encoding = $encoding; DB::$error_handler = 'db_error_handler'; $link = mysqli_connect($server, $user, $pass, $database, $port); $link->set_charset($encoding); //Load Tree $tree = new SplClassLoader('Tree\\NestedTree', '../includes/libraries'); $tree->register(); $tree = new Tree\NestedTree\NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title'); //Load AES $aes = new SplClassLoader('Encryption\\Crypt', '../includes/libraries'); $aes->register(); if (!empty($_POST['type'])) { switch ($_POST['type']) { case "groupes_visibles": case "groupes_interdits": $val = explode(';', $_POST['valeur']); $valeur = $_POST['valeur']; // Check if id folder is already stored $data = DB::queryfirstrow("SELECT " . $_POST['type'] . " FROM " . prefix_table("users") . " WHERE id = %i", $val[0]); $new_groupes = $data[$_POST['type']]; if (!empty($data[$_POST['type']])) { $groupes = explode(';', $data[$_POST['type']]); if (in_array($val[1], $groupes)) { $new_groupes = str_replace($val[1], "", $new_groupes); } else { $new_groupes .= ";" . $val[1];
<?php include_once "autoloader.php"; $autoload = new SplClassLoader(); $autoload->register(); /* * TMP PART * FOR FRAMEWORK DEV */ $tests = new \Test\Test(); $tests->call(0);
* * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package phpBB * @author Nils Adermann <*****@*****.**> * @copyright 2010 phpBB Ltd. * @license http://www.gnu.org/licenses/gpl.txt * GNU General Public License * @version Release: @package_version@ */ // set up include path set_include_path(__DIR__ . '/lib/' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR); if (!defined('PHP_EXT')) { define('PHP_EXT', strrchr(__FILE__, '.')); } require 'SplClassLoader' . PHP_EXT; // phpBB's autoloader $phpBBClassLoader = new SplClassLoader('phpBB'); $phpBBClassLoader->setFileExtension(PHP_EXT); $phpBBClassLoader->register(); // symfony autoloader $symfonyClassLoader = new SplClassLoader('Symfony', 'symfony/src/'); $symfonyClassLoader->setFileExtension(PHP_EXT); $symfonyClassLoader->register();
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ session_start(); global $k, $settings; header("Content-type: text/html; charset=utf-8"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php error_reporting(E_ERROR); include '../includes/include.php'; include '../includes/settings.php'; //Class loader require_once '../sources/SplClassLoader.php'; if (empty($_SESSION['key'])) { $pwgen = new SplClassLoader('Encryption\\PwGen', '../includes/libraries'); $pwgen->register(); $pwgen = new Encryption\PwGen\pwgen(); $pwgen->setLength(20); $pwgen->setSecure(true); $pwgen->setSymbols(true); $pwgen->setCapitalize(true); $pwgen->setNumerals(true); $_SESSION['key'] = $pwgen->generate(); } $_SESSION['prefix_length'] = "15"; // connect to the server require_once '../includes/libraries/Database/Meekrodb/db.class.php'; DB::$host = $server; DB::$user = $user; DB::$password = $pass; DB::$dbName = $database;
<?php const DEFAULT_APP = 'Frontend'; // Si l'application n'est pas valide, on va charger l'application par défaut qui se chargera de générer une erreur 404 if (!isset($_GET['app']) || !file_exists(__DIR__ . '/../App/' . $_GET['app'])) { $_GET['app'] = DEFAULT_APP; } // On commence par inclure la classe nous permettant d'enregistrer nos autoload require __DIR__ . '/../lib/OCFram/SplClassLoader.php'; // On va ensuite enregistrer les autoloads correspondant à chaque vendor (OCFram, App, Model, etc.) $OCFramLoader = new SplClassLoader('OCFram', __DIR__ . '/../lib'); $OCFramLoader->register(); $appLoader = new SplClassLoader('App', __DIR__ . '/..'); $appLoader->register(); $modelLoader = new SplClassLoader('Model', __DIR__ . '/../lib/vendors'); $modelLoader->register(); $entityLoader = new SplClassLoader('Entity', __DIR__ . '/../lib/vendors'); $entityLoader->register(); $formBuilderLoader = new SplClassLoader('FormBuilder', __DIR__ . '/../lib/vendors'); $formBuilderLoader->register(); // Il ne nous suffit plus qu'à déduire le nom de la classe et de l'instancier $appClass = 'App\\' . $_GET['app'] . '\\' . $_GET['app'] . 'Application'; $app = new $appClass(); $app->run();