function buildSitemapNode($location, $lastmod = null, $changeFreq = null, $priority = null) { if (!isset($lastmod)) { $lastmod = PMF_Date::createIsoDate($_SERVER['REQUEST_TIME'], DATE_W3C, 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; }
$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);
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"];
<tbody> <?php foreach ($openquestions as $question) { ?> <tr> <td> <input id="questions[]" name="questions[]" value="<?php echo $question['id']; ?> " type="checkbox" /> </td> <td> <?php echo $date->format(PMF_Date::createIsoDate($question['created'])); ?> <br> <a href="mailto:<?php echo $question['email']; ?> "> <?php echo $question['username']; ?> </a> </td> <td> <strong><?php echo $category->categoryName[$question['category_id']]['name']; ?>
print $PMF_LANG['ad_entry_visibility']; ?> ?</th> <th class="list"><?php print $PMF_LANG['ad_gen_delete']; ?> ?</th> </tr> </thead> <tbody> <?php foreach ($openquestions as $question) { ?> <tr> <td class="list"><?php print PMF_Date::createIsoDate($question['date']); ?> <br /><a href="mailto:<?php print $question['email']; ?> "><?php print $question['user']; ?> </a></td> <td class="list"><?php print $category->categoryName[$question['category']]['name'] . ":<br />" . $question['question']; ?> </td> <td class="list"><a href="?action=question&id=<?php print $question['id']; ?>
/** * 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; }
/** * This function generates the list with the latest published records * * @return array */ public function getLatest() { $result = $this->getLatestData(PMF_NUMBER_RECORDS_LATEST, $this->language); $output = array(); if (count($result) > 0) { foreach ($result as $row) { $output['url'][] = $row['url']; $output['title'][] = PMF_Utils::makeShorterText($row['thema'], 8); $output['date'][] = PMF_Date::createIsoDate($row['datum']); } } else { $output['error'] = $this->pmf_lang["err_noArticles"]; } return $output; }
?> </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; ?>
/** * 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); }
?> </option> <?php foreach ($revisions as $revisionId => $revisionData) { ?> <option value="<?php echo $revisionData['revision_id']; ?> " <?php if ($selectedRevisionId == $revisionData['revision_id']) { echo 'selected="selected"'; } ?> > <?php printf('%s 1.%d: %s - %s', $PMF_LANG['ad_entry_revision'], $revisionData['revision_id'], PMF_Date::createIsoDate($revisionData['datum']), $revisionData['author']); ?> </option> <?php } ?> </select> </form> </div> <?php } if (isset($selectedRevisionId) && isset($faqData['revision_id']) && $selectedRevisionId != $faqData['revision_id']) { $faq->language = $faqData['lang']; $faq->getRecord($faqData['id'], $selectedRevisionId, true); $faqData = $faq->faqRecord; $faqData['tags'] = implode(',', $tagging->getAllTagsById($faqData['id']));
/** * 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; }
?> ?</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']; ?>
/** * 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); $date = new PMF_Date($this->config); $mail = new PMF_Mail($this->config); $output = ''; foreach ($comments as $item) { $output .= '<p class="comment">'; $output .= '<img class="commment-bubbles" src="assets/img/bubbles.gif" />'; $output .= sprintf('<strong>%s<a href="mailto:%s">%s</a>:</strong><br />%s<br /><small>%s</small></p>', $this->pmfStr['msgCommentBy'], $mail->safeEmail($item['email']), $item['user'], $this->showShortComment($id, $item['content']), $this->pmfStr['newsCommentDate'] . $date->format(PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false))); } return $output; }
<fieldset class="fullwidth"> <legend><?php print $PMF_LANG['ad_entry_changelog']; ?> </legend> <label class="lefteditor"><?php print $PMF_LANG["ad_entry_date"]; ?> </label> <?php if (isset($faqData['date'])) { print $faqData['date']; } else { print PMF_Date::createIsoDate(date("YmdHis")); } ?> <br /> <label class="lefteditor" for="changed"><?php print $PMF_LANG["ad_entry_changed"]; ?> </label> <textarea name="changed" id="changed" style="width: 390px; height: 50px;" cols="40" rows="4"><?php if (isset($changed)) { print $changed; } ?> </textarea><br />
/** * Returns the XML export * * @param integer $nCatid Number of categories * @param boolean $bDownwards Downwards * @param string $lang Language * * @return string */ public static function getXMLExport($nCatid = 0, $bDownwards = true, $lang = "") { global $db, $LANGCODE, $PMF_LANG, $PMF_CONF; $tree = new PMF_Category(); $tree->transform(0); $my_xml_output = "<?xml version=\"1.0\" encoding=\"" . $PMF_LANG["metaCharset"] . "\" standalone=\"yes\" ?>\n"; $my_xml_output .= "<!-- XML-Output by phpMyFAQ " . $PMF_CONF['main.currentVersion'] . " | Date: " . PMF_Date::createIsoDate(date("YmdHis")) . " -->\n"; $my_xml_output .= "<phpmyfaq xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:NamespaceSchemaLocation=\"http://www.phpmyfaq.de/xml/faqschema.xsd\">\n"; // Get Faq Data $oFaq = new PMF_Faq(); $faqs = $oFaq->get(FAQ_QUERY_TYPE_EXPORT_XML, $nCatid, $bDownwards, $lang); // Start composing XML if (count($faqs) > 0) { foreach ($faqs as $faq) { // Get faq properties $xml_content = $faq['content']; $xml_rubrik = $tree->getPath($faq['category_id'], " >> "); $xml_thema = $faq['topic']; $xml_keywords = $faq['keywords']; // Take care of XML entities $xml_content = strip_tags(PMF_String::htmlspecialchars($xml_content, ENT_QUOTES, $PMF_LANG['metaCharset'])); $xml_rubrik = PMF_htmlentities(strip_tags($xml_rubrik), ENT_QUOTES, $PMF_LANG['metaCharset']); $xml_thema = strip_tags($xml_thema); // Build the <article/> node $my_xml_output .= "\t<article id=\"" . $faq['id'] . "\">\n"; $my_xml_output .= "\t<language>" . $faq['lang'] . "</language>\n"; $my_xml_output .= "\t<category>" . $xml_rubrik . "</category>\n"; if (!empty($xml_keywords)) { $my_xml_output .= "\t<keywords>" . $xml_keywords . "</keywords>\n"; } else { $my_xml_output .= "\t<keywords />\n"; } $my_xml_output .= "\t<theme>" . $xml_thema . "</theme>\n"; $my_xml_output .= "\t<content xmlns=\"http://www.w3.org/TR/REC-html40\">" . $xml_content . "</content>\n"; if (!empty($faq['author_name'])) { $my_xml_output .= "\t<author>" . $faq['author_name'] . "</author>\n"; } else { $my_xml_output .= "\t<author />\n"; } $my_xml_output .= "\t<date>" . PMF_Date::createIsoDate($faq['lastmodified']) . "</date>\n"; $my_xml_output .= "\t</article>\n"; } } $my_xml_output .= "</phpmyfaq>"; return $my_xml_output; }
$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 = '';
/** <<<<<<< HEAD ======= * Prints the open questions as a XHTML table * * @return string * @access public * @since 2002-09-17 * @author Thorsten Rinne <*****@*****.**> */ function printOpenQuestions() { global $sids, $category; if ($this->groupSupport) { $permPart = sprintf("AND ( fdg.group_id IN (%s))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups)); $permPartLeftJoin = sprintf("LEFT JOIN %sfaqcategory_group AS fdg ON fq.ask_rubrik = fdg.category_id", $SQLPREFIX); } else { $permPart = ''; $permPartLeftJoin = ''; } $query = sprintf("\n SELECT\n COUNT(*) AS num\n FROM\n %sfaqquestions \n\t\t\t%s\n WHERE\n is_visible != 'Y'\n\t\t\t%s ", SQLPREFIX, $permPartLeftJoin, $permPart); $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 fq.id,\n fq.ask_username,\n fq.ask_usermail,\n fq.ask_rubrik,\n fq.ask_content,\n fq.ask_date\n FROM\n %sfaqquestions as fq\n %s\n\t\t\tWHERE\n fq.is_visible = 'Y'\n\t\t\t %s\n\t\t\tORDER BY\n ask_date ASC", SQLPREFIX, $permPartLeftJoin, $permPart); $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->created), PMF_Mail::safeEmail($row->email), $row->username); $output .= sprintf('<td valign="top"><strong>%s:</strong><br />%s</td>', isset($category->categoryName[$row->category_id]['name']) ? $category->categoryName[$row->category_id]['name'] : '', strip_tags($row->question)); $output .= sprintf('<td valign="top"><a href="?%saction=add&question=%d&cat=%d">%s</a></td>', $sids, $row->id, $row->category_id, $this->pmf_lang['msg2answer']); $output .= '</tr>'; } } else { $output = sprintf('<tr><td colspan="3">%s</td></tr>', $this->pmf_lang['msgNoQuestionsAvailable']); } return $output . $extraout; }
/** * 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; }
?> <input type="hidden" name="grouppermission" class="active" value="all" /> <?php } if ('00000000000000' == $faqData['dateStart']) { $dateStart = ''; } else { $dateStart = preg_replace("/(\\d{4})(\\d{2})(\\d{2}).*/", "\$1-\$2-\$3", $faqData['dateStart']); } if ('99991231235959' == $faqData['dateEnd']) { $dateEnd = ''; } else { $dateEnd = preg_replace("/(\\d{4})(\\d{2})(\\d{2}).*/", "\$1-\$2-\$3", $faqData['dateEnd']); } if (!isset($faqData['date'])) { $faqData['date'] = PMF_Date::createIsoDate(date('YmdHis')); } ?> <p> <label for="userpermission"><?php print $PMF_LANG['ad_entry_userpermission']; ?> </label> <input type="radio" id="userpermission" name="userpermission" class="active" value="all" <?php print $allUsers ? 'checked="checked"' : ''; ?> /> <?php print $PMF_LANG['ad_entry_all_users']; ?> <br />
/** * 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(); }
/** * 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(); }
?> ?</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 />
/** * Prints the open questions as a XHTML table * * @return string * @access public * @since 2002-09-17 * @author Thorsten Rinne <*****@*****.**> */ function printOpenQuestions() { global $sids, $category; $date = new PMF_Date($this->_config); $mail = new PMF_Mail($this->_config); $query = sprintf("\n SELECT\n COUNT(id) AS num\n FROM\n %sfaqquestions\n WHERE\n is_visible != 'Y'", PMF_Db::getTablePrefix()); $result = $this->_config->getDb()->query($query); $row = $this->_config->getDb()->fetchObject($result); $numOfInvisibles = $row->num; if ($numOfInvisibles > 0) { $extraout = sprintf('<tr><td colspan="3"><small>%s %s</small></td></tr>', $this->pmf_lang['msgQuestionsWaiting'], $numOfInvisibles); } else { $extraout = ''; } $query = sprintf("\n SELECT\n *\n FROM\n %sfaqquestions\n WHERE\n is_visible = 'Y'\n ORDER BY\n created ASC", PMF_Db::getTablePrefix()); $result = $this->_config->getDb()->query($query); $output = ''; if ($result && $this->_config->getDb()->numRows($result) > 0) { while ($row = $this->_config->getDb()->fetchObject($result)) { $output .= '<tr class="openquestions">'; $output .= sprintf('<td><small>%s</small><br /><a href="mailto:%s">%s</a></td>', $date->format(PMF_Date::createIsoDate($row->created)), $mail->safeEmail($row->email), $row->username); $output .= sprintf('<td><strong>%s:</strong><br />%s</td>', isset($category->categoryName[$row->category_id]['name']) ? $category->categoryName[$row->category_id]['name'] : '', strip_tags($row->question)); if ($this->_config->get('records.enableCloseQuestion') && $row->answer_id) { $output .= sprintf('<td><a id="PMF_openQuestionAnswered" href="?%saction=artikel&cat=%d&id=%d">%s</a></td>', $sids, $row->category_id, $row->answer_id, $this->pmf_lang['msg2answerFAQ']); } else { $output .= sprintf('<td><a class="btn btn-primary" href="?%saction=add&question=%d&cat=%d">%s</a></td>', $sids, $row->id, $row->category_id, $this->pmf_lang['msg2answer']); } $output .= '</tr>'; } } else { $output = sprintf('<tr><td colspan="3">%s</td></tr>', $this->pmf_lang['msgNoQuestionsAvailable']); } return $output . $extraout; }