function buildSitemapNode($location, $lastmod = null, $changeFreq = null, $priority = null) { if (!isset($lastmod)) { $lastmod = PMF_Date::createISO8601Date($_SERVER['REQUEST_TIME'], false); } if (!isset($changeFreq)) { $changeFreq = PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY; } $node = '<url>' . '<loc>' . PMF_String::htmlspecialchars($location) . '</loc>' . '<lastmod>' . $lastmod . '</lastmod>' . '<changefreq>' . $changeFreq . '</changefreq>' . (isset($priority) ? '<priority>' . $priority . '</priority>' : '') . '</url>'; return $node; }
/** * Generates a huge array for the report * @return array */ public function getReportingData() { $report = []; $query = sprintf("\n SELECT\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n c.name as category_name,\n c.parent_id as parent_id,\n fd.sticky AS sticky,\n fd.thema AS question,\n fd.author AS original_author,\n fd.datum AS creation_date,\n fv.visits AS visits,\n u.display_name AS last_author\n FROM\n %sfaqdata fd\n LEFT JOIN\n %sfaqcategoryrelations fcr\n ON\n (fd.id = fcr.record_id AND fd.lang = fcr.record_lang)\n LEFT JOIN\n %sfaqvisits fv\n ON\n (fd.id = fv.id AND fd.lang = fv.lang)\n LEFT JOIN\n %sfaqchanges as fc\n ON\n (fd.id = fc.id AND fd.lang = fc.lang)\n LEFT JOIN\n %sfaquserdata as u\n ON\n (u.user_id = fc.usr)\n LEFT JOIN\n %sfaqcategories as c\n ON\n (c.id = fcr.category_id AND c.lang = fcr.record_lang)\n ORDER BY\n fd.id\n ASC", PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix()); $result = $this->_config->getDb()->query($query); $lastId = 0; while ($row = $this->_config->getDb()->fetchObject($result)) { if ($row->id == $lastId) { $report[$row->id]['faq_translations'] += 1; } else { $report[$row->id] = array('faq_id' => $row->id, 'faq_language' => $row->lang, 'category_id' => $row->category_id, 'category_parent' => $row->parent_id, 'category_name' => $row->category_name, 'faq_translations' => 0, 'faq_sticky' => $row->sticky, 'faq_question' => $row->question, 'faq_org_author' => $row->original_author, 'faq_creation' => PMF_Date::createIsoDate($row->creation_date), 'faq_visits' => $row->visits, 'faq_last_author' => $row->last_author); } $lastId = $row->id; } return $report; }
/** * Renders the open questions table * * @param array $questions Array of open questions */ public function renderOpenQuestions(array $questions) { global $PMF_LANG, $sids; $html = ''; if (count($questions)) { foreach ($questions as $question) { if ($question->is_visible == 'N') { continue; } $html .= '<tr class="openquestions">'; $html .= sprintf('<td valign="top" nowrap="nowrap">%s<br /><a href="mailto:%s">%s</a></td>', PMF_Date::createIsoDate($question->date), PMF_Mail::safeEmail($question->email), $question->username); $html .= sprintf('<td valign="top"><strong>%s:</strong><br />%s</td>', $this->categoryLayout->renderBreadcrumb(array($question->category_id)), strip_tags($question->question)); $html .= sprintf('<td valign="top"><a href="?%saction=add&question=%d&cat=%d">%s</a></td>', $sids, $question->id, $question->category_id, $PMF_LANG['msg2answer']); $html .= '</tr>'; } } else { $output = sprintf('<tr><td colspan="3">%s</td></tr>', $PMF_LANG['msgNoQuestionsAvailable']); } return $html; }
</p> <p> <label><?php print $PMF_LANG["ad_stat_browse"]; ?> :</label> <select name="day" size="1"> <?php foreach ($trackingDates as $trackingDate) { printf('<option value="%d"', $trackingDate); if (date("Y-m-d", $trackingDate) == strftime('%Y-%m-%d', $_SERVER['REQUEST_TIME'])) { print ' selected="selected"'; } print '>'; print PMF_Date::format(date('Y-m-d H:i', $trackingDate)); print "</option>\n"; } ?> </select> </p> <p> <input class="submit" type="submit" name="statbrowse" value="<?php print $PMF_LANG["ad_stat_ok"]; ?> " /> </p> </fieldset> </form>
<h2 class="page-header"> <i class="fa fa-pencil"></i> <?php echo $PMF_LANG['msgOpenQuestions']; ?> </h2> </div> </header> <div class="row"> <div class="col-lg-12"> <?php if ($user->perm->checkRight($user->getUserId(), 'delquestion')) { $category = new PMF_Category($faqConfig, [], false); $category->setUser($currentAdminUser); $category->setGroups($currentAdminGroups); $date = new PMF_Date($faqConfig); $questionId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $toggle = PMF_Filter::filterInput(INPUT_GET, 'is_visible', FILTER_SANITIZE_STRING); if ($toggle == 'toggle') { $is_visible = $faq->getVisibilityOfQuestion($questionId); if (!is_null($is_visible)) { $faq->setVisibilityOfQuestion($questionId, $is_visible == 'N' ? 'Y' : 'N'); } } echo '<div id="returnMessage"></div>'; $openquestions = $faq->getAllOpenQuestions(); if (count($openquestions) > 0) { ?> <form id="questionSelection" name="questionSelection" method="post" accept-charset="utf-8"> <table class="table table-striped"> <thead>
?> </h2> <h3><strong><em><?php print $categorylist; ?> </em> <?php print $question; ?> </strong></h3> <?php print html_entity_decode($content); ?> <p class="little"><?php print $PMF_LANG["msgLastUpdateArticle"] . PMF_Date::createIsoDate(date("YmdHis")); ?> <br /> <?php print $PMF_LANG["msgAuthor"] . ' ' . $author; ?> </p> <form action="?action=editpreview" method="post"> <input type="hidden" name="id" value="<?php print $record_id; ?> " /> <input type="hidden" name="thema" value="<?php print $question; ?>
?> ?</th> <th><?php print $PMF_LANG['ad_gen_delete']; ?> ?</th> </tr> </thead> <tbody> <?php foreach ($openquestions as $question) { ?> <tr> <td> <?php print PMF_Date::format(PMF_Date::createIsoDate($question['created'])); ?> <br /> <a href="mailto:<?php print $question['email']; ?> "> <?php print $question['username']; ?> </a> </td> <td> <?php print $category->categoryName[$question['category_id']]['name']; ?>
/** * Fetches a news entry identified by its ID * * @param integer $id ID of news * @param boolean $admin Is admin * * @return array */ function getNewsEntry($id, $admin = false) { $news = array(); $query = sprintf("SELECT\n *\n FROM\n %sfaqnews\n WHERE\n id = %d\n AND\n lang = '%s'", SQLPREFIX, $id, $this->language); $result = $this->db->query($query); if ($this->db->numRows($result) > 0) { if ($row = $this->db->fetchObject($result)) { $content = $row->artikel; $active = 'y' == $row->active; $allowComments = 'y' == $row->comment; $expired = date('YmdHis') > $row->date_end; if (!$admin) { if (!$active) { $content = $this->pmf_lang['err_inactiveNews']; } if ($expired) { $content = $this->pmf_lang['err_expiredNews']; } } $news = array('id' => $row->id, 'lang' => $row->lang, 'date' => PMF_Date::createIsoDate($row->datum), 'header' => $row->header, 'content' => $content, 'authorName' => $row->author_name, 'authorEmail' => $row->author_email, 'dateStart' => $row->date_start, 'dateEnd' => $row->date_end, 'active' => $active, 'allowComments' => $allowComments, 'link' => $row->link, 'linkTitle' => $row->linktitel, 'target' => $row->target); } } return $news; }
/** * Generates the export * * @param integer $categoryId Category Id * @param boolean $downwards If true, downwards, otherwise upward ordering * @param string $language Language * * @return string */ public function generate($categoryId = 0, $downwards = true, $language = '') { global $PMF_LANG; // Set PDF options $this->pdf->enableBookmarks = true; $this->pdf->isFullExport = true; $filename = 'FAQs.pdf'; // Initialize categories $this->category->transform($categoryId); $this->pdf->setCategory($categoryId); $this->pdf->setCategories($this->category->categoryName); $this->pdf->SetCreator($this->_config->get('main.titleFAQ') . ' - powered by phpMyFAQ ' . $this->_config->get('main.currentVersion')); $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XML, $categoryId, $downwards, $language); $categories = $this->category->catTree; $categoryGroup = 0; $this->pdf->AddPage(); foreach ($categories as $category) { if ($category['id'] !== $categoryGroup) { $this->pdf->Bookmark(html_entity_decode($this->category->categoryName[$category['id']]['name'], ENT_QUOTES, 'utf-8'), $category['level'], 0); $categoryGroup = $category['id']; } foreach ($faqdata as $faq) { if ($faq['category_id'] === $category['id']) { $this->pdf->AddPage(); $this->pdf->setCategory($category['id']); $this->pdf->Bookmark(html_entity_decode($faq['topic'], ENT_QUOTES, 'utf-8'), $category['level'] + 1, 0); if ($this->tags instanceof PMF_Tags) { $tags = $this->tags->getAllTagsById($faq['id']); } $this->pdf->WriteHTML('<h2 align="center">' . $faq['topic'] . '</h2>', true); $this->pdf->Ln(10); $this->pdf->SetFont($this->pdf->getCurrentFont(), '', 12); $this->pdf->WriteHTML(trim($faq['content'])); $this->pdf->Ln(10); if (!empty($faq['keywords'])) { $this->pdf->Ln(); $this->pdf->Write(5, $PMF_LANG['msgNewContentKeywords'] . ' ' . $faq['keywords']); } if (isset($tags) && 0 !== count($tags)) { $this->pdf->Ln(); $this->pdf->Write(5, $PMF_LANG['ad_entry_tags'] . ': ' . implode(', ', $tags)); } $this->pdf->Ln(); $this->pdf->Ln(); $this->pdf->Write(5, $PMF_LANG['msgLastUpdateArticle'] . PMF_Date::createIsoDate($faq['lastmodified'])); } } } // remove default header/footer $this->pdf->setPrintHeader(false); $this->pdf->addFaqToc(); return $this->pdf->Output($filename); }
<?php print $PMF_LANG['ad_entry_changelog_history']; ?> </a> </legend> <div id="editChangelogHistory" style="display: none;"> <?php $changeEntries = $faq->getChangeEntries($faqData['id']); foreach ($changeEntries as $entry) { $user->getUserById($entry['user']); ?> <p style="font-size: 10px;"> <label> <?php printf('%s 1.%d<br/>%s<br/>%s: %s', $PMF_LANG['ad_entry_revision'], $entry['revision_id'], PMF_Date::format(date('Y-m-d H:i', $entry['date'])), $PMF_LANG['ad_entry_author'], $user->getUserData('display_name')); ?> </label> <?php print $entry['changelog']; ?> </p> <?php } ?> </div> </fieldset> </form> <script type="text/javascript">
$rss->writeElement('description', html_entity_decode($faqConfig->get('main.metaDescription'))); $rss->writeElement('link', $faqConfig->get('main.referenceURL')); $rss->startElementNS('atom', 'link', 'http://www.w3.org/2005/Atom'); $rss->writeAttribute('rel', 'self'); $rss->writeAttribute('type', 'application/rss+xml'); $rss->writeAttribute('href', $faqConfig->get('main.referenceURL') . 'feed/openquestions/rss.php'); $rss->endElement(); if ($num > 0) { $counter = 0; foreach ($rssData as $item) { if ($counter < PMF_RSS_OPENQUESTIONS_MAX) { $counter++; $rss->startElement('item'); $rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['question'], ENT_COMPAT, 'UTF-8'), 8) . " (" . $item['username'] . ")"); $rss->startElement('description'); $rss->writeCdata($item['question']); $rss->endElement(); $rss->writeElement('link', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER['SCRIPT_NAME']) . "?action=open#openq_" . $item['id']); $rss->writeElement('guid', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER['SCRIPT_NAME']) . "?action=open#openq_" . $item['id']); $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['created'], true)); $rss->endElement(); } } } $rss->endElement(); $rss->endElement(); $rssData = $rss->outputMemory(); $headers = array('Content-Type: application/rss+xml', 'Content-Length: ' . strlen($rssData)); $http = new PMF_Helper_Http(); $http->sendWithHeaders($rssData, $headers); $faqConfig->getDb()->close();
print str_replace("\"", "´", $record['title']); ?> '"> <?php print $record['title']; ?> </a> <?php if (isset($numCommentsByFaq[$record['id']])) { printf('<br/>(<a href="?action=comments#record_id_%d">%d %s</a>)', $record['id'], $numCommentsByFaq[$record['id']], $PMF_LANG['ad_start_comments']); } ?> </td> <td style="width: 48px;"> <?php print PMF_Date::format($record['date']); ?> </td> <td style="width: 96px;"> <?php print $linkverifier->getEntryStateHTML($record['id'], $record['lang']); ?> </td> <td style="width: 16px;"> <a href="javascript:void(0);" onclick="javascript:deleteRecord(<?php print $record['id']; ?> , '<?php print $record['lang']; ?>
$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['msgOpenQuestions']); $rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription'))); $rss->writeElement('link', PMF_Link::getSystemUri('/feed/openquestions/rss.php')); if ($num > 0) { $counter = 0; foreach ($rssData as $item) { if ($counter < PMF_RSS_OPENQUESTIONS_MAX) { $counter++; $rss->startElement('item'); $rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item->question), 8) . " (" . $item->username . ")"); $rss->startElement('description'); $rss->writeCdata($item->question); $rss->endElement(); $rss->writeElement('link', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER["PHP_SELF"]) . "?action=open#openq_" . $item->id); $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item->date, true)); $rss->endElement(); } } } $rss->endElement(); $rss->endElement(); $rssData = $rss->outputMemory(); header('Content-Type: application/rss+xml'); header('Content-Length: ' . strlen($rssData)); print $rssData; $db->dbclose();
?> ?</th> <th><?php print $PMF_LANG['ad_gen_delete']; ?> ?</th> </tr> </thead> <tbody> <?php foreach ($openQuestions as $question) { ?> <tr> <td> <?php print PMF_Date::createIsoDate($question->date); ?> <br /> <a href="mailto:<?php print $question->email; ?> "><?php print $question->username; ?> </a> </td> <td> <?php print $categoryLayout->renderBreadcrumb($categoryData->getPath($question->category_id)); ?> :<br />
while (list($dummy, $dummy, $dummy, $dummy, $dummy, $dummy, $dummy, $tstamp) = fgetcsv($fp, 1024, ";")) { $stamp = $tstamp; } fclose($fp); if (empty($stamp)) { $stamp = $_SERVER['REQUEST_TIME']; } print date("d.m.Y H:i:s", $stamp) . '<br />'; } else { print $PMF_LANG["ad_sess_noentry"] . '<br />'; } $dir = opendir(PMF_ROOT_DIR . "/data"); $trackingDates = array(); while (false !== ($dat = readdir($dir))) { if ($dat != "." && $dat != ".." && strlen($dat) == 16 && !is_dir($dat)) { $trackingDates[] = PMF_Date::getTrackingFileDate($dat); } } closedir($dir); sort($trackingDates); ?> <label class="left"><?php print $PMF_LANG["ad_stat_browse"]; ?> :</label> <select name="day" size="1"> <?php foreach ($trackingDates as $trackingDate) { printf('<option value="%d"', $trackingDate); if (date("Y-m-d", $trackingDate) == strftime('%Y-%m-%d', $_SERVER['REQUEST_TIME'])) { print ' selected="selected"';
} header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } if (($permission['editbt'] || $permission['addbt']) && !PMF_Db::checkOnEmptyTable('faqcategories')) { $category = new PMF_Category($faqConfig, array(), false); $category->setUser($currentAdminUser); $category->setGroups($currentAdminGroups); $category->buildTree(); $categoryHelper = new PMF_Helper_Category(); $categoryHelper->setCategory($category); $selectedCategory = ''; $categories = array(); $faqData = array('id' => 0, 'lang' => $LANGCODE, 'revision_id' => 0, 'title' => '', 'dateStart' => '', 'dateEnd' => ''); $tagging = new PMF_Tags($faqConfig); $date = new PMF_Date($faqConfig); if ('takequestion' === $action) { $questionId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $question = $faq->getQuestion($questionId); $selectedCategory = $question['category_id']; $faqData['title'] = $question['question']; $notifyUser = $question['username']; $notifyEmail = $question['email']; $categories = array('category_id' => $selectedCategory, 'category_lang' => $faqData['lang']); } else { $questionId = 0; $notifyUser = ''; $notifyEmail = ''; } if ('editpreview' === $action) { $faqData['id'] = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT);
$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') : ''; $newsId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $oComment = new PMF_Comment($faqConfig); $comments = $oComment->getCommentsData($newsId, PMF_Comment::COMMENT_TYPE_NEWS); foreach ($comments as $item) { $item['date'] = PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false); } $twig->loadTemplate('news/edit.twig')->display(array('PMF_LANG' => $PMF_LANG, 'comments' => $comments, 'commentType' => PMF_Comment::COMMENT_TYPE_NEWS, 'dateEnd' => $dateEnd, 'dateStart' => $dateStart, 'languageSelector' => PMF_Language::selectLanguages($newsData['lang'], false, array(), 'langTo'), 'newsData' => $newsData)); } elseif ('savenews' == $action && $user->perm->checkRight($user->getUserId(), "addnews")) { $dateStart = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING); $dateEnd = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING); $header = PMF_Filter::filterInput(INPUT_POST, 'newsheader', FILTER_SANITIZE_STRIPPED); $content = PMF_Filter::filterInput(INPUT_POST, 'news', FILTER_SANITIZE_SPECIAL_CHARS); $author = PMF_Filter::filterInput(INPUT_POST, 'authorName', FILTER_SANITIZE_STRIPPED); $email = PMF_Filter::filterInput(INPUT_POST, 'authorEmail', FILTER_VALIDATE_EMAIL); $active = PMF_Filter::filterInput(INPUT_POST, 'active', FILTER_SANITIZE_STRING); $comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRING); $link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL); $linktitle = PMF_Filter::filterInput(INPUT_POST, 'linkTitle', FILTER_SANITIZE_STRIPPED); $newslang = PMF_Filter::filterInput(INPUT_POST, 'langTo', FILTER_SANITIZE_STRING); $target = PMF_Filter::filterInput(INPUT_POST, 'target', FILTER_SANITIZE_STRIPPED);
/** * Generates the export * * @param integer $categoryId Category Id * @param boolean $downwards If true, downwards, otherwise upward ordering * @param string $language Language * * @return string */ public function generate($categoryId = 0, $downwards = true, $language = '') { // Initialize categories $this->category->transform($categoryId); $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XML, $categoryId, $downwards, $language); $version = $this->_config->get('main.currentVersion'); $comment = sprintf('XML output by phpMyFAQ %s | Date: %s', $version, PMF_Date::createIsoDate(date("YmdHis"))); $this->xml->startDocument('1.0', 'utf-8', 'yes'); $this->xml->writeComment($comment); $this->xml->startElement('phpmyfaq'); if (count($faqdata)) { foreach ($faqdata as $data) { // Build the <article/> node $this->xml->startElement('article'); $this->xml->writeAttribute('id', $data['id']); $this->xml->writeElement('language', $data['lang']); $this->xml->writeElement('category', $this->category->getPath($data['category_id'], ' >> ')); if (!empty($data['keywords'])) { $this->xml->writeElement('keywords', $data['keywords']); } else { $this->xml->writeElement('keywords'); } $this->xml->writeElement('question', strip_tags($data['topic'])); $this->xml->writeElement('answer', PMF_String::htmlspecialchars($data['content'])); if (!empty($data['author_name'])) { $this->xml->writeElement('author', $data['author_name']); } else { $this->xml->writeElement('author'); } $this->xml->writeElement('data', PMF_Date::createIsoDate($data['lastmodified'])); $this->xml->endElement(); } } $this->xml->endElement(); header('Content-type: text/xml'); return $this->xml->outputMemory(); }
continue; } $counter++; if ($counter <= $start) { continue; } $displayedCounter++; $user->getUserById($logging_value['usr']); ?> <tr class="cell"> <td class="list"><?php print $logging_id; ?> </td> <td class="list"><?php print PMF_Date::format(date('Y-m-d H:i', $logging_value['time'])); ?> </td> <td class="list"><?php print $user->getLogin(); ?> </td> <td class="list"><?php print $logging_value['ip']; ?> </td> </tr> <tr class="cell"> <td colspan="4" class="list"><?php $text = $logging_value['text']; $text = str_replace("Loginerror", $PMF_LANG["ad_log_lger"], $text);
$rss->writeElement('title', $faqConfig->get('main.titleFAQ') . ' - '); $rss->writeElement('description', html_entity_decode($faqConfig->get('main.metaDescription'))); $rss->writeElement('link', $faqConfig->get('main.referenceURL')); if (is_array($records)) { foreach ($records as $item) { $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['record_link']); if (PMF_RSS_USE_SEO) { if (isset($item['record_title'])) { $oLink = new PMF_Link($link, $faqConfig); $oLink->itemTitle = $item['record_title']; $link = $oLink->toString(); } } $rss->startElement('item'); $rss->writeElement('title', html_entity_decode($item['record_title'] . ' (' . $item['visits'] . ' ' . $PMF_LANG['msgViews'] . ')', ENT_COMPAT, 'UTF-8')); $rss->startElement('description'); $rss->writeCdata($item['record_preview']); $rss->endElement(); $rss->writeElement('link', $faqConfig->get('main.referenceURL') . $link); $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['record_date'], true)); $rss->endElement(); } } $rss->endElement(); $rss->endElement(); $rssData = $rss->outputMemory(); $response = Response::create($rssData); $response->headers->set('Content-Type', 'application/rss+xml'); $response->headers->set('Content-Length', strlen($rssData)); $response->send(); $faqConfig->getDb()->close();
$search->setDatabaseHandle($db)->setTable($fdTable)->setResultColumns(array($fdTable . '.id AS id', $fdTable . '.lang AS lang', $fdTable . '.solution_id AS solution_id', $fcrTable . '.category_id AS category_id', $fdTable . '.sticky AS sticky', $fdTable . '.active AS active', $fdTable . '.thema AS thema', $fdTable . '.content AS content', $fdTable . '.datum AS date'))->setJoinedTable($fcrTable)->setJoinedColumns(array($fdTable . '.id = ' . $fcrTable . '.record_id', $fdTable . '.lang = ' . $fcrTable . '.record_lang')); if (is_numeric($searchterm)) { $search->setMatchingColumns(array($fdTable . '.solution_id')); } else { $search->setMatchingColumns(array($fdTable . '.thema', $fdTable . '.content', $fdTable . '.keywords')); } $result = $search->search($searchterm); // @todo add missing ordering! $laction = 'view'; $internalSearch = '&search=' . $searchterm; $wasSearch = true; while ($row = $db->fetchObject($result)) { if ($searchcat != 0 && $searchcat != (int) $row->category_id) { continue; } $faq->faqRecords[] = array('id' => $row->id, 'category_id' => $row->category_id, 'solution_id' => $row->solution_id, 'lang' => $row->lang, 'active' => $row->active, 'sticky' => $row->sticky, 'title' => $row->thema, 'content' => $row->content, 'date' => PMF_Date::createIsoDate($row->date)); if (!isset($numActiveByCat[$row->category_id])) { $numActiveByCat[$row->category_id] = 0; } $numActiveByCat[$row->category_id] += $row->active ? 1 : 0; } } $num = count($faq->faqRecords); if ($num > 0) { $old = 0; $all_ids = $visits = array(); foreach (PMF_Visits::getInstance()->getAllData() as $visit) { $visits[$visit['id']] = $visit['lang']; } foreach ($faq->faqRecords as $record) { $catInfo = '';
print $PMF_LANG['ad_sess_session']; ?> </th> </tr> </thead> <tbody> <?php foreach ($sessiondata as $sid => $data) { ?> <tr> <td><?php print $data['ip']; ?> </td> <td><?php print PMF_Date::format(date("Y-m-d H:i", $data['time'])); ?> </td> <td><a href="?action=viewsession&id=<?php print $sid; ?> "><?php print $sid; ?> </a></td> </tr> <?php } ?> </tbody> </table>
/** * Returns all user comments (HTML formatted) from a record by type * * @todo Move this code to a helper class * * @param integer $id Comment ID * @param integer $type Comment type: {faq|news} * * @return string */ public function getComments($id, $type) { $comments = $this->getCommentsData($id, $type); $output = ''; foreach ($comments as $item) { $output .= '<p class="comment">'; $output .= '<img src="images/bubbles.gif" />'; $output .= sprintf('<strong>%s<a href="mailto:%s">%s</a>:</strong><br />%s<br />%s</p>', $this->pmf_lang['msgCommentBy'], PMF_Mail::safeEmail($item['email']), $item['user'], nl2br($item['content']), $this->pmf_lang['newsCommentDate'] . PMF_Date::format(PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false))); } return $output; }
$newsHeader = $news['header']; // Add Glossary entries $oGlossary = new PMF_Glossary(); $newsContent = $oGlossary->insertItemsIntoContent($newsContent); $newsHeader = $oGlossary->insertItemsIntoContent($newsHeader); // Add information link if existing if (strlen($news['link']) > 0) { $newsContent .= sprintf('</p><p>%s<a href="%s" target="%s">%s</a>', $PMF_LANG['msgInfo'], $news['link'], $news['target'], $news['linkTitle']); } // Show link to edit the news? $editThisEntry = ''; if (isset($permission['editnews'])) { $editThisEntry = sprintf('<a href="%sadmin/index.php?action=news&do=edit&id=%d">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $newsId, $PMF_LANG['ad_menu_news_edit']); } // Is the news item expired? $expired = date('YmdHis') > $news['dateEnd']; // Does the user have the right to add a comment? if (!$news['active'] || !$news['allowComments'] || $expired) { $commentMessage = $PMF_LANG['msgWriteNoComment']; } else { $commentMessage = sprintf('<a href="javascript:void(0);" onclick="javascript:$(\'#commentForm\').show();">%s</a>', $PMF_LANG['newsWriteComment']); } // date of news entry if ($news['active'] && !$expired) { $newsDate = sprintf('%s<span id="newsLastUpd">%s</span>', $PMF_LANG['msgLastUpdateArticle'], PMF_Date::format($news['date'])); } else { $newsDate = ''; } // Set the template variables $tpl->processTemplate('writeContent', array('writeNewsHeader' => $newsMainHeader, 'writeNewsRSS' => $newsFeed, 'writeHeader' => $newsHeader, 'writeContent' => $newsContent, 'writeDateMsg' => $newsDate, 'writeAuthor' => $news['active'] && !$expired ? $PMF_LANG['msgAuthor'] . ': ' . $news['authorName'] : '', 'editThisEntry' => $editThisEntry, 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['newsWriteComment'], 'newsId' => $newsId, 'newsLang' => $news['lang'], 'msgCommentHeader' => $PMF_LANG['msgCommentHeader'], 'msgNewContentName' => $PMF_LANG['msgNewContentName'], 'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgYourComment' => $PMF_LANG['msgYourComment'], 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit'], 'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderCaptcha($captcha, 'writecomment', $PMF_LANG['msgCaptcha']), 'writeComments' => $comment->getComments($newsId, PMF_Comment::COMMENT_TYPE_NEWS))); $tpl->includeTemplate('writeContent', 'index');
* @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; } $logging = new PMF_Logging($faqConfig); if ($user->perm->checkRight($user->getUserId(), 'adminlog') && 'adminlog' == $action) { $date = new PMF_Date($faqConfig); $perpage = 15; $pages = PMF_Filter::filterInput(INPUT_GET, 'pages', FILTER_VALIDATE_INT); $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 1); if (is_null($pages)) { $pages = round(($logging->getNumberOfEntries() + $perpage / 3) / $perpage, 0); } $start = ($page - 1) * $perpage; $ende = $start + $perpage; $baseUrl = sprintf('%s?action=adminlog&page=%d', PMF_Link::getSystemRelativeUri(), $page); // Pagination options $options = array('baseUrl' => $baseUrl, 'total' => $logging->getNumberOfEntries(), 'perPage' => $perpage, 'pageParamName' => 'page'); $pagination = new PMF_Pagination($faqConfig, $options); $loggingData = $logging->getAll(); ?> <header>
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php')); if ($num > 0) { $i = 0; foreach ($rssData as $item) { $i++; // Get the url $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']); if (PMF_RSS_USE_SEO) { if (isset($item['thema'])) { $oLink = new PMF_Link($link); $oLink->itemTitle = html_entity_decode($item['thema'], ENT_COMPAT, 'UTF-8'); $link = html_entity_decode($oLink->toString(), ENT_COMPAT, 'UTF-8'); } } $rss->startElement('item'); $rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['thema'], ENT_COMPAT, 'UTF-8'), 8) . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"); $rss->startElement('description'); $rss->writeCdata("[" . $i . ".] " . $item['thema'] . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"); $rss->endElement(); $rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php') . $link); $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['last_visit'], false)); $rss->endElement(); } } $rss->endElement(); $rss->endElement(); $rssData = $rss->outputMemory(); header('Content-Type: application/rss+xml'); header('Content-Length: ' . strlen($rssData)); print $rssData; $db->dbclose();
/** * Generates the export * * @param integer $categoryId Category Id * @param boolean $downwards If true, downwards, otherwise upward ordering * @param string $language Language * * @return string */ public function generate($categoryId = 0, $downwards = true, $language = '') { global $PMF_LANG; // Initialize categories $this->category->transform($categoryId); $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XHTML, $categoryId, $downwards, $language); $version = $this->_config->get('main.currentVersion'); $comment = sprintf('XHTML output by phpMyFAQ %s | Date: %s', $version, PMF_Date::createIsoDate(date("YmdHis"))); $this->xml->startDocument('1.0', 'utf-8'); $this->xml->writeDtd('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'); $this->xml->startElement('html'); $this->xml->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); $this->xml->writeAttribute('xml:lang', $language); $this->xml->writeComment($comment); $this->xml->startElement('head'); $this->xml->writeElement('title', $this->_config->get('main.titleFAQ')); $this->xml->startElement('meta'); $this->xml->writeAttribute('http-equiv', 'Content-Type'); $this->xml->writeAttribute('content', 'application/xhtml+xml; charset=utf-8'); $this->xml->endElement(); $this->xml->endElement(); // </head> $this->xml->startElement('body'); $this->xml->writeAttribute('dir', $PMF_LANG['dir']); if (count($faqdata)) { $lastCategory = 0; foreach ($faqdata as $data) { if ($data['category_id'] != $lastCategory) { $this->xml->writeElement('h1', $this->category->getPath($data['category_id'], ' >> ')); } $this->xml->writeElement('h2', strip_tags($data['topic'])); $this->xml->startElement('p'); $this->xml->writeCdata(html_entity_decode($data['content'], ENT_QUOTES, 'UTF-8')); $this->xml->endElement(); $this->xml->writeElement('p', $PMF_LANG['msgAuthor'] . ': ' . $data['author_email']); $this->xml->writeElement('p', $PMF_LANG['msgLastUpdateArticle'] . PMF_Date::createIsoDate($data['lastmodified'])); $lastCategory = $data['category_id']; } } $this->xml->endElement(); // </body> $this->xml->endElement(); // </html> header('Content-type: text/html'); return $this->xml->outputMemory(); }
foreach ($comments as $item) { ?> <p><?php print $PMF_LANG["ad_entry_commentby"]; ?> <a href="mailto:<?php print $item['email']; ?> "><?php print $item['user']; ?> </a>:<br /><?php print $item['content']; ?> <br /><?php print $PMF_LANG['newsCommentDate'] . PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false); ?> <a href="?action=delcomment&artid=<?php print $newsId; ?> &cmtid=<?php print $item['id']; ?> &type=<?php print PMF_Comment::COMMENT_TYPE_NEWS; ?> "><img src="images/delete.gif" alt="<?php print $PMF_LANG["ad_entry_delete"]; ?> " title="<?php print $PMF_LANG["ad_entry_delete"];
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; } if ($permission['viewlog']) { $perpage = 50; $day = PMF_Filter::filterInput(INPUT_POST, 'day', FILTER_VALIDATE_INT); $firstHour = mktime(0, 0, 0, date('m', $day), date('d', $day), date('Y', $day)); $lastHour = mktime(23, 59, 59, date('m', $day), date('d', $day), date('Y', $day)); $session = new PMF_Session($faqConfig); $sessiondata = $session->getSessionsbyDate($firstHour, $lastHour); $date = new PMF_Date($faqConfig); ?> <header> <h2><i class="icon-tasks"></i> <?php echo $PMF_LANG['ad_sess_session'] . ' ' . date("Y-m-d", $day); ?> </h2> </header> <table class="table table-striped"> <thead> <tr> <th><?php echo $PMF_LANG['ad_sess_ip']; ?> </th>
/** * Prints the open questions as a XHTML table * * @return string * @access public * @since 2002-09-17 * @author Thorsten Rinne <*****@*****.**> */ function printOpenQuestions() { global $sids, $category; $query = sprintf("\n SELECT\n COUNT(*) AS num\n FROM\n %sfaqquestions\n WHERE\n is_visible != 'Y'", SQLPREFIX); $result = $this->db->query($query); $row = $this->db->fetch_object($result); $numOfInvisibles = $row->num; if ($numOfInvisibles > 0) { $extraout = sprintf('<tr><td colspan="3"><hr />%s%s</td></tr>', $this->pmf_lang['msgQuestionsWaiting'], $numOfInvisibles); } else { $extraout = ''; } $query = sprintf("\n SELECT\n id,\n ask_username,\n ask_usermail,\n ask_rubrik,\n ask_content,\n ask_date\n FROM\n %sfaqquestions\n WHERE\n is_visible = 'Y'\n ORDER BY\n ask_date ASC", SQLPREFIX); $result = $this->db->query($query); $output = ''; if ($this->db->num_rows($result) > 0) { while ($row = $this->db->fetch_object($result)) { $output .= '<tr class="openquestions">'; $output .= sprintf('<td valign="top" nowrap="nowrap">%s<br /><a href="mailto:%s">%s</a></td>', PMF_Date::createIsoDate($row->ask_date), safeEmail($row->ask_usermail), $row->ask_username); $output .= sprintf('<td valign="top"><strong>%s:</strong><br />%s</td>', $category->categoryName[$row->ask_rubrik]['name'], strip_tags($row->ask_content)); $output .= sprintf('<td valign="top"><a href="%s?%saction=add&question=%d&cat=%d">%s</a></td>', $_SERVER['PHP_SELF'], $sids, $row->id, $row->ask_rubrik, $this->pmf_lang['msg2answer']); $output .= '</tr>'; } } else { $output = sprintf('<tr><td colspan="3">%s</td></tr>', $this->pmf_lang['msgNoQuestionsAvailable']); } return $output . $extraout; }