function upgrade_wp_tables()
 {
     global $xoopsDB;
     require_once dirname(dirname(__FILE__)) . '/wp-config.php';
     if ($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('postmeta')) == false) {
         $sql1 = "CREATE TABLE " . wp_table('postmeta') . " (\n\t\t\t\t\t\tmeta_id int(11) NOT NULL auto_increment,\n\t\t\t\t\t\tpost_id int(11) NOT NULL default '0',\n\t\t\t\t\t\tmeta_key varchar(255) default NULL,\n\t\t\t\t\t\tmeta_value text,\n\t\t\t\t\t\tPRIMARY KEY\t (meta_id),\n\t\t\t\t\t\tKEY post_id (post_id),\n\t\t\t\t\t\tKEY meta_key (meta_key)\n\t\t\t\t\t)";
         $xoopsDB->query($sql1);
         $GLOBALS['msgs'][] = "TABLE " . wp_table('postmeta') . " is added.";
     }
     if (!$xoopsDB->getRowsNum($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('comments') . " LIKE 'comment_type'"))) {
         $sql1 = "ALTER TABLE " . wp_table('comments') . " ADD (\n\t\t\t\t\t\tcomment_agent varchar(255) NOT NULL default '',\n\t\t\t\t\t\tcomment_type varchar(20) NOT NULL default '',\n\t\t\t\t\t\tcomment_parent int(11) NOT NULL default '0',\n\t\t\t\t\t\tuser_id int(11) NOT NULL default '0'\n\t\t\t\t\t)";
         $xoopsDB->query($sql1);
         $GLOBALS['msgs'][] = "TABLE " . wp_table('comments') . " is modified.";
     }
     # --------------------------------------------------------
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =7 AND option_name ='new_users_can_blog'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =7");
     }
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =8 AND option_name ='users_can_register'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =8");
     }
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =91 AND option_name ='gzipcompression'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =91");
     }
     if (!get_settings('use_comment_preview')) {
         add_option('use_comment_preview', '0', 2, "Display Preview Screen after comment posting.", 2, 8);
     }
     if (!get_settings('active_plugins')) {
         add_option('active_plugins', "\n");
     }
 }
 function timesince()
 {
     global $post;
     $older_date = abs(strtotime($post->post_date_gmt . " GMT"));
     $newer_date = time();
     $chunks = array(array(60 * 60 * 24 * 365, 'year'), array(60 * 60 * 24 * 30, 'month'), array(60 * 60 * 24 * 7, 'week'), array(60 * 60 * 24, 'day'), array(60 * 60, 'hour'), array(60, 'minute'));
     $newer_date = $newer_date == false ? time() + 60 * 60 * get_settings("gmt_offset") : $newer_date;
     $since = $newer_date - $older_date;
     for ($i = 0, $j = count($chunks); $i < $j; $i++) {
         $seconds = $chunks[$i][0];
         $name = $chunks[$i][1];
         if (($count = floor($since / $seconds)) != 0) {
             break;
         }
     }
     $output = $count == 1 ? '1 ' . $name : "{$count} {$name}s";
     if ($i + 1 < $j) {
         $seconds2 = $chunks[$i + 1][0];
         $name2 = $chunks[$i + 1][1];
         if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) {
             $output .= $count2 == 1 ? ', 1 ' . $name2 : ", {$count2} {$name2}s";
         }
     }
     echo $output;
 }
