Ejemplo n.º 1
0
<?php

global $xoops_db, $xpress_config;
$xoops_trust_path = get_xoops_trust_path();
$xoops_root_path = get_xoops_root_path();
$inc_path = $xoops_trust_path . '/modules/d3forum/include/comment_functions.php';
include_once $inc_path;
$xpress_dir = get_xpress_dir_path();
$xpress_dirname = get_xpress_dir_name();
include_once $xpress_dir . '/class/xpressD3commentContent.class.php';
$dir_name = $xpress_config->d3forum_module_dir;
$forum_id = $xpress_config->d3forum_forum_id;
$external_link_format = $xpress_config->d3forum_external_link_format;
if ($xpress_config->is_d3forum_desc) {
    $order = 'desc';
} else {
    $order = 'asc';
}
if ($xpress_config->is_d3forum_desc) {
    $order = 'desc';
} else {
    $order = 'asc';
}
if ($xpress_config->is_d3forum_flat) {
    $view = 'listposts_flat';
} else {
    $view = 'listtopics';
}
$posts_num = $xpress_config->d3forum_views_num;
// force UPDATE forums.forum_external_link_format "(dirname)::(classname)::(trustdirname)"
$xoops_db->query("UPDATE " . get_xoops_prefix() . $dir_name . "_forums SET forum_external_link_format='" . $external_link_format . "' WHERE forum_id= {$forum_id}");
Ejemplo n.º 2
0
 function ReadPostData($post_data = null)
 {
     global $xoops_db, $blog_id;
     if (empty($blog_id)) {
         if (defined(BLOG_ID_CURRENT_SITE)) {
             $blog_id = BLOG_ID_CURRENT_SITE;
         } else {
             $blog_id = 1;
         }
     }
     foreach ((array) $post_data as $index_key => $value) {
         if (preg_match('/^ch_/', $index_key)) {
             // case ch_
             $indedx = preg_replace('/^ch_/', '', $index_key);
             $set_value = stripslashes(trim($value));
             // post d3forum
             if ($indedx === 'd3forum') {
                 $this->D3Forum_old_Link_clear($value);
                 if ($value == 'none') {
                     $this->is_use_d3forum = false;
                     $this->d3forum_module_dir = '';
                     $this->d3forum_forum_id = '';
                     $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
                 } else {
                     $d3f_set = explode('|', $value);
                     $this->is_use_d3forum = true;
                     $this->d3forum_module_dir = $d3f_set[1];
                     if (preg_match('/Create New In Cat=([0-9]*)/', $d3f_set[2], $matchs)) {
                         $cat_id = $matchs[1];
                         $title = get_option('blogname');
                         $this->d3forum_forum_id = $this->D3Forum_create_new($this->d3forum_module_dir, $cat_id, $title);
                     } else {
                         $this->d3forum_forum_id = $d3f_set[2];
                     }
                     $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
                     $this->D3Forum_link_set();
                 }
             } else {
                 //post other
                 if (empty($set_value)) {
                     switch ($indedx) {
                         case 'old_post_link_text':
                             $set_value = __('Older Post', 'xpressme');
                             break;
                         case 'newer_post_link_text':
                             $set_value = __('Newer Post', 'xpressme');
                             break;
                         case 'old_page_link_text':
                             $set_value = __('Older Entries', 'xpressme');
                             break;
                         case 'newer_page_link_text':
                             $set_value = __('Newer Entries', 'xpressme');
                             break;
                         case 'excerpt_more_link_text':
                             $set_value = __('Read the rest of this entry &raquo;', 'xpressme');
                             break;
                         case 'theme_select':
                             $set_value = 'use_wordpress_select';
                             break;
                         default:
                     }
                 }
                 $this->{$indedx} = $value;
             }
         }
         // end of case 'ch_'
     }
     // end of loop
     global $xoops_config;
     $table = get_wp_prefix() . 'group_role';
     //		$sql=  "SELECT * FROM $table";
     //		$this->groupe_role =  $xoops_db->get_results($sql);  // before Read
     foreach ($this->groupe_role as $groupe) {
         $post_role_gid = 'role_gid_' . $groupe->groupid;
         $login_all_gid = 'login_all_gid_' . $groupe->groupid;
         if (isset($post_data[$post_role_gid])) {
             $role = stripslashes(trim($post_data[$post_role_gid]));
             $login_all = stripslashes(trim($post_data[$login_all_gid]));
             if (empty($login_all)) {
                 $login_all = '0';
             }
             $groupe->role = $role;
             $groupe->login_all = $login_all;
             $update_sql = "UPDATE  {$table} ";
             $update_sql .= 'SET ';
             $update_sql .= "role  = '{$role}' , ";
             $update_sql .= "login_all  = {$login_all} ";
             $update_sql .= "WHERE (groupid = '{$groupe->groupid}' AND blog_id = {$blog_id})";
             $xoops_db->query($update_sql);
         }
     }
 }
