Пример #1
0
function buildSitemapNode($location, $lastmod = null, $changeFreq = null, $priority = null)
{
    if (!isset($lastmod)) {
        $lastmod = PMF_Date::createISO8601Date($_SERVER['REQUEST_TIME'], false);
    }
    if (!isset($changeFreq)) {
        $changeFreq = PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY;
    }
    $node = '<url>' . '<loc>' . PMF_String::htmlspecialchars($location) . '</loc>' . '<lastmod>' . $lastmod . '</lastmod>' . '<changefreq>' . $changeFreq . '</changefreq>' . (isset($priority) ? '<priority>' . $priority . '</priority>' : '') . '</url>';
    return $node;
}
Пример #2
0
 /**
  * Adds a post to Twitter
  * 
  * @param string $question Question
  * @param string $tags     String of tags
  * @param string $link     URL to FAQ
  * 
  * @return void
  */
 public function addPost($question, $tags, $link)
 {
     $hashtags = '';
     if ($tags != '') {
         $hashtags = '#' . str_replace(',', ' #', $tags);
     }
     $message = PMF_String::htmlspecialchars($question);
     $message .= ' ' . $hashtags;
     $message .= ' ' . $link;
     $this->connection->post('statuses/update', array('status' => $message));
 }
Пример #3
0
                 $mquery[] = trim(PMF_String::substr($dat, 0, -1));
             }
         }
         $k = 0;
         $g = 0;
         printf("<p>%s</p>\n", $PMF_LANG['ad_csv_process']);
         $num = count($mquery);
         $kg = '';
         for ($i = 0; $i < $num; $i++) {
             $mquery[$i] = PMF_DB_Helper::alignTablePrefix($mquery[$i], $table_prefix, PMF_Db::getTablePrefix());
             $kg = $faqConfig->getDb()->query($mquery[$i]);
             if (!$kg) {
                 printf('<div style="alert alert-danger"><strong>Query</strong>: "%s" failed (Reason: %s)</div>%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), $faqConfig->getDb()->error(), "\n");
                 $k++;
             } else {
                 printf('<!-- <div style="alert alert-success"><strong>Query</strong>: "%s" okay</div> -->%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), "\n");
                 $g++;
             }
         }
         printf('<p class="alert alert-success">%d %s %d %s</p>', $g, $PMF_LANG['ad_csv_of'], $num, $PMF_LANG['ad_csv_suc']);
     }
 } else {
     switch ($_FILES['userfile']['error']) {
         case 1:
             $errorMessage = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
             break;
         case 2:
             $errorMessage = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
             break;
         case 3:
             $errorMessage = 'The uploaded file was only partially uploaded.';
 /**
  * Updates an item and definition into the database
  *
  * @param  integer $id         Glossary ID
  * @param  string  $item       Item
  * @param  string  $definition Definition
  *
  * @return boolean
  */
 public function updateGlossaryItem($id, $item, $definition)
 {
     $this->item = $this->config->getDb()->escape($item);
     $this->definition = $this->config->getDb()->escape($definition);
     $query = sprintf("\n            UPDATE\n                %sfaqglossary\n            SET\n                item = '%s',\n                definition = '%s'\n            WHERE\n                id = %d AND lang = '%s'", PMF_Db::getTablePrefix(), PMF_String::htmlspecialchars($this->item), PMF_String::htmlspecialchars($this->definition), (int) $id, $this->config->getLanguage()->getLanguage());
     if ($this->config->getDb()->query($query)) {
         return true;
     }
     return false;
 }
Пример #5
0
         <input type="checkbox" name="q[other][]" value="ruby" />Ruby / Ruby on Rails
         <input type="checkbox" name="q[other][]" value="python" />Python
     </fieldset>
    <br />

    <p class="center">Additional to your input we're going to submit some information about your system setup for statstic purpose.</p>
    <p class="center">We are not storing any personal information. You can see the data by clicking <a href="#" onclick="show('configliste');return false;">here</a>.</p>

    <div id="configliste" class="collapsed">
        <a href="#" onclick="hide('configliste'); return false;">hide again</a>
        <dl>
<?php 
    $q = new PMF_Questionnaire_Data($configs);
    $options = $q->get();
    array_walk($options, 'data_printer');
    echo '</dl><input type="hidden" name="systemdata" value="' . PMF_String::htmlspecialchars(serialize($q->get()), ENT_QUOTES) . '" />';
    ?>
    </div>
    <p class="center"><input type="submit" value="Click here to submit the data and fnish the installation process" /></p>
</form>
<div id="questionnaireThanks" style="display:none;">
    <p class="center"><b>Thank you for giving your feedback!</b></p>
    <p class="center">You can visit <a href="../index.php">your version of phpMyFAQ</a> or</p>
    <p class="center">login into your <a href="../admin/index.php">admin section</a>.</p>
</div>
<br />
<?php 
    // Remove 'scripts' folder: no need of prompt anything to the user
    if (file_exists(PMF_ROOT_DIR . "/scripts") && is_dir(PMF_ROOT_DIR . "/scripts")) {
        @rmdir(PMF_ROOT_DIR . "/scripts");
    }
Пример #6
0
    if (PMF_Configuration::getInstance()->get('main.enableRewriteRules')) {
        header('Location: ' . PMF_Link::getSystemUri('/index.php') . '/solution_id_' . $inputSearchTerm . '.html');
    } else {
        header('Location: ' . PMF_Link::getSystemUri('/index.php') . '/index.php?solution_id=' . $inputSearchTerm);
    }
    exit;
}
$category->buildTree();
$mostPopularSearchData = $faqSearch->getMostPopularSearches($faqconfig->get('search.numberSearchTerms'));
// Set base URL scheme
if (PMF_Configuration::getInstance()->get('main.enableRewriteRules')) {
    $baseUrl = sprintf("%ssearch.html?search=%s&amp;seite=%d%s&amp;searchcategory=%d", PMF_Link::getSystemRelativeUri('index.php'), urlencode($inputSearchTerm), $page, $languages, $inputCategory);
} else {
    $baseUrl = sprintf('%s?%saction=search&amp;search=%s&amp;seite=%d%s&amp;searchcategory=%d', PMF_Link::getSystemRelativeUri(), empty($sids) ? '' : '$sids&amp;', urlencode($inputSearchTerm), $page, $languages, $inputCategory);
}
// Pagination options
$options = array('baseUrl' => $baseUrl, 'total' => $faqSearchResult->getNumberOfResults(), 'perPage' => PMF_Configuration::getInstance()->get('records.numberOfRecordsPerPage'), 'pageParamName' => 'seite', 'nextPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG['msgNext'] . '</a>', 'prevPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG['msgPrevious'] . '</a>', 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
$faqPagination = new PMF_Pagination($options);
$faqCategoryHelper = PMF_Helper_Category::getInstance();
$faqCategoryHelper->setCategory($category);
$faqSearchHelper = PMF_Helper_Search::getInstance();
$faqSearchHelper->setSearchterm($inputSearchTerm);
$faqSearchHelper->setCategory($category);
$faqSearchHelper->setPagination($faqPagination);
$faqSearchHelper->setPlurals($plr);
$faqSearchHelper->setSessionId($sids);
if ('' == $searchResult && !is_null($inputSearchTerm)) {
    $searchResult = $faqSearchHelper->renderSearchResult($faqSearchResult, $page);
}
$tpl->processTemplate('writeContent', array('msgAdvancedSearch' => $tagSearch ? $PMF_LANG['msgTagSearch'] : $PMF_LANG['msgAdvancedSearch'], 'msgSearch' => $PMF_LANG['msgSearch'], 'searchString' => PMF_String::htmlspecialchars($inputSearchTerm, ENT_QUOTES, 'utf-8'), 'searchOnAllLanguages' => $PMF_LANG['msgSearchOnAllLanguages'], 'checkedAllLanguages' => $allLanguages ? ' checked="checked"' : '', 'selectCategories' => $PMF_LANG['msgSelectCategories'], 'allCategories' => $PMF_LANG['msgAllCategories'], 'printCategoryOptions' => $faqCategoryHelper->renderCategoryOptions($inputCategory), 'writeSendAdress' => '?' . $sids . 'action=search', 'msgSearchWord' => $PMF_LANG['msgSearchWord'], 'printResult' => $searchResult, 'openSearchLink' => $faqSearchHelper->renderOpenSearchLink(), 'msgMostPopularSearches' => $PMF_LANG['msgMostPopularSearches'], 'printMostPopularSearches' => $faqSearchHelper->renderMostPopularSearches($mostPopularSearchData)));
$tpl->includeTemplate('writeContent', 'index');
Пример #7
0
         $result = $mail->send();
         unset($mail);
         $message = array('success' => $PMF_LANG['msgMailContact']);
     } else {
         $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']);
Пример #8
0
 * @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;
}
$faqsession->userTracking('sendmail_send2friend', 0);
$captcha = new PMF_Captcha($sids);
$name = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
$mailfrom = PMF_Filter::filterInput(INPUT_POST, 'mailfrom', FILTER_VALIDATE_EMAIL);
$mailto = PMF_Filter::filterInputArray(INPUT_POST, array('mailto' => array('filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_REQUIRE_ARRAY | FILTER_NULL_ON_FAILURE)));
$link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL);
$attached = PMF_Filter::filterInput(INPUT_POST, 'zusatz', FILTER_SANITIZE_STRIPPED);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
if (!is_null($name) && !is_null($mailfrom) && is_array($mailto) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($attached)) && $captcha->checkCaptchaCode($code)) {
    // Backward compatibility: extract article info from the link, no template change required
    $cat = $id = $artlang = null;
    preg_match('`index\\.php\\?action=artikel&cat=(?<cat>[\\d]+)&id=(?<id>[\\d]+)&artlang=(?<artlang>[^$]+)$`', $link, $matches);
    if (isset($matches['cat'])) {
        $cat = (int) $matches['cat'];
    }
    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');
Пример #9
0
    $record_ids = $tagging->getRecordsByTagId($inputTag);
    $printResult = $faq->showAllRecordsByIds($record_ids);
}
//
// Handle the full text search stuff
//
if (!is_null($inputSearchTerm) || !is_null($search)) {
    if (!is_null($inputSearchTerm)) {
        $inputSearchTerm = $db->escapeString(strip_tags($inputSearchTerm));
    }
    if (!is_null($search)) {
        $inputSearchTerm = $db->escapeString(strip_tags($search));
    }
    $printResult = searchEngine($inputSearchTerm, $inputCategory, $allLanguages);
    $inputSearchTerm = stripslashes($inputSearchTerm);
    $faqsearch->logSearchTerm($inputSearchTerm);
}
// Change a little bit the $searchCategory value;
$inputCategory = '%' == $inputCategory ? 0 : $inputCategory;
$faqsession->userTracking('fulltext_search', $inputSearchTerm);
$openSearchLink = sprintf('<a class="searchplugin" href="#" onclick="window.external.AddSearchProvider(\'%s/opensearch.php\');">%s</a>', PMF_Link::getSystemUri('/index.php'), $PMF_LANG['opensearch_plugin_install']);
$mostPopularSearches = '';
$mostPopularSearchData = $faqsearch->getMostPopularSearches($faqconfig->get('main.numberSearchTerms'));
foreach ($mostPopularSearchData as $searchItem) {
    if (PMF_String::strlen($searchItem['searchterm']) > 0) {
        $mostPopularSearches .= sprintf('<li><a href="?search=%s&submit=Search&action=search">%s</a> (%dx)</li>', urlencode($searchItem['searchterm']), $searchItem['searchterm'], $searchItem['number']);
    }
}
$categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryData)));
$tpl->processTemplate('writeContent', array('msgSearch' => $tagSearch ? $PMF_LANG['msgTagSearch'] : $PMF_LANG['msgSearch'], 'searchString' => PMF_String::htmlspecialchars($inputSearchTerm, ENT_QUOTES, 'utf-8'), 'searchOnAllLanguages' => $PMF_LANG['msgSearchOnAllLanguages'], 'checkedAllLanguages' => $allLanguages ? ' checked="checked"' : '', 'selectCategories' => $PMF_LANG['msgSelectCategories'], 'allCategories' => $PMF_LANG['msgAllCategories'], 'printCategoryOptions' => $categoryLayout->renderOptions(array($inputCategory)), 'writeSendAdress' => '?' . $sids . 'action=search', 'msgSearchWord' => $PMF_LANG['msgSearchWord'], 'printResult' => $printResult, 'openSearchLink' => $openSearchLink, 'msgMostPopularSearches' => $PMF_LANG['msgMostPopularSearches'], 'printMostPopularSearches' => '<ul class="phpmyfaq_ul">' . $mostPopularSearches . '</ul>'));
$tpl->includeTemplate('writeContent', 'index');
Пример #10
0
        $retval = $mail->send();
    }
    return $retval;
}
if (!is_null($username) && !empty($usermail) && !empty($content) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($content)) && $captcha->checkCaptchaCode($code)) {
    $pmf_sw = PMF_Stopwords::getInstance();
    $search_stuff = $pmf_sw->clean($content);
    $search = new PMF_Search($db, $Language);
    $search_result = array();
    $counter = 0;
    foreach ($search_stuff as $word) {
        $tmp = $search->search($word);
        foreach ($tmp as $foundItem) {
            if (!isset($foundItem->id, $search_result[$foundItem->category_id])) {
                $counter++;
                $foundItem->searchterm = PMF_String::htmlspecialchars(stripslashes($word), ENT_QUOTES, 'utf-8');
                $search_result[$foundItem->category_id][$foundItem->id] = $foundItem;
            }
        }
    }
    if ($search_result) {
        $faqUser = new PMF_Faq_User();
        $faqGroup = new PMF_Faq_Group();
        $search_result_html = '<p>' . $plr->GetMsg('plmsgSearchAmount', count($search_result)) . "</p>\n";
        $counter = 0;
        foreach ($search_result as $cat_id => $cat_contents) {
            $tmp_result_html = '';
            foreach ($cat_contents as $cat_content_item) {
                $b_permission = false;
                //Groups Permission Check
                if ($faqconfig->get('main.permLevel') == 'medium') {
    $groupPermission = $faq->getPermission('group', $faqData['id']);
    if (count($groupPermission) == 0 || $groupPermission[0] == -1) {
        $allGroups = true;
        $restrictedGroups = false;
        $groupPermission[0] = -1;
    } else {
        $allGroups = false;
        $restrictedGroups = true;
    }
    // Set data for forms
    $faqData['title'] = isset($faqData['title']) ? PMF_String::htmlspecialchars($faqData['title']) : '';
    $faqData['content'] = isset($faqData['content']) ? trim(PMF_String::htmlentities($faqData['content'])) : '';
    $faqData['tags'] = isset($faqData['tags']) ? PMF_String::htmlspecialchars($faqData['tags']) : '';
    $faqData['keywords'] = isset($faqData['keywords']) ? PMF_String::htmlspecialchars($faqData['keywords']) : '';
    $faqData['author'] = isset($faqData['author']) ? PMF_String::htmlspecialchars($faqData['author']) : $user->getUserData('display_name');
    $faqData['email'] = isset($faqData['email']) ? PMF_String::htmlspecialchars($faqData['email']) : $user->getUserData('email');
    $faqData['isoDate'] = isset($faqData['date']) ? $faqData['date'] : date('Y-m-d H:i');
    $faqData['date'] = isset($faqData['date']) ? $date->format($faqData['date']) : $date->format(date('Y-m-d H:i'));
    $faqData['changed'] = isset($faqData['changed']) ? $faqData['changed'] : '';
    if (isset($faqData['comment']) && $faqData['comment'] == 'y') {
        $faqData['comment'] = ' checked="checked"';
    } elseif ($faqConfig->get('records.defaultAllowComments')) {
        $faqData['comment'] = ' checked="checked"';
    } else {
        $faqData['comment'] = '';
    }
    // Start header
    ?>
        <header>
            <h2>
<?php 
Пример #12
0
 /**
  * Returns all records from the current first letter
  *
  * @param  string $letter Letter
  * @return array
  * @since  2007-03-30
  * @author Thorsten Rinne <*****@*****.**>
  */
 public function getRecordsFromLetter($letter = 'A')
 {
     global $sids, $PMF_LANG;
     if ($this->groupSupport) {
         $permPart = sprintf("( fdg.group_id IN (%s)\n            OR\n                (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
     } else {
         $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
     }
     $letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1)));
     $writeMap = '';
     switch ($this->type) {
         case 'db2':
         case 'sqlite':
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTR(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
         default:
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTRING(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
     }
     $result = $this->db->query($query);
     $oldId = 0;
     while ($row = $this->db->fetch_object($result)) {
         if ($oldId != $row->id) {
             $title = PMF_String::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8');
             $url = sprintf('%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
             $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
             $oLink->itemTitle = $row->thema;
             $oLink->text = $title;
             $oLink->tooltip = $title;
             $writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n";
             $writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25) . " ...</li>\n";
         }
         $oldId = $row->id;
     }
     $writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>';
     return $writeMap;
 }
Пример #13
0
                 $mquery[] = trim(PMF_String::substr($dat, 0, -1));
             }
         }
         $k = 0;
         $g = 0;
         printf("<p>%s</p>\n", $PMF_LANG['ad_csv_process']);
         $num = count($mquery);
         $kg = '';
         for ($i = 0; $i < $num; $i++) {
             $mquery[$i] = alignTablePrefix($mquery[$i], $table_prefix, SQLPREFIX);
             $kg = $db->query($mquery[$i]);
             if (!$kg) {
                 printf('<div style="font-size: 9px;"><strong>Query</strong>: "%s" <span style="color: red;">failed (Reason: %s)</span></div>%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), $db->error(), "\n");
                 $k++;
             } else {
                 printf('<!-- <div style="font-size: 9px;"><strong>Query</strong>: "%s" <span style="color: green;">okay</span></div> -->%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), "\n");
                 $g++;
             }
         }
         printf('<p class="success">%d %s %d %s</p>', $g, $PMF_LANG['ad_csv_of'], $num, $PMF_LANG['ad_csv_suc']);
     }
 } else {
     switch ($_FILES['userfile']['error']) {
         case 1:
             $errorMessage = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
             break;
         case 2:
             $errorMessage = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
             break;
         case 3:
             $errorMessage = 'The uploaded file was only partially uploaded.';
Пример #14
0
 /**
  * Returns the HTML for the Tags Cloud
  *
  * @return string
  */
 public function printHTMLTagsCloud()
 {
     global $sids;
     $html = '';
     $tags = array();
     // Limit the result set (see: PMF_TAGS_CLOUD_RESULT_SET_SIZE)
     // for avoiding an 'heavy' load during the evaluation
     // of the number of records for each tag
     $tagList = $this->getAllTags('', true);
     foreach ($tagList as $tagId => $tagName) {
         $totFaqByTag = count($this->getRecordsByTagName($tagName));
         if ($totFaqByTag > 0) {
             $tags[$tagName]['id'] = $tagId;
             $tags[$tagName]['name'] = $tagName;
             $tags[$tagName]['count'] = $totFaqByTag;
         }
     }
     $min = 0;
     $max = 0;
     foreach ($tags as $tag) {
         if ($min > $tag['count']) {
             $min = $tag['count'];
         }
         if ($max < $tag['count']) {
             $max = $tag['count'];
         }
     }
     $CSSRelevanceLevels = 5;
     $CSSRelevanceMinLevel = 1;
     $CSSRelevanceMaxLevel = $CSSRelevanceLevels - $CSSRelevanceMinLevel;
     $CSSRelevanceLevel = 3;
     $html = '<div class="tagscloud">';
     $i = 0;
     foreach ($tags as $tag) {
         $i++;
         if ($max - $min > 0) {
             $CSSRelevanceLevel = (int) ($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel * ($tag['count'] - $min) / ($max - $min));
         }
         $class = 'relevance' . $CSSRelevanceLevel;
         $html .= '<span class="' . $class . '">';
         $title = PMF_String::htmlspecialchars($tag['name'] . ' (' . $tag['count'] . ')', ENT_QUOTES, 'utf-8');
         $url = sprintf($sids . 'action=search&amp;tagging_id=%d', $tag['id']);
         $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
         $oLink->itemTitle = $tag['name'];
         $oLink->text = $tag['name'];
         $oLink->tooltip = $title;
         $html .= $oLink->toHtmlAnchor();
         $html .= (count($tags) == $i ? '' : ' ') . '</span>';
     }
     $html .= '</div>';
     return $html;
 }
Пример #15
0
 /**
  * Wrapper for the PMF_Export_Docbook class
  * 
  */
 private static function _generateDocBookExport2()
 {
     // TODO: check/refine/improve/fix docbook.php and add toString method before recoding the method in order to use faq and news classes.
     global $PMF_CONF, $PMF_LANG;
     // XML DocBook export
     $parentID = 0;
     $rubrik = 0;
     $sql = '';
     $selectString = '';
     $db = PMF_Db::getInstance();
     $export = new PMF_Export_Docbook();
     $export->delete_file();
     // Set the FAQ title
     $faqtitel = PMF_String::htmlspecialchars($PMF_CONF['main.titleFAQ']);
     // Print the title of the FAQ
     $export->xmlContent = '<?xml version="1.0" encoding="' . $PMF_LANG['metaCharset'] . '"?>' . '<book lang="en">' . '<title>phpMyFAQ</title>' . '<bookinfo>' . '<title>' . $faqtitel . '</title>' . '</bookinfo>';
     // include the news
     $result = $db->query("SELECT id, header, artikel, datum FROM " . SQLPREFIX . "faqnews");
     // Write XML file
     $export->write_file();
     // Transformation of the news entries
     if ($db->num_rows($result) > 0) {
         $export->xmlContent .= '<part><title>News</title>';
         while ($row = $db->fetch_object($result)) {
             $datum = $export->aktually_date($row->datum);
             $export->xmlContent .= '<article>' . '<title>' . $row->header . '</title>' . '<para>' . wordwrap($datum, 20) . '</para>';
             $replacedString = ltrim(str_replace('<br />', '', $row->artikel));
             $export->TableImageText($replacedString);
             $export->xmlContent .= '</article>';
         }
         $export->xmlContent .= '</part>';
     }
     $export->write_file();
     // Transformation of the articles
     $export->xmlContent .= '<part>' . '<title>Artikel</title>' . '<preface>' . '<title>Rubriken</title>';
     // Selection of the categories
     $export->recursive_category($parentID);
     $export->xmlContent .= '</preface>' . '</part>' . '</book>';
     $export->write_file();
 }
Пример #16
0
        print $PMF_LANG["ad_entry_back"];
        ?>
" /></p>
    </form>
<?php 
    } else {
        printf("<h2>%s</h2>\n", $PMF_LANG['ad_entry_aor']);
        printf("<p>%s</p>", $PMF_LANG['ad_entryins_fail']);
        ?>
    <form action="?action=editpreview" method="post">
    <input type="hidden" name="thema"               value="<?php 
        print PMF_String::htmlspecialchars($question);
        ?>
" />
    <input type="hidden" name="content" class="mceNoEditor" value="<?php 
        print PMF_String::htmlspecialchars($content);
        ?>
" />
    <input type="hidden" name="lang"                value="<?php 
        print $record_lang;
        ?>
" />
    <input type="hidden" name="keywords"            value="<?php 
        print $keywords;
        ?>
" />
    <input type="hidden" name="tags"                value="<?php 
        print $tags;
        ?>
" />
    <input type="hidden" name="author"              value="<?php 
Пример #17
0
        ?>
<td><input style="width: 300px;" type="text" name="<?php 
        echo $key;
        ?>
" value="<?php 
        echo PMF_String::htmlspecialchars($rightVarsOnly[$key]);
        ?>
" /></td>
<?php 
    } else {
        ?>
<td><input style="width: 300px;border-color: red;" type="text" name="<?php 
        echo $key;
        ?>
" value="<?php 
        echo PMF_String::htmlspecialchars($line);
        ?>
" /></td>
<?php 
    }
    ?>
</tr>
<?php 
}
?>
<tr>
<td colspan="3"><?php 
echo $pageBar;
?>
</td>
</tr>
Пример #18
0
        ?>
</td>
        <td><a href="../index.php?action=artikel&amp;cat=<?php 
        print $data['category_id'];
        ?>
&amp;id=<?php 
        print $data['id'];
        ?>
&amp;artlang=<?php 
        print $data['lang'];
        ?>
" title="<?php 
        print PMF_String::htmlspecialchars(trim($data['question']), ENT_QUOTES, 'utf-8');
        ?>
"><?php 
        print PMF_Utils::makeShorterText(PMF_String::htmlspecialchars(trim($data['question']), ENT_QUOTES, 'utf-8'), 14);
        ?>
</a></td>
        <td><?php 
        print $data['usr'];
        ?>
</td>
        <td style="width: 50px;"><img src="stat.bar.php?num=<?php 
        print $data['num'];
        ?>
" border="0" alt="<?php 
        print round($data['num'] * 20);
        ?>
 %" width="50" height="15" title="<?php 
        print round($data['num'] * 20);
        ?>
Пример #19
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');
Пример #20
0
    } else {
        print $user->getUserData('display_name');
    }
    ?>
" />
                </p>

                <p>
                    <label for="email"><?php 
    print $PMF_LANG["ad_entry_email"];
    ?>
</label>
                    <input type="email" name="email" id="email" style="width: 300px;"
                           value="<?php 
    if (isset($faqData['email'])) {
        print PMF_String::htmlspecialchars($faqData['email']);
    } else {
        print $user->getUserData('email');
    }
    ?>
" />
                </p>

            </fieldset>

            <fieldset>
                <legend><?php 
    print $PMF_LANG['ad_entry_record_administration'];
    ?>
</legend>
Пример #21
0
            $displayedCounter++;
            continue;
        }
        $counter++;
        if ($counter <= $start) {
            continue;
        }
        $displayedCounter++;
        $num = round($searchItem['number'] * 100 / $searchesCount, 2);
        ?>
        <tr class="row_search_id_<?php 
        print $searchItem['id'];
        ?>
">
            <td><?php 
        print PMF_String::htmlspecialchars($searchItem['searchterm']);
        ?>
</td>
            <td><?php 
        print $searchItem['number'];
        ?>
</td>
            <td><?php 
        print $languageCodes[PMF_String::strtoupper($searchItem['lang'])];
        ?>
</td>
            <td><?php 
        print $num;
        ?>
 %</td>
            <td>
 /**
  * Generates the export
  *
  * @param integer $categoryId Category Id
  * @param boolean $downwards  If true, downwards, otherwise upward ordering
  * @param string  $language   Language
  *
  * @return string
  */
 public function generate($categoryId = 0, $downwards = true, $language = '')
 {
     // Initialize categories
     $this->category->transform($categoryId);
     $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XML, $categoryId, $downwards, $language);
     $version = $this->_config->get('main.currentVersion');
     $comment = sprintf('XML output by phpMyFAQ %s | Date: %s', $version, PMF_Date::createIsoDate(date("YmdHis")));
     $this->xml->startDocument('1.0', 'utf-8', 'yes');
     $this->xml->writeComment($comment);
     $this->xml->startElement('phpmyfaq');
     if (count($faqdata)) {
         foreach ($faqdata as $data) {
             // Build the <article/> node
             $this->xml->startElement('article');
             $this->xml->writeAttribute('id', $data['id']);
             $this->xml->writeElement('language', $data['lang']);
             $this->xml->writeElement('category', $this->category->getPath($data['category_id'], ' >> '));
             if (!empty($data['keywords'])) {
                 $this->xml->writeElement('keywords', $data['keywords']);
             } else {
                 $this->xml->writeElement('keywords');
             }
             $this->xml->writeElement('question', strip_tags($data['topic']));
             $this->xml->writeElement('answer', PMF_String::htmlspecialchars($data['content']));
             if (!empty($data['author_name'])) {
                 $this->xml->writeElement('author', $data['author_name']);
             } else {
                 $this->xml->writeElement('author');
             }
             $this->xml->writeElement('data', PMF_Date::createIsoDate($data['lastmodified']));
             $this->xml->endElement();
         }
     }
     $this->xml->endElement();
     header('Content-type: text/xml');
     return $this->xml->outputMemory();
 }