Exemple #3
0
function wptouch_time_since($older_date, $newer_date = false)
{
    // array of time period chunks
    $chunks = array(array(60 * 60 * 24 * 30, __('mo', 'wptouch')), array(60 * 60 * 24 * 7, __('wk', 'wptouch')), array(60 * 60 * 24, __('day', 'wptouch')), array(60 * 60, __('hr', 'wptouch')), array(60, __('min', 'wptouch')));
    $newer_date = $newer_date == false ? time() + 60 * 60 * get_settings("gmt_offset") : $newer_date;
    // difference in seconds
    $since = $newer_date - $older_date;
    for ($i = 0, $j = count($chunks); $i < $j; $i++) {
        $seconds = $chunks[$i][0];
        $name = $chunks[$i][1];
        // finding the biggest chunk (if the chunk fits, break)
        if (($count = floor($since / $seconds)) != 0) {
            break;
        }
    }
    // set output var
    $output = $count == 1 ? '1 ' . $name : "{$count} {$name}s";
    // step two: the second chunk
    if ($i + 1 < $j) {
        $seconds2 = $chunks[$i + 1][0];
        $name2 = $chunks[$i + 1][1];
        if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) {
            // add to output var
            $output .= $count2 == 1 ? ', 1 ' . $name2 : ", {$count2} {$name2}s";
        }
    }
    return $output;
}
/**
* @desc Output of king widget css and js in admin head area. Is included in every king widget
* @author Georg Leciejewski
*/
function widget_king_admin_head()
{
    //$js_dir = str_replace(ABSPATH, get_settings('siteurl').'/', dirname(__FILE__)) . '/js';
    $js_dir = get_settings('siteurl') . '/wp-content/plugins/king-includes/js/';
    $css_dir = get_settings('siteurl') . '/wp-content/plugins/king-includes/css/';
    if (strpos($_SERVER['REQUEST_URI'], 'themes.php') !== false || strpos($_SERVER['REQUEST_URI'], 'king-framework.php') !== false) {
        # only include in themes area
        echo '<link rel="stylesheet" href="' . $css_dir . 'king_widget.css" type="text/css" media="screen" />' . "\n";
        echo '<script type="text/javascript" src="' . $js_dir . 'jquery.js"></script>' . "\n";
        echo '<script type="text/javascript" src="' . $js_dir . 'jquery_plugins.js"></script>' . "\n";
        echo '<script type="text/javascript" src="' . $js_dir . 'tooltip.js"></script>' . "\n";
        echo '<script type="text/javascript" src="' . $js_dir . 'king_widgets.js"></script>' . "\n";
        load_plugin_textdomain('widgetKing', '/wp-content/plugins/king-includes/lang');
    } elseif (strpos($_SERVER['REQUEST_URI'], 'post.php') !== false) {
        # only include in post article temp. disabled since incompatibilities
        # and new methods to add js to head in wp2.1
        //		echo '<link rel="stylesheet" href="'. $css_dir.'king_admin.css" type="text/css" media="screen" />'."\n";
        //		echo '<script type="text/javascript" src="'.$js_dir.'jquery.js"></script>'."\n";
        //		echo '<script type="text/javascript" src="'.$js_dir.'jquery_plugins.js"></script>'."\n";
        //		echo '<script type="text/javascript" src="'.$js_dir.'king_admin.js"></script>'."\n";
    }
    if (strpos($_SERVER['REQUEST_URI'], 'plugins.php') !== false) {
        echo '<script type="text/javascript" src="' . $js_dir . 'prototype-1.4.0.js"></script>' . "\n";
        load_plugin_textdomain('widgetKing', '/wp-content/plugins/king-includes/lang');
    }
}
Exemple #5
0
 /**
  *
  */
 function __construct()
 {
     $apiKey = get_settings('site_settings', 'gerencianet_apikey');
     $apiSecret = get_settings('site_settings', 'gerencianet_apisecret');
     $options = ['client_id' => $apiKey, 'client_secret' => $apiSecret, 'sandbox' => ENVIRONMENT == 'development' ? true : false];
     $this->api = new Gerencianet($options);
 }
 function wp_mail($to, $subject, $message, $headers = '')
 {
     if ($headers == '') {
         $headers = "MIME-Version: 1.0\n" . "From: " . get_settings('admin_email') . "\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
     }
     return @mail($to, $subject, $message, $headers);
 }
