function wpdm_pro_Install()
{
    global $wpdb;
    delete_option('wpdm_latest');
    $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_download_stats` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `pid` int(11) NOT NULL,\n              `uid` int(11) NOT NULL,\n              `oid` varchar(100) NOT NULL,\n              `year` int(4) NOT NULL,\n              `month` int(2) NOT NULL,\n              `day` int(2) NOT NULL,\n              `timestamp` int(11) NOT NULL,\n              `ip` varchar(20) NOT NULL,\n              PRIMARY KEY (`id`)\n            )";
    $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_emails` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `email` varchar(255) NOT NULL,\n              `pid` int(11) NOT NULL,\n              `date` int(11) NOT NULL,\n              `custom_data` text NOT NULL,\n              `request_status` INT( 1 ) NOT NULL,\n              PRIMARY KEY (`id`)\n            )";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    foreach ($sqls as $sql) {
        $wpdb->query($sql);
        //dbDelta($sql);
    }
    if (get_option('_wpdm_etpl') == '') {
        update_option('_wpdm_etpl', array('title' => 'Your download link', 'body' => file_get_contents(dirname(__FILE__) . '/templates/wpdm-email-lock-template.html')));
    }
    wpdm_common_actions();
    flush_rewrite_rules();
    CreateDir();
}
function wpdm_pro_Install()
{
    global $wpdb;
    delete_option('wpdm_latest');
    $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_download_stats` (\r\n              `id` int(11) NOT NULL AUTO_INCREMENT,\r\n              `pid` int(11) NOT NULL,\r\n              `uid` int(11) NOT NULL,\r\n              `oid` varchar(100) NOT NULL,\r\n              `year` int(4) NOT NULL,\r\n              `month` int(2) NOT NULL,\r\n              `day` int(2) NOT NULL,\r\n              `timestamp` int(11) NOT NULL,\r\n              `ip` varchar(20) NOT NULL,\r\n              PRIMARY KEY (`id`)\r\n            ) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    foreach ($sqls as $sql) {
        $wpdb->query($sql);
        //dbDelta($sql);
    }
    if (get_option('access_level', 0) == 0) {
        update_option('access_level', 'level_10');
    }
    if (get_option('_wpdm_thumb_w', 0) == 0) {
        update_option('_wpdm_thumb_w', '200');
    }
    if (get_option('_wpdm_thumb_h', 0) == 0) {
        update_option('_wpdm_thumb_h', '100');
    }
    if (get_option('_wpdm_pthumb_w', 0) == 0) {
        update_option('_wpdm_pthumb_w', '400');
    }
    if (get_option('_wpdm_pthumb_h', 0) == 0) {
        update_option('_wpdm_pthumb_h', '250');
    }
    if (get_option('_wpdm_athumb_w', 0) == 0) {
        update_option('_wpdm_athumb_w', '50');
    }
    if (get_option('_wpdm_athumb_h', 0) == 0) {
        update_option('_wpdm_athumb_h', '50');
    }
    if (get_option('_wpdm_athumb_h', 0) == 0) {
        update_option('_wpdm_athumb_h', '50');
    }
    if (get_option('_wpdm_wthumb_h', 0) == 0) {
        update_option('_wpdm_wthumb_h', '150');
    }
    if (get_option('_wpdm_wthumb_h', 0) == 0) {
        update_option('_wpdm_wthumb_h', '70');
    }
    if (get_option('_wpdm_show_ct_bar', -1) == -1) {
        update_option('_wpdm_show_ct_bar', '1');
    }
    if (get_option('_wpdm_custom_template', '') == '') {
        update_option('_wpdm_custom_template', 'page.php');
    }
    update_option('wpdm_default_link_template', "[thumb_100x50]\r\n<br style='clear:both'/>\r\n<b>[popup_link]</b><br/>\r\n<b>[download_count]</b> downloads");
    update_option('wpdm_default_page_template', "[thumb_800x500]\r\n<br style='clear:both'/>\r\n[description]\r\n<fieldset class='pack_stats'>\r\n<legend><b>Package Statistics</b></legend>\r\n<table>\r\n<tr><td>Total Downloads:</td><td>[download_count]</td></tr>\r\n<tr><td>Stock Limit:</td><td>[quota]</td></tr>\r\n<tr><td>Total Files:</td><td>[file_count]</td></tr>\r\n</table>\r\n</fieldset><br>\r\n[download_link]");
    if (get_option('_wpdm_etpl') == '') {
        update_option('_wpdm_etpl', array('title' => 'Your download link', 'body' => file_get_contents(dirname(__FILE__) . '/templates/wpdm-email-lock-template.html')));
    }
    wpdm_common_actions();
    flush_rewrite_rules();
    CreateDir();
}
示例#3
0
function basic_settings()
{
    if (isset($_POST['task']) && $_POST['task'] == 'wdm_save_settings') {
        if ($_POST['__wpdm_curl_base'] == '') {
            $_POST['__wpdm_curl_base'] = 'wpdm-category';
        }
        if ($_POST['__wpdm_purl_base'] == '') {
            $_POST['__wpdm_purl_base'] = 'wpdm-package';
        }
        if ($_POST['__wpdm_curl_base'] == $_POST['__wpdm_purl_base']) {
            $_POST['__wpdm_curl_base'] .= 's';
        }
        foreach ($_POST as $optn => $optv) {
            update_option($optn, $optv);
        }
        if (!isset($_POST['__wpdm_login_form'])) {
            delete_option('__wpdm_login_form');
        }
        if (!isset($_POST['__wpdm_cat_desc'])) {
            delete_option('__wpdm_cat_desc');
        }
        if (!isset($_POST['__wpdm_cat_img'])) {
            delete_option('__wpdm_cat_img');
        }
        if (!isset($_POST['__wpdm_cat_tb'])) {
            delete_option('__wpdm_cat_tb');
        }
        flush_rewrite_rules();
        global $wp_rewrite;
        wpdm_common_actions();
        $wp_rewrite->flush_rules();
        die('Settings Saved Successfully');
    }
    include 'settings/basic.php';
}
示例#4
0
function wpdm_pro_Install()
{
    global $wpdb;
    delete_option('wpdm_latest');
    /*
    $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_files` (
            `id` int(11) NOT NULL AUTO_INCREMENT,
            `title` varchar(255) NOT NULL,
            `description` text NOT NULL,
            `link_label` varchar(255) NOT NULL,
            `password` text NOT NULL,
            `quota` int(11) NOT NULL,
            `show_quota` tinyint(11) NOT NULL,
            `show_counter` tinyint(1) NOT NULL,
            `access` text NOT NULL,
            `template` varchar(100) NOT NULL,
            `category` text NOT NULL,
            `icon` varchar(255) NOT NULL,
            `preview` varchar(255) NOT NULL,
            `files` text NOT NULL,
            `sourceurl` text NOT NULL,
            `download_count` int(11) NOT NULL,
            `page_template` varchar(255) NOT NULL,
            `url_key` varchar(255) NOT NULL,
            `uid` INT NOT NULL,
            `create_date` INT NOT NULL,
            `update_date` INT NOT NULL,
            PRIMARY KEY (`id`)
          ) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
    */
    $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_download_stats` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `pid` int(11) NOT NULL,\n              `uid` int(11) NOT NULL,\n              `oid` varchar(100) NOT NULL,\n              `year` int(4) NOT NULL,\n              `month` int(2) NOT NULL,\n              `day` int(2) NOT NULL,\n              `timestamp` int(11) NOT NULL,\n              `ip` varchar(20) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
    /*
    $sqls[] = "CREATE TABLE `{$wpdb->prefix}ahm_filemeta` (
           `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
           `pid` INT NOT NULL ,
           `name` VARCHAR( 80 ) NOT NULL ,
           `value` TEXT NOT NULL,
           `uniq` BOOLEAN NOT NULL DEFAULT '0'
          ) ENGINE = MyISAM  DEFAULT CHARSET=utf8";
    */
    $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_emails` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `email` varchar(255) NOT NULL,\n              `pid` int(11) NOT NULL,\n              `date` int(11) NOT NULL,\n              `custom_data` text NOT NULL,\n              `request_status` INT( 1 ) NOT NULL,\n              PRIMARY KEY (`id`)\n            )";
    /* $sqls[] = "CREATE TABLE  IF NOT EXISTS `{$wpdb->prefix}ahm_categories` (
       `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
       `title` VARCHAR( 255 ) NOT NULL ,
       `desc` TEXT NOT NULL ,
       `url_key` VARCHAR( 255 ) NOT NULL ,
       `pcount` INT NOT NULL ,
       `image` VARCHAR( 255 ) NOT NULL ,
       `parent` INT NOT NULL ,
       UNIQUE (
       `url_key`
       )
       )";*/
    //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `uid` INT NOT NULL";
    //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `create_date` INT NOT NULL";
    //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `update_date` INT NOT NULL";
    //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `url_key` varchar(255) NOT NULL";
    //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_emails` ADD `custom_data` TEXT NOT NULL ";
    //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_emails` ADD `request_status` INT( 1 ) NOT NULL ";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    foreach ($sqls as $sql) {
        $wpdb->query($sql);
        //dbDelta($sql);
    }
    if (get_option('_wpdm_etpl') == '') {
        update_option('_wpdm_etpl', array('title' => 'Your download link', 'body' => file_get_contents(dirname(__FILE__) . '/templates/wpdm-email-lock-template.html')));
    }
    wpdm_common_actions();
    flush_rewrite_rules();
    CreateDir();
}