Example #1
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_htmlentities($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;
 }
Example #2
0
 * @author     Thorsten Rinne <*****@*****.**>
 * @since      2002-09-16
 * @version    SVN: $Id$
 * @copyright  2002-2009 phpMyFAQ Team
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$faqsession->userTracking('send2friend', 0);
$cat = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
$id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$artlang = PMF_Filter::filterInput(INPUT_GET, 'artlang', FILTER_SANITIZE_STRING);
$send2friendLink = sprintf('http://%s%s?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'], $cat, $id, urlencode($artlang));
$tpl->processTemplate('writeContent', array('msgSend2Friend' => $PMF_LANG['msgSend2Friend'], 'writeSendAdress' => $_SERVER['PHP_SELF'] . '?' . $sids . 'action=mailsend2friend', 'msgS2FReferrer' => 'link', 'msgS2FName' => $PMF_LANG['msgS2FName'], 'msgS2FEMail' => $PMF_LANG['msgS2FEMail'], 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgS2FFriends' => $PMF_LANG['msgS2FFriends'], 'msgS2FEMails' => $PMF_LANG['msgS2FEMails'], 'msgS2FText' => $PMF_LANG['msgS2FText'], 'send2friend_text' => PMF_htmlentities($PMF_CONF['main.send2friendText'], ENT_QUOTES, $PMF_LANG['metaCharset']), 'msgS2FText2' => $PMF_LANG['msgS2FText2'], 'send2friendLink' => $send2friendLink, 'msgS2FMessage' => $PMF_LANG['msgS2FMessage'], 'captchaFieldset' => printCaptchaFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('send2friend'), $captcha->caplength), 'msgS2FButton' => $PMF_LANG['msgS2FButton']));
$tpl->includeTemplate('writeContent', 'index');
Example #3
0
</script>
<script type="text/javascript" src="editor/htmlarea.js"></script>
<script type="text/javascript" src="editor/plugins/ImageManager/image-manager.js"></script>
<script type="text/javascript">
//<![CDATA[
    HTMLArea.init();
    HTMLArea.loadPlugin('ImageManager');
    HTMLArea.onload = function() {
    var editor = new HTMLArea('content');
    var config = new HTMLArea.Config();
    var phpMyFAQLinks   = {
<?php 
    $output = "'Include internal links' : '',\n";
    $result = $db->query('SELECT ' . SQLPREFIX . 'faqdata.id AS id, ' . SQLPREFIX . 'faqdata.lang AS lang, ' . SQLPREFIX . 'faqcategoryrelations.category_id AS category_id, ' . SQLPREFIX . 'faqdata.thema AS thema FROM ' . SQLPREFIX . 'faqdata LEFT JOIN ' . SQLPREFIX . 'faqcategoryrelations ON ' . SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqcategoryrelations.record_id AND ' . SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqcategoryrelations.record_lang ORDER BY ' . SQLPREFIX . 'faqcategoryrelations.category_id, ' . SQLPREFIX . 'faqdata.id');
    while ($row = $db->fetch_object($result)) {
        $_title = makeShorterText(addslashes(PMF_htmlentities(str_replace(array("\n", "\r", "\r\n"), "", $row->thema), ENT_NOQUOTES, $PMF_LANG['metaCharset'])), 8);
        $output .= sprintf("'%s' : '<a href=\"index.php?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s\">%s<\\/a>',\n", $_title, $row->category_id, $row->id, $row->lang, $_title);
    }
    $output = substr($output, 0, -2);
    print $output;
    ?>
        };

    var internalLinks = {
        id      :   'internalLinks',
        tooltip :   'internal Link',
        options :   phpMyFAQLinks,
        action  :   function(editor)
        {
            var elem = editor._toolbarObjects[this.id].element;
            editor.insertHTML(elem.value);
Example #4
0
            ?>
 /></td>
        <td class="list"><a href="?action=editentry&amp;id=<?php 
            print $record['id'];
            ?>
&amp;lang=<?php 
            print $record['lang'];
            ?>
" title="<?php 
            print $PMF_LANG["ad_user_edit"];
            ?>
 '<?php 
            print str_replace("\"", "ยด", $record['title']);
            ?>
'"><?php 
            print PMF_htmlentities($record['title'], ENT_QUOTES, $PMF_LANG['metaCharset']);
            ?>
</a>
<?php 
            if (isset($numCommentsByFaq[$record['id']])) {
                print " (" . $numCommentsByFaq[$record['id']] . " " . $PMF_LANG["ad_start_comments"] . ")";
            }
            ?>
</td>
        <td class="list" style="width: 48px;"><?php 
            print PMF_String::substr($record['date'], 0, 10);
            ?>
</td>
        <td class="list" style="width: 96px;"><?php 
            print $linkverifier->getEntryStateHTML($record['id'], $record['lang']);
            ?>
Example #5
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_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);
        ?>
 %" width="50" height="15" title="<?php 
        print round($data['num'] * 20);
        ?>
Example #6
0
/**
 * Output the data as an HTML Definition List.
 *
 * @param  mixed  $value Value
 * @param  string $key   Key
 * @param  string $ident Identian
 * 
 * @return  void
 */
function data_printer($value, $key, $ident = "\n\t")
{
    echo $ident, '<dt>', PMF_htmlentities($key), '</dt>', $ident, "\t", '<dd>';
    if (is_array($value)) {
        echo '<dl>';
        array_walk($value, 'data_printer', $ident . "\t");
        echo $ident, "\t", '</dl>';
    } else {
        echo PMF_htmlentities($value);
    }
    echo '</dd>';
}
Example #7
0
/**
 * Contact page
 *
 * @package   phpMyFAQ
 * @author    Thorsten Rinne <*****@*****.**>
 * @since     2002-09-16
 * @version   SVN: $Id$
 * @copyright 2002-2009 phpMyFAQ Team
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$faqsession->userTracking('contact', 0);
$captcha = new PMF_Captcha($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$tpl->processTemplate('writeContent', array('msgContact' => $PMF_LANG['msgContact'], 'msgContactOwnText' => nl2br(PMF_htmlentities($faqconfig->get('main.contactInformations'), ENT_QUOTES, $PMF_LANG['metaCharset'])), 'msgContactEMail' => $PMF_LANG['msgContactEMail'], 'writeSendAdress' => '?' . $sids . 'action=sendmail', 'msgNewContentName' => $PMF_LANG['msgNewContentName'], 'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgMessage' => $PMF_LANG['msgMessage'], 'msgS2FButton' => $PMF_LANG['msgS2FButton'], 'version' => $faqconfig->get('main.currentVersion'), 'captchaFieldset' => printCaptchaFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('contact'), $captcha->caplength)));
$tpl->includeTemplate('writeContent', 'index');
Example #8
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();
    $search_result = array();
    $counter = 0;
    foreach ($search_stuff as $word) {
        $tmp = getSearchData($word);
        foreach ($tmp as $foundItem) {
            if (!isset($foundItem->id, $search_result[$foundItem->category_id])) {
                $counter++;
                $foundItem->searchterm = PMF_htmlentities(stripslashes($word), ENT_QUOTES, $PMF_LANG['metaCharset']);
                $search_result[$foundItem->category_id][$foundItem->id] = $foundItem;
            }
        }
    }
    if ($search_result) {
        $search_result_html = '<p>' . $plr->GetMsg('plmsgSearchAmount', $num) . "</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') {
                    $perm_group = $faq->getPermission('group', $cat_content_item->id);
                    foreach ($current_groups as $index => $value) {
Example #9
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->escapeString(PMF_String::substr($letter, 0, 1)));
     $writeMap = '<ul>';
     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->fetchObject($result)) {
         if ($oldId != $row->id) {
             $title = PMF_htmlentities($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 .= chopString(strip_tags($row->snap), 25) . " ...</li>\n";
         }
         $oldId = $row->id;
     }
     $writeMap .= '</ul>';
     return $writeMap;
 }
Example #10
0
/**
 * The main search function for the full text search
 *
 * TODO: add filter for (X)HTML tag names and attributes!
 *
 * @param   string  Text/Number (solution id)
 * @param   string  '%' to avoid any category filtering
 * @param   boolean true to search over all languages
 * @param   boolean true to disable the results paging
 * @param   boolean true to use it for Instant Response
 * @return  string
 * @access  public
 * @author  Thorsten Rinne <*****@*****.**>
 * @author  Matteo Scaramuccia <*****@*****.**>
 * @author  Adrianna Musiol <*****@*****.**>
 * @since   2002-09-16
 */
function searchEngine($searchterm, $cat = '%', $allLanguages = true, $hasMore = false, $instantRespnse = false)
{
    global $sids, $PMF_LANG, $plr, $LANGCODE, $faq, $current_user, $current_groups, $categoryLayout;
    $_searchterm = PMF_htmlentities(stripslashes($searchterm), ENT_QUOTES, 'utf-8');
    $seite = 1;
    $output = '';
    $num = 0;
    $searchItems = array();
    $langs = true == $allLanguages ? '&amp;langs=all' : '';
    $seite = PMF_Filter::filterInput(INPUT_GET, 'seite', FILTER_VALIDATE_INT, 1);
    $db = PMF_Db::getInstance();
    $faqconfig = PMF_Configuration::getInstance();
    $result = getSearchData(htmlentities($searchterm, ENT_COMPAT, 'utf-8'), true, $cat, $allLanguages);
    $num = $db->numRows($result);
    if (0 == $num) {
        $output = $PMF_LANG['err_noArticles'];
    }
    $confPerPage = $faqconfig->get('main.numberOfRecordsPerPage');
    $pages = ceil($num / $confPerPage);
    $last = $seite * $confPerPage;
    $first = $last - $confPerPage;
    if ($last > $num) {
        $last = $num;
    }
    if ($num > 0) {
        $output .= '<p>' . $plr->GetMsg('plmsgSearchAmount', $num);
        if ($hasMore && $pages > 1) {
            $output .= sprintf($PMF_LANG['msgInstantResponseMaxRecords'], $confPerPage);
        }
        $output .= "</p>\n";
        if (!$hasMore && $pages > 1) {
            $output .= "<p><strong>" . $PMF_LANG["msgPage"] . $seite . " " . $PMF_LANG["msgVoteFrom"] . " " . $plr->GetMsg('plmsgPagesTotal', $pages) . "</strong></p>";
        }
        $output .= "<ul class=\"phpmyfaq_ul\">\n";
        $faqUser = new PMF_Faq_User();
        $faqGroup = new PMF_Faq_Group();
        $counter = $displayedCounter = 0;
        while (($row = $db->fetchObject($result)) && $displayedCounter < $confPerPage) {
            $counter++;
            if ($counter <= $first) {
                continue;
            }
            $displayedCounter++;
            $b_permission = false;
            //Groups Permission Check
            if ($faqconfig->get('main.permLevel') == 'medium') {
                $perm_group = $faqGroup->fetch($row->id);
                foreach ($current_groups as $value) {
                    if ($value == $perm_group->group_id) {
                        $b_permission = true;
                    }
                }
            }
            if ($faqconfig->get('main.permLevel') == 'basic' || $b_permission) {
                $perm_user = $faqUser->fetch($row->id);
                foreach ($perm_user as $value) {
                    if ($value == -1) {
                        $b_permission = true;
                        break;
                    } elseif ((int) $value == $current_user) {
                        $b_permission = true;
                        break;
                    } else {
                        $b_permission = false;
                    }
                }
            }
            if ($b_permission) {
                $rubriktext = $categoryLayout->renderBreadcrumb(array($row->category_id));
                $thema = chopString($row->thema, 15);
                $content = chopString(strip_tags($row->content), 25);
                $searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $searchterm);
                $searchterm = preg_quote($searchterm, '/');
                $searchItems = explode(' ', $searchterm);
                if (PMF_String::strlen($searchItems[0]) > 1) {
                    foreach ($searchItems as $item) {
                        if (PMF_String::strlen($item) > 2) {
                            $thema = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $thema);
                            $content = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $content);
                        }
                    }
                }
                // Print the link to the faq record
                $url = sprintf('?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s&amp;highlight=%s', $sids, $row->category_id, $row->id, $row->lang, urlencode($_searchterm));
                if ($instantRespnse) {
                    $currentUrl = PMF_Link::getSystemRelativeUri('ajaxresponse.php') . 'index.php';
                } else {
                    $currentUrl = PMF_Link::getSystemRelativeUri();
                }
                $oLink = new PMF_Link($currentUrl . $url);
                $oLink->itemTitle = $row->thema;
                $oLink->text = $thema;
                $oLink->tooltip = $row->thema;
                $output .= '<li><strong>' . $rubriktext . '</strong>: ' . $oLink->toHtmlAnchor() . '<br />' . '<div class="searchpreview"><strong>' . $PMF_LANG['msgSearchContent'] . '</strong> ' . $content . '...</div>' . '<br /></li>' . "\n";
            }
        }
        $output .= "</ul>\n";
    } else {
        $output = $PMF_LANG["err_noArticles"];
    }
    if (!$hasMore && $num > $confPerPage) {
        if ($faqconfig->get('main.enableRewriteRules')) {
            $baseUrl = sprintf("search.html?search=%s&amp;seite=%d%s&amp;searchcategory=%d", urlencode($_searchterm), $seite, $langs, $cat);
        } else {
            $baseUrl = PMF_Link::getSystemRelativeUri() . '?' . (empty($sids) ? '' : "{$sids}&amp;") . 'action=search&amp;search=' . urlencode($_searchterm) . '&amp;seite=' . $seite . $langs . "&amp;searchcategory=" . $cat;
        }
        $options = array('baseUrl' => $baseUrl, 'total' => $num, 'perPage' => $confPerPage, '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>');
        $pagination = new PMF_Pagination($options);
        $output .= $pagination->render();
    }
    return $output;
}
Example #11
0
        ?>
</td>
        <td class="list"><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, $PMF_LANG['metaCharset']);
        ?>
