private function onAdd() { $form = $this->getForm(); if (false !== ($errors = $form->validate($this->module))) { return $errors . $this->templateAdd(); } $langid = $form->getVar('langid'); $title = $form->getVar('title'); $message = $form->getVar('message'); $options = GWF_News::HIDDEN; if (false === ($news = GWF_News::newNews(GWF_Time::getDate(GWF_NEWS_DATE_LEN), $form->getVar('catid'), GWF_Session::getUserID(), $langid, $title, $message, false, $options))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if ($form->getVar('newsletter') !== false) { $this->onSendNewsletter($langid, $news); # FIXME: {gizmore} method does not exist } return $this->module->message('msg_news_added'); }
public function showAccountLinkNews() { // $db = gdo_db(); // $users = GWF_TABLE_PREFIX.'user'; //// $history = GWF_TABLE_PREFIX.'wc_user_history'; // $regat = GWF_TABLE_PREFIX.'wc_regat'; // $sites = GWF_TABLE_PREFIX.'wc_site'; //// $time = GWF_Time::getTimeWeekStart(); // $today = GWF_Time::getDate(GWF_Date::LEN_DAY); // $query = // "SELECT user_name, site_name, regat_solved ". // "FROM $regat ". // "LEFT JOIN $users ON user_id=regat_uid ". // "LEFT JOIN $sites ON site_id=regat_sid ". // "WHERE regat_linkdate='$today' AND regat_solved>0"; // if (false === ($result = $db->queryAll($query))) { // return ''; // } $result = $this->getFirstLinkNews(); if (count($result) === 0) { return ''; } $msg = ''; foreach ($result as $row) { $un = $row['fili_username']; $sn = $row['fili_sitename']; // $site_link = sprintf('[url=%s]%s[/url]', GWF_WEB_ROOT, urlencode($sn), GWF_HTML::display($sn)); $site_link = sprintf('[b]%s[/b]', $sn); $perc = sprintf('%.02f', $row['fili_percent']); $profile_link = sprintf('[url=/profile/%s]%s[/url]', $un, $un); $msg .= $this->lang('newsrow_link', array($profile_link, $site_link, $perc)) . PHP_EOL; // $msg .= sprintf('%s', $this->lang('newsrow_link', sprintf('<a href="%sprofile/%s">%s</a>', GWF_WEB_ROOT, urlencode($un), GWF_HTML::display($row['fili_username'])), , )).PHP_EOL; } $title = $this->lang('newsrow_linkt'); $wechalluser = $this->cfgWeChallUser(); $english = GWF_Language::getEnglish(); $news = GWF_News::newNews(GWF_Time::getDate(GWF_Date::LEN_SECOND), 0, $wechalluser->getID(), $english->getID(), $title, $msg, true); return Module_News::displayItem($news); }