public static function es_synctables()
 {
     $es_c_email_subscribers_ver = get_option('email-subscribers');
     if ($es_c_email_subscribers_ver != "2.9") {
         global $wpdb;
         // loading the sql file, load it and separate the queries
         $sql_file = ES_DIR . 'sql' . DS . 'es-createdb.sql';
         $prefix = $wpdb->prefix;
         $handle = fopen($sql_file, 'r');
         $query = fread($handle, filesize($sql_file));
         fclose($handle);
         $query = str_replace('CREATE TABLE IF NOT EXISTS ', 'CREATE TABLE ' . $prefix, $query);
         $query = str_replace('ENGINE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci*/', '', $query);
         $queries = explode('-- SQLQUERY ---', $query);
         // includes db upgrade file
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         // run the queries one by one
         foreach ($queries as $sSql) {
             dbDelta($sSql);
         }
         $guid = es_cls_common::es_generate_guid(60);
         $home_url = home_url('/');
         $cronurl = $home_url . "?es=cron&guid=" . $guid;
         add_option('es_c_cronurl', $cronurl);
         add_option('es_cron_mailcount', "50");
         add_option('es_cron_adminmail', "Hi Admin, \r\n\r\nCron URL has been triggered successfully on ###DATE### for the mail ###SUBJECT###. And it sent mail to ###COUNT### recipient. \r\n\r\nThank You");
         update_option('email-subscribers', "2.9");
     }
 }
Example #2
2
/**
 * Create base pages, add roles, add caps and create tables
 * @param $network_wide
 */
function anspress_activate($network_wide)
{
    // add roles
    $ap_roles = new AP_Roles();
    $ap_roles->add_roles();
    $ap_roles->add_capabilities();
    ap_create_base_page();
    if (ap_opt('ap_version') != AP_VERSION) {
        ap_opt('ap_installed', 'false');
        ap_opt('ap_version', AP_VERSION);
    }
    global $wpdb;
    /**
     * Run DB quries only if AP_DB_VERSION does not match
     */
    if (ap_opt('ap_db_version') != AP_DB_VERSION) {
        $charset_collate = !empty($wpdb->charset) ? "DEFAULT CHARACTER SET " . $wpdb->charset : '';
        $meta_table = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "ap_meta` (\n\t\t\t\t  `apmeta_id` bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\t\t  `apmeta_userid` bigint(20) DEFAULT NULL,\n\t\t\t\t  `apmeta_type` varchar(256) DEFAULT NULL,\n\t\t\t\t  `apmeta_actionid` bigint(20) DEFAULT NULL,\n\t\t\t\t  `apmeta_value` text,\n\t\t\t\t  `apmeta_param` LONGTEXT DEFAULT NULL,\n\t\t\t\t  `apmeta_date` timestamp NULL DEFAULT NULL,\n\t\t\t\t  PRIMARY KEY (`apmeta_id`)\n\t\t\t\t)" . $charset_collate . ";";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($meta_table);
        ap_opt('ap_db_version', AP_DB_VERSION);
    }
    if (!get_option('anspress_opt')) {
        update_option('anspress_opt', ap_default_options());
    } else {
        update_option('anspress_opt', get_option('anspress_opt') + ap_default_options());
    }
    ap_opt('ap_flush', 'true');
    flush_rewrite_rules(false);
}
 public static function activate()
 {
     global $wpdb;
     global $charset_collate;
     $table_name = $wpdb->prefix . 'gps_locations';
     $sql = "DROP TABLE IF EXISTS {$table_name};  \n              CREATE TABLE {$table_name} (\n              gps_location_id int(10) unsigned NOT NULL AUTO_INCREMENT,\n              last_update timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n              latitude decimal(10,6) NOT NULL DEFAULT '0.000000',\n              longitude decimal(10,6) NOT NULL DEFAULT '0.000000',\n              user_name varchar(50) NOT NULL DEFAULT '',\n              session_id varchar(50) NOT NULL DEFAULT '',\n              speed int(10) unsigned NOT NULL DEFAULT '0',\n              direction int(10) unsigned NOT NULL DEFAULT '0',\n              distance decimal(10,1) NOT NULL DEFAULT '0.0',\n              gps_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',\n              location_method varchar(50) NOT NULL DEFAULT '',\n              accuracy int(10) unsigned NOT NULL DEFAULT '0',\n              extra_info varchar(255) NOT NULL DEFAULT '',\n              event_type varchar(50) NOT NULL DEFAULT '',\n              UNIQUE KEY (gps_location_id),\n              KEY session_id_index (session_id),\n              KEY user_name_index (user_name)\n            ) {$charset_collate};";
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
     $location_row_count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name};");
     if ($location_row_count == 0) {
         $sql = "INSERT INTO {$table_name} VALUES (1,'2007-01-03 11:37:00',47.61,-122.33,'wordpressUser','8BA21D90-3F90-407F-BAAE-800B04B1F5EC',0,0,0.0,'2007-01-03 13:37:00','na',137,'na','wordpress');";
         $wpdb->query($sql);
     }
     $procedure_name = $wpdb->prefix . "get_routes";
     $wpdb->query("DROP PROCEDURE IF EXISTS {$procedure_name};");
     $sql = "CREATE PROCEDURE {$procedure_name}()\n            BEGIN\n            CREATE TEMPORARY TABLE temp_routes (\n                session_id VARCHAR(50),\n                user_name VARCHAR(50),\n                start_time DATETIME,\n                end_time DATETIME)\n                ENGINE = MEMORY;\n\n            INSERT INTO temp_routes (session_id, user_name)\n            SELECT DISTINCT session_id, user_name\n            FROM {$table_name};\n\n            UPDATE temp_routes tr\n            SET start_time = (SELECT MIN(gps_time) FROM {$table_name} gl\n            WHERE gl.session_id = tr.session_id\n            AND gl.user_name = tr.user_name);\n\n            UPDATE temp_routes tr\n            SET end_time = (SELECT MAX(gps_time) FROM {$table_name} gl\n            WHERE gl.session_id = tr.session_id\n            AND gl.user_name = tr.user_name);\n\n            SELECT\n            CONCAT('{ \"session_id\": \"', CAST(session_id AS CHAR),  '\", \"user_name\": \"', user_name, '\", \"times\": \"(', DATE_FORMAT(start_time, '%b %e %Y %h:%i%p'), ' - ', DATE_FORMAT(end_time, '%b %e %Y %h:%i%p'), ')\" }') json\n            FROM temp_routes\n            ORDER BY start_time DESC;\n\n            DROP TABLE temp_routes;\n            END;";
     $wpdb->query($sql);
     // $wpdb->print_error();
     $procedure_name = $wpdb->prefix . "get_route_for_map";
     $wpdb->query("DROP PROCEDURE IF EXISTS {$procedure_name};");
     $sql = "CREATE PROCEDURE {$procedure_name}(\n            _session_id VARCHAR(50))\n            BEGIN\n            SELECT\n            CONCAT('{ \"latitude\": \"', CAST(latitude AS CHAR),'\", \"longitude\": \"', CAST(longitude AS CHAR), '\", \"speed\": \"', CAST(speed AS CHAR), '\", \"direction\": \"', CAST(direction AS CHAR), '\", \"distance\": \"', CAST(distance AS CHAR), '\", \"location_method\": \"', location_method, '\", \"gps_time\": \"', DATE_FORMAT(gps_time, '%b %e %Y %h:%i%p'), '\", \"user_name\": \"', user_name, '\", \"session_id\": \"', CAST(session_id AS CHAR), '\", \"accuracy\": \"', CAST(accuracy AS CHAR), '\", \"extra_info\": \"', extra_info, '\" }') json\n            FROM {$table_name}\n            WHERE session_id = _session_id\n            ORDER BY last_update;\n            END;";
     $wpdb->query($sql);
     $procedure_name = $wpdb->prefix . "delete_route";
     $wpdb->query("DROP PROCEDURE IF EXISTS {$procedure_name};");
     $sql = "CREATE PROCEDURE {$procedure_name}(\n            _session_id VARCHAR(50))\n            BEGIN\n            DELETE FROM {$table_name}\n            WHERE sessionID = _sessionID;\n            END;";
     $wpdb->query($sql);
 }
Example #4
1
function set_up_options()
{
    global $wpdb;
    $table_name = $wpdb->prefix . 'chatwee_moderators';
    $sql = "CREATE TABLE {$table_name} (\r\n\t\t  id int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t  user_id int(11) DEFAULT NULL,\r\n\t\t  UNIQUE KEY id (id)\r\n\t\t);";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
    register_setting('chatwee-settings-group', 'is_home');
    register_setting('chatwee-settings-group', 'is_search');
    register_setting('chatwee-settings-group', 'is_archive');
    register_setting('chatwee-settings-group', 'is_page');
    register_setting('chatwee-settings-group', 'is_single');
    register_setting('chatwee-settings-group', 'ssostatus');
    register_setting('chatwee-settings-group', 'clientid');
    register_setting('chatwee-settings-group', 'keyapi');
    register_setting('chatwee-settings-group', 'loginallsubdomains');
    register_setting('chatwee-settings-group', 'group_moderators_editor');
    register_setting('chatwee-settings-group', 'group_moderators_author');
    register_setting('chatwee-settings-group', 'group_moderators_contributor');
    register_setting('chatwee-settings-group', 'group_moderators_subscriber');
    register_setting('chatwee-settings-group', 'display_format');
    update_option('chatwee-settings-group[is_home]', "on");
    update_option('chatwee-settings-group[display_format]', 0);
    update_option('chatwee-settings-group[is_search]', "on");
    update_option('chatwee-settings-group[is_archive]', "on");
    update_option('chatwee-settings-group[is_single]', "on");
    update_option('chatwee-settings-group[is_page]', "on");
    update_option('chatwee-settings-group[ssostatus]', "on");
    update_option('chatwee-settings-group[loginallsubdomains]', "on");
    update_option('chatwee', "");
}
/**
 * @file
 * Install functions for the Easy Contact Forms plugin.
 */