Exemple #7
0
function etruel_AdServe_Bannersave($id)
{
    global $wpdb, $table_prefix;
    $table_name = $wpdb->prefix . "adserve";
    $scriptcode = isset($_POST['scriptcode']) ? 1 : 0;
    $src = !empty($_POST['src']) ? $_POST['src'] : '';
    $width = !empty($_POST['width']) ? $_POST['width'] : null;
    $height = !empty($_POST['height']) ? $_POST['height'] : null;
    if ($scriptcode) {
        $ok = true;
    } else {
        $ext = substr($src, strlen($src) - 3, 3);
        if ($ext !== 'swf' || $width != null && $height !== null) {
            $ok = true;
        } else {
            $ok = false;
        }
    }
    if ($ok) {
        $height = is_null($height) ? 'null' : $height;
        $width = is_null($width) ? $height : $width;
        if ($id > 0) {
            // update
            $query = "  UPDATE {$table_name}\n                        SET\n                            title\t\t='" . $_POST['title'] . "',\n                            scriptcode \t= " . $scriptcode . ",\n                            url\t\t\t='" . $_POST['url'] . "',\n                            src\t\t\t='" . urlencode($src) . "',\n                            user\t\t='" . $_POST['user'] . "',\n                            email\t\t='" . $_POST['email'] . "',\n                            keywords\t='" . $_POST['keywords'] . "',\n                            width\t\t= " . $width . ",\n                            height\t\t= " . $height . "\n                        WHERE id={$id}";
        } else {
            // insert
            $query = "  INSERT INTO {$table_name}" . " (title, scriptcode, url, src, email, keywords, impressions, clicks, width, height) " . "VALUES ('" . $_POST['title'] . "', '" . $scriptcode . "', '" . $_POST['url'] . "', '" . urlencode($src) . "', '" . $_POST['email'] . "', '" . $_POST['keywords'] . "',0, 0, {$width}, {$height})";
        }
        //echo $query."<br>";
        $wpdb->query($query);
    }
    return get_settings('siteurl') . "/wp-admin/admin.php?page=admanage";
}
Exemple #8
0
function mdv_recent_posts($no_posts = 10, $before = '<li>', $after = '</li>', $hide_pass_post = true, $skip_posts = 0, $show_excerpts = false)
{
    global $wpdb;
    $time_difference = get_settings('gmt_offset');
    $now = gmdate("Y-m-d H:i:s", time());
    $request = "SELECT ID, post_title, post_excerpt FROM {$wpdb->posts} WHERE post_status = 'publish' ";
    if ($hide_pass_post) {
        $request .= "AND post_password ='' ";
    }
    $request .= "AND post_date_gmt < '{$now}' ORDER BY post_date DESC LIMIT {$skip_posts}, {$no_posts}";
    $posts = $wpdb->get_results($request);
    $output = '';
    if ($posts) {
        foreach ($posts as $post) {
            $post_title = stripslashes($post->post_title);
            $permalink = get_permalink($post->ID);
            $output .= $before . '<a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . htmlspecialchars($post_title, ENT_COMPAT) . '">' . htmlspecialchars($post_title) . '</a>';
            if ($show_excerpts) {
                $post_excerpt = stripslashes($post->post_excerpt);
                $output .= '<br />' . $post_excerpt;
            }
            $output .= $after;
        }
    } else {
        $output .= $before . "None found" . $after;
    }
    echo $output;
}
Exemple #9
0
function AGCZone_Settings()
{
    echo '<div class="wrap">';
    echo '<h2>AGCZone Plugins Settings</h2>';
    echo '<form method="post" action="options.php">';
    echo settings_fields('az-settings-group');
    echo get_settings('az-settings-group');
    echo '<table class="form-table">';
    echo '<tr valign="top">';
    echo '<th scope="row">Your Amazon Affiliate ID</th>';
    echo '<td><input type="text" name="affid" value="' . get_option('affid') . '" /></td>';
    echo '</tr>';
    echo '<tr valign="top">';
    echo '<th scope="row">Your Amazon API Key</th>';
    echo '<td><input type="text" name="apikey" value="' . get_option('apikey') . '" /></td>';
    echo '</tr>';
    echo '<tr valign="top">';
    echo '<th scope="row">Your Amazon Secret Key</th>';
    echo '<td><input type="text" name="secret_key" value="' . get_option('secret_key') . '" /></td>';
    echo '</tr>';
    echo '<tr valign="top">';
    echo '<th scope="row">Amazon Country</th>';
    echo '<td><input type="text" name="region" value="' . get_option('region') . '" /></td>';
    echo '</tr>';
    echo '<tr valign="top">';
    echo '<th scope="row">Sets Category</th>';
    echo '<td><input type="text" name="department" value="' . get_option('department') . '" /></td>';
    echo '</tr>';
    echo '</table>';
    echo submit_button();
    echo '</form>';
    echo '</div>';
}
Exemple #10
0
 public static function ing_recent_posts($no_posts = 8, $before = '<li>', $after = "</li>\n", $hide_pass_post = true, $skip_posts = 0, $type = 'post')
 {
     global $wpdb;
     $time_difference = get_settings('gmt_offset');
     $now = gmdate("Y-m-d H:i:s", time());
     $request = "SELECT ID, post_title, post_content, DATE_FORMAT(post_date_gmt, '%M %d %Y') as my_date FROM {$wpdb->posts} WHERE post_status = 'publish'  ";
     if ($hide_pass_post) {
         $request .= "AND post_password ='' ";
     }
     $request .= "AND post_type='{$type}' ";
     $request .= "ORDER BY post_date DESC LIMIT {$skip_posts}, {$no_posts}";
     $posts = $wpdb->get_results($request);
     $output = '';
     if ($posts) {
         foreach ($posts as $post) {
             $post_title = stripslashes($post->post_title);
             $permalink = get_permalink($post->ID);
             $content = stripslashes($post->post_content);
             $stripedcontent = strip_tags($content);
             $shortexcerpt = $this->ing_truncate($stripedcontent, 90);
             $output .= $before;
             $output .= '<span class="shortexcerpt">' . $shortexcerpt . '</span>';
             $output .= '<br /><span class="postdate">' . $post->my_date . '</span> - by <span class="name">' . htmlspecialchars($post_title) . '</span> - <a href="' . $permalink . '" rel="bookmark" class="postlink" title="' . htmlspecialchars($post_title, ENT_COMPAT) . '">Read Post</a> ';
             //$output .= '<a href="' . $permalink . '" rel="bookmark" title="' . htmlspecialchars($post_title, ENT_COMPAT) . '">' . htmlspecialchars($post_title). '</a>';
             $output .= $after;
         }
     } else {
         $output .= $before . "Sorry, No Recent Stories!" . $after;
     }
     return $output;
 }
Exemple #11
0
 public static function get_news_settings()
 {
     if (empty(self::$news_settings)) {
         self::$news_settings = get_settings("news");
     }
     return self::$news_settings;
 }
function wpbl_notify($comment_id, $reason, $harvest)
{
    global $wpdb, $wp_id, $url, $email, $comment, $user_ip, $comment_post_ID, $author, $tableposts;
    $tableposts = $wpdb->posts[$wp_id];
    $sql = "SELECT * FROM {$tableposts} WHERE ID='{$comment_post_ID}' LIMIT 1";
    $post = $wpdb->get_row($sql);
    if (!empty($user_ip)) {
        $comment_author_domain = gethostbyaddr($user_ip);
    } else {
        $comment_author_domain = '';
    }
    // create the e-mail body
    $notify_message = "A new comment on post #{$comment_post_ID} \"" . stripslashes($post->post_title) . "\" has been automatically deleted by the WPBlacklist plugin.\r\n\r\n";
    $notify_message .= "Author : {$author} (IP: {$user_ip} , {$comment_author_domain})\r\n";
    $notify_message .= "E-mail : {$email}\r\n";
    $notify_message .= "URL    : {$url}\r\n";
    $notify_message .= "Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput={$user_ip}\r\n";
    $notify_message .= "Comment:\r\n" . stripslashes($comment) . "\r\n\r\n";
    $notify_message .= "Triggered by : {$reason}\r\n\r\n";
    // add harvested info - if there is any
    if (!empty($harvest)) {
        $notify_message .= "Harvested the following information:\r\n" . stripslashes($harvest);
    }
    // e-mail header
    $subject = '[' . stripslashes(get_settings('blogname')) . '] Automatically deleted: "' . stripslashes($post->post_title) . '"';
    $admin_email = get_settings("admin_email");
    $from = "From: {$admin_email}";
    // send e-mail
    if (function_exists('mb_send_mail')) {
        mb_send_mail($admin_email, $subject, $notify_message, $from);
    } else {
        @mail($admin_email, $subject, $notify_message, $from);
    }
    return true;
}
function bm_custom_login()
{
    // default wordpress mu plugin path
    $pluginPath = "/wp-content/mu-plugins/";
    // change this to wordpress mu version that has the new login design
    $versionCheck = 999;
    // is it wordpress mu or wordpress normal?
    if (!is_dir($pluginPath)) {
        $pluginPath = "/wp-content/plugins/";
        $versionCheck = 2.5;
    }
    $themeVersions = array(array('min' => 0, 'max' => 2.5, 'css' => '/bm-custom-login.css'), array('min' => 2.5, 'max' => 2.7, 'css' => '/bm-custom-login-2.css'), array('min' => 2.7, 'max' => 5, 'css' => '/bm-custom-login-3.css'));
    // full plugin path
    $pluginUrl = get_settings('siteurl') . $pluginPath . plugin_basename(dirname(__FILE__));
    // check which version of wp is being used
    $blogVersion = substr(get_bloginfo('version'), 0, 3);
    // split style sheets based upon current wp version
    foreach ($themeVersions as $version) {
        if ($blogVersion >= $version['min'] && $blogVersion < $version['max']) {
            $pluginUrl .= $version['css'];
            break;
        }
    }
    echo '<link rel="stylesheet" type="text/css" href="' . $pluginUrl . '" />';
}
function check_option($opt)
{
    $settings = get_settings('bas_options');
    if (in_array($opt, $settings)) {
        echo ' checked="checked"';
    }
}
function pg_action_init()
{
    global $pg_options;
    include 'js/atatari.php';
    load_plugin_textdomain('platesgenerator', false, dirname(plugin_basename(__FILE__)) . '/languages/');
    $pg_options = array('your_reg_caption' => __('your_reg_caption', 'platesgenerator'), 'your_reg_description' => __('your_reg_description', 'platesgenerator'), 'plate_size_caption' => __('plate_size_caption', 'platesgenerator'), 'text_style_caption' => __('text_style_caption', 'platesgenerator'), 'badge_caption' => __('badge_caption', 'platesgenerator'), 'border_caption' => __('border_caption', 'platesgenerator'), 'slogan_caption' => __('slogan_caption', 'platesgenerator'), 'your_mail' => get_settings('admin_email'));
}
Exemple #16
0
function postie_loadjs_admin_head()
{
    $plugindir = get_settings('home') . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__));
    wp_enqueue_script('loadjs', $plugindir . '/js/simpleTabs.jquery.js');
    echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('url') . '/wp-content/plugins/postie/css/style.css" />' . "\n";
    echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('url') . '/wp-content/plugins/postie/css/simpleTabs.css" />' . "\n";
}
Exemple #17
0
function is_referer_search_engine($engine = 'google')
{
    $siteurl = get_settings('home');
    $referer = urldecode($_SERVER['HTTP_REFERER']);
    //echo "referer is: $referer<br />";
    if (!$engine) {
        return 0;
    }
    switch ($engine) {
        case 'google':
            if (preg_match('|^http://(www)?\\.?google.*|i', $referer)) {
                return 1;
            }
            break;
        case 'lycos':
            if (preg_match('|^http://search\\.lycos.*|i', $referer)) {
                return 1;
            }
            break;
        case 'yahoo':
            if (preg_match('|^http://search\\.yahoo.*|i', $referer)) {
                return 1;
            }
            break;
        case 'wordpress':
            if (preg_match("#^{$siteurl}#i", $referer)) {
                return 1;
            }
            break;
    }
    return 0;
}
Exemple #18
0
function time_since($older_date, $newer_date = false)
{
    // array of time period chunks
    $chunks = array(array(60 * 60 * 24 * 365, 'year'), array(60 * 60 * 24 * 30, 'month'), array(60 * 60 * 24 * 7, 'week'), array(60 * 60 * 24, 'day'), array(60 * 60, 'hour'), array(60, 'minute'));
    // $newer_date will equal false if we want to know the time elapsed between a date and the current time
    // $newer_date will have a value if we want to work out time elapsed between two known dates
    $newer_date = $newer_date == false ? time() + 60 * 60 * get_settings("gmt_offset") : $newer_date;
    // difference in seconds
    $since = $newer_date - $older_date;
    // we only want to output two chunks of time here, eg:
    // x years, xx months
    // x days, xx hours
    // so there's only two bits of calculation below:
    // step one: the first chunk
    for ($i = 0, $j = count($chunks); $i < $j; $i++) {
        $seconds = $chunks[$i][0];
        $name = $chunks[$i][1];
        // finding the biggest chunk (if the chunk fits, break)
        if (($count = floor($since / $seconds)) != 0) {
            break;
        }
    }
    // set output var
    $output = $count == 1 ? '1 ' . $name : "{$count} {$name}s";
    // step two: the second chunk
    if ($i + 1 < $j) {
        $seconds2 = $chunks[$i + 1][0];
        $name2 = $chunks[$i + 1][1];
        if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) {
            // add to output var
            $output .= $count2 == 1 ? ', 1 ' . $name2 : ", {$count2} {$name2}s";
        }
    }
    return $output;
}
/**
* Better display of avatars in comments
* Should only be used in comment sections (may update in future)
* Checks for false empty commenter URLs 'http://' w/registered users
* Adds the class 'photo' to the image
* Adds a call to 'images/trackback.jpg' for trackbacks
* Adds a call to 'images/pingback.jpg' for pingbacks
*
* Filters should only return a string for an image URL for the avatar with class $avatar
* They should not get the avatar as this is done after the filter
*
* @since 0.2
* @filter
*/
function comicpress_avatar()
{
    global $comment;
    $url = get_comment_author_url();
    $comment_type = get_comment_type();
    if (get_settings('avatar_default')) {
        $avatar = get_settings('avatar_default');
    }
    //	$avatar = apply_filters('comicpress_avatar', $avatar);
    if ($comment_type != 'pingback' && $comment_type != 'trackback') {
        echo '<div class="comment-avatar">';
        if ($url == true && $url != 'http://') {
            echo '<a href="' . $url . '" rel="external nofollow" title="' . wp_specialchars(get_comment_author(), 1) . '">';
        }
        $id_or_email = get_comment_author_email();
        if (empty($id_or_email)) {
            $id_or_email = get_comment_author();
        }
        if (function_exists('comicpress_get_avatar') && $comment_type != 'pingback' && $comment_type != 'trackback') {
            echo str_replace("alt='", "alt='" . wp_specialchars(get_comment_author(), 1) . "' title='" . wp_specialchars(get_comment_author(), 1), comicpress_get_avatar($id_or_email, 64));
        } else {
            echo '<img src="' . get_template_directory_uri() . '/' . $avatar . '" class="avatar photo" />';
        }
        if ($url == true && $url != 'http://') {
            echo '</a>';
        }
        echo '</div>';
    }
}
function email_back($id)
{
    global $wpdb, $email_send_comment;
    $reply_id = mysql_escape_string($_REQUEST['comment_reply_ID']);
    $post_id = mysql_escape_string($_REQUEST['comment_post_ID']);
    if ($reply_id == 0 || $_REQUEST["email"] != get_settings('admin_email') && !isset($_REQUEST['comment_email_back'])) {
        return;
    }
    $comment = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_ID='{$id}' LIMIT 0, 1");
    $reply_comment = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_ID='{$reply_id}' LIMIT 0, 1");
    $post = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID='{$post_id}' LIMIT 0, 1");
    $comment = $comment[0];
    $reply_comment = $reply_comment[0];
    $post = $post[0];
    $title = $post->post_title;
    $author = $reply_comment->comment_author;
    $url = get_permalink($post_id);
    $to = $reply_comment->comment_author_email;
    if ($to == "") {
        return;
    }
    $subject = "The author replied your comment at [" . get_bloginfo() . "]'" . $title;
    $date = mysql2date('Y.m.d H:i', $reply_comment->comment_date);
    $message = "\r\n\t<div>\r\n\t\t<p>Dear {$author}:<p>\r\n\t\t<p>{$comment->comment_content}</p>\r\n\t\t<div style='color:grey;'><small>{$date}, your comment at " . get_bloginfo() . "<a href='{$url}#comment-{$id}'>{$title}</a>: </small>\r\n\t\t\t<blockquote>\r\n\t\t\t\t<p>{$reply_comment->comment_content}</p>\r\n\t\t\t</blockquote>\r\n\t\t</div>\r\n\t</div>";
    // strip out some chars that might cause issues, and assemble vars
    $site_name = get_bloginfo();
    $site_email = get_settings('admin_email');
    $charset = get_settings('blog_charset');
    $headers = "From: \"{$site_name}\" <{$site_email}>\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: text/html; charset=\"{$charset}\"\n";
    $email_send_comment = "Email notification has sent to " . $to . " with subject '" . $subject . "'";
    return wp_mail($to, $subject, $message, $headers);
}
 function upgrade_wp_tables()
 {
     global $xoopsDB;
     require_once dirname(dirname(__FILE__)) . '/wp-config.php';
     if ($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('postmeta')) == false) {
         $sql1 = "CREATE TABLE " . wp_table('postmeta') . " (\n\t\t\t\t\t\tmeta_id int(11) NOT NULL auto_increment,\n\t\t\t\t\t\tpost_id int(11) NOT NULL default '0',\n\t\t\t\t\t\tmeta_key varchar(255) default NULL,\n\t\t\t\t\t\tmeta_value text,\n\t\t\t\t\t\tPRIMARY KEY\t (meta_id),\n\t\t\t\t\t\tKEY post_id (post_id),\n\t\t\t\t\t\tKEY meta_key (meta_key)\n\t\t\t\t\t)";
         $xoopsDB->query($sql1);
         $GLOBALS['msgs'][] = "TABLE " . wp_table('postmeta') . " is added.";
     }
     if (!$xoopsDB->getRowsNum($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('comments') . " LIKE 'comment_type'"))) {
         $sql1 = "ALTER TABLE " . wp_table('comments') . " ADD (\n\t\t\t\t\t\tcomment_agent varchar(255) NOT NULL default '',\n\t\t\t\t\t\tcomment_type varchar(20) NOT NULL default '',\n\t\t\t\t\t\tcomment_parent int(11) NOT NULL default '0',\n\t\t\t\t\t\tuser_id int(11) NOT NULL default '0'\n\t\t\t\t\t)";
         $xoopsDB->query($sql1);
         $GLOBALS['msgs'][] = "TABLE " . wp_table('comments') . " is modified.";
     }
     $sql1 = "ALTER TABLE " . wp_table('options') . " CHANGE \n\t\t\t\t\toption_value option_value longtext NOT NULL default ''\n\t\t\t\t";
     $xoopsDB->query($sql1);
     $GLOBALS['msgs'][] = "TABLE " . wp_table('options') . " is modified.";
     $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id=1");
     $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id=2");
     $xoopsDB->query("UPDATE " . wp_table('optiongroup_options') . " SET seq=1 WHERE group_id=6 AND option_id=3");
     $xoopsDB->query("UPDATE " . wp_table('optiongroup_options') . " SET seq=2 WHERE group_id=6 AND option_id=4");
     $xoopsDB->query("UPDATE " . wp_table('optiongroup_options') . " SET seq=3 WHERE group_id=6 AND option_id=54");
     # --------------------------------------------------------
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =7 AND option_name ='new_users_can_blog'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =7");
     }
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =8 AND option_name ='users_can_register'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =8");
     }
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =91 AND option_name ='gzipcompression'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =91");
     }
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =27 AND option_name ='use_blodotgsping'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=3 AND option_id =27");
     }
     if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =28 AND option_name ='blodotgsping_url'")) {
         $xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=3 AND option_id =28");
     }
     if (!get_settings('use_comment_preview')) {
         add_option('use_comment_preview', '0', 2, "Display Preview Screen after comment posting.", 2, 8);
     }
     if (!get_settings('active_plugins')) {
         add_option('active_plugins', "\n");
     }
     if (!get_settings('check_trackback_content')) {
         add_option('check_trackback_content', '0', 3, '_LANG_INST_BASE_VALUE95', 2, 8);
     }
     if (!get_settings('trackback_filename')) {
         add_option('trackback_filename', 'wp-trackback.php', 3, 'TrackBack File Name (default wp-trackback.php)', 3, 8);
     }
     if (!get_settings('xmlrpc_filename')) {
         add_option('xmlrpc_filename', 'xmlrpc.php', 3, 'TrackBack File Name (default xmlrpc.php)', 3, 8);
     }
     if (!get_settings('xmlrpc_autodetect')) {
         add_option('xmlrpc_autodetect', '0', 3, 'Enable XMLRPC File Auto detection', 2, 8);
     }
     $date_format = get_settings('date_format');
     $date_format = str_replace('\\\\d', '\\d', $date_format);
     update_option('date_format', $date_format);
 }