"><?php 
        print PMF_Utils::makeShorterText(PMF_htmlentities(trim($data['question']), ENT_QUOTES, $PMF_LANG['metaCharset']), 14);
        ?>
</a></td>
        <td class="list"><?php 
        print $data['usr'];
        ?>
</td>
        <td class="list" style="background-color: #d3d3d3;"><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);
        ?>
Example #12
0
            print $_SERVER["PHP_SELF"] . $linkext;
            ?>
&amp;aktion=editentry&amp;id=<?php 
            print $row->id;
            ?>
&amp;lang=<?php 
            print $row->lang;
            ?>
" title="<?php 
            print $PMF_LANG["ad_user_edit"];
            ?>
 '<?php 
            print str_replace("\"", "ยด", $row->thema);
            ?>
'"><?php 
            print PMF_htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset']);
            ?>
</a>
<?php 
            if (isset($numCommentsByFaq[$row->id])) {
                print " (" . $numCommentsByFaq[$row->id] . " " . $PMF_LANG["ad_start_comments"] . ")";
            }
            ?>
</td>
        <td class="list" width="17"><a href="<?php 
            print $_SERVER["PHP_SELF"] . $linkext;
            ?>
&amp;aktion=saveentry&amp;id=<?php 
            print $row->id;
            ?>
