// create tables $facts_table = TABLE_PREFIX . 'facts'; $facts_table_sql =<<<SQL CREATE TABLE IF NOT EXISTS {$facts_table} ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `name` VARCHAR( 255 ) NULL DEFAULT NULL , `data` MEDIUMTEXT NULL DEFAULT NULL , `url` VARCHAR( 255 ) NULL DEFAULT NULL , `clicks` INT( 11 ) NOT NULL DEFAULT '0' , `created` DATETIME NULL DEFAULT NULL , `updated` DATETIME NULL DEFAULT NULL , PRIMARY KEY ( `id` ) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 SQL; if ( ! Installer::createTable($facts_table,$facts_table_sql) ) Installer::failInstall( 'facts', __('Could not create table 1 of 1.') ); // create new permissions if ( ! Installer::createPermissions('facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' ); // create new roles if ( ! Installer::createRoles('facts admin,facts editor,facts user') ) Installer::failInstall( 'facts' ); // assign permissions // note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface if ( ! Installer::assignPermissions('administrator','facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' ); if ( ! Installer::assignPermissions('editor','facts_view') ) Installer::failInstall( 'facts' ); if ( ! Installer::assignPermissions('facts admin','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' ); if ( ! Installer::assignPermissions('facts editor','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' ); if ( ! Installer::assignPermissions('facts user','admin_view,facts_view') ) Installer::failInstall( 'facts' );
`alttext` VARCHAR( 255 ) NULL DEFAULT NULL , `url` VARCHAR( 255 ) NULL DEFAULT NULL , `image` VARCHAR( 255 ) NULL DEFAULT NULL , `target` VARCHAR( 25 ) NULL DEFAULT NULL , `width` VARCHAR( 5 ) NULL DEFAULT NULL , `height` VARCHAR( 5 ) NULL DEFAULT NULL , `dcount` int(11) NOT NULL DEFAULT 0, `ccount` int(11) NOT NULL DEFAULT 0, `active` tinyint(1) NOT NULL DEFAULT 1, `created` DATETIME NULL DEFAULT NULL , `expires` DATE NULL DEFAULT NULL, `updated` DATETIME NULL DEFAULT NULL, PRIMARY KEY ( `id` ) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SQL; if ( ! Installer::createTable($banner_table,$banner_table_sql) ) Installer::failInstall( 'banner', __('Could not create table 1 of 1.') ); // create new permissions if ( ! Installer::createPermissions('banner_view,banner_new,banner_edit,banner_delete,banner_settings') ) Installer::failInstall('banner'); // create new roles if ( ! Installer::createRoles('banner admin,banner manager') ) Installer::failInstall('banner'); // assign permissions // note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface if ( ! Installer::assignPermissions('banner admin','admin_view,banner_view,banner_new,banner_edit,banner_delete,banner_settings') ) Installer::failInstall('banner'); if ( ! Installer::assignPermissions('banner manager','admin_view,banner_view,banner_new,banner_edit,banner_delete') ) Installer::failInstall('banner'); if ( ! Installer::assignPermissions('administrator','banner_view,banner_new,banner_edit,banner_delete,banner_settings') ) Installer::failInstall('banner'); // setup plugin settings $settings = array(
`hits` INT( 11 ) DEFAULT 0 NOT NULL , `created` DATETIME NULL DEFAULT NULL , `updated` DATETIME NULL DEFAULT NULL , PRIMARY KEY ( `id` ) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 SQL; $errors_table_sqlite =<<<SQL CREATE TABLE IF NOT EXISTS `{$errors_table}` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT , `url` VARCHAR( 255 ) , `hits` INT( 11 ) DEFAULT 0 NOT NULL , `created` DATETIME DEFAULT NULL , `updated` DATETIME DEFAULT NULL ) SQL; if ( ! Installer::createTable($errors_table,( $driver == 'mysql' ? $errors_table_mysql : $errors_table_sqlite )) ) Installer::failInstall( 'redirector', __('Could not create table 2 of 2.') ); // create new permissions if ( ! Installer::createPermissions('redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' ); // create new roles if ( ! Installer::createRoles('redirector admin,redirector editor,redirector user') ) Installer::failInstall( 'redirector' ); // assign permissions // note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface if ( ! Installer::assignPermissions('administrator','redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' ); if ( ! Installer::assignPermissions('editor','redirector_view') ) Installer::failInstall( 'redirector' ); if ( ! Installer::assignPermissions('redirector admin','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' ); if ( ! Installer::assignPermissions('redirector editor','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete') ) Installer::failInstall( 'redirector' ); if ( ! Installer::assignPermissions('redirector user','admin_view,redirector_view') ) Installer::failInstall( 'redirector' );
`name` VARCHAR( 255 ) NOT NULL , PRIMARY KEY ( `id` ) , UNIQUE ( `name` ) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 SQL; if ( ! Installer::createTable($downloadtags_table,$downloadtags_table_sql) ) Installer::failInstall( 'downloads', __('Could not create table 2 of 3.') ); $downloads_tags_table = TABLE_PREFIX.'downloads_tags'; $downloads_tags_table_sql =<<<SQL CREATE TABLE IF NOT EXISTS {$downloads_tags_table} ( `download_id` INT( 11 ) NOT NULL , `tag_id` INT( 11 ) NOT NULL, INDEX `download_tag` ( `download_id` , `tag_id` ) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 SQL; if ( ! Installer::createTable($downloads_tags_table,$downloads_tags_table_sql) ) Installer::failInstall( 'downloads', __('Could not create table 3 of 3.') ); // create new permissions if ( ! Installer::createPermissions('downloads_view,downloads_new,downloads_edit,downloads_delete,downloads_settings') ) Installer::failInstall('downloads'); // create new roles if ( ! Installer::createRoles('download manager admin,download manager editor,download manager user') ) Installer::failInstall('downloads'); // assign permissions // note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface if ( ! Installer::assignPermissions('download manager admin','admin_view,downloads_view,downloads_new,downloads_edit,downloads_delete,downloads_settings') ) Installer::failInstall('downloads'); if ( ! Installer::assignPermissions('download manager editor','admin_view,downloads_view,downloads_new,downloads_edit,downloads_delete') ) Installer::failInstall('downloads'); if ( ! Installer::assignPermissions('download manager user','admin_view,downloads_view') ) Installer::failInstall('downloads'); if ( ! Installer::assignPermissions('administrator','downloads_view,downloads_new,downloads_edit,downloads_delete,downloads_settings') ) Installer::failInstall('downloads'); // setup plugin settings