本文整理汇总了PHP中Core::getDbTablePrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::getDbTablePrefix方法的具体用法?PHP Core::getDbTablePrefix怎么用?PHP Core::getDbTablePrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::getDbTablePrefix方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSettings
/**
* Used to update the settings on the Settings tab.
* @param array $post
*/
public function updateSettings($post)
{
$accountInfo = Core::$user->getAccount();
$accountType = $accountInfo["accountType"];
$isAnonymous = $accountInfo["isAnonymous"];
$L = Core::$language->getCurrentLanguageStrings();
if (!isset($post["consoleEventsDataTypePlugins"]) || empty($post["consoleEventsDataTypePlugins"])) {
$post["consoleEventsDataTypePlugins"] = array();
}
if (!isset($post["consoleEventsExportTypePlugins"]) || empty($post["consoleEventsExportTypePlugins"])) {
$post["consoleEventsExportTypePlugins"] = array();
}
$settings = array("consoleWarnings" => isset($post["consoleWarnings"]) ? "enabled" : "", "consoleEventsPublish" => isset($post["consoleEventsPublish"]) ? "enabled" : "", "consoleEventsSubscribe" => isset($post["consoleEventsSubscribe"]) ? "enabled" : "", "consoleCoreEvents" => isset($post["consoleCoreEvents"]) ? "enabled" : "", "consoleEventsDataTypePlugins" => implode(",", $post["consoleEventsDataTypePlugins"]), "consoleEventsExportTypePlugins" => implode(",", $post["consoleEventsExportTypePlugins"]), "theme" => $post["theme"]);
if (!$isAnonymous && $accountType == "admin") {
if (isset($post["userAccountSetup"])) {
$settings["userAccountSetup"] = $post["userAccountSetup"] == "single" ? "single" : "multiple";
}
}
$prefix = Core::getDbTablePrefix();
$errors = array();
while (list($key, $value) = each($settings)) {
$value = mysql_real_escape_string($value);
$result = Core::$db->query("\n\t\t\t\tUPDATE {$prefix}settings\n\t\t\t\tSET setting_value = '{$value}'\n\t\t\t\tWHERE setting_name = '{$key}'\n\t\t\t");
if (!$result["success"]) {
$errors[] = $result["errorMessage"];
}
}
if (count($errors) > 0) {
return array(false, implode("<br />", $errors));
} else {
return array(true, $L["notify_settings_updated"]);
}
}
示例2: initCityList
/**
* Called when the plugin is initialized during data generation. Initializes the
* $citiesByCountryRegion private var.
*/
private function initCityList()
{
$prefix = Core::getDbTablePrefix();
$response = Core::$db->query("\n\t\t\tSELECT *\n\t\t\tFROM {$prefix}cities\n\t\t");
if (!$response["success"]) {
return;
}
$cities = array();
$citiesByCountryRegion = array();
while ($cityInfo = mysqli_fetch_assoc($response["results"])) {
$currCountrySlug = $cityInfo["country_slug"];
$currRegionSlug = $cityInfo["region_slug"];
if (!array_key_exists($currCountrySlug, $citiesByCountryRegion)) {
$citiesByCountryRegion[$currCountrySlug] = array("numRegions" => 0, "regions" => array());
}
if (!array_key_exists($currRegionSlug, $citiesByCountryRegion[$currCountrySlug]["regions"])) {
$citiesByCountryRegion[$currCountrySlug]["regions"][$currRegionSlug] = array("numCities" => 0, "cities" => array());
$citiesByCountryRegion[$currCountrySlug]["numRegions"]++;
}
$citiesByCountryRegion[$currCountrySlug]["regions"][$currRegionSlug]["cities"][] = array("city" => $cityInfo["city"], "city_id" => $cityInfo["city_id"]);
$citiesByCountryRegion[$currCountrySlug]["regions"][$currRegionSlug]["numCities"]++;
$cities[] = $cityInfo["city"];
}
// now we've put together all the info, add in "numRegions" and "numCities" hash keys
// at the appropriate spots in the data structure. This'll help speed up the data generation
$this->citiesByCountryRegion = $citiesByCountryRegion;
$this->cities = $cities;
$this->numCities = count($cities);
}
示例3: updateGlobalSettings
/**
* Used to update the settings on the Settings tab. Only ever called by administrators or anonymous admins.
* @param array $post
* @return array
*/
public static function updateGlobalSettings($post)
{
$dbLink = Core::$db->getDBLink();
$L = Core::$language->getCurrentLanguageStrings();
if (empty($post["consoleEventsDataTypePlugins"])) {
$post["consoleEventsDataTypePlugins"] = array();
}
if (empty($post["consoleEventsExportTypePlugins"])) {
$post["consoleEventsExportTypePlugins"] = array();
}
$settings = array("consoleWarnings" => $post["consoleWarnings"] == "true" ? "enabled" : "", "consoleEventsPublish" => $post["consoleEventsPublish"] == "true" ? "enabled" : "", "consoleEventsSubscribe" => $post["consoleEventsSubscribe"] == "true" ? "enabled" : "", "consoleCoreEvents" => $post["consoleCoreEvents"] == "true" ? "enabled" : "", "consoleEventsDataTypePlugins" => implode(",", $post["consoleEventsDataTypePlugins"]), "consoleEventsExportTypePlugins" => implode(",", $post["consoleEventsExportTypePlugins"]), "theme" => "classic");
$prefix = Core::getDbTablePrefix();
$errors = array();
while (list($key, $value) = each($settings)) {
$value = mysqli_real_escape_string($dbLink, $value);
$result = Core::$db->query("\n\t\t\t\tUPDATE {$prefix}settings\n\t\t\t\tSET setting_value = '{$value}'\n\t\t\t\tWHERE setting_name = '{$key}'\n\t\t\t");
if (!$result["success"]) {
$errors[] = $result["errorMessage"];
}
}
if (count($errors) > 0) {
return array(false, implode("<br />", $errors));
} else {
return array(true, $L["notify_settings_updated"]);
}
}
示例4: __construct
function __construct()
{
if (!Core::checkIsInstalled()) {
return;
}
$this->dbLink = Core::$db->getDBLink();
$this->dbPrefix = Core::getDbTablePrefix();
// register this object as the session handler
session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
}
示例5: uninstall
/**
* Country plugins don't need to implement their own uninstallation function - this takes
* care of all the database cleanup for them, since we know the locations of all the data.
* However, if need be, this function can be overridden.
*/
public function uninstall()
{
$prefix = Core::getDbTablePrefix();
$countrySlug = $this->countrySlug;
$queries = array();
$queries[] = "DELETE FROM {$prefix}countries WHERE country_slug = '{$countrySlug}'";
$queries[] = "DELETE FROM {$prefix}regions WHERE country_slug = '{$countrySlug}'";
$queries[] = "DELETE FROM {$prefix}cities WHERE country_slug = '{$countrySlug}'";
Core::$db->query($queries);
}
示例6: createCoreTables
/**
* Creates the core tables and populates them.
*/
public static function createCoreTables()
{
$prefix = Core::getDbTablePrefix();
$rollbackQueries = array("DROP TABLE IF EXISTS {$prefix}cities", "DROP TABLE IF EXISTS {$prefix}configurations", "DROP TABLE IF EXISTS {$prefix}countries", "DROP TABLE IF EXISTS {$prefix}first_names", "DROP TABLE IF EXISTS {$prefix}last_names", "DROP TABLE IF EXISTS {$prefix}regions", "DROP TABLE IF EXISTS {$prefix}sessions", "DROP TABLE IF EXISTS {$prefix}settings", "DROP TABLE IF EXISTS {$prefix}user_accounts");
// start off by clearing out the DB, just in case. For this, we just run the rollback queries (used
// below, in case of an SQL error)
Core::$db->query($rollbackQueries);
// now construct the database
$queries = array();
$queries[] = "\n\t\t\tCREATE TABLE {$prefix}cities (\n\t\t\t\tcity_id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\tcountry_slug varchar(100) NOT NULL,\n\t\t\t\tregion_slug varchar(100) NOT NULL,\n\t\t\t\tcity varchar(80) CHARACTER SET utf8 NOT NULL,\n\t\t\t\tPRIMARY KEY (city_id)\n\t\t\t)\n\t\t";
$queries[] = "\n\t\t\tCREATE TABLE {$prefix}configurations (\n\t\t\t\tconfiguration_id mediumint(9) NOT NULL auto_increment,\n\t\t\t\tstatus ENUM('public','private') NOT NULL,\n\t\t\t\tdate_created datetime NOT NULL,\n\t\t\t\tlast_updated datetime NOT NULL,\n\t\t\t\taccount_id mediumint(9) NOT NULL,\n\t\t\t\tconfiguration_name varchar(100) NOT NULL,\n\t\t\t\tcontent mediumtext NOT NULL,\n\t\t\t\tnum_rows_generated MEDIUMINT DEFAULT 0,\n\t\t\t\tPRIMARY KEY (configuration_id)\n\t\t\t)\n\t\t";
$queries[] = "\n\t\t\tCREATE TABLE {$prefix}countries (\n\t\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\tcountry varchar(100) NOT NULL DEFAULT '',\n\t\t\t\tcountry_slug varchar(100) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY (id)\n\t\t\t)\n\t\t";
$queries[] = "\n\t\t\tCREATE TABLE {$prefix}regions (\n\t\t\t\tregion_id mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\tcountry_slug varchar(100) NOT NULL,\n\t\t\t\tregion varchar(35) CHARACTER SET utf8 NOT NULL,\n\t\t\t\tregion_short char(3) CHARACTER SET utf8 DEFAULT NULL,\n\t\t\t\tregion_slug varchar(100) NOT NULL,\n\t\t\t\tweight smallint(3) NOT NULL,\n\t\t\t\tPRIMARY KEY (region_id)\n\t\t\t)\n\t\t";
$queries[] = "\n\t\t\tCREATE TABLE {$prefix}settings (\n\t\t\t\tsetting_name varchar(100) NOT NULL,\n\t\t\t\tsetting_value text NOT NULL,\n\t\t\t\tUNIQUE KEY setting_name (setting_name)\n\t\t\t)\n\t\t";
$defaultTheme = Core::getDefaultTheme();
$queries[] = "\n\t\t\tINSERT INTO {$prefix}settings (setting_name, setting_value)\n\t\t\tVALUES\n\t\t\t\t('lipsum', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur sed tortor. Integer aliquam adipiscing lacus. Ut nec urna et arcu imperdiet ullamcorper. Duis at lacus. Quisque purus sapien, gravida non, sollicitudin a, malesuada id, erat. Etiam vestibulum massa rutrum magna. Cras convallis convallis dolor. Quisque tincidunt pede ac urna. Ut tincidunt vehicula risus. Nulla eget metus eu erat semper rutrum. Fusce dolor quam, elementum at, egestas a, scelerisque sed, sapien. Nunc pulvinar arcu et pede. Nunc sed orci lobortis augue scelerisque mollis. Phasellus libero mauris, aliquam eu, accumsan sed, facilisis vitae, orci. Phasellus dapibus quam quis diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Fusce aliquet magna a neque. Nullam ut nisi a odio semper cursus. Integer mollis. Integer tincidunt aliquam arcu. Aliquam ultrices iaculis odio. Nam interdum enim non nisi. Aenean eget metus. In nec orci. Donec nibh. Quisque nonummy ipsum non arcu. Vivamus sit amet risus. Donec egestas. Aliquam nec enim. Nunc ut erat. Sed nunc est, mollis non, cursus non, egestas a, dui. Cras pellentesque. Sed dictum. Proin eget odio. Aliquam vulputate ullamcorper magna. Sed eu eros. Nam consequat dolor vitae dolor. Donec fringilla. Donec feugiat metus sit amet ante. Vivamus non lorem vitae odio sagittis semper. Nam tempor diam dictum sapien. Aenean massa. Integer vitae nibh. Donec est mauris, rhoncus id, mollis nec, cursus a, enim. Suspendisse aliquet, sem ut cursus luctus, ipsum leo elementum sem, vitae aliquam eros turpis non enim. Mauris quis turpis vitae purus gravida sagittis. Duis gravida. Praesent eu nulla at sem molestie sodales. Mauris blandit enim consequat purus. Maecenas libero est, congue a, aliquet vel, vulputate eu, odio. Phasellus at augue id ante dictum cursus. Nunc mauris elit, dictum eu, eleifend nec, malesuada ut, sem. Nulla interdum. Curabitur dictum. Phasellus in felis. Nulla tempor augue ac ipsum. Phasellus vitae mauris sit amet lorem semper auctor. Mauris vel turpis. Aliquam adipiscing lobortis risus. In mi pede, nonummy ut, molestie in, tempus eu, ligula. Aenean euismod mauris eu elit. Nulla facilisi. Sed neque. Sed eget lacus. Mauris non dui nec urna suscipit nonummy. Fusce fermentum fermentum arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae Phasellus ornare. Fusce mollis. Duis sit amet diam eu dolor egestas rhoncus. Proin nisl sem, consequat nec, mollis vitae, posuere at, velit. Cras lorem lorem, luctus ut, pellentesque eget, dictum placerat, augue. Sed molestie. Sed id risus quis diam luctus lobortis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Mauris ut quam vel sapien imperdiet ornare. In faucibus. Morbi vehicula. Pellentesque tincidunt tempus risus. Donec egestas. Duis ac arcu. Nunc mauris. Morbi non sapien molestie orci tincidunt adipiscing. Mauris molestie pharetra nibh. Aliquam ornare, libero at auctor ullamcorper, nisl arcu iaculis enim, sit amet ornare lectus justo eu arcu. Morbi sit amet massa. Quisque porttitor eros nec tellus. Nunc lectus pede, ultrices a, auctor non, feugiat nec, diam. Duis mi enim, condimentum eget, volutpat ornare, facilisis eget, ipsum. Donec sollicitudin adipiscing ligula. Aenean gravida nunc sed pede. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin vel arcu eu odio tristique pharetra. Quisque ac libero nec ligula consectetuer rhoncus. Nullam velit dui, semper et, lacinia vitae, sodales at, velit. Pellentesque ultricies dignissim lacus. Aliquam rutrum lorem ac risus. Morbi metus. Vivamus euismod urna. Nullam lobortis quam a felis ullamcorper viverra. Maecenas iaculis aliquet diam. Sed diam lorem, auctor quis, tristique ac, eleifend vitae, erat. Vivamus nisi. Mauris nulla. Integer urna. Vivamus molestie dapibus ligula. Aliquam erat volutpat. Nulla dignissim. Maecenas ornare egestas ligula. Nullam feugiat placerat velit. Quisque varius. Nam porttitor scelerisque neque. Nullam nisl. Maecenas malesuada fringilla est. Mauris eu turpis. Nulla aliquet. Proin velit. Sed malesuada augue ut lacus. Nulla tincidunt, neque vitae semper egestas, urna justo faucibus lectus, a sollicitudin orci sem eget massa. Suspendisse eleifend. Cras sed leo. Cras vehicula aliquet libero. Integer in magna. Phasellus dolor elit, pellentesque a, facilisis non, bibendum sed, est. Nunc laoreet lectus quis massa. Mauris vestibulum, neque sed dictum eleifend, nunc risus varius orci, in consequat enim diam vel arcu. Curabitur ut odio vel est tempor bibendum. Donec felis orci, adipiscing non, luctus sit amet, faucibus ut, nulla. Cras eu tellus eu augue porttitor interdum. Sed auctor odio a purus. Duis elementum, dui quis accumsan convallis, ante lectus convallis est, vitae sodales nisi magna sed dui. Fusce aliquam, enim nec tempus scelerisque, lorem ipsum sodales purus, in molestie tortor nibh sit amet orci. Ut sagittis lobortis mauris. Suspendisse aliquet molestie tellus. Aenean egestas hendrerit neque. In ornare sagittis felis. Donec tempor, est ac mattis semper, dui lectus rutrum urna, nec luctus felis purus ac tellus. Suspendisse sed dolor. Fusce mi lorem, vehicula et, rutrum eu, ultrices sit amet, risus. Donec nibh enim, gravida sit amet, dapibus id, blandit at, nisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin vel nisl. Quisque fringilla euismod enim. Etiam gravida molestie arcu. Sed eu nibh vulputate mauris sagittis placerat. Cras dictum ultricies ligula. Nullam enim. Sed nulla ante, iaculis nec, eleifend non, dapibus rutrum, justo. Praesent luctus. Curabitur egestas nunc sed libero. Proin sed turpis nec mauris blandit mattis. Cras eget nisi dictum augue malesuada malesuada. Integer id magna et ipsum cursus vestibulum. Mauris magna. Duis dignissim tempor arcu. Vestibulum ut eros non enim commodo hendrerit. Donec porttitor tellus non magna. Nam ligula elit, pretium et, rutrum non, hendrerit id, ante. Nunc mauris sapien, cursus in, hendrerit consectetuer, cursus et, magna. Praesent interdum ligula eu enim. Etiam imperdiet dictum magna. Ut tincidunt orci quis lectus. Nullam suscipit, est ac facilisis facilisis, magna tellus faucibus leo, in lobortis tellus justo sit amet nulla. Donec non justo. Proin non massa non ante bibendum ullamcorper. Duis cursus, diam at pretium aliquet, metus urna convallis erat, eget tincidunt dui augue eu tellus. Phasellus elit pede, malesuada vel, venenatis vel, faucibus id, libero. Donec consectetuer mauris id sapien. Cras dolor dolor, tempus non, lacinia at, iaculis quis, pede. Praesent eu dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eget magna. Suspendisse tristique neque venenatis lacus. Etiam bibendum fermentum metus. Aenean sed pede nec ante blandit viverra. Donec tempus, lorem fringilla ornare placerat, orci lacus vestibulum lorem, sit amet ultricies sem magna nec quam. Curabitur vel lectus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec dignissim magna a tortor. Nunc commodo auctor velit. Aliquam nisl. Nulla eu neque pellentesque massa lobortis ultrices. Vivamus rhoncus. Donec est. Nunc ullamcorper, velit in aliquet lobortis, nisi nibh lacinia orci, consectetuer euismod est arcu ac orci. Ut semper pretium neque. Morbi quis urna. Nunc quis arcu vel quam dignissim pharetra. Nam ac nulla. In tincidunt congue turpis. In condimentum. Donec at arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae Donec tincidunt. Donec vitae erat vel pede blandit congue. In scelerisque scelerisque dui. Suspendisse ac metus vitae velit egestas lacinia. Sed congue, elit sed consequat auctor, nunc nulla vulputate dui, nec tempus mauris erat eget ipsum. Suspendisse sagittis. Nullam vitae diam. Proin dolor. Nulla semper tellus id nunc interdum feugiat. Sed nec metus facilisis lorem tristique aliquet. Phasellus fermentum convallis ligula. Donec luctus aliquet odio. Etiam ligula tortor, dictum eu, placerat eget, venenatis a, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam laoreet, libero et tristique pellentesque, tellus sem mollis dui, in sodales elit erat vitae risus. Duis a mi fringilla mi lacinia mattis. Integer eu lacus. Quisque imperdiet, erat nonummy ultricies ornare, elit elit fermentum risus, at fringilla purus mauris a nunc. In at pede. Cras vulputate velit eu sem. Pellentesque ut ipsum ac mi eleifend egestas. Sed pharetra, felis eget varius ultrices, mauris ipsum porta elit, a feugiat tellus lorem eu metus. In lorem. Donec elementum, lorem ut aliquam iaculis, lacus pede sagittis augue, eu tempor erat neque non quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam fringilla cursus purus. Nullam scelerisque neque sed sem egestas blandit. Nam nulla magna, malesuada vel, convallis in, cursus et, eros. Proin ultrices. Duis volutpat nunc sit amet metus. Aliquam erat volutpat. Nulla facilisis. Suspendisse commodo tincidunt nibh. Phasellus nulla. Integer vulputate, risus a ultricies adipiscing, enim mi tempor lorem, eget mollis lectus pede et risus. Quisque libero lacus, varius et, euismod et, commodo at, libero. Morbi accumsan laoreet ipsum. Curabitur consequat, lectus sit amet luctus vulputate, nisi sem semper erat, in consectetuer ipsum nunc id enim. Curabitur massa. Vestibulum accumsan neque et nunc. Quisque ornare tortor at risus. Nunc ac sem ut dolor dapibus gravida. Aliquam tincidunt, nunc ac mattis ornare, lectus ante dictum mi, ac mattis velit justo nec ante. Maecenas mi felis, adipiscing fringilla, porttitor vulputate, posuere vulputate, lacus. Cras interdum. Nunc sollicitudin commodo ipsum. Suspendisse non leo. Vivamus nibh dolor, nonummy ac, feugiat non, lobortis quis, pede. Suspendisse dui. Fusce diam nunc, ullamcorper eu, euismod ac, fermentum vel, mauris. Integer sem elit, pharetra ut, pharetra sed, hendrerit a, arcu. Sed et libero. Proin mi. Aliquam gravida mauris ut mi. Duis risus odio, auctor vitae, aliquet nec, imperdiet nec, leo. Morbi neque tellus, imperdiet non, vestibulum nec, euismod in, dolor. Fusce feugiat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam auctor, velit eget laoreet posuere, enim nisl elementum purus, accumsan interdum libero dui nec ipsum.'),\n\t\t\t\t('userAccountSetup', ''),\n\t\t\t\t('consoleEventsPublish', ''),\n\t\t\t\t('consoleEventsSubscribe', ''),\n\t\t\t\t('consoleEventsDataTypePlugins', ''),\n\t\t\t\t('consoleEventsExportTypePlugins', ''),\n\t\t\t\t('consoleCoreEvents', ''),\n\t\t\t\t('consoleWarnings', ''),\n\t\t\t\t('defaultLanguage', ''),\n\t\t\t\t('installationStepComplete_Core', 'no'),\n\t\t\t\t('installationComplete', 'no'),\n\t\t\t\t('installedDataTypes', ''),\n\t\t\t\t('installedExportTypes', ''),\n\t\t\t\t('installedCountries', ''),\n\t\t\t\t('allowAnonymousAccess', ''),\n\t\t\t\t('anonymousUserPermissionDeniedMsg', ''),\n\t\t\t\t('theme', '{$defaultTheme}')\n\t\t";
$queries[] = "\n\t\t\tCREATE TABLE {$prefix}sessions (\n\t\t\t\tsession_id varchar(100) NOT NULL default '',\n\t\t\t\tsession_data text NOT NULL,\n\t\t\t\texpires int(11) NOT NULL default '0',\n\t\t\t\tPRIMARY KEY (session_id)\n\t\t\t)\n\t\t";
$queries[] = "\n\t\t\tCREATE TABLE {$prefix}user_accounts (\n\t\t\t\taccount_id mediumint(8) unsigned NOT NULL auto_increment,\n\t\t\t\tdate_created datetime NOT NULL,\n\t\t\t\tlast_updated datetime NOT NULL,\n\t\t\t\tlast_logged_in datetime NULL,\n\t\t\t\tdate_expires datetime default NULL,\n\t\t\t\taccount_type ENUM('user', 'admin') NOT NULL,\n\t\t\t\tfirst_name varchar(50) default NULL,\n\t\t\t\tlast_name varchar(50) default NULL,\n\t\t\t\temail varchar(100) NOT NULL,\n\t\t\t\tpassword varchar(50) NOT NULL,\n\t\t\t\tpassword_recovery_question varchar(100) default NULL,\n\t\t\t\tpassword_recovery_answer varchar(100) default NULL,\n\t\t\t\tnum_rows_generated mediumint(9) default 0,\n\t\t\t\tmax_records mediumint(9) default NULL,\n\t\t\t\tPRIMARY KEY (account_id)\n\t\t\t)\n\t\t";
return Core::$db->query($queries, $rollbackQueries);
}
示例7: truncateDataSetHistory
/**
* Called after every save. This ensures the size of the history is truncated to whatever value is set (see
* the $maxDataSetHistorySize setting in Core.
* @param $configurationID
*/
private function truncateDataSetHistory($configurationID)
{
$prefix = Core::getDbTablePrefix();
$maxHistory = Core::getMaxDataSetHistorySize();
if (empty($maxHistory) || !is_numeric($maxHistory)) {
return;
}
// first, get the ID of the oldest saved history item, according to however large this
$response = Core::$db->query("\n SELECT *\n FROM {$prefix}configuration_history\n WHERE configuration_id = {$configurationID}\n ORDER BY history_id DESC\n LIMIT 1\n OFFSET {$maxHistory}\n ");
if ($response["success"] && !empty($response["results"])) {
$results = mysqli_fetch_assoc($response["results"]);
$historyID = $results["history_id"];
Core::$db->query("\n DELETE FROM {$prefix}configuration_history\n WHERE configuration_id = {$configurationID} AND history_id <= {$historyID}\n ");
}
}
示例8: getLipsum
/**
* Returns an array of lorem ipsum words. Assumes that a file exists in a misc/ subfolder called
* loremipsum.txt, containing lorem ipsum text.
*
* @return array a large array of words
*/
public static function getLipsum()
{
if (!self::$lipsumMemoized) {
$prefix = Core::getDbTablePrefix();
// grab all the words in the text files & put them in an array (1 word per index)
$response = Core::$db->query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM {$prefix}settings\n\t\t\t\tWHERE setting_name = 'lipsum'\n\t\t\t");
if ($response["success"]) {
$info = mysqli_fetch_assoc($response["results"]);
self::$lipsum = preg_split("/\\s+/", $info["setting_value"]);
}
self::$lipsumMemoized = true;
}
return self::$lipsum;
}
示例9: saveDataSetVisibilityStatus
/**
* Time is currently passed but not used. It's going to be used to ensure that only NEWEST requests
* actually update the record
*/
public function saveDataSetVisibilityStatus($configurationID, $status, $time)
{
if (!is_numeric($configurationID)) {
return;
}
$prefix = Core::getDbTablePrefix();
$accountID = $this->accountID;
$configurationID = mysql_real_escape_string($configurationID);
$status = mysql_real_escape_string($status);
$response = Core::$db->query("\n\t\t\tUPDATE {$prefix}configurations\n\t\t\tSET status = '{$status}'\n\t\t\tWHERE account_id = {$accountID} AND \n\t\t\t\t configuration_id = {$configurationID}\n\t\t");
if ($response["success"]) {
return array("success" => true, "message" => $configurationID, "newStatus" => $status);
} else {
return array("success" => false, "message" => "There was a problem saving the configuration: " . $response["errorMessage"]);
}
}
示例10: getRegions
function getRegions($countryID)
{
$prefix = Core::getDbTablePrefix();
$response = Core::$db->query("\n\t\t\tSELECT *\n\t\t\tFROM {$prefix}regions\n\t\t\tWHERE country_id = {$countryID}\n\t\t");
if ($response["success"]) {
$regionInfo = array();
while ($row = mysqli_fetch_assoc($response["results"])) {
$regionInfo[] = $row;
}
}
return $regionInfo;
}
示例11: header
<?php
require_once "library.php";
Core::init("installation");
// if the script is already installed, redirect them to the index page.
if (Core::checkIsInstalled()) {
header("location: index.php");
exit;
}
$currentPage = 1;
if (Core::checkSettingsFileExists()) {
$currentPage = 3;
if (Settings::getSetting("installationStepComplete_Core") == "yes") {
$currentPage = 4;
}
}
$params = array();
$params["theme"] = Core::getDefaultTheme();
$params["randomPassword"] = Utils::generateRandomAlphanumericStr("CVxxCxV");
$params["tablePrefix"] = Core::getDbTablePrefix();
$params["currentPage"] = $currentPage;
Templates::displayPage("resources/templates/install.tpl", $params);
示例12: populateDB
/**
* Helper function for country plugins to populate the database by simply passing the country data.
*
* @param string $countryName
* @param string $countrySlug
* @param array $data the data needs to be in the following format.
* $data = array(
* array(
* "regionName" => "",
* "regionShort" => "",
* "regionSlug" => "",
* "weight" => ".",
* "cities" => array(
* "A", "B", "C"
* )
* ),
* ...
* );
*/
public static function populateDB($countryName, $countrySlug, $data)
{
$prefix = Core::getDbTablePrefix();
$countryName = addslashes($countryName);
$countrySlug = addslashes($countrySlug);
// now insert the data
$queries = array();
$queries[] = "INSERT INTO {$prefix}countries (country, country_slug) VALUES ('{$countryName}', '{$countrySlug}')";
foreach ($data as $regionInfo) {
$currRegionName = addslashes($regionInfo["regionName"]);
$currRegionSlug = $regionInfo["regionSlug"];
$currRegionShort = addslashes($regionInfo["regionShort"]);
$queries[] = "\n\t\t\t\tINSERT INTO {$prefix}regions (country_slug, region, region_slug, region_short, weight)\n\t\t\t\tVALUES ('{$countrySlug}', '{$currRegionName}', '{$currRegionSlug}', '{$currRegionShort}', '{$regionInfo["weight"]}')\n\t\t\t";
$rows = array();
foreach ($regionInfo["cities"] as $cityName) {
$cityName = addslashes($cityName);
$rows[] = "('{$countrySlug}', '{$currRegionSlug}', '{$cityName}')";
}
$rowsStr = implode(",", $rows);
$queries[] = "\n\t\t\t\tINSERT INTO {$prefix}cities (country_slug, region_slug, city)\n\t\t\t\tVALUES {$rowsStr}\n\t\t\t";
}
$response = Core::$db->query($queries);
if ($response["success"]) {
return array(true, "");
} else {
//print_r($response);
//$this->uninstall();// TODO
return array(false, $response["errorMessage"]);
}
}
示例13: initCityData
private function initCityData()
{
$prefix = Core::getDbTablePrefix();
$response = Core::$db->query("\n\t\t\tSELECT *\n\t\t\tFROM {$prefix}cities\n\t\t\tORDER BY country_slug\n\t\t");
if (!$response["success"]) {
return;
}
$cityData = array();
while ($row = mysqli_fetch_assoc($response["results"])) {
$cityData[] = $row;
}
$this->cityData = $cityData;
}
示例14: getLipsum
/**
* Returns an array of lorem ipsum words. Assumes that a file exists in a misc/ subfolder called
* loremipsum.txt, containing lorem ipsum text.
*
* TODO this seems a good candidate to memoize...
*
* @return array a large array of words
*/
function getLipsum()
{
$prefix = Core::getDbTablePrefix();
// grab all the words in the text files & put them in an array (1 word per index)
$response = Core::$db->query("\n\t\t\tSELECT *\n\t\t\tFROM {$prefix}settings\n\t\t\tWHERE setting_name = 'lipsum'\n\t\t");
if ($response["success"]) {
$info = mysql_fetch_assoc($response["results"]);
$words = preg_split("/\\s+/", $info["setting_value"]);
return $words;
}
}