示例#1
0
 /**
  * Prohibit creating an object from outside
  */
 public function __construct()
 {
     phpFastCache::setup("storage", "files");
     phpFastCache::setup("path", FRONTEND_PATH . "../" . self::PATH);
     phpFastCache::setup("securityKey", "cache");
     self::$cache = new phpFastCache();
 }
示例#2
0
 protected function setCache(Container $di, $cacheConfig, $basePath)
 {
     foreach ($cacheConfig as $key => $value) {
         \phpFastCache::setup($key, $value);
     }
     \phpFastCache::setup("path", $basePath . "/var/cache");
     $di->set("cache", $di->lazyNew('phpFastCache'));
 }
示例#3
0
 /**
  * Constructor
  */
 function __construct($prefix = 'index.php?')
 {
     global $base_dir, $_SERVER;
     phpFastCache::setup('storage', 'files');
     phpFastCache::setup('path', $base_dir);
     phpFastCache::setup('securityKey', 'cache');
     $this->cache = phpFastCache();
     $this->id = $_SERVER['QUERY_STRING'];
     if ($this->id == '') {
         $this->id = 'mod=home';
     }
     $this->id = $this->prefix . $this->id;
 }
 public function result()
 {
     if ($this->on_cache == true) {
         require $this->path . '/phpfastcache/phpfastcache.php';
         phpFastCache::setup("storage", "auto");
         phpFastCache::setup('path', $this->path . '/phpfastcache/cache/');
         $cache = phpFastCache();
         $this->data = $cache->get($this->key_cache);
         if ($this->data == null) {
             $this->data = $this->get_direct();
             $cache->set($this->key_cache, $this->data, 86400);
         }
     } else {
         $this->data = $this->get_direct();
     }
     return $this->data;
 }
