示例#1
0
if ($user->perm->checkRight($user->getUserId(), 'editbt')) {
    $editThisEntry = sprintf('<a href="%sadmin/index.php?action=editentry&amp;id=%d&amp;lang=%s">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $recordId, $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 (-1 === $user->getUserId() && !$faqConfig->get('records.allowCommentsForGuests') || $faq->faqRecord['active'] === 'no' || 'n' == $faq->faqRecord['comment'] || $expired) {
    $commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
    $commentMessage = sprintf("%s<a href=\"javascript:void(0);\" onclick=\"javascript:\$('#commentForm').show();\">%s</a>", $PMF_LANG['msgYouCan'], $PMF_LANG['msgWriteComment']);
}
$translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&amp;cat=%s&amp;id=%d&amp;srclang=%s', $sids, $currentCategory, $recordId, $lang);
if (!empty($switchLanguage)) {
    $tpl->parseBlock('writeContent', 'switchLanguage', array('msgChangeLanguage' => $PMF_LANG['msgLangaugeSubmit']));
}
if ($user->perm->checkRight($user->getUserId(), 'addtranslation')) {
    $tpl->parseBlock('writeContent', 'addTranslation', array('msgTranslate' => $PMF_LANG['msgTranslate']));
}
if ('-' !== $faqTagging->getAllLinkTagsById($recordId)) {
    $tpl->parseBlock('writeContent', 'tagsAvailable', array('renderTags' => $PMF_LANG['msg_tags'] . ': ' . $faqTagging->getAllLinkTagsById($recordId)));
}
if ('' !== $htmlAllCategories) {
    $tpl->parseBlock('writeContent', 'relatedCategories', array('renderRelatedCategoriesHeader' => $PMF_LANG['msgArticleCategories'], 'renderRelatedCategories' => $htmlAllCategories));
}
if ('' !== $relatedFaqs) {
    $tpl->parseBlock('writeContent', 'relatedFaqs', array('renderRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'], 'renderRelatedArticles' => $relatedFaqs));
}
$date = new PMF_Date($faqConfig);
$captchaHelper = new PMF_Helper_Captcha($faqConfig);
$tpl->parse('writeContent', array('baseHref' => $faqSystem->getSystemUri($faqConfig), 'writeRubrik' => $categoryName, 'solution_id' => $faq->faqRecord['solution_id'], 'solution_id_link' => PMF_Link::getSystemRelativeUri() . '?solution_id=' . $faq->faqRecord['solution_id'], 'writeThema' => $question, 'writeContent' => $answer, 'writeDateMsg' => '<dt>' . $PMF_LANG['msgLastUpdateArticle'] . '</dt><dd>' . $date->format($faq->faqRecord['date']) . '</dd>', 'writeRevision' => '<dt>' . $PMF_LANG['ad_entry_revision'] . ':</dt><dd>1.' . $faq->faqRecord['revision_id'] . '</dd>', 'writeAuthor' => '<dt>' . $PMF_LANG['msgAuthor'] . ':</dt><dd>' . $faq->faqRecord['author'] . '</dd>', 'editThisEntry' => $editThisEntry, 'translationUrl' => $translationUrl, 'languageSelection' => PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation'), 'msgTranslateSubmit' => $PMF_LANG['msgTranslateSubmit'], 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $recordId, 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'renderVotingStars' => '', 'printVotings' => $faqRating->getVotingResult($recordId), 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'id' => $recordId, 'lang' => $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' => $captchaHelper->renderCaptcha($captcha, 'writecomment', $PMF_LANG['msgCaptcha'], $auth), 'writeComments' => $faqComment->getComments($recordId, PMF_Comment::COMMENT_TYPE_FAQ), 'msg_about_faq' => $PMF_LANG['msg_about_faq']));
$tpl->merge('writeContent', 'index');
示例#2
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')";
示例#3
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;
 }
示例#4
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;
 }
示例#5
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>';
 }
示例#6
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);
     }
 }
 /**
  * @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;
 }
示例#8
0
/**
 * There are meanwhile over 600 language
 * vars and we won't to show them all
 * at once, so let's paginate.
 */