Пример #23
0
</td>
        <td><?php 
        print $data['lang'];
        ?>
</td>
        <td><a href="../index.php?action=artikel&amp;cat=<?php 
        print $data['category_id'];
        ?>
&amp;id=<?php 
        print $data['id'];
        ?>
&amp;artlang=<?php 
        print $data['lang'];
        ?>
" title="<?php 
        print PMF_String::htmlspecialchars(trim($data['question']), ENT_QUOTES, 'utf-8');
        ?>
"><?php 
        print PMF_Utils::makeShorterText(PMF_htmlentities(trim($data['question']), ENT_QUOTES, 'utf-8'), 14);
        ?>
</a></td>
        <td><?php 
        print $data['usr'];
        ?>
</td>
        <td style="width: 50px;"><img src="stat.bar.php?num=<?php 
        print $data['num'];
        ?>
" border="0" alt="<?php 
        print round($data['num'] * 20);
        ?>
Пример #24
0
    print $id;
    ?>
]"  value="<?php 
    print PMF_String::htmlspecialchars($row->url);
    ?>
"  <?php 
    print $_owner ? '' : 'disabled';
    ?>
  ></td>

        <!-- Reason to warn/ignore -->
        <td><input type="text" name="reason[<?php 
    print $id;
    ?>
]" value="<?php 
    print PMF_String::htmlspecialchars($row->reason);
    ?>