示例#5
0
require_once 'vendor/autoload.php';
defined('BASE_DIR') || define('BASE_DIR', __DIR__);
defined('APP_DIR') || define('APP_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'app');
defined('RESOURCES_DIR') || define('RESOURCES_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'resources');
defined('HTML_RESOURCES_DIR') || define('HTML_RESOURCES_DIR', RESOURCES_DIR . DIRECTORY_SEPARATOR . 'html');
defined('SERVICES_DIR') || define('SERVICES_DIR', APP_DIR . DIRECTORY_SEPARATOR . 'services');
defined('CONFIG_DIR') || define('CONFIG_DIR', APP_DIR . DIRECTORY_SEPARATOR . 'config');
use Pimple\Container;
$container = new Container();
$container['config'] = function ($c) {
    $configValues = (require_once CONFIG_DIR . DIRECTORY_SEPARATOR . 'main.php');
    return new App\Services\DotNotation($configValues);
};
$container['cache'] = function ($c) {
    // TODO: Swap out and Use a cache which supports cache namespaces
    $cacheConfig = $c['config']->get('components.cache');
    phpFastCache::setup("storage", $cacheConfig['storage']);
    phpFastCache::setup("path", $cacheConfig['path']);
    return phpFastCache();
};
$container['weatherService'] = function ($c) {
    return new App\Services\YahooWeather();
};
$container['cityWeatherParser'] = function ($c) {
    return new App\Services\CityWeatherParser();
};
$container['httpClient'] = function ($c) {
    return new GuzzleHttp\Client();
};
\App\Services\ServiceLocator::setContainer($container);
示例#6
0
 public function cache($folder = 'design')
 {
     require_once ROOT . DS . 'includes' . DS . 'libraries' . DS . 'phpfastcache.php';
     phpFastCache::setup("storage", "files");
     phpFastCache::setup("path", ROOT . DS . 'cache');
     phpFastCache::setup("securityKey", $folder);
     $cache = phpFastCache();
     return $cache;
 }
示例#7
0
 /**
  * Constructor of the class.
  * setting the cache-object to its default value
  *
  */
 private function __construct()
 {
     $config = (include CORE_PATH . 'classes' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'phpfastcache' . EXT);
     phpFastCache::setup($config);
     $this->o_cache = phpFastCache();
 }
示例#8
0
<?php

//if(!defined('IN_TRACKER'))
//    die('Hacking attempt!');
require_once "cache/phpfastcache.php";
phpFastCache::setup("bonho", "auto");
$Cache = phpFastCache();
function get_global_sp_state()
{
    global $Cache;
    static $global_promotion_state;
    if (!$global_promotion_state) {
        if (!($global_promotion_state = $Cache->get_value('global_promotion_state'))) {
            $res = mysql_query("SELECT * FROM torrents_state");
            $row = mysql_fetch_assoc($res);
            $global_promotion_state = $row["global_sp_state"];
            $Cache->cache_value('global_promotion_state', $global_promotion_state, 57226);
        }
    }
    return $global_promotion_state;
}
// IP Validation
function validip($ip)
{
    if (!ip2long($ip)) {
        //IPv6
        return true;
    }
    if (!empty($ip) && $ip == long2ip(ip2long($ip))) {
        // reserved IANA IPv4 addresses
        // http://www.iana.org/assignments/ipv4-address-space
示例#9
0
<?php

include 'config.php';
require "vendor/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
phpFastCache::setup("path", dirname(__FILE__) . '/cache');
// Path For Files
//User Whitelist Check
if (!in_array($username, $user_whitelist)) {
    echo "Clever girl... But you're not on the list. <a href='http://goo.gl/forms/0wgJeVpIaI'>Request Access</a>";
    exit;
}
// Set Caching
$cache = phpFastCache();
// Try to get $content from Caching First
// product_page is "identity keyword";
$link = $cache->get($username);
if ($link == null) {
    $connection = new TwitterOAuth(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
    $content = $connection->get(API_KIND, array("screen_name" => $username, "count" => intval(POSTS_COUNT)));
    if (empty($content->errors)) {
        //All is dandy
        foreach ($content as $tweet_object) {
            $urls = $tweet_object->entities->urls;
            //Get URLS
            foreach ($urls as $url) {
                //$debug = $url->expanded_url;
                if (strpos($url->display_url, 'periscope.tv') !== false) {
                    //Find periscope link
                    $link = $url->expanded_url;
                }
示例#10
0
function cometchatMemcacheConnect()
{
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "cometchat_cache.php";
    global $memcache;
    if (MEMCACHE != 0 && MC_NAME == 'memcachier') {
        $memcache = new MemcacheSASL();
        $memcache->addServer(MC_SERVER, MC_PORT);
        $memcache->setSaslAuthData(MC_USERNAME, MC_PASSWORD);
    } elseif (MEMCACHE != 0) {
        phpFastCache::setup("path", dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cache');
        phpFastCache::setup("storage", MC_NAME);
        $memcache = phpFastCache();
    }
}
示例#11
0
        $NameBD = $cmd->parametro->get("NameBD");
    }
    $bool = mysql_select_db($NameBD, $connect);
    $q = mysql_query('select * from bsw_bi.bi_server where dbName="' . $NameBD . '"');
    if (mysql_num_rows($q) == 1) {
        $_SESSION['id_server'] = mysql_result($q, 0);
    } else {
        die($LANG_ERROR_BI);
    }
} catch (Exception $e) {
    print $LANG_ERROR_CONNECT . " {$database}";
}
include_once "fast/phpfastcache/phpfastcache.php";
phpFastCache::setup("storage", "auto");
if (php_uname("s") == "Darwin") {
    phpFastCache::setup("path", '/private/var/tmp');
}
// Path For Files includes/work must be in 777
function readDashboardSections()
{
    $q = 'select distinct dashboard
	from bi_dashboard,bm_items_groups
	where bi_dashboard.id_item=bm_items_groups.id_item and
		  bm_items_groups.groupid=' . $_SESSION['groupid'] . '
	order by displayorder';
    $q1 = mysql_query($q);
    while ($r = mysql_fetch_array($q1, MYSQL_ASSOC)) {
        $data[] = array('dashboard' => $r['dashboard']);
    }
    return $data;
}
 public static function init()
 {
     $fastCacheConfig = array("storage" => "files", "path" => $_SERVER['DOCUMENT_ROOT'] . "/../db/cache", "securityKey" => "auto", "default_chmod" => 0777, "htaccess" => TRUE);
     \phpFastCache::setup($fastCacheConfig);
     self::$cache = new \phpFastCache();
 }
示例#13
0
 /**
  * Prohibit creating an object from outside
  */
 public function __construct()
 {
     phpFastCache::setup("storage", "files");
     self::$cache = new phpFastCache();
 }
示例#14
0
文件: RxCache.php 项目: rudraks/boot
function setUpPHPFastCache()
{
    include_once RUDRA . "/phpfastcache/phpfastcache.php";
    \phpFastCache::setup("path", "./build");
}
示例#15
0
<?php

$_SESSION['id_server'] = 100;
include_once "fast/phpfastcache/phpfastcache.php";
phpFastCache::setup("storage", "files");
phpFastCache::setup("path", "/tmp");
$cache = phpFastCache();
//$cache->clean();
$key = "100";
$obj = $cache->get($key);
if ($obj == null) {
    echo "nulo";
    $cache->set($key, array('clock' => 0, 'value' => 0, 'valid' => 0, 't' => ''), 60);
} else {
    echo "desde cache";
    var_dump($obj);
}
?>

  
示例#16
0
function updatecaching()
{
    global $ts;
    $conn = 1;
    $errorCode = 0;
    $memcacheAuth = 0;
    include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "cometchat_cache.php";
    if ($_POST['MC_NAME'] == 'memcachier') {
        $memcacheAuth = 1;
        $conn = 0;
        $memcache = new MemcacheSASL();
        $memcache->addServer($_POST['MC_SERVER'], $_POST['MC_PORT']);
        if ($memcachierAuth = $memcache->setSaslAuthData($_POST['MC_USERNAME'], $_POST['MC_PASSWORD'])) {
            $memcache->set('auth', 'ok');
            if (!($conn = $memcache->get('auth'))) {
                $errorCode = 3;
            }
            $memcache->delete('auth');
        } else {
            $errorCode = 3;
        }
    } elseif ($_POST['MC_NAME'] != '') {
        $conn = 0;
        $memcacheAuth = 1;
        phpFastCache::setup("storage", $_POST['MC_NAME']);
        $memcache = new phpFastCache();
        $driverPresent = isset($memcache->driver->option['availability']) ? 0 : 1;
        if ($driverPresent) {
            if ($_POST['MC_NAME'] == 'memcache' && class_exists("Memcache") || $_POST['MC_NAME'] == 'memcached' && class_exists("Memcached")) {
                if ($_POST['MC_NAME'] == 'memcache') {
                    $server = array(array($_POST['MC_SERVER'], $_POST['MC_PORT'], 1));
                    $memcache->option('server', $server);
                }
                if ($_POST['MC_NAME'] == 'memcached') {
                    $server = array(array($_POST['MC_SERVER'], $_POST['MC_PORT'], 1));
                    $memcache->option('server', $server);
                }
                $memcache->set('auth', 'ok', 30);
                if (!($conn = $memcache->get('auth'))) {
                    $errorCode = 1;
                }
                $memcache->delete('auth');
            }
        }
    }
    if (!$errorCode) {
        configeditor($_POST);
        $_SESSION['cometchat']['error'] = 'Caching details updated successfully.';
    } else {
        if ($_POST['MC_NAME'] == 'memcachier') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memchachier server details';
        } elseif ($_POST['MC_NAME'] == 'files') {
            $_SESSION['cometchat']['error'] = 'Please check file permission of your cache directory. Please try 755/777/644';
        } elseif ($_POST['MC_NAME'] == 'apc') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your APC configuration.';
        } elseif ($_POST['MC_NAME'] == 'wincache') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Wincache configuration.';
        } elseif ($_POST['MC_NAME'] == 'sqlite') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your SQLite configuration.';
        } elseif ($_POST['MC_NAME'] == 'memcached') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memcached configuration.';
        } else {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memcache server configuration.';
        }
    }
    header("Location:?module=settings&action=caching&ts={$ts}");
}
示例#17
0
 public function __construct()
 {
     global $container;
     $container = new Container();
     $container['session'] = function ($container) {
         $session = new Session();
         if (session_id() == '') {
             $session->start();
         }
         return $session;
     };
     $container['request'] = function ($container) {
         $request = Request::createFromGlobals();
         return $request;
     };
     $container['config'] = function ($container) {
         $config = new ConfigHelper();
         return $config->objInstance;
     };
     $container['translator'] = function ($container) {
         $request = $container['request'];
         $translator = new TranslateHelper($request);
         return $translator->objInstance;
     };
     $container['cacheType'] = $container['config']["fastChatType"];
     $container['fastcache'] = function ($container) {
         phpFastCache::setup("storage", $container['cacheType']);
         phpFastCache::setup("path", BASE_ROOT . "/cache/fastcache/");
         $cache = phpFastCache();
         return $cache;
     };
     $container['twig'] = function ($container) {
         $config = $container['config'];
         $translator = $container['translator'];
         $arrayOfFileSystem = [BASE_ROOT . '/pages/Admin/templates/modules', BASE_ROOT . '/pages/Admin/templates/emails', BASE_ROOT . '/pages/Admin/modules/GererItemShop/templates', BASE_ROOT . '/pages/Admin/modules/GererEquipeJeu/templates', BASE_ROOT . '/pages/Admin/modules/GererEquipeSite/templates', BASE_ROOT . '/pages/Admin/modules/Parametres/templates', BASE_ROOT . '/pages/ItemShop/modules/Hipay/templates', BASE_ROOT . '/pages/ItemShop/modules/Starpass/templates', BASE_ROOT . '/pages/Classements/templates/', BASE_ROOT . '/pages/Inscription/templates/modules', BASE_ROOT . '/pages/Inscription/templates/emails', BASE_ROOT . '/pages/ItemShop/templates/modules', BASE_ROOT . '/pages/ItemShop/templates/emails', BASE_ROOT . '/pages/Messagerie/templates/modules', BASE_ROOT . '/pages/Messagerie/templates/emails', BASE_ROOT . '/pages/Marche/templates/modules', BASE_ROOT . '/pages/Marche/templates/emails', BASE_ROOT . '/pages/MonCompte/templates/modules', BASE_ROOT . '/pages/MonCompte/templates/emails', BASE_ROOT . '/pages/MonPersonnage/templates/modules', BASE_ROOT . '/pages/MonPersonnage/templates/emails', BASE_ROOT . '/pages/Statistiques/templates/modules', BASE_ROOT . '/pages/Votes/templates/', BASE_ROOT . '/pages/_LegacyPages/templates/', BASE_ROOT . '/pages/_Home/templates/modules/', BASE_ROOT . '/core/templates/'];
         if ($config["twigCache"]) {
             $urlCache = BASE_ROOT . $config["twigCacheUrl"];
         } else {
             $urlCache = false;
         }
         $loader = new Twig_Loader_Filesystem($arrayOfFileSystem);
         $twig = new Twig_Environment($loader, array('cache' => $urlCache));
         $twig->addExtension(new Twig_Extensions_Extension_Text());
         $twig->addExtension(new StringFunctionExtension());
         $twig->addExtension(new FonctionsUtilesExtension());
         $twig->addExtension(new HelperExtension());
         $twig->addExtension(new ImageFunctionExtension());
         $twig->addExtension(new DateFunctionExtension());
         $twig->addExtension(new Twig_Extension_Debug());
         $twig->addExtension(new EncryptExtension());
         include BASE_ROOT . '/pages/Tableaux_Arrays.php';
         $twig->addExtension(new \Symfony\Bridge\Twig\Extension\TranslationExtension($translator));
         $twig->addGlobal('session', $container['session']);
         $twig->addGlobal('request', $container['request']);
         $twig->addGlobal('config', $container['config']);
         $twig->addGlobal('urlBase', BASE_ROOT);
         return $twig;
     };
     $container['doctrine.eventManager'] = function ($container) {
         $eventManager = new \Doctrine\Common\EventManager();
         return $eventManager;
     };
     $container['doctrine.connection.default'] = function ($container) {
         $param = $container['config'];
         $config = new \Doctrine\DBAL\Configuration();
         // build connection parameters
         $connectionParameters = array('dbname' => "site", 'user' => $param["bdd"]["user"], 'password' => $param["bdd"]["password"], 'host' => $param["bdd"]["host"], 'port' => $param["bdd"]["port"]);
         switch (strtolower($param["bdd"]["driver"])) {
             case 'mysql':
                 $connectionParameters['driver'] = 'pdo_mysql';
                 $connectionParameters['charset'] = strtolower($param["bdd"]["charset"]);
                 break;
             default:
                 throw new RuntimeException('Database driver ' . $param["bdd"]["driver"] . ' not known by doctrine.');
         }
         /* if (!empty($GLOBALS['TL_CONFIG']['dbPdoDriverOptions'])) {
            $connectionParameters['driverOptions'] = deserialize($GLOBALS['TL_CONFIG']['dbPdoDriverOptions'], true);
            } */
         $connectionParameters['defaultTableOptions'] = array('collate' => 'utf8_general_ci');
         /** @var \Doctrine\Common\EventManager $eventManager */
         $eventManager = $container['doctrine.eventManager'];
         // establish connection
         $connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParameters, $config, $eventManager);
         $connection->getConfiguration()->setSQLLogger(null);
         // fix platform differences
         $platform = $connection->getDatabasePlatform();
         $platform->registerDoctrineTypeMapping('bit', 'boolean');
         return $connection;
     };
     $container['doctrine.orm.entitiesCacheDir'] = function ($container) {
         $entitiesCacheDir = BASE_ROOT . '/cache/doctrine/entities';
         if (!is_dir($entitiesCacheDir)) {
             mkdir($entitiesCacheDir, 0777, true);
         }
         $classLoader = new \Composer\Autoload\ClassLoader();
         $classLoader->add('', array($entitiesCacheDir), true);
         $classLoader->register(true);
         $container['doctrine.orm.entitiesClassLoader'] = $classLoader;
         return $entitiesCacheDir;
     };
     $container['doctrine.orm.proxiesCacheDir'] = function ($container) {
         $proxiesCacheDir = BASE_ROOT . '/cache/doctrine/proxies';
         if (!is_dir($proxiesCacheDir)) {
             mkdir($proxiesCacheDir, 0777, true);
         }
         return $proxiesCacheDir;
     };
     $container['doctrine.orm.repositoriesCacheDir'] = function ($container) {
         $repositoriesCacheDir = BASE_ROOT . '/cache/doctrine/repositories';
         if (!is_dir($repositoriesCacheDir)) {
             mkdir($repositoriesCacheDir, 0777, true);
         }
         return $repositoriesCacheDir;
     };
     $container['doctrine.orm.entityManager'] = function ($container) {
         $param = $container['config'];
         $paths = array(BASE_ROOT . '/core/library/Account/Entity', BASE_ROOT . '/core/library/Player/Entity');
         $isDevMode = false;
         $config = \Doctrine\ORM\Tools\Setup::createConfiguration($isDevMode);
         // Configuration
         $config = new Doctrine\ORM\Configuration();
         $config->addCustomStringFunction('PASSWORD', '\\DoctrinePasswordExtension');
         $config->addCustomStringFunction('RAND', '\\DoctrineRandExtension');
         $config->addCustomStringFunction('WEEK', '\\DoctrineExtensions\\Query\\Mysql\\WEEK');
         $config->addCustomStringFunction('MONTH', '\\DoctrineExtensions\\Query\\Mysql\\MONTH');
         $config->addCustomStringFunction('YEAR', '\\DoctrineExtensions\\Query\\Mysql\\YEAR');
         $config->addCustomStringFunction('IFELSE', '\\DoctrineExtensions\\Query\\Mysql\\IfElse');
         // Proxy Configuration
         $proxiesCacheDir = $container['doctrine.orm.proxiesCacheDir'];
         $config->setProxyDir($proxiesCacheDir);
         $config->setProxyNamespace('entities\\proxies');
         switch ($param["bdd"]["cache"]) {
             case 'apc':
                 $cache = new \Doctrine\Common\Cache\ApcCache();
                 break;
             case 'array':
                 $cache = new \Doctrine\Common\Cache\ArrayCache();
                 break;
             case false:
                 $cache = false;
                 break;
         }
         if (!$cache) {
             // Mapping Configuration
             $entitiesCacheDir = $container['doctrine.orm.entitiesCacheDir'];
             $reader = new \Doctrine\Common\Annotations\FileCacheReader(new \Doctrine\Common\Annotations\AnnotationReader(), $entitiesCacheDir, $debug = false);
         } else {
             $reader = new \Doctrine\Common\Annotations\CachedReader(new \Doctrine\Common\Annotations\AnnotationReader(), $cache, $debug = false);
         }
         $driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, $paths);
         //$driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(new \Doctrine\Common\Annotations\AnnotationReader(), $paths);
         // registering noop annotation autoloader - allow all annotations by default
         \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');
         $config->setMetadataDriverImpl($driverImpl);
         // Caching Configuration
         $cache = new \Doctrine\Common\Cache\ArrayCache();
         $config->setMetadataCacheImpl($cache);
         $config->setQueryCacheImpl($cache);
         //$config->setAutoGenerateProxyClasses(false);
         /** @var $connection \Doctrine\DBAL\Connection */
         $connection = $container['doctrine.connection.default'];
         /** @var $eventManager \Doctrine\Common\EventManager */
         $eventManager = $container['doctrine.eventManager'];
         /** @var $entityManager \Doctrine\ORM\EntityManager */
         $entityManager = \Doctrine\ORM\EntityManager::create($connection, $config, $eventManager);
         return $entityManager;
     };
     $this->container = $container;
 }
示例#18
0
 public static function loadDataArray($keys)
 {
     if (!self::$enabled) {
         return null;
     }
     if (self::$cache === null) {
         phpFastCache::setup(phpFastCache::$config);
         self::$cache = phpFastCache();
     }
     ///Logger::Log('load: '.implode(':',$keys), LogLevel::DEBUG, false, dirname(__FILE__) . '/../calls.log');
     return self::$cache->getMulti($keys);
 }
 public function __construct()
 {
     //Construct Padre
     parent::__construct();
     //Instancia del core de CI
     self::$ci =& get_instance();
     /*
      * Cargar el id del modulo actual
      */
     self::$id_modulo = $this->id_modulo();
     /*
      * Cargar el uuid del usuario que esta loguiado.
      */
     self::$uuid_usuario = $this->uuid_usuario();
     /*
      * Cargar el id categoria a la que pertenece el
      * usuario que esta loguiado.
      */
     self::$id_categoria_usuario = $this->categoria_usuario("id_categoria");
     /*
      * Cargar el uuid categoria a la que pertenece el
      * usuario que esta loguiado.
      */
     self::$uuid_categoria_usuario = $this->categoria_usuario("uuid_categoria");
     self::$categoria_usuario_key = $this->categoria_usuario("key");
     //roles del usuario
     self::$user_role = $this->getRole();
     /*
      * Verificando que este usuario este en estado pendiente para redireccionar
      */
     if ($this->session->userdata('id_usuario') && $this->session->userdata('status') == 'Pendiente') {
         if (self::$ci->router->fetch_method() != 'ver_usuario' && self::$ci->router->fetch_method() != 'logout') {
             redirect('/usuarios/ver-usuario/' . $this->session->userdata('id_usuario'));
         }
     }
     //Cargar Libreria Assets
     $this->load->library('assets');
     //carga la libreria de notificaciones
     //$this->load->library('notificaciones');
     //Cargar Libreria para usuario
     $this->load->library('grafica_usuario');
     //Cargar Libreria template
     $this->load->library('template');
     //Cargar Libreria de Autenticacion
     //Verifica el rol y los permisos
     //que tiene el usuario.
     $this->load->library('auth');
     $this->load->library('core');
     /**
      * Cargar libreria Subpanel
      */
     $this->load->library('subpanel');
     /**
      * Cargar libreria para utility
      */
     $this->load->library('util');
     /**
      * Cargar libreria para modales
      */
     $this->load->library('modal');
     /**
      * Cargar libreria para jqgrid
      */
     $this->load->library('jqgrid');
     /**
      * Cargar libreria para catalogos
      */
     $this->load->library('catalogos');
     /**
      * carga libreria de jobs
      */
     $this->load->library('jobs');
     $this->load->library('notificaciones');
     /**
      * Cargar libreria phpFastCache
      *
      * phpFastCache is Lightweight, Fastest & Security,
      * supported many caching class (APC, MemCached, MemCache, Files, PDO, WinCache)
      */
     $this->load->library('phpfastcache/3.0.0/phpfastcache');
     phpFastCache::setup("storage", "auto");
     phpFastCache::$config = array("storage" => "auto", "default_chmod" => 0777, "htaccess" => true, "path" => "application/cache", "securityKey" => "auto", "memcache" => array(array("127.0.0.1", 11211, 1)), "redis" => array("host" => "127.0.0.1", "port" => "", "password" => "", "database" => "", "timeout" => ""), "extensions" => array(), "fallback" => "files");
     if (self::$cache == "") {
         self::$cache = phpFastCache("auto");
     }
 }
示例#20
0
        echo '<br><b>Error File:</b> ' . $errfile;
        echo '<br><b>Error Line:</b> ' . $errline;
    } else {
        throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }
});
// grab the settings
require ROOT . 'settings.php';
// grab status definitions
require SCRIPTROOT . 'statusdefs.php';
// set timezone
date_default_timezone_set('UTC');
// setup cache
require SCRIPTROOT . 'phpfastcache/phpfastcache.php';
phpFastCache::setup('storage', 'files');
phpFastCache::setup('path', ROOT . 'cache');
$cache = phpFastCache();
// setup routing
require SCRIPTROOT . 'AltoRouter/AltoRouter.php';
$routes = new AltoRouter();
// load the actual routes
require ROOT . 'routes.php';
// handle the route request
$route = $routes->match();
// error page handling
function ErrorPage($Error)
{
    ob_get_clean();
    http_response_code($Error);
    $error = $Error;
    require VIEWROOT . 'error.php';
示例#21
0
文件: index.php 项目: rodino25/tsv2
$dbh = mysqli_connect($db_server, DB_USERNAME, DB_PASSWORD, DB_NAME, $port);
if (!$dbh) {
    echo "<h3>Unable to connect to database. Please check details in configuration file.</h3>";
    exit;
}
mysqli_select_db($dbh, DB_NAME);
mysqli_query($GLOBALS['dbh'], "SET NAMES utf8");
mysqli_query($GLOBALS['dbh'], "SET CHARACTER SET utf8");
mysqli_query($GLOBALS['dbh'], "SET COLLATION_CONNECTION = 'utf8_general_ci'");
if (MC_NAME == 'memcachier') {
    $memcache = new MemcacheSASL();
    $memcache->addServer(MC_SERVER, MC_PORT);
    $memcache->setSaslAuthData(MC_USERNAME, MC_PASSWORD);
} elseif (MEMCACHE != 0) {
    phpFastCache::setup("path", dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'cache');
    phpFastCache::setup("storage", MC_NAME);
    $memcache = phpFastCache();
    $memcache->set('auth', 'o1k', 30);
}
$usertable = TABLE_PREFIX . DB_USERTABLE;
$usertable_username = DB_USERTABLE_NAME;
$usertable_userid = DB_USERTABLE_USERID;
$body = '';
if (!empty($_POST['username'])) {
    $_SESSION['cometchat']['cometchat_admin_user'] = $_POST['username'];
}
if (!empty($_POST['password'])) {
    $_SESSION['cometchat']['cometchat_admin_pass'] = $_POST['password'];
}
authenticate();
$module = "dashboard";
示例#22
0
<?php

// phpFastCache Library
require_once dirname(__FILE__) . "/phpfastcache/2.4.2/base.php";
// OK, setup your cache
phpFastCache::$storage = "files";
//memcache
phpFastCache::$config = array("storage" => phpFastCache::$storage, "fallback" => "files", "securityKey" => "auto", "htaccess" => true, "path" => "", "memcached" => array(array("127.0.0.1", 11211, 1)), "memcache" => array(array("127.0.0.1", 11211, 1)), "server" => array(array("127.0.0.1", 11211, 1)), "redis" => array("host" => "127.0.0.1", "port" => "", "password" => "", "database" => "", "timeout" => ""), "extensions" => array());
phpFastCache::setup(phpFastCache::$config);
// temporary disabled phpFastCache
phpFastCache::$disabled = false;
// default chmod | only change if you know what you are doing
phpFastCache::$default_chmod = "";
// keep it blank, it will use 666 for module and 644 for cgi
<?php

/*
 * Learn how to setup phpFastCache ?
 */
require_once "../phpfastcache.php";
/*
 * Now this is Optional Config setup for default phpFastCache
 */
$config = array("storage" => "auto", "default_chmod" => 0777, "htaccess" => true, "path" => "", "securityKey" => "auto", "memcache" => array(array("127.0.0.1", 11211, 1)), "redis" => array("host" => "127.0.0.1", "port" => "", "password" => "", "database" => "", "timeout" => ""), "extensions" => array(), "fallback" => "files");
phpFastCache::setup($config);
// OR
phpFastCache::setup("storage", "files");
phpFastCache::setup("path", dirname(__FILE__));
/*
 * End Optional Config
 */
$config = array();
$cache = phpFastCache("files", $config);
// this will be $config['storage'] up there;
// changing config example
$cache->setup("path", "new_path");
$cache2 = phpFastCache("memcache");
// this will use memcache
$server = array(array("127.0.0.1", 11211, 1));
$cache2->setup("memcache", $server);
function updatecaching()
{
    global $ts;
    $conn = 1;
    $errorCode = 0;
    $memcacheAuth = 0;
    include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "cometchat_cache.php";
    if ($_POST['MC_NAME'] == 'memcachier') {
        $memcacheAuth = 1;
        $conn = 0;
        $memcache = new MemcacheSASL();
        $memcache->addServer($_POST['MC_SERVER'], $_POST['MC_PORT']);
        if ($memcachierAuth = $memcache->setSaslAuthData($_POST['MC_USERNAME'], $_POST['MC_PASSWORD'])) {
            $memcache->set('auth', 'ok');
            if (!($conn = $memcache->get('auth'))) {
                $errorCode = 3;
            }
            $memcache->delete('auth');
        } else {
            $errorCode = 3;
        }
    } elseif ($_POST['MC_NAME'] != '') {
        $conn = 0;
        $memcacheAuth = 1;
        phpFastCache::setup("storage", $_POST['MC_NAME']);
        $memcache = new phpFastCache();
        $driverPresent = isset($memcache->driver->option['availability']) ? 0 : 1;
        if ($driverPresent) {
            if ($_POST['MC_NAME'] == 'memcache') {
                $server = array(array($_POST['MC_SERVER'], $_POST['MC_PORT'], 1));
                $memcache->option('server', $server);
            }
            $memcache->set('auth', 'ok', 30);
            if (!($conn = $memcache->get('auth'))) {
                $errorCode = 1;
            }
            $memcache->delete('auth');
        }
    }
    if ($conn && !$errorCode) {
        $data = 'define(\'MEMCACHE\',\'' . $memcacheAuth . '\');' . "\r\n";
        $data .= 'define(\'MC_SERVER\',\'' . $_POST['MC_SERVER'] . '\');' . "\t// Set name of your memcache  server\r\n";
        $data .= 'define(\'MC_PORT\',\'' . $_POST['MC_PORT'] . '\');' . "\t\t\t// Set port of your memcache  server\r\n";
        $data .= 'define(\'MC_USERNAME\',\'' . $_POST['MC_USERNAME'] . '\');' . "\t\t\t\t\t\t\t// Set username of memcachier  server\r\n";
        $data .= 'define(\'MC_PASSWORD\',\'' . $_POST['MC_PASSWORD'] . '\');' . "\t\t\t// Set password your memcachier  server\r\n";
        $data .= 'define(\'MC_NAME\',\'' . $_POST['MC_NAME'] . '\');' . "\t\t\t// Set name of caching method if 0 : '', 1 : memcache, 2 : files, 3 : memcachier, 4 : apc, 5 : wincache, 6 : sqlite & 7 : memcached";
        configeditor('MEMCACHE', $data, 0);
        $_SESSION['cometchat']['error'] = 'Caching details updated successfully.';
    } else {
        if ($_POST['MC_NAME'] == 'memcachier') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memchachier server details';
        } elseif ($_POST['MC_NAME'] == 'files') {
            $_SESSION['cometchat']['error'] = 'Please check file permission of your cache directory. Please try 755/777/644';
        } elseif ($_POST['MC_NAME'] == 'apc') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your APC configuration.';
        } elseif ($_POST['MC_NAME'] == 'wincache') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Wincache configuration.';
        } elseif ($_POST['MC_NAME'] == 'sqlite') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your SQLite configuration.';
        } elseif ($_POST['MC_NAME'] == 'memcached') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memcached configuration.';
        } else {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memcache server configuration.';
        }
    }
    header("Location:?module=settings&action=caching&ts={$ts}");
}
示例#25
0
 function SetCachedVersion($function, $unique_id, $args_id, $data)
 {
     // In your config file
     //		require_once(dirname(__FILE__) . "/phpfastcache.php");
     phpFastCache::setup("storage", "redis");
     #default global for everywhere.
     //		 phpFastCache support "redis", "cookie", "apc", "memcache", "memcached", "wincache" ,"files", "sqlite" and "xcache";
     // You don't need to change your code when you change your caching system, blank will use default global:
     $cache = phpFastCache("files");
     $id = md5($function . $unique_id . $args_id);
     $results = $cache->get("cache_" . $id);
     if ($results) {
         return $results;
     }
     return $results;
     //
 }
