/**
  * This function generates a list with the mosted voted or most visited records
  *
  * @param  string $type Type definition visits/voted
  * @access public
  * @since  2009-11-03
  * @author Max Köhler <*****@*****.**>
  * @return array
  */
 public function getTopTen($type = 'visits')
 {
     if ('visits' == $type) {
         $result = $this->getTopTenData(PMF_NUMBER_RECORDS_TOPTEN, 0, $this->_config->getLanguage()->getLanguage());
     } else {
         $result = $this->getTopVotedData(PMF_NUMBER_RECORDS_TOPTEN, 0, $this->_config->getLanguage()->getLanguage());
     }
     $output = array();
     if (count($result) > 0) {
         foreach ($result as $row) {
             if ('visits' == $type) {
                 $output['title'][] = PMF_Utils::makeShorterText($row['thema'], 8);
                 $output['url'][] = $row['url'];
                 $output['visits'][] = $this->plr->GetMsg('plmsgViews', $row['visits']);
             } else {
                 $output['title'][] = PMF_Utils::makeShorterText($row['thema'], 8);
                 $output['url'][] = $row['url'];
                 $output['voted'][] = sprintf('%s %s 5 - %s', round($row['avg'], 2), $this->pmf_lang['msgVoteFrom'], $this->plr->GetMsg('plmsgVotes', $row['user']));
             }
         }
     } else {
         $output['error'] = $this->pmf_lang['err_noTopTen'];
     }
     return $output;
 }
Exemple #2
0
 /**
  * Calculates the rating of the user votings
  *
  * @param   integer    $id
  * @return  string
  * @access  public
  * @since   2002-08-29
  * @author  Thorsten Rinne <*****@*****.**>
  */
 function getVotingResult($id)
 {
     $query = sprintf('SELECT
             (vote/usr) as voting, usr
         FROM
             %sfaqvoting
         WHERE
             artikel = %d', SQLPREFIX, $id);
     $result = $this->db->query($query);
     if ($this->db->num_rows($result) > 0) {
         $row = $this->db->fetch_object($result);
         return sprintf(' %s %s 5 (' . $this->plr->GetMsg('plmsgVotes', $row->usr) . ')', round($row->voting, 2), $this->pmf_lang['msgVoteFrom']);
     } else {
         return sprintf(' 0 %s 5 (' . $this->plr->GetMsg('plmsgVotes', 0) . ')', $this->pmf_lang['msgVoteFrom']);
     }
 }
Exemple #3
0
 /**
  * Calculates the rating of the user votings
  *
  * @param integer $id
  *
  * @return  string
  */
 function getVotingResult($id)
 {
     $query = sprintf('
         SELECT
             (vote/usr) as voting, usr
         FROM
             %sfaqvoting
         WHERE
             artikel = %d', PMF_Db::getTablePrefix(), $id);
     $result = $this->_config->getDb()->query($query);
     if ($this->_config->getDb()->numRows($result) > 0) {
         $row = $this->_config->getDb()->fetchObject($result);
         return sprintf(' %s (' . $this->plr->GetMsg('plmsgVotes', $row->usr) . ')', round($row->voting, 2));
     } else {
         return '0 (' . $this->plr->GetMsg('plmsgVotes', 0) . ')';
     }
 }
Exemple #4
0
// Get language (default: english)
//
$Language = new PMF_Language();
$LANGCODE = $Language->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
// Preload English strings
require_once 'lang/language_en.php';
$showCaptcha = PMF_Filter::filterInput(INPUT_GET, 'gen', FILTER_SANITIZE_STRING);
if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE) && is_null($showCaptcha)) {
    // Overwrite English strings with the ones we have in the current language,
    // but don't include UTF-8 encoded files, these will break the captcha images
    require_once 'lang/language_' . $LANGCODE . '.php';
} else {
    $LANGCODE = 'en';
}
//Load plurals support for selected language
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($PMF_LANG["metaCharset"], $LANGCODE);
/**
 * Initialize attachment factory
 */