"  <?php 
    print $_owner ? '' : 'disabled';
    ?>
  ></td>

        <!-- Lock entry / chown entry -->
        <td>
        <?php 
    if ($row->locked == 'y') {
        if ($_owner || $_admin) {
            ?>
                    <input type="checkbox" name="locked[<?php 
            print $id;
            ?>
Пример #25
0
 /**
  * Verifies specified article content and update links_state database entry
  *
  * @param   string  $contents
  * @param   integer $id
  * @param   string  $artlang
  * @param   boolean $cron
  * 
  * @result  string  HTML text, if $cron is false (default)
  */
 public function verifyArticleURL($contents = '', $id = 0, $artlang = '', $cron = false)
 {
     global $PMF_LANG;
     $faqconfig = PMF_Configuration::getInstance();
     if ($faqconfig->get('main.referenceURL') == '') {
         $output = $PMF_LANG['ad_linkcheck_noReferenceURL'];
         return $cron ? '' : '<br /><br />' . $output;
     }
     if (trim('' == $faqconfig->get('main.referenceURL'))) {
         $output = $PMF_LANG['ad_linkcheck_noReferenceURL'];
         return $cron ? '' : '<br /><br />' . $output;
     }
     if ($this->isReady() === false) {
         $output = $PMF_LANG['ad_linkcheck_noAllowUrlOpen'];
         return $cron ? '' : '<br /><br />' . $output;
     }
     // Parse contents and verify URLs
     $this->parse_string($contents);
     $result = $this->VerifyURLs($faqconfig->get('main.referenceURL'));
     $this->markEntry($id, $artlang);
     // If no URLs found
     if ($result == false) {
         $output = sprintf('<h2>%s</h2><br />%s', $PMF_LANG['ad_linkcheck_checkResult'], $PMF_LANG['ad_linkcheck_noLinksFound']);
         return $cron ? '' : utf8_decode($output);
     }
     //uncomment to see the result structure
     //print str_replace("\n","<br />",PMF_String::htmlspecialchars(print_r($result, true)));
     $failreasons = $inforeasons = array();
     $output = "    <h2>" . $PMF_LANG['ad_linkcheck_checkResult'] . "</h2>\n";
     $output .= '    <table class="verifyArticleURL">' . "\n";
     foreach ($result as $type => $_value) {
         $output .= "        <tr><td><strong>" . PMF_String::htmlspecialchars($type) . "</strong></td></tr>\n";
         foreach ($_value as $url => $value) {
             $_output = '            <td />';
             $_output .= '            <td><a href="' . $value['absurl'] . '" target="_blank">' . PMF_String::htmlspecialchars($value['absurl']) . "</a></td>\n";
             $_output .= '            <td>';
             if (isset($value['redirects']) && $value['redirects'] > 0) {
                 $_redirects = "(" . $value['redirects'] . ")";
             } else {
                 $_redirects = "";
             }
             if ($value['valid'] === true) {
                 $_classname = "urlsuccess";
                 $_output .= '<td class="' . $_classname . '">' . $PMF_LANG['ad_linkcheck_checkSuccess'] . $_redirects . '</td>';
                 if ($value['reason'] != "") {
                     $inforeasons[] = sprintf($PMF_LANG['ad_linkcheck_openurl_infoprefix'], PMF_String::htmlspecialchars($value['absurl'])) . $value['reason'];
                 }
             } else {
                 $_classname = "urlfail";
                 $_output .= '<td class="' . $_classname . '">' . $PMF_LANG['ad_linkcheck_checkFailed'] . '</td>';
                 if ($value['reason'] != "") {
                     $failreasons[] = $value['reason'];
                 }
             }
             $_output .= '</td>';
             $output .= '        <tr class="' . $_classname . '">' . "\n" . $_output . "\n";
             $output .= "        </tr>\n";
         }
     }
     $output .= "    </table>\n";
     if (count($failreasons) > 0) {
         $output .= "    <br />\n    <strong>" . $PMF_LANG['ad_linkcheck_failReason'] . "</strong>\n    <ul>\n";
         foreach ($failreasons as $reason) {
             $output .= "        <li>" . $reason . "</li>\n";
         }
         $output .= "    </ul>\n";
     }
     if (count($inforeasons) > 0) {
         $output .= "    <br />\n    <strong>" . $PMF_LANG['ad_linkcheck_infoReason'] . "</strong>\n    <ul>\n";
         foreach ($inforeasons as $reason) {
             $output .= "        <li>" . $reason . "</li>\n";
         }
         $output .= "    </ul>\n";
     }
     if ($cron) {
         return '';
     } else {
         return utf8_decode($output);
     }
 }
Пример #26
0
]" value="<?php 
            print $newscomment['comment_id'];
            ?>
" type="checkbox" /></td>
        <td class="list">
            <span style="font-weight: bold;">
                <a href="mailto:<?php 
            print $newscomment['email'];
            ?>
"><?php 
            print $newscomment['user'];
            ?>
</a>
            </span><br/>
            <?php 
            print PMF_String::htmlspecialchars($newscomment['content']);
            ?>
        </td>
    </tr>
<?php 
        }
        ?>
    <tr>
        <td colspan="3"><input class="submit" type="submit" value="<?php 
        print $PMF_LANG["ad_entry_delete"];
        ?>