Exemple #22
0
function be_themes_contact_authentication()
{
    $contact_name = $_POST['contact_name'];
    $contact_email = $_POST['contact_email'];
    $contact_comment = $_POST['contact_comment'];
    $contact_subject = $_POST['contact_subject'];
    if (empty($contact_name) || empty($contact_email) || empty($contact_comment) || empty($contact_subject)) {
        $result['status'] = "error";
        $result['data'] = __('All fields are required', 'be-themes');
    } else {
        if (!preg_match('/^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,6}$/', $contact_email)) {
            $result['status'] = "error";
            $result['data'] = __('Please enter a valid email address', 'be-themes');
        } else {
            if (!empty($contact_name) && !empty($contact_email) && !empty($contact_comment) && !empty($contact_subject)) {
                $to = get_settings('admin_email');
                $subject = $contatc_subject;
                $from = $contact_email;
                $headers = "From:" . $from;
                //mail($to,$subject,$contact_comment,$headers);
                $result['status'] = "sucess";
                $result['data'] = __('Your message was sent sucessfully', 'be-themes');
            }
        }
    }
    header('Content-type: application/json');
    echo json_encode($result);
    die;
}
Exemple #23
0
function bbld_install()
{
    if (get_option('wpbb_status') == FALSE) {
        $bbpath = '/bbpress';
        // Adjust the path to suit your bbpress location. Example: '/forums'
        $wpbburl = get_settings('home') . $bbpath;
        update_option('wpbb_path', $wpbburl);
        $forum_slimit = '10';
        // Adjust the limit to show
        update_option('wpbb_limit', $forum_slimit);
        $bbdb_prefix = 'bb_';
        // Set Bbpress Prefix
        update_option('wpbb_bbprefix', $bbdb_prefix);
        $limit = '100';
        update_option('wpbb_slimit', $limit);
        update_option('wpbb_permalink', false);
        update_option('wpbb_intergrated', false);
        update_option('wpbb_exdb', false);
        update_option('wpbb_dbuser', DB_USER);
        update_option('wpbb_dbpass', DB_PASSWORD);
        update_option('wpbb_dbname', DB_NAME);
        update_option('wpbb_dbhost', DB_HOST);
        $install_status = 'install';
        update_option('wpbb_status', $install_status);
        update_option('wpbb_lastposter', true);
        update_option('wpbb_inside', true);
    }
}
Exemple #24
0
 function widget($args, $instance)
 {
     global $wpdb;
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
     $group = empty($instance['group']) ? 'Group' : $instance['group'];
     $size = empty($instance['size']) ? 'Group' : $instance['size'];
     define('MYPLUGIN_PATH', get_settings('siteurl') . '/wp-content/plugins/ggroups');
     // Before the widget
     echo $before_widget;
     print '<link rel="stylesheet" href="' . MYPLUGIN_PATH . '/ggroup.css" type="text/css" media="screen" />';
     echo '<div id="ggroup-wrap">';
     // The title
     echo '<div class="gimage">';
     echo $before_title;
     //			echo('<img src="'.PLUGINDIR.'/ggroups/googlegroups.png"><br />');
     echo $title . $after_title;
     echo '</div><br/>';
     echo '<div id="gtext">';
     //$site = "http://groups.google.com/group/".$group."/feed/rss_v2_0_msgs.xml";
     include_once ABSPATH . WPINC . '/rss.php';
     wp_rss('http://groups.google.com/group/' . $group . '/feed/rss_v2_0_msgs.xml', 7);
     echo '</div>';
     echo '<div class="gjoin"><a href="http://groups.google.com/group/' . $group . '/subscribe">Join ' . $title . '!</a></div>';
     //		echo '<div style="text-align:center;padding:10px;">' . parseRDF($site) .
     //		'<br />' .
     //	$size .
     //"</div>";
     echo '</div>';
     //end ggroup-wrap
     echo $after_widget;
 }
