示例#1
0
文件: rss.php 项目: atlcurling/tkt
$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();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
$db->dbclose();
示例#2
0
文件: save.php 项目: nosch/phpMyFAQ
        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);
        }
示例#3
0
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;
    } else {
        PMF_Helper_Http::getInstance()->printHTTPStatus404();
    }
} else {
    header('Content-Type: text/xml');
示例#4
0
        }
        if ($useSticky) {
            $text[$i][] = $data['faq_sticky'];
        }
        if ($useTitle) {
            $text[$i][] = $report->convertEncoding($data['faq_question']);
        }
        if ($useCreationDate) {
            $text[$i][] = $data['faq_creation'];
        }
        if ($useOwner) {
            $text[$i][] = $report->convertEncoding($data['faq_org_author']);
        }
        if ($useLastModified) {
            $text[$i][] = $report->convertEncoding($data['faq_last_author']);
        }
        if ($useUrl) {
            $text[$i][] = $report->convertEncoding(sprintf('%sindex.php?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', PMF_Link::getSystemUri('admin/index.php'), $data['category_id'], $data['faq_id'], $data['faq_language']));
        }
        if ($useVisits) {
            $text[$i][] = $data['faq_visits'];
        }
    }
    $content = '';
    foreach ($text as $row) {
        $content .= implode(";", $row);
        $content .= "\r\n";
    }
    $oHttpStreamer = new PMF_HttpStreamer('csv', $content);
    $oHttpStreamer->send(PMF_HttpStreamer::HTTP_CONTENT_DISPOSITION_ATTACHMENT);
}
示例#5
0
         $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";
     $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description) VALUES\n            (45, 'export', 'Right to export the complete FAQ')";
示例#6
0
$editThisEntry = '';
if (isset($permission['editbt'])) {
    $editThisEntry = sprintf('<a href="%sadmin/index.php?action=editentry&amp;id=%d&amp;lang=%s">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $record_id, $lang, $PMF_LANG['ad_entry_edit_1'] . ' ' . $PMF_LANG['ad_entry_edit_2']);
}
// Is the faq expired?
$expired = date('YmdHis') > $faq->faqRecord['dateEnd'];
// Does the user have the right to add a comment?
if ($faq->faqRecord['active'] != 'yes' || 'n' == $faq->faqRecord['comment'] || $expired) {
    $commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
    $commentMessage = sprintf("%s<a href=\"javascript:void(0);\" onclick=\"javascript:\$('#comment').show();\">%s</a>", $PMF_LANG['msgYouCan'], $PMF_LANG['msgWriteComment']);
}
// Build Digg it! URL
$diggItUrl = sprintf('%s?cat=%s&amp;id=%d&amp;lang=%s&amp;title=%s', PMF_Link::getSystemUri(), $currentCategory, $record_id, $lang, urlencode($thema));
// Build Facebook URL
$facebookUrl = sprintf('%s?cat=%s&amp;id=%d&amp;lang=%s', PMF_Link::getSystemUri(), $currentCategory, $record_id, $lang);
// Create commented out HTML for microsummary
$allVisitsData = $faqvisits->getAllData();
$faqPopularity = '';
$maxVisits = 0;
$minVisits = 0;
$currVisits = 0;
$faqVisitsCount = count($allVisitsData);
$percentage = 0;
if ($faqVisitsCount > 0) {
    $percentage = 100 / $faqVisitsCount;
}
foreach ($allVisitsData as $_r) {
    if ($minVisits > $_r['visits']) {
        $minVisits = $_r['visits'];
    }
示例#7
0
 /**
  * The footer of the PDF file
  *
  * @return void
  */
 public function Footer()
 {
     global $PMF_LANG;
     $faqconfig = PMF_Configuration::getInstance();
     $footer = sprintf('(c) %d %s <%s> | %s', date('Y'), $faqconfig->get('main.metaPublisher'), $faqconfig->get('main.administrationMail'), PMF_Date::format(date('Y-m-d H:i')));
     $currentTextColor = $this->TextColor;
     $this->SetTextColor(0, 0, 0);
     $this->SetY(-25);
     $this->SetFont($this->currentFont, '', 10);
     $this->Cell(0, 10, $PMF_LANG['ad_gen_page'] . ' ' . $this->getAliasNumPage() . ' / ' . $this->getAliasNbPages(), 0, 0, 'C');
     $this->SetY(-20);
     $this->SetFont($this->currentFont, 'B', 8);
     $this->Cell(0, 10, $footer, 0, 1, "C");
     if ($this->enableBookmarks == false) {
         $this->SetY(-15);
         $this->SetFont($this->currentFont, '', 8);
         $baseUrl = 'index.php';
         if (is_array($this->faq) && !empty($this->faq)) {
             $baseUrl .= '?action=artikel&amp;';
             if (array_key_exists($this->category, $this->categories)) {
                 $baseUrl .= 'cat=' . $this->categories[$this->category]['id'];
             } else {
                 $baseUrl .= 'cat=0';
             }
             $baseUrl .= '&amp;id=' . $this->faq['id'];
             $baseUrl .= '&amp;artlang=' . $this->faq['lang'];
         }
         $url = PMF_Link::getSystemUri('pdf.php') . $baseUrl;
         $urlObj = new PMF_Link($url);
         $urlObj->itemTitle = $this->question;
         $_url = str_replace('&amp;', '&', $urlObj->toString());
         $this->Cell(0, 10, 'URL: ' . $_url, 0, 1, 'C', 0, $_url);
     }
     $this->TextColor = $currentTextColor;
 }
示例#8
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>';
 }
示例#9
0
文件: rss.php 项目: atlcurling/tkt
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ');
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/category/rss.php'));
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);
                $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', PMF_Link::getSystemUri('/feed/category/rss.php') . $link);
        $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['record_date'], true));
        $rss->endElement();
    }
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
$db->dbclose();
示例#10
0
        <value-of select="id('main')/h2"/>
      </template>