示例#26
0
function getColorVars()
{
    global $client;
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "cometchat_cache.php";
    global $settingscache;
    global $colors;
    phpFastCache::setup("path", dirname(__FILE__) . DIRECTORY_SEPARATOR . 'writable' . DIRECTORY_SEPARATOR . 'cache');
    phpFastCache::setup("storage", 'files');
    $settingscache = phpFastCache();
    if ($conf = getCachedSettings($client . "cometchat_color", 3600)) {
        $colors = unserialize($conf);
    } else {
        cometchatDBConnect();
        $colors = array();
        $sql = "select `color_key`,`color_value`,`color` from `cometchat_colors`";
        $query = mysqli_query($GLOBALS['dbh'], $sql);
        while ($color = mysqli_fetch_assoc($query)) {
            if (empty($colors[$color['color']])) {
                $colors[$color['color']] = array();
            }
            $colors[$color['color']][$color['color_key']] = $color['color_value'];
        }
        setCachedSettings($client . "cometchat_color", serialize($colors), 3600);
    }
}
示例#27
0
<?php

return array('Cache' => function () {
    $config = (require \App::path() . '/app/config/cache.php');
    \phpFastCache::setup($config);
    return phpFastCache();
}, 'Crypt' => 'Disco\\classes\\Crypt', 'Data' => 'Disco\\classes\\Data', 'DB' => 'Disco\\classes\\PDO', 'Event' => 'Disco\\classes\\Event', 'Email' => 'Disco\\classes\\Email', 'FileHelper' => 'Disco\\classes\\FileHelper', 'Form' => 'Disco\\classes\\Form', 'Html' => 'Disco\\classes\\Html', 'Model' => 'Disco\\classes\\ModelFactory', 'Queue' => 'Disco\\classes\\Queue', 'Request' => 'Disco\\classes\\Request', 'Session' => 'Disco\\classes\\Session', 'Template' => 'Disco\\classes\\Template', 'View' => 'Disco\\classes\\View', 'User' => 'App\\service\\User');
<?php

