Exemplo n.º 1
0
 static function Init()
 {
     //&$con
     parent::Init();
     if (!isset($install)) {
         $result = Query::query('SELECT * FROM tbl_settings');
         while ($get_setting = $result->fetch_array()) {
             Settings::Set($get_setting['key'], $get_setting['value']);
         }
         Settings::Set($get_setting['table_prefix'], 'tbl_');
     }
     //Template Settings
     $template = array();
     $template['homepage_game_limit'] = 3;
     // Number of games to show per caregory on the homepage
     $template['homepage_order'] = 'newest';
     // Rating stars
     $template['rating_star'] = 'star.png';
     $template['rating_half_star'] = 'half_star.png';
     $template['rating_empty_star'] = 'empty_star.png';
     // Highscore image
     $template['highscore_image'] = '<img src="' . '' . '/images/trophy_smaller.png" />';
     //$setting['site_url']
     // Display settings
     $template['new_game_columns'] = 2;
     $template['new_game_number'] = 6;
     $template['category_columns'] = 2;
     // Number of game columns on the category page
     $template['homepage_columns'] = 2;
     // Number of category columns on the homepage
     $template['random_game_limit'] = 5;
     // Number of games to show in the random games section
     $template['games_per_page'] = 30;
     // Number of games to show per page in categories
     $template['category_game_chars'] = 25;
     // The character limit for game names in categories
     $template['category_game_desc_chars'] = 55;
     // The character limit for game descriptions in categories
     $template['home_game_chars'] = 25;
     // The character limit for game names in categories
     $template['home_game_desc_chars'] = 145;
     // The character limit for game descriptions in categories
     $template['random_game_chars'] = 25;
     // The character limit for the random game names
     $template['random_game_desc_chars'] = 110;
     // The character limit for the random game descriptions
     $template['module_max_chars'] = 25;
     // The character limit modules (game names, news)
     $template['player_module_max_chars'] = 20;
     // The character limit modules (game names, news)
     // Module Settings
     $template['categories_menu_seperator'] = ' &nbsp; ';
     $template['user_menu_seperator'] = '&nbsp;&nbsp;&nbsp;';
     $template['pages_menu_seperator'] = ' | ';
     foreach ($template as $key => $value) {
         Settings::Set($key, $value);
         $template = NULL;
     }
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     //parent::setUp();
     $this->sample = Yii::createObject(['class' => NewModel::className(), 'items' => $this->items]);
 }
Exemplo n.º 3
0
<?php

session_start();
include_once '../../TOMO2-Web/includes/connection.php';
include_once '../../TOMO2-Web/includes/New.php';
include_once '../../TOMO2-Web/PDO/NewModel.php';
//include_once ('../img_bbdd/upload.php');
if (isset($_SESSION['name']) and $_SESSION['id'] == '10207674962976867') {
    $id_news = $_GET['id_news'];
    $news = new News();
    $newModel = new NewModel();
    $image = array(null);
    $directory = "img_bbdd/helados.jpg";
    /*
        if (isset($_GET['name'], $_GET['description'], $_GET['upload_date'], $_GET['image'], $_GET['link'], $_GET['active'])){
            $name = $_GET['name'];
            $description = nl2br($_GET['description']);
            $upload_date = $_GET['upload_date'];
            $link = $_GET['image'];
            $image = $_GET['link'];
            $active = $_GET['active'];
    
            if (empty($name) or empty($description) or empty($upload_date)){
                $error = 'There are some fields empty. The only empty field accepted is "image" or "link" field';
            } else {
                $query = $pdo->prepare('INSERT INTO Noticias (name, description, upload_date, image, link, active) VALUES (?, ?, ?, ?, ?, ?)');
    
                $query->bindValue (1, $name);
                $query->bindValue (2, $description);
                $query->bindValue (3, $upload_date);
                $query->bindValue (4, $image);
Exemplo n.º 4
0
 function testUnsetAttributes()
 {
     $model = new NewModel();
     $model->attr1 = 1;
     $model->attr2 = 2;
     $model->unsetAttributes(array('attr1'));
     $this->assertEquals(null, $model->attr1);
     $this->assertEquals(2, $model->attr2);
     $model->unsetAttributes();
     $this->assertEquals(null, $model->attr1);
     $this->assertEquals(null, $model->attr2);
 }
Exemplo n.º 5
0
 static function Init()
 {
     NewModel::connect('localhost', 'root', '', 'boxarcade');
 }
Exemplo n.º 6
0
 public function testNoErrorMessageForValidAttribute()
 {
     $model = new NewModel();
     $model->validate();
     $this->assertNull($model->getError('attr2'));
 }
Exemplo n.º 7
0
        } catch (Exception $e) {
            die($e->getMessage());
        }
    }
    public function Insert(News $data)
    {
        try {
            $query = "INSERT INTO Noticias (name, description, upload_date, image, link, active)\n                          VALUES (?, ?, ?, ?, ?, ?)";
            $this->pdo->prepare($query)->execute(array($data->__GET('name'), $data->__GET('description'), $data->__GET('upload_date'), $data->__GET('image'), $data->__GET('link'), $data->__GET('active')));
        } catch (Exception $e) {
            die($e->getMessage());
        }
    }
}
$news = new News();
$newModel = new NewModel();
if (isset($_REQUEST['action'])) {
    echo '<script language="javascript">alert("Hemos entrado en el 1er if! Encima, el nombre es: ' . $_REQUEST['name'] . '");
        </script>';
    switch ($_REQUEST['action']) {
        case 'update':
            $news->__SET('id_news', $_REQUEST['id_news']);
            $news->__SET('name', $_REQUEST['name']);
            $news->__SET('description', $_REQUEST['description']);
            $news->__SET('upload_date', $_REQUEST['upload_date']);
            $news->__SET('image', $_REQUEST['image']);
            $news->__SET('link', $_REQUEST['link']);
            $news->__SET('active', $_REQUEST['active']);
            $newModel->Update($news);
            header('Location: ../admin/index.php');
            echo '<script language="javascript">alert("¡El registro se ha actualizado exitosamente!");</script>';