public function rm()
{
@unlink($this->filename);
- clearstatcache();
+ @clearstatcache();
}
public function rename($fn)
public static function _prepare($args)
{
- $query = array_map(Array('XDB', '_db_escape'), $args);
+ $query = array_map(Array('XDB', 'escape'), $args);
$query[0] = str_replace('{?}', '%s', str_replace('%', '%%', $args[0]));
return call_user_func_array('sprintf', $query);
}
return XDB::$mysqli->affected_rows;
}
- public static function _db_escape($var)
+ public static function escape($var)
{
switch (gettype($var)) {
case 'boolean':
{
$this->user = $this->getUser($uid, $email);
$this->sender_mail = $this->getFrom($from, $sender);
- $this->engine = $this->getEngine($type, $data, $from == 'user' ? null : $this->sender);
+ $this->engine =& $this->getEngine($type, $data, $from == 'user' ? null : $this->sender);
$this->type = $type;
$this->data = $data;
}
}
- private function getEngine($type, $data, $from)
+ private function &getEngine($type, $data, $from)
{
$class = $type . 'Marketing';
if (!class_exists($class, false)) {
$class= 'DefaultMarketing';
}
- return new $class($data, $from);
+ if (!is_subclass_of($class, 'MarketingEngine')) {
+ $engine = null;
+ } else {
+ $engine = new $class($data, $from);
+ }
+ return $engine;
}
public function getTitle()
'events' => $this->make_hook('ev', AUTH_COOKIE),
'rss' => $this->make_hook('rss', AUTH_PUBLIC),
'events/preview' => $this->make_hook('preview', AUTH_PUBLIC, 'user', NO_AUTH),
- 'events/photo' => $this->make_hook('photo', AUTH_COOKIE),
+ 'events/photo' => $this->make_hook('photo', AUTH_PUBLIC),
'events/submit' => $this->make_hook('ev_submit', AUTH_MDP),
'admin/events' => $this->make_hook('admin_events', AUTH_MDP, 'admin'),
$uid = init_rss('events/rss.tpl', $user, $hash);
$rss = XDB::iterator(
- 'SELECT e.id, e.titre, e.texte, e.creation_date,
+ 'SELECT e.id, e.titre, e.texte, e.creation_date, e.post_id, p.attachmime IS NOT NULL AS photo,
IF(u2.nom_usage = "", u2.nom, u2.nom_usage) AS nom, u2.prenom, u2.promo
FROM auth_user_md5 AS u
INNER JOIN evenements AS e ON ( (e.promo_min = 0 || e.promo_min <= u.promo)
AND (e.promo_max = 0 || e.promo_max >= u.promo) )
+ LEFT JOIN evenements_photo AS p ON (p.eid = e.id)
INNER JOIN auth_user_md5 AS u2 ON (u2.user_id = e.user_id)
WHERE u.user_id = {?} AND FIND_IN_SET(e.flags, "valide")
AND peremption >= NOW()', $uid);
$page->addCssLink('profil.css');
$page->assign('xorg_title', 'Polytechnique.org - Mon Profil');
- require_once 'tabs.inc.php';
+ require_once dirname(__FILE__) . '/profile/tabs.inc.php';
require_once 'profil.func.inc.php';
require_once 'synchro_ax.inc.php';
<title>{$line.titre|strip_tags}</title>
<guid isPermaLink="false">{$line.id}</guid>
<link>{#globals.baseurl#}/events#newsid{$line.id}</link>
- <description><![CDATA[{$line.texte|nl2br}]]></description>
+ <description><![CDATA[
+ {if $line.photo}
+ <div style="float: left; padding-right: 0.5em">
+ <img src="{#globals.baseurl#}/events/photo/{$line.id}" alt="{$line.title}" />
+ </div>
+ {/if}
+ <div>{$line.texte}</div>
+ {if $line.post_id neq -1}
+ <div style="clear: both">
+ <br />
+ <a href="{#globals.baseurl#}/banana/{#globals.banana.event_reply#|default:#globals.banana.event_forum#}/read/{$line.post_id}">
+ {icon name=comments full=true} Suivre la discussion
+ </a>
+ </div>
+ {/if}
+ ]]></description>
<author>{$line.prenom} {$line.nom} (X{$line.promo})</author>
<pubDate>{$line.creation_date|rss_date}</pubDate>
</item>
$from = array();
$to = array();
foreach ($array as $key=>$value) {
- $from[] = $key . '="' . XDB::_db_escape($value) . '"';
+ $from[] = $key . '="' . XDB::escape($value) . '"';
$valued = utf8_decode($value);
if (is_utf8($value) && $valued != $value) {
- $to[] = $key . '="' . XDB::_db_escape($valued) .'"';
+ $to[] = $key . '="' . XDB::escape($valued) .'"';
}
}
if (!empty($to)) {