<?php 
        break;
    case 'open':
        // Open questions: Last question
        ?>
      <template match="/">
        <value-of select="id('main')/table/tbody/tr[last()]/td[2]"/>
      </template>
<?php 
        break;
    default:
        ?>
      <template match="/">
        <value-of select="id('header')/h1/a"/>
      </template>
<?php 
        break;
}
?>
      <pages>
        <include><?php 
print PMF_Link::getSystemUri('/microsummary.php');
?>
/*</include>
      </pages>
    </transform>
  </template>
</generator>
示例#11
0
 /**
  * Renders the OpenSearchLink
  * 
  * @return string
  */
 public function renderOpenSearchLink()
 {
     return sprintf('<a class="searchplugin" href="#" onclick="window.external.AddSearchProvider(\'%s/opensearch.php\');">%s</a>', PMF_Link::getSystemUri('/index.php'), $this->translation['opensearch_plugin_install']);
 }
示例#12
0
 *
 * PHP Version 5.2
 *
 * 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.
 *
 * @category  phpMyFAQ
 * @package   Frontend
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2006-2010 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2006-11-19
 */
define('PMF_ROOT_DIR', dirname(__FILE__));
require PMF_ROOT_DIR . '/inc/Init.php';
require PMF_ROOT_DIR . '/inc/Link.php';
require_once 'lang/' . $faqconfig->get('main.language');
$baseUrl = PMF_Link::getSystemUri('/opensearch.php');
$searchUrl = $baseUrl . '/index.php?action=search';
$srcUrl = $baseUrl;
$opensearch = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\">\n<ShortName>" . $faqconfig->get('main.titleFAQ') . "</ShortName>\n<Description>" . $faqconfig->get('main.metaDescription') . "</Description>\n<Url type=\"text/html\" template=\"" . $searchUrl . "&amp;search={searchTerms}\" />\n<Language>" . $PMF_LANG['metaLanguage'] . "</Language>\n<OutputEncoding>utf-8</OutputEncoding>\n<Contact>" . $faqconfig->get('main.administrationMail') . "</Contact>\n<Image height=\"16\" width=\"16\" type=\"image/png\">" . $baseUrl . "/images/pmfsearch.png</Image>\n</OpenSearchDescription>";
header("Content-type: text/xml");
print $opensearch;
示例#13
0
$sitemap = '';
// 1st entry: the faq server itself
$sitemap .= PMF_Link::getSystemUri('/sitemap.yahoo.php') . PMF_SITEMAP_YAHOO_END_OF_LINE;
// nth entry: each faq
foreach ($items as $item) {
    // a. We use plain PMF urls w/o any SEO schema
    $link = str_replace($_SERVER['PHP_SELF'], '/index.php', $item['url']);
    // b. We use SEO PMF urls
    if (PMF_SITEMAP_YAHOO_USE_SEO) {
        if (isset($item['thema'])) {
            $oL = new PMF_Link($link);
            $oL->itemTitle = $item['thema'];
            $link = $oL->toString();
        }
    }
    $sitemap .= PMF_Link::getSystemUri('/sitemap.yahoo.php') . $link . PMF_SITEMAP_YAHOO_END_OF_LINE;
}
$getgezip = PMF_Filter::filterInput(INPUT_GET, PMF_SITEMAP_YAHOO_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_YAHOO_FILENAME_GZ . '"');
        header('Content-Length: ' . strlen($sitemapGz));
        print $sitemapGz;
    } else {
        printHTTPStatus404();
    }
} else {
    header('Content-Type: text/plain');
    header('Content-Disposition: inline; filename="' . PMF_SITEMAP_YAHOO_FILENAME . '"');
示例#14
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">
示例#15
0
文件: rss.php 项目: noon/phpMyFAQ
$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['PHP_SELF'], '/index.php', $item['url']);
        if (PMF_RSS_USE_SEO) {
            if (isset($item['thema'])) {
                $oL = new PMF_Link($link);
                $oL->itemTitle = $item['thema'];
                $link = $oL->toString();
            }
        }
        $rss->startElement('item');
        $rss->writeElement('title', utf8_encode(PMF_Utils::makeShorterText($item['thema'], 8) . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"));
        $rss->startElement('description');
        $rss->writeCdata(utf8_encode("[" . $i . ".] " . $item['thema'] . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"));
        $rss->endElement();
        $rss->writeElement('link', utf8_encode(PMF_Link::getSystemUri('/feed/topten/rss.php') . $link));
        $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['last_visit'], false));
        $rss->endElement();
    }
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
$db->dbclose();
示例#16
0
 if ('faq' == $type) {
     $faq->getRecord($id);
     if ($faq->faqRecord['email'] != '') {
         $emailTo = $faq->faqRecord['email'];
     }
     $_faqUrl = sprintf('?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', 0, $faq->faqRecord['id'], $faq->faqRecord['lang']);
     $oLink = new PMF_Link(PMF_Link::getSystemUri('/ajaxservice.php') . $_faqUrl);
     $oLink->itemTitle = $faq->faqRecord['title'];
     $urlToContent = $oLink->toString();
 } else {
     $oNews = new PMF_News($db, $Language);
     $news = $oNews->getNewsEntry($id);
     if ($news['authorEmail'] != '') {
         $emailTo = $news['authorEmail'];
     }
     $link = sprintf('%s?action=news&amp;newsid=%d&amp;newslang=%s', PMF_Link::getSystemUri('/ajaxservice.php'), $news['id'], $news['lang']);
     $oLink = new PMF_Link($link);
     $oLink->itemTitle = $news['header'];
     $urlToContent = $oLink->toString();
 }
 $commentMail = 'User: '******'username'] . ', mailto:' . $commentData['usermail'] . "\n" . 'New comment posted on: ' . $urlToContent . "\n\n" . wordwrap($comment, 72);
 $send = array();
 $mail = new PMF_Mail();
 $mail->setReplyTo($commentData['usermail'], $commentData['username']);
 $mail->addTo($emailTo);
 $send[$emailTo] = 1;
 // Let the admin get a copy of the message
 if (!isset($send[$faqconfig->get('main.administrationMail')])) {
     $mail->addCc($faqconfig->get('main.administrationMail'));
     $send[$faqconfig->get('main.administrationMail')] = 1;
 }
