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; }
* * @category phpMyFAQ * @package Administration * @author Thorsten Rinne <*****@*****.**> * @copyright 2006-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 2006-09-18 */ if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) { header('Location: http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } printf('<h2>%s</h2>', $PMF_LANG['ad_menu_categ_structure']); if ($permission['editcateg']) { $categoryNode = new PMF_Category_Node(); $currentLanguage = $languageCodes[strtoupper($LANGCODE)]; $showcat = PMF_Filter::filterInput(INPUT_POST, 'showcat', FILTER_SANITIZE_STRING); // translate an existing category if (!is_null($showcat) && $showcat == 'yes') { $categoryData = array('id' => PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT), 'lang' => PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING), 'parent_id' => PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT), 'name' => PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING), 'description' => PMF_Filter::filterInput(INPUT_POST, 'description', FILTER_SANITIZE_STRING), 'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT)); // translate.category only returns non-existent languages to translate too if ($categoryNode->create($categoryData)) { printf('<p>%s</p>', $PMF_LANG['ad_categ_translated']); } else { printf('<p>%s</p>', $db->error()); } } print "\n\n<table>\n"; print "<tr>\n"; print " <th>" . $currentLanguage . "</th>\n";
* @category phpMyFAQ * @package Administration * @author Thorsten Rinne <*****@*****.**> * @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
* @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 * @link http://www.phpmyfaq.de * @copyright 2003-2010 phpMyFAQ Team */ if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } printf('<h2>%s</h2>', $PMF_LANG['ad_menu_categ_edit']); print "<p>\n"; printf('<img src="images/arrow.gif" width="11" height="11" alt="" border="0" /> <a href="?action=addcategory">%s</a>', $PMF_LANG['ad_kateg_add']); print " "; printf('<img src="images/arrow.gif" width="11" height="11" alt="" border="0" /> <a href="?action=showcategory">%s</a>', $PMF_LANG['ad_categ_show']); print "</p>\n"; if ($permission['editcateg']) { $categoryNode = new PMF_Category_Node(); $categoryUser = new PMF_Category_User(); $categoryGroup = new PMF_Category_Group(); $categoryRelations = new PMF_Category_Relations(); $categoryHelper = new PMF_Category_Helper(); // Save a new category if ($action == 'savecategory') { $categoryData = array('id' => null, 'lang' => PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING), 'parent_id' => PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT), 'name' => PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING), 'description' => PMF_Filter::filterInput(INPUT_POST, 'description', FILTER_SANITIZE_STRING), 'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT)); $userperm = PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING); $userAllowed = 'all' == $userperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT); $groupperm = PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING); $groupAllowed = 'all' == $groupperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_groups', FILTER_VALIDATE_INT); if ($categoryNode->create($categoryData)) { $userPermission = array('category_id' => $categoryNode->getCategoryId(), 'user_id' => $userAllowed); $groupPermission = array('category_id' => $categoryNode->getCategoryId(), 'group_id' => $groupAllowed); $categoryUser->create($userPermission);
* * @category phpMyFAQ * @package Administration * @author Thorsten Rinne <*****@*****.**> * @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-03-10 */ if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } if ($permission['editcateg']) { $categoryId = 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($categoryId); $userPermission = $categoryUser->fetch($categoryId); if ($userPermission->user_id == -1) { $allUsers = true; $restrictedUsers = false; } else { $allUsers = false; $restrictedUsers = true; } $groupPermission = $categoryGroup->fetch($categoryId); if ($groupPermission->group_id == -1) { $allGroups = true; $restrictedGroups = false;
if (!is_null($faqid)) { $isNew = false; $faqsession->userTracking('save_new_translation_entry', 0); } else { $faqsession->userTracking('save_new_entry', 0); } $isTranslation = false; if (!is_null($faqlanguage)) { $isTranslation = true; $newLanguage = $faqlanguage; } if (PMF_String::substr($contentlink, 7) != "") { $content = $content . "<br />" . $PMF_LANG["msgInfo"] . "<a href=\"http://" . PMF_String::substr($contentlink, 7) . "\" target=\"_blank\">" . $contentlink . "</a>"; } $newData = array('lang' => $isTranslation == true ? $newLanguage : $LANGCODE, 'thema' => $thema, 'active' => FAQ_SQL_ACTIVE_NO, 'sticky' => 0, 'content' => $content, 'keywords' => $keywords, 'author' => $username, 'email' => $usermail, 'comment' => FAQ_SQL_YES, 'date' => date('YmdHis'), 'dateStart' => '00000000000000', 'dateEnd' => '99991231235959', 'linkState' => '', 'linkDateCheck' => 0); $categoryNode = new PMF_Category_Node(); $categoryRelation = new PMF_Category_Relations(); $faqRecord = new PMF_Faq_Record(); if ($isNew) { $newData['id'] = null; $categories = $categoryNode->fetchAll($categories['rubrik']); } else { $newData['id'] = $faqid; foreach ($categoryRelation->fetchAll() as $relation) { if ($relation->record_id == $newData['id']) { $categories[] = $relation; } } } $faqRecord->create($newData); $recordId = $faqRecord->getSolutionId();
break; case 'getApiVersion': $result = array('apiVersion' => (int) $faqconfig->get('main.currentApiVersion')); break; case 'search': $search = new PMF_Search($db, $Language); $searchString = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRIPPED); $result = $search->search($searchString, false); $url = $faqconfig->get('main.referenceURL') . '/index.php?action=artikel&cat=%d&id=%d&artlang=%s'; foreach ($result as &$data) { $data->answer = html_entity_decode(strip_tags($data->answer), ENT_COMPAT, 'utf-8'); $data->answer = PMF_Utils::makeShorterText($data->answer, 12); $data->link = sprintf($url, $data->category_id, $data->id, $data->lang); } break; case 'getCategories': $categoryNode = new PMF_Category_Node(); $result = $categoryNode->fetchAll(); break; case 'getFaqs': $faq = new PMF_Faq($current_user, $current_groups); $result = $faq->getAllRecordPerCategory($categoryId); break; case 'getFaq': $faq = new PMF_Faq($current_user, $current_groups); $faq->getRecord($recordId); $result = $faq->faqRecord; break; } // print result as JSON print json_encode($result);
* @category phpMyFAQ * @package Administration * @author Thorsten Rinne <*****@*****.**> * @author Rudi Ferrari <*****@*****.**> * @copyright 2006-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 2006-09-10 */ if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } if ($permission["editcateg"]) { $categoryHelper = new PMF_Category_Helper(); $categoryNode = new PMF_Category_Node(); // Set language $categoryNode->setLanguage($LANGCODE); $categoryId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT); $categoryData = $categoryNode->fetch($categoryId); $header = sprintf('%s %s: <em>%s</em>', $PMF_LANG['ad_categ_trans_1'], $PMF_LANG['ad_categ_trans_2'], $categoryData->name); $selectedLanguage = PMF_Filter::filterInput(INPUT_POST, 'trlang', FILTER_SANITIZE_STRING, $LANGCODE); if ($selectedLanguage != $LANGCODE) { $showCategories = 'yes'; } else { $showCategories = 'no'; } printf('<h2>%s</h2>', $header); ?> <form action="?action=updatecategory" method="post"> <fieldset>
* @category phpMyFAQ * @package Frontend * @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');
/** * 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); }