PMF_Attachment_Factory::init($faqconfig->get('main.attachmentsStorageType'), $faqconfig->get('main.defaultAttachmentEncKey'), $faqconfig->get('main.enableAttachmentEncryption'));
//
// Get user action
//
$action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING, 'main');
//
// Authenticate current user
//
Exemple #5
0
session_start();
$action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
$ajaxlang = PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
$Language = new PMF_Language();
$languageCode = $Language->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
require_once 'lang/language_en.php';
if (PMF_Language::isASupportedLanguage($ajaxlang)) {
    $languageCode = trim($ajaxlang);
    require_once 'lang/language_' . $languageCode . '.php';
} else {
    $languageCode = 'en';
    require_once 'lang/language_en.php';
}
//Load plurals support for selected language
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($languageCode);
// Check captcha
$captcha = new PMF_Captcha($db, $Language);
//$captcha->setSessionId($sids);
// Send headers
$http = PMF_Helper_Http::getInstance();
$http->setContentType('application/json');
$http->addHeader();
// Set session
$faqsession = new PMF_Session($db, $Language);
$network = new PMF_Network();
if (!$network->checkIp($_SERVER['REMOTE_ADDR'])) {
Exemple #6
0
// Preload English strings
require_once 'lang/language_en.php';
$faqConfig->setLanguage($Language);
$showCaptcha = PMF_Filter::filterInput(INPUT_GET, 'gen', FILTER_SANITIZE_STRING);
if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE) && is_null($showCaptcha)) {
    // Overwrite English strings with the ones we have in the current language,
    // but don't include UTF-8 encoded files, these will break the captcha images
    if (!file_exists('lang/language_' . $LANGCODE . '.php')) {
        $LANGCODE = 'en';
    }
    require_once 'lang/language_' . $LANGCODE . '.php';
} else {
    $LANGCODE = 'en';
}
//Load plurals support for selected language
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
/**
 * Initialize attachment factory
 */
PMF_Attachment_Factory::init($faqConfig->get('records.attachmentsStorageType'), $faqConfig->get('records.defaultAttachmentEncKey'), $faqConfig->get('records.enableAttachmentEncryption'));
//
// Get user action
//
$action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING, 'main');
//
// Authenticate current user
//
Exemple #7
0
 /**
  * This function generates the Top Ten with the mosted viewed records
  *
  * @return array
  * @author Thorsten Rinne <*****@*****.**>
  * @since  2002-05-07
  */
 public function getTopTen()
 {
     $result = $this->getTopTenData(PMF_NUMBER_RECORDS_TOPTEN, 0, $this->language);
     $output = array();
     if (count($result) > 0) {
         foreach ($result as $row) {
             $shortTitle = PMF_Utils::makeShorterText(PMF_htmlentities($row['thema'], ENT_QUOTES, $this->pmf_lang['metaCharset']), 8);
             $output['title'][] = $shortTitle;
             $output['url'][] = $row['url'];
             $output['visits'][] = $this->plr->GetMsg('plmsgViews', $row['visits']);
         }
     } else {
         $output['error'] = $this->pmf_lang['err_noTopTen'];
     }
     return $output;
 }
Exemple #8
0
$LANGCODE = $Language->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
// Preload English strings
require_once 'lang/language_en.php';
$showCaptcha = PMF_Filter::filterInput(INPUT_GET, 'gen', FILTER_SANITIZE_STRING);
if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE) && is_null($showCaptcha)) {
    // Overwrite English strings with the ones we have in the current language,
    // but don't include UTF-8 encoded files, these will break the captcha images
    if (!file_exists('lang/language_' . $LANGCODE . '.php')) {
        $LANGCODE = 'en';
    }
    require_once 'lang/language_' . $LANGCODE . '.php';
} else {
    $LANGCODE = 'en';
}
//Load plurals support for selected language
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
/**
 * Initialize attachment factory
 */
PMF_Attachment_Factory::init($faqconfig->get('records.attachmentsStorageType'), $faqconfig->get('records.defaultAttachmentEncKey'), $faqconfig->get('records.enableAttachmentEncryption'));
//
// Get user action
//
$action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING, 'main');
//
// Authenticate current user
//