本文整理汇总了PHP中PMF_Db::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Db::getInstance方法的具体用法?PHP PMF_Db::getInstance怎么用?PHP PMF_Db::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Db
的用法示例。
在下文中一共展示了PMF_Db::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
*/
public function __construct()
{
global $PMF_LANG;
$this->db = PMF_Db::getInstance();
$this->language = PMF_Language::$language;
$this->pmf_lang = $PMF_LANG;
}
示例2: __construct
/**
* Constructor
*
* @param resource$result Resultset
*/
public function __construct($result)
{
$this->db = PMF_Db::getInstance();
$arrayObject = new ArrayObject();
while ($row = $this->db->fetch_assoc($result)) {
$arrayObject[] = $row;
}
$this->iterator = $arrayObject->getIterator();
}
示例3: __construct
/**
* Constructor
*
* @since 2007-03-31
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
*/
function __construct()
{
global $DB, $PMF_LANG, $plr;
$this->db = PMF_Db::getInstance();
$this->language = PMF_Language::$language;
$this->type = $DB['type'];
$this->pmf_lang = $PMF_LANG;
$this->plr = $plr;
}
示例4: __construct
/**
* Constructor
*
* @param integer $user User
* @param array $groups Groupss
* @since 2007-03-30
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
*/
public function __construct($user = null, $groups = null)
{
global $DB, $faqconfig;
$this->db = PMF_Db::getInstance();
$this->language = PMF_Language::$language;
$this->type = $DB['type'];
if (is_null($user)) {
$this->user = -1;
} else {
$this->user = $user;
}
if (is_null($groups)) {
$this->groups = array(-1);
} else {
$this->groups = $groups;
}
if ($faqconfig->get('main.permLevel') == 'medium') {
$this->groupSupport = true;
}
}
示例5: 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 static function languageAvailable($id, $table = 'faqdata')
{
$db = PMF_Db::getInstance();
$output = array();
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, SQLPREFIX, $table, $where);
$result = $db->query($query);
if ($db->numRows($result) > 0) {
while ($row = $db->fetchObject($result)) {
$output[] = $row->lang;
}
}
}
return $output;
}
示例6: __construct
/**
* Constructor
*/
private function __construct()
{
$this->db = PMF_Db::getInstance();
$this->language = PMF_Language::$language;
$this->table_name = SQLPREFIX . "faqstopwords";
}
示例7: __construct
/**
* Constructor
*
* @return void
*/
protected function __construct()
{
$this->db = PMF_Db::getInstance();
}
示例8: __construct
/**
* Constructor
*
*/
public function __construct()
{
$this->db = PMF_Db::getInstance();
$this->language = PMF_Language::$language;
$this->_table = SQLPREFIX . 'faqsearches';
}
示例9: adminlog
/**
* Administrator logging
*
* @param string
* @return void
* @access public
* @since 2001-02-18
* @author Bastian Poettner <bastian@poettner.net>
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
*/
function adminlog($text)
{
global $auth, $user;
$faqconfig = PMF_Configuration::getInstance();
$db = PMF_Db::getInstance();
if ($faqconfig->get('main.enableAdminLog') && $auth && isset($user)) {
$query = sprintf('INSERT INTO
%sfaqadminlog
(id, time, usr, text, ip)
VALUES (%d, %d, %d, %s, %s)', SQLPREFIX, $db->nextID(SQLPREFIX . 'faqadminlog', 'id'), $_SERVER['REQUEST_TIME'], $user->userdata->get('user_id'), "'" . nl2br($text) . "'", "'" . $_SERVER['REMOTE_ADDR'] . "'");
$db->query($query);
}
}
示例10: __construct
/**
* Constructor
*
* @param PMF_Perm $perm Permission object
* @param array $auth Authorization array
* @return void
*/
public function __construct(PMF_Perm $perm = null, array $auth = array())
{
$this->db = PMF_Db::getInstance();
if ($perm !== null) {
if (!$this->addPerm($perm)) {
return false;
}
} else {
$permLevel = PMF_Configuration::getInstance()->get('security.permLevel');
$perm = PMF_Perm::selectPerm($permLevel);
if (!$this->addPerm($perm)) {
return false;
}
}
// authentication objects
// always make a 'local' $auth object (see: $auth_data)
$this->auth_container = array();
$authLocal = PMF_Auth::selectAuth($this->auth_data['authSource']['name']);
$authLocal->selectEncType($this->auth_data['encType']);
$authLocal->setReadOnly($this->auth_data['readOnly']);
if (!$this->addAuth($authLocal, $this->auth_data['authSource']['type'])) {
return false;
}
// additionally, set given $auth objects
if (count($auth) > 0) {
foreach ($auth as $name => $auth_object) {
if (!$this->addAuth($auth_object, $name)) {
break;
}
}
}
// user data object
$this->userdata = new PMF_User_UserData();
}
示例11: __construct
/**
* Constructor
*
* @param integer $user User
* @param array $groups Groups
* @return void
*/
public function __construct($user = null, $groups = null)
{
global $PMF_LANG, $plr;
$this->db = PMF_Db::getInstance();
$this->language = PMF_Language::$language;
$this->pmf_lang = $PMF_LANG;
$this->plr = $plr;
if (is_null($user)) {
$this->user = -1;
} else {
$this->user = $user;
}
if (is_null($groups)) {
$this->groups = array(-1);
} else {
$this->groups = $groups;
}
$faqconfig = PMF_Configuration::getInstance();
if ($faqconfig->get('main.permLevel') == 'medium') {
$this->groupSupport = true;
}
}
示例12: _generateDocBookExport2
/**
* Wrapper for the PMF_Export_Docbook class
*
*/
private static function _generateDocBookExport2()
{
// TODO: check/refine/improve/fix docbook.php and add toString method before recoding the method in order to use faq and news classes.
global $PMF_CONF, $PMF_LANG;
// XML DocBook export
$parentID = 0;
$rubrik = 0;
$sql = '';
$selectString = '';
$db = PMF_Db::getInstance();
$export = new PMF_Export_Docbook();
$export->delete_file();
// Set the FAQ title
$faqtitel = PMF_String::htmlspecialchars($PMF_CONF['main.titleFAQ']);
// Print the title of the FAQ
$export->xmlContent = '<?xml version="1.0" encoding="' . $PMF_LANG['metaCharset'] . '"?>' . '<book lang="en">' . '<title>phpMyFAQ</title>' . '<bookinfo>' . '<title>' . $faqtitel . '</title>' . '</bookinfo>';
// include the news
$result = $db->query("SELECT id, header, artikel, datum FROM " . SQLPREFIX . "faqnews");
// Write XML file
$export->write_file();
// Transformation of the news entries
if ($db->num_rows($result) > 0) {
$export->xmlContent .= '<part><title>News</title>';
while ($row = $db->fetch_object($result)) {
$datum = $export->aktually_date($row->datum);
$export->xmlContent .= '<article>' . '<title>' . $row->header . '</title>' . '<para>' . wordwrap($datum, 20) . '</para>';
$replacedString = ltrim(str_replace('<br />', '', $row->artikel));
$export->TableImageText($replacedString);
$export->xmlContent .= '</article>';
}
$export->xmlContent .= '</part>';
}
$export->write_file();
// Transformation of the articles
$export->xmlContent .= '<part>' . '<title>Artikel</title>' . '<preface>' . '<title>Rubriken</title>';
// Selection of the categories
$export->recursive_category($parentID);
$export->xmlContent .= '</preface>' . '</part>' . '</book>';
$export->write_file();
}
示例13: __construct
/**
* Constructor
*
* @param string $sids Session ID
* @param integer $caplength Length of captch code
* @return void
*/
public function __construct($sids, $caplength = 6)
{
$this->db = PMF_Db::getInstance();
$this->language = PMF_Language::$language;
if ($sids > 0) {
$this->sids = $sids;
} else {
$this->sids = '';
}
$this->userAgent = $_SERVER['HTTP_USER_AGENT'];
$this->ip = $_SERVER['REMOTE_ADDR'];
$this->caplength = $caplength;
$this->letters = array('1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
$this->code = '';
$this->quality = 60;
$this->fonts = $this->getFonts();
$this->width = 200;
$this->height = 40;
$this->timestamp = $_SERVER['REQUEST_TIME'];
}
示例14: __construct
/**
* Constructor
*
* @param integer $user User
* @param array $groups Group
* @param boolean $withperm With or without permission check
* @return void
*/
public function __construct($user = null, $groups = null, $withperm = true)
{
$this->language = PMF_Language::$language;
$this->db = PMF_Db::getInstance();
$this->categories = array();
if (is_null($user)) {
$this->user = -1;
} else {
$this->user = $user;
}
if (is_null($groups)) {
$this->groups = array(-1);
} else {
$this->groups = $groups;
}
$this->lineTab = $this->getOrderedCategories($withperm);
for ($i = 0; $i < count($this->lineTab); $i++) {
$this->lineTab[$i]['level'] = $this->levelOf($this->lineTab[$i]['id']);
}
}
示例15: __construct
/**
* Constructor
*
* @param integer $id attachment id
*
* @return null
*/
public function __construct($id = null)
{
$this->db = PMF_Db::getInstance();
if (null !== $id) {
$this->id = $id;
$this->getMeta();
}
}