$itemsPerPage = 32;
if (!isset($_SESSION['trans'])) {
    /**
     * English is our exemplary language
     */
    $_SESSION['trans']['leftVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_en.php");
    $_SESSION['trans']['rightVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_{$translateLang}.php");
}
$leftVarsOnly = array_slice($_SESSION['trans']['leftVarsOnly'], ($page - 1) * $itemsPerPage, $itemsPerPage);
$rightVarsOnly =& $_SESSION['trans']['rightVarsOnly'];
$options = array('baseUrl' => PMF_Link::getSystemRelativeUri('index.php') . '?' . str_replace('&', '&amp;', $_SERVER['QUERY_STRING']), 'total' => count($_SESSION['trans']['leftVarsOnly']), 'perPage' => $itemsPerPage, 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
$pagination = new PMF_Pagination($options);
$pageBar = $pagination->render();
/**
 * These keys always exist as they are defined when creating translation.
 * We use these values to add the correct number of input boxes.
 * Left column will always have 2 boxes, right - 1 to 6+ boxes.
 */
$leftNPlurals = (int) $_SESSION['trans']['leftVarsOnly']['PMF_LANG[nplurals]'];
$rightNPlurals = (int) $rightVarsOnly['PMF_LANG[nplurals]'];
printf('<header><h2>%s</h2></header>', $PMF_LANG['ad_menu_translations']);
printf('<p style="color: red;">%s</p>', $PMF_LANG['msgTransToolNoteFileSaving']);
$NPluralsErrorReported = false;
?>
        <form id="transDiffForm">
        <table class="list" style="width: 100%">
示例#9
0
文件: Faq.php 项目: noon/phpMyFAQ
 /**
  * Returns the sticky records with URL and Title
  * 
  * @return array
  */
 private function getStickyRecordsData()
 {
     global $sids;
     if ($this->groupSupport) {
         $permPart = sprintf("AND\n                ( fdg.group_id IN (%s)\n            OR\n                (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
     } else {
         $permPart = sprintf("AND\n                ( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
     }
     $now = date('YmdHis');
     $query = sprintf("\n            SELECT\n                fd.id AS id,\n                fd.lang AS lang,\n                fd.thema AS thema,\n                fcr.category_id AS category_id\n            FROM\n                %sfaqdata fd\n            LEFT JOIN\n                %sfaqcategoryrelations fcr\n            ON\n                fd.id = fcr.record_id\n            AND\n                fd.lang = fcr.record_lang\n            LEFT JOIN\n                %sfaqdata_group AS fdg\n            ON\n                fd.id = fdg.record_id\n            LEFT JOIN\n                %sfaqdata_user AS fdu\n            ON\n                fd.id = fdu.record_id\n            WHERE\n                fd.lang = '%s'\n            AND \n                fd.date_start <= '%s'\n            AND \n                fd.date_end   >= '%s'\n            AND \n                fd.active = 'yes'\n            AND \n                fd.sticky = 1\n            %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $this->language, $now, $now, $permPart);
     $result = $this->db->query($query);
     $sticky = array();
     $data = array();
     $oldId = 0;
     while ($row = $this->db->fetch_object($result)) {
         if ($oldId != $row->id) {
             $data['thema'] = $row->thema;
             $title = $row->thema;
             $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->tooltip = $title;
             $data['url'] = $oLink->toString();
             $sticky[] = $data;
         }
         $oldId = $row->id;
     }
     return $sticky;
 }
示例#10
0
/**
 * There are meanwhile over 600 language
 * vars and we won't to show them all
 * at once, so let's paginate.
 */
$itemsPerPage = 32;
if (!isset($_SESSION['trans'])) {
    /**
     * English is our exemplary language
     */
    $_SESSION['trans']['leftVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_en.php");
    $_SESSION['trans']['rightVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_{$translateLang}.php");
}
$leftVarsOnly = array_slice($_SESSION['trans']['leftVarsOnly'], ($page - 1) * $itemsPerPage, $itemsPerPage);
$rightVarsOnly =& $_SESSION['trans']['rightVarsOnly'];
$options = array('baseUrl' => PMF_Link::getSystemRelativeUri('index.php') . '?' . str_replace('&', '&amp;', $_SERVER['QUERY_STRING']), 'total' => count($_SESSION['trans']['leftVarsOnly']), 'perPage' => $itemsPerPage);
$pagination = new PMF_Pagination($faqConfig, $options);
$pageBar = $pagination->render();
/**
 * These keys always exist as they are defined when creating translation.
 * We use these values to add the correct number of input boxes.
 * Left column will always have 2 boxes, right - 1 to 6+ boxes.
 */
$leftNPlurals = (int) $_SESSION['trans']['leftVarsOnly']['PMF_LANG[nplurals]'];
$rightNPlurals = (int) $rightVarsOnly['PMF_LANG[nplurals]'];
printf('<header class="row"><div class="col-lg-12"><h2 class="page-header"><i class="fa fa-wrench"></i> %s</h2></div></header>', $PMF_LANG['ad_menu_translations']);
$NPluralsErrorReported = false;
?>
        <div class="row">
            <div class="col-lg-12">
                <p class="alert alert-info">
 /**
  * Returns the sticky records with URL and Title
  *
  * @return array
  */
 private function getStickyRecordsData()
 {
     global $sids;
     $now = date('YmdHis');
     $query = sprintf("\n            SELECT\n                fd.id AS id,\n                fd.lang AS lang,\n                fd.thema AS thema,\n                fcr.category_id AS category_id\n            FROM\n                %sfaqdata fd\n            LEFT JOIN\n                %sfaqcategoryrelations fcr\n            ON\n                fd.id = fcr.record_id\n            AND\n                fd.lang = fcr.record_lang\n            LEFT JOIN\n                %sfaqdata_group AS fdg\n            ON\n                fd.id = fdg.record_id\n            LEFT JOIN\n                %sfaqdata_user AS fdu\n            ON\n                fd.id = fdu.record_id\n            WHERE\n                fd.lang = '%s'\n            AND \n                fd.date_start <= '%s'\n            AND \n                fd.date_end   >= '%s'\n            AND \n                fd.active = 'yes'\n            AND \n                fd.sticky = 1\n            %s", PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), $this->_config->getLanguage()->getLanguage(), $now, $now, $this->queryPermission($this->groupSupport));
     $result = $this->_config->getDb()->query($query);
     $sticky = array();
     $data = array();
     $oldId = 0;
     while ($row = $this->_config->getDb()->fetchObject($result)) {
         if ($oldId != $row->id) {
             $data['thema'] = $row->thema;
             $title = $row->thema;
             $url = sprintf('%s?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', PMF_Link::getSystemRelativeUri(), $sids, $row->category_id, $row->id, $row->lang);
             $oLink = new PMF_Link($url, $this->_config);
             $oLink->itemTitle = $row->thema;
             $oLink->tooltip = $title;
             $data['url'] = $oLink->toString();
             $sticky[] = $data;
         }
         $oldId = $row->id;
     }
     return $sticky;
 }
示例#12
0
        $htmlAllCategories .= sprintf("<li>%s</li>\n", $path);
    }
    $htmlAllCategories .= '            </ul>';
    $htmlAllCategories .= '    </div>';
}
// Related FAQs
$faqSearchResult->reviewResultset($faqRelation->getAllRelatedById($faq->faqRecord['id'], $faq->faqRecord['title'], $faq->faqRecord['keywords']));
$relatedFaqs = PMF_Helper_Search::getInstance()->renderRelatedFaqs($faqSearchResult, $faq->faqRecord['id']);
// Show link to edit the faq?
$editThisEntry = '';
if (isset($permission['editbt']) && $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:\$('#commentForm').show();\">%s</a>", $PMF_LANG['msgYouCan'], $PMF_LANG['msgWriteComment']);
}
$translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&amp;cat=%s&amp;id=%d&amp;srclang=%s', $sids, $currentCategory, $faq->faqRecord['id'], $lang);
if (!empty($switchLanguage)) {
    $tpl->processBlock('writeContent', 'switchLanguage', array('msgChangeLanguage' => $PMF_LANG['msgLangaugeSubmit']));
}
if (isset($permission['addtranslation']) && $permission['addtranslation']) {
    $tpl->processBlock('writeContent', 'addTranslation', array('msgTranslate' => $PMF_LANG['msgTranslate']));
}
// Set the template variables
$tpl->processTemplate('writeContent', array('writeRubrik' => $categoryName, 'solution_id' => $faq->faqRecord['solution_id'], 'writeThema' => $question, 'writeArticleCategoryHeader' => $PMF_LANG['msgArticleCategories'], 'writeArticleCategories' => $htmlAllCategories, 'writeContent' => $answer, 'writeTagHeader' => $PMF_LANG['msg_tags'] . ': ', 'writeArticleTags' => $faqTagging->getAllLinkTagsById($faq->faqRecord['id']), 'writeRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'] . ': ', 'writeRelatedArticles' => $relatedFaqs, 'writeDateMsg' => $PMF_LANG['msgLastUpdateArticle'] . PMF_Date::format($faq->faqRecord['date']), 'writeRevision' => $PMF_LANG['ad_entry_revision'] . ': 1.' . $faq->faqRecord['revision_id'], 'writeAuthor' => $PMF_LANG['msgAuthor'] . ': ' . $faq->faqRecord['author'], 'editThisEntry' => $editThisEntry, 'translationUrl' => $translationUrl, 'languageSelection' => PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation'), 'msgTranslateSubmit' => $PMF_LANG['msgTranslateSubmit'], 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $faq->faqRecord['id'], 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'printVotings' => $faqRating->getVotingResult($recordId), 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'id' => $faq->faqRecord['id'], 'lang' => $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()->renderCaptcha($captcha, 'writecomment', $PMF_LANG['msgCaptcha']), 'writeComments' => $faqComment->getComments($faq->faqRecord['id'], PMF_Comment::COMMENT_TYPE_FAQ), 'msg_about_faq' => $PMF_LANG['msg_about_faq']));
$tpl->includeTemplate('writeContent', 'index');
示例#13
0
 /**
  * Renders the result page for the main search page
  * 
  * @param PMF_Search_Resultset $resultSet   PMF_Search_Resultset object
  * @param integer              $currentPage Current page number
  * 
  * @return string
  */
 public function renderSearchResult(PMF_Search_Resultset $resultSet, $currentPage)
 {
     $html = '';
     $confPerPage = PMF_Configuration::getInstance()->get('main.numberOfRecordsPerPage');
     $numOfResults = $resultSet->getNumberOfResults();
     $totalPages = ceil($numOfResults / $confPerPage);
     $lastPage = $currentPage * $confPerPage;
     $firstPage = $lastPage - $confPerPage;
     if ($lastPage > $numOfResults) {
         $lastPage = $numOfResults;
     }
     if (0 < $numOfResults) {
         $html .= sprintf("<p>%s</p>\n", $this->plurals->GetMsg('plmsgSearchAmount', $numOfResults));
         if (1 < $totalPages) {
             $html .= sprintf("<p><strong>%s%d %s %s</strong></p>\n", $this->translation['msgPage'], $currentPage, $this->translation['msgVoteFrom'], $this->plurals->GetMsg('plmsgPagesTotal', $totalPages));
         }
         $html .= "<ul class=\"phpmyfaq_ul\">\n";
         foreach ($resultSet->getResultset() as $result) {
             $categoryName = $this->categoryLayout->renderBreadcrumb(array($result->category_id));
             $question = PMF_Utils::chopString($result->question, 15);
             $answerPreview = PMF_Utils::chopString(strip_tags($result->answer), 25);
             $searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $this->searchterm);
             $searchterm = preg_quote($searchterm, '/');
             $searchItems = explode(' ', $searchterm);
             if (PMF_String::strlen($searchItems[0]) > 1) {
                 foreach ($searchItems as $item) {
                     if (PMF_String::strlen($item) > 2) {
                         $question = PMF_Utils::setHighlightedString($question, $item);
                         $answerPreview = PMF_Utils::setHighlightedString($answerPreview, $item);
                     }
                 }
             }
             // Build the link to the faq record
             $currentUrl = sprintf('%s?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s&amp;highlight=%s', PMF_Link::getSystemRelativeUri(), $this->sessionId, $result->category_id, $result->id, $result->lang, urlencode($searchterm));
             $oLink = new PMF_Link($currentUrl);
             $oLink->text = $oLink->itemTitle = $oLink->tooltip = $result->question;
             $html .= sprintf("<li><strong>%s</strong>: %s<br /><div class=\"searchpreview\"><strong>%s</strong> %s...</div><br /></li>\n", $categoryName, $oLink->toHtmlAnchor(), $this->translation['msgSearchContent'], $answerPreview);
         }
         $html .= "</ul>\n";
         if (1 > $totalPages) {
             $html .= $this->pagination->render();
         }
     } else {
         $html = $this->translation['err_noArticles'];
     }
     return $html;
 }
示例#14
0
 /**
  * Returns all relevant articles for a FAQ record with the same language
  *
  * @param integer $record_id FAQ ID
  * @param string  $thema     FAQ title
  * 
  * @return string
  */
 public function getAllRelatedById($record_id, $article_name, $keywords)
 {
     global $sids;
     $relevantslisting = '';
     $begriffe = str_replace('-', ' ', $article_name) . $keywords;
     $search = PMF_Search_Factory::create($this->language, array('database' => PMF_Db::getType()));
     $i = $last_id = 0;
     $search->setDatabaseHandle($this->db)->setTable(SQLPREFIX . 'faqdata AS fd')->setResultColumns(array('fd.id AS id', 'fd.lang AS lang', 'fcr.category_id AS category_id', 'fd.thema AS thema', 'fd.content AS content'))->setJoinedTable(SQLPREFIX . 'faqcategoryrelations AS fcr')->setJoinedColumns(array('fd.id = fcr.record_id', 'fd.lang = fcr.record_lang'))->setConditions(array('fd.active' => "'yes'", 'fd.lang' => "'" . $this->language->getLanguage() . "'"))->setMatchingColumns(array('fd.thema', 'fd.content', 'fd.keywords'));
     $result = $search->search($begriffe);
     while (($row = $this->db->fetchObject($result)) && $i < PMF_Configuration::getInstance()->get('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;
 }
示例#15
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) {
示例#16
0
 */
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);
$page = 1 > $page ? 1 : $page;
$fa = new PMF_Attachment_Collection($faqConfig);
$itemsPerPage = 32;
$allCrumbs = $fa->getBreadcrumbs();
$crumbs = array_slice($allCrumbs, ($page - 1) * $itemsPerPage, $itemsPerPage);
$pagination = new PMF_Pagination($faqConfig, array('baseUrl' => PMF_Link::getSystemRelativeUri() . '?' . str_replace('&', '&amp;', $_SERVER['QUERY_STRING']), 'total' => count($allCrumbs), 'perPage' => $itemsPerPage));
?>
        <header class="row">
            <div class="col-lg-12">
                <h2 class="page-header">
                    <i class="fa fa-file"></i> <?php 
echo $PMF_LANG['ad_menu_attachment_admin'];
?>
                </h2>
            </div>
        </header>

        <div class="row">
            <div class="col-lg-12">
                <table class="table table-striped">
                    <thead>
             }
             $url = sprintf('%s?action=artikel&cat=%d&id=%d&artlang=%s', $faqConfig->get('main.referenceURL'), $categories['rubrik'][0], $recordId, $recordLang);
             $oLink = new PMF_Link($url, $faqConfig);
             // notify the user who added the question
             $notifyEmail = PMF_Filter::filterInput(INPUT_POST, 'notifyEmail', FILTER_SANITIZE_EMAIL);
             $notifyUser = PMF_Filter::filterInput(INPUT_POST, 'notifyUser', FILTER_SANITIZE_STRING);
             $notification = new PMF_Notification($faqConfig);
             $notification->sendOpenQuestionAnswered($notifyEmail, $notifyUser, $oLink->toString());
         }
         // Call Link Verification
         PMF_Helper_Linkverifier::linkOndemandJavascript($recordId, $recordData['lang']);
         // Callback to Twitter if enabled
         if ($faqConfig->get('socialnetworks.enableTwitterSupport')) {
             require '../inc/libs/twitteroauth/twitteroauth.php';
             $connection = new TwitterOAuth($faqConfig->get('socialnetworks.twitterConsumerKey'), $faqConfig->get('socialnetworks.twitterConsumerSecret'), $faqConfig->get('socialnetworks.twitterAccessTokenKey'), $faqConfig->get('socialnetworks.twitterAccessTokenSecret'));
             $link = PMF_Link::getSystemRelativeUri() . sprintf('?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $category, $recordId, $recordLang);
             $link = $faqConfig->get('main.referenceURL') . str_replace('/admin/', '/', $link);
             $oLink = new PMF_Link($link, $faqConfig);
             $oLink->itemTitle = $question;
             $link = $oLink->toString();
             if ($connection) {
                 $twitter = new PMF_Services_Twitter($connection);
                 $twitter->addPost($question, $tags, $link);
             }
         }
         // All the other translations
         $languages = PMF_Filter::filterInput(INPUT_POST, 'used_translated_languages', FILTER_SANITIZE_STRING);
         ?>
 <script type="text/javascript">
 $(document).ready(function(){
     setTimeout(function() {
示例#18
0
文件: Tags.php 项目: nosch/phpMyFAQ
 /**
  * Returns the HTML for the Tags Cloud
  *
  * @return string
  */
 public function printHTMLTagsCloud()
 {
     global $sids;
     $html = '';
     $tags = array();
     // Limit the result set (see: PMF_TAGS_CLOUD_RESULT_SET_SIZE)
     // for avoiding an 'heavy' load during the evaluation
     // of the number of records for each tag
     $tagList = $this->getAllTags('', true);
     foreach ($tagList as $tagId => $tagName) {
         $totFaqByTag = count($this->getRecordsByTagName($tagName));
         if ($totFaqByTag > 0) {
             $tags[$tagName]['id'] = $tagId;
             $tags[$tagName]['name'] = $tagName;
             $tags[$tagName]['count'] = $totFaqByTag;
         }
     }
     $min = 0;
     $max = 0;
     foreach ($tags as $tag) {
         if ($min > $tag['count']) {
             $min = $tag['count'];
         }
         if ($max < $tag['count']) {
             $max = $tag['count'];
         }
     }
     $CSSRelevanceLevels = 5;
     $CSSRelevanceMinLevel = 1;
     $CSSRelevanceMaxLevel = $CSSRelevanceLevels - $CSSRelevanceMinLevel;
     $CSSRelevanceLevel = 3;
     $html = '<div class="tagscloud">';
     $i = 0;
     foreach ($tags as $tag) {
         $i++;
         if ($max - $min > 0) {
             $CSSRelevanceLevel = (int) ($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel * ($tag['count'] - $min) / ($max - $min));
         }
         $class = 'relevance' . $CSSRelevanceLevel;
         $html .= '<span class="' . $class . '">';
         $title = PMF_htmlentities($tag['name'] . ' (' . $tag['count'] . ')', ENT_QUOTES, 'utf-8');
         $url = sprintf($sids . 'action=search&amp;tagging_id=%d', $tag['id']);
         $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
         $oLink->itemTitle = $tag['name'];
         $oLink->text = $tag['name'];
         $oLink->tooltip = $title;
         $html .= $oLink->toHtmlAnchor();
         $html .= (count($tags) == $i ? '' : ' ') . '</span>';
     }
     $html .= '</div>';
     return $html;
 }
示例#19
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;
 }
示例#20
0
 * @copyright 2003-2011 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2010-12-13
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$page = 1 > $page ? 1 : $page;
$fa = new PMF_Attachment_Collection();
$itemsPerPage = 32;
$allCrumbs = $fa->getBreadcrumbs();
$crumbs = array_slice($allCrumbs, ($page - 1) * $itemsPerPage, $itemsPerPage);
$pagination = new PMF_Pagination(array('baseUrl' => PMF_Link::getSystemRelativeUri() . '?' . str_replace('&', '&amp;', $_SERVER['QUERY_STRING']), 'total' => count($allCrumbs), 'perPage' => $itemsPerPage, 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>'));
printf('<header><h2>%s</h2></header>', $PMF_LANG['ad_menu_attachment_admin']);
?>
        <table class="list" style="width: 100%;">
            <thead>
                <tr>
                    <th><?php 
print $PMF_LANG['msgAttachmentsFilename'];
?>
</th>
                    <th><?php 
print $PMF_LANG['msgTransToolLanguage'];
?>
</th>
                    <th><?php 
print $PMF_LANG['msgAttachmentsFilesize'];
示例#21
0
文件: show.php 项目: noon/phpMyFAQ
 */
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');
}
示例#22
0
 /**
  * Returns all records from the current first letter
  *
  * @param  string $letter Letter
  * @return array
  * @since  2007-03-30
  * @author Thorsten Rinne <*****@*****.**>
  */
 public function getRecordsFromLetter($letter = 'A')
 {
     global $sids, $PMF_LANG;
     if ($this->groupSupport) {
         $permPart = sprintf("( fdg.group_id IN (%s)\n            OR\n                (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
     } else {
         $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
     }
     $letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1)));
     $writeMap = '';
     switch ($this->type) {
         case 'db2':
         case 'sqlite':
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTR(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
         default:
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTRING(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
     }
     $result = $this->db->query($query);
     $oldId = 0;
     while ($row = $this->db->fetch_object($result)) {
         if ($oldId != $row->id) {
             $title = PMF_String::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8');
             $url = sprintf('%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
             $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
             $oLink->itemTitle = $row->thema;
             $oLink->text = $title;
             $oLink->tooltip = $title;
             $writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n";
             $writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25) . " ...</li>\n";
         }
         $oldId = $row->id;
     }
     $writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>';
     return $writeMap;
 }
示例#23
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'];
    ?>
 * @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');
示例#25
0
文件: search.php 项目: atlcurling/tkt
    // 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);
}
示例#26
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());
 }
示例#27
0
        $minVisits = $_r['visits'];
    }
    if ($maxVisits < $_r['visits']) {
        $maxVisits = $_r['visits'];
    }
    if ($record_id == $_r['id'] && $lang == $_r['lang']) {
        $currVisits = $_r['visits'];
    }
}
if ($maxVisits - $minVisits > 0) {
    $percentage = 100 * ($currVisits - $minVisits) / ($maxVisits - $minVisits);
}
$faqPopularity = $currVisits . '/' . (int) $percentage . '%';
$translationForm = '';
if (count($arrLanguage) < count(PMF_Language::getAvailableLanguages())) {
    $translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&amp;cat=%s&amp;id=%d&amp;srclang=%s', $sids, $currentCategory, $record_id, $lang);
    $translationForm = '
        <form action="' . $translationUrl . '" method="post" style="display: inline;">
            <img src="images/translate.gif" alt="' . $PMF_LANG['msgTranslate'] . '" title="' . $PMF_LANG['msgTranslate'] . '" width="16" height="16" border="0" /> ' . $PMF_LANG['msgTranslate'] . ' ' . PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation') . ' <input class="submit" type="submit" name="submit" value="' . $PMF_LANG['msgTranslateSubmit'] . '" />
        </form>';
}
// Get rating
$recordRating = $faqrating->fetch($record_id);
if (!is_null($recordRating)) {
    $printVoting = sprintf(' %s (%s)', round($recordRating->sumVotings / $recordRating->numVotings, 2), $plr->GetMsg('plmsgVotes', $recordRating->numVotings));
} else {
    $printVoting = sprintf('0 (%s)', $plr->GetMsg('plmsgVotes', 0));
}
// Set the template variables
$tpl->processTemplate("writeContent", array('writeRubrik' => $categoryName . '<br />', 'solution_id' => $faq->faqRecord['solution_id'], 'writeThema' => $thema, 'writeArticleCategoryHeader' => $PMF_LANG['msgArticleCategories'], 'writeArticleCategories' => $writeMultiCategories, 'writeContent' => $content, 'writeTagHeader' => $PMF_LANG['msg_tags'] . ': ', 'writeArticleTags' => $tagging->getAllLinkTagsById($record_id), 'writeRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'] . ': ', 'writeRelatedArticles' => $relevant->getAllRelatedById($record_id, $faq->faqRecord['title'], $faq->faqRecord['keywords']), 'writePopularity' => $faqPopularity, 'writeDateMsg' => $PMF_LANG['msgLastUpdateArticle'] . $faq->faqRecord['date'], 'writeRevision' => $PMF_LANG['ad_entry_revision'] . ': 1.' . $faq->faqRecord['revision_id'], 'writeAuthor' => $PMF_LANG['msgAuthor'] . ': ' . $faq->faqRecord['author'], 'editThisEntry' => $editThisEntry, 'writeDiggMsgTag' => 'Digg it!', 'link_digg' => sprintf('http://digg.com/submit?phase=2&amp;url=%s', urlencode($diggItUrl)), 'writeFacebookMsgTag' => 'Share on Facebook', 'link_facebook' => sprintf('http://www.facebook.com/sharer.php?u=%s', urlencode($facebookUrl)), 'link_email' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=send2friend&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $currentCategory, $record_id, $lang), 'link_pdf' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'pdf.php?cat=%d&amp;id=%d&amp;artlang=%s', $currentCategory, $record_id, $lang), 'writePDFTag' => $PMF_LANG['msgPDF'], 'writePrintMsgTag' => $PMF_LANG['msgPrintArticle'], 'writeSend2FriendMsgTag' => $PMF_LANG['msgSend2Friend'], 'translationForm' => $translationForm, 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $record_id, 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'printVotings' => $printVoting, 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'writeSendAdress' => '?' . $sids . 'action=savecomment', 'id' => $record_id, 'lang' => $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($record_id, PMF_Comment::COMMENT_TYPE_FAQ)));
$tpl->includeTemplate('writeContent', 'index');
示例#28
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');
示例#29
0
    }
    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'];
    ?>
