Beispiel #1
0
 public function delete_note($noteId)
 {
     $db = new DBmanager();
     $dbh = $db->open_connection();
     $sth = $dbh->prepare('DELETE FROM notes WHERE id = ? ');
     $s = $sth->execute(array($noteId));
     unset($db);
     $dbh = null;
     return array("status" => $s);
 }
Beispiel #2
0
 function listasector()
 {
     $conn = new DBmanager();
     if ($conn->conectar() == true) {
         $query = "SELECT * FROM  tbl_sector ";
         $result = mysql_query($query);
         if (!$result) {
             return false;
         } else {
             mysql_close();
         }
         return $result;
     }
 }
 function up()
 {
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `lernmarktplatz_hosts` (\n                `host_id` varchar(32) NOT NULL PRIMARY KEY,\n                `name` varchar(64) NOT NULL,\n                `url` varchar(200) NOT NULL,\n                `public_key` text NOT NULL,\n                `private_key` text NULL,\n                `active` tinyint(4) NOT NULL DEFAULT '1',\n                `index_server` TINYINT NOT NULL DEFAULT '0',\n                `allowed_as_index_server` TINYINT NOT NULL DEFAULT '1',\n                `last_updated` bigint(20) NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                UNIQUE KEY `url` (`url`)\n            ) ENGINE=InnoDB\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `lernmarktplatz_material` (\n                `material_id` varchar(32) NOT NULL PRIMARY KEY,\n                `foreign_material_id` VARCHAR( 32 ) NULL,\n                `host_id` varchar(32) NULL,\n                `name` varchar(64) NOT NULL,\n                `filename` varchar(64) NOT NULL,\n                `short_description` VARCHAR(100) NULL,\n                `description` text NOT NULL,\n                `user_id` varchar(32) NOT NULL,\n                `content_type` varchar(64) NOT NULL,\n                `front_image_content_type` VARCHAR(64) NULL,\n                `structure` text NULL,\n                `rating` DOUBLE NULL,\n                `license` VARCHAR( 64 ) NOT NULL DEFAULT 'CC BY SA 3.0',\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` int(11) NOT NULL\n            ) ENGINE=InnoDB\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `lernmarktplatz_tags_material` (\n                `material_id` varchar(32) NOT NULL,\n                `tag_hash` varchar(32) NOT NULL,\n                UNIQUE KEY `unique_tags` (`material_id`,`tag_hash`),\n                KEY `tag_hash` (`tag_hash`),\n                KEY `material_id` (`material_id`)\n            ) ENGINE=InnoDB\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `lernmarktplatz_tags` (\n                `tag_hash` varchar(32) NOT NULL,\n                `name` varchar(64) NOT NULL,\n                PRIMARY KEY (`tag_hash`)\n            ) ENGINE=InnoDB\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `lernmarktplatz_user` (\n                `user_id` varchar(32) NOT NULL,\n                `foreign_user_id` varchar(32) NOT NULL,\n                `host_id` varchar(32) NOT NULL,\n                `name` varchar(100) NOT NULL,\n                `avatar` varchar(256) DEFAULT NULL,\n                `description` TEXT NULL,\n                `chdate` int(11) NOT NULL,\n                `mkdate` int(11) NOT NULL,\n                PRIMARY KEY (`user_id`),\n                UNIQUE KEY `unique_users` (`foreign_user_id`,`host_id`),\n                KEY `foreign_user_id` (`foreign_user_id`),\n                KEY `host_id` (`host_id`)\n            ) ENGINE=InnoDB\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `lernmarktplatz_reviews` (\n                `review_id` varchar(32) NOT NULL,\n                `material_id` varchar(32) NOT NULL,\n                `foreign_review_id` varchar(32) NULL,\n                `user_id` varchar(32) NOT NULL,\n                `host_id` varchar(32) NULL,\n                `rating` int(11) NOT NULL,\n                `review` TEXT NOT NULL,\n                `chdate` int(11) NOT NULL,\n                `mkdate` int(11) NOT NULL,\n                PRIMARY KEY (`review_id`),\n                UNIQUE KEY `unique_users` (`user_id`,`host_id`, `material_id`),\n                KEY `material_id` (`material_id`),\n                KEY `foreign_review_id` (`foreign_review_id`),\n                KEY `user_id` (`user_id`),\n                KEY `host_id` (`host_id`)\n            ) ENGINE=InnoDB\n        ");
     DBmanager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `lernmarktplatz_comments` (\n                `comment_id` varchar(32) NOT NULL,\n                `review_id` varchar(32) NOT NULL,\n                `foreign_comment_id` varchar(32) DEFAULT NULL,\n                `comment` text NOT NULL,\n                `host_id` varchar(32) DEFAULT NULL,\n                `user_id` varchar(32) NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                PRIMARY KEY (`comment_id`),\n                KEY `review_id` (`review_id`),\n                KEY `foreign_comment_id` (`foreign_comment_id`),\n                KEY `host_id` (`host_id`),\n                KEY `user_id` (`user_id`)\n            ) ENGINE=InnoDB\n        ");
     DBManager::get()->exec("\n            INSERT IGNORE INTO datafields\n            SET datafield_id = MD5('Lernmarktplatz-Beschreibung'),\n                name = 'Lernmarktplatz-Beschreibung',\n                object_type = 'user',\n                edit_perms = 'user',\n                view_perms = 'user',\n                priority = 0,\n                mkdate = UNIX_TIMESTAMP(),\n                chdate = UNIX_TIMESTAMP(),\n                `type` = 'textarea',\n                typeparam = '',\n                description = 'Geben Sie eine kurze Beschreibung für Sich ab, die auf Ihrem Profil im Lernmarktplatz sichtbar ist.'\n        ");
     DBManager::get()->exec("\n            INSERT IGNORE INTO `config` (`config_id`, `parent_id`, `field`, `value`, `is_default`, `type`, `range`, `section`, `position`, `mkdate`, `chdate`, `description`, `comment`, `message_template`)\n            VALUES\n                (MD5('LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD'), '', 'LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD', MD5('Lernmarktplatz-Beschreibung'), MD5('Lernmarktplatz-Beschreibung'), 'string', 'global', 'LERNMARKTPLATZ', 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 'MD5-Hash or name of datafield that is representing the user-description', '', '')\n        ");
 }