Пример #1
0
 function truncate()
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("TRUNCATE TABLE free_delivery_price");
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
Пример #2
0
 protected function setUp()
 {
     $this->connection = ConnectionManager::getConnection();
     $this->emptyDatabaseTables();
     $this->loadFixtures();
     $this->setBrowser('*firefox');
     $this->setBrowserUrl('http://localhost/');
 }
Пример #3
0
 function Listado($valor_debug = 0)
 {
     $this->db = ConnectionManager::getConnection($this->_conexion);
     $this->formato_fecha = "y-m-d";
     $this->debug = $valor_debug;
     $this->db->debug = $this->debug;
     $this->path_image = "imagenes/listado/";
     $this->estilo = "lista";
     $this->javascript["popup"] = " \n\r\n\t\t\t<script language=\"JavaScript\"> \n\r\n\t\t\t\tfunction popup_class_listado(nombre,pagina,x,y){ \n\r\n\t\t\t\t\teval (\"newwin_\" + nombre + \" = window.open('\"+pagina+\"','\"+nombre+\"','height='+y+',top=' + (screen.height-y)/2 + ',width='+x+',left=' + (screen.width - x)/2 + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');\");\n\r\n\t\t\t\t\teval (\"newwin_\" + nombre + \" . focus(); \");\n\r\n\t\t\t\t\treturn false;\n\r\n\t\t\t\t}\n\r\n\t\t\t</script>\n";
 }
 public function getCategory()
 {
     $connection = ConnectionManager::getConnection();
     $sql = "SELECT * FROM category";
     $catresult = $connection->query($sql);
     $catArr = array();
     while ($row = $catresult->fetch_assoc()) {
         $catArr[] = $row['name'];
     }
     return $catArr;
 }
 public function getAuctionTitle($auctionId)
 {
     //auctionId sanitized
     $auctionId = (int) $auctionId;
     $connection = ConnectionManager::getConnection();
     $sql_bidHistory = "SELECT title\n            FROM auction\n            WHERE id = {$auctionId};\n            ";
     $result_bidHistory = $connection->query($sql_bidHistory);
     while ($row = $result_bidHistory->fetch_assoc()) {
         $auction_title = $row['title'];
     }
     return $auction_title;
 }
 public function getLosingBuyers($auctionId, $highestBidderId)
 {
     $connection = ConnectionManager::getConnection();
     $auctionId = (int) $auctionId;
     $highestBidderId = (int) $highestBidderId;
     $sql = "SELECT DISTINCT bidder_id FROM bid WHERE auction_id = {$auctionId} AND bidder_id <> {$highestBidderId}";
     $resultSet = $connection->query($sql);
     $losers = array();
     $userManager = new UserManager();
     while ($row = $resultSet->fetch_assoc()) {
         $losers[] = $userManager->getUser($row['bidder_id']);
     }
     return $losers;
 }
Пример #7
0
 function getPostalCode($customer_id, $address_no)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("SELECT postal_code FROM address WHERE customer_id=? AND address_no=?");
     $stmt->bind_param("si", $customer_id, $address_no);
     $stmt->execute();
     $stmt->bind_result($postal_code);
     $postalcode = '';
     while ($stmt->fetch()) {
         $postalcode = $postal_code;
     }
     $ConnectionManager->closeConnection($stmt, $conn);
     return $postalcode;
 }
Пример #8
0
 /**
  * Contructor
  * @access public
  * @param $id (int) Identificador del registro que se va a cargar. Por defecto es vac�o.
  * @return void
  */
 function AbstractEntity($id = "")
 {
     // Obtener una conexi�n a la base
     $this->_db = ConnectionManager::getConnection($this->_connection);
     // Verificar parametro
     if (!empty($id)) {
         $this->id = $id;
     }
     // Inicializar variables (vacio)
     foreach ($this->_fields as $key => $value) {
         eval('$this->$key = \'\';');
     }
     // Cargar
     if (!empty($id)) {
         $this->load($id);
     }
 }