function easycontactforms_install()
{
    global $wpdb;
    $collate = '';
    if (!empty($wpdb->charset)) {
        $collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
    }
    if (!empty($wpdb->collate)) {
        $collate .= ' COLLATE ' . $wpdb->collate;
    }
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    require_once dirName(__FILE__) . DIRECTORY_SEPARATOR . 'easy-contact-forms-database.php';
    $sqls = array();
    $sqls[] = "CREATE TABLE #wp__easycontactforms_applicationsettings (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tTinyMCEConfig text,\n\t\t\t\tUseTinyMCE tinyint(1),\n\t\t\t\tApplicationWidth int(10),\n\t\t\t\tApplicationWidth2 int(10),\n\t\t\t\tDefaultStyle varchar(50),\n\t\t\t\tDefaultStyle2 varchar(50),\n\t\t\t\tSecretWord varchar(50),\n\t\t\t\tNotLoggenInText text,\n\t\t\t\tFileFolder varchar(900),\n\t\t\t\tSendFrom varchar(100),\n\t\t\t\tFixJSLoading tinyint(1),\n\t\t\t\tFormCompletionMinTime int(10),\n\t\t\t\tFormCompletionMaxTime int(10),\n\t\t\t\tFixStatus0 tinyint(1),\n\t\t\t\tProductVersion varchar(25),\n\t\t\t\tPhoneRegEx varchar(100),\n\t\t\t\tInitTime int(11),\n\t\t\t\tShowPoweredBy tinyint(1),\n\t\t\t\tDateFormat varchar(500),\n\t\t\t\tDateTimeFormat varchar(500),\n\t\t\t\tFixStatus02 tinyint(1),\n\t\t\t\tw3cCompliant tinyint(1),\n\t\t\t\tw3cStyle varchar(50),\n\t\t\t\tFixJSLoading2 tinyint(1),\n\t\t\t\tAllowMarkupInEntries tinyint(1),\n\t\t\t\tSkipWeeklyReport tinyint(1),\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY Description (Description)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_contacttypes (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tNotes text,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY Description (Description)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_customformentryfiles (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tDate int(11),\n\t\t\t\tCustomFormsEntries int(11) NOT NULL DEFAULT 0,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY Description (Description),\n\t\t\t\tKEY CustomFormsEntries (CustomFormsEntries)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_customformentrystatistics (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tPageName varchar(300),\n\t\t\t\tTotalEntries int(10),\n\t\t\t\tIncludeIntoReporting tinyint(1),\n\t\t\t\tCustomForms int(11) NOT NULL DEFAULT 0,\n\t\t\t\tImpressions int(10),\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY CustomForms (CustomForms)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_customformfields (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tType int(11) NOT NULL DEFAULT 0,\n\t\t\t\tSettings text,\n\t\t\t\tTemplate text,\n\t\t\t\tListPosition int(10) NOT NULL DEFAULT 0,\n\t\t\t\tCustomForms int(11) NOT NULL DEFAULT 0,\n\t\t\t\tFieldSet int(10),\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY FieldSet (FieldSet),\n\t\t\t\tKEY Description (Description),\n\t\t\t\tKEY CustomForms (CustomForms),\n\t\t\t\tKEY Type (Type),\n\t\t\t\tKEY ListPosition (ListPosition)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_customformfieldtypes (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tCssClass varchar(100),\n\t\t\t\tSettings text,\n\t\t\t\tSignature text,\n\t\t\t\tListPosition int(10) NOT NULL DEFAULT 0,\n\t\t\t\tValueField tinyint(1),\n\t\t\t\tHelpLink text,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY Description (Description),\n\t\t\t\tKEY ListPosition (ListPosition)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_customforms (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tNotificationSubject varchar(200),\n\t\t\t\tSendFrom varchar(200),\n\t\t\t\tSendConfirmation tinyint(1),\n\t\t\t\tConfirmationSubject varchar(200),\n\t\t\t\tConfirmationText text,\n\t\t\t\tRedirect tinyint(1),\n\t\t\t\tRedirectURL text,\n\t\t\t\tShortCode varchar(300),\n\t\t\t\tTemplate tinyint(1),\n\t\t\t\tObjectOwner int(11) NOT NULL DEFAULT 0,\n\t\t\t\tSubmissionSuccessText text,\n\t\t\t\tStyleSheet text,\n\t\t\t\tHTML mediumtext,\n\t\t\t\tSendFromAddress varchar(200),\n\t\t\t\tShowSubmissionSuccess tinyint(1),\n\t\t\t\tSuccessMessageClass varchar(200),\n\t\t\t\tFailureMessageClass varchar(200),\n\t\t\t\tWidth int(10),\n\t\t\t\tWidthUnit varchar(5),\n\t\t\t\tLineHeight int(10),\n\t\t\t\tLineHeightUnit varchar(5),\n\t\t\t\tFormClass varchar(200),\n\t\t\t\tFormStyle text,\n\t\t\t\tStyle varchar(50),\n\t\t\t\tConfirmationStyleSheet text,\n\t\t\t\tTotalEntries int(10),\n\t\t\t\tTotalProcessedEntries int(10),\n\t\t\t\tImpressions int(10),\n\t\t\t\tNotificationText text,\n\t\t\t\tIncludeVisitorsAddressInReplyTo tinyint(1),\n\t\t\t\tReplyToNameTemplate varchar(200),\n\t\t\t\tConfirmationReplyToName varchar(200),\n\t\t\t\tConfirmationReplyToAddress varchar(200),\n\t\t\t\tNotificationStyleSheet text,\n\t\t\t\tSendConfirmationAsText tinyint(1),\n\t\t\t\tSendNotificationAsText tinyint(1),\n\t\t\t\tFadingDelay int(10),\n\t\t\t\tMessageDelay int(10),\n\t\t\t\tIncludeIntoReporting tinyint(1),\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY ObjectOwner (ObjectOwner),\n\t\t\t\tKEY Description (Description)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_customforms_mailinglists (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tCustomForms int(11) NOT NULL DEFAULT 0,\n\t\t\t\tContacts int(11) NOT NULL DEFAULT 0,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY CustomForms (CustomForms),\n\t\t\t\tKEY Contacts (Contacts)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_customformsentries (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDate int(11),\n\t\t\t\tContent mediumtext,\n\t\t\t\tHeader text,\n\t\t\t\tData text,\n\t\t\t\tCustomForms int(11) NOT NULL DEFAULT 0,\n\t\t\t\tUsers int(11) NOT NULL DEFAULT 0,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tSiteUser int(11) NOT NULL DEFAULT 0,\n\t\t\t\tPageName varchar(300),\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY Description (Description),\n\t\t\t\tKEY CustomForms (CustomForms),\n\t\t\t\tKEY Users (Users),\n\t\t\t\tKEY SiteUser (SiteUser)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_files (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDoctype varchar(80),\n\t\t\t\tDocfield varchar(80),\n\t\t\t\tDocid int(10),\n\t\t\t\tName varchar(300),\n\t\t\t\tType varchar(80),\n\t\t\t\tSize int(10),\n\t\t\t\tProtected tinyint(1),\n\t\t\t\tWebdir tinyint(1),\n\t\t\t\tCount int(11),\n\t\t\t\tStoragename varchar(300),\n\t\t\t\tObjectOwner int(11),\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY Docid (Docid),\n\t\t\t\tKEY typefieldid (Doctype,Docfield,Docid),\n\t\t\t\tKEY ObjectOwner (ObjectOwner)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_options (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tOptionGroup varchar(20),\n\t\t\t\tValue text,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY OptionGroup (OptionGroup),\n\t\t\t\tKEY Description (Description)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_roles (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(100) NOT NULL DEFAULT '',\n\t\t\t\tAdmin tinyint(1),\n\t\t\t\tEmployee tinyint(1),\n\t\t\t\tPRIMARY KEY  (id)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_users (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tDescription varchar(200) NOT NULL DEFAULT '',\n\t\t\t\tName varchar(100),\n\t\t\t\tContactType int(11) NOT NULL DEFAULT 0,\n\t\t\t\tBirthday int(11),\n\t\t\t\tRole int(11) NOT NULL DEFAULT 0,\n\t\t\t\tCMSId int(11),\n\t\t\t\tNotes text,\n\t\t\t\temail varchar(100),\n\t\t\t\temail2 varchar(100),\n\t\t\t\tCell varchar(30),\n\t\t\t\tPhone1 varchar(30),\n\t\t\t\tPhone2 varchar(30),\n\t\t\t\tPhone3 varchar(30),\n\t\t\t\tSkypeId varchar(100),\n\t\t\t\tWebsite varchar(200),\n\t\t\t\tContactField3 text,\n\t\t\t\tContactField4 text,\n\t\t\t\tCountry varchar(300),\n\t\t\t\tAddress text,\n\t\t\t\tCity varchar(300),\n\t\t\t\tState varchar(300),\n\t\t\t\tZip varchar(20),\n\t\t\t\tComment text,\n\t\t\t\tHistory text,\n\t\t\t\tOptions text,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY ContactType (ContactType),\n\t\t\t\tKEY CMSId (CMSId),\n\t\t\t\tKEY Description (Description),\n\t\t\t\tKEY Role (Role),\n\t\t\t\tKEY descriptionname (Description,Name)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_acl (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tobjtype varchar(50) NOT NULL,\n\t\t\t\tmethod varchar(50) NOT NULL,\n\t\t\t\tname varchar(50) NOT NULL,\n\t\t\t\trole varchar(50) NOT NULL,\n\t\t\t\tPRIMARY KEY  (id)) {$collate};";
    $sqls[] = "CREATE TABLE #wp__easycontactforms_sessions (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\topentime timestamp DEFAULT CURRENT_TIMESTAMP,\n\t\t\t\tvalue text,\n\t\t\t\tsid char(32) NOT NULL,\n\t\t\t\tPRIMARY KEY  (id)) {$collate};";
    foreach ($sqls as $sql) {
        $sql = EasyContactFormsDB::wptn($sql);
        dbDelta($sql);
    }
}
/**
 * Set basic settings on the activation of the plugin.
 * - Saved in 'options' table.
 * - Creating custom table for storing email addresses.
 * ------------------------------------------------------------------------------
 */
