示例#1
0
 public function __construct()
 {
     $this->_db = App::getDatabase();
     $this->_name = App::getAuth()->user()->pseudo;
     $this->_id = App::getAuth()->user()->id_user;
     $this->getConvoi();
 }
示例#2
0
 public static function import(File $file)
 {
     ini_set('memory_limit', '5120M');
     set_time_limit(0);
     $sql_query = $file->content;
     $sql_query = static::strip_remarks($sql_query);
     $sql_query = static::strip_comments($sql_query);
     dd($sql_query);
     $sql_query = static::split_sql_file($sql_query, ';');
     $i = 1;
     foreach ($sql_query as $sql) {
         echo $i++;
         echo PHP_EOL;
         App::getDatabase()->query($sql);
     }
 }
示例#3
0
 function __construct($id_user, $id_tweet = null)
 {
     $this->_db = App::getDatabase();
     $this->_id_user = $id_user;
     if (NULL !== $id_tweet) {
         $this->_id_tweet = $id_tweet;
         $sql = "SELECT * FROM tweets WHERE id_tweet = :id";
         $smt = $this->_db->query($sql, [':id' => $this->_id_tweet]);
         $all = $smt->fetch();
         $this->_content = $all->content;
         $this->_creation_date = $all->creation_date;
         $this->_media = $all->media;
         $this->_deleted = $all->deleted;
         $this->_is_origin = $all->is_origin;
         $this->_is_reply = $all->is_reply;
         $this->_location = $all->location;
     }
 }
示例#4
0
<?php

require 'inc/bootstrap.php';
$db = App::getDatabase();
if (App::getAuth()->confirm($db, $_GET['id'], $_GET['token'], Session::getInstance())) {
    Session::getInstance()->setFlash('danger', "Votre compte a bien été validé");
    App::redirect('index.php');
} else {
    Session::getInstance()->setFlash('danger', "Ce token n'est plus valide");
    App::redirect('login.php');
}
示例#5
0
        $cdp->run();
        $utility = new SchedulePlannerProtocolMessageUtility(App::getDatabase());
        $response = $utility->createCoursesResponse(null);
        $json = ProtocolMessage::serialize($response);
        try {
            $file = new File(FILE_ROOT . '/cache/courses.json');
            $file->content = "')]}\n" . $json;
        } catch (FileException $e) {
            fprintf(STDOUT, "Failed to write file cache, continuing.\n");
        }
        fprintf(STDOUT, "Done!\n");
    } else {
        fprintf(STDOUT, "Unrecognized command.\n");
    }
});
/**
 * Regenerates the cache of course data to reflect database modifications.
 * php server.php recache
 */
CLIApplication::listen('recache', function ($args) {
    $utility = new SchedulePlannerProtocolMessageUtility(App::getDatabase());
    $response = $utility->createCoursesResponse(null);
    $json = ProtocolMessage::serialize($response);
    try {
        $file = new File(FILE_ROOT . '/cache/courses.json');
        $file->content = "')]}\n" . $json;
    } catch (FileException $e) {
        fprintf(STDOUT, "Failed to write file cache, continuing.\n");
    }
    fprintf(STDOUT, "Done!\n");
});
示例#6
0
 function __construct($_db, $_nameUser = NULL, $_tag = NULL)
 {
     $this->_db = App::getDatabase();
 }
示例#7
0
<?php

require_once 'includes/autoloader.php';
require 'includes/header.php';
$bdd = App::getDatabase();
$statusBdd = $bdd->getStatusBdd();
if ($statusBdd) {
    $library = App::getLibrary();
}
?>
      <div class="row">
        <div class="col-md-12 text-center">
          <h1>Application test C2iS</h1>
          <h2>Gestion de bibliothèque</h2>
        </div>  
      </div>
      <div class="row">
        <div class="col-md-12">
          <?php 
if (!$statusBdd) {
    ?>
            <div class="alert alert-danger" role="alert">
              <div>Impossible de se connecter à la base de données.</div>
              <div>Veuillez vérifier vos données de connexion.</div>
              <div>Utilisateur='root' , Mot de passe='root', Hôte='localhost' , Nom de la base='appli_C2iS' </div>
            </div>
          <?php 
} else {
    //Le corps de l'application est construit suivant ce qui est demandé par l'utilisateur.
    $page = isset($_GET['page']) ? $_GET['page'] : '';
    if (empty($page) || isset($_GET['id']) && !is_int((int) $_GET['id']) || isset($_POST['author']) && !is_int((int) $_POST['author'])) {
示例#8
0
 public function __construct()
 {
     $this->_db = App::getDatabase();
 }
示例#9
0
 public function __construct($id)
 {
     $this->_db = App::getDatabase();
     $this->_id = $id;
     $this->getAllFromConvoi();
 }