Пример #9
0
 function getUnusedCreditListByReceiverId($receiver_id)
 {
     $creditList = [];
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("SELECT sender_id, receiver_id FROM credit_history WHERE receiver_id = ? AND status = false");
     $stmt->bind_param("s", $receiver_id);
     $stmt->execute();
     $stmt->bind_result($sender_id, $receiver_id);
     while ($stmt->fetch()) {
         $credit = [];
         $credit["sender_id"] = $sender_id;
         $credit["receiver_id"] = $receiver_id;
         array_push($creditList, $credit);
     }
     $ConnectionManager->closeConnection($stmt, $conn);
     return $creditList;
 }
Пример #10
0
 function setGift($code, $product_name, $worth, $photo)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE reward SET product_name = ? , worth = ? , photo = ? WHERE code = ?");
     $stmt->bind_param("ssss", $product_name, $worth, $photo, $code);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
Пример #11
0
 protected function setUp()
 {
     $this->connection = ConnectionManager::getConnection();
     $this->emptyDatabaseTables();
     $this->startFakemail();
 }
Пример #12
0
 function deleteProject($project_id)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("DELETE FROM project WHERE project_id = ?");
     $stmt->bind_param("s", $project_id);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
Пример #13
0
 public function reestablishConnection($close = true)
 {
     // if connection name property is null the connection manager will use the default connection
     $connection = $this->class->getStaticPropertyValue('connection', null);
     if ($close) {
         ConnectionManager::dropConnection($connection);
         static::clearCache();
     }
     return $this->conn = ConnectionManager::getConnection($connection);
 }
