/**
  * Sends a notification to user who added a question
  *
  * @param string $email    Email address of the user
  * @param string $userName Name of the user
  * @param string $url      URL of answered FAQ
  *
  * @return void
  */
 public function sendOpenQuestionAnswered($email, $userName, $url)
 {
     $this->mail->addTo($email, $userName);
     $this->mail->subject = $this->config->get('main.titleFAQ') . ' - ' . $this->pmfStr['msgQuestionAnswered'];
     $this->mail->message = sprintf($this->pmfStr['msgMessageQuestionAnswered'], $this->config->get('main.titleFAQ')) . "\n\r" . $url;
     $this->mail->send();
 }
Пример #2
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;
}
Пример #3
0
 /**
  * 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&amp;question=%d&amp;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;
 }
Пример #4
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;
}
Пример #5
0
         $_faqUrl = sprintf('%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, 0, $faq->faqRecord['id'], $faq->faqRecord['lang']);
         $oLink = new PMF_Link(PMF_Link::getSystemUri() . '?' . $_faqUrl);
         $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&amp;newsid=' . $news['id'] . '&amp;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'];
Пример #6
0
     $messages[] = $errorMessages['addUser_noRealName'];
 }
 // 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
Пример #7
0
         $message = array('error' => $PMF_LANG['err_sendMail']);
     }
     break;
     // Send mails to friends
 // Send mails to friends
 case 'sendtofriends':
     $name = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
     $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
     $link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL);
     $attached = PMF_Filter::filterInput(INPUT_POST, 'message', FILTER_SANITIZE_STRIPPED);
     $mailto = PMF_Filter::filterInputArray(INPUT_POST, array('mailto' => array('filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_REQUIRE_ARRAY | FILTER_NULL_ON_FAILURE)));
     if (!is_null($name) && !empty($name) && !is_null($email) && !empty($email) && is_array($mailto) && !empty($mailto['mailto'][0]) && checkBannedWord(PMF_String::htmlspecialchars($attached))) {
         foreach ($mailto['mailto'] as $recipient) {
             $recipient = trim(strip_tags($recipient));
             if (!empty($recipient)) {
                 $mail = new PMF_Mail();
                 $mail->setReplyTo($email, $name);
                 $mail->addTo($recipient);
                 $mail->subject = $PMF_LANG["msgS2FMailSubject"] . $name;
                 $mail->message = sprintf("%s\r\n\r\n%s\r\n%s\r\n\r\n%s", $faqconfig->get('main.send2friendText'), $PMF_LANG['msgS2FText2'], $link, $attached);
                 // Send the email
                 $result = $mail->send();
                 unset($mail);
                 usleep(250);
             }
         }
         $message = array('success' => $PMF_LANG['msgS2FThx']);
     } else {
         $message = array('error' => $PMF_LANG['err_sendMail']);
     }
     break;
Пример #8
0
        $userStatus = PMF_Filter::filterInput(INPUT_POST, 'user_status', FILTER_SANITIZE_STRING, $defaultUserStatus);
        $user = new PMF_User();
        $user->getUserById($userId);
        $stats = $user->getStatus();
        // set new password an send email if user is switched to active
        if ($stats == 'blocked' && $userStatus == 'active') {
            $consonants = array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z");
            $vowels = array("a", "e", "i", "o", "u");
            $newPassword = '';
            srand((double) microtime() * 1000000);
            for ($i = 1; $i <= 4; $i++) {
                $newPassword .= $consonants[rand(0, 19)];
                $newPassword .= $vowels[rand(0, 4)];
            }
            $user->changePassword($newPassword);
            $mail = new PMF_Mail();
            $mail->addTo($userData['email']);
            $mail->subject = '[%sitename%] Username / activation';
            $mail->message = sprintf("\nUsername: %s\nLoginname: %s\nNew Password: %s\n\n", $userData['display_name'], $user->getLogin(), $newPassword);
            $result = $mail->send();
            unset($mail);
        }
        if (!$user->userdata->set(array_keys($userData), array_values($userData)) or !$user->setStatus($userStatus)) {
            $message .= '<p class="error">' . $errorMessages['updateUser'] . '</p>';
        } else {
            $message .= '<p class="success">' . sprintf($successMessages['updateUser'], $user->getLogin()) . '</p>';
            $message .= '<script type="text/javascript">updateUser(' . $userId . ');</script>';
        }
    }
}
// delete user confirmation
Пример #9
0
    if (isset($matches['id'])) {
        $id = (int) $matches['id'];
    }
    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"]));
Пример #10
0
 /**
  * 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;
 }
Пример #11
0
    $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
    if (!is_null($username) && !is_null($email)) {
        $user = new PMF_User_CurrentUser();
        $loginExist = $user->getUserByLogin($username);
        if ($loginExist && $email == $user->getUserData('email')) {
            $consonants = array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z');
            $vowels = array('a', 'e', 'i', 'o', 'u');
            $newPassword = '';
            srand((double) microtime() * 1000000);
            for ($i = 1; $i <= 4; $i++) {
                $newPassword .= $consonants[rand(0, 19)];
                $newPassword .= $vowels[rand(0, 4)];
            }
            $user->changePassword($newPassword);
            $text = $PMF_LANG['lostpwd_text_1'] . "\nUsername: "******"\nNew Password: "******"\n\n" . $PMF_LANG["lostpwd_text_2"];
            $mail = new PMF_Mail();
            $mail->addTo($email);
            $mail->subject = '[%sitename%] Username / password request';
            $mail->message = $text;
            $result = $mail->send();
            unset($mail);
            // Trust that the email has been sent
            $message = sprintf('<p class="success">%s</p>', $PMF_LANG["lostpwd_mail_okay"]);
            print "<p><img src=\"images/arrow.gif\" width=\"11\" height=\"11\" alt=\"" . $PMF_LANG["ad"] . "\" border=\"0\" /> <a href=\"index.php\" title=\"" . $PMF_LANG["ad"] . "\">" . $PMF_LANG["ad"] . "</a></p>";
        } else {
            $message = sprintf('<p class="error">%s</p>', $PMF_LANG["lostpwd_err_1"]);
        }
    } else {
        $message = sprintf('<p class="error">%s</p>', $PMF_LANG["lostpwd_err_2"]);
    }
}
Пример #12
0
 /**
 <<<<<<< 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&amp;question=%d&amp;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;
 }
Пример #13
0
\$PMF_LANG['metaCharset'] = '%s';
\$PMF_LANG['metaLanguage'] = '%s';
\$PMF_LANG['language'] = '%s';
\$PMF_LANG['dir'] = '%s';
\$PMF_LANG['nplurals'] = '%s';
FILE;
        $authorTpl = '';
        foreach ($author as $authorData) {
            $authorTpl .= " * @author    {$authorData}\n";
        }
        $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'), $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals);
        $retval = @file_put_contents(PMF_ROOT_DIR . '/lang/language_' . strtolower($langCode) . '.php', $fileTpl);
        $response->setData(intval($retval));
        break;
    case 'send_translated_file':
        $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING);
        $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php";
        if (!file_exists($filename)) {
            $response->setData(0);
            break;
        }
        $letterTpl = '';
        $mail = new PMF_Mail($faqConfig);
        $mail->subject = 'New phpMyFAQ language file submitted';
        $mail->message = sprintf('The file below was sent by %s, which is using phpMyFAQ %s on %s', $user->userdata->get('email'), $faqConfig->get('main.currentVersion'), $_SERVER['HTTP_HOST']);
        $mail->addTo('*****@*****.**');
        $mail->addAttachment($filename, null, 'text/plain');
        $response->setData((int) $mail->send());
        break;
}
$response->send();
Пример #14
0
 /**
  * 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;
 }
Пример #15
0
\$PMF_LANG['metaCharset'] = '%s';
\$PMF_LANG['metaLanguage'] = '%s';
\$PMF_LANG['language'] = '%s';
\$PMF_LANG['dir'] = '%s';
\$PMF_LANG['nplurals'] = '%s';
FILE;
        $authorTpl = '';
        foreach ($author as $authorData) {
            $authorTpl .= " * @author    {$authorData}\n";
        }
        $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'), $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals);
        $retval = @file_put_contents(PMF_ROOT_DIR . '/lang/language_' . strtolower($langCode) . '.php', $fileTpl);
        print intval($retval);
        break;
    case 'send_translated_file':
        $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING);
        $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php";
        if (!file_exists($filename)) {
            print 0;
            exit;
        }
        $letterTpl = '';
        $mail = new PMF_Mail();
        $mail->subject = 'New phpMyFAQ language file submitted';
        $mail->message = sprintf('The file below was sent by %s, which is using phpMyFAQ %s on %s', $user->userdata->get('email'), PMF_Configuration::getInstance()->get('main.currentVersion'), $_SERVER['HTTP_HOST']);
        $mail->addTo('*****@*****.**');
        $mail->addAttachment($filename, null, 'text/plain');
        print (int) $mail->send();
        break;
}
 /**
  * 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&amp;cat=%d&amp;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&amp;question=%d&amp;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;
 }
Пример #17
0
     print 'Invalid FAQ link.';
     exit;
 }
 // Load categories
 $category = new PMF_Category();
 // Load the required faq
 $faq = new PMF_Faq();
 $faq->getRecord($id);
 // Get the HTML content
 $html = @PMF_Utils::getHTTPContent($link);
 // Try to attach the PDF content
 $pdfFile = $faq->buildPDFFile($cat);
 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;
         if ($html !== false) {
             $mail->messageAlt = $faqconfig->get("main.send2friendText") . "\r\n\r\n" . $PMF_LANG["msgS2FText2"] . "\r\n" . $link . "\r\n\r\n" . $attached;
             $mail->setHTMLMessage($html);
         }
         if (!empty($pdfFile) && file_exists($pdfFile)) {
             $mail->addAttachment($pdfFile, basename($pdfFile), 'application/pdf');
         }
         // Send the email
         $result = $mail->send();
         unset($mail);
Пример #18
0
 /**
  * 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                *\n            FROM\n                %sfaqquestions\n            WHERE\n                is_visible = 'Y'\n            ORDER BY\n                created ASC", SQLPREFIX);
     $result = $this->db->query($query);
     $output = '';
     if ($result && $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::format(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&amp;question=%d&amp;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;
 }