/*
 * This script bootstraps all loading
 *
 * It will handle all the includes, page construction and output
 */
session_start();
$script = $_SERVER['SCRIPT_NAME'];
$menuPath = str_replace("/pages/", "", $script);
$baseDir = $_SERVER['DOCUMENT_ROOT'] . '/';
$includesDir = $baseDir . "includes/";
//load up the cache engine
include $includesDir . 'phpfastcache.php';
phpFastCache::setup("storage", "files");
phpFastCache::setup("path", $baseDir . 'cache/');
// Path For Files
$cache = phpFastCache();
// detect if this is an ajax page call
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $ajax = true;
} else {
    $ajax = false;
}
//detect if this is a post (which could also be an ajax call
if ($_POST) {
    $post = true;
} else {
    $post = false;
}
include 'mangoConfig.php';
示例#29
0
<?php

/*
 * Here is how to setup and work on phpFastCache fast!
 */
require_once "phpfastcache/phpfastcache.php";
// auto, files, sqlite, xcache, memcache, apc, memcached, wincache
phpFastCache::setup("storage", "auto");
// SET a Data into Cache
__c()->set("keyword", "array|object|string|data", $time_in_second);
// GET a Data from Cache
$data = __c()->get("keyword");
$object = __c()->getInfo("keyword");
// ARRAY
// Others Funtions
__c()->delete("keyword");
__c()->increment("keyword", $step = 1);
// TRUE | FALSE
__c()->decrement("keyword", $step = 1);
// TRUE | FALSE
__c()->touch("keyword", $more_time_in_second);
// TRUE | FALSE
__c()->clean();
__c()->stats();
// ARRAY
__c()->isExisting("keyword");
// TRUE | FALSE
// Direct Keyword SET & GET
__c()->keyword = array("array|object|string|data", $time_in_second);
$data = __c()->keyword;