function nanodesigns_email_downloads_activate()
{
    /**
     * Creating a custom table.
     * @since 1.0.1
     * -----------
     */
    global $wpdb, $nano_db_version;
    $table = $wpdb->prefix . 'download_email';
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table}'") != $table) {
        $sql = "CREATE TABLE {$table} (\n                  id mediumint(9) NOT NULL AUTO_INCREMENT,\n                  email tinytext NOT NULL,\n                  UNIQUE KEY id (id)\n                );";
        //reference to upgrade.php file
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
    }
    //endif($wpdb->get_var
    update_option("nano_ed_db_version", $nano_db_version);
    /**
     * Add the necessary default settings to the 'options table'.
     * @since 1.0.0
     * -----------
     */
    $noreply_email = noreply_email();
    $admin_email = get_option('admin_email');
    $admin_user = get_user_by('email', $admin_email);
    $ed_settings = array('ed_sender_email' => $noreply_email, 'ed_sender_name' => $admin_user->display_name);
    update_option('email_downloads_settings', $ed_settings);
}
 /**
  * Generates the index table if it does not exist
  */
 function createIndexTable()
 {
     global $wpdb;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $charset_collate = "";
     if (!empty($wpdb->charset)) {
         $charset_collate_bin_column = "CHARACTER SET {$wpdb->charset}";
         $charset_collate = "DEFAULT {$charset_collate_bin_column}";
     }
     if (strpos($wpdb->collate, "_") > 0) {
         $charset_collate .= " COLLATE {$wpdb->collate}";
     }
     $table_name = $this->asp_index_table;
     $query = "\n\t\t\t\tCREATE TABLE IF NOT EXISTS " . $table_name . " (\n\t\t\t\t\tdoc bigint(20) NOT NULL DEFAULT '0',\n\t\t\t\t\tterm varchar(50) NOT NULL DEFAULT '0',\n\t\t\t\t\tterm_reverse varchar(50) NOT NULL DEFAULT '0',\n\t\t\t\t\tblogid mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\tcontent mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\ttitle mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\tcomment mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\ttag mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\tlink mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\tauthor mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\tcategory mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\texcerpt mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\ttaxonomy mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\tcustomfield mediumint(9) NOT NULL DEFAULT '0',\n\t\t\t\t\tpost_type varchar(50) NOT NULL DEFAULT 'post',\n\t\t\t\t\titem bigint(20) NOT NULL DEFAULT '0',\n\t\t\t\t\tlang varchar(20) NOT NULL DEFAULT '0',\n\t\t\t    UNIQUE KEY doctermitem (doc, term, blogid)) {$charset_collate}";
     dbDelta($query);
     $query = "SHOW INDEX FROM {$table_name}";
     $indices = $wpdb->get_results($query);
     $existing_indices = array();
     foreach ($indices as $index) {
         if (isset($index->Key_name)) {
             $existing_indices[] = $index->Key_name;
         }
     }
     // Worst case scenario optimal indexes
     if (!in_array('term_ptype_bid_lang', $existing_indices)) {
         $sql = "CREATE INDEX term_ptype_bid_lang ON {$table_name} (term(20), post_type(20), blogid, lang(10))";
         $wpdb->query($sql);
     }
     if (!in_array('rterm_ptype_bid_lang', $existing_indices)) {
         $sql = "CREATE INDEX rterm_ptype_bid_lang ON {$table_name} (term_reverse(20), post_type(20), blogid, lang(10))";
         $wpdb->query($sql);
     }
 }
/**
 * PR fetcher installation
 */
function prtools_install()
{
    global $wpdb;
    global $prtools_url_table;
    global $prtools_pr_table;
    /**
     * Installing tables
     */
    if ($wpdb->get_var("SHOW TABLES LIKE '" . $prtools_url_table . "'") != $prtools_url_table) {
        $sql = "CREATE TABLE " . $prtools_url_table . " (\n\t\tID int(11) NOT NULL AUTO_INCREMENT,\n\t\tentrydate int(11) DEFAULT '0' NOT NULL,\n\t\tlastupdate int(11) DEFAULT '0' NOT NULL,\n\t\tlastcheck int(11) NOT NULL,\n\t\turl_type char(50) NOT NULL,\n\t\turl VARCHAR(500) NOT NULL,\n\t\ttitle text NOT NULL,\n\t\tpr int(11) NOT NULL,\n\t\tdiff_last_pr int(1) NOT NULL,\n\t\tpr_entries int(11) NOT NULL,\n\t\tUNIQUE KEY id (id)\n\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
    }
    if ($wpdb->get_var("SHOW TABLES LIKE '" . $prtools_pr_table . "'") != $prtools_pr_table) {
        $sql = "CREATE TABLE " . $prtools_pr_table . " (\n\t\tID int(11) NOT NULL AUTO_INCREMENT,\n\t\tentrydate int(11) DEFAULT '0' NOT NULL,\n\t\turl VARCHAR(500) NOT NULL,\n\t\tpr int(11) NOT NULL,\n\t\tUNIQUE KEY id (id)\n\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
    }
    update_url_table();
    add_option("prtools_db_version", '1.0');
    /**
     * Setting standard options
     */
    if (get_option('pagerank_tools_settings') == "") {
        $prtools_settings['fetch_interval'] = 5;
        $prtools_settings['fetch_url_interval'] = 120;
        $prtools_settings['fetch_url_interval_new'] = 14;
        $prtools_settings['fetch_num'] = 1;
        $prtools_settings['fetch_titles_num'] = 2;
        $prtools_settings['running_number'] = 1;
        update_option('pagerank_tools_settings', $prtools_settings);
    }
}
/**
 * Activation/Installation
 */
function tm_password_install()
{
    global $wpdb;
    $sql = "CREATE TABLE " . tm_password_TABLE_NAME . " (\n\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\tusername varchar(255),\n\t\tpassword varchar(255),\n\t\tUNIQUE KEY id (id)\n\t);";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
}
Example #10
0
 public static function es_af_activation()
 {
     global $wpdb;
     $es_af_pluginversion = "";
     $es_af_tableexists = "YES";
     $es_af_pluginversion = get_option("es_af_pluginversion");
     $es_af_dbtable = $wpdb->get_var("show tables like '" . $wpdb->prefix . ES_AF_TABLE . "'");
     if ($es_af_dbtable != "") {
         if (strtoupper($es_af_dbtable) != strtoupper($wpdb->prefix . ES_AF_TABLE)) {
             $es_af_tableexists = "NO";
         }
     } else {
         $es_af_tableexists = "NO";
     }
     if ($es_af_tableexists == "NO" || $es_af_pluginversion != ES_AF_DBVERSION) {
         $sSql = "CREATE TABLE " . $wpdb->prefix . ES_AF_TABLE . " (\n\t\t\t\t es_af_id mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t es_af_title VARCHAR(1024) DEFAULT 'Advanced Form 1' NOT NULL,\n\t\t\t\t es_af_desc VARCHAR(1024) DEFAULT 'Welcome to Email Subscribers Advanced Form' NOT NULL,\n\t\t\t\t es_af_name VARCHAR(20) DEFAULT 'YES' NOT NULL,\n\t\t\t\t es_af_name_mand VARCHAR(20) DEFAULT 'YES' NOT NULL,\t \n\t\t\t\t es_af_email VARCHAR(20) DEFAULT 'YES' NOT NULL,\n\t\t\t\t es_af_email_mand VARCHAR(20) DEFAULT 'YES' NOT NULL,\n\t\t\t\t es_af_group VARCHAR(20) DEFAULT 'YES' NOT NULL,\n\t\t\t\t es_af_group_mand VARCHAR(20) DEFAULT 'YES' NOT NULL,\n\t\t\t\t es_af_group_list VARCHAR(1024) DEFAULT 'Public' NOT NULL,\n\t\t\t\t es_af_plugin VARCHAR(20) DEFAULT 'es-af' NOT NULL,\n\t\t\t\t UNIQUE KEY es_af_id (es_af_id)\n\t\t\t  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;";
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         dbDelta($sSql);
         if ($es_af_pluginversion == "") {
             add_option('es_af_pluginversion', "1.0");
         } else {
             update_option("es_af_pluginversion", ES_AF_DBVERSION);
         }
         if ($es_af_tableexists == "NO") {
             $welcome_text = "Advanced Form 1";
             $rows_affected = $wpdb->insert($wpdb->prefix . ES_AF_TABLE, array('es_af_title' => $welcome_text));
         }
     }
 }
Example #11
0
/**
 * Runs the SQL query for installing/upgrading a table
 *
 * @param string $key The key used in scb_register_table()
 * @param string $columns The SQL columns for the CREATE TABLE statement
 * @param array $opts Various other options
 */
function scb_install_table($key, $columns, $opts = array())
{
    global $wpdb;
    $full_table_name = $wpdb->{$key};
    if (is_string($opts)) {
        $opts = array('upgrade_method' => $opts);
    }
    $opts = wp_parse_args($opts, array('upgrade_method' => 'dbDelta', 'table_options' => ''));
    $charset_collate = '';
    if ($wpdb->has_cap('collation')) {
        if (!empty($wpdb->charset)) {
            $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
        }
        if (!empty($wpdb->collate)) {
            $charset_collate .= " COLLATE {$wpdb->collate}";
        }
    }
    $table_options = $charset_collate . ' ' . $opts['table_options'];
    if ('dbDelta' == $opts['upgrade_method']) {
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta("CREATE TABLE {$full_table_name} ( {$columns} ) {$table_options}");
        return;
    }
    if ('delete_first' == $opts['upgrade_method']) {
        $wpdb->query("DROP TABLE IF EXISTS {$full_table_name};");
    }
    $wpdb->query("CREATE TABLE IF NOT EXISTS {$full_table_name} ( {$columns} ) {$table_options};");
}
 protected function delta($query)
 {
     if (!function_exists('dbDelta')) {
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     }
     return dbDelta($query);
 }
