Пример #1
0
 $faqsession->userTracking("save_comment", $id);
 $commentData = array('record_id' => $id, 'type' => $type, 'username' => $user, 'usermail' => $mail, 'comment' => nl2br($comment), 'date' => $_SERVER['REQUEST_TIME'], 'helped' => '');
 if ($faq->addComment($commentData)) {
     $emailTo = $faqconfig->get('main.administrationMail');
     $urlToContent = '';
     if ('faq' == $type) {
         $faq->getRecord($id);
         if ($faq->faqRecord['email'] != '') {
             $emailTo = $faq->faqRecord['email'];
         }
         $_faqUrl = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, 0, $faq->faqRecord['id'], $faq->faqRecord['lang']);
         $oLink = new PMF_Link(PMF_Link::getSystemUri() . '?' . $_faqUrl);
         $oLink->itemTitle = $faq->faqRecord['title'];
         $urlToContent = $oLink->toString();
     } else {
         $oNews = new PMF_News();
         $news = $oNews->getNewsEntry($id);
         if ($news['authorEmail'] != '') {
             $emailTo = $news['authorEmail'];
         }
         $oLink = new PMF_Link(PMF_Link::getSystemUri() . '?action=news&newsid=' . $news['id'] . '&newslang=' . $news['lang']);
         $oLink->itemTitle = $news['header'];
         $urlToContent = $oLink->toString();
     }
     $commentMail = 'User: '******'username'] . ', mailto:' . $commentData['usermail'] . "\n" . 'New comment posted on: ' . $urlToContent . "\n\n" . wordwrap($comment, 72);
     $mail = new PMF_Mail();
     $mail->unsetFrom();
     $mail->setFrom($commentData['usermail']);
     $mail->addTo($emailTo);
     // Let the category owner get a copy of the message
     if ($emailTo != $faqconfig->get('main.administrationMail')) {
Пример #2
0
 * @author    Thorsten Rinne <*****@*****.**>
 * @author    Matteo Scaramuccia <*****@*****.**>
 * @copyright 2003-2014 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
 * @link      http://www.phpmyfaq.de
 * @since     2003-02-23
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    $protocol = 'http';
    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
        $protocol = 'https';
    }
    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$news = new PMF_News($faqConfig);
if ('addnews' == $action && $user->perm->checkRight($user->getUserId(), "addnews")) {
    $twig->loadTemplate('news/add.twig')->display(array('PMF_LANG' => $PMF_LANG, 'languageSelector' => PMF_Language::selectLanguages($LANGCODE, false, array(), 'langTo'), 'userDisplayName' => $user->getUserData('display_name'), 'userEmail' => $user->getUserData('email')));
} elseif ('news' == $action && $user->perm->checkRight($user->getUserId(), "editnews")) {
    $date = new PMF_Date($faqConfig);
    $newsHeader = $news->getNewsHeader();
    foreach ($newsHeader as $key => $newsItem) {
        $newsHeader[$key]['date'] = $date->format($newsItem['date']);
    }
    $twig->loadTemplate('news/list.twig')->display(array('PMF_LANG' => $PMF_LANG, 'newsHeader' => $newsHeader));
    unset($date, $newsHeader, $key, $newsItem);
} elseif ('editnews' == $action && $user->perm->checkRight($user->getUserId(), 'editnews')) {
    $id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
    $newsData = $news->getNewsEntry($id, true);
    $dateStart = $newsData['dateStart'] != '00000000000000' ? PMF_Date::createIsoDate($newsData['dateStart'], 'Y-m-d') : '';
    $dateEnd = $newsData['dateEnd'] != '99991231235959' ? PMF_Date::createIsoDate($newsData['dateEnd'], 'Y-m-d') : '';
Пример #3
0
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2006-07-23
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($db, $Language);
$comment = new PMF_Comment();
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$oNews = new PMF_News($db, $Language);
$newsId = PMF_Filter::filterInput(INPUT_GET, 'newsid', FILTER_VALIDATE_INT);
if (is_null($newsId)) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$faqsession->userTracking('news_view', $id);
// Define the header of the page
$newsMainHeader = $faqconfig->get('main.titleFAQ') . $PMF_LANG['msgNews'];
$newsFeed = '&nbsp;<a href="feed/news/rss.php" target="_blank"><img id="newsRSS" src="images/feed.png" width="16" height="16" alt="RSS" /></a>';
// Get all data from the news record
$news = $oNews->getNewsEntry($newsId);
$newsContent = $news['content'];
$newsHeader = $news['header'];
// Add Glossary entries
$oGlossary = new PMF_Glossary();
Пример #4
0
//
$Language = new PMF_Language();
$LANGCODE = $Language->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
// Preload English strings
require_once PMF_ROOT_DIR . '/lang/language_en.php';
if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) {
    // Overwrite English strings with the ones we have in the current language
    require_once PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php';
} else {
    $LANGCODE = 'en';
}
//
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
$oNews = new PMF_News();
$showArchive = false;
$active = true;
$forceConfLimit = true;
$rssData = $oNews->getLatestData($showArchive, $active, $forceConfLimit);
$num = count($rssData);
$rss = new XMLWriter();
$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgNews']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/news/rss.php'));
Пример #5
0
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * @category  phpMyFAQ
 * @package   Frontend
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2002-2012 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2002-08-23
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$news = new PMF_News($db, $Language);
$archived = PMF_Filter::filterInput(INPUT_GET, 'newsid', FILTER_VALIDATE_INT);
$writeNewsHeader = $faqconfig->get('main.titleFAQ');
if (!is_null($archived)) {
    $writeNewsHeader .= $PMF_LANG['newsArchive'];
    $writeNewsRSS = '';
    $showAllNews = sprintf('<a href="?%s">%s</a>', $sids, $PMF_LANG['newsShowCurrent']);
    $archived = true;
} else {
    $writeNewsHeader .= ' ' . $PMF_LANG['msgNews'];
    $writeNewsRSS = '&nbsp;<a href="feed/news/rss.php" target="_blank">' . '<img id="newsRSS" src="images/feed.png" width="16" height="16" alt="RSS" /></a>';
    $showAllNews = sprintf('<a href="?%snewsid=0">%s</a>', $sids, $PMF_LANG['newsShowArchive']);
}
$tpl->processTemplate('writeContent', array('writeNewsHeader' => $writeNewsHeader, 'writeNewsRSS' => $writeNewsRSS, 'writeNews' => $news->getNews($archived), 'showAllNews' => $showAllNews, 'writeNumberOfArticles' => $plr->getMsg('plmsgHomeArticlesOnline', $faq->getNumberOfRecords($LANGCODE))));
$tpl->includeTemplate('writeContent', 'index');