/** * So far, it only initializes the connection to the database, using the ADOdb API. */ function Model() { $this->Object(); $this->_db =& Db::getDb(); // fetch the database prefix $this->_prefix = Db::getPrefix(); $this->_db->debug = DAO_DEBUG_ENABLED; }
/** * Connects to the database using the parameters in the config file. * */ function ConfigDbStorage($params = null) { // initialize the connection $this->_db =& Db::getDb(); // get the prefix $this->_dbPrefix = Db::getPrefix(); // and finally, load the whole data $this->_loadData(); }
function bb2_db_query($query) { include_once PLOG_CLASS_PATH . "class/database/db.class.php"; $db =& Db::getDb(); $result = $db->Execute($query); if (!$result) { return false; } return $result; }
function PluginTopCommentVisitors() { $this->PluginBase(); $this->id = "topcommentvisitors"; $this->author = "Mark Wu"; $this->desc = "This plugin offers the rank list of visitors by number of comments."; $this->prefix = Db::getPrefix(); $this->db =& Db::getDb(); $this->locales = array("en_UK", "zh_TW", "zh_CN"); $this->init(); }
public static function getByUsername($username) { $query = "SELECT * FROM Users WHERE username = :username"; $stmt = Db::getDb()->prepare($query); $stmt->bindParam(":username", $username); if ($stmt->execute() && ($row = $stmt->fetch())) { $user = new User(); $user->initFromDb($row); return $user; } return null; }
/** * @private */ function _checkTables() { // create the table to keep track of the voters, so that people cannot vote // more than once $fields = "\r\n\t\t\t id I(10) NOTNULL PRIMARY AUTOINCREMENT,\r\n\t\t\t recipients TEXT NOTNULL DEFAULT '',\n\t\t\t recipients_cc TEXT NOTNULL DEFAULT '',\n\t\t\t recipients_bcc TEXT NOTNULL DEFAULT '',\r\n\t\t\t subject C(255) NOTNULL DEFAULT '',\r\n\t\t\t body XL NOTNULL DEFAULT '',\r\n\t\t\t\t date T(14) DEFDATE\r\n\t\t\t\t "; $db =& Db::getDb(); $dbPrefix = Db::getPrefix(); $tableName = $dbPrefix . "mailcentre_sent"; // create the data dictionary and create the table if necessary $dict = NewDataDictionary($db); $sqlArray = $dict->ChangeTableSQL($tableName, $fields); $result = $dict->ExecuteSQLArray($sqlArray); if (!$result) { die("There was an error creating the plugin tables!"); } return true; }
function _verifyTable() { $fields = "\n id I(11) NOTNULL PRIMARY AUTOINCREMENT,\n blogId I(11) NOTNULL KEY,\n active C(1) NOTNULL KEY,\n subject TEXT NOTNULL,\n responses TEXT NOTNULL,\n responsedata TEXT NOTNULL,\n dateadded I(11) NOTNULL"; $fields2 = "\n id I(11) NOTNULL KEY,\n ip I8 NOTNULL KEY,\n date I(11) NOTNULL KEY"; $db =& Db::getDb(); $dbPrefix = Db::getPrefix(); $tableName = $dbPrefix . "plogpoll_polls"; $tableName2 = $dbPrefix . "plogpoll_voterips"; $dict = NewDataDictionary($db); $sqlAry = $dict->ChangeTableSQL($tableName, $fields); $result = $dict->ExecuteSQLArray($sqlAry); if (!$result) { die("There was an error creating/updating plogpoll plugin tables!"); } $sqlAry = $dict->ChangeTableSQL($tableName2, $fields2); $result = $dict->ExecuteSQLArray($sqlAry); if (!$result) { die("There was an error creating/updating plogpoll plugin tables!"); } }
public static function getById($id) { $modelClass = get_called_class(); $tableName = $modelClass . "s"; $query = "\tSELECT\t*\n\t\t\t\t\t\tFROM\t{$tableName}\n\t\t\t\t\t\tWHERE\tid = :id"; $stmt = Db::getDb()->prepare($query); $stmt->bindParam(":id", $id); if ($stmt->execute() && ($row = $stmt->fetch())) { $model = new $modelClass(); $model->initFromDb($row); return $model; } return null; }
include_once PLOG_CLASS_PATH . "class/object/object.class.php"; include_once PLOG_CLASS_PATH . "class/net/xmlrpc/IXR_Library.lib.php"; include_once PLOG_CLASS_PATH . "class/config/config.class.php"; include_once PLOG_CLASS_PATH . "class/database/db.class.php"; include_once PLOG_CLASS_PATH . "class/dao/users.class.php"; include_once PLOG_CLASS_PATH . "class/dao/article.class.php"; include_once PLOG_CLASS_PATH . "class/dao/articles.class.php"; include_once PLOG_CLASS_PATH . "class/dao/articlecategories.class.php"; include_once PLOG_CLASS_PATH . "class/dao/users.class.php"; include_once PLOG_CLASS_PATH . "class/dao/blogs.class.php"; include_once PLOG_CLASS_PATH . "class/template/cachecontrol.class.php"; include_once PLOG_CLASS_PATH . "class/gallery/dao/galleryresources.class.php"; include_once PLOG_CLASS_PATH . "class/plugin/pluginmanager.class.php"; // init database $_db = new Db(); $adodb = $_db->getDb(); // config object $config =& Config::getConfig(); // users object $users = new Users(); // articles object $articles = new Articles(); // category object $category = new ArticleCategories(); // blog object $blogsG = new Blogs(); function newPost($args) { global $users, $articles, $blogsG; $appkey = $args[0]; $blogid = $args[1];