&amp;language=<?php 
Example #13
0
    foreach ($linkArray as $_url) {
        if (!(strpos($_url, 'index.php?action=artikel') === false)) {
            // Get the Faq link title
            preg_match('/id=([\\d]+)/ism', $_url, $matches);
            $_id = $matches[1];
            preg_match('/artlang=([a-z\\-]+)$/ism', $_url, $matches);
            $_lang = $matches[1];
            $_title = $faq->getRecordTitle($_id, false);
            $_link = substr($_url, 9);
            // Move the link to XHTML
            if (strpos($_url, '&amp;') === false) {
                $_link = str_replace('&', '&amp;', $_link);
            }
            $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . $_link);
            $oLink->itemTitle = $_title;
            $oLink->tooltip = PMF_htmlentities($_title, ENT_QUOTES, $PMF_LANG['metaCharset']);
            $newFaqPath = $oLink->toString();
            $fixedContent = str_replace($_url, $newFaqPath, $fixedContent);
        }
    }
}
$content = str_replace('href="#', 'href="index.php?action=artikel&lang=' . $LANGCODE . '&id=' . $record_id . '#', $content);
// Check for the languages for a faq
$arrLanguage = PMF_Utils::languageAvailable($record_id);
$switchLanguage = '';
$check4Lang = '';
$num = count($arrLanguage);
if ($num > 1) {
    foreach ($arrLanguage as $language) {
        $check4Lang .= "<option value=\"" . $language . "\"";
        $check4Lang .= $lang == $language ? ' selected="selected"' : '';
Example #14
0
         }
         break;
     case 'pgsql':
         $query[] = "VACUUM ANALYZE;";
         break;
 }
 // Perform the queries for optimizing the database
 if (isset($query)) {
     foreach ($query as $current_query) {
         $result = $db->query($current_query);
         printf('<span title="%s">|</span> ', $current_query);
         if (!$result) {
             print "\n<div class=\"error\">\n";
             print "<p><strong>DB error:</strong> " . $db->error() . "</p>\n";
             print "<div style=\"text-align: left;\"><p>Query:\n";
             print "<pre>" . PMF_htmlentities($current_query) . "</pre></p></div>\n";
             print "</div>";
             die;
         }
         wait(25);
     }
 }
 print "</p>\n";
 print '<p class="center">The database was updated successfully.</p>';
 print '<p class="center"><a href="../index.php">phpMyFAQ</a></p>';
 foreach (glob(PMF_ROOT_DIR . '/inc/*.bak.php') as $filename) {
     if (!@unlink($filename)) {
         print "<p class=\"center\">Please manually remove the backup file '" . $filename . "'.</p>\n";
     }
 }
 // Remove 'scripts' folder: no need of prompt anything to the user
