Example #1
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');
Example #2
0
$rss = new XMLWriter();
$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqConfig->get('main.titleFAQ') . ' - ');
$rss->writeElement('description', html_entity_decode($faqConfig->get('main.metaDescription')));
$rss->writeElement('link', $faqConfig->get('main.referenceURL'));
if (is_array($records)) {
    foreach ($records as $item) {
        $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['record_link']);
        if (PMF_RSS_USE_SEO) {
            if (isset($item['record_title'])) {
                $oLink = new PMF_Link($link, $faqConfig);
                $oLink->itemTitle = $item['record_title'];
                $link = $oLink->toString();
            }
        }
        $rss->startElement('item');
        $rss->writeElement('title', html_entity_decode($item['record_title'] . ' (' . $item['visits'] . ' ' . $PMF_LANG['msgViews'] . ')', ENT_COMPAT, 'UTF-8'));
        $rss->startElement('description');
        $rss->writeCdata($item['record_preview']);
        $rss->endElement();
        $rss->writeElement('link', $faqConfig->get('main.referenceURL') . $link);
        $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['record_date'], true));
        $rss->endElement();
    }
}
$rss->endElement();
Example #3
0
// Sitemap header
$sitemap = '<?xml version="1.0" encoding="UTF-8"?>' . '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"' . ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . ' xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . ' http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">';
// 1st entry: the faq server itself
$sitemap .= buildSitemapNode(PMF_Link::getSystemUri('/sitemap.google.php'), PMF_Date::createISO8601Date($_SERVER['REQUEST_TIME'], false), PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY, PMF_SITEMAP_GOOGLE_PRIORITY_MAX);
// nth entry: each faq
foreach ($items as $item) {
    $priority = PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT;
    if ($visitsMax - $visitMin > 0) {
        $priority = sprintf('%.1f', PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT * (1 + ($item['visits'] - $visitMin) / ($visitsMax - $visitMin)));
    }
    // a. We use plain PMF urls w/o any SEO schema
    $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']);
    // b. We use SEO PMF urls
    if (PMF_SITEMAP_GOOGLE_USE_SEO) {
        if (isset($item['thema'])) {
            $oL = new PMF_Link($link);
            $oL->itemTitle = $item['thema'];
            $link = $oL->toString();
        }
    }
    $sitemap .= buildSitemapNode(PMF_Link::getSystemUri('/sitemap.google.php') . $link, PMF_Date::createISO8601Date($item['date']), PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY, $priority);
}
$sitemap .= '</urlset>';
$getgezip = PMF_Filter::filterInput(INPUT_GET, PMF_SITEMAP_GOOGLE_GET_GZIP, FILTER_VALIDATE_INT);
if (!is_null($getgezip) && 1 == $getgezip) {
    if (function_exists('gzencode')) {
        $sitemapGz = gzencode($sitemap);
        header('Content-Type: application/x-gzip');
        header('Content-Disposition: attachment; filename="' . PMF_SITEMAP_GOOGLE_FILENAME_GZ . '"');
        header('Content-Length: ' . strlen($sitemapGz));
        print $sitemapGz;
Example #4
0
// Search for href attributes only
$linkArray = $oLnk->getUrlpool();
if (isset($linkArray['href'])) {
    foreach (array_unique($linkArray['href']) as $_url) {
        if (!(strpos($_url, 'index.php?action=artikel') === false)) {
            // Get the Faq link title
            $matches = array();
            preg_match('/id=([\\d]+)/ism', $_url, $matches);
            $_id = $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 = $oLink->tooltip = $_title;
            $newFaqPath = $oLink->toString();
            $fixedContent = str_replace($_url, $newFaqPath, $fixedContent);
        }
    }
}
$content = $fixedContent;
// 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 . "\"";
Example #5
0
 /**
  * The footer of the PDF file
  *
  * @return void
  */
 public function Footer()
 {
     global $PMF_LANG;
     $faqconfig = PMF_Configuration::getInstance();
     $currentTextColor = $this->TextColor;
     $this->SetTextColor(0, 0, 0);
     $this->SetY(-25);
     $this->SetFont('dejavusans', '', 10);
     $this->Cell(0, 10, $PMF_LANG['ad_gen_page'] . ' ' . $this->PageNo() . ' / ' . $this->getAliasNbPages(), 0, 0, 'C');
     $this->SetY(-20);
     $this->SetFont('dejavusans', 'B', 8);
     $this->Cell(0, 10, "(c) " . date("Y") . " " . $faqconfig->get('main.metaPublisher') . " <" . $faqconfig->get('main.administrationMail') . ">", 0, 1, "C");
     if ($this->enableBookmarks == false) {
         $this->SetY(-15);
         $this->SetFont('dejavusans', '', 8);
         $baseUrl = '/index.php';
         if (is_array($this->faq) && !empty($this->faq)) {
             $baseUrl .= '?action=artikel&amp;cat=' . $this->categories[$this->category]['id'];
             $baseUrl .= '&amp;id=' . $this->faq['id'];
             $baseUrl .= '&amp;artlang=' . $this->faq['lang'];
         }
         $url = PMF_Link::getSystemScheme() . $_SERVER['HTTP_HOST'] . $baseUrl;
         $urlObj = new PMF_Link($url);
         $urlObj->itemTitle = $this->thema;
         $_url = str_replace('&amp;', '&', $urlObj->toString());
         $this->Cell(0, 10, 'URL: ' . $_url, 0, 1, 'C', 0, $_url);
     }
     $this->TextColor = $currentTextColor;
 }
Example #6
0
 /**
  * Starts the installation
  *
  * @param array $DB
  */
 public function startInstall(array $DB = null)
 {
     $query = $uninst = $dbSetup = [];
     // Check table prefix
     $dbSetup['dbPrefix'] = $sqltblpre = PMF_Filter::filterInput(INPUT_POST, 'sqltblpre', FILTER_SANITIZE_STRING, '');
     if ('' !== $dbSetup['dbPrefix']) {
         PMF_Db::setTablePrefix($dbSetup['dbPrefix']);
     }
     // Check database entries
     $dbSetup['dbType'] = PMF_Filter::filterInput(INPUT_POST, 'sql_type', FILTER_SANITIZE_STRING);
     if (!is_null($dbSetup['dbType'])) {
         $dbSetup['dbType'] = trim($dbSetup['dbType']);
         if (!file_exists(PMF_ROOT_DIR . '/setup/assets/sql/' . $dbSetup['dbType'] . '.sql.php')) {
             printf('<p class="alert alert-danger"><strong>Error:</strong> Invalid server type: %s</p>', $dbSetup['dbType']);
             PMF_System::renderFooter(true);
         }
     } else {
         echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please select a database type.</p>\n";
         PMF_System::renderFooter(true);
     }
     $dbSetup['dbServer'] = PMF_Filter::filterInput(INPUT_POST, 'sql_server', FILTER_SANITIZE_STRING);
     if (is_null($dbSetup['dbServer']) && !PMF_System::isSqlite($dbSetup['dbType'])) {
         echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database server.</p>\n";
         PMF_System::renderFooter(true);
     }
     $dbSetup['dbPort'] = PMF_Filter::filterInput(INPUT_POST, 'sql_port', FILTER_VALIDATE_INT);
     if (is_null($dbSetup['dbPort']) && !PMF_System::isSqlite($dbSetup['dbType'])) {
         echo "<p class=\"alert alert-error\"><strong>Error:</strong> Please add a valid database port.</p>\n";
         PMF_System::renderFooter(true);
     }
     $dbSetup['dbUser'] = PMF_Filter::filterInput(INPUT_POST, 'sql_user', FILTER_SANITIZE_STRING);
     if (is_null($dbSetup['dbUser']) && !PMF_System::isSqlite($dbSetup['dbType'])) {
         echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database username.</p>\n";
         PMF_System::renderFooter(true);
     }
     $dbSetup['dbPassword'] = PMF_Filter::filterInput(INPUT_POST, 'sql_passwort', FILTER_UNSAFE_RAW);
     if (is_null($dbSetup['dbPassword']) && !PMF_System::isSqlite($dbSetup['dbType'])) {
         // Password can be empty...
         $dbSetup['dbPassword'] = '';
     }
     $dbSetup['dbDatabaseName'] = PMF_Filter::filterInput(INPUT_POST, 'sql_db', FILTER_SANITIZE_STRING);
     if (is_null($dbSetup['dbDatabaseName']) && !PMF_System::isSqlite($dbSetup['dbType'])) {
         echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database name.</p>\n";
         PMF_System::renderFooter(true);
     }
     if (PMF_System::isSqlite($dbSetup['dbType'])) {
         $dbSetup['dbServer'] = PMF_Filter::filterInput(INPUT_POST, 'sql_sqlitefile', FILTER_SANITIZE_STRING);
         if (is_null($dbSetup['dbServer'])) {
             echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a SQLite database filename.</p>\n";
             PMF_System::renderFooter(true);
         }
     }
     // check database connection
     PMF_Db::setTablePrefix($dbSetup['dbPrefix']);
     $db = PMF_Db::factory($dbSetup['dbType']);
     $db->connect($dbSetup['dbServer'], $dbSetup['dbUser'], $dbSetup['dbPassword'], $dbSetup['dbDatabaseName']);
     if (!$db) {
         printf("<p class=\"alert alert-danger\"><strong>DB Error:</strong> %s</p>\n", $db->error());
         PMF_System::renderFooter(true);
     }
     $configuration = new PMF_Configuration($db);
     // check LDAP if available
     $ldapEnabled = PMF_Filter::filterInput(INPUT_POST, 'ldap_enabled', FILTER_SANITIZE_STRING);
     if (extension_loaded('ldap') && !is_null($ldapEnabled)) {
         $ldapSetup = [];
         // check LDAP entries
         $ldapSetup['ldapServer'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_server', FILTER_SANITIZE_STRING);
         if (is_null($ldapSetup['ldapServer'])) {
             echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a LDAP server.</p>\n";
             PMF_System::renderFooter(true);
         }
         $ldapSetup['ldapPort'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_port', FILTER_VALIDATE_INT);
         if (is_null($ldapSetup['ldapPort'])) {
             echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a LDAP port.</p>\n";
             PMF_System::renderFooter(true);
         }
         $ldapSetup['ldapBase'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_base', FILTER_SANITIZE_STRING);
         if (is_null($ldapSetup['ldapBase'])) {
             echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a LDAP base search DN.</p>\n";
             PMF_System::renderFooter(true);
         }
         // LDAP User and LDAP password are optional
         $ldapSetup['ldapUser'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_user', FILTER_SANITIZE_STRING, '');
         $ldapSetup['ldapPassword'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_password', FILTER_SANITIZE_STRING, '');
         // check LDAP connection
         require PMF_ROOT_DIR . "/inc/PMF/Ldap.php";
         $ldap = new PMF_Ldap($configuration);
         $ldap->connect($ldapSetup['ldapServer'], $ldapSetup['ldapPort'], $ldapSetup['ldapBase'], $ldapSetup['ldapUser'], $ldapSetup['ldapPassword']);
         if (!$ldap) {
             echo "<p class=\"alert alert-danger\"><strong>LDAP Error:</strong> " . $ldap->error() . "</p>\n";
             PMF_System::renderFooter(true);
         }
     }
     // check loginname
     $loginname = PMF_Filter::filterInput(INPUT_POST, 'loginname', FILTER_SANITIZE_STRING);
     if (is_null($loginname)) {
         echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a loginname for your account.</p>';
         PMF_System::renderFooter(true);
     }
     // check user entries
     $password = PMF_Filter::filterInput(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
     if (is_null($password)) {
         echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a password for the your account.</p>';
         PMF_System::renderFooter(true);
     }
     $password_retyped = PMF_Filter::filterInput(INPUT_POST, 'password_retyped', FILTER_SANITIZE_STRING);
     if (is_null($password_retyped)) {
         echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a retyped password.</p>';
         PMF_System::renderFooter(true);
     }
     if (strlen($password) <= 5 || strlen($password_retyped) <= 5) {
         echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are too short.' . ' Please set your password and your retyped password with a minimum of 6 characters.</p>';
         PMF_System::renderFooter(true);
     }
     if ($password != $password_retyped) {
         echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are not equal.' . ' Please check your password and your retyped password.</p>';
         PMF_System::renderFooter(true);
     }
     $language = PMF_Filter::filterInput(INPUT_POST, 'language', FILTER_SANITIZE_STRING, 'en');
     $realname = PMF_Filter::filterInput(INPUT_POST, 'realname', FILTER_SANITIZE_STRING, '');
     $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, '');
     $permLevel = PMF_Filter::filterInput(INPUT_POST, 'permLevel', FILTER_SANITIZE_STRING, 'basic');
     $instanceSetup = new PMF_Instance_Setup();
     $instanceSetup->setRootDir(PMF_ROOT_DIR);
     // Write the DB variables in database.php
     if (!$instanceSetup->createDatabaseFile($dbSetup)) {
         echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/database.php.</p>";
         $this->_system->cleanInstallation();
         PMF_System::renderFooter(true);
     }
     // check LDAP if available
     if (extension_loaded('ldap') && !is_null($ldapEnabled)) {
         if (!$instanceSetup->createLdapFile($ldapSetup, '')) {
             echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/ldap.php.</p>";
             $this->_system->cleanInstallation();
             PMF_System::renderFooter(true);
         }
     }
     // connect to the database using config/database.php
     require PMF_ROOT_DIR . '/config/database.php';
     $db = PMF_Db::factory($dbSetup['dbType']);
     $db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']);
     if (!$db) {
         echo "<p class=\"alert alert-danger\"><strong>DB Error:</strong> " . $db->error() . "</p>\n";
         $this->_system->cleanInstallation();
         PMF_System::renderFooter(true);
     }
     require PMF_ROOT_DIR . '/setup/assets/sql/' . $dbSetup['dbType'] . '.sql.php';
     // CREATE TABLES
     require PMF_ROOT_DIR . '/setup/assets/sql/stopwords.sql.php';
     // INSERTs for stopwords
     $this->_system->setDatabase($db);
     echo '<p>';
     // Erase any table before starting creating the required ones
     if (!PMF_System::isSqlite($dbSetup['dbType'])) {
         $this->_system->dropTables($uninst);
     }
     // Start creating the required tables
     $count = 0;
     foreach ($query as $executeQuery) {
         $result = @$db->query($executeQuery);
         if (!$result) {
             echo '<p class="alert alert-danger"><strong>Error:</strong> Please install your version of phpMyFAQ once again or send
         us a <a href=\\"http://www.phpmyfaq.de\\" target=\\"_blank\\">bug report</a>.</p>';
             printf('<p class="alert alert-danger"><strong>DB error:</strong> %s</p>', $db->error());
             printf('<code>%s</code>', htmlentities($executeQuery));
             $this->_system->dropTables($uninst);
             $this->_system->cleanInstallation();
             PMF_System::renderFooter(true);
         }
         usleep(2500);
         $count++;
         if (!($count % 10)) {
             echo '| ';
         }
     }
     $link = new PMF_Link(null, $configuration);
     // add main configuration, add personal settings
     $this->_mainConfig['main.metaPublisher'] = $realname;
     $this->_mainConfig['main.administrationMail'] = $email;
     $this->_mainConfig['main.language'] = $language;
     $this->_mainConfig['security.permLevel'] = $permLevel;
     foreach ($this->_mainConfig as $name => $value) {
         $configuration->add($name, $value);
     }
     $configuration->update(array('main.referenceURL' => $link->getSystemUri('/setup/index.php')));
     $configuration->add('security.salt', md5($configuration->get('main.referenceURL')));
     // add admin account and rights
     $admin = new PMF_User($configuration);
     if (!$admin->createUser($loginname, $password, 1)) {
         printf("<p class=\"alert alert-danger\"><strong>Fatal installation error:</strong><br>" . "Couldn't create the admin user: %s</p>\n", $admin->error());
         $this->_system->cleanInstallation();
         PMF_System::renderFooter(true);
     }
     $admin->setStatus('protected');
     $adminData = array('display_name' => $realname, 'email' => $email);
     $admin->setUserData($adminData);
     // add default rights
     foreach ($this->_mainRights as $right) {
         $admin->perm->grantUserRight(1, $admin->perm->addRight($right));
     }
     // Add anonymous user account
     $instanceSetup->createAnonymousUser($configuration);
     // Add master instance
     $instanceData = array('url' => $link->getSystemUri($_SERVER['SCRIPT_NAME']), 'instance' => $link->getSystemRelativeUri('setup/index.php'), 'comment' => 'phpMyFAQ ' . PMF_System::getVersion());
     $faqInstance = new PMF_Instance($configuration);
     $faqInstance->addInstance($instanceData);
     $faqInstanceMaster = new PMF_Instance_Master($configuration);
     $faqInstanceMaster->createMaster($faqInstance);
     echo '</p>';
 }
Example #7
0
         usleep(10000);
         $count++;
         if (!($count % 10)) {
             ob_flush();
         }
     }
     echo "</div>";
 }
 // Clear the array with the queries
 unset($query);
 $query = [];
 //
 // 2nd UPDATES FROM 2.8.0-alpha2
 //
 if (version_compare($version, '2.8.0-alpha2', '<')) {
     $link = new PMF_Link(null, $faqConfig);
     $instanceData = array('url' => $link->getSystemUri($_SERVER['SCRIPT_NAME']), 'instance' => $link->getSystemRelativeUri('setup/update.php'), 'comment' => $faqConfig->get('main.titleFAQ'));
     $faqInstance = new PMF_Instance($faqConfig);
     $faqInstance->addInstance($instanceData);
     $faqInstanceMaster = new PMF_Instance_Master($faqConfig);
     $faqInstanceMaster->createMaster($faqInstance);
     $faqConfig->add('records.autosaveActive', 'false');
     $faqConfig->add('records.autosaveSecs', '180');
     $faqConfig->add('main.maintenanceMode', 'false');
     $faqConfig->add('security.salt', md5($faqConfig->get('main.referenceURL')));
 }
 //
 // UPDATES FROM 2.8.0-alpha3
 //
 if (version_compare($version, '2.8.0-alpha3', '<')) {
     $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faqlinkverifyrules";
Example #8
0
 /**
  * Gets the path from root to child as breadcrumbs
  *
  * @param integer $id                Category ID
  * @param string  $separator         Path separator
  * @param boolean $renderAsMicroData Renders breadcrumbs as HTML5 microdata
  * @param string  $useCssClass       Use CSS class "breadcrumb"
  * @return string
  */
 public function getPath($id, $separator = ' / ', $renderAsMicroData = false, $useCssClass = 'breadcrumb')
 {
     global $sids;
     $ids = $this->getNodes($id);
     $num = count($ids);
     $temp = $catid = $desc = $breadcrumb = [];
     for ($i = 0; $i < $num; $i++) {
         $t = $this->getLineCategory($ids[$i]);
         if (array_key_exists($t, $this->treeTab)) {
             $temp[] = $this->treeTab[$this->getLineCategory($ids[$i])]['name'];
             $catid[] = $this->treeTab[$this->getLineCategory($ids[$i])]['id'];
             $desc[] = $this->treeTab[$this->getLineCategory($ids[$i])]['description'];
         }
     }
     if (isset($this->treeTab[$this->getLineCategory($id)]['name'])) {
         $temp[] = $this->treeTab[$this->getLineCategory($id)]['name'];
         $catid[] = $this->treeTab[$this->getLineCategory($id)]['id'];
         $desc[] = $this->treeTab[$this->getLineCategory($id)]['description'];
     }
     // @todo Maybe this should be done somewhere else ...
     if ($renderAsMicroData) {
         foreach ($temp as $k => $category) {
             $url = sprintf('%s?%saction=show&amp;cat=%d', PMF_Link::getSystemRelativeUri(), $sids, $catid[$k]);
             $oLink = new PMF_Link($url, $this->_config);
             $oLink->text = sprintf('<span itemprop="title">%s</span>', $category);
             $oLink->itemTitle = $category;
             $oLink->tooltip = $desc[$k];
             $oLink->setItemProperty('url');
             if (0 == $k) {
                 $oLink->setRelation('index');
             }
             $breadcrumb[] = sprintf('<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">%s</li>', $oLink->toHtmlAnchor());
         }
         $temp = $breadcrumb;
         return sprintf('<ul class="%s">%s</ul>', $useCssClass, implode('', $temp));
     } else {
         return implode($separator, $temp);
     }
 }
Example #9
0
        if (!isset($sent[$userId])) {
            // TODO: Move this code to Category.php
            $oUser = new PMF_User();
            $oUser->getUserById($userId);
            $catOwnerEmail = $oUser->getUserData('email');
            $mail = new PMF_Mail();
            $mail->unsetFrom();
            $mail->setFrom($usermail);
            $mail->addTo($faqconfig->get('main.administrationMail'));
            // Let the category owner get a copy of the message
            if ($faqconfig->get('main.administrationMail') != $catOwnerEmail) {
                $mail->addCc($catOwnerEmail);
            }
            $mail->subject = '%sitename%';
            // TODO: let the email contains the faq article both as plain text and as HTML
            $mail->message = html_entity_decode($PMF_LANG['msgMailCheck']) . "\n\n" . $faqconfig->get('main.titleFAQ') . ": " . PMF_Link::getSystemUri('/index.php') . '/admin';
            $result = $mail->send();
            unset($mail);
            $sent[$userId] = $catOwnerEmail;
        }
    }
    $tpl->processTemplate('writeContent', array('msgNewContentHeader' => $PMF_LANG["msgNewContentHeader"], 'Message' => $isNew ? $PMF_LANG['msgNewContentThanks'] : $PMF_LANG['msgNewTranslationThanks']));
} else {
    if (false === IPCheck($_SERVER['REMOTE_ADDR'])) {
        $tpl->processTemplate('writeContent', array('msgNewContentHeader' => $PMF_LANG['msgNewContentHeader'], 'Message' => $PMF_LANG['err_bannedIP']));
    } else {
        if (is_null($faqid)) {
            $faqsession->userTracking('error_save_entry', 0);
        } else {
            $faqsession->userTracking('error_save_translation_entry', 0);
        }
Example #10
0
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
$faqQuestions = new PMF_Faq_Questions();
$rssData = $faqQuestions->fetchAll();
$num = count($rssData);
$rss = new XMLWriter();
$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgOpenQuestions']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/openquestions/rss.php'));
if ($num > 0) {
    $counter = 0;
    foreach ($rssData as $item) {
        if ($counter < PMF_RSS_OPENQUESTIONS_MAX) {
            $counter++;
            $rss->startElement('item');
            $rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item->question), 8) . " (" . $item->username . ")");
            $rss->startElement('description');
            $rss->writeCdata($item->question);
            $rss->endElement();
            $rss->writeElement('link', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER["PHP_SELF"]) . "?action=open#openq_" . $item->id);
            $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item->date, true));
            $rss->endElement();
        }
    }