Пример #14
0
 function deleteAllPhotosByProduct($product_id)
 {
     $photoList = self::getPhotos($product_id);
     foreach ($photoList as $url) {
         unlink($url);
     }
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("DELETE FROM photo WHERE product_id = ?");
     $stmt->bind_param("s", $product_id);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
Пример #15
0
<?php

require_once '../lib/EventoService.php';
require_once '../lib/ConnectionManager.php';
if (!isset($_POST['crea_evento'])) {
    header('Location: http://localhost/phpday2010/web/nuovoevento.php');
}
$evento_s = new EventoService();
$evento_s->creaNuovoEvento($_POST, ConnectionManager::getConnection());
header('Location: http://localhost/phpday2010/web/nuovoevento.php?message=' . urlencode("Evento creato con successo!"));
 /**
  * @param $auctionID
  * @param $amount
  */
 public function watcherEmail($auctionID, $amount)
 {
     $connection = ConnectionManager::getConnection();
     $sql = "SELECT\n                u.email as email,\n                u.notifications as notification,\n                u.first_name as firstName,\n                a.title as title\n                FROM `user` as u\n                INNER JOIN watching as w ON\n                u.`id` = w.`user_id`\n                LEFT JOIN auction as a ON\n                w.`auction_id` = a.`id`\n                WHERE w.`auction_id` = '{$auctionID}'";
     $result = $connection->query($sql);
     if (isset($result)) {
         while ($row = $result->fetch_assoc()) {
             if ($row['notification'] == 1) {
                 $item = $row['title'];
                 $to = $row['email'];
                 $subject = 'Item, ' . $item;
                 $message = '<html><body>';
                 $message .= '<h3>Hi ' . $row['firstName'] . '!</h3>';
                 $message .= '<h4> Just to let you know there is a new highest bid on ' . $item . ' of £' . $amount . '.</h4>';
                 $message .= "<p><br>Best regards,<br>The BidBucket Team</p>";
                 $message .= "</body></html>";
                 $this->sendEmail($to, $subject, $message);
             }
         }
     }
 }
Пример #17
0
 function checkProductPendingOrderStatus($product_id)
 {
     $result = 0;
     $ConnectionMgr = new ConnectionManager();
     $conn = $ConnectionMgr->getConnection();
     $stmt = $conn->prepare("SELECT COUNT(*) AS count FROM `order` where `product_id` = ? AND `status` = 'pending'");
     $stmt->bind_param("s", $product_id);
     $stmt->execute();
     $stmt->bind_result($count);
     while ($stmt->fetch()) {
         $result = $count;
     }
     $ConnectionMgr->closeConnection($stmt, $conn);
     return $result;
 }
Пример #18
0
 /**
  * Genera el rollback de la transacción actual
  * 
  * @access protected
  * @return void
  */
 function tearDown()
 {
     $db = ConnectionManager::getConnection();
     $db->rollback();
 }
Пример #19
0
 function updateColorInOptionalCodeTable($product_id, $new_color, $old_color)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE optional_code SET color = ? WHERE product_id = ? AND color = ?");
     $stmt->bind_param("sss", $new_color, $product_id, $old_color);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
Пример #20
0
    <!--[if lt IE 8]><link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->

    <link rel="stylesheet" href="./css/main.css" type="text/css" />

  </head>
    <body>
    <div class="container">
        <div class="span-24 header ">
            <h2 class="prepend-1">Testare l'ignoto</h2>
        </div>
        <hr/>
        <?php 
$es = new EventoService();
?>
        <?php 
$eventi = $es->retrieveEventi(ConnectionManager::getConnection());
?>
        <div class="span-17 prepend-1 colborder">
            <?php 
foreach ($eventi as $evento) {
    ?>
            <div class="evento span-17">
              <h3><?php 
    echo $evento['titolo'];
    ?>
</h3>
              <p>Descrizione: <?php 
    echo $evento['descrizione'];
    ?>
</p>
              <p>Data inizio: <?php 
Пример #21
0
<?php

define("BASE_DIR_RELATIVO", "../");
define("BASE_DIR", realpath(BASE_DIR_RELATIVO) . "/");
include_once BASE_DIR . "comun/defines_app.php";
include_once BASE_DIR . "ionix/config/ionix-config.php";
include_once BASE_DIR . "ionix/data/Db.php";
include_once BASE_DIR . "ionix/data/DbMySql.php";
include_once BASE_DIR . "ionix/data/ConnectionManager.php";
include_once BASE_DIR . "ionix/data/AbstractEntity.php";
include_once BASE_DIR . "ionix/data/AbstractDAO.php";
// Obtener una conexión a la base
$db = ConnectionManager::getConnection('');
$mensaje_resultado = '';
$mensaje_error = '';
if (!empty($_GET['idMota']) && isset($_GET['idMota'])) {
    if (!empty($_GET['enviar_estado']) && isset($_GET['enviar_estado'])) {
        if ($_GET['estado'] == CONST_EN_USO) {
            // ENCENDER
            // Se actualiza el estado de la mota
            $str_sql = 'UPDATE `dispositivo` SET `estado`=\'' . CONST_EN_USO . '\' WHERE `id`=\'' . $_GET['idMota'] . '\' LIMIT 1;';
            $db->leer($str_sql);
            $mensaje_resultado .= 'Operación de encendido de Mota "' . $_GET['idMota'] . '" recibida<br/>';
        } else {
            if ($_GET['estado'] == CONST_APAGADO) {
                // APAGAR
                // Se actualiza el estado de la mota
                $str_sql = 'UPDATE `dispositivo` SET `estado`=\'' . CONST_APAGADO . '\' WHERE `id`=\'' . $_GET['idMota'] . '\' LIMIT 1;';
                $db->leer($str_sql);
                $mensaje_resultado .= 'Operación de apagado de Mota "' . $_GET['idMota'] . '" recibida<br/>';
            } else {
 /**
  * Method to check email already exists or not
  *
  * @param $email
  */
 public function checkEmailExistence($favouriteBO)
 {
     try {
         $connection = new ConnectionManager();
         $link = $connection->getConnection();
         $email_id = $favouriteBO->getEmailId();
         // Fetch Query for debtorData table
         $query = "SELECT id FROM favourite WHERE email_id='{$email_id}'";
         $result = mysql_query($query, $link);
         $success = mysql_fetch_assoc($result);
         $xid = intval($success['id']);
         if ($xid) {
             return $xid;
         } else {
             return NULL;
         }
     } catch (Exception $e) {
         throw new Exception("[MESSAGE:" . $e->getMessage() . "]<br />[CLASS:debtorDAO][FUNCTION:saveDebtor]");
     }
 }
Пример #23
0
 function updateSpecificPhoto($project_id, $photo_no, $new_url)
 {
     $url = self::getSpecificPhotoURL($project_id, $photo_no);
     unlink($url);
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE photo SET photo_url=? WHERE project_id=? AND photo_no=?");
     $stmt->bind_param("sss", $new_url, $project_id, $photo_no);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
Пример #24
0
 function activateAccount($customer_id)
 {
     $verified = "true";
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE customer SET verified=? WHERE customer_id = ?");
     $stmt->bind_param("ss", $verified, $customer_id);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }