WordPress.org

Support

Support » Plugins and Hacks » Intrusive Plugin!

Intrusive Plugin!

  • Apparently there is no support or even official website for this plug-in: Link Exchange Manager so I was wondering if some plug-in guru can help me to fix it so it works with WP 2.7

    This plug-in takes the Users option place on the admin interface, when I deactivate it the Users option comes back to its place.

    Here is the code:

    <?php
    /*
    Plugin Name: Link Exchange Manager
    Plugin URI: http://www.ebrandmarketing.com.au/wordpress-link-directory/
    Description: This plugin enables you to embed a link exchange directory right in the comfort of your own blog. Use this plugin to gain new partner sites and to improve your overall backlink count.
    Author: eBrandMarketing
    Version: 1.4
    Author URI: http://www.ebrandmarketing.com/
    */
    // install functions
    function eblex_executequery($query)
    {
        global $wpdb;
        $wpdb->query($query);
    } 
    
    function eblex_install()
    {
        global $table_prefix, $wpdb;
        $eblex_settings = $table_prefix . "eblex_settings";
        $eblex_categories = $table_prefix . "eblex_categories";
        $eblex_links = $table_prefix . "eblex_link";
    
        if ($wpdb->get_var("show tables like '$eblex_settings'") != $eblex_settings && $wpdb->get_var("show tables like '$eblex_categories'") != $eblex_categories && $wpdb->get_var("show tables like '$eblex_links'") != $eblex_links) {
            $sql = 'CREATE TABLE <code>' . $table_prefix . 'eblex_settings</code> ('
             . '<code>option</code> TINYTEXT NOT NULL ,'
             . '<code>value</code> MEDIUMTEXT NOT NULL ,'
             . '<code>id</code> INT NOT NULL ,'
             . 'INDEX ( <code>id</code> )'
             . ') ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;';
            $results = $wpdb->query($sql);
    
            $sql = 'CREATE TABLE <code>' . $table_prefix . 'eblex_captcha</code> ('
             . ' <code>id</code> VARCHAR(32) NOT NULL, '
             . ' <code>text</code> TINYTEXT NOT NULL, '
             . ' <code>time</code> BIGINT UNSIGNED NOT NULL,'
             . ' INDEX (<code>id</code>)'
             . ' )'
             . ' ENGINE = myisam;';
            $results = $wpdb->query($sql);
    
            $sql = 'CREATE TABLE <code>' . $table_prefix . 'eblex_categories</code> ('
             . ' <code>id</code> VARCHAR(32) NOT NULL, '
             . ' <code>parent</code> VARCHAR(32) NOT NULL, '
             . ' <code>title</code> MEDIUMTEXT NOT NULL, '
             . ' <code>description</code> MEDIUMTEXT NOT NULL, '
             . ' <code>keywords</code> MEDIUMTEXT NOT NULL, '
             . ' <code>nicename</code> MEDIUMTEXT NOT NULL, '
             . ' <code>time</code> BIGINT UNSIGNED NOT NULL, '
             . ' <code>visible</code> BOOL NOT NULL, '
             . ' <code>zindex</code> BIGINT NOT NULL,'
             . ' INDEX (<code>id</code>)'
             . ' )'
             . ' ENGINE = myisam'
             . ' CHARACTER SET utf8 COLLATE utf8_unicode_ci;';
            $results = $wpdb->query($sql);
    
            $sql = 'INSERT INTO <code>' . $table_prefix . 'eblex_categories</code> (<code>id</code>, <code>parent</code>, <code>title</code>, <code>description</code>, <code>keywords</code>, <code>nicename</code>, <code>time</code>, <code>visible</code>, <code>zindex</code>) VALUES (\'0\', \'\', \'Root\', \'Root directory\', \'\', \'root\', \'1\', \'1\', \'0\');';
            $results = $wpdb->query($sql);
    
            $sql = 'CREATE TABLE <code>' . $table_prefix . 'eblex_links</code> ('
             . ' <code>title</code> MEDIUMTEXT NOT NULL, '
             . ' <code>active</code> TINYINT NOT NULL, '
             . ' <code>nonreciprocal</code> TINYINT NOT NULL, '
             . ' <code>url</code> MEDIUMTEXT NOT NULL, '
             . ' <code>category</code> VARCHAR(32) NOT NULL, '
             . ' <code>description</code> MEDIUMTEXT NOT NULL, '
             . ' <code>email</code> MEDIUMTEXT NOT NULL, '
             . ' <code>reciprocalurl</code> MEDIUMTEXT NOT NULL, '
             . ' <code>status</code> TINYTEXT NOT NULL, '
             . ' <code>time</code> BIGINT UNSIGNED NOT NULL, '
             . ' <code>administratorcomment</code> MEDIUMTEXT NOT NULL, '
             . ' <code>zindex</code> BIGINT NOT NULL, '
             . ' <code>id</code> VARCHAR(32) NOT NULL,'
             . ' INDEX (<code>id</code>)'
             . ' )'
             . ' ENGINE = myisam'
             . ' CHARACTER SET utf8 COLLATE utf8_unicode_ci;';
            $results = $wpdb->query($sql);
        }
        // Add options
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('seofriendly', '1', '0');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('description', '1', '1');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('url', '1', '2');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('linksperpage', '10', '3');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('approval', '1', '4');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('nonreciprocal', '0', '5');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('validate', '1', '6');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('deactivate', '0', '7');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('is_active', '1', '8');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('maxdescsize', '350', '9');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('reciprocalurl', 'http://www.google.com', '10');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('spoof', '1', '11');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('email', '1', '12');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('emailto', 'do-not-reply@ebrandmarketing.com.au', '13');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('email2', '1', '14');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('email3', '1', '15');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('emailt1', 'Your link ({LINK}) has been approved to be displayed in our link directory!\n\nThank you for your submission!', '16');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('emailt2', 'We regret to inform you that your link ({LINK}) has not been approved to be displayed in our link directory due to incompatibility with our policies.\n\nYou may have submitted an invalid reciprocal URL, placed your link in a wrong category, or maybe you skipped on writing an adequate description for it. If this is the case, you may try and submit your link again.\n\nThank you for your submission.', '17');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('showcategorydescription', '0', '18');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('keywords', '', '19'), ('pagedescription', 'Link Directory', '20');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('captcha', '1', '21');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('name', 'Link Directory', '22');");
        eblex_executequery("INSERT INTO <code>&quot; . $table_prefix . &quot;eblex_settings</code> (<code>option</code>, <code>value</code>, <code>id</code>) VALUES ('emailfrom', 'do-not-reply@ebrandmarketing.com.au', '23');");
    }
    // UNINSTALL
    function eblex_uninstall()
    {
        global $table_prefix, $wpdb;
        $eblex_settings = $table_prefix . "eblex_settings";
        $eblex_categories = $table_prefix . "eblex_categories";
        $eblex_links = $table_prefix . "eblex_links";
        $eblex_deactivate = $wpdb->get_var("SELECT <code>value</code> FROM <code>$eblex_settings</code> WHERE <code>option</code>='deactivate'");
    
        if ($eblex_deactivate == "1") {
            eblex_executequery('DROP TABLE <code>' . $table_prefix . 'eblex_settings</code>');
            eblex_executequery('DROP TABLE <code>' . $table_prefix . 'eblex_categories</code>');
            eblex_executequery('DROP TABLE <code>' . $table_prefix . 'eblex_links</code>');
            eblex_executequery('DROP TABLE <code>' . $table_prefix . 'eblex_captcha</code>');
        } else {
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='seofriendly'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='description'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='url'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='linksperpage'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='approval'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='nonreciprocal'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='validate'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='deactivate'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='is_active'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='maxdescsize'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='reciprocalurl'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='spoof'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='email'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='emailto'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='email2'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='email3'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='emailt1'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='emailt2'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='showcategorydescription'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='keywords'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='pagedescription'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='captcha'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='name'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='emailfrom'");
            // Patch
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='lic'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='seo1'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='seo2'");
            eblex_executequery("DELETE FROM <code>&quot; . $table_prefix . &quot;eblex_settings</code> WHERE <code>option</code>='seo3'");
        }
    }
    // Create the button for the plugin
    function eblex_put_button()
    {
        global $menu, $submenu, $wpdb, $table_prefix;
        $menu[50] = array(__('Link exchange'), 'manage_links', 'link-exchange.php');
        $inbox = $wpdb->get_var("SELECT count(*) FROM <code>&quot; . $table_prefix . &quot;eblex_links</code> WHERE <code>active</code>='0'");
    
        if ($_GET['action'] == "delete") {
            $confirmation = $wpdb->get_var("SELECT <code>id</code> FROM <code>&quot; . $table_prefix . &quot;eblex_links</code> WHERE <code>id</code>='" . $_GET['id'] . "'");
            if ($confirmation != "") {
                $inbox--;
            }
        } 
    
        if ($_GET['action'] == "approve") {
            $confirmation = $wpdb->get_var("SELECT <code>id</code> FROM <code>&quot; . $table_prefix . &quot;eblex_links</code> WHERE <code>id</code>='" . $_GET['id'] . "' AND <code>active</code>='0'");
            if ($confirmation != "") {
                $inbox--;
            }
        } 
    
        $submenu['link-exchange.php'][0] = array(__('Home'), 'manage_links', 'link-exchange.php');
        $submenu['link-exchange.php'][5] = array(__('Inbox (' . $inbox . ')'), 'manage_links', 'link-exchange-inbox.php');
        $submenu['link-exchange.php'][10] = array(__('Quick Add'), 'manage_links', 'link-exchange-qa.php');
        $submenu['link-exchange.php'][15] = array(__('Categories'), 'manage_links', 'link-exchange-categories.php');
        $submenu['link-exchange.php'][20] = array(__('Browse links'), 'manage_links', 'link-exchange-browse.php');
        $submenu['link-exchange.php'][25] = array(__('Search'), 'manage_links', 'link-exchange-search.php');
        $submenu['link-exchange.php'][30] = array(__('Backlink cleansing'), 'manage_links', 'link-exchange-clean.php');
        $submenu['link-exchange.php'][35] = array(__('Statistics'), 'manage_links', 'link-exchange-stats.php');
        $submenu['link-exchange.php'][40] = array(__('Settings'), 'manage_links', 'link-exchange-settings.php');
        $submenu['link-exchange.php'][45] = array(__('Help'), 'manage_links', 'link-exchange-help.php');
    } 
    
    add_action('admin_head', 'eblex_put_button');
    add_action('activate_linkexchange/plugin.php', 'eblex_install');
    add_action('deactivate_linkexchange/plugin.php', 'eblex_uninstall');
    
    ?>

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Intrusive Plugin!’ is closed to new replies.
Skip to toolbar