Esempio n. 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;
}
Esempio n. 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;
}
Esempio n. 3
0
            $oLink->itemTitle = $faq->faqRecord['title'];
            $urlToContent = $oLink->toString();
        } else {
            $oNews = new PMF_News();
            $news = $oNews->getNewsEntry($id);
            if ($news['authorEmail'] != '') {
                $emailTo = $news['authorEmail'];
            }
            $oLink = new PMF_Link(PMF_Link::getSystemUri() . '?action=news&newsid=' . $news['id'] . '&newslang=' . $news['lang']);
            $oLink->itemTitle = $news['header'];
            $urlToContent = $oLink->toString();
        }
        $commentMail = 'User: '******'username'] . ', mailto:' . $commentData['usermail'] . "\n" . 'New comment posted on: ' . $urlToContent . "\n\n" . wordwrap($comment, 72);
        $mail = new PMF_Mail();
        $mail->unsetFrom();
        $mail->setFrom($commentData['usermail']);
        $mail->addTo($emailTo);
        // Let the category owner get a copy of the message
        if ($emailTo != $faqconfig->get('main.administrationMail')) {
            $mail->addCc($faqconfig->get('main.administrationMail'));
        }
        $mail->subject = '%sitename%';
        $mail->message = strip_tags($commentMail);
        $result = $mail->send();
        unset($mail);
        $message = $PMF_LANG['msgCommentThanks'];
    } else {
        $faqsession->userTracking('error_save_comment', $id);
        $message = $PMF_LANG['err_SaveComment'];
    }
} else {
Esempio n. 4
0
 // ok, let's go
 if (count($messages) == 0) {
     // Create user account (login and password)
     // Note: password be automatically generated
     //       and sent by email as soon if admin switch user to "active"
     if (!$user->createUser($user_name, '')) {
         $messages[] = $user->error();
     } else {
         // set user data (realname, email)
         $user->userdata->set(array('display_name', 'email'), array($user_realname, $user_email));
         // set user status
         $user->setStatus($defaultUserStatus);
         $text = sprintf("New user has been registrated:\n\nUsername: %s\nLoginname: %s\n\n" . "To activate this user do please use the administration interface.", $lastname, $loginname);
         $mail = new PMF_Mail();
         $mail->unsetFrom();
         $mail->setFrom($user_email);
         $mail->addTo($faqconfig->get('main.administrationMail'));
         $mail->subject = PMF_Utils::resolveMarkers($PMF_LANG['emailRegSubject']);
         $mail->message = $text;
         $result = $mail->send();
         unset($mail);
         header("Location: index.php?action=thankyou");
         exit;
     }
 }
 // no errors, show list
 if (count($messages) == 0) {
     $userAction = $defaultUserAction;
     // display error messages and show form again
 } else {
     $tpl->processTemplate('writeContent', array('regErrors' => sprintf("<strong>%s</strong> <br /> - %s <br /><br />", $PMF_LANG['msgRegError'], implode("<br />- ", $messages)), 'msgUserData' => $PMF_LANG['msgUserData'], 'login_errorRegistration' => !is_null($loginname) ? $PMF_LANG['errorRegistration'] : '', 'name_errorRegistration' => !is_null($lastname) ? $PMF_LANG['errorRegistration'] : '', 'email_errorRegistration' => !is_null($email) ? $PMF_LANG['errorRegistration'] : '', 'loginname' => $PMF_LANG["ad_user_loginname"], 'lastname' => $PMF_LANG["ad_user_realname"], 'email' => $PMF_LANG["ad_entry_email"], 'loginname_value' => $loginname, 'lastname_value' => $lastname, 'email_value' => $email, 'submitRegister' => $PMF_LANG['submitRegister'], 'captchaFieldset' => printCaptchaFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('add'), $captcha->caplength, isset($captchaError) ? $captchaError : '')));
Esempio n. 5
0
 * @since     2002-09-17
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$faqsession->userTracking('sendmail_contact', 0);
$captcha = new PMF_Captcha($sids);
$name = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
$email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$question = PMF_Filter::filterInput(INPUT_POST, 'question', FILTER_SANITIZE_STRIPPED);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
// If e-mail address is set to optional
if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($email)) {
    $email = PMF_Configuration::getInstance()->get('main.administrationMail');
}
if (!is_null($name) && !is_null($email) && !is_null($question) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($question)) && $captcha->checkCaptchaCode($code)) {
    $mail = new PMF_Mail();
    $mail->unsetFrom();
    $mail->setFrom($email, $name);
    $mail->addTo($faqconfig->get('main.administrationMail'));
    $mail->subject = 'Feedback: %sitename%';
    $mail->message = $question;
    $result = $mail->send();
    unset($mail);
    $message = $PMF_LANG['msgMailContact'];
} else {
    $message = $PMF_LANG['err_sendMail'];
}
$tpl->processTemplate('writeContent', array('msgContact' => $PMF_LANG['msgContact'], 'Message' => $message));
$tpl->includeTemplate('writeContent', 'index');
Esempio n. 6
0
    }
    if (isset($matches['artlang'])) {
        $artlang = $matches['artlang'];
    }
    // Sanity check
    if (is_null($cat) || is_null($id) || is_null($artlang)) {
        header('HTTP/1.1 403 Forbidden');
        print 'Invalid FAQ link.';
        exit;
    }
    foreach ($mailto['mailto'] as $recipient) {
        $recipient = trim(strip_tags($recipient));
        if (!empty($recipient)) {
            $mail = new PMF_Mail();
            $mail->unsetFrom();
            $mail->setFrom($mailfrom, $name);
            $mail->addTo($recipient);
            $mail->subject = $PMF_LANG["msgS2FMailSubject"] . $name;
            $mail->message = $faqconfig->get("main.send2friendText") . "\r\n\r\n" . $PMF_LANG["msgS2FText2"] . "\r\n" . $link . "\r\n\r\n" . $attached;
            // Send the email
            $result = $mail->send();
            unset($mail);
            usleep(250);
        }
    }
    $tpl->processTemplate('writeContent', array('msgSend2Friend' => $PMF_LANG['msgSend2Friend'], 'Message' => $PMF_LANG['msgS2FThx']));
} else {
    if (false === IPCheck($_SERVER["REMOTE_ADDR"])) {
        $tpl->processTemplate('writeContent', array('msgSend2Friend' => $PMF_LANG['msgSend2Friend'], 'Message' => $PMF_LANG["err_bannedIP"]));
    } else {
        $tpl->processTemplate('writeContent', array('msgSend2Friend' => $PMF_LANG['msgSend2Friend'], 'Message' => $PMF_LANG["err_sendMail"]));
Esempio n. 7
0
        // save the category relations
        $categoryRelations->create($categoryData);
    }
    $sent = array();
    // Let the PMF Administrator and the Category Owner to be informed by email of this new entry
    foreach ($categories as $category) {
        $userId = $category->user_id;
        // Avoid to send multiple emails to the same owner
        if (!isset($sent[$userId])) {
            // TODO: Move this code to Category.php
            $oUser = new PMF_User();
            $oUser->getUserById($userId);
            $catOwnerEmail = $oUser->getUserData('email');
            $mail = new PMF_Mail();
            $mail->unsetFrom();
            $mail->setFrom($usermail);
            $mail->addTo($faqconfig->get('main.administrationMail'));
            // Let the category owner get a copy of the message
            if ($faqconfig->get('main.administrationMail') != $catOwnerEmail) {
                $mail->addCc($catOwnerEmail);
            }
            $mail->subject = '%sitename%';
            // TODO: let the email contains the faq article both as plain text and as HTML
            $mail->message = html_entity_decode($PMF_LANG['msgMailCheck']) . "\n\n" . $faqconfig->get('main.titleFAQ') . ": " . PMF_Link::getSystemUri('/index.php') . '/admin';
            $result = $mail->send();
            unset($mail);
            $sent[$userId] = $catOwnerEmail;
        }
    }
    $tpl->processTemplate('writeContent', array('msgNewContentHeader' => $PMF_LANG["msgNewContentHeader"], 'Message' => $isNew ? $PMF_LANG['msgNewContentThanks'] : $PMF_LANG['msgNewTranslationThanks']));
} else {
     $urlToContent = $oLink->toString();
 } else {
     $oNews = new PMF_News($faqConfig);
     $news = $oNews->getNewsEntry($id);
     if ($news['authorEmail'] != '') {
         $emailTo = $news['authorEmail'];
     }
     $link = sprintf('%s?action=news&newsid=%d&newslang=%s', $faqConfig->get('main.referenceURL'), $news['id'], $news['lang']);
     $oLink = new PMF_Link($link, $faqConfig);
     $oLink->itemTitle = $news['header'];
     $urlToContent = $oLink->toString();
 }
 $commentMail = 'User: '******'username'] . ', mailto:' . $commentData['usermail'] . "\n" . 'New comment posted on: ' . $urlToContent . "\n\n" . wordwrap($comment, 72);
 $send = array();
 $mail = new PMF_Mail($faqConfig);
 $mail->setFrom($faqConfig->get('main.administrationMail'), $faqConfig->get('main.titleFAQ'));
 $mail->setReplyTo($commentData['usermail'], $commentData['username']);
 $mail->addTo($emailTo);
 $send[$emailTo] = 1;
 $send[$faqConfig->get('main.administrationMail')] = 1;
 // Let the category owner get a copy of the message
 $category = new PMF_Category($faqConfig, $current_groups);
 $categories = $category->getCategoryIdsFromArticle($faq->faqRecord['id']);
 foreach ($categories as $_category) {
     $userId = $category->getCategoryUser($_category);
     $catUser = new PMF_User($faqConfig);
     $catUser->getUserById($userId);
     $catOwnerEmail = $catUser->getUserData('email');
     if ($catOwnerEmail != '') {
         if (!isset($send[$catOwnerEmail])) {
             $mail->addCc($catOwnerEmail);