Example #1
0
function sendAskedQuestion($username, $usermail, $usercat, $content)
{
    global $IDN, $category, $PMF_LANG, $faq, $faqconfig;
    $retval = false;
    $cat = new PMF_Category();
    $categories = $cat->getAllCategories();
    if ($faqconfig->get('records.enableVisibilityQuestions')) {
        $visibility = 'N';
    } else {
        $visibility = 'Y';
    }
    $questionData = array('ask_username' => $username, 'ask_usermail' => $IDN->encode($usermail), 'ask_category' => $usercat, 'ask_content' => $content, 'ask_date' => date('YmdHis'), 'is_visible' => $visibility);
    list($user, $host) = explode("@", $questionData['ask_usermail']);
    if (PMF_Filter::filterVar($questionData['ask_usermail'], FILTER_VALIDATE_EMAIL) != false) {
        $faq->addQuestion($questionData);
        $questionMail = "User: "******", mailto:" . $questionData['ask_usermail'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['ask_category']]["name"] . "\n\n" . wordwrap($content, 72);
        $userId = $category->getCategoryUser($questionData['ask_category']);
        $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['ask_usermail'], $questionData['ask_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;
}
Example #2
0
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;
}
Example #3
0
 *
 * @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-09-16
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$recordId = PMF_Filter::filterInput(INPUT_POST, 'artikel', FILTER_VALIDATE_INT, 0);
$vote = PMF_Filter::filterInput(INPUT_POST, 'vote', FILTER_VALIDATE_INT);
$userIp = PMF_Filter::filterVar($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);
if (isset($vote) && $faq->votingCheck($recordId, $userIp) && $vote > 0 && $vote < 6) {
    $faqsession->userTracking('save_voting', $recordId);
    $voting = new PMF_Rating();
    $votingData = array('id' => null, 'record_id' => $recordId, 'vote' => $vote, 'date' => $_SERVER['REQUEST_TIME'], 'user_ip' => $userIp);
    if (!$voting->fetch($recordId)) {
        $voting->create($votingData);
    } else {
        $voting->update($recordId, $votingData);
    }
    $tpl->processTemplate('writeContent', array('msgVoteThanks' => $PMF_LANG['msgVoteThanks']));
} elseif (isset($voting) && !$faq->votingCheck($recordId, $userIp)) {
    $faqsession->userTracking('error_save_voting', $recordId);
    $tpl->processTemplate('writeContent', array('msgVoteThanks' => $PMF_LANG['err_VoteTooMuch']));
} else {
    $faqsession->userTracking('error_save_voting', $recordId);
Example #4
0
        $response->setData(1);
        break;
    case 'save_added_trans':
        if (!$user->perm->checkRight($user->getUserId(), 'addtranslation')) {
            $response->setData($PMF_LANG['err_NotAuth']);
            break;
        }
        if (!is_writable(PMF_ROOT_DIR . "/lang")) {
            $response->setData(0);
            break;
        }
        $langCode = PMF_Filter::filterInput(INPUT_POST, 'translang', FILTER_SANITIZE_STRING);
        $langName = @$languageCodes[$langCode];
        $langCharset = "UTF-8";
        $langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING);
        $langNPlurals = strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1));
        $langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING);
        $author = (array) @$_POST['author'];
        if (empty($langCode) || empty($langName) || empty($langCharset) || empty($langDir) || empty($langDesc) || empty($author)) {
            $response->setData(0);
            break;
        }
        $fileTpl = <<<FILE
<?php
/**
 * %s
 *
 * PHP Version 5.4
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can