<?php include 'configuration/index.shell.php'; require 'Users.php'; require 'NetworkAPI.php'; if (!empty($argc) && strstr($argv[0], basename(__FILE__)) and isset($argv[1])) { $filename = $argv[1]; $network_api = new NetworkAPI(); $network_api->setConfig($config->aes_key, $config->aes_iv, $config->signature_salt); if (isset($argv[2])) { $network_api->isDebuggingMode($argv[2] == "true"); } include "unittest/{$filename}.php"; }
require 'facebook-php-sdk-master/src/facebook.php'; $dict = new Zend_Config_Ini(APP_ROOT . APP_FOLDER . CONFIG_FOLDER . 'dictionary.ini', 'th'); // Load dictionary.ini from root. Zend_Registry::set('dict', $dict); $config = new Zend_Config_Ini(APP_ROOT . APP_FOLDER . CONFIG_FOLDER . 'config.ini', 'production'); // Load config.ini from root. Zend_Registry::set('config', $config); $config->display_compile_error == 1 ? error_reporting(E_ALL) : error_reporting(0); //date_default_timezone_set($config->timezone); ini_set('display_startup_errors', $config->display_runtime_error); ini_set('display_errors', $config->display_runtime_error); // Initial Objects //////////////////////////////////////////////////////////////////////////////////////////////////////// require 'GameManager.php'; require 'Utils.php'; require 'NetworkAPI.php'; $network_api = new NetworkAPI(); $network_api->setConfig($config->aes_key, $config->aes_iv, $config->signature_salt); Zend_Registry::set('network_api', $network_api); $utils = new Utils(); $facebook = new Facebook(array('appId' => $config->facebook_app_id, 'secret' => $config->facebook_app_secret)); Zend_Registry::set('facebook', $facebook); // MEMCACHE SETUP ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Setup memcache if enabled. //if ($config->memcahce_enable == 'yes') { require 'Zend/Cache.php'; $frontendOptions = array('lifetime' => $config->memcache->frontend->lifetime->days, 'automatic_serialization' => true); $backendOptions = array('servers' => array(array('host' => $config->memcache->servers->ip, 'port' => $config->memcache->servers->port, 'persistent' => true)), 'compression' => false); try { $cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions, $backendOptions); Zend_Registry::set('cache', $cache); $cache_hour = Zend_Cache::factory('Core', 'Memcached', array('lifetime' => $config->memcache->frontend->lifetime->hours, 'automatic_serialization' => true), $backendOptions);