public function run() { global $platal, $globals; // Update last unread time $time = null; if (!is_null($this->params) && isset($this->params['updateall'])) { $time = intval($this->params['updateall']); $this->user->banana_last = $time; } $infos = $this->fetchProfile(); if ($infos['maj']) { $time = time(); } // Build user profile $req = XDB::query("SELECT name\n FROM forum_subs AS fs\n LEFT JOIN forums AS f ON (f.fid = fs.fid)\n WHERE uid={?}", $this->user->id()); Banana::$profile['headers']['From'] = $infos['name'] . ' <' . $infos['mail'] . '>'; Banana::$profile['headers']['Organization'] = make_Organization(); Banana::$profile['signature'] = $infos['sig']; Banana::$profile['display'] = $infos['threads']; Banana::$profile['autoup'] = $infos['maj']; Banana::$profile['lastnews'] = $this->user->banana_last; Banana::$profile['subscribe'] = $req->fetchColumn(); Banana::$tree_unread = $infos['tree_unread']; Banana::$tree_read = $infos['tree_read']; // Update the "unread limit" if (!is_null($time)) { XDB::execute('UPDATE forum_profiles SET last_seen = FROM_UNIXTIME({?}) WHERE uid = {?}', $time, $this->user->id()); if (XDB::affectedRows() == 0) { XDB::execute('INSERT IGNORE INTO forum_profiles (uid, last_seen) VALUES ({?}, FROM_UNIXTIME({?}))', $this->user->id(), $time); } } if (!empty($GLOBALS['IS_XNET_SITE'])) { Banana::$page->killPage('forums'); Banana::$page->killPage('subscribe'); Banana::$spool_boxlist = false; } else { // Register custom Banana links and tabs if (!Banana::$profile['autoup']) { Banana::$page->registerAction('<a href=\'javascript:$.dynPost("' . $platal->path . '", "updateall", ' . time() . ')\'>' . 'Marquer tous les messages comme lus' . '</a>', array('forums', 'thread', 'message')); } Banana::$page->registerPage('profile', 'Préférences', null); } // Run Bananai if (Banana::$action == 'profile') { Banana::$page->run(); return $this->action_updateProfile(); } else { return parent::run(); } }
public function run() { global $platal, $globals; $nom = S::v('prenom') . ' ' . S::v('nom'); $mail = $this->user->bestEmail(); $sig = $nom . ' (' . S::v('promo') . ')'; Banana::$msgedit_headers['X-Org-Mail'] = $this->user->forlifeEmail(); // Tree color $req = XDB::query('SELECT tree_unread, tree_read FROM forum_profiles WHERE uid= {?}', $this->user->id()); if (!(list($unread, $read) = $req->fetchOneRow())) { $unread = 'o'; $read = 'dg'; } Banana::$tree_unread = $unread; Banana::$tree_read = $read; // Build user profile Banana::$profile['headers']['From'] = "{$nom} <{$mail}>"; Banana::$profile['headers']['Organization'] = make_Organization(); Banana::$profile['signature'] = $sig; // Page design Banana::$page->killPage('forums'); Banana::$page->killPage('subscribe'); // Run Banana return parent::run(); }