本文整理汇总了PHP中PMF_Db::getTablePrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Db::getTablePrefix方法的具体用法?PHP PMF_Db::getTablePrefix怎么用?PHP PMF_Db::getTablePrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Db
的用法示例。
在下文中一共展示了PMF_Db::getTablePrefix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllRelatedById
/**
* Returns all relevant articles for a FAQ record with the same language
*
* @param integer $recordId FAQ ID
* @param string $question FAQ title
* @param string $keywords FAQ keywords
*
* @return array
*/
public function getAllRelatedById($recordId, $question, $keywords)
{
$terms = str_replace('-', ' ', $question) . $keywords;
$search = PMF_Search_Factory::create($this->_config, array('database' => PMF_Db::getType()));
$search->setTable(PMF_Db::getTablePrefix() . 'faqdata AS fd')->setResultColumns(array('fd.id AS id', 'fd.lang AS lang', 'fcr.category_id AS category_id', 'fd.thema AS question', 'fd.content AS answer'))->setJoinedTable(PMF_Db::getTablePrefix() . 'faqcategoryrelations AS fcr')->setJoinedColumns(array('fd.id = fcr.record_id', 'fd.lang = fcr.record_lang'))->setConditions(array('fd.active' => "'yes'", 'fd.lang' => "'" . $this->_config->getLanguage()->getLanguage() . "'"))->setMatchingColumns(array('fd.thema', 'fd.content', 'fd.keywords'));
$result = $search->search($terms);
return $this->_config->getDb()->fetchAll($result);
}
示例2: getBreadcrumbs
/**
* Get an array with minimalistic attachment meta data
*
* @return array
*/
public function getBreadcrumbs()
{
$retval = array();
$query = sprintf("\n SELECT\n fa.id AS ID,\n fa.record_id AS record_id,\n fa.record_lang AS record_lang,\n fa.filename AS filename,\n fa.filesize AS filesize,\n fa.mime_type AS mime_type,\n fd.thema AS thema\n FROM\n %s fa\n JOIN\n %s fd\n ON\n fa.record_id = fd.id\n GROUP BY\n fa.id", PMF_Db::getTablePrefix() . 'faqattachment', PMF_Db::getTablePrefix() . 'faqdata');
$result = $this->config->getDb()->query($query);
if ($result) {
$retval = $this->config->getDb()->fetchAll($result);
}
return $retval;
}
示例3: getReportingData
/**
* Generates a huge array for the report
* @return array
*/
public function getReportingData()
{
$report = [];
$query = sprintf("\n SELECT\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n c.name as category_name,\n c.parent_id as parent_id,\n fd.sticky AS sticky,\n fd.thema AS question,\n fd.author AS original_author,\n fd.datum AS creation_date,\n fv.visits AS visits,\n u.display_name AS last_author\n FROM\n %sfaqdata fd\n LEFT JOIN\n %sfaqcategoryrelations fcr\n ON\n (fd.id = fcr.record_id AND fd.lang = fcr.record_lang)\n LEFT JOIN\n %sfaqvisits fv\n ON\n (fd.id = fv.id AND fd.lang = fv.lang)\n LEFT JOIN\n %sfaqchanges as fc\n ON\n (fd.id = fc.id AND fd.lang = fc.lang)\n LEFT JOIN\n %sfaquserdata as u\n ON\n (u.user_id = fc.usr)\n LEFT JOIN\n %sfaqcategories as c\n ON\n (c.id = fcr.category_id AND c.lang = fcr.record_lang)\n ORDER BY\n fd.id\n ASC", PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix());
$result = $this->_config->getDb()->query($query);
$lastId = 0;
while ($row = $this->_config->getDb()->fetchObject($result)) {
if ($row->id == $lastId) {
$report[$row->id]['faq_translations'] += 1;
} else {
$report[$row->id] = array('faq_id' => $row->id, 'faq_language' => $row->lang, 'category_id' => $row->category_id, 'category_parent' => $row->parent_id, 'category_name' => $row->category_name, 'faq_translations' => 0, 'faq_sticky' => $row->sticky, 'faq_question' => $row->question, 'faq_org_author' => $row->original_author, 'faq_creation' => PMF_Date::createIsoDate($row->creation_date), 'faq_visits' => $row->visits, 'faq_last_author' => $row->last_author);
}
$lastId = $row->id;
}
return $report;
}
示例4: getEntryState
/**
* retrieves stored link state and validates timestamp
*
* @param int $id
* @param string $artlang
* @param boolean $checkDate
*
* @return boolean|string
*/
public function getEntryState($id = 0, $artlang = '', $checkDate = false)
{
$interval = $this->getURLValidateInterval();
$query = sprintf("\n SELECT \n links_state, links_check_date \n FROM \n %sfaqdata \n WHERE \n id = %d \n AND \n lang = '%s'", PMF_Db::getTablePrefix(), $id, $this->_config->getDb()->escape($artlang));
if ($result = $this->_config->getDb()->query($query)) {
while ($row = $this->_config->getDb()->fetchObject($result)) {
$_linkState = $row->links_state;
if (trim($_linkState) == "") {
$_linkState = true;
}
if ($row->links_check_date > $interval) {
return $_linkState;
} else {
if ($checkDate == false) {
return $_linkState;
} else {
return true;
}
}
}
} else {
return false;
}
}
示例5: removeAllUsersFromGroup
/**
* Removes all users from the group $groupId.
* Returns true on success, otherwise false.
*
* @param integer $groupId Group ID
* @return bool
*/
public function removeAllUsersFromGroup($groupId)
{
if ($groupId <= 0 or !is_numeric($groupId)) {
return false;
}
// remove all user from group
$delete = sprintf("\n DELETE FROM\n %sfaquser_group\n WHERE\n group_id = %d", PMF_Db::getTablePrefix(), $groupId);
$res = $this->config->getDb()->query($delete);
if (!$res) {
return false;
}
return true;
}
示例6: checkOnEmptyTable
/**
* Check if a table is filled with data
*
* @param string $tableName Table name
*
* @return boolean true, if table is empty, otherwise false
*/
public static function checkOnEmptyTable($tableName)
{
if (self::$instance->numRows(self::$instance->query('SELECT * FROM ' . PMF_Db::getTablePrefix() . $tableName)) < 1) {
return true;
} else {
return false;
}
}
示例7: languageAvailable
/**
* Returns an array of country codes for a specific FAQ record ID,
* specific category ID or all languages used by FAQ records , categories
*
* @param integer $id ID
* @param string $table Specifies table
*
* @return array
*/
public function languageAvailable($id, $table = 'faqdata')
{
$output = [];
if (isset($id)) {
if ($id == 0) {
// get languages for all ids
$distinct = ' DISTINCT ';
$where = '';
} else {
// get languages for specified id
$distinct = '';
$where = " WHERE id = " . $id;
}
$query = sprintf("\n SELECT %s\n lang\n FROM\n %s%s\n %s", $distinct, PMF_Db::getTablePrefix(), $table, $where);
$result = $this->config->getDb()->query($query);
if ($this->config->getDb()->numRows($result) > 0) {
while ($row = $this->config->getDb()->fetchObject($result)) {
$output[] = $row->lang;
}
}
}
return $output;
}
示例8: refuseAllUserRights
/**
* Refuses all user rights.
* Returns true on success, otherwise false.
*
* @param integer $user_id User ID
* @return boolean
*/
public function refuseAllUserRights($user_id)
{
$delete = sprintf("\n DELETE FROM\n %sfaquser_right\n WHERE\n user_id = %d", PMF_Db::getTablePrefix(), $user_id);
$res = $this->config->getDb()->query($delete);
if (!$res) {
return false;
}
return true;
}
示例9: update
/**
* Updates all configuration items
*
* @param array $newConfigs Array with new configuration values
*
* @return bool
*/
public function update(array $newConfigs)
{
$runtimeConfigs = array('core.database', 'core.instance', 'core.language', 'core.ldap', 'core.ldapConfig');
if (is_array($newConfigs)) {
foreach ($newConfigs as $name => $value) {
if ($name != 'main.phpMyFAQToken' && !in_array($name, $runtimeConfigs)) {
$update = sprintf("\n UPDATE\n %s%s\n SET\n config_value = '%s'\n WHERE\n config_name = '%s'", PMF_Db::getTablePrefix(), $this->_tableName, $this->getDb()->escape(trim($value)), $name);
$this->getDb()->query($update);
if (isset($this->config[$name])) {
unset($this->config[$name]);
}
}
}
return true;
}
return false;
}
示例10: setSuccess
/**
* Sets login succuess/failure
*
* @param boolean $success
*
* @return boolean
*/
protected function setSuccess($success)
{
$this->loginState = (int) $success;
$update = sprintf("\n UPDATE\n %sfaquser\n SET\n success = %d\n WHERE\n user_id = %d", PMF_Db::getTablePrefix(), $this->loginState, $this->getUserId());
return $this->config->getDb()->query($update);
}
示例11: header
* @author Alexander M. Turek <me@derrabus.de>
* @copyright 2005-2014 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
* @since 2013-02-05
*/
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;
}
$faqTableInfo = $faqConfig->getDb()->getTableStatus();
$templateVars = array('PMF_LANG' => $PMF_LANG, 'dashboardArticles' => $faqTableInfo[PMF_Db::getTablePrefix() . "faqdata"], 'dashboardComments' => $faqTableInfo[PMF_Db::getTablePrefix() . "faqcomments"], 'dashboardNews' => $faqTableInfo[PMF_Db::getTablePrefix() . "faqnews"], 'dashboardOpenQuestions' => $faqTableInfo[PMF_Db::getTablePrefix() . "faqquestions"], 'dashboardUsers' => $faqTableInfo[PMF_Db::getTablePrefix() . 'faquser'] - 1, 'dashboardVisits' => $faqTableInfo[PMF_Db::getTablePrefix() . 'faqsessions'], 'enableUserTracking' => $faqConfig->get('main.enableUserTracking'), 'inMaintenanceMode' => $faqConfig->get('main.maintenanceMode'), 'onlineVerificationActive' => false, 'onlineVerificationError' => false, 'updateCheckActive' => false);
if ($faqConfig->get('main.enableUserTracking')) {
$session = new PMF_Session($faqConfig);
$visits = $session->getLast30DaysVisits();
$templateVars['visitsData'] = implode(',', $visits);
unset($session, $visits);
}
// Perform update check
$version = PMF_Filter::filterInput(INPUT_POST, 'param', FILTER_SANITIZE_STRING);
if (!is_null($version) && $version == 'version') {
$json = file_get_contents('http://www.phpmyfaq.de/api/version');
$result = json_decode($json);
if ($result instanceof stdClass) {
$installed = $faqConfig->get('main.currentVersion');
$available = $result->stable;
$templateVars['updateCheckActive'] = true;
示例12:
<div class="dashboard-stat span2">
<span><a href="?action=news"><?php
echo $PMF_LANG["msgNews"];
?>
</a></span>
<?php
echo $faqTableInfo[PMF_Db::getTablePrefix() . "faqnews"];
?>
</div>
<div class="dashboard-stat span2">
<span><a href="?action=user&user_action=listallusers"><?php
echo $PMF_LANG['admin_mainmenu_users'];
?>
</a></span>
<?php
echo $faqTableInfo[PMF_Db::getTablePrefix() . 'faquser'] - 1;
?>
</div>
</section>
<?php
if ($faqConfig->get('main.enableUserTracking')) {
?>
<section class="row-fluid">
<div class="span12">
<header>
<h3><?php
echo $PMF_LANG["ad_stat_report_visits"];
?>
</h3>
示例13: deleteMeta
/**
* Remove meta data from the db
*
* @return null
*/
protected function deleteMeta()
{
$sql = sprintf("DELETE FROM %sfaqattachment WHERE id = %d", PMF_Db::getTablePrefix(), $this->id);
$this->db->query($sql);
}
示例14: foreach
<div class="controls">
<ul class="adminAttachments">
<?php
$attList = PMF_Attachment_Factory::fetchByRecordId($faqConfig, $faqData['id']);
foreach ($attList as $att) {
printf('<li><a href="../%s">%s</a> ', $att->buildUrl(), $att->getFilename());
if ($permission['delattachment']) {
printf('<a class="label label-important" href="?action=delatt&record_id=%d&id=%d&lang=%s"><i class="icon-trash icon-white"></i></a>', $faqData['id'], $att->getId(), $faqData['lang']);
}
echo "</li>\n";
}
?>
</ul>
<?php
if (0 === $faqData['id']) {
$faqData['id'] = $faqConfig->getDb()->nextId(PMF_Db::getTablePrefix() . 'faqdata', 'id');
}
printf('<a class="btn btn-success" onclick="addAttachment(\'attachment.php?record_id=%d&record_lang=%s\', \'Attachment\');">%s</a>', $faqData['id'], $faqData['lang'], $PMF_LANG['ad_att_add']);
?>
</div>
</div>
<?php
}
?>
<!-- Tags -->
<div class="control-group">
<label class="control-label" for="tags"><?php
echo $PMF_LANG['ad_entry_tags'];
?>
:</label>
<div class="controls">
示例15: search
/**
* The main search function for the full text search
*
* @param string $searchTerm Text/Number (solution id)
* @param boolean $allLanguages true to search over all languages
*
* @return array
*/
public function search($searchTerm, $allLanguages = true)
{
$fdTable = PMF_Db::getTablePrefix() . 'faqdata';
$fcrTable = PMF_Db::getTablePrefix() . 'faqcategoryrelations';
$condition = array($fdTable . '.active' => "'yes'");
$search = PMF_Search_Factory::create($this->_config, array('database' => PMF_Db::getType()));
if (!is_null($this->getCategoryId()) && 0 < $this->getCategoryId()) {
if ($this->getCategory() instanceof PMF_Category) {
$children = $this->getCategory()->getChildNodes($this->getCategoryId());
$selectedCategory = array($fcrTable . '.category_id' => array_merge((array) $this->getCategoryId(), $children));
} else {
$selectedCategory = array($fcrTable . '.category_id' => $this->getCategoryId());
}
$condition = array_merge($selectedCategory, $condition);
}
if (!$allLanguages && !is_numeric($searchTerm)) {
$selectedLanguage = array($fdTable . '.lang' => "'" . $this->_config->getLanguage()->getLanguage() . "'");
$condition = array_merge($selectedLanguage, $condition);
}
$search->setTable($fdTable)->setResultColumns(array($fdTable . '.id AS id', $fdTable . '.lang AS lang', $fdTable . '.solution_id AS solution_id', $fcrTable . '.category_id AS category_id', $fdTable . '.thema AS question', $fdTable . '.content AS answer'))->setJoinedTable($fcrTable)->setJoinedColumns(array($fdTable . '.id = ' . $fcrTable . '.record_id', $fdTable . '.lang = ' . $fcrTable . '.record_lang'))->setConditions($condition);
if (is_numeric($searchTerm)) {
$search->setMatchingColumns(array($fdTable . '.solution_id'));
} else {
$search->setMatchingColumns(array($fdTable . '.thema', $fdTable . '.content', $fdTable . '.keywords'));
}
$result = $search->search($searchTerm);
if (!$this->_config->getDb()->numRows($result)) {
return [];
} else {
return $this->_config->getDb()->fetchAll($result);
}
}