function isFree() { $rs = qdb("SELECT IS_FREE_LOCK('" . $this->lockname . "')"); $lock = (bool) result($rs, 0); mysqli_free_result($rs); return $lock; }
public function delete() { qdb("DELETE FROM `PREFIX_packages` WHERE `id` = %d", $this->id); delete_directory(dirname(__FILE__) . "/../packages/" . $this->name); self::update_lists(); }
function create_mysql_tables() { global $sql_tables; $queries = explode(";", $sql_tables); foreach ($queries as $q) { if (!empty($q)) { qdb($q); } } qdb("INSERT INTO `PREFIX_meta` (`key`, `value`) VALUES ('dbversion', ?)", base64_encode(serialize(1))); }
public function delete() { $tx = new Transaction(); try { $this->title->delete(); $this->text->delete(); $this->excerpt->delete(); foreach ($this->get_comments() as $comment) { $comment->delete(); } qdb("DELETE FROM `PREFIX_article_tag_relations` WHERE `article` = ?", $this->id); qdb("DELETE FROM `PREFIX_article_extradata` WHERE `article` = ?", $this->id); qdb("DELETE FROM `PREFIX_articles` WHERE `id` = ?", $this->id); $tx->commit(); } catch (Exception $e) { $tx->rollback(); throw $e; } }
/* Load and check config */ require_once dirname(__FILE__) . "/config.php"; if (!defined("CONFIG_FILLED_OUT")) { die("Config file not filled out."); } /* Include database functions... */ require_once dirname(__FILE__) . "/db.php"; db_connect(); /* create tables */ if (!SKIP_TABLE_CREATION) { $db_structure = "CREATE TABLE IF NOT EXISTS `PREFIX_packages` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` text COLLATE utf8_unicode_ci NOT NULL,\n `author` text COLLATE utf8_unicode_ci NOT NULL,\n `lastversion` int(11) NOT NULL,\n `user` int(11) NOT NULL,\n `description` text COLLATE utf8_unicode_ci NOT NULL,\n `lastupdate` bigint(20) NOT NULL,\n `txtversion` text COLLATE utf8_unicode_ci NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\nCREATE TABLE IF NOT EXISTS `PREFIX_settings_kvstorage` (\n `key` text COLLATE utf8_unicode_ci NOT NULL,\n `value` text COLLATE utf8_unicode_ci NOT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\nCREATE TABLE IF NOT EXISTS `PREFIX_users` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` text COLLATE utf8_unicode_ci NOT NULL,\n `pwhash` text COLLATE utf8_unicode_ci NOT NULL,\n `isadmin` tinyint(4) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; $queries = explode(";", $db_structure); foreach ($queries as $q) { if (!empty($q)) { qdb($q); } } } /* Include more files... */ require_once dirname(__FILE__) . "/ste.php"; require_once dirname(__FILE__) . "/models.php"; require_once dirname(__FILE__) . "/urlprocess.php"; require_once dirname(__FILE__) . "/pwhash.php"; require_once dirname(__FILE__) . "/pluginpackage.php"; require_once dirname(__FILE__) . "/utils.php"; /* init STE */ $tpl_basedir = dirname(__FILE__) . "/templates"; $ste = new \ste\STECore(new \ste\FilesystemStorageAccess("{$tpl_basedir}/src", "{$tpl_basedir}/transc")); $ste->register_tag("loremipsum", function ($ste, $params, $sub) { $repeats = empty($params["repeat"]) ? 1 : $params["repeat"] + 0;