function fep_plugin_activate()
{
    global $wpdb;
    $charset_collate = '';
    if ($wpdb->has_cap('collation')) {
        if (!empty($wpdb->charset)) {
            $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
        }
        if (!empty($wpdb->collate)) {
            $charset_collate .= " COLLATE {$wpdb->collate}";
        }
    }
    $installed_ver = get_option("fep_db_version");
    $installed_meta_ver = get_option("fep_meta_db_version");
    if ($installed_ver != FEP_DB_VERSION || $wpdb->get_var("SHOW TABLES LIKE '" . FEP_MESSAGES_TABLE . "'") != FEP_MESSAGES_TABLE) {
        $sqlMsgs = "CREATE TABLE " . FEP_MESSAGES_TABLE . " (\r\n            id int(11) NOT NULL auto_increment,\r\n            parent_id int(11) NOT NULL default '0',\r\n            from_user int(11) NOT NULL default '0',\r\n            to_user int(11) NOT NULL default '0',\r\n            last_sender int(11) NOT NULL default '0',\r\n            send_date datetime NOT NULL default '0000-00-00 00:00:00',\r\n            last_date datetime NOT NULL default '0000-00-00 00:00:00',\r\n            message_title varchar(256) NOT NULL,\r\n            message_contents longtext NOT NULL,\r\n            status int(11) NOT NULL default '0',\r\n            to_del int(11) NOT NULL default '0',\r\n            from_del int(11) NOT NULL default '0',\r\n            PRIMARY KEY (id))\r\n            {$charset_collate};";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sqlMsgs);
        update_option("fep_db_version", FEP_DB_VERSION);
        //var_dump('1');
    }
    if ($installed_meta_ver != FEP_META_VERSION || $wpdb->get_var("SHOW TABLES LIKE '" . FEP_META_TABLE . "'") != FEP_META_TABLE) {
        $sql_meta = "CREATE TABLE " . FEP_META_TABLE . " (\r\n            meta_id int(11) NOT NULL auto_increment,\r\n            message_id int(11) NOT NULL default '0',\r\n            field_name varchar(128) NOT NULL,\r\n            field_value longtext NOT NULL,\r\n            PRIMARY KEY (meta_id),\r\n\t\t\tKEY (field_name))\r\n            {$charset_collate};";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql_meta);
        update_option("fep_meta_db_version", FEP_META_VERSION);
        //var_dump('2');
    }
    //var_dump('3');
}
Example #14
0
 /**
  * Runs on activation
  */
 function ajaxsearchpro_activate()
 {
     global $wpdb;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $charset_collate_bin_column = '';
     $charset_collate = '';
     if (!empty($wpdb->charset)) {
         $charset_collate_bin_column = "CHARACTER SET {$wpdb->charset}";
         $charset_collate = "DEFAULT {$charset_collate_bin_column}";
     }
     if (strpos($wpdb->collate, "_") > 0) {
         $charset_collate_bin_column .= " COLLATE " . substr($wpdb->collate, 0, strpos($wpdb->collate, '_')) . "_bin";
         $charset_collate .= " COLLATE {$wpdb->collate}";
     } else {
         if ($wpdb->collate == '' && $wpdb->charset == "utf8") {
             $charset_collate_bin_column .= " COLLATE utf8_bin";
         }
     }
     if (isset($wpdb->base_prefix)) {
         $_prefix = $wpdb->base_prefix;
     } else {
         $_prefix = $wpdb->prefix;
     }
     $table_name = $_prefix . "ajaxsearchpro";
     $query = "\r\n        CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n          `id` int(11) NOT NULL AUTO_INCREMENT,\r\n          `name` text NOT NULL,\r\n          `data` text NOT NULL,\r\n          PRIMARY KEY (`id`)\r\n        ) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\r\n      ";
     dbDelta($query);
     $table_name = $_prefix . "ajaxsearchpro_statistics";
     $query = "\r\n        CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n          `id` int(11) NOT NULL AUTO_INCREMENT,\r\n          `search_id` int(11) NOT NULL,\r\n          `keyword` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,\r\n          `num` int(11) NOT NULL,\r\n          `last_date` int(11) NOT NULL,\r\n          PRIMARY KEY (`id`)\r\n        ) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\r\n      ";
     dbDelta($query);
     $query = "ALTER TABLE `{$table_name}` MODIFY `keyword` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL";
     dbDelta($query);
     $wpdb->query($query);
     $table_name = $_prefix . "ajaxsearchpro_priorities";
     $query = "\r\n        CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n          `post_id` int(11) NOT NULL,\r\n          `blog_id` int(11) NOT NULL,\r\n          `priority` int(11) NOT NULL,\r\n          PRIMARY KEY (`post_id`, `blog_id`)\r\n        ) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\r\n      ";
     dbDelta($query);
     $query = "SHOW INDEX FROM `{$table_name}` WHERE KEY_NAME = 'post_blog_id'";
     $index_exists = $wpdb->query($query);
     if ($index_exists == 0) {
         $query = "ALTER TABLE `{$table_name}` ADD INDEX `post_blog_id` (`post_id`, `blog_id`);";
         $wpdb->query($query);
     }
     $this->create_index();
     //@deprecated since 4.5
     //$this->fulltext();
     $this->chmod();
     /**
      * If the asp_version option exists, then the plugin was used before.
      * In this case, re-creating the CSS files is highly advised.
      */
     if (get_option('asp_version') !== false) {
         asp_generate_the_css();
     }
     /**
      * Store the version number after everything is done. This is going to help distinguishing
      * stored asp_version from the ASP_CURR_VER variable. These two are different in cases:
      *  - Uninstalling, installing new versions
      *  - Uploading and overwriting old version with a new one
      */
     update_option('asp_version', ASP_CURR_VER);
 }
 function createDatabaseTable()
 {
     global $wpdb;
     $options = array();
     $options['title'] = 'Quote Rotator';
     $options['delay'] = 5;
     $options['fade'] = 2;
     $options['fontsize'] = 12;
     $options['fontunit'] = 'px';
     if (!get_option('widgetQuoteRotator')) {
         add_option('widgetQuoteRotator', $options);
     }
     if ($wpdb->get_var("SHOW TABLES LIKE `" . $this->tableName . "`") != $this->tableName) {
         $sql = "CREATE TABLE `" . $wpdb->prefix . "QuoteRotator` (`id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, `quote` TEXT NULL);";
         //$sql = "CREATE TABLE `" . $this->tableName . "` (`id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, `quote` TEXT NULL);";
         require_once ABSPATH . 'wp-admin/upgrade-functions.php';
         dbDelta($sql);
         $options['version'] = $this->currentVersion;
     }
     $sql = "ALTER TABLE `" . $this->tableName . "` ADD `author` VARCHAR(255) NOT NULL AFTER `quote`;";
     $wpdb->query($sql);
     $sql = "RENAME TABLE `wp_QuoteRotator` TO `{$this->tableName}`;";
     $wpdb->query($sql);
     $sql = "ALTER TABLE `" . $this->tableName . "` CHANGE `quote` `quote` TEXT NULL;";
     $wpdb->query($sql);
     update_option('widgetQuoteRotator', $options);
     delete_option('widgetizeQuoteRotator');
 }