Example #15
0
/**
* searchEngine()
*
* The main search function for the full text search
*
* @param    string
* @param    string
* @return   string
* @access   public
* @author   Thorsten Rinne <*****@*****.**>
* @since    2002-09-16
*/
function searchEngine($begriff, $category = '%')
{
    global $db, $sids, $tree, $PMF_LANG, $PMF_CONF;
    $_begriff = $begriff;
    $seite = '';
    $output = '';
    $searchItems = array();
    if (isset($_REQUEST["seite"])) {
        $seite = $_REQUEST["seite"];
    } else {
        $seite = 1;
    }
    if ('%' == $category) {
        $cond = array(SQLPREFIX . "faqdata.active" => "'yes'");
    } else {
        $cond = array(SQLPREFIX . "faqdata.active" => "'yes'", SQLPREFIX . "faqcategoryrelations.category_id" => $category);
    }
    if (is_numeric($begriff)) {
        // search for the solution_id
        $result = $db->search(SQLPREFIX . 'faqdata', array(SQLPREFIX . 'faqdata.id AS id', SQLPREFIX . 'faqdata.lang AS lang', SQLPREFIX . 'faqdata.solution_id AS solution_id', SQLPREFIX . 'faqcategoryrelations.category_id AS category_id', SQLPREFIX . 'faqdata.thema AS thema', SQLPREFIX . 'faqdata.content AS content'), SQLPREFIX . 'faqcategoryrelations', array(SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqcategoryrelations.record_id', SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqcategoryrelations.record_lang'), array(SQLPREFIX . 'faqdata.solution_id'), $begriff, $cond);
    } else {
        $result = $db->search(SQLPREFIX . "faqdata", array(SQLPREFIX . "faqdata.id AS id", SQLPREFIX . "faqdata.lang AS lang", SQLPREFIX . "faqcategoryrelations.category_id AS category_id", SQLPREFIX . "faqdata.thema AS thema", SQLPREFIX . "faqdata.content AS content"), SQLPREFIX . "faqcategoryrelations", array(SQLPREFIX . "faqdata.id = " . SQLPREFIX . "faqcategoryrelations.record_id", SQLPREFIX . "faqdata.lang = " . SQLPREFIX . "faqcategoryrelations.record_lang"), array(SQLPREFIX . "faqdata.thema", SQLPREFIX . "faqdata.content", SQLPREFIX . "faqdata.keywords"), $begriff, $cond);
    }
    if (false === $result) {
        $output = $PMF_LANG['err_noArticles'];
        $num = 0;
    } else {
        $num = $db->num_rows($result);
    }
    // Show the record with the solution ID directly
    // Sanity checks: if a valid Solution ID has been provided the result set
    //                will measure 1: this is true ONLY if the faq is not
    //                classified among more than 1 category
    if (is_numeric($begriff) && $begriff > PMF_SOLUTION_ID_START_VALUE && $num > 0) {
        if (isset($PMF_CONF['mod_rewrite']) && $PMF_CONF['mod_rewrite'] == 'TRUE') {
            header('Location: http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . 'solution_id_' . $begriff . '.html');
        } else {
            header('Location: http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . '?solution_id=' . $begriff);
        }
        exit;
    }
    if (0 == $num) {
        $keys = preg_split("/\\s+/", $begriff);
        $numKeys = count($keys);
        $where = '';
        for ($i = 0; $i < $numKeys; $i++) {
            if (strlen($where) != 0) {
                $where = $where . " OR ";
            }
            $where = $where . '(' . SQLPREFIX . "faqdata.thema LIKE '%" . $keys[$i] . "%' OR " . SQLPREFIX . "faqdata.content LIKE '%" . $keys[$i] . "%' OR " . SQLPREFIX . "faqdata.keywords LIKE '%" . $keys[$i] . "%') AND " . SQLPREFIX . 'faqdata.active = \'yes\'';
            if (is_numeric($category)) {
                $where .= ' AND ' . SQLPREFIX . 'faqcategoryrelations.category_id = ' . $category;
            }
        }
        $where = " WHERE (" . $where . ") AND active = 'yes'";
        $query = 'SELECT ' . SQLPREFIX . 'faqdata.id AS id, ' . SQLPREFIX . 'faqdata.lang AS lang, ' . SQLPREFIX . 'faqcategoryrelations.category_id AS category_id, ' . SQLPREFIX . 'faqdata.thema AS thema, ' . SQLPREFIX . 'faqdata.content AS content FROM ' . SQLPREFIX . 'faqdata LEFT JOIN ' . SQLPREFIX . 'faqcategoryrelations ON ' . SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqcategoryrelations.record_id AND ' . SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqcategoryrelations.record_lang ' . $where;
        $result = $db->query($query);
        $num = $db->num_rows($result);
    }
    $pages = ceil($num / $PMF_CONF["numRecordsPage"]);
    $last = $seite * $PMF_CONF["numRecordsPage"];
    $first = $last - $PMF_CONF["numRecordsPage"];
    if ($last > $num) {
        $last = $num;
    }
    if ($num > 0) {
        if ($num == "1") {
            $output .= "<p>" . $num . $PMF_LANG["msgSearchAmount"] . "</p>\n";
        } else {
            $output .= "<p>" . $num . $PMF_LANG["msgSearchAmounts"] . "</p>\n";
        }
        if ($pages > 1) {
            $output .= "<p><strong>" . $PMF_LANG["msgPage"] . $seite . " " . $PMF_LANG["msgVoteFrom"] . " " . $pages . " " . $PMF_LANG["msgPages"] . "</strong></p>";
        }
        $output .= "<ul class=\"phpmyfaq_ul\">\n";
        $counter = 0;
        $displayedCounter = 0;
        while (($row = $db->fetch_object($result)) && $displayedCounter < $PMF_CONF['numRecordsPage']) {
            $counter++;
            if ($counter <= $first) {
                continue;
            }
            $displayedCounter++;
            $rubriktext = $tree->getPath($row->category_id);
            $thema = PMF_htmlentities(chopString($row->thema, 15), ENT_NOQUOTES, $PMF_LANG['metaCharset']);
            $content = chopString(strip_tags($row->content), 25);
            $begriff = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']'), '', $begriff);
            $begriff = preg_quote($begriff, '/');
            $searchItems = explode(' ', $begriff);
            if (strlen($searchItems[0]) > 1) {
                foreach ($searchItems as $item) {
                    $thema = preg_replace_callback('/(' . $item . '="[^"]*")|((href|src|title|alt|class|style|id|name)="[^"]*' . $item . '[^"]*")|(' . $item . ')/mis', "highlight_no_links", $thema);
                    $content = preg_replace_callback('/(' . $item . '="[^"]*")|((href|src|title|alt|class|style|id|name)="[^"]*' . $item . '[^"]*")|(' . $item . ')/mis', "highlight_no_links", $content);
                }
            }
            // Print the link to the faq record
            if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
                $output .= "<li><strong>" . $rubriktext . "</strong>: <a href=\"" . $row->category_id . "_" . $row->id . "_" . $row->lang . ".html?highlight=" . $begriff . "\">" . $thema . "...</a><br /><div class=\"searchpreview\"><strong>" . $PMF_LANG["msgSearchContent"] . "</strong> " . $content . "...</div><br /></li>\n";
            } else {
                $output .= "<li><strong>" . $rubriktext . "</strong>: <a href=\"" . $_SERVER["PHP_SELF"] . "?" . $sids . "action=artikel&amp;cat=" . $row->category_id . "&amp;id=" . $row->id . "&amp;artlang=" . $row->lang . "&amp;highlight=" . $begriff . "\">" . $thema . "...</a><br /><div class=\"searchpreview\"><strong>" . $PMF_LANG["msgSearchContent"] . "</strong> " . $content . "...</div><br /></li>\n";
            }
        }
        $output .= "</ul>\n";
    } else {
        $output = $PMF_LANG["err_noArticles"];
    }
    if ($num > $PMF_CONF["numRecordsPage"]) {
        $output .= "<p align=\"center\"><strong>";
        $vor = $seite - 1;
        $next = $seite + 1;
        if ($vor != 0) {
            if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
                $output .= "[ <a href=\"search.html?search=" . urlencode($_begriff) . "&amp;seite=" . $vor . "\">" . $PMF_LANG["msgPrevious"] . "</a> ]";
            } else {
                $output .= "[ <a href=\"" . $_SERVER["PHP_SELF"] . "?" . $sids . "action=search&amp;search=" . urlencode($_begriff) . "&amp;seite=" . $vor . "\">" . $PMF_LANG["msgPrevious"] . "</a> ]";
            }
        }
        $output .= " ";
        if ($next <= $pages) {
            if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
                $output .= "[ <a href=\"search.html?search=" . urlencode($_begriff) . "&amp;seite=" . $next . "\">" . $PMF_LANG["msgNext"] . "</a> ]";
            } else {
                $output .= "[ <a href=\"" . $_SERVER["PHP_SELF"] . "?" . $sids . "action=search&amp;search=" . urlencode($_begriff) . "&amp;seite=" . $next . "\">" . $PMF_LANG["msgNext"] . "</a> ]";
            }
        }
        $output .= "</strong></p>";
    }
    return $output;
}
Example #16
0
}
$captcha = new PMF_Captcha($sids);
$comment = new PMF_Comment();
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$oNews = new PMF_News();
$news_id = PMF_Filter::filterInput(INPUT_GET, 'newsid', FILTER_VALIDATE_INT);
if (is_null($news_id)) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$faqsession->userTracking('news_view', $id);
// Define the header of the page
$writeNewsHeader = PMF_htmlentities($PMF_CONF['main.titleFAQ'], ENT_QUOTES, $PMF_LANG['metaCharset']) . $PMF_LANG['msgNews'];
$writeNewsRSS = '&nbsp;<a href="feed/news/rss.php" target="_blank"><img id="newsRSS" src="images/feed.png" width="16" height="16" alt="RSS" /></a>';
// Get all data from the news record
$news = $oNews->getNewsEntry($news_id);
$content = $news['content'];
$header = $news['header'];
// Add Glossary entries
$oGlossary = new PMF_Glossary();
$content = $oGlossary->insertItemsIntoContent($content);
$header = $oGlossary->insertItemsIntoContent($header);
// Add information link if existing
if (strlen($news['link']) > 0) {
    $content .= sprintf('</p><p>%s<a href="%s" target="%s">%s</a>', $PMF_LANG['msgInfo'], $news['link'], $news['target'], $news['linkTitle']);
}
// Show link to edit the news?
$editThisEntry = '';
Example #17
0
                    $table_prefix = trim(substr($dat, $backup_prefix_pattern_len));
                }
                if (substr($dat, 0, 2) != '--' && $dat != '') {
                    $mquery[] = trim(substr($dat, 0, -1));
                }
            }
            fclose($fp);
            $k = 0;
            $g = 0;
            print "<p>" . $PMF_LANG["ad_csv_process"] . "</p>\n";
            $anz = count($mquery);
            $kg = "";
            for ($i = 0; $i < $anz; $i++) {
                $mquery[$i] = alignTablePrefix($mquery[$i], $table_prefix, SQLPREFIX);
                $kg = $db->query($mquery[$i]);
                if (!$kg) {
                    print "<div style=\"font-size: 9px;\"><b>Query</b>: \"" . PMF_htmlentities($mquery[$i]) . "\" <span style=\"color: red;\">failed (Reason: " . $db->error() . ")</span></div>\n";
                    $k++;
                } else {
                    print "<div style=\"font-size: 9px;\"><b>Query</b>: <!-- \"" . PMF_htmlentities($mquery[$i]) . "\" --> <span style=\"color: green;\">okay</span></div>\n";
                    $g++;
                }
            }
            print "<p>" . $g . " " . $PMF_LANG["ad_csv_of"] . " " . $anz . " " . $PMF_LANG["ad_csv_suc"] . "</p>\n";
        }
    } else {
        print "<p>" . $PMF_LANG["ad_csv_no"] . "</p>";
    }
} else {
    print $PMF_LANG["err_NotAuth"];
}
Example #18
0
 /**
  * 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'", SQLPREFIX, $id, $this->language);
     $result = $this->db->query($query);
     if ($this->db->numRows($result) > 0) {
         $row = $this->db->fetchObject($result);
         return PMF_htmlentities($row->keywords, ENT_QUOTES, 'utf-8');
     } else {
         return '';
     }
 }
Example #19
0
    $self = substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT']));
    foreach ($searchesList as $searchItem) {
        if ($displayedCounter >= $perpage) {
            $displayedCounter++;
            continue;
        }
        $counter++;
        if ($counter <= $start) {
            continue;
        }
        $displayedCounter++;
        $num = round($searchItem['number'] * 100 / $searchesCount, 2);
        ?>
<tr>
	<td class="list"><?php 
        print PMF_htmlentities($searchItem['searchterm']);
        ?>
</td>
	<td class="list"><?php 
        print $searchItem['number'];
        ?>
</td>
	<td class="list"><?php 
        print $languageCodes[PMF_String::strtoupper($searchItem['lang'])];
        ?>
</td>
	<td class="list"><img src="stat.search.php?num=<?php 
        print $num;
        ?>
" alt="<?php 
        print $num;
Example #20
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->escape_string(strip_tags($inputSearchTerm));
    }
    if (!is_null($search)) {
        $inputSearchTerm = $db->escape_string(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);
$category->buildTree();
$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();
foreach ($mostPopularSearchData as $searchItem) {
    $mostPopularSearches .= sprintf('<a href="?search=%s&submit=Search&action=search">%s</a> (%dx), ', urlencode($searchItem['searchterm']), $searchItem['searchterm'], $searchItem['number']);
}
$helper = PMF_Helper_Category::getInstance();
$helper->setCategory($category);
$tpl->processTemplate('writeContent', array('msgSearch' => $tagSearch ? $PMF_LANG['msgTagSearch'] : $PMF_LANG['msgSearch'], 'searchString' => PMF_htmlentities($inputSearchTerm, ENT_QUOTES, $PMF_LANG['metaCharset']), 'searchOnAllLanguages' => $PMF_LANG['msgSearchOnAllLanguages'], 'checkedAllLanguages' => $allLanguages ? ' checked="checked"' : '', 'selectCategories' => $PMF_LANG['msgSelectCategories'], 'allCategories' => $PMF_LANG['msgAllCategories'], 'printCategoryOptions' => $helper->renderCategoryOptions($inputCategory), 'writeSendAdress' => '?' . $sids . 'action=search', 'msgSearchWord' => $PMF_LANG['msgSearchWord'], 'printResult' => $printResult, 'openSearchLink' => $openSearchLink, 'msgMostPopularSearches' => $PMF_LANG['msgMostPopularSearches'], 'printMostPopularSearches' => PMF_String::substr($mostPopularSearches, 0, -2)));
$tpl->includeTemplate('writeContent', 'index');
Example #21
0
        }
    }
}
if (is_null($currentAction) || !is_null($currentSave)) {
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
    print $PMF_LANG["metaLanguage"];
    ?>
" lang="<?php 
    print $PMF_LANG["metaLanguage"];
    ?>
">
<head>
    <title><?php 
    print PMF_htmlentities($faqconfig->get('main.titleFAQ'), ENT_QUOTES, $PMF_LANG['metaCharset']);
    ?>
 - powered by phpMyFAQ</title>
    <meta name="copyright" content="(c) 2001-2009 phpMyFAQ Team" />
    <meta http-equiv="Content-Type" content="text/html; charset=<?php 
    print $PMF_LANG["metaCharset"];
    ?>
" />
    <link rel="shortcut icon" href="../template/<?php 
    echo PMF_Template::getTplSetName();
    ?>
/favicon.ico" type="image/x-icon" />
    <link rel="icon" href="../template/<?php 
    echo PMF_Template::getTplSetName();
    ?>
/favicon.ico" type="image/x-icon" />
Example #22
0
 /**
  * Returns the XML export
  * 
  * @param integer $nCatid     Number of categories
  * @param boolean $bDownwards Downwards
  * @param string  $lang       Language
  * 
  * @return string
  */
 public static function getXMLExport($nCatid = 0, $bDownwards = true, $lang = "")
 {
     global $db, $LANGCODE, $PMF_LANG, $PMF_CONF;
     $tree = new PMF_Category();
     $tree->transform(0);
     $my_xml_output = "<?xml version=\"1.0\" encoding=\"" . $PMF_LANG["metaCharset"] . "\" standalone=\"yes\" ?>\n";
     $my_xml_output .= "<!-- XML-Output by phpMyFAQ " . $PMF_CONF['main.currentVersion'] . " | Date: " . PMF_Date::createIsoDate(date("YmdHis")) . " -->\n";
     $my_xml_output .= "<phpmyfaq xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:NamespaceSchemaLocation=\"http://www.phpmyfaq.de/xml/faqschema.xsd\">\n";
     // Get Faq Data
     $oFaq = new PMF_Faq();
     $faqs = $oFaq->get(FAQ_QUERY_TYPE_EXPORT_XML, $nCatid, $bDownwards, $lang);
     // Start composing XML
     if (count($faqs) > 0) {
         foreach ($faqs as $faq) {
             // Get faq properties
             $xml_content = $faq['content'];
             $xml_rubrik = $tree->getPath($faq['category_id'], " >> ");
             $xml_thema = $faq['topic'];
             $xml_keywords = $faq['keywords'];
             // Take care of XML entities
             $xml_content = strip_tags(PMF_String::htmlspecialchars($xml_content, ENT_QUOTES, $PMF_LANG['metaCharset']));
             $xml_rubrik = PMF_htmlentities(strip_tags($xml_rubrik), ENT_QUOTES, $PMF_LANG['metaCharset']);
             $xml_thema = strip_tags($xml_thema);
             // Build the <article/> node
             $my_xml_output .= "\t<article id=\"" . $faq['id'] . "\">\n";
             $my_xml_output .= "\t<language>" . $faq['lang'] . "</language>\n";
             $my_xml_output .= "\t<category>" . $xml_rubrik . "</category>\n";
             if (!empty($xml_keywords)) {
                 $my_xml_output .= "\t<keywords>" . $xml_keywords . "</keywords>\n";
             } else {
                 $my_xml_output .= "\t<keywords />\n";
             }
             $my_xml_output .= "\t<theme>" . $xml_thema . "</theme>\n";
             $my_xml_output .= "\t<content xmlns=\"http://www.w3.org/TR/REC-html40\">" . $xml_content . "</content>\n";
             if (!empty($faq['author_name'])) {
                 $my_xml_output .= "\t<author>" . $faq['author_name'] . "</author>\n";
             } else {
                 $my_xml_output .= "\t<author />\n";
             }
             $my_xml_output .= "\t<date>" . PMF_Date::createIsoDate($faq['lastmodified']) . "</date>\n";
             $my_xml_output .= "\t</article>\n";
         }
     }
     $my_xml_output .= "</phpmyfaq>";
     return $my_xml_output;
 }