示例#30
0
                 if ($value == -1) {
                     $b_permission = true;
                     break;
                 } elseif ((int) $value == $current_user) {
                     $b_permission = true;
                     break;
                 } else {
                     $b_permission = false;
                 }
             }
         }
         if (!$b_permission) {
             continue;
         }
         $url = sprintf('?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s&amp;highlight=%s', $sids, $cat_content_item->category_id, $cat_content_item->id, $cat_content_item->lang, urlencode($cat_content_item->searchterm));
         $currentUrl = PMF_Link::getSystemRelativeUri();
         $oLink = new PMF_Link($currentUrl . $url);
         $oLink->itemTitle = $cat_content_item->thema;
         $oLink->text = $cat_content_item->thema;
         $oLink->tooltip = $cat_content_item->thema;
         $tmp_result_html .= '<li>' . $oLink->toHtmlAnchor() . '<br /></li>' . "\n";
     }
     if ($tmp_result_html) {
         $search_result_html .= '<strong>' . $category->getPath($cat_id) . '</strong>: ';
         $search_result_html .= '<ul class="phpmyfaq_ul">' . "\n";
         $search_result_html .= $tmp_result_html;
         $search_result_html .= '</ul>';
     }
 }
 $search_result_html .= '<div class="searchpreview"><strong>' . $PMF_LANG['msgSearchContent'] . '</strong> ' . $content . '...</div>';
 $tpl->processBlock('writeContent', 'adequateAnswers', array('answers' => $search_result_html));