Example #16
0
function alm_create_table()
{
    global $wpdb;
    $table_name = $wpdb->prefix . "alm";
    $blog_id = $wpdb->blogid;
    $defaultRepeater = '<li <?php if (!has_post_thumbnail()) { ?> class="no-img"<?php } ?>><?php if ( has_post_thumbnail() ) { the_post_thumbnail(array(100,100));}?><h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3><p class="entry-meta"><?php the_time("F d, Y"); ?></p><?php the_excerpt(); ?></li>';
    /* MULTISITE */
    /* if this is a multisite blog and it's not id = 1, create default template */
    if ($blog_id > 1) {
        $dir = ALM_PATH . 'core/repeater/' . $blog_id;
        if (!is_dir($dir)) {
            mkdir($dir);
        }
        $file = ALM_PATH . 'core/repeater/' . $blog_id . '/default.php';
        if (!file_exists($file)) {
            $tmp = fopen($file, 'w');
            $w = fwrite($tmp, $defaultRepeater);
            fclose($tmp);
        }
    }
    //Create table, if it doesn't already exist.
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
        $sql = "CREATE TABLE {$table_name} (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\tname text NOT NULL,\n\t\t\trepeaterDefault longtext NOT NULL,\n\t\t\trepeaterType text NOT NULL,\n\t\t\tpluginVersion text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        //Insert the default data in created table
        $wpdb->insert($table_name, array('name' => 'default', 'repeaterDefault' => $defaultRepeater, 'repeaterType' => 'default', 'pluginVersion' => ALM_VERSION));
    }
}
 public static function activate()
 {
     global $wpdb, $choobs_wp_mailchimp_db_version, $choobs_wp_mailchimp_forms_table;
     if (!isset($choobs_wp_mailchimp_forms_table)) {
         return false;
     }
     $installed_version = get_option("choobs_wp_mailchimp_db_version");
     if ($installed_version == $choobs_wp_mailchimp_db_version) {
         return true;
     }
     $table_name = $wpdb->prefix . $choobs_wp_mailchimp_forms_table;
     $charset_collate = $wpdb->get_charset_collate();
     /**
      * idform, int, primary key
      * form_list, text, mailchimp list id
      * form_label, text, title of the form
      * form_html, text, html body of the form
      * form_shortcode, text, shortcode generated for the form
      * edit_date, datetime, time of editing the form
      * edited_by, int, user id of editing user
      * form_status, enum, [active, inacrive, draft]
      */
     $sql = "CREATE TABLE {$table_name} (\n\t\t\t\t\tidform bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t\t\t\tform_list text NOT NULL,\n\t\t\t\t\tform_label text NOT NULL,\n\t\t\t\t\tform_html text NOT NULL,\n\t\t\t\t\tform_shortcode text NOT NULL,\n\t\t\t\t\tedit_date datetime,\n\t\t\t\t\tedited_by bigint(20) UNSIGNED,\n\t\t\t\t\tform_status enum('active', 'inactive', 'draft') DEFAULT 'draft' NOT NULL,\n\t\t\t\t\tPRIMARY KEY (idform)\n\t\t\t\t\t) {$charset_collate};";
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
     update_option('choobs_wp_mailchimp_db_version', $choobs_wp_mailchimp_db_version);
 }
 /**
  * Here we install the tables and initial data needed to
  * power our special functions
  */
 function install()
 {
     global $wpdb, $db_version;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $table = $wpdb->prefix . 'wik_sources';
     $link = $wpdb->prefix . 'wik_source_types';
     $life = $wpdb->prefix . 'wik_life_data';
     $q = '';
     if ($wpdb->get_var("show tables like '{$table}'") != $table) {
         $q = "CREATE TABLE " . $table . "( \r\n\t\t\t\tid int NOT NULL AUTO_INCREMENT,\r\n\t\t\t\ttitle varchar(255) NOT NULL,\r\n\t\t\t\tprofile_url varchar(255) NOT NULL,\r\n\t\t\t\tfeed_url varchar(255) NOT NULL,\r\n\t\t\t\ttype boolean NOT NULL,\r\n\t\t\t\tlifestream boolean NOT NULL,\r\n\t\t\t\tupdates boolean NOT NULL,\r\n\t\t\t\tfavicon varchar(255) NOT NULL,\r\n\t\t\t\tUNIQUE KEY id (id)\r\n\t\t\t);";
     }
     if ($wpdb->get_var("show tables like '{$life}'") != $life) {
         $q .= "CREATE TABLE " . $life . "(\r\n\t\t\t\tid int NOT NULL AUTO_INCREMENT,\r\n\t\t\t\tname varchar(255) NOT NULL,\r\n\t\t\t\tcontent TEXT NOT NULL,\r\n\t\t\t\tdate varchar(255) NOT NULL,\r\n\t\t\t\tlink varchar(255) NOT NULL,\r\n\t\t\t\tenabled boolean NOT NULL,\r\n\t\t\t\tUNIQUE KEY id (id)\r\n\t\t\t);";
     }
     if ($wpdb->get_var("show tables like '{$link}'") != $link) {
         $q .= "CREATE TABLE " . $link . "( \r\n\t\t\t\tid int NOT NULL AUTO_INCREMENT,\r\n\t\t\t\ttype_id tinyint(4) NOT NULL,\r\n\t\t\t\tname varchar(255) NOT NULL,\r\n\t\t\t\tUNIQUE KEY id (id)\r\n\t\t\t);";
     }
     if ($q != '') {
         dbDelta($q);
     }
     $types = array(array('type_id' => '3', 'name' => 'Social Network'), array('type_id' => '2', 'name' => 'Website/Blog'), array('type_id' => '1', 'name' => 'Images'));
     foreach ($types as $type) {
         if (!$wpdb->get_var("SELECT type_id FROM {$link} WHERE type_id = " . $type['type_id'])) {
             $i = "INSERT INTO " . $link . " (id,type_id,name) VALUES('', '" . $type['type_id'] . "','" . $type['name'] . "')";
             $query = $wpdb->query($i);
         }
     }
     wp_add_option('wik_db_version', $db_version);
 }
function speedymarket_tables()
{
    //Get the table name with the WP database prefix
    global $wpdb;
    $speedymarket_table_version = "1.0";
    $installed_ver = get_option("speedymarket_table_version");
    //Check if the table already exists and if the table is up to date, if not create it
    if ($wpdb->get_var("SHOW TABLES LIKE '{$wpc_cat_table}'") != $wpc_cat_table || $installed_ver != $speedymarket_table_version) {
        $sql = "CREATE TABLE `tb_article` (\r\n  `id_article` int(11) NOT NULL,\r\n  `a_designation` varchar(100) NOT NULL,\r\n  `a_pht` float(6,2) DEFAULT NULL,\r\n  `a_description` text,\r\n  `a_quantite_stock` int(11) DEFAULT NULL,\r\n  `a_visible` tinyint(1) NOT NULL,\r\n  `id_categorie` int(11) DEFAULT NULL,\r\n  `url_image` varchar(200) DEFAULT NULL,\r\n  `id_tva` int(11) DEFAULT NULL\r\n   UNIQUE KEY id_article (id)\r\n            )";
        $sql1 = "CREATE TABLE `tb_categorie` (\r\n`id_categorie` int(11) NOT NULL,\r\n  `c_libelle` varchar(100) NOT NULL,\r\n  `id_categorie_mere` int(11) DEFAULT NULL,\r\n  `url_image` varchar(200) DEFAULT NULL\r\n  )";
        $sql2 = "CREATE TABLE `tb_client` (\r\n  `id_personne` int(11) NOT NULL,\r\n  UNIQUE KEY id_personne()\r\n)";
        $sql3 = "CREATE TABLE `tb_commande` (\r\n`id_commande` int(11) NOT NULL,\r\n  `c_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n  `c_dateretrait` date DEFAULT NULL,\r\n  `id_statut` int(11) DEFAULT NULL,\r\n  `client_id_pers` int(11) DEFAULT NULL,\r\n  `prepa_id_pers` int(11) DEFAULT NULL\r\n)";
        $sql4 = "CREATE TABLE `tb_image` (\r\n  `url_image` varchar(200) NOT NULL,\r\n  `i_nom` varchar(100) NOT NULL,\r\n  `i_libelle` varchar(100) DEFAULT NULL\r\n)";
        $sql5 = "CREATE TABLE IF NOT EXISTS `tb_ligne_commande` (\r\n  `id_article` int(11) NOT NULL,\r\n  `id_commande` int(11) NOT NULL,\r\n  `qte_cmde` int(11) NOT NULL\r\n)";
        $sql6 = "CREATE TABLE IF NOT EXISTS `tb_personne` (\r\n`id_personne` int(11) NOT NULL,\r\n  `p_nom` varchar(100) NOT NULL,\r\n  `p_prenom` varchar(100) NOT NULL,\r\n  `p_arue` varchar(100) DEFAULT NULL,\r\n  `p_aville` varchar(100) NOT NULL,\r\n  `p_acp` int(11) NOT NULL,\r\n  `p_tel` int(11) DEFAULT NULL,\r\n  `p_mail` varchar(100) NOT NULL,\r\n  `p_mdp` varchar(128) NOT NULL\r\n)";
        $sql7 = "CREATE TABLE IF NOT EXISTS `tb_preparateur` (\r\n  `id_personne` int(11) NOT NULL\r\n)";
        $sql8 = "CREATE TABLE IF NOT EXISTS `tb_statut` (\r\n`id_statut` int(11) NOT NULL,\r\n  `s_libelle` varchar(50) NOT NULL\r\n)";
        $sql9 = "CREATE TABLE IF NOT EXISTS `tb_tva` (\r\n`id_tva` int(11) NOT NULL,\r\n  `t_libelle` varchar(100) NOT NULL,\r\n  `t_taux` float(4,3) NOT NULL\r\n)";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option("speedymarket_table_version", $speedymarket_table_version);
    }
    //Add database table versions to options
    add_option("wpc_cat_table_version", $speedymarket_table_version);
}
Example #20
0
/** Setup database and sample data */
function flipping_team_install()
{
    global $wpdb;
    $table_name = $wpdb->prefix . "team";
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
        $sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        add_option("flipping_team_db_version", $flipping_team_db_version);
        $table_name = $wpdb->prefix . "team";
        $name = "Abhishek Gupta";
        $website = "http://abhishek.cc";
        $info = "Student at IIT Delhi. More about on his website abhishek.cc or his startup zumbl.com .";
        $imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
        $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
        $table_name = $wpdb->prefix . "team";
        $name = "Scii";
        $website = "http://scil.coop";
        $info = "More about on his website.";
        $imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
        $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
    }
    $installed_ver = get_option("flipping_team_db_version");
    if ($installed_ver != $jal_db_version) {
        $sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option("flipping_team_db_version", $flipping_team_db_version);
    }
}
 /**
  * Initialize the table if it doesn't exist.
  */
 function initialize($force = false)
 {
     global $wpdb;
     if ($wpdb->get_var("SHOW TABLES LIKE '{$this->table_name}'") != $this->table_name || $force) {
         $sql = "CREATE TABLE {$this->table_name} (\n";
         $statements = array();
         foreach ($this->schema_info as $info) {
             list($name, $type, $size, $extra) = $info;
             $statement = "{$name} {$type}";
             if (!empty($size)) {
                 $statement .= "({$size})";
             }
             if (!empty($extra)) {
                 $statement .= " {$extra}";
             }
             $statements[] = $statement;
         }
         $sql .= implode(",\n", $statements) . ");";
         if (!$wpdb->is_mock) {
             require_once ABSPATH . 'wp-admin/includes/upgrade.php';
             dbDelta($sql);
             return true;
         }
     }
     return false;
 }
