/**
  * 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 PluginRecentTrackbacks()
 {
     $this->PluginBase();
     $this->id = "recenttrackbacks";
     $this->author = "Mark Wu";
     $this->desc = "This plugin offers the most recently article trackbacks.";
     $this->prefix = Db::getPrefix();
     $this->locales = array("en_UK", "zh_TW", "zh_CN", "es_ES");
     $this->init();
 }
 function PluginTopReadPosts()
 {
     $this->PluginBase();
     $this->id = "topreadposts";
     $this->author = "Mark Wu";
     $this->desc = "This plugin offers the rank list of articles by number of read.";
     $this->prefix = Db::getPrefix();
     $this->locales = array("en_UK", "zh_TW", "zh_CN");
     $this->init();
 }
 function PluginArticleReferers()
 {
     $this->PluginBase();
     $this->id = "articlereferers";
     $this->author = "Mark Wu";
     $this->desc = "This plugin offers you to get the referers of the specific article.";
     $this->prefix = Db::getPrefix();
     $this->locales = array("en_UK", "zh_TW", "zh_CN");
     $this->init();
 }
 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();
 }
 /**
  * @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!");
     }
 }
Example #9
0
 function perform()
 {
     $this->_userName = $this->_request->getValue("userName");
     $this->_userPassword = $this->_request->getValue("userPassword");
     $this->_confirmPassword = $this->_request->getValue("userPasswordCheck");
     $this->_userEmail = $this->_request->getValue("userEmail");
     $this->_userFullName = $this->_request->getValue("userFullName");
     $db = connectDb();
     if (!$db) {
         $this->_view = new WizardView("step3");
         $this->_view->setErrorMessage("There was an error connecting to the database. Please check your settings.");
         $this->setCommonData();
         return false;
     }
     if ($this->_confirmPassword != $this->_userPassword) {
         $this->_view = new WizardView("step3");
         $this->_form->setFieldValidationStatus("userPasswordCheck", false);
         $this->setCommonData(true);
         return false;
     }
     $dbPrefix = Db::getPrefix();
     $users = new Users();
     $user = new UserInfo($this->_userName, $this->_userPassword, $this->_userEmail, "", $this->_userFullName);
     $userId = $users->addUser($user);
     if (!$userId) {
         $this->_view = new WizardView("step3");
         $message = "There was an error adding the user. Make sure that the user does not already exist in the database (" . $users->DbError() . ")";
         $this->_view->setErrorMessage($message);
         $this->setCommonData();
         return false;
     }
     // we also have to execute the code to give administrator privileges to this user
     $query = "INSERT INTO {$dbPrefix}users_permissions(user_id,blog_id,permission_id) VALUES( {$userId}, 0, 1 );";
     $db->Execute($query);
     $this->_view = new Wizardview("step4");
     $this->_view->setValue("ownerid", $userId);
     $this->_view->setValue("siteLocales", Locales::getLocales());
     $this->_view->setValue("defaultLocale", Locales::getDefaultLocale());
     $ts = new TemplateSets();
     $this->_view->setValue("siteTemplates", $ts->getGlobalTemplateSets());
     $this->setCommonData();
     return true;
 }
Example #10
0
function bb2_read_settings()
{
    include_once PLOG_CLASS_PATH . "class/database/db.class.php";
    include_once PLOG_CLASS_PATH . "class/config/config.class.php";
    $config =& Config::getConfig();
    $prefix = Db::getPrefix();
    $displayStats = $config->getValue('bb2_display_stats', true);
    $verbose = $config->getValue('bb2_verbose', false);
    $isInstalled = $config->getValue('bb2_installed', false);
    $logging = $config->getValue('bb2_logging', false);
    return array('log_table' => $prefix . 'bad_behavior', 'display_stats' => $displayStats, 'verbose' => $verbose, 'logging' => $logging, 'is_installed' => $isInstalled);
}
 public function __construct(Db $db, Shop $shop)
 {
     $this->db = $db;
     $this->shop = $shop;
     $this->db_prefix = $db->getPrefix();
 }