示例#17
0
文件: search.php 项目: nosch/phpMyFAQ
    $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');
示例#18
0
文件: search.php 项目: atlcurling/tkt
    $faqSearch->setCategory($inputCategory);
    $searchResults = $faqSearch->search($inputSearchTerm, $allLanguages);
    $faqSearchResult->reviewResultset($searchResults);
    $inputSearchTerm = stripslashes($inputSearchTerm);
    $faqSearch->logSearchTerm($inputSearchTerm);
}
// Change a little bit the $searchCategory value;
$inputCategory = '%' == $inputCategory ? 0 : $inputCategory;
$faqsession->userTracking('fulltext_search', $inputSearchTerm);
if (is_numeric($inputSearchTerm) && PMF_SOLUTION_ID_START_VALUE <= $inputSearchTerm && 0 < $faqSearchResult->getNumberOfResults()) {
    // 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();
示例#19
0
 /**
  * Returns the "Send 2 Friends" URL
  *
  * @return string
  */
 public function getSuggestLink()
 {
     return sprintf('%s?action=send2friend&amp;cat=%d&amp;id=%d&amp;artlang=%s', PMF_Link::getSystemUri(), $this->getCategoryId(), $this->getFaqId(), $this->getLanguage());
 }
示例#20
0
文件: setup.php 项目: noon/phpMyFAQ
    $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;
    }