function votesys_install()
{
    $votesys_default = array('add_point_sk' => '1', 'track_by_ip' => true, 'track_by_time' => true, 'advance_tracking' => true, 'help_href' => 'http://mc.skilas.lt');
    update_option('votesys_options', $votesys_default);
    global $wpdb;
    //add lookup table
    $table_name = $wpdb->prefix . 'votesys_lookup';
    $charset_collate = $wpdb->get_charset_collate();
    $sql = "CREATE TABLE " . $table_name . " (\n                    `id` int(11) NOT NULL AUTO_INCREMENT,\n                    `points` int(11) NOT NULL DEFAULT '0',\n                    `site_id` int(11) NOT NULL DEFAULT '0',\n                    `time` int(11) NOT NULL DEFAULT '0',\n                    `added_points` tinyint(1) DEFAULT NULL,\n                    `ip` varchar(200) NOT NULL DEFAULT '',\n                    PRIMARY KEY (`id`)\n                    )" . $charset_collate . ";";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
    //add userdb table
    $table_name = $wpdb->prefix . 'votesys_userdata';
    $sql = "CREATE TABLE " . $table_name . " (\n                    `user_id` int(11) NOT NULL DEFAULT '0',\n                    `points` int(11) NOT NULL DEFAULT '0',\n                    PRIMARY KEY (`user_id`)\n                    )" . $charset_collate . ";";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
    //add userdb table
    $table_name = $wpdb->prefix . 'votesys_votetime';
    $sql = "CREATE TABLE " . $table_name . " (\n                    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n                    `user_id` int(11) NOT NULL DEFAULT '0',\n                    `vote_site_id` int(11) NOT NULL DEFAULT '0',\n                    `vote_time` int(11) NOT NULL DEFAULT '0',\n                    PRIMARY KEY (`id`)\n                    )" . $charset_collate . ";";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
    //add topsite table
    $table_name = $wpdb->prefix . 'votesys_topsite';
    $sql = "CREATE TABLE " . $table_name . " (\n                    `vote_site_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n                    `site_name` varchar(200) NOT NULL DEFAULT '',\n                    `site_banner_url` varchar(200) NOT NULL DEFAULT '',\n                    `site_vote_url` varchar(200) NOT NULL DEFAULT '',\n                    `vote_interval` int(11) NOT NULL DEFAULT '0',\n                    `vote_interval_text` varchar(200) NOT NULL DEFAULT '',\n                    `lookup_text` varchar(200) NOT NULL DEFAULT '',\n                    PRIMARY KEY (`vote_site_id`)\n                    )" . $charset_collate . ";";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
    register_uninstall_hook(__FILE__, 'votesys_uninstall');
}
Example #23
0
 public function ERP_DB()
 {
     global $wpdb;
     //create the name of the table including the wordpress prefix (wp_ etc)
     $EPR_user = $wpdb->prefix . "EPR_user";
     $EPR_user_meta = $wpdb->prefix . "EPR_user_meta";
     //$wpdb->show_errors();
     //check if there are any tables of that name already
     if ($wpdb->get_var("show tables like '{$EPR_user}'") !== $EPR_user) {
         //create your sql
         $sql = "CREATE TABLE " . $EPR_user . " (\n    ID bigint(20) NOT NULL AUTO_INCREMENT,\n    fname VARCHAR (10) NOT NULL,\n    lname VARCHAR(10) NOT NULL,\n    email VARCHAR(20) NOT NULL,\n    staddress VARCHAR(20) NOT NULL,\n    city VARCHAR(20) NOT NULL,\n    state VARCHAR(20) NOT NULL,\n    Zip VARCHAR(20) NOT NULL,\n    phone VARCHAR(20) NOT NULL,\n    eve_phone VARCHAR(20) NOT NULL,\n    date_of_birth VARCHAR(20) NOT NULL,\n    medication VARCHAR(20) NOT NULL,\n    term_option VARCHAR(20) NOT NULL,\n    term_coverag_amount VARCHAR(20) NOT NULL,\n    Exterior_Wall_Type VARCHAR(20) NOT NULL,\n    property_type VARCHAR(20) NOT NULL,\n    year_build VARCHAR(20) NOT NULL,\n    squar_footge VARCHAR(20) NOT NULL,\n    property_country VARCHAR(20) NOT NULL,\n    swimming_pool VARCHAR(20) NOT NULL,\n    driver_first_name1 VARCHAR(20) NOT NULL,\n    driver_last_name1 VARCHAR(20) NOT NULL,\n    driver_birthdate1 VARCHAR(20) NOT NULL,\n    driver_maritual_statues1 VARCHAR(20) NOT NULL,\n    driver_1st_violation_description1 VARCHAR(20) NOT NULL,\n    driver_first_name2 VARCHAR(20) NOT NULL,\n    driver_last_name2 VARCHAR(20) NOT NULL,\n    driver_birthdate2 VARCHAR(20) NOT NULL,\n    driver_maritual_statues2 VARCHAR(20) NOT NULL,\n    driver_1nd_violation_description2 VARCHAR(20) NOT NULL,\n    driver_first_name3 VARCHAR(20) NOT NULL,\n    driver_last_name3 VARCHAR(20) NOT NULL,\n    driver_birthdate3 VARCHAR(20) NOT NULL,\n    driver_maritual_statues3 VARCHAR(20) NOT NULL,\n    driver_1nd_violation_description3 VARCHAR(20) NOT NULL,\n    Vehicle_year1 VARCHAR(20) NOT NULL,\n    Vehicle_Make1 VARCHAR(20) NOT NULL,\n    Vehicle_Model1 VARCHAR(20) NOT NULL,\n    Vehicle_Deductible1 VARCHAR(20) NOT NULL,\n    Vehicle_year2 VARCHAR(20) NOT NULL,\n    Vehicle_Make2 VARCHAR(20) NOT NULL,\n    Vehicle_Model2 VARCHAR(20) NOT NULL,\n    Vehicle_Deductible2 VARCHAR(20) NOT NULL,\n    Vehicle_year3 VARCHAR(20) NOT NULL,\n    Vehicle_Make3 VARCHAR(20) NOT NULL,\n    Vehicle_Model3 VARCHAR(20) NOT NULL,\n    Vehicle_Deductible3 VARCHAR(20) NOT NULL,\n    What_are_your_current_liability_limits VARCHAR(20) NOT NULL,\n    Current_Resident_Status VARCHAR(20) NOT NULL,\n    Requested_Policy_Start_Date VARCHAR(20) NOT NULL,\n    Design_Type VARCHAR(20) NOT NULL,\n    Square_Footage VARCHAR(20) NOT NULL,\n    Number_of_Stories VARCHAR(20) NOT NULL,\n    Foundation_Type VARCHAR(20) NOT NULL,\n    Roof_Type VARCHAR(20) NOT NULL,\n    Property_Extras VARCHAR(20) NOT NULL,\n    Heating_Type VARCHAR(20) NOT NULL,\n    Garage_Type VARCHAR(20) NOT NULL,\n    Bathrooms VARCHAR(20) NOT NULL,\n    Additional_Comments VARCHAR(20) NOT NULL,\n    square_ft VARCHAR(10) NOT NULL,\n    Promotion_Code VARCHAR(10) NOT NULL,\n    dogs VARCHAR(10) NOT NULL,\n    hear_about_us VARCHAR(50) NOT NULL,\n    method_to_contuct VARCHAR(50) NOT NULL,\n    type VARCHAR(50) NOT NULL,\n    UNIQUE KEY ID (ID));";
     }
     if ($wpdb->get_var("show tables like '{$EPR_user_meta}'") !== $EPR_user_meta) {
         //create your sql
         $EPR_user_meta_sql = "CREATE TABLE " . $EPR_user_meta . " (\n    ID bigint(20) NOT NULL AUTO_INCREMENT,\n    fname VARCHAR (10) NOT NULL,\n    lname VARCHAR(10) NOT NULL,\n    email VARCHAR(20) NOT NULL,\n    staddress VARCHAR(20) NOT NULL,\n    city VARCHAR(20) NOT NULL,\n    state VARCHAR(20) NOT NULL,\n    Zip VARCHAR(20) NOT NULL,\n    phone VARCHAR(20) NOT NULL,\n    eve_phone VARCHAR(20) NOT NULL,\n    date_of_birth VARCHAR(20) NOT NULL,\n    medication VARCHAR(20) NOT NULL,\n    term_option VARCHAR(20) NOT NULL,\n    term_coverag_amount VARCHAR(20) NOT NULL,\n    Exterior_Wall_Type VARCHAR(20) NOT NULL,\n    property_type VARCHAR(20) NOT NULL,\n    year_build VARCHAR(20) NOT NULL,\n    squar_footge VARCHAR(20) NOT NULL,\n    property_country VARCHAR(20) NOT NULL,\n    swimming_pool VARCHAR(20) NOT NULL,\n    1driver_first_name VARCHAR(20) NOT NULL,\n    1driver_last_name VARCHAR(20) NOT NULL,\n    1st_driver_birthdate VARCHAR(20) NOT NULL,\n    1driver_maritual_statues VARCHAR(20) NOT NULL,\n    1st_driver_1st_violation_description VARCHAR(20) NOT NULL,\n    2driver_first_name VARCHAR(20) NOT NULL,\n    2driver_last_name VARCHAR(20) NOT NULL,\n    2nd_driver_birthdate VARCHAR(20) NOT NULL,\n    2driver_maritual_statues VARCHAR(20) NOT NULL,\n    2nd_driver_1nd_violation_description VARCHAR(20) NOT NULL,\n    3driver_first_name VARCHAR(20) NOT NULL,\n    3driver_last_name VARCHAR(20) NOT NULL,\n    3nd_driver_birthdate VARCHAR(20) NOT NULL,\n    3driver_maritual_statues VARCHAR(20) NOT NULL,\n    3rd_driver_1nd_violation_description VARCHAR(20) NOT NULL,\n    1_Vehicle_year VARCHAR(20) NOT NULL,\n    1_Vehicle_Make VARCHAR(20) NOT NULL,\n    1_Vehicle_Model VARCHAR(20) NOT NULL,\n    1_Vehicle_Deductible VARCHAR(20) NOT NULL,\n    2_Vehicle_year VARCHAR(20) NOT NULL,\n    2_Vehicle_Make VARCHAR(20) NOT NULL,\n    2_Vehicle_Model VARCHAR(20) NOT NULL,\n    2_Vehicle_Deductible VARCHAR(20) NOT NULL,\n    3_Vehicle_year VARCHAR(20) NOT NULL,\n    3_Vehicle_Make VARCHAR(20) NOT NULL,\n    3_Vehicle_Model VARCHAR(20) NOT NULL,\n    3_Vehicle_Deductible VARCHAR(20) NOT NULL,\n    What_are_your_current_liability_limits VARCHAR(20) NOT NULL,\n    Current_Resident_Status VARCHAR(20) NOT NULL,\n    Requested_Policy_Start_Date VARCHAR(20) NOT NULL,\n    Design_Type VARCHAR(20) NOT NULL,\n    Square_Footage VARCHAR(20) NOT NULL,\n    Number_of_Stories VARCHAR(20) NOT NULL,\n    Foundation_Type VARCHAR(20) NOT NULL,\n    Roof_Type VARCHAR(20) NOT NULL,\n    Property_Extras VARCHAR(20) NOT NULL,\n    Heating_Type VARCHAR(20) NOT NULL,\n    Garage_Type VARCHAR(20) NOT NULL,\n    Bathrooms VARCHAR(20) NOT NULL,\n    Additional_Comments VARCHAR(20) NOT NULL,\n    square_ft VARCHAR(10) NOT NULL,\n    Promotion_Code VARCHAR(10) NOT NULL,\n    dogs VARCHAR(10) NOT NULL,\n    hear_about_us VARCHAR(50) NOT NULL,\n    method_to_contuct VARCHAR(50) NOT NULL,\n    UNIQUE KEY ID (ID));";
     }
     //include the wordpress db functions
     require_once ABSPATH . 'wp-admin/upgrade-functions.php';
     dbDelta($sql);
     dbDelta($EPR_user_meta_sql);
     //register the new table with the wpdb object
     if (!isset($wpdb->EPR_user_meta)) {
         $wpdb->EPR_user_meta = $EPR_user_meta;
         //add the shortcut so you can use $wpdb->EPR_user
         $wpdb->tables[] = str_replace($wpdb->prefix, '', $EPR_user_meta);
     }
     if (!isset($wpdb->EPR_user)) {
         $wpdb->EPR_user = $EPR_user;
         //add the shortcut so you can use $wpdb->EPR_user
         $wpdb->tables[] = str_replace($wpdb->prefix, '', $EPR_user);
     }
 }
 function create_wc_cancel_sql()
 {
     global $wpdb;
     include_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $sql = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "wc_cancel_orders (\r\n\t\t  `id` bigint(20) NOT NULL AUTO_INCREMENT,\r\n\t\t  `order_id` bigint(20) NOT NULL,\r\n\t\t  `user_id` bigint(20) NOT NULL,\r\n\t\t  `is_approved` TINYINT( 2 ) NOT NULL DEFAULT  '0',\r\n\t\t  `cancel_request_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n\t\t  `cancel_date` TIMESTAMP NOT NULL,\r\n\t\t   PRIMARY KEY (`id`)\r\n\t\t   ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
     dbDelta($sql);
 }
 function jo_initialize_db()
 {
     //initialize db
     global $jo_db_version;
     $jo_db_version = '1.0';
     global $wpdb;
     global $jo_db_version;
     $table_name = $wpdb->prefix . "jo_prompts";
     $charset_collate = $wpdb->get_charset_collate();
     $sql_remove_table = "DROP TABLE {$table_name};";
     $sql = "CREATE TABLE {$table_name} (\n\t\t\t  id mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\t  word tinytext NOT NULL,\n\t\t\t  word_class tinytext NOT NULL,\n\t\t\t  UNIQUE KEY id (id)\n\t\t\t) {$charset_collate};";
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql_remove_table);
     dbDelta($sql);
     add_option('jo_db_version', $jo_db_version);
     //add words to table
     //create verb array
     $verb_list = array('surf', 'turn', 'kiss', 'brace', 'run', 'embellish', 'transfer', 'push', 'think', 'love', 'jump', 'type', 'play', 'sue', 'cut', 'expand', 'dress up', 'win', 'lose', 'pull', 'redirect', 'sail', 'rake', 'yell', 'whisper', 'shade', 'draw', 'bathe', 'clean', 'estimate', 'improvise', 'listen', 'speak', 'translate', 'empathize', 'free', 'defend', 'attack', 'float', 'swim', 'sink', 'dive', 'paint', 'stretch', 'blow', 'underestimate', 'praise', 'weigh', 'pack', 'wrap', 'stack', 'sprint', 'cruise', 'extend', 'grow', 'plunge', 'glow', 'purchase', 'disappear', 'hug', 'invite', 'employ', 'quit', 'shake', 'inspect', 'cook', 'prepare', 'bake', 'thaw', 'boil', 'store', 'rate', 'describe', 'deconstruct', 'consider', 'reverse', 'revert', 'score', 'build', 'assemble', 'cover', 'stain', 'fry', 'forage', 'gather', 'rest', 'assault', 'agree', 'rekindle', 'taste', 'smell', 'sniff', 'inhale', 'hear', 'careen', 'blast', 'charge', 'scoot', 'soar', 'amble', 'ski', 'skate', 'sink', 'berate', 'insult', 'compliment', 'convince', 'deceive', 'inform', 'comfort', 'collapse');
     //create noun array
     $noun_list = array('board', 'plank', 'workout', 'tennis racquet', 'tooth', 'olive', 'beer', 'window', 'door', 'face', 'body', 'foot', 'hand', 'envelope', 'pencil', 'pen', 'hair', 'session', 'lips', 'shin', 'home', 'department', 'apartment', 'house', 'brink', 'brick', 'stairway', 'skeleton', 'lawsuit', 'relationship', 'core', 'fruit', 'spaghetti', 'sandwich', 'turkey', 'basketball', 'surfboard', 'wave', 'conversation', 'experience', 'telephone', 'computer', 'tablet', 'pill', 'medication', 'prescription', 'examination', 'homework', 'novel', 'manuscript', 'banana', 'papaya', 'porch', 'boat', 'car', 'cabin', 'basement', 'heater', 'room', 'block', 'town', 'city', 'state', 'country', 'nation', 'fish', 'shark', 'dolphin', 'coral', 'bear', 'code', 'cord', 'pipe', 'scripture', 'sermon', 'savior', 'religion', 'belief', 'atheist', 'skeptic', 'interest', 'elbow', 'elephant', 'position', 'court', 'field', 'lawn', 'teacher', 'principal', 'judge', 'lawyer', 'doctor', 'president', 'senator', 'liar', 'politician', 'celebrity', 'stud', 'beauty', 'painting', 'sculpture');
     $counter = 1;
     //insert verbs
     foreach ($verb_list as $value) {
         jo_insert_word_to_db($counter, $value, 'verb', $table_name);
         $counter++;
     }
     //insert verbs
     foreach ($noun_list as $key => $value) {
         jo_insert_word_to_db($counter, $value, 'noun', $table_name);
         $counter++;
     }
 }
 static function create_db_tables()
 {
     global $wpdb;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     //"User Login" related tables
     $lockdown_tbl_name = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
     $failed_login_tbl_name = AIOWPSEC_TBL_FAILED_LOGINS;
     $user_login_activity_tbl_name = AIOWPSEC_TBL_USER_LOGIN_ACTIVITY;
     $aiowps_global_meta_tbl_name = AIOWPSEC_TBL_GLOBAL_META_DATA;
     $aiowps_event_tbl_name = AIOWPSEC_TBL_EVENTS;
     $charset_collate = '';
     if (!empty($wpdb->charset)) {
         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     } else {
         $charset_collate = "DEFAULT CHARSET=utf8";
     }
     if (!empty($wpdb->collate)) {
         $charset_collate .= " COLLATE {$wpdb->collate}";
     }
     $ld_tbl_sql = "CREATE TABLE " . $lockdown_tbl_name . " (\r\r\n        id bigint(20) NOT NULL AUTO_INCREMENT,\r\r\n        user_id bigint(20) NOT NULL,\r\r\n        user_login VARCHAR(150) NOT NULL,\r\r\n        lockdown_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\r\n        release_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\r\n        failed_login_ip varchar(100) NOT NULL DEFAULT '',\r\r\n        lock_reason varchar(128) NOT NULL DEFAULT '',\r\r\n        unlock_key varchar(128) NOT NULL DEFAULT '',\r\r\n        PRIMARY KEY  (id)\r\r\n        )" . $charset_collate . ";";
     dbDelta($ld_tbl_sql);
     $fl_tbl_sql = "CREATE TABLE " . $failed_login_tbl_name . " (\r\r\n        id bigint(20) NOT NULL AUTO_INCREMENT,\r\r\n        user_id bigint(20) NOT NULL,\r\r\n        user_login VARCHAR(150) NOT NULL,\r\r\n        failed_login_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\r\n        login_attempt_ip varchar(100) NOT NULL DEFAULT '',\r\r\n        PRIMARY KEY  (id)\r\r\n        )" . $charset_collate . ";";
     dbDelta($fl_tbl_sql);
     $ula_tbl_sql = "CREATE TABLE " . $user_login_activity_tbl_name . " (\r\r\n        id bigint(20) NOT NULL AUTO_INCREMENT,\r\r\n        user_id bigint(20) NOT NULL,\r\r\n        user_login VARCHAR(150) NOT NULL,\r\r\n        login_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\r\n        logout_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\r\n        login_ip varchar(100) NOT NULL DEFAULT '',\r\r\n        login_country varchar(150) NOT NULL DEFAULT '',\r\r\n        browser_type varchar(150) NOT NULL DEFAULT '',\r\r\n        PRIMARY KEY  (id)\r\r\n        )" . $charset_collate . ";";
     dbDelta($ula_tbl_sql);
     $gm_tbl_sql = "CREATE TABLE " . $aiowps_global_meta_tbl_name . " (\r\r\n        meta_id bigint(20) NOT NULL auto_increment,\r\r\n        date_time datetime NOT NULL default '0000-00-00 00:00:00',\r\r\n        meta_key1 varchar(255) NOT NULL,\r\r\n        meta_key2 varchar(255) NOT NULL,\r\r\n        meta_key3 varchar(255) NOT NULL,\r\r\n        meta_key4 varchar(255) NOT NULL,\r\r\n        meta_key5 varchar(255) NOT NULL,\r\r\n        meta_value1 varchar(255) NOT NULL,\r\r\n        meta_value2 text NOT NULL,\r\r\n        meta_value3 text NOT NULL,\r\r\n        meta_value4 longtext NOT NULL,\r\r\n        meta_value5 longtext NOT NULL,\r\r\n        PRIMARY KEY  (meta_id)\r\r\n        )" . $charset_collate . ";";
     dbDelta($gm_tbl_sql);
     $evt_tbl_sql = "CREATE TABLE " . $aiowps_event_tbl_name . " (\r\r\n        id bigint(20) NOT NULL AUTO_INCREMENT,\r\r\n        event_type VARCHAR(150) NOT NULL DEFAULT '',\r\r\n        username VARCHAR(150),\r\r\n        user_id bigint(20),\r\r\n        event_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\r\n        ip_or_host varchar(100),\r\r\n        referer_info varchar(255),\r\r\n        url varchar(255),\r\r\n        event_data longtext,\r\r\n        PRIMARY KEY  (id)\r\r\n        )" . $charset_collate . ";";
     dbDelta($evt_tbl_sql);
     update_option("aiowpsec_db_version", AIO_WP_SECURITY_DB_VERSION);
 }