Example #23
0
$lookup = PMF_Filter::filterInput(INPUT_GET, 'lookup', FILTER_VALIDATE_INT);
if (count(ob_list_handlers()) > 0) {
    ob_clean();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
print $PMF_LANG["metaLanguage"];
?>
" lang="<?php 
print $PMF_LANG["metaLanguage"];
?>
">
<head>
    <title><?php 
print PMF_htmlentities($PMF_CONF['main.titleFAQ'], ENT_QUOTES, $PMF_LANG['metaCharset']);
?>
 - powered by phpMyFAQ</title>
    <meta name="copyright" content="(c) 2001-2009 phpMyFAQ Team" />
    <meta http-equiv="Content-Type" content="text/html; charset=<?php 
print $PMF_LANG["metaCharset"];
?>
" />
    <style type="text/css"> @import url(../template/<?php 
echo PMF_Template::getTplSetName();
?>
/admin.css); </style>
    <script type="text/javascript" src="../inc/js/jquery.min.js"></script>
</head>
<body id="body" dir="<?php 
print $PMF_LANG["dir"];
Example #24
0
        ?>
    <h3><?php 
        print $PMF_LANG["ad_entry_changelog"];
        ?>
</h3>
    <div id="changelog">
<?php 
        $changeEntries = $faq->getChangeEntries($faqData['id']);
        foreach ($changeEntries as $entry) {
            $user->getUserById($entry['user']);
            ?>
    <div style="font-size: 10px;"><strong><?php 
            print date("Y-m-d H:i:s", $entry['date']) . ": " . $user->getUserData('display_name');
            ?>
</strong><br /><?php 
            print PMF_htmlentities($entry['changelog'], ENT_QUOTES, $PMF_LANG['metaCharset']);
            ?>
<br /><?php 
            print $PMF_LANG['ad_entry_revision'] . ' 1.' . $entry['revision_id'];
            ?>
</div>
<?php 
        }
        ?>
    </div>
    </form>
    
    <script type="text/javascript">
    /* <![CDATA[ */

    $(function()
Example #25
0
 print "<p class=\"center\">";
 @ob_flush();
 flush();
 // Erase any table before starting creating the required ones
 db_uninstall();
 // Start creating the required tables
 $count = 0;
 while ($each_query = each($query)) {
     $result = @$db->query($each_query[1]);
     print "| ";
     if (!$result) {
         print "\n<div class=\"error\">\n";
         print "<p><strong>Error:</strong> Please install your version of phpMyFAQ once again or send us a <a href=\"http://bugs.phpmyfaq.de\" target=\"_blank\">bug report</a>.</p>";
         print "<p><strong>DB error:</strong> " . $db->error() . "</p>\n";
         print "<div style=\"text-align: left;\"><p>Query:\n";
         print "<pre>" . PMF_htmlentities($each_query[1]) . "</pre></p></div>\n";
         print "</div>";
         db_uninstall();
         cleanInstallation();
         HTMLFooter();
         die;
     }
     wait(25);
     $count++;
     if (!($count % 10)) {
         @ob_flush();
         flush();
     }
 }
 @ob_flush();
 flush();
Example #26
0
 /**
  * This function generates the list with the latest published records
  *
  * @return array
  * @author Thorsten Rinne <*****@*****.**>
  * @since  2002-05-07
  */
 public function getLatest()
 {
     $result = $this->getLatestData(PMF_NUMBER_RECORDS_LATEST, $this->language);
     if (count($result) > 0) {
         foreach ($result as $row) {
             $shortTitle = PMF_Utils::makeShorterText(PMF_htmlentities($row['thema'], ENT_QUOTES, $this->pmf_lang['metaCharset']), 8);
             $output['url'][] = $row['url'];
             $output['title'][] = $shortTitle;
             $output['date'][] = PMF_Date::createIsoDate($row['datum']);
         }
     } else {
         $output['error'] = $this->pmf_lang["err_noArticles"];
     }
     return $output;
 }
Example #27
0
}
$writeLetters = '<p>';
$result = $db->query($query_1);
while ($row = $db->fetch_object($result)) {
    $letters = $row->letters;
    if (preg_match("/^[a-z0-9]/i", $letters)) {
        if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
            $writeLetters .= '<a href="sitemap-' . $letters . '_' . $lang . '.html">' . $letters . '</a> ';
        } else {
            $writeLetters .= '<a href="' . $_SERVER["PHP_SELF"] . '?' . $sids . 'action=sitemap&amp;letter=' . $letters . '&amp;lang=' . $lang . '">' . $letters . '</a> ';
        }
    }
}
$writeLetters .= '</p>';
$writeMap = '<ul>';
$result = $db->query($query_2);
$oldId = 0;
while ($row = $db->fetch_object($result)) {
    if ($oldId != $row->id) {
        if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
            $writeMap .= '<li><a href="' . $row->category_id . '_' . $row->id . '_' . $row->lang . '.html">' . PMF_htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset']) . "</a><br />\n";
        } else {
            $writeMap .= '<li><a href="index.php?' . $sids . 'action=artikel&amp;cat=' . $row->category_id . '&amp;id=' . $row->id . '&amp;artlang=' . $row->lang . '">' . PMF_htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset']) . "</a><br />\n";
        }
        $writeMap .= chopString(strip_tags($row->snap), 25) . " ...</li>\n";
    }
    $oldId = $row->id;
}
$writeMap .= '</ul>';
$tpl->processTemplate('writeContent', array('writeLetters' => $writeLetters, 'writeMap' => $writeMap, 'writeCuttentLetter' => $currentLetter));
$tpl->includeTemplate('writeContent', 'index');
Example #28
0
                if (PMF_String::substr($dat, 0, $backup_prefix_pattern_len) == $backup_prefix_pattern) {
                    $table_prefix = trim(PMF_String::substr($dat, $backup_prefix_pattern_len));
                }
                if (PMF_String::substr($dat, 0, 2) != '--' && $dat != '') {
                    $mquery[] = trim(PMF_String::substr($dat, 0, -1));
                }
            }
            $k = 0;
            $g = 0;
            printf("<p>%s</p>\n", $PMF_LANG['ad_csv_process']);
            $anz = count($mquery);
            $kg = "";
            for ($i = 0; $i < $anz; $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_htmlentities($mquery[$i], ENT_QUOTES, $PMF_LANG['metaCharset']), $db->error(), "\n");
                    $k++;
                } else {
                    printf('<!-- <div style="font-size: 9px;"><strong>Query</strong>: "%s" <span style="color: green;">okay</span></div> -->%s', PMF_htmlentities($mquery[$i], ENT_QUOTES, $PMF_LANG['metaCharset']), "\n");
                    $g++;
                }
            }
            print "<p>" . $g . " " . $PMF_LANG["ad_csv_of"] . " " . $anz . " " . $PMF_LANG["ad_csv_suc"] . "</p>\n";
        }
    } else {
        print "<p>" . $PMF_LANG["ad_csv_no"] . "</p>";
    }
} else {
    print $PMF_LANG["err_NotAuth"];
}