register(new Silex\Provider\SwiftmailerServiceProvider()); // Register Swiftmailer // $nexmo = new Nexmo\Client(new Nexmo\Client\Credentials\Basic("3c2aaf82", "4bc9f145f63e7cca")); $menu_array = array(); // CSRF AND ESCAPE ANY POST REQUEST $protectPostsData = function (Request $request) use($app, $csrf) { switch ($request->getMethod()) { case 'POST': // Escape Any POST DATA // foreach ($_POST as $key => $val) { // $_POST[$key] = $app->escape($_POST[$key]); // } // CSRF IT // $token = base64_decode($request->get('token')); // CSRF It ! // if (!$csrf->validateSignature($token)) { // return new Response("TOKEN WRONG!!", 403); // exit; // } } }; $protectPostsRender = function (Request $request) use($app, $csrf) { switch ($request->getMethod()) { case 'GET': /* Generate CSRF Token And Field */ // $token = base64_encode($csrf->getSignature()); // echo ""; } }; // $app->before($protectPostsData); // $app->after($protectPostsRender); include 'mailsetting.php'; // Call the Login function , Mailer Function and make a conditional include_once 'func.class/mailer.func.php'; include_once 'func.class/login.func.php'; if (is_login()) { // Call necessary files; include_once 'func.class/newuser.func.php'; include_once 'func.class/modular.func.php'; // <-- Controller Module include_once 'func.class/pagination.func.php'; // <-- Pagination Class $app->get('/', function() use($app) { return $app->redirect('/dashboard'); }); if ($_SESSION["role"] == "1") { $hooks->do_action('all_menu'); $hooks->do_action('silex_action'); } else { $hooks->do_action('admin_menu'); $hooks->do_action('silex_action'); $hooks->do_action('admin_action'); } $_SESSION["company_id"] = getCompany($_SESSION['user_id']); $_SESSION["branch_id"] = getBranch($_SESSION['user_id']); } $app['debug'] = true; // Include the Mail Configurator $app->run(); }