Example #27
0
function maletek_pintalocker_install()
{
    /*creating tables*/
    global $wpdb;
    $tablePrefix = $wpdb->prefix . 'maletek_pintalocker';
    /*
     * We'll set the default character set and collation for this table.
     * If we don't do this, some characters could end up being converted 
     * to just ?'s when saved in our table.
     */
    $charset_collate = '';
    if (!empty($wpdb->charset)) {
        $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
    }
    if (!empty($wpdb->collate)) {
        $charset_collate .= " COLLATE {$wpdb->collate}";
    }
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    #lockers
    $table_name = $tablePrefix . "item";
    $sql = "CREATE TABLE IF NOT EXIST {$table_name} (\r\r\n     id int NOT NULL AUTO_INCREMENT,\r\r\n     dateUpdate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,\r\r\n     varName tinytext NOT NULL,\r\r\n     varContent text NOT NULL,\r\r\n     intRows int NOT NULL,\r\r\n     intCols int NOT NULL,\r\r\n     varImage tinytext DEFAULT '' NOT NULL,\r\r\n     UNIQUE KEY id (id)\r\r\n   ) {$charset_collate};";
    dbDelta($sql);
    $table_name = $tablePrefix . "item";
    $sql = "CREATE TABLE IF NOT EXIST {$table_name} (\r\r\n     id int NOT NULL AUTO_INCREMENT,\r\r\n     dateUpdate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,\r\r\n     varName tinytext NOT NULL,\r\r\n     varCode tinytext NOT NULL,\r\r\n     UNIQUE KEY id (id)\r\r\n   ) {$charset_collate};";
    dbDelta($sql);
    #add_option( $tablePrefix."version", $current_version );
}
Example #28
0
function i_world_map_install()
{
    global $wpdb;
    $table_name_imap = $wpdb->prefix . "i_world_map";
    $iwm_db_version = 5;
    $charset_collate = "";
    if (!empty($wpdb->charset)) {
        $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
    }
    if (!empty($wpdb->collate)) {
        $charset_collate .= " COLLATE {$wpdb->collate}";
    }
    $sql = "CREATE TABLE {$table_name_imap} (\n\t\t\t\t\t  id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t  name varchar(255) DEFAULT NULL,\n\t\t\t\t\t  description longtext,\n\t\t\t\t\t  use_defaults int(11) DEFAULT NULL,\t\t\t\t\t  \n\t\t\t\t\t  bg_color varchar(100) DEFAULT NULL,\n\t\t\t\t\t  border_color varchar(100) DEFAULT NULL,\n\t\t\t\t\t  border_stroke varchar(100) DEFAULT NULL,\n\t\t\t\t\t  ina_color varchar(100) DEFAULT NULL,\n\t\t\t\t\t  act_color varchar(100) DEFAULT NULL,\n\t\t\t\t\t  marker_size int(11) DEFAULT NULL,\t\n\t\t\t\t\t  width varchar(100) DEFAULT NULL,\n\t\t\t\t\t  height varchar(100) DEFAULT NULL,\n\t\t\t\t\t  aspect_ratio int(11) DEFAULT NULL,\n\t\t\t\t\t  interactive int(11) DEFAULT '1',\n\t\t\t\t\t  showtooltip int(11) DEFAULT '1',\n\t\t\t\t\t  region varchar(100) DEFAULT NULL,\n\t\t\t\t\t  display_mode varchar(100) DEFAULT NULL, \n\t\t\t\t\t  map_action varchar(100) DEFAULT NULL,\n\t\t\t\t\t  places LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\t  image LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\t  custom_action LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\t  custom_css LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\t  created timestamp NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t\t\t\t  UNIQUE KEY id (id)\n    \t\t) {$charset_collate};";
    $currentdbversion = $iwm_db_version;
    $storeddbversion = false;
    $storeddbversionexists = get_option('i_world_map_db_version');
    if ($storeddbversionexists != false) {
        $storeddbversion = $storeddbversionexists;
    }
    if ($storeddbversionexists != false && $storeddbversionexists != $currentdbversion) {
        //upgrade function
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option("i_world_map_db_version", $currentdbversion);
    }
    if ($storeddbversionexists == false) {
        update_option("i_world_map_db_version", $currentdbversion);
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
    }
}
Example #29
0
function ninja_forms_uploads_activation()
{
    global $wpdb;
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    $sql = "CREATE TABLE IF NOT EXISTS " . NINJA_FORMS_UPLOADS_TABLE_NAME . " (\r\n\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t  `user_id` int(11) DEFAULT NULL,\r\n\t  `form_id` int(11) NOT NULL,\r\n\t  `field_id` int(11) NOT NULL,\r\n\t  `data` longtext CHARACTER SET utf8 NOT NULL,\r\n\t  `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n\t  PRIMARY KEY (`id`)\r\n\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;";
    dbDelta($sql);
    $opt = get_option('ninja_forms_settings');
    if (isset($opt['version'])) {
        $current_version = $opt['version'];
    } else {
        $current_version = '';
    }
    $base_upload_url = wp_upload_dir();
    $base_upload_url = $base_upload_url['baseurl'] . '/ninja-forms';
    $opt['base_upload_url'] = $base_upload_url;
    $base_upload_dir = wp_upload_dir();
    $base_upload_dir = $base_upload_dir['basedir'] . '/ninja-forms';
    $opt['base_upload_dir'] = $base_upload_dir;
    if (!is_dir($base_upload_dir)) {
        mkdir($base_upload_dir);
    }
    if (!is_dir($base_upload_dir . "/tmp/")) {
        mkdir($base_upload_dir . "/tmp/");
    }
    if (!isset($opt['upload_error'])) {
        $opt['upload_error'] = __('There was an error uploading your file.', 'ninja-forms');
    }
    if (!isset($opt['max_file_size'])) {
        $opt['max_file_size'] = 2;
    }
    $opt['uploads_version'] = NINJA_FORMS_UPLOADS_VERSION;
    update_option('ninja_forms_settings', $opt);
}
function cfs_directory_install()
{
    global $wpdb;
    $table_name = $wpdb->prefix . "cfs_grocery";
    $checkSQL = "show tables like '{$table_name}'";
    if ($wpdb->get_var($checkSQL) != $table_name) {
        $create_table = "CREATE TABLE {$table_name} (\r\n                            id BIGINT(20) NOT NULL AUTO_INCREMENT,\r\n                            name VARCHAR(100),\r\n                            price VARCHAR(10),\r\n                            image VARCHAR(11),\r\n                            PRIMARY KEY (`id`));\r\n                            ";
        require_once ABSPATH . "wp-admin/includes/upgrade.php";
        dbDelta($create_table);
    }
    $table_name = $wpdb->prefix . "cfs_donator";
    $checkSQL = "show tables like '{$table_name}'";
    if ($wpdb->get_var($checkSQL) != $table_name) {
        $create_table = "CREATE TABLE {$table_name} (\r\n                            id BIGINT(20) NOT NULL AUTO_INCREMENT,\r\n                            trans_id VARCHAR(100),\r\n                            team_id BIGINT(20),\r\n                            payment_type VARCHAR(10),                            \r\n                            show_amount INT(1),\r\n                            donator_name VARCHAR(50),\r\n                            donator_email VARCHAR(100),\r\n                            amount INT(10),\r\n                            trans_detail text,\r\n                            timestamp TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,\r\n                            PRIMARY KEY (`id`));\r\n                            ";
        require_once ABSPATH . "wp-admin/includes/upgrade.php";
        dbDelta($create_table);
    }
    $table_name = $wpdb->prefix . "cfs_team";
    $checkSQL = "show tables like '{$table_name}'";
    if ($wpdb->get_var($checkSQL) != $table_name) {
        $create_table = "CREATE TABLE {$table_name} (\r\n                            id BIGINT(20) NOT NULL AUTO_INCREMENT,\r\n                            team_name VARCHAR(100),\r\n                            company_id BIGINT(20),\r\n                            PRIMARY KEY (`id`));\r\n                            ";
        require_once ABSPATH . "wp-admin/includes/upgrade.php";
        dbDelta($create_table);
    }
    add_role('donator', 'Donator', array('read' => true, 'level_0' => true));
}