/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Connection.php
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function runQueryCallback($query, $bindings, Closure $callback)
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
try
{
$result = $callback($this, $query, $bindings);
}
// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
catch (\Exception $e)
{
throw new QueryException(
$query, $this->prepareBindings($bindings), $e
);
}
return $result;
}
/**
* Handle a query exception that occurred during query execution.
*
* @param \Illuminate\Database\QueryException $e
* @param string $query
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback)
{
/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Connection.php
/**
* Run an SQL statement and get the number of rows affected.
*
* @param string $query
* @param array $bindings
* @return int
*/
public function affectingStatement($query, $bindings = array())
{
return $this->run($query, $bindings, function($me, $query, $bindings)
{
if ($me->pretending()) return 0;
// For update or delete statements, we want to get the number of rows affected
// by the statement and return that back to the developer. We'll first need
// to execute the statement and then we'll use PDO to fetch the affected.
$statement = $me->getPdo()->prepare($query);
$statement->execute($me->prepareBindings($bindings));
return $statement->rowCount();
});
}
/**
* Run a raw, unprepared query against the PDO connection.
*
* @param string $query
* @return bool
*/
public function unprepared($query)
{
return $this->run($query, array(), function($me, $query)
{
if ($me->pretending()) return true;
return (bool) $me->getPdo()->exec($query);
});
}
/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Connection.php
/**
* Run an SQL statement and get the number of rows affected.
*
* @param string $query
* @param array $bindings
* @return int
*/
public function affectingStatement($query, $bindings = array())
{
return $this->run($query, $bindings, function($me, $query, $bindings)
{
if ($me->pretending()) return 0;
// For update or delete statements, we want to get the number of rows affected
// by the statement and return that back to the developer. We'll first need
// to execute the statement and then we'll use PDO to fetch the affected.
$statement = $me->getPdo()->prepare($query);
$statement->execute($me->prepareBindings($bindings));
return $statement->rowCount();
});
}
/**
* Run a raw, unprepared query against the PDO connection.
*
* @param string $query
* @return bool
*/
public function unprepared($query)
{
return $this->run($query, array(), function($me, $query)
{
if ($me->pretending()) return true;
return (bool) $me->getPdo()->exec($query);
});
}
/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Connection.php
}
/**
* Run a SQL statement.
*
* @param string $query
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function runQueryCallback($query, $bindings, Closure $callback)
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
try
{
$result = $callback($this, $query, $bindings);
}
// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
catch (\Exception $e)
{
throw new QueryException(
$query, $this->prepareBindings($bindings), $e
);
}
return $result;
}
/**
* Handle a query exception that occurred during query execution.
*
* @param \Illuminate\Database\QueryException $e
* @param string $query
/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Connection.php
*
* @param string $query
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function run($query, $bindings, Closure $callback)
{
$this->reconnectIfMissingConnection();
$start = microtime(true);
// Here we will run this query. If an exception occurs we'll determine if it was
// caused by a connection that has been lost. If that is the cause, we'll try
// to re-establish connection and re-run the query with a fresh connection.
try
{
$result = $this->runQueryCallback($query, $bindings, $callback);
}
catch (QueryException $e)
{
$result = $this->tryAgainIfCausedByLostConnection(
$e, $query, $bindings, $callback
);
}
// Once we have run the query we will calculate the time that it took to run and
// then log the query, bindings, and execution time so we will report them on
// the event that the developer needs them. We'll log time in milliseconds.
$time = $this->getElapsedTime($start);
$this->logQuery($query, $bindings, $time);
return $result;
}
/**
* Run a SQL statement.
/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Connection.php
*
* @param string $query
* @param array $bindings
* @return int
*/
public function affectingStatement($query, $bindings = array())
{
return $this->run($query, $bindings, function($me, $query, $bindings)
{
if ($me->pretending()) return 0;
// For update or delete statements, we want to get the number of rows affected
// by the statement and return that back to the developer. We'll first need
// to execute the statement and then we'll use PDO to fetch the affected.
$statement = $me->getPdo()->prepare($query);
$statement->execute($me->prepareBindings($bindings));
return $statement->rowCount();
});
}
/**
* Run a raw, unprepared query against the PDO connection.
*
* @param string $query
* @return bool
*/
public function unprepared($query)
{
return $this->run($query, array(), function($me, $query)
{
if ($me->pretending()) return true;
return (bool) $me->getPdo()->exec($query);
});
}
/**
* Prepare the query bindings for execution.
/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Connection.php
*
* @param string $query
* @param array $bindings
* @return int
*/
public function update($query, $bindings = array())
{
return $this->affectingStatement($query, $bindings);
}
/**
* Run a delete statement against the database.
*
* @param string $query
* @param array $bindings
* @return int
*/
public function delete($query, $bindings = array())
{
return $this->affectingStatement($query, $bindings);
}
/**
* Execute an SQL statement and return the boolean result.
*
* @param string $query
* @param array $bindings
* @return bool
*/
public function statement($query, $bindings = array())
{
return $this->run($query, $bindings, function($me, $query, $bindings)
{
if ($me->pretending()) return true;
$bindings = $me->prepareBindings($bindings);
return $me->getPdo()->prepare($query)->execute($bindings);
});
}
/home/yykajri/ra/app/vendor/illuminate/database/Illuminate/Database/Query/Builder.php
return $this->update($columns);
}
/**
* Delete a record from the database.
*
* @param mixed $id
* @return int
*/
public function delete($id = null)
{
// If an ID is passed to the method, we will set the where clause to check
// the ID to allow developers to simply and quickly remove a single row
// from their database without manually specifying the where clauses.
if ( ! is_null($id)) $this->where('id', '=', $id);
$sql = $this->grammar->compileDelete($this);
return $this->connection->delete($sql, $this->getBindings());
}
/**
* Run a truncate statement on the table.
*
* @return void
*/
public function truncate()
{
foreach ($this->grammar->compileTruncate($this) as $sql => $bindings)
{
$this->connection->statement($sql, $bindings);
}
}
/**
* Get a new instance of the query builder.
*
* @return \Illuminate\Database\Query\Builder
*/
/home/yykajri/ra/app/vendor/illuminate/session/Illuminate/Session/DatabaseSessionHandler.php
]);
}
$this->exists = true;
}
/**
* {@inheritDoc}
*/
public function destroy($sessionId)
{
$this->getQuery()->where('id', $sessionId)->delete();
}
/**
* {@inheritDoc}
*/
public function gc($lifetime)
{
$this->getQuery()->where('last_activity', '<=', time() - $lifetime)->delete();
}
/**
* Get a fresh query builder instance for the table.
*
* @return \Illuminate\Database\Query\Builder
*/
protected function getQuery()
{
return $this->connection->table($this->table);
}
/**
* Set the existence state for the session.
*
* @param bool $value
* @return $this
*/
public function setExists($value)
{
/home/yykajri/ra/app/vendor/gears/session/src/Session.php
* Returns:
* -------------------------------------------------------------------------
* void
*/
public function install($global = false)
{
// Make sure we have a sessions table
$schema = $this->dbConnection->getSchemaBuilder();
if (!$schema->hasTable($this->table))
{
$schema->create($this->table, function($t)
{
$t->string('id')->unique();
$t->text('payload');
$t->integer('last_activity');
});
}
// Run the garbage collection
$this->sessionStore->getHandler()->gc($this->lifetime);
// Check for our session cookie
if (isset($_COOKIE[$this->name]))
{
// Grab the session id from the cookie
$cookie_id = $_COOKIE[$this->name];
// Does the session exist in the db?
$session = (object) $this->dbConnection
->table($this->table)
->find($cookie_id)
;
if (isset($session->payload))
{
// Set the id of the session
$this->sessionStore->setId($cookie_id);
}
else
{
/home/yykajri/ra/app/core/socle.php
//return $testmigrate;
$this->capsule = new Capsule;
$this->capsule->addConnection($app["sql"]);
$this->capsule->bootEloquent();
$this->capsule->setAsGlobal();
return $this->capsule;
//$this->schema = $this->capsule->schema();
});
$services["db"] = $app["services"]->get('db');
/*---------------------------------------------------------------
* sessions api
*--------------------------------------------------------------- */
$app["services"]->set('session', function () use($app) {
$session = new Gears\Session();
$session->dbConfig = $app["sql"];
$session->install();
$session->globalise();
return $session;
});
$services["session"] = $app["services"]->get('session');
/*---------------------------------------------------------------
* mailer
*--------------------------------------------------------------- */
/*$app["services"]->set('mailer', function () use($app) {
if(isset($app["config"]["mail"])):
$transport = Swift_SmtpTransport::newInstance($app["config"]["mail"]["host"], $app["config"]["mail"]["port"])
->setUsername($app["config"]["mail"]["login"])
->setPassword($app["config"]["mail"]["pass"]);
/home/yykajri/ra/app/vendor/php-di/invoker/src/Invoker.php
$callableReflection = CallableReflection::create($callable);
$args = $this->parameterResolver->getParameters($callableReflection, $parameters, array());
// Sort by array key because call_user_func_array ignores numeric keys
ksort($args);
// Check all parameters are resolved
$diff = array_diff_key($callableReflection->getParameters(), $args);
if (! empty($diff)) {
/** @var \ReflectionParameter $parameter */
$parameter = reset($diff);
throw new NotEnoughParametersException(sprintf(
'Unable to invoke the callable because no value was given for parameter %d ($%s)',
$parameter->getPosition() + 1,
$parameter->name
));
}
return call_user_func_array($callable, $args);
}
/**
* Create the default parameter resolver.
*
* @return ParameterResolver
*/
private function createParameterResolver()
{
return new ResolverChain(array(
new NumericArrayResolver,
new AssociativeArrayResolver,
new DefaultValueResolver,
));
}
/**
* @return ParameterResolver By default it's a ResolverChain
*/
public function getParameterResolver()
/home/yykajri/ra/app/vendor/php-di/invoker/src/Invoker.php
$callableReflection = CallableReflection::create($callable);
$args = $this->parameterResolver->getParameters($callableReflection, $parameters, array());
// Sort by array key because call_user_func_array ignores numeric keys
ksort($args);
// Check all parameters are resolved
$diff = array_diff_key($callableReflection->getParameters(), $args);
if (! empty($diff)) {
/** @var \ReflectionParameter $parameter */
$parameter = reset($diff);
throw new NotEnoughParametersException(sprintf(
'Unable to invoke the callable because no value was given for parameter %d ($%s)',
$parameter->getPosition() + 1,
$parameter->name
));
}
return call_user_func_array($callable, $args);
}
/**
* Create the default parameter resolver.
*
* @return ParameterResolver
*/
private function createParameterResolver()
{
return new ResolverChain(array(
new NumericArrayResolver,
new AssociativeArrayResolver,
new DefaultValueResolver,
));
}
/**
* @return ParameterResolver By default it's a ResolverChain
*/
public function getParameterResolver()
/home/yykajri/ra/app/vendor/php-di/php-di/src/DI/Definition/Resolver/FactoryResolver.php
*
* This will call the callable of the definition.
*
* @param FactoryDefinition $definition
*
* {@inheritdoc}
*/
public function resolve(Definition $definition, array $parameters = [])
{
if (! $this->invoker) {
$parameterResolver = new ResolverChain([
new FactoryParameterResolver($this->container),
new NumericArrayResolver,
]);
$this->invoker = new Invoker($parameterResolver, $this->container);
}
try {
return $this->invoker->call($definition->getCallable(), [$this->container, $definition]);
} catch (NotCallableException $e) {
throw new DefinitionException(sprintf(
'Entry "%s" cannot be resolved: factory %s',
$definition->getName(),
$e->getMessage()
));
} catch (NotEnoughParametersException $e) {
throw new DefinitionException(sprintf(
'Entry "%s" cannot be resolved: %s',
$definition->getName(),
$e->getMessage()
));
}
}
/**
* {@inheritdoc}
*/
public function isResolvable(Definition $definition, array $parameters = [])
{
/home/yykajri/ra/app/vendor/php-di/php-di/src/DI/Definition/Resolver/ResolverDispatcher.php
{
$this->container = $container;
$this->proxyFactory = $proxyFactory;
}
/**
* Resolve a definition to a value.
*
* @param Definition $definition Object that defines how the value should be obtained.
* @param array $parameters Optional parameters to use to build the entry.
*
* @throws DefinitionException If the definition cannot be resolved.
*
* @return mixed Value obtained from the definition.
*/
public function resolve(Definition $definition, array $parameters = [])
{
$definitionResolver = $this->getDefinitionResolver($definition);
return $definitionResolver->resolve($definition, $parameters);
}
/**
* Check if a definition can be resolved.
*
* @param Definition $definition Object that defines how the value should be obtained.
* @param array $parameters Optional parameters to use to build the entry.
*
* @return bool
*/
public function isResolvable(Definition $definition, array $parameters = [])
{
$definitionResolver = $this->getDefinitionResolver($definition);
return $definitionResolver->isResolvable($definition, $parameters);
}
/**
* Returns a resolver capable of handling the given definition.
*
/home/yykajri/ra/app/vendor/php-di/php-di/src/DI/Container.php
*
* @param Definition $definition
* @param array $parameters
*
* @throws DependencyException Error while resolving the entry.
* @return mixed
*/
private function resolveDefinition(Definition $definition, array $parameters = [])
{
$entryName = $definition->getName();
// Check if we are already getting this entry -> circular dependency
if (isset($this->entriesBeingResolved[$entryName])) {
throw new DependencyException("Circular dependency detected while trying to resolve entry '$entryName'");
}
$this->entriesBeingResolved[$entryName] = true;
// Resolve the definition
try {
$value = $this->definitionResolver->resolve($definition, $parameters);
} catch (Exception $exception) {
unset($this->entriesBeingResolved[$entryName]);
throw $exception;
}
unset($this->entriesBeingResolved[$entryName]);
return $value;
}
private function setDefinition($name, Definition $definition)
{
if ($this->definitionSource instanceof CachedDefinitionSource) {
throw new \LogicException('You cannot set a definition at runtime on a container that has a cache configured. Doing so would risk caching the definition for the next execution, where it might be different. You can either put your definitions in a file, remove the cache or ->set() a raw value directly (PHP object, string, int, ...) instead of a PHP-DI definition.');
}
if (! $this->definitionSource instanceof MutableDefinitionSource) {
// This can happen if you instantiate the container yourself
throw new \LogicException('The container has not been initialized correctly');
}
/home/yykajri/ra/app/vendor/php-di/php-di/src/DI/Container.php
public function get($name)
{
if (! is_string($name)) {
throw new InvalidArgumentException(sprintf(
'The name parameter must be of type string, %s given',
is_object($name) ? get_class($name) : gettype($name)
));
}
// Try to find the entry in the singleton map
if (array_key_exists($name, $this->singletonEntries)) {
return $this->singletonEntries[$name];
}
$definition = $this->definitionSource->getDefinition($name);
if (! $definition) {
throw new NotFoundException("No entry or class found for '$name'");
}
$value = $this->resolveDefinition($definition);
// If the entry is singleton, we store it to always return it without recomputing it
if ($definition->getScope() === Scope::SINGLETON) {
$this->singletonEntries[$name] = $value;
}
return $value;
}
/**
* Build an entry of the container by its name.
*
* This method behave like get() except it forces the scope to "prototype",
* which means the definition of the entry will be re-evaluated each time.
* For example, if the entry is a class, then a new instance will be created each time.
*
* This method makes the container behave like a factory.
*
* @param string $name Entry name or a class name.
* @param array $parameters Optional parameters to use to build the entry. Use this to force specific parameters
/home/yykajri/ra/app/core/socle.php
return $this->capsule;
//$this->schema = $this->capsule->schema();
});
$services["db"] = $app["services"]->get('db');
/*---------------------------------------------------------------
* sessions api
*--------------------------------------------------------------- */
$app["services"]->set('session', function () use($app) {
$session = new Gears\Session();
$session->dbConfig = $app["sql"];
$session->install();
$session->globalise();
return $session;
});
$services["session"] = $app["services"]->get('session');
/*---------------------------------------------------------------
* mailer
*--------------------------------------------------------------- */
/*$app["services"]->set('mailer', function () use($app) {
if(isset($app["config"]["mail"])):
$transport = Swift_SmtpTransport::newInstance($app["config"]["mail"]["host"], $app["config"]["mail"]["port"])
->setUsername($app["config"]["mail"]["login"])
->setPassword($app["config"]["mail"]["pass"]);
else:
$transport = Swift_MailTransport::newInstance();
endif;
$mailer = Swift_Mailer::newInstance($transport);
/home/yykajri/ra/app/core/socle.php
ini_set("zlib.output_compression", "On");
ini_set("zlib.output_compression", 4096);
ini_set("memory_limit","1024M");
ini_set('upload_max_filesize', '40M');
ini_set('post_max_size', '40M');
/* Désactivation de la reconnaissance de l'identifiant de session dans l'URL */
ini_set('session.use_trans_sid', "0");
/* Interdiction d'ajouter l'identifiant de session dans le code html généré */
ini_set("url_rewriter.tags","");
//define('always_populate_raw_post_data', '-1');
set_time_limit(200);
gc_enable();
//if (substr_count($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip")) ob_start("ob_gzhandler"); else ob_start();
$this->config($dir);
$this->add_services();
$app["map"] = util::array_clean((array)singleton("route")->map($app["request"]));
//$this->add_projects();
$this->get_project();
gc_collect_cycles();
}
/*---------------------------------------------------------------
* config
*--------------------------------------------------------------- */
public function config($dir) {
global $app;
/*
/home/yykajri/ra/www/index.php
<?php
/*---------------------------------------------------------------
* autoload
*--------------------------------------------------------------- */
define('in_app', '...for security dude!');
require_once("../app/vendor/autoload.php");//load libs
require_once("../app/project/datas/datas.php");//load libs
require_once("../app/core/cache.php");//load libs
$myapp = new Socle(__dir__);
/*---------------------------------------------------------------
* datas
*--------------------------------------------------------------- */
/*
$app["services"]->set('datas', function () use($app) {
$return = new Datas;
return $return;
});
$services["datas"] = $app["services"]->get('datas');
*/
/*---------------------------------------------------------------
* init
*--------------------------------------------------------------- */
$myapp->run();
?>