Ejemplo n.º 3
0
function xpress_selected_author_id($args ='' ) {
	$defaults = array(
		'echo' => 1
	);
	$r = wp_parse_args( $args, $defaults );

	extract( $r );
	$output = '';
  	$author_cookie = 'select_' . get_xpress_dir_name() . "_author" ;
  	if (!empty($_COOKIE[$author_cookie])){
  		$output = intval($_COOKIE[$author_cookie]);
  	} else {
  		$output = '';
  	}
	if ($echo)
		echo $output;
	else
		return $output;		
}
Ejemplo n.º 4
0
function xpress_query_filter($query)
{
    if (is_admin()) {
        return $query;
    }
    $author_cookie = 'select_' . get_xpress_dir_name() . "_author";
    if (strpos($query, 'SELECT') === false) {
        return $query;
    }
    $select_pattern = "SELECT(.*)post_author(.*)FROM";
    if (preg_match("/" . $select_pattern . "/i", $query, $select_match)) {
        return $query;
    }
    $query = preg_replace('/\\s\\s+/', ' ', $query);
    if (!empty($_COOKIE[$author_cookie])) {
        if (xpress_is_wp_version('<', '2.1')) {
            $pattern = "WHERE.*AND\\s?\\(*post_author\\s*=";
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                return $query;
            }
            $pattern = "WHERE\\s?post_author\\s*=";
            // get_usernumposts()
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                return $query;
            }
            $pattern = "WHERE.*post_status\\s*=\\s*'publish'\\s*\\)?";
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                $where_str = "{$match['0']}";
                $where_arry = split(' ', $where_str);
                $post_prefix = '';
                foreach ($where_arry as $p) {
                    if (preg_match("/post_status/", $p, $match3)) {
                        $post_prefix = preg_replace("/post_status/", "", $p);
                        $post_prefix = preg_replace("/\\(/", "", $post_prefix);
                        break;
                    }
                }
                $patern = 'WHERE';
                $replace = "WHERE {$post_prefix}post_author = " . intval($_COOKIE[$author_cookie]) . " AND ";
                $query = preg_replace("/{$patern}/", $replace, $query);
            }
        } else {
            $pattern = "WHERE.*post_type\\s*=\\s*'post'\\s*\\)?";
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                $where_str = "{$match['0']}";
                $where_arry = split(' ', $where_str);
                $post_prefix = '';
                foreach ($where_arry as $p) {
                    if (preg_match("/post_type/", $p, $match3)) {
                        $post_prefix = preg_replace("/post_type/", "", $p);
                        $post_prefix = preg_replace("/\\(/", "", $post_prefix);
                        break;
                    }
                }
                preg_match("/post_type(.*)/", $where_str, $p_match);
                $patern_s = $p_match[0];
                $patern = preg_replace('/\\)/', '\\)', $patern_s);
                $replace = $patern_s . " AND {$post_prefix}post_author = " . intval($_COOKIE[$author_cookie]) . " ";
                $query = preg_replace("/{$patern}/", $replace, $query);
            }
        }
    }
    //	xpress_show_sql_quary($query);
    return $query;
}