function sendAskedQuestion($username, $usermail, $usercat, $content) { global $PMF_LANG, $faq; $retval = false; $faqconfig = PMF_Configuration::getInstance(); $categoryNode = new PMF_Category_Node(); if ($faqconfig->get('records.enableVisibilityQuestions')) { $visibility = 'N'; } else { $visibility = 'Y'; } $questionData = array('id' => null, 'username' => $username, 'email' => $usermail, 'category_id' => $usercat, 'question' => $content, 'date' => date('YmdHis'), 'is_visible' => $visibility); list($user, $host) = explode("@", $questionData['email']); if (PMF_Filter::filterVar($questionData['email'], FILTER_VALIDATE_EMAIL) != false) { $faqQuestions = new PMF_Faq_Questions(); $faqQuestions->create($questionData); $categoryData = $categoryNode->fetch($questionData['category_id']); $questionMail = "User: "******", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categoryData->name . "\n\n" . wordwrap($content, 72); $userId = $categoryData->user_id; $oUser = new PMF_User(); $oUser->getUserById($userId); $userEmail = $oUser->getUserData('email'); $mainAdminEmail = $faqconfig->get('main.administrationMail'); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($questionData['email'], $questionData['username']); $mail->addTo($mainAdminEmail); // Let the category owner get a copy of the message if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $retval = $mail->send(); } return $retval; }
* @copyright 2003-2010 phpMyFAQ Team * @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 * @link http://www.phpmyfaq.de * @since 2003-12-20 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } print "<h2>" . $PMF_LANG["ad_categ_new"] . "</h2>\n"; if ($permission["addcateg"]) { $parentId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0); $categoryNode = new PMF_Category_Node(); $categoryUser = new PMF_Category_User(); $categoryGroup = new PMF_Category_Group(); $categoryData = $categoryNode->fetch($parentId); ?> <form action="?action=savecategory" method="post"> <fieldset> <legend><?php print $PMF_LANG["ad_categ_new"]; ?> </legend> <input type="hidden" id="lang" name="lang" value="<?php print $LANGCODE; ?> " /> <input type="hidden" name="parent_id" value="<?php print $parent_id; ?> " />
} // Moves a category if ($action == 'changecategory') { $firstCategoryId = PMF_Filter::filterInput(INPUT_POST, 'cat', FILTER_VALIDATE_INT); $secondCategoryId = PMF_Filter::filterInput(INPUT_POST, 'change', FILTER_VALIDATE_INT); if ($categoryHelper->swapCategories($firstCategoryId, $secondCategoryId)) { printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_updated']); } else { printf('<p class="error">%s<br />%s</p>', $PMF_LANG['ad_categ_paste_error'], $db->error()); } } // Pastes a category if ($action == 'pastecategory') { $categoryId = PMF_Filter::filterInput(INPUT_POST, 'cat', FILTER_VALIDATE_INT); $parentId = PMF_Filter::filterInput(INPUT_POST, 'after', FILTER_VALIDATE_INT); $categoryData = $categoryNode->fetch($categoryId); $categoryData->parent_id = $parentId; if ($categoryNode->update($categoryId, (array) $categoryData)) { printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_updated']); } else { printf('<p class="error">%s<br />%s</p>', $PMF_LANG['ad_categ_paste_error'], $db->error()); } } // Lists all categories $lang = PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING, $LANGCODE); $categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery($LANGCODE); $categoryTreeHelper = new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryDataProvider)); foreach ($categoryTreeHelper as $categoryId => $categoryName) { $indent = str_repeat(' ', $categoryTreeHelper->indent); $categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage(); $parentId = $categoryTreeHelper->getInnerIterator()->current()->getParentId();
* @author Thorsten Rinne <*****@*****.**> * @copyright 2002-2010 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-27 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $categoryId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT); if (!is_null($categoryId)) { $faqsession->userTracking('show_category', $categoryId); $categoryNode = new PMF_Category_Node(); $categoryNode->setLanguage($LANGCODE); $selectedCategoryData = $categoryNode->fetch($categoryId); $records = $faq->showAllRecords($categoryId, $faqconfig->get('records.orderby'), $faqconfig->get('records.sortby')); if (!$records) { $records = $categoryLayout->renderTree(); } $backToParent = ''; if ($selectedCategoryData->parent_id != 0) { $url = sprintf('%saction=show&cat=%d', $sids, $selectedCategoryData->parent_id); $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url); $oLink->text = $PMF_LANG['msgCategoryUp']; $backToParent = $oLink->toHtmlAnchor(); } $tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgEntriesIn'] . $selectedCategoryData->name, 'writeCategoryDescription' => $selectedCategoryData->description, 'writeThemes' => $records, 'writeOneThemeBack' => $backToParent)); $tpl->includeTemplate('writeContent', 'index'); } else { $categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper($categoryTree));
/** * Builds the PDF delivery for the given faq. * * @param integer $currentCategory The category under which we want the PDF to be created. * @param string $pdfFile The path to the PDF file. Optional, default: pdf/<faq_id>.pdf. * @return mixed */ public function buildPDFFile($currentCategory, $pdfFile = null) { global $PMF_LANG; // Sanity check: stop here if getRecord() has not been called yet if (empty($this->faqRecord)) { return false; } // Default filename: pdf/<faq_id>.pdf if (empty($pdfFile)) { $pdfFile = 'pdf' . $this->faqRecord['id'] . '.pdf'; } $faqconfig = PMF_Configuration::getInstance(); $categoryNode = new PMF_Category_Node(); $categoryData = $categoryNode->fetch($currentCategory); $pdf = new PMF_Export_Pdf_Wrapper(); $pdf->faq = $this->faqRecord; $pdf->setCategory($categoryData); $pdf->setQuestion($this->faqRecord['title']); // Start building PDF... $pdf->Open(); // Set any item $pdf->SetTitle($this->faqRecord['title']); $pdf->SetCreator($faqconfig->get('main.titleFAQ') . ' - powered by phpMyFAQ ' . $faqconfig->get('main.currentVersion')); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('arialunicid0', '', 12); $pdf->SetDisplayMode('real'); $pdf->Ln(); $pdf->WriteHTML(str_replace('../', '', $this->faqRecord['content']), true); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont('arialunicid0', '', 11); $pdf->Write(5, $PMF_LANG['ad_entry_solution_id'] . ': #' . $this->faqRecord['solution_id']); $pdf->SetAuthor($this->faqRecord['author']); $pdf->Ln(); $pdf->Write(5, $PMF_LANG['msgAuthor'] . ': ' . $this->faqRecord['author']); $pdf->Ln(); $pdf->Write(5, $PMF_LANG['msgLastUpdateArticle'] . $this->faqRecord['date']); // Build it return $pdf->Output($pdfFile); }