Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: winks/phpMyFAQ
base: f35a9b147e
...
head fork: winks/phpMyFAQ
compare: 260f1e0dbc
  • 6 commits
  • 15 files changed
  • 0 commit comments
  • 2 contributors
View
6 phpmyfaq/admin/ajax.config.php
@@ -87,8 +87,8 @@
if (PMF_Language::isASupportedLanguage($stopwordsLang)) {
$stopwordsList = PMF_Stopwords::getInstance($faqConfig)->getByLang($stopwordsLang);
- header('Content-Type: application/json');
- print json_encode($stopwordsList);
+ $payload = $stopwordsList;
+ PMF_Helper_Http::sendJsonWithHeaders($payload);
}
break;
@@ -99,7 +99,7 @@
$oStopwords->remove($stopwordId);
}
break;
-
+
case 'save_stop_word':
if (null != $stopword && PMF_Language::isASupportedLanguage($stopwordsLang)) {
$oStopwords = PMF_Stopwords::getInstance($faqConfig);
View
2  phpmyfaq/admin/record.add.php
@@ -93,7 +93,7 @@
$faq->createChangeEntry($record_id, $user->getUserId(), nl2br($changed), $recordData['lang']);
// Create the visit entry
- $visits = PMF_Visits::getInstance($db, $Language);
+ $visits = PMF_Visits::getInstance($faqConfig);
$visits->add($record_id);
// Insert the new category relations
View
4 phpmyfaq/admin/record.save.php
@@ -112,7 +112,7 @@
$faq->createChangeEntry($record_id, $user->getUserId(), nl2br($changed), $record_lang, $revision_id);
// Create the visit entry
- PMF_Visits::getInstance($db, $Language)->add($record_id);
+ PMF_Visits::getInstance($faqConfig)->add($record_id);
// save or update the FAQ record
if ($faq->isAlreadyTranslated($record_id, $record_lang)) {
@@ -162,7 +162,7 @@
if ($faqConfig->get('main.enableGoogleTranslation') === true && !empty($languages)) {
$linkverifier = new PMF_Linkverifier($faqConfig, $user->getLogin());
- $visits = PMF_Visits::getInstance($db, $Language);
+ $visits = PMF_Visits::getInstance($faqConfig);
$languages = PMF_Filter::filterInput(INPUT_POST, 'used_translated_languages', FILTER_SANITIZE_STRING);
$languages = explode(",", $languages);
View
2  phpmyfaq/admin/record.show.php
@@ -201,7 +201,7 @@
$old = 0;
$all_ids = $visits = array();
- foreach (PMF_Visits::getInstance($db, $Language)->getAllData() as $visit) {
+ foreach (PMF_Visits::getInstance($faqConfig)->getAllData() as $visit) {
$visits[$visit['id']] = $visit['lang'];
}
View
2  phpmyfaq/ajaxservice.php
@@ -303,7 +303,7 @@
}
// Activate visits
- $visits = PMF_Visits::getInstance($db, $Language);
+ $visits = PMF_Visits::getInstance($faqConfig);
$visits->add($recordId, $newData['lang']);
if ($autoActivate) {
View
2  phpmyfaq/artikel.php
@@ -58,7 +58,7 @@
$faqsession->userTracking('article_view', $faq->faqRecord['id']);
-$faqVisits = PMF_Visits::getInstance($db, $Language);
+$faqVisits = PMF_Visits::getInstance($faqConfig);
$faqVisits->logViews($faq->faqRecord['id']);
// Add Glossary entries
View
16 phpmyfaq/feed/category/rss.php
@@ -107,7 +107,7 @@
if (is_array($records)) {
foreach ($records as $item) {
-
+
$link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['record_link']);
if (PMF_RSS_USE_SEO) {
@@ -121,11 +121,11 @@
$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));
@@ -137,9 +137,11 @@
$rss->endElement();
$rssData = $rss->outputMemory();
-header('Content-Type: application/rss+xml');
-header('Content-Length: '.strlen($rssData));
+$headers = array(
+ 'Content-Type: application/rss+xml',
+ 'Content-Length: '.strlen($rssData)
+);
-print $rssData;
+PMF_Helper_Http::sendWithHeaders($rssData, $headers);
-$db->close();
+$db->close();
View
10 phpmyfaq/feed/latest/rss.php
@@ -126,7 +126,7 @@
$rss->startElement('description');
$rss->writeCdata($content);
$rss->endElement();
-
+
$rss->writeElement('link', $faqConfig->get('main.referenceURL') . $link);
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['datum'], true));
$rss->endElement();
@@ -137,9 +137,11 @@
$rss->endElement();
$rssData = $rss->outputMemory();
-header('Content-Type: application/rss+xml');
-header('Content-Length: '.strlen($rssData));
+$headers = array(
+ 'Content-Type: application/rss+xml',
+ 'Content-Length: '.strlen($rssData)
+);
-print $rssData;
+PMF_Helper_Http::sendWithHeaders($rssData, $headers);
$db->close();
View
10 phpmyfaq/feed/news/rss.php
@@ -84,7 +84,7 @@
$rss->startElement('description');
$rss->writeCdata($item['content']);
$rss->endElement();
-
+
$rss->writeElement('link', $faqConfig->get('main.referenceURL').$link);
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['date'], true));
$rss->endElement();
@@ -95,9 +95,11 @@
$rss->endElement();
$rssData = $rss->outputMemory();
-header('Content-Type: application/rss+xml');
-header('Content-Length: '.strlen($rssData));
+$headers = array(
+ 'Content-Type: application/rss+xml',
+ 'Content-Length: '.strlen($rssData)
+);
-print $rssData;
+PMF_Helper_Http::sendWithHeaders($rssData, $headers);
$db->close();
View
16 phpmyfaq/feed/openquestions/rss.php
@@ -71,14 +71,14 @@
$rss->startElement('item');
$rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['question'], ENT_COMPAT, 'UTF-8'), 8) .
- " (".$item['user'].")");
-
+ " (".$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['SCRIPT_NAME'])."?action=open#openq_".$item['id']);
- $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['date'], true));
+ $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['created'], true));
$rss->endElement();
}
}
@@ -88,9 +88,11 @@
$rss->endElement();
$rssData = $rss->outputMemory();
-header('Content-Type: application/rss+xml');
-header('Content-Length: '.strlen($rssData));
+$headers = array(
+ 'Content-Type: application/rss+xml',
+ 'Content-Length: '.strlen($rssData)
+);
-print $rssData;
+PMF_Helper_Http::sendWithHeaders($rssData, $headers);
$db->close();
View
12 phpmyfaq/feed/topten/rss.php
@@ -122,11 +122,11 @@
$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', $faqConfig->get('main.referenceURL').$link);
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['last_visit'], false));
$rss->endElement();
@@ -137,9 +137,11 @@
$rss->endElement();
$rssData = $rss->outputMemory();
-header('Content-Type: application/rss+xml');
-header('Content-Length: '.strlen($rssData));
+$headers = array(
+ 'Content-Type: application/rss+xml',
+ 'Content-Length: '.strlen($rssData)
+);
-print $rssData;
+PMF_Helper_Http::sendWithHeaders($rssData, $headers);
$db->close();
View
18 phpmyfaq/inc/Helper/Http.php
@@ -28,7 +28,7 @@
* @since 2009-09-13
* @copyright 2009 phpMyFAQ Team
*/
-class PMF_Helper_Http extends PMF_Helper
+class PMF_Helper_Http extends PMF_Helper
{
/**
* Instance
@@ -36,24 +36,24 @@ class PMF_Helper_Http extends PMF_Helper
* @var PMF_Helper_Http
*/
private static $instance = null;
-
+
/**
* Content type
*
* @var string
*/
private $contentType = '';
-
+
/**
* Constructor
*
- * @return
+ * @return
*/
private function __construct()
{
-
+
}
-
+
/**
* Returns the single instance
*
@@ -68,7 +68,7 @@ public static function getInstance()
}
return self::$instance;
}
-
+
/**
* __clone() Magic method to prevent cloning
*
@@ -76,7 +76,7 @@ public static function getInstance()
*/
private function __clone()
{
-
+
}
/**
@@ -106,7 +106,7 @@ public function addHeader()
header('Vary: Negotiate,Accept');
header('Content-type: ' . $this->contentType);
}
-
+
/**
* Returns a 404 header
*
View
16 phpmyfaq/inc/System.php
@@ -85,14 +85,14 @@ class PMF_System
* @var array
*/
private $_supportedDatabases = array(
- 'mysql' => array('5.3.2', 'MySQL 5.x (ext/mysql)'),
- 'mysqli' => array('5.3.2', 'MySQL 5.x (ext/mysqli)'),
- 'mysqli' => array('5.3.2', 'MariaDB 5.x (experimental)'),
- 'pgsql' => array('5.3.2', 'PostgreSQL 8.x'),
- 'sqlite' => array('5.3.2', 'SQLite'),
- 'sqlite3' => array('5.3.2', 'SQLite 3 (only PHP 5.3+, experimental)'),
- 'mssql' => array('5.3.2', 'MS SQL Server 2005 / 2008'),
- 'sqlsrv' => array('5.3.2', 'SQL Server Driver for PHP (experimental)')
+ 'mysql' => array(self::VERSION_MINIMUM_PHP, 'MySQL 5.x (ext/mysql)'),
+ 'mysqli' => array(self::VERSION_MINIMUM_PHP, 'MySQL 5.x (ext/mysqli)'),
+ 'mysqli' => array(self::VERSION_MINIMUM_PHP, 'MariaDB 5.x (experimental)'),
+ 'pgsql' => array(self::VERSION_MINIMUM_PHP, 'PostgreSQL 8.x'),
+ 'sqlite' => array(self::VERSION_MINIMUM_PHP, 'SQLite'),
+ 'sqlite3' => array(self::VERSION_MINIMUM_PHP, 'SQLite 3 (only PHP 5.3+, experimental)'),
+ 'mssql' => array(self::VERSION_MINIMUM_PHP, 'MS SQL Server 2005 / 2008'),
+ 'sqlsrv' => array(self::VERSION_MINIMUM_PHP, 'SQL Server Driver for PHP (experimental)')
);
/**
View
50 phpmyfaq/inc/Visits.php
@@ -2,7 +2,7 @@
/**
* Handles all the stuff for visits
*
- * PHP Version 5.2
+ * PHP Version 5.3
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
@@ -35,18 +35,9 @@
class PMF_Visits
{
/**
- * The database handle
- *
- * @var PMF_DB_Driver
- */
- private $db = null;
-
- /**
- * The user agent language
- *
- * @var string
+ * @var PMF_Configuration
*/
- private $language;
+ private $_config;
/**
* Instance
@@ -58,15 +49,13 @@ class PMF_Visits
/**
* Constructor
*
- * @param PMF_DB_Driver $database Database connection
- * @param PMF_Language $language Language object
+ * @param PMF_Configuration $config
*
* @return PMF_Visits
*/
- private function __construct(PMF_DB_Driver $database, PMF_Language $language)
+ private function __construct(PMF_Configuration $config)
{
- $this->db = $database;
- $this->language = $language;
+ $this->_config = $config;
}
@@ -75,16 +64,15 @@ private function __construct(PMF_DB_Driver $database, PMF_Language $language)
*
* @access static
*
- * @param PMF_DB_Driver $database Database connection
- * @param PMF_Language $language Language object
+ * @param PMF_Configuration $config
*
* @return PMF_Visits
*/
- public static function getInstance(PMF_DB_Driver $database, PMF_Language $language)
+ public static function getInstance(PMF_Configuration $config)
{
if (null == self::$instance) {
$className = __CLASS__;
- self::$instance = new $className($database, $language);
+ self::$instance = new $className($config);
}
return self::$instance;
}
@@ -119,12 +107,12 @@ public function logViews($id)
lang = '%s'",
SQLPREFIX,
$id,
- $this->language->getLanguage()
+ $this->_config->getLanguage()->getLanguage()
);
- $result = $this->db->query($query);
- if ($this->db->numRows($result)) {
- $row = $this->db->fetchObject($result);
+ $result = $this->_config->getDb()->query($query);
+ if ($this->_config->getDb()->numRows($result)) {
+ $row = $this->_config->getDb()->fetchObject($result);
$nVisits = $row->visits;
}
if ($nVisits == 0) {
@@ -153,11 +141,11 @@ public function add($id)
(%d, '%s', %d, %d)",
SQLPREFIX,
$id,
- $this->language->getLanguage(),
+ $this->_config->getLanguage()->getLanguage(),
1,
$_SERVER['REQUEST_TIME']
);
- $this->db->query($query);
+ $this->_config->getDb()->query($query);
return true;
}
@@ -185,9 +173,9 @@ private function update($id)
SQLPREFIX,
$_SERVER['REQUEST_TIME'],
$id,
- $this->language->getLanguage()
+ $this->_config->getLanguage()->getLanguage()
);
- $this->db->query($query);
+ $this->_config->getDb()->query($query);
return true;
}
@@ -210,9 +198,9 @@ public function getAllData()
visits DESC",
SQLPREFIX
);
- $result = $this->db->query($query);
+ $result = $this->_config->getDb()->query($query);
- while ($row = $this->db->fetchObject($result)) {
+ while ($row = $this->_config->getDb()->fetchObject($result)) {
$data[] = array(
'id' => $row->id,
'lang' => $row->lang,
View
28 phpmyfaq/pdf.php
@@ -9,7 +9,7 @@
* obtain one at http://mozilla.org/MPL/2.0/.
*
* @category phpMyFAQ
- * @package Frontend
+ * @package Frontend
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @author Peter Beauvain <pbeauvain@web.de>
* @author Olivier Plathey <olivier@fpdf.org>
@@ -18,7 +18,7 @@
* @copyright 2003-2012 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
- * @since 2003-02-12
+ * @since 2003-02-12
*/
define('IS_VALID_PHPMYFAQ', null);
@@ -107,9 +107,12 @@
$pdf = new PMF_Export_Pdf($faq, $category);
session_cache_limiter('private');
-header("Pragma: public");
-header("Expires: 0");
-header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+
+$headers = array(
+ "Pragma: public",
+ "Expires: 0",
+ "Cache-Control: must-revalidate, post-check=0, pre-check=0",
+);
if (true === $getAll) {
@@ -119,8 +122,9 @@
} else {
if (is_null($currentCategory) || is_null($id)) {
- header('HTTP/1.1 403 Forbidden');
- print 'Wrong HTTP GET parameters values.';
+ $headers[] = 'HTTP/1.1 403 Forbidden';
+ $payload = 'Wrong HTTP GET parameters values.';
+ PMF_Helper_Http::sendWithHeaders($payload, $headers);
exit();
}
@@ -132,11 +136,11 @@
}
if (preg_match("/MSIE/i", $_SERVER["HTTP_USER_AGENT"])) {
- header("Content-type: application/pdf");
- header("Content-Transfer-Encoding: binary");
- header("Content-Disposition: attachment; filename=" . $filename);
+ $headers[] = "Content-type: application/pdf";
+ $headers[] = "Content-Transfer-Encoding: binary";
+ $headers[] = "Content-Disposition: attachment; filename=" . $filename;
} else {
- header("Content-Type: application/pdf");
+ $headers[] = "Content-Type: application/pdf";
}
-print $pdfFile;
+PMF_Helper_Http::sendWithHeaders($pdfFile, $headers);

No commit comments for this range

Something went wrong with that request. Please try again.