Example #11
0
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgTopTen']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php'));
if ($num > 0) {
    $i = 0;
    foreach ($rssData as $item) {
        $i++;
        // Get the url
        $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']);
        if (PMF_RSS_USE_SEO) {
            if (isset($item['thema'])) {
                $oLink = new PMF_Link($link);
                $oLink->itemTitle = html_entity_decode($item['thema'], ENT_COMPAT, 'UTF-8');
                $link = html_entity_decode($oLink->toString(), ENT_COMPAT, 'UTF-8');
            }
        }
        $rss->startElement('item');
        $rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['thema'], ENT_COMPAT, 'UTF-8'), 8) . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")");
        $rss->startElement('description');
        $rss->writeCdata("[" . $i . ".] " . $item['thema'] . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")");
        $rss->endElement();
        $rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php') . $link);
        $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['last_visit'], false));
        $rss->endElement();
    }
}
$rss->endElement();
Example #12
0
         $templateVars['renderUpdateUserScript'] = true;
         $templateVars['updateUserId'] = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT, 0);
     }
     $twig->loadTemplate('user/list.twig')->display($templateVars);
 }
 // show list of all users
 if ($userAction == 'listallusers' && $user->perm->checkRight($user->getUserId(), 'edituser')) {
     $templateVars = array('PMF_LANG' => $PMF_LANG, 'displayPagination' => false, 'message' => $message, 'users' => array());
     $allUsers = $user->getAllUsers();
     $numUsers = count($allUsers);
     $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 0);
     $perPage = 10;
     $numPages = ceil($numUsers / $perPage);
     $lastPage = $page * $perPage;
     $firstPage = $lastPage - $perPage;
     $baseUrl = sprintf('%s?action=user&amp;user_action=listallusers&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
     if ($perPage < $numUsers) {
         // Pagination options
         $options = array('baseUrl' => $baseUrl, 'total' => $numUsers, 'perPage' => $perPage, 'pageParamName' => 'page');
         $pagination = new PMF_Pagination($faqConfig, $options);
         $templateVars['displayPagination'] = true;
         $templateVars['pagination'] = $pagination->render();
     }
     $counter = $displayedCounter = 0;
     foreach ($allUsers as $userId) {
         $user->getUserById($userId);
         if ($displayedCounter >= $perPage) {
             continue;
         }
         $counter++;
         if ($counter <= $firstPage) {
Example #13
0
// 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 = '';
if (isset($permission['editnews'])) {
    $editThisEntry = sprintf('<a href="%sadmin/index.php?action=news&amp;do=edit&amp;id=%d">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $news_id, $PMF_LANG['ad_menu_news_edit']);
}
// Is the news item expired?
$expired = date('YmdHis') > $news['dateEnd'];
// Does the user have the right to add a comment?
if (!$news['active'] || !$news['allowComments'] || $expired) {
    $commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
    $oLink = new PMF_Link($_SERVER['SCRIPT_NAME'] . '?' . str_replace('&', '&amp;', $_SERVER['QUERY_STRING']));
    $oLink->itemTitle = $header;
    $commentHref = $oLink->toString() . '#comment';
    $commentMessage = sprintf('<a onclick="javascript:$(\'#comment\').show();" href="%s">%s</a>', $commentHref, $PMF_LANG['newsWriteComment']);
}
// Set the template variables
$tpl->processTemplate("writeContent", array('writeNewsHeader' => $writeNewsHeader, 'writeNewsRSS' => $writeNewsRSS, 'writeHeader' => $header, 'writeContent' => $content, 'writeDateMsg' => $news['active'] && !$expired ? $PMF_LANG['msgLastUpdateArticle'] . '<span id="newsLastUpd">' . $news['date'] . '</span>' : '', 'writeAuthor' => $news['active'] && !$expired ? $PMF_LANG['msgAuthor'] . ': ' . $news['authorName'] : '', 'editThisEntry' => $editThisEntry, 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['newsWriteComment'], 'writeSendAdress' => '?' . $sids . 'action=savecomment', 'newsId' => $news_id, 'newsLang' => $news['lang'], 'msgCommentHeader' => $PMF_LANG['msgCommentHeader'], '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') : '', 'msgYourComment' => $PMF_LANG['msgYourComment'], 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit'], 'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('writecomment')), 'writeComments' => $comment->getComments($news_id, PMF_Comment::COMMENT_TYPE_NEWS)));
$tpl->includeTemplate('writeContent', 'index');
Example #14
0
 /**
  * Returns the "Show FAQ as PDF" URL
  *
  * @return string
  */
 public function getPdfLink()
 {
     return sprintf('%spdf.php?cat=%d&amp;id=%d&amp;artlang=%s', PMF_Link::getSystemRelativeUri('index.php'), $this->getCategoryId(), $this->getFaqId(), $this->getLanguage());
 }
Example #15
0
    $search = new PMF_Search($faqConfig);
    if ('truncatesearchterms' === $action) {
        if ($search->deleteAllSearchTerms()) {
            printf('<p class="alert alert-success">%s</p>', $PMF_LANG["ad_searchterm_del_suc"]);
        } else {
            printf('<p class="alert alert-success">%s</p>', $PMF_LANG["ad_searchterm_del_err"]);
        }
    }
    $searchesCount = $search->getSearchesCount();
    $searchesList = $search->getMostPopularSearches($searchesCount + 1, true);
    if (is_null($pages)) {
        $pages = round((count($searchesList) + $perpage / 3) / $perpage, 0);
    }
    $start = ($page - 1) * $perpage;
    $ende = $start + $perpage;
    $baseUrl = sprintf('%s?action=searchstats&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
    // Pagination options
    $options = array('baseUrl' => $baseUrl, 'total' => count($searchesList), 'perPage' => $perpage, 'pageParamName' => 'page');
    $pagination = new PMF_Pagination($faqConfig, $options);
    ?>
                <div id="ajaxresponse"></div>
                <table class="table table-striped">
                <thead>
                <tr>
                    <th><?php 
    echo $PMF_LANG['ad_searchstats_search_term'];
    ?>
</th>
                    <th><?php 
    echo $PMF_LANG['ad_searchstats_search_term_count'];
    ?>
Example #16
0
 /**
  * Returns all relevant Articles for a FAQ record
  *
  * @param   integer $record_id
  * @param   string  $thema
  * @return   string
  * @since   2006-08-29
  * @author  Thomas Zeithaml <*****@*****.**>
  */
 public function getAllRelatedById($record_id, $article_name, $keywords)
 {
     global $sids, $PMF_CONF;
     $relevantslisting = '';
     $begriffe = str_replace('-', ' ', $article_name) . $keywords;
     $i = $last_id = 0;
     $result = $this->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"), $begriffe, array(SQLPREFIX . "faqdata.active" => "'yes'"));
     while (($row = $this->db->fetch_object($result)) && $i < $PMF_CONF['records.numberOfRelatedArticles']) {
         if ($row->id == $record_id || $row->id == $last_id) {
             continue;
         }
         $relevantslisting .= '' == $relevantslisting ? '<ul>' : '';
         $relevantslisting .= '<li>';
         $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 = $row->thema;
         $oLink->tooltip = $row->thema;
         $relevantslisting .= $oLink->toHtmlAnchor() . '</li>';
         $i++;
         $last_id = $row->id;
     }
     $relevantslisting .= $i > 0 ? '</ul>' : '';
     return '' == $relevantslisting ? '-' : $relevantslisting;
 }
Example #17
0
 $mergedResult = array();
 foreach ($cleanQuestion as $word) {
     $searchResult[] = $faqSearch->search($word);
 }
 foreach ($searchResult as $resultSet) {
     foreach ($resultSet as $result) {
         $mergedResult[] = $result;
     }
 }
 $faqSearchResult->reviewResultset($mergedResult);
 if (0 < $faqSearchResult->getNumberOfResults()) {
     $response = sprintf('<p>%s</p>', $plr->GetMsg('plmsgSearchAmount', $faqSearchResult->getNumberOfResults()));
     $response .= '<ul>';
     foreach ($faqSearchResult->getResultset() as $result) {
         $url = sprintf('/index.php?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $result->category_id, $result->id, $result->lang);
         $oLink = new PMF_Link(PMF_Configuration::getInstance()->get('main.referenceURL') . $url);
         $oLink->text = PMF_Utils::chopString($result->question, 15);
         $oLink->itemTitle = $result->question;
         $response .= sprintf('<li>%s<br /><div class="searchpreview">%s...</div></li>', $oLink->toHtmlAnchor(), PMF_Utils::chopString(strip_tags($result->answer), 10));
     }
     $response .= '</ul>';
     $message = array('result' => $response);
 } else {
     $questionData = array('username' => $name, 'email' => $email, 'category_id' => $ucategory, 'question' => $question, 'is_visible' => $visibility);
     $faq->addQuestion($questionData);
     $questionMail = "User: "******", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['category_id']]["name"] . "\n\n" . wordwrap($question, 72) . "\n\n" . $faqconfig->get('main.referenceURL') . '/admin/';
     $userId = $cat->getCategoryUser($questionData['category_id']);
     $oUser = new PMF_User();
     $oUser->getUserById($userId);
     $userEmail = $oUser->getUserData('email');
     $mainAdminEmail = PMF_Configuration::getInstance()->get('main.administrationMail');
 /**
  * @param PMF_Search_Resultset $resultSet
  * @param integer              $recordId
  *
  * @return string
  */
 public function renderRelatedFaqs(PMF_Search_Resultset $resultSet, $recordId)
 {
     $html = '';
     $numOfResults = $resultSet->getNumberOfResults();
     if ($numOfResults > 0) {
         $html .= '<ul>';
         $counter = 0;
         foreach ($resultSet->getResultset() as $result) {
             if ($counter >= 5) {
                 continue;
             }
             if ($recordId == $result->id) {
                 continue;
             }
             $counter++;
             $url = sprintf('%s?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', PMF_Link::getSystemRelativeUri(), $result->category_id, $result->id, $result->lang);
             $oLink = new PMF_Link($url, $this->_config);
             $oLink->itemTitle = $result->question;
             $oLink->text = $result->question;
             $oLink->tooltip = $result->question;
             $html .= '<li>' . $oLink->toHtmlAnchor() . '</li>';
         }
         $html .= '</ul>';
     }
     return $html;
 }
Example #19
0
    // Before a redirection we must force the PHP session update for preventing data loss
    session_write_close();
    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);
}
Example #20
0
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$currentCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
if (!is_null($currentCategory) && isset($category->categoryName[$currentCategory])) {
    $faqsession->userTracking('show_category', $currentCategory);
    $parent = $category->categoryName[$currentCategory]['parent_id'];
    $name = $category->categoryName[$currentCategory]['name'];
    $records = $faq->showAllRecords($currentCategory, $faqconfig->get('records.orderby'), $faqconfig->get('records.sortby'));
    if (!$records) {
        $subCategory = new PMF_Category($current_user, $current_groups, true);
        $subCategory->transform($currentCategory);
        $records = $subCategory->viewTree();
    }
    $up = '';
    if ($parent != 0) {
        $url = sprintf('%saction=show&amp;cat=%d', $sids, $parent);
        $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
        $oLink->itemTitle = $category->categoryName[$parent]['name'];
        $oLink->text = $PMF_LANG['msgCategoryUp'];
        $up = $oLink->toHtmlAnchor();
    }
    $tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgEntriesIn'] . $name, 'writeThemes' => $records, 'writeOneThemeBack' => $up));
    $tpl->includeTemplate('writeContent', 'index');
} else {
    $faqsession->userTracking('show_all_categories', 0);
    $tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgFullCategories'], 'writeThemes' => $category->viewTree(), 'writeOneThemeBack' => ''));
    $tpl->includeTemplate('writeContent', 'index');
}
Example #21
0
    $rights = array(array('name' => 'adduser', 'description' => 'Right to add user accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'edituser', 'description' => 'Right to edit user accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'deluser', 'description' => 'Right to delete user accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addbt', 'description' => 'Right to add faq entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editbt', 'description' => 'Right to edit faq entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delbt', 'description' => 'Right to delete faq entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'viewlog', 'description' => 'Right to view logfiles', 'for_users' => 1, 'for_groups' => 1), array('name' => 'adminlog', 'description' => 'Right to view admin log', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delcomment', 'description' => 'Right to delete comments', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addnews', 'description' => 'Right to add news', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editnews', 'description' => 'Right to edit news', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delnews', 'description' => 'Right to delete news', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addcateg', 'description' => 'Right to add categories', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editcateg', 'description' => 'Right to edit categories', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delcateg', 'description' => 'Right to delete categories', 'for_users' => 1, 'for_groups' => 1), array('name' => 'passwd', 'description' => 'Right to change passwords', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editconfig', 'description' => 'Right to edit configuration', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addatt', 'description' => 'Right to add attachments', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delatt', 'description' => 'Right to delete attachments', 'for_users' => 1, 'for_groups' => 1), array('name' => 'backup', 'description' => 'Right to save backups', 'for_users' => 1, 'for_groups' => 1), array('name' => 'restore', 'description' => 'Right to load backups', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delquestion', 'description' => 'Right to delete questions', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addglossary', 'description' => 'Right to add glossary entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editglossary', 'description' => 'Right to edit glossary entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delglossary', 'description' => 'Right to delete glossary entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'changebtrevs', 'description' => 'Right to edit revisions', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addgroup', 'description' => 'Right to add group accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editgroup', 'description' => 'Right to edit group accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delgroup', 'description' => 'Right to delete group accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addtranslation', 'description' => 'Right to add translation', 'for_users' => 1, 'for_groups' => 1), array('name' => 'edittranslation', 'description' => 'Right to edit translations', 'for_users' => 1, 'for_groups' => 1), array('name' => 'deltranslation', 'description' => 'Right to delete translations', 'for_users' => 1, 'for_groups' => 1), array('name' => 'approverec', 'description' => 'Right to approve records', 'for_users' => 1, 'for_groups' => 1));
    foreach ($rights as $right) {
        $rightID = $admin->perm->addRight($right);
        $admin->perm->grantUserRight($adminID, $rightID);
    }
    // Add anonymous user account
    $anonymous = new PMF_User();
    $anonymous->createUser('anonymous', null, -1);
    $anonymous->setStatus('protected');
    $anonymousData = array('display_name' => 'Anonymous User', 'email' => null);
    $anonymous->setUserData($anonymousData);
    $oConf = PMF_Configuration::getInstance();
    $oConf->getAll();
    $configs = $oConf->config;
    $configs['spam.enableCaptchaCode'] = extension_loaded('gd') ? 'true' : 'false';
    $configs['main.referenceURL'] = PMF_Link::getSystemUri('/install/setup.php');
    $configs['main.phpMyFAQToken'] = md5(uniqid(rand()));
    $oConf->update($configs);
    print "</p>\n";
    print "<p class=\"center\">All database tables were successfully created.</p>\n";
    print "<p class=\"center\">Congratulation! Everything seems to be okay.</p>\n";
    ?>
<script type="text/javascript">
//<![CDATA[
var iframect = 0;

function iframeUpdated() {
    if (iframect++ == 0) {
        return;
    }
Example #22
0
 /**
  * Render url for a given page
  * 
  * @param string  $url  url
  * @param integer $page page number
  * 
  * @return string
  */
 protected function renderUrl($url, $page)
 {
     $cleanedUrl = PMF_String::preg_replace(array('$&(amp;|)' . $this->pageParamName . '=(\\d+)$'), '', $url);
     $url = sprintf('%s&amp;%s=%d', $cleanedUrl, $this->pageParamName, $page);
     $link = new PMF_Link($url);
     $link->itemTitle = $this->seoName;
     return $link->toString();
 }
Example #23
0
 /**
  * Function for generating the HTML fro the current news
  *
  * @param boolean $showArchive Show archived news
  * @param boolean $active      Show active news
  * 
  * @return string
  */
 public function getNews($showArchive = false, $active = true)
 {
     $output = '';
     $news = $this->getLatestData($showArchive, $active);
     foreach ($news as $item) {
         $url = sprintf('%s?action=news&amp;newsid=%d&amp;newslang=%s', PMF_Link::getSystemRelativeUri(), $item['id'], $item['lang']);
         $oLink = new PMF_Link($url);
         if (isset($item['header'])) {
             $oLink->itemTitle = $item['header'];
         }
         $output .= sprintf('<h3><a name="news_%d" href="%s">%s <img class="goNews" src="images/more.gif" width="11" height="11" alt="%s" /></a></h3><div class="block">%s', $item['id'], $oLink->toString(), $item['header'], $item['header'], $item['content']);
         if (strlen($item['link']) > 1) {
             $output .= sprintf('<br />%s <a href="%s" target="_%s">%s</a>', $this->pmf_lang['msgInfo'], $item['link'], $item['target'], $item['linkTitle']);
         }
         $output .= sprintf('</div><div class="date">%s</div>', PMF_Date::createIsoDate($item['date']));
     }
     return '' == $output ? $this->pmf_lang['msgNoNews'] : $output;
 }
Example #24
0
 /**
  * Renders the main navigation dropdown
  *
  * @return string
  */
 public function renderCategoryDropDown()
 {
     global $sids, $PMF_LANG;
     $open = 0;
     $output = '';
     $numCategories = $this->Category->height();
     $this->Category->expandAll();
     if ($numCategories > 0) {
         for ($y = 0; $y < $this->Category->height(); $y = $this->Category->getNextLineTree($y)) {
             list($hasChild, $categoryName, $parent, $description) = $this->Category->getLineDisplay($y);
             $level = $this->Category->treeTab[$y]['level'];
             $leveldiff = $open - $level;
             $numChilds = $this->Category->treeTab[$y]['numChilds'];
             if (!isset($number[$parent])) {
                 $number[$parent] = 0;
             }
             if ($this->_config->get('records.hideEmptyCategories') && 0 === $number[$parent] && '-' === $hasChild) {
                 continue;
             }
             if ($leveldiff > 1) {
                 $output .= '</li>';
                 for ($i = $leveldiff; $i > 1; $i--) {
                     $output .= sprintf("\n%s</ul>\n%s</li>\n", str_repeat("\t", $level + $i + 1), str_repeat("\t", $level + $i));
                 }
             }
             if ($level < $open) {
                 if ($level - $open == -1) {
                     $output .= '</li>';
                 }
                 $output .= sprintf("\n%s</ul>\n%s</li>\n", str_repeat("\t", $level + 2), str_repeat("\t", $level + 1));
             } elseif ($level == $open && $y != 0) {
                 $output .= "</li>\n";
             }
             if ($level > $open) {
                 $output .= sprintf("\n%s<ul class=\"dropdown-menu\">\n%s", str_repeat("\t", $level + 1), str_repeat("\t", $level + 1));
                 if ($numChilds > 0) {
                     $output .= '<li class="dropdown-submenu">';
                 } else {
                     $output .= '<li>';
                 }
             } else {
                 $output .= str_repeat("\t", $level + 1);
                 if ($numChilds > 0) {
                     $output .= '<li class="dropdown-submenu">';
                 } else {
                     $output .= '<li>';
                 }
             }
             $url = sprintf('%s?%saction=show&amp;cat=%d', PMF_Link::getSystemRelativeUri(), $sids, $parent);
             $oLink = new PMF_Link($url, $this->_config);
             $oLink->itemTitle = $categoryName;
             $oLink->text = $categoryName;
             $oLink->tooltip = $description;
             $output .= $oLink->toHtmlAnchor();
             $open = $level;
         }
         if (isset($level) && $level > 0) {
             $output .= str_repeat("</li>\n\t</ul>\n\t", $level);
         }
         return $output;
     } else {
         $output = '<li><a href="#">' . $PMF_LANG['no_cats'] . '</a></li>';
     }
     return $output;
 }
Example #25
0
// Set right column
//
// Check in any tags with at leat one entry exist
$hasTags = $oTag->existTagRelations();
if ($hasTags && ($action == 'artikel' || $action == 'show')) {
    $right_tpl = $action == 'artikel' ? 'catandtag.tpl' : 'tagcloud.tpl';
} else {
    $right_tpl = 'startpage.tpl';
}
//
// Load template files and set template variables
//
$tpl = new PMF_Template(array('index' => 'index.tpl', 'loginBox' => $login_tpl, 'rightBox' => $right_tpl, 'writeContent' => $inc_tpl), $faqconfig->get('main.templateSet'));
$usersOnLine = getUsersOnline();
$totUsersOnLine = $usersOnLine[0] + $usersOnLine[1];
$systemUri = PMF_Link::getSystemUri('index.php');
$helper = PMF_Helper_Category::getInstance();
$helper->setCategory($category);
$main_template_vars = array('title' => $faqconfig->get('main.titleFAQ') . $title, 'baseHref' => $systemUri, 'version' => $faqconfig->get('main.currentVersion'), 'header' => str_replace('"', '', $faqconfig->get('main.titleFAQ')), 'metaTitle' => str_replace('"', '', $faqconfig->get('main.titleFAQ')), 'metaDescription' => $faqconfig->get('main.metaDescription'), 'metaKeywords' => $faqconfig->get('main.metaKeywords') . $keywords, 'metaPublisher' => $faqconfig->get('main.metaPublisher'), 'metaLanguage' => $PMF_LANG['metaLanguage'], 'metaCharset' => $PMF_LANG['metaCharset'], 'phpmyfaqversion' => $faqconfig->get('main.currentVersion'), 'stylesheet' => $PMF_LANG['dir'] == 'rtl' ? 'style.rtl' : 'style', 'action' => $action, 'dir' => $PMF_LANG['dir'], 'msgCategory' => $PMF_LANG['msgCategory'], 'showCategories' => $helper->renderCategoryNavigation($cat), 'searchBox' => $PMF_LANG['msgSearch'], 'languageBox' => $PMF_LANG['msgLangaugeSubmit'], 'writeLangAdress' => $writeLangAdress, 'switchLanguages' => PMF_Language::selectLanguages($LANGCODE, true), 'userOnline' => $plr->getMsg('plmsgUserOnline', $totUsersOnLine) . $plr->getMsg('plmsgGuestOnline', $usersOnLine[0]) . $plr->getMsg('plmsgRegisteredOnline', $usersOnLine[1]), 'stickyRecordsHeader' => $PMF_LANG['stickyRecordsHeader'], 'copyright' => 'powered by <a href="http://www.phpmyfaq.de" target="_blank">phpMyFAQ</a> ' . $faqconfig->get('main.currentVersion'));
$stickyRecordsParams = $faq->getStickyRecords();
if (!isset($stickyRecordsParams['error'])) {
    $tpl->processBlock('index', 'stickyRecordsList', array('stickyRecordsUrl' => $stickyRecordsParams['url'], 'stickyRecordsTitle' => $stickyRecordsParams['title']));
}
if ($faqconfig->get('main.enableRewriteRules')) {
    $links_template_vars = array("faqHome" => $_SERVER['PHP_SELF'], "msgSearch" => '<a href="' . $systemUri . 'search.html">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', 'msgAddContent' => '<a href="' . $systemUri . 'addcontent.html">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="' . $systemUri . 'ask.html">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="' . $systemUri . 'open.html">' . $PMF_LANG["msgOpenQuestions"] . '</a>', 'msgHelp' => '<a href="' . $systemUri . 'help.html">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="' . $systemUri . 'contact.html">' . $PMF_LANG["msgContact"] . '</a>', "backToHome" => '<a href="' . $systemUri . 'index.html">' . $PMF_LANG["msgHome"] . '</a>', "allCategories" => '<a href="' . $systemUri . 'showcat.html">' . $PMF_LANG["msgShowAllCategories"] . '</a>', "writeSendAdress" => $systemUri . 'search.html', 'showInstantResponse' => '<a href="' . $systemUri . 'instantresponse.html">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => getLinkHtmlAnchor($_SERVER['PHP_SELF'] . '?' . $sids . 'action=sitemap&amp;lang=' . $LANGCODE, $PMF_LANG['msgSitemap']), 'opensearch' => $systemUri . 'search.html');
} else {
    $links_template_vars = array("faqHome" => $_SERVER['PHP_SELF'], "msgSearch" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=search">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', "msgAddContent" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=add">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=ask">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=open">' . $PMF_LANG["msgOpenQuestions"] . '</a>', "msgHelp" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=help">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=contact">' . $PMF_LANG["msgContact"] . '</a>', "allCategories" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=show">' . $PMF_LANG["msgShowAllCategories"] . '</a>', "backToHome" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . '">' . $PMF_LANG["msgHome"] . '</a>', "writeSendAdress" => $_SERVER['PHP_SELF'] . '?' . $sids . 'action=search', 'showInstantResponse' => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=instantresponse">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=sitemap&amp;lang=' . $LANGCODE . '">' . $PMF_LANG['msgSitemap'] . '</a>', 'opensearch' => $_SERVER['PHP_SELF'] . '?' . $sids . 'action=search');
}
//
// Send headers and print template
//
Example #26
0
if ($faqConfig->get('main.enableUserTracking')) {
    $users = $faqsession->getUsersOnline();
    $totUsers = $users[0] + $users[1];
    $usersOnline = $plr->getMsg('plmsgUserOnline', $totUsers) . ' | ' . $plr->getMsg('plmsgGuestOnline', $users[0]) . $plr->getMsg('plmsgRegisteredOnline', $users[1]);
} else {
    $usersOnline = '';
}
$faqSystem = new PMF_System();
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$categoryHelper->setConfiguration($faqConfig);
$keywordsArray = array_merge(explode(',', $keywords), explode(',', $faqConfig->get('main.metaKeywords')));
$keywordsArray = array_filter($keywordsArray, 'strlen');
shuffle($keywordsArray);
$keywords = implode(',', $keywordsArray);
$faqLink = new PMF_Link($faqSystem->getSystemUri($faqConfig), $faqConfig);
$currentPageUrl = $faqLink->getCurrentUrl();
if (is_null($error)) {
    $loginMessage = '<p>' . $PMF_LANG['ad_auth_insert'] . '</p>';
} else {
    $loginMessage = '<p class="error">' . $error . '</p>';
}
$tplMainPage = array('msgLoginUser' => $PMF_LANG['msgLoginUser'], 'title' => $faqConfig->get('main.titleFAQ') . $title, 'baseHref' => $faqSystem->getSystemUri($faqConfig), 'version' => $faqConfig->get('main.currentVersion'), 'header' => str_replace('"', '', $faqConfig->get('main.titleFAQ')), 'metaTitle' => str_replace('"', '', $faqConfig->get('main.titleFAQ') . $title), 'metaDescription' => $metaDescription, 'metaKeywords' => $keywords, 'metaPublisher' => $faqConfig->get('main.metaPublisher'), 'metaLanguage' => $PMF_LANG['metaLanguage'], 'metaCharset' => 'utf-8', 'phpmyfaqversion' => $faqConfig->get('main.currentVersion'), 'stylesheet' => $PMF_LANG['dir'] == 'rtl' ? 'style.rtl' : 'style', 'currentPageUrl' => $currentPageUrl, 'action' => $action, 'dir' => $PMF_LANG['dir'], 'headerCategories' => $PMF_LANG['msgFullCategories'], 'msgCategory' => $PMF_LANG['msgCategory'], 'msgExportAllFaqs' => $PMF_LANG['msgExportAllFaqs'], 'languageBox' => $PMF_LANG['msgLangaugeSubmit'], 'writeLangAdress' => $writeLangAdress, 'switchLanguages' => PMF_Language::selectLanguages($LANGCODE, true), 'userOnline' => $usersOnline, 'copyright' => 'powered by <a href="http://www.phpmyfaq.de" target="_blank">phpMyFAQ</a> ' . $faqConfig->get('main.currentVersion'), 'registerUser' => '<a href="?action=register">' . $PMF_LANG['msgRegistration'] . '</a>', 'sendPassword' => '<a href="?action=password">' . $PMF_LANG['lostPassword'] . '</a>', 'loginHeader' => $PMF_LANG['msgLoginUser'], 'loginMessage' => $loginMessage, 'writeLoginPath' => $faqSystem->getSystemUri($faqConfig) . '?' . PMF_Filter::getFilteredQueryString(), 'faqloginaction' => $action, 'login' => $PMF_LANG['ad_auth_ok'], 'username' => $PMF_LANG['ad_auth_user'], 'password' => $PMF_LANG['ad_auth_passwd'], 'rememberMe' => $PMF_LANG['rememberMe'], 'headerChangePassword' => $PMF_LANG['ad_passwd_cop'], 'msgUsername' => $PMF_LANG['ad_auth_user'], 'msgEmail' => $PMF_LANG['ad_entry_email'], 'msgSubmit' => $PMF_LANG['msgNewContentSubmit']);
$tpl->parseBlock('index', 'categoryListSection', array('showCategories' => $categoryHelper->renderNavigation($cat), 'categoryDropDown' => $categoryHelper->renderCategoryDropDown($cat)));
if ('main' == $action || 'show' == $action) {
    if ('main' == $action && $faqConfig->get('search.useAjaxSearchOnStartpage')) {
        $tpl->parseBlock('index', 'globalSuggestBox', array('ajaxlanguage' => $LANGCODE, 'msgDescriptionInstantResponse' => $PMF_LANG['msgDescriptionInstantResponse'], 'msgSearch' => sprintf('<a class="help" href="%sindex.php?action=search">%s</a>', $faqSystem->getSystemUri($faqConfig), $PMF_LANG["msgAdvancedSearch"])));
    } else {
        $tpl->parseBlock('index', 'globalSearchBox', array('writeSendAdress' => '?' . $sids . 'action=search', 'searchBox' => $PMF_LANG['msgSearch'], 'categoryId' => $cat === 0 ? '%' : (int) $cat, 'msgSearch' => sprintf('<a class="help" href="%sindex.php?action=search">%s</a>', $faqSystem->getSystemUri($faqConfig), $PMF_LANG["msgAdvancedSearch"])));
    }
}
    }
    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$logging = new PMF_Logging($faqConfig);
if ($user->perm->checkRight($user->getUserId(), 'adminlog') && 'adminlog' == $action) {
    $date = new PMF_Date($faqConfig);
    $perpage = 15;
    $pages = PMF_Filter::filterInput(INPUT_GET, 'pages', FILTER_VALIDATE_INT);
    $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 1);
    if (is_null($pages)) {
        $pages = round(($logging->getNumberOfEntries() + $perpage / 3) / $perpage, 0);
    }
    $start = ($page - 1) * $perpage;
    $ende = $start + $perpage;
    $baseUrl = sprintf('%s?action=adminlog&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
    // Pagination options
    $options = array('baseUrl' => $baseUrl, 'total' => $logging->getNumberOfEntries(), 'perPage' => $perpage, 'pageParamName' => 'page');
    $pagination = new PMF_Pagination($faqConfig, $options);
    $loggingData = $logging->getAll();
    ?>
    <header>
        <h2 class="page-header">
            <i class="fa fa-tasks"></i> <?php 
    echo $PMF_LANG["ad_menu_adminlog"];
    ?>
            <div class="pull-right">
                <a class="btn btn-danger" href="?action=deleteadminlog">
                    <i class="fa fa-trash"></i> <?php 
    echo $PMF_LANG['ad_adminlog_del_older_30d'];
    ?>
Example #28
0
?>
" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="<?php 
print $PMF_LANG['metaLanguage'];
?>
" class="no-js"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    
    <title><?php 
print $faqconfig->get('main.titleFAQ');
?>
 - powered by phpMyFAQ</title>
    <base href="<?php 
print PMF_Link::getSystemUri('index.php');
?>
" />
    
    <meta name="description" content="Only Chuck Norris can divide by zero.">
    <meta name="author" content="phpMyFAQ Team">
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
    <meta name="application-name" content="phpMyFAQ <?php 
print $faqconfig->get('main.currentVersion');
?>
">
    <meta name="copyright" content="(c) 2001-2010 phpMyFAQ Team">
    <meta name="publisher" content="phpMyFAQ Team">
    <meta name="MSSmartTagsPreventParsing" content="true">
    
    <link rel="stylesheet" href="style/admin.css?v=1">
Example #29
0
 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 {
     $oNews = new PMF_News();
     $news = $oNews->getNewsEntry($id);
     if ($news['authorEmail'] != '') {
         $emailTo = $news['authorEmail'];
     }
     $oLink = new PMF_Link(PMF_Link::getSystemUri() . '?action=news&amp;newsid=' . $news['id'] . '&amp;newslang=' . $news['lang']);
     $oLink->itemTitle = $news['header'];
     $urlToContent = $oLink->toString();
 }
 $commentMail = 'User: '******'username'] . ', mailto:' . $commentData['usermail'] . "\n" . 'New comment posted on: ' . $urlToContent . "\n\n" . wordwrap($comment, 72);
 $mail = new PMF_Mail();
 $mail->unsetFrom();
 $mail->setFrom($commentData['usermail']);
 $mail->addTo($emailTo);
 // Let the category owner get a copy of the message
 if ($emailTo != $faqconfig->get('main.administrationMail')) {
     $mail->addCc($faqconfig->get('main.administrationMail'));
 }
 $mail->subject = '%sitename%';
 $mail->message = strip_tags($commentMail);
 $result = $mail->send();
 * @since     2012-09-03
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    $protocol = 'http';
    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
        $protocol = 'https';
    }
    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 1);
$glossary = new PMF_Glossary($faqConfig);
$glossaryItems = $glossary->getAllGlossaryItems();
$numItems = count($glossaryItems);
$itemsPerPage = 10;
$baseUrl = sprintf('%s?action=glossary&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
// Pagination options
$options = array('baseUrl' => $baseUrl, 'total' => count($glossaryItems), 'perPage' => $itemsPerPage, 'pageParamName' => 'page');
$pagination = new PMF_Pagination($faqConfig, $options);
if (0 < $numItems) {
    $output = array();
    $visibleItems = array_slice($glossaryItems, ($page - 1) * $itemsPerPage, $itemsPerPage);
    foreach ($visibleItems as $item) {
        $output['item'][] = $item['item'];
        $output['definition'][] = $item['definition'];
        $i++;
    }
    $tpl->parseBlock('writeContent', 'glossaryItems', array('item' => $output['item'], 'desc' => $output['definition']));
}
$tpl->parse('writeContent', array('msgGlossary' => $PMF_LANG['ad_menu_glossary'], 'msgGlossrayItem' => $PMF_LANG['ad_glossary_item'], 'msgGlossaryDescription' => $PMF_LANG['ad_glossary_definition'], 'pagination' => $pagination->render(), 'glossaryData' => ''));
$tpl->merge('writeContent', 'index');