function get_recent_comments_name($start = 0, $author = "", $div = "SP", $no_comments = 5, $before = '<li>', $after = '</li>', $show_pass_post = false)
{
    global $wpdb, $tablecomments, $tableposts, $total;
    $request = "select T1.comment_post_ID, T1.comment_date, T1.comment_ID, T1.comment_content, T1.comment_author, T1.comment_date, T1.comment_reply_ID from {$tablecomments} as T1 left join {$tablecomments} as T2 ON (T2.comment_author = '{$author}' OR T2.comment_ID = 1) WHERE ((T2.comment_author = '{$author}' AND T2.comment_ID = T1.comment_reply_ID) OR (T1.comment_author = '{$author}' AND T2.comment_ID = 1)) ";
    $request .= " ORDER BY T1.comment_date DESC LIMIT {$start}, {$no_comments}";
    $comments = $wpdb->get_results($request);
    $output = '';
    if (!empty($comments)) {
        foreach ($comments as $comment) {
            $total = $total + 1;
            $comment_author = stripslashes($comment->comment_author);
            $comment_content = strip_tags($comment->comment_content);
            $comment_content = stripslashes($comment_content);
            $comment_excerpt = substr($comment_content, 0, 100);
            $comment_excerpt = utf8_trim_1($comment_excerpt);
            $posturl = get_permalink($comment->comment_post_ID);
            $permalink = $posturl . "#comment-" . $comment->comment_ID;
            $posttitle = get_the_title($comment->comment_post_ID);
            $commentdate = mysql2date('Y.m.d H:i', $comment->comment_date);
            $output .= $before . '<a href="' . $comment->comment_author_url . '" title="作者网站" target="_blank">' . $comment_author . '</a>&#22312;&#25991;&#31456;<a href="' . $permalink . '" onclick="ajaxShowPost(\'' . get_settings('home') . '/wp-content/themes/yuewei/jscript/getpost.php?id=' . $comment->comment_post_ID . '\', \'' . $div . '\', \'comment-' . $comment->comment_ID . '\'); window.location.href=\'#' . 'comment-' . $comment->comment_ID . '\';return false;" title="发表于' . $commentdate . '">' . $posttitle . '</a>&#35828;&#65306; <span class="grey">' . $comment_excerpt . '...</span>' . $after;
        }
    }
    if ($output == '') {
        echo '<li>' . $author . ', 您好!</li><li>你目前还没有发表任何留言,当你发表留言后,在这里可以直接察看最近你所发表过的留言以及他人对你的留言的回复</li>';
    } else {
        echo $author . '最近的留言以及获得的回复:';
        echo $output;
    }
}
function frontier_email_on_transition($new_status, $old_status, $post)
{
    if ($post->post_type !== 'post') {
        return;
    }
    //Don't touch anything that's not a post (i.e. ignore links and attachments and whatnot )
    //If some variety of a draft is being published, dispatch an email
    if ($old_status != 'pending' && $new_status == 'pending' && fp_get_option("fps_mail_to_approve", "false") == "true") {
        $author_name = get_the_author_meta('display_name', $post->post_author);
        $to = get_option("frontier_post_mail_address") ? fp_get_option("fps_mail_address") : get_settings("admin_email");
        $subject = __("Post for approval from", "frontier-post") . ": " . $author_name . " (" . get_bloginfo("name") . ")";
        $body = __("Post for approval from", "frontier-post") . ": " . $author_name . " (" . get_bloginfo("name") . ")" . "\r\n\r\n";
        $body = $body . "Title:: " . $post->post_title . "\r\n\r\n";
        $body = $body . "Link to approvals: " . site_url('/wp-admin/edit.php?post_status=pending&post_type=post') . "\r\n\r\n";
        //error_log('sending email: '.$subject.' To: '.$to);
        if (!wp_mail($to, $subject, $body)) {
            error_log(__("Message delivery failed - Recipient: (", "frontier-post") . $to . ")");
        }
    }
    if ($old_status == 'pending' && $new_status == 'publish' && fp_get_option("fps_mail_approved", "false") == "true") {
        if ($post->post_author == get_current_user_id()) {
            return;
        }
        // no reason to send email if current user is able to publish :)
        $to = get_the_author_meta('email', $post->post_author);
        $subject = __("Your post has been approved", "frontier-post") . " (" . get_bloginfo("name") . ")";
        $body = __("Your post has been approved", "frontier-post") . ": " . $post->title . " (" . get_bloginfo("name") . ")" . "\r\n\r\n";
        $body = $body . "Title:: " . $post->post_title . "\r\n\r\n";
        //error_log('sending email: '.$subject.' To: '.$to);
        if (!wp_mail($to, $subject, $body)) {
            error_log(__("Message delivery failed - Recipient: (", "frontier-post") . $to . ")");
        }
    }
}
Exemple #27
0
function add_feedlink($catfeed, $cat)
{
    //echo 'the cat feed is : '.$catfeed.' .<br />';
    $rssLink = "\n";
    if ($catfeed == 'text') {
        $rssLink .= '<a class="menuRss" href="' . get_category_feed_link($cat->term_id) . '">(RSS)</a>';
    } elseif ($catfeed == 'image') {
        $options = get_option('ssMenu_options');
        if (class_exists('ssBase')) {
            $baseoptions = get_option('ssBase_options');
            $ss_global_over_ride = $baseoptions[ss_global_over_ride];
            if ($ss_global_over_ride == 'on') {
                $options[css_load] = $baseoptions[css_load];
            }
        }
        if ($options[css_load] == 'default') {
            $rssPath = WP_PLUGIN_URL . '/superslider-menu/plugin-data/superslider/ssMenu/rss/rss_out.png';
        } elseif ($options[css_load] == 'pluginData') {
            $rssPath = WP_CONTENT_URL . '/plugin-data/superslider/ssMenu/rss/rss_out.png';
        } elseif ($options[css_load] == 'off') {
            $rssPath = get_option('siteurl') . '/wp-includes/images/rss.png';
        }
        $url = get_settings(siteurl);
        $rssLink .= '<a class="menuRss" href="' . get_category_feed_link($cat->term_id) . '"><img src="' . $rssPath . '" alt="rss" /></a>';
    } else {
        $rssLink = '';
    }
    $rssLink .= "\n";
    return $rssLink;
}
function wp_insert_user($userdata)
{
    global $wpdb;
    extract($userdata);
    // Are we updating or creating?
    if (!empty($ID)) {
        $update = true;
    } else {
        $update = false;
        // Password is not hashed when creating new user.
        $user_pass = md5($user_pass);
    }
    if (empty($user_nicename)) {
        $user_nicename = sanitize_title($user_login);
    }
    if (empty($display_name)) {
        $display_name = $user_login;
    }
    if (empty($nickname)) {
        $nickname = $user_login;
    }
    if (empty($user_registered)) {
        $user_registered = gmdate('Y-m-d H:i:s');
    }
    if ($update) {
        $query = "UPDATE {$wpdb->users} SET user_pass='******', user_email='{$user_email}', user_url='{$user_url}', user_nicename = '{$user_nicename}', display_name = '{$display_name}' WHERE ID = '{$ID}'";
        $query = apply_filters('update_user_query', $query);
        $wpdb->query($query);
        $user_id = $ID;
    } else {
        $query = "INSERT INTO {$wpdb->users} \n\t\t(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)\n\tVALUES \n\t\t('{$user_login}', '{$user_pass}', '{$user_email}', '{$user_url}', '{$user_registered}', '{$user_nicename}', '{$display_name}')";
        $query = apply_filters('create_user_query', $query);
        $wpdb->query($query);
        $user_id = $wpdb->insert_id;
    }
    update_usermeta($user_id, 'first_name', $first_name);
    update_usermeta($user_id, 'last_name', $last_name);
    update_usermeta($user_id, 'nickname', $nickname);
    update_usermeta($user_id, 'description', $description);
    update_usermeta($user_id, 'jabber', $jabber);
    update_usermeta($user_id, 'aim', $aim);
    update_usermeta($user_id, 'yim', $yim);
    if ($update && !empty($role)) {
        $user = new WP_User($user_id);
        $user->set_role($role);
    }
    if (!$update) {
        $user = new WP_User($user_id);
        $user->set_role(get_settings('default_role'));
    }
    wp_cache_delete($user_id, 'users');
    wp_cache_delete($user_login, 'userlogins');
    if ($update) {
        do_action('profile_update', $user_id);
    } else {
        do_action('user_register', $user_id);
    }
    return $user_id;
}
Exemple #29
0
/**
* @desc in first install puts an empty option to options table
* @author Georg Leciejewski
*/
function king_admin_init()
{
    $current_king_plugin = 'admin';
    $current = get_settings('active_' . $current_king_plugin . '_plugins');
    if (empty($current)) {
        add_option('active_' . $current_king_plugin . '_plugins', ' ');
    }
}
function bte_wb_head_admin()
{
    wp_enqueue_script('jquery-ui-tabs');
    $home = get_settings('siteurl');
    $base = '/' . end(explode('/', str_replace(array('\\', '/BTE_WB_admin.php'), array('/', ''), __FILE__)));
    $stylesheet = $home . '/wp-content/plugins' . $base . '/css/wordpress-backup.css';
    echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
}