" name="submit" /></td>
    </tr>
    </table>
<?php 
    } else {
Пример #27
0
                    <tbody>
<?php 
    foreach ($ratingdata as $data) {
        if ($data['category_id'] != $oldcategory) {
            ?>
                    <tr>
                        <th colspan="6" style="text-align: left;">
                            <h4><?php 
            echo $category->categoryName[$data['category_id']]['name'];
            ?>
</h4>
                        </th>
                    </tr>
<?php 
        }
        $question = PMF_String::htmlspecialchars(trim($data['question']));
        $url = sprintf('../index.php?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $data['category_id'], $data['id'], $data['lang']);
        ?>
                    <tr>
                        <td><?php 
        echo $data['id'];
        ?>
</td>
                        <td><?php 
        echo $data['lang'];
        ?>
</td>
                        <td>
                            <a href="<?php 
        echo $url;
        ?>
Пример #28
0
$thema = PMF_Filter::filterInput(INPUT_POST, 'thema', FILTER_SANITIZE_STRIPPED);
$content = PMF_Filter::filterInput(INPUT_POST, 'content', FILTER_SANITIZE_STRIPPED);
$tr_content = PMF_Filter::filterInput(INPUT_POST, 'translated_content', FILTER_SANITIZE_STRING);
$contentlink = PMF_Filter::filterInput(INPUT_POST, 'contentlink', FILTER_VALIDATE_URL);
$keywords = PMF_Filter::filterInput(INPUT_POST, 'keywords', FILTER_SANITIZE_STRIPPED);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
$categories = PMF_Filter::filterInputArray(INPUT_POST, array('rubrik' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY)));
// If e-mail address is set to optional
if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($usermail)) {
    $usermail = PMF_Configuration::getInstance()->get('main.administrationMail');
}
// Check on translation
if (is_null($content) && !is_null($tr_content)) {
    $content = $tr_content;
}
if (!is_null($username) && !is_null($usermail) && !is_null($thema) && !is_null($content) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($thema)) && checkBannedWord(PMF_String::htmlspecialchars($content)) && $captcha->checkCaptchaCode($code) && (is_null($faqid) && !is_null($categories) || !is_null($faqid) && !is_null($faqlanguage) && PMF_Language::isASupportedLanguage($faqlanguage))) {
    $isNew = true;
    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>";
    }