示例#21
0
文件: rss.php 项目: nosch/phpMyFAQ
// 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();
        }
    }
示例#22
0
文件: index.php 项目: noon/phpMyFAQ
// 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
//
示例#23
0
$editThisEntry = '';
if (isset($permission['editbt'])) {
    $editThisEntry = sprintf('<a href="%sadmin/index.php?action=editentry&amp;id=%d&amp;lang=%s">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $faq->faqRecord['id'], $lang, $PMF_LANG['ad_entry_edit_1'] . ' ' . $PMF_LANG['ad_entry_edit_2']);
}
// Is the faq expired?
$expired = date('YmdHis') > $faq->faqRecord['dateEnd'];
// Does the user have the right to add a comment?
if ($faq->faqRecord['active'] != 'yes' || 'n' == $faq->faqRecord['comment'] || $expired) {
    $commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
    $commentMessage = sprintf("%s<a href=\"javascript:void(0);\" onclick=\"javascript:\$('#comment').show();\">%s</a>", $PMF_LANG['msgYouCan'], $PMF_LANG['msgWriteComment']);
}
// Build Digg it! URL
$diggItUrl = sprintf('%s?cat=%s&amp;id=%d&amp;lang=%s&amp;title=%s', PMF_Link::getSystemUri(), $currentCategory, $faq->faqRecord['id'], $lang, urlencode($thema));
// Build Facebook URL
$facebookUrl = sprintf('%s?cat=%s&amp;id=%d&amp;lang=%s', PMF_Link::getSystemUri(), $currentCategory, $faq->faqRecord['id'], $lang);
// Create commented out HTML for microsummary
$allVisitsData = $faqvisits->getAllData();
$faqPopularity = '';
$maxVisits = 0;
$minVisits = 0;
$currVisits = 0;
$faqVisitsCount = count($allVisitsData);
$percentage = 0;
if ($faqVisitsCount > 0) {
    $percentage = 100 / $faqVisitsCount;
}
foreach ($allVisitsData as $_r) {
    if ($minVisits > $_r['visits']) {
        $minVisits = $_r['visits'];
    }
示例#24
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();
示例#25
0
/**
 * Get search data weither as array or resource
 *
 * @param string $searchterm
 * @param boolean $asResource
 * @param string $cat
 * @param boolean $allLanguages
 * 
 * @return array|resource
 */
function getSearchData($searchterm, $asResource = false, $cat = '%', $allLanguages = true)
{
    $db = PMF_Db::getInstance();
    $LANGCODE = PMF_Language::$language;
    $result = null;
    $num = 0;
    $cond = array(SQLPREFIX . "faqdata.active" => "'yes'");
    if ($cat != '%') {
        $cond = array_merge(array(SQLPREFIX . "faqcategoryrelations.category_id" => $cat), $cond);
    }
    if (!$allLanguages && !is_numeric($searchterm)) {
        $cond = array_merge(array(SQLPREFIX . "faqdata.lang" => "'" . $LANGCODE . "'"), $cond);
    }
    if (is_numeric($searchterm)) {
        // 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'), $searchterm, $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"), $searchterm, $cond);
    }
    if ($result) {
        $num = $db->numRows($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($searchterm) && $searchterm >= PMF_SOLUTION_ID_START_VALUE && $num > 0) {
        // Hack: 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_' . $searchterm . '.html');
        } else {
            header('Location: ' . PMF_Link::getSystemUri('/index.php') . '/index.php?solution_id=' . $searchterm);
        }
        exit;
    }
    if (0 == $num) {
        $keys = PMF_String::preg_split("/\\s+/", $searchterm);
        $numKeys = count($keys);
        $where = '';
        for ($i = 0; $i < $numKeys; $i++) {
            if (PMF_String::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] . "%')";
            if (is_numeric($cat)) {
                $where .= ' AND ' . SQLPREFIX . 'faqcategoryrelations.category_id = ' . $cat;
            }
            if (!$allLanguages) {
                $where .= ' AND ' . SQLPREFIX . "faqdata.lang = '" . $LANGCODE . "'";
            }
        }
        $where = " WHERE (" . $where . ") AND " . SQLPREFIX . "faqdata.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);
    }
    return $asResource ? $result : $db->fetchAll($result);
}