public function processDelete($table, $id_set) { if (_ControllerFront::$session->getPermissions('delete', $table)) { switch ($table) { default: foreach ($id_set as $id) { AdaptorMysql::sql("DELETE FROM `{$table}` WHERE id = {$id}"); $this->logChange($table, $id); } break; } } }
require $base . 'cms/_version.php'; $db = new AdaptorMysql(); // Check to see if we have a sufficient schema installed if ($db->query("SHOW TABLES LIKE 'cms_info'")) { if ($q = $db->queryRow("SELECT * FROM cms_info WHERE name = 'schema_version'")) { if ($q['value'] >= REQUIRED_SCHEMA_VERSION) { die('You have an up to date schema'); } } } //run schema patch $sql = "alter table `cms_cols` change column `edit_channel` `edit_channel` varchar(20) not null default '' after `default_value`;\nalter table `cms_cols` change column `edit_module` `edit_module` varchar(20) not null default '' after `edit_channel`;\nalter table `cms_cols` change column `edit_mode` `edit_mode` varchar(20) not null default '' after `edit_module`;\nalter table `cms_cols` change column `process_channel` `process_channel` varchar(20) not null default '' after `edit_config`;\nalter table `cms_cols` change column `process_mode` `process_mode` varchar(20) not null default '' after `process_module`;\nalter table `cms_headers` change column `mode` `mode` varchar(255) not null default '' after `table_name`;\nalter table `cms_relations` change column `display` `display` varchar(255) not null default '' after `column_child`;\nalter table `cms_tables` change column `display_mode` `display_mode` varchar(20) not null default '' after `sort_default`;\nCREATE TABLE `cms_info` (\n `name` varchar(40) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`name`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\ninsert into `cms_info` values('schema_version','1.0.14');"; $schema = explode(';', $sql); array_pop($schema); foreach ($schema as $row) { $db->sql($row); } function processTable($q, $table) { //prep columns from initial rowage global $db; foreach ($q as $row) { $sqlA = array(); foreach ($row as $key => $value) { if (!is_numeric($key) && $key != 'id') { if ($value != '') { if ($value = reformatData($value)) { $sqlA[] = array('field' => $key, 'value' => $value); } } }
public static function setTimezone($timezone = null) { date_default_timezone_set($timezone = $timezone ? $timezone : self::getTimezone()); //die(timezone_offset_get()); $offset = substr(strftime('%z', time()), 0, 3) . ':' . substr(strftime('%z', time()), 3); //die(date_default_timezone_get() .' : ' . $offset); // Set timezone for database connection (if a connection exists) if (class_exists('AdaptorMysql')) { AdaptorMysql::sql("SET time_zone = '{$offset}'"); } }
private function checkDB() { // If Blackbird database tables do not exist, create them using the schema.sql file if (!AdaptorMysql::query("SHOW TABLES LIKE '" . BLACKBIRD_TABLE_PREFIX . "%'")) { if ($schema = file_get_contents('..' . DS . INSTALL_FOLDER . DS . 'assets' . DS . 'sql' . DS . 'schema.sql')) { $schema = explode(';', $schema); array_pop($schema); foreach ($schema as $row) { AdaptorMysql::sql($row); } } else { die('Could not load SQL schema and data'); } } }