<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
public $texte;
public $pmin;
public $pmax;
- public $peremption;
+ public $expiration;
public $comment;
public $imgtype;
// }}}
// {{{ constructor
- public function __construct($_titre, $_texte, $_pmin, $_pmax, $_peremption, $_comment, User &$_user, PlUpload &$upload = null)
+ public function __construct($_titre, $_texte, $_pmin, $_pmax, $_expiration, $_comment, User $_user, PlUpload $upload = null)
{
parent::__construct($_user, false, 'evts');
$this->titre = $_titre;
$this->texte = $_texte;
$this->pmin = $_pmin;
$this->pmax = $_pmax;
- $this->peremption = $_peremption;
+ $this->expiration = $_expiration;
$this->comment = $_comment;
if ($upload) {
$this->readImage($upload);
// }}}
// {{{ function readImage()
- private function readImage(PlUpload &$upload)
+ private function readImage(PlUpload $upload)
{
if ($upload->exists() && $upload->isType('image')) {
list($this->imgx, $this->imgy, $this->imgtype) = $upload->imageInfo();
$this->texte = Env::v('texte');
$this->pmin = Env::i('promo_min');
$this->pmax = Env::i('promo_max');
- $this->peremption = Env::v('peremption');
+ $this->expiration = Env::v('expiration');
if (@$_FILES['image']['tmp_name']) {
$upload = PlUpload::get($_FILES['image'], S::user()->login(), 'event');
if (!$upload) {
public function commit()
{
- if (XDB::execute("INSERT INTO evenements
- SET user_id = {?}, creation_date=NOW(), titre={?}, texte={?},
- peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide,wiki')",
+ /* TODO: refines this filter on promotions by using userfilter. */
+ if (XDB::execute("INSERT INTO announces
+ SET uid = {?}, creation_date=NOW(), titre={?}, texte={?},
+ expiration={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide,wiki')",
$this->user->id(), $this->titre, $this->texte,
- $this->peremption, $this->pmin, $this->pmax)) {
+ $this->expiration, $this->pmin, $this->pmax)) {
$eid = XDB::insertId();
if ($this->img) {
- XDB::execute("INSERT INTO evenements_photo
+ XDB::execute("INSERT INTO announce_photos
SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
XDB::insertId(), $this->imgtype, $this->imgx, $this->imgy, $this->img);
}
$globals->banana->event_reply,
$this->titre, MiniWiki::wikiToText($this->texte, false, 0, 80));
if ($post != -1) {
- XDB::execute("UPDATE evenements
+ XDB::execute("UPDATE announces
SET creation_date = creation_date, post_id = {?}
WHERE id = {?}", $post, $eid);
}