Пример #29
0
switch ($type) {
    case 'news':
        $id = $newsid;
        $msgWriteComment = $PMF_LANG['newsWriteComment'];
        break;
    case 'faq':
    default:
        $id = $faqid;
        $msgWriteComment = $PMF_LANG['msgWriteComment'];
        break;
}
// If e-mail address is set to optional
if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($mail)) {
    $mail = PMF_Configuration::getInstance()->get('main.administrationMail');
}
if (!is_null($user) && !is_null($mail) && !is_null($comment) && checkBannedWord(PMF_String::htmlspecialchars($comment)) && IPCheck($_SERVER['REMOTE_ADDR']) && $captcha->checkCaptchaCode($code) && !$faq->commentDisabled($id, $LANGCODE, $type)) {
    $faqsession->userTracking("save_comment", $id);
    $commentData = array('record_id' => $id, 'type' => $type, 'username' => $user, 'usermail' => $mail, 'comment' => nl2br($comment), 'date' => $_SERVER['REQUEST_TIME'], 'helped' => '');
    if ($faq->addComment($commentData)) {
        $emailTo = $faqconfig->get('main.administrationMail');
        $urlToContent = '';
        if ('faq' == $type) {
            $faq->getRecord($id);
            if ($faq->faqRecord['email'] != '') {
                $emailTo = $faq->faqRecord['email'];
            }
            $_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 {
 /**
  * Returns the keywords of a FAQ record from the ID and language
  *
  * @param  integer $id record id
  * @return string
  */
 public function getRecordKeywords($id)
 {
     if (isset($this->faqRecord['id']) && $this->faqRecord['id'] == $id) {
         return $this->faqRecord['keywords'];
     }
     $query = sprintf("SELECT\n                keywords\n            FROM\n                %sfaqdata\n            WHERE id = %d AND lang = '%s'", PMF_Db::getTablePrefix(), $id, $this->_config->getLanguage()->getLanguage());
     $result = $this->_config->getDb()->query($query);
     if ($this->_config->getDb()->numRows($result) > 0) {
         $row = $this->_config->getDb()->fetchObject($result);
         return PMF_String::htmlspecialchars($row->keywords, ENT_QUOTES, 'utf-8');
     } else {
         return '';
     }
 }