Exemplo n.º 1
0
function helplist($num, $id = '', $aids = "", $orderby = "aid asc")
{
    if (is_numeric($id)) {
        $wherestr[] = "typeid = " . $id;
    } elseif (is_array($id)) {
        $ids = getdotstring($id, 'int');
        $wherestr[] = "typeid in ({$ids})";
    } elseif (is_string($id) && (strexists($id, ',') || strexists($id, '|'))) {
        if (strexists($id, ',')) {
            $ids = getdotstring($id, 'int');
        } else {
            $ids = getdotstring(explode('|', $ids), 'int');
        }
        $wherestr[] = "typeid in ({$ids})";
    } else {
        $wherestr[] = "";
    }
    if (!empty($aids)) {
        $aids = getdotstring($aids, 'int');
        $wherestr[] = "aid in ({$ids})";
    }
    $num = GetNum($num);
    $wheresql = implode(' AND ', $wherestr);
    //条件汇总
    $articleobj = new TableClass('article', 'aid');
    $articlearray = $articleobj->getdata($num, $wheresql, $orderby, 'aid,typeid,title');
    return $articlearray;
}
Exemplo n.º 2
0
 /**
  * 删除指定ID信息
  *
  * @param unknown_type $id
  * @return unknown
  */
 function del($id, $uname = "", $other = "")
 {
     if (is_numeric($id)) {
         $wherestr[] = $this->idname . " = " . $id;
     } elseif (is_array($id)) {
         $ids = getdotstring($id, 'int');
         $wherestr[] = $this->idname . " in ({$ids})";
     } elseif (is_string($id) && (strexists($id, ',') || strexists($id, '|'))) {
         if (strexists($id, ',')) {
             $ids = getdotstring($id, 'int');
         } else {
             $ids = getdotstring(explode('|', $ids), 'int');
         }
         $wherestr[] = $this->idname . " in ({$ids})";
     } else {
         return lang('ID_format_error');
     }
     if ($uname != "") {
         $wherestr[] = "uname = '" . $uname . "'";
     }
     if ($other != "") {
         $wherestr[] = $other;
     }
     $wheresql = implode(' AND ', $wherestr);
     //条件汇总
     $this->db->query("delete from {$this->table} where " . $wheresql);
     return "OK";
 }
 }
 $scopestring = getscopestring('readperm', $_POST['readperm']);
 if ($scopestring) {
     $blockcodearr[] = $scopestring;
 }
 $scopestring = getscopestring('downloads', $_POST['downloads']);
 if ($scopestring) {
     $blockcodearr[] = $scopestring;
 }
 if (!empty($_POST['t_fid'])) {
     $blockcodearr[] = 't_fid/' . implode(',', $_POST['t_fid']);
 }
 if (!empty($_POST['t_typeid'])) {
     $blockcodearr[] = 't_typeid/' . implode(',', $_POST['t_typeid']);
 }
 $_POST['t_authorid'] = getdotstring($_POST['t_authorid'], 'int');
 if (!empty($_POST['t_authorid'])) {
     $blockcodearr[] = 't_authorid/' . $_POST['authorid'];
 }
 if (!empty($_POST['t_dateline'])) {
     $blockcodearr[] = 't_dateline/' . $_POST['t_dateline'];
 }
 if (!empty($_POST['t_lastpost'])) {
     $blockcodearr[] = 't_lastpost/' . $_POST['t_lastpost'];
 }
 $scopestring = getscopestring('t_readperm', $_POST['t_readperm']);
 if ($scopestring) {
     $blockcodearr[] = $scopestring;
 }
 $scopestring = getscopestring('t_price', $_POST['t_price']);
 if ($scopestring) {
Exemplo n.º 4
0
function runsql($paramarr, $bbsdb = '', $returncount = 0, $multicachekey = '')
{
    global $_G, $_SGLOBAL, $_SBLOCK;
    //處理SQL
    $sqlstring = getblocksql($paramarr['sql']);
    //初始化
    $listcount = 1;
    //連接數據庫
    //$thedb = empty($bbsdb)?$_SGLOBAL['db']:$bbsdb;
    //分頁
    if (!empty($paramarr['perpage'])) {
        $countsql = '';
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)WHERE(.+?)ORDER', 2, 3);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)WHERE(.+?)LIMIT', 2, 3);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)WHERE(.+?)$', 2, 3);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)ORDER', 2, -1);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)LIMIT', 2, -1);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)$', 2, -1);
        }
        if (!empty($countsql)) {
            if ($returncount > 0) {
                //需要更新計數緩存時
                $listcount = DB::result_first($countsql);
                return $listcount;
            } else {
                //無需更新緩存時
                $listcount = intval(unserialize($_SBLOCK[$multicachekey]['value']));
            }
            if ($listcount) {
                $paramarr['perpage'] = intval($paramarr['perpage']);
                if (empty($paramarr['perpage'])) {
                    $paramarr['perpage'] = 20;
                }
                if (empty($_G['page'])) {
                    $_G['page'] = 1;
                }
                $_G['page'] = intval($_G['page']);
                if ($_G['page'] < 1) {
                    $_G['page'] = 1;
                }
                $start = ($_G['page'] - 1) * $paramarr['perpage'];
                //SQL文
                $sqlstring = preg_replace("/ LIMIT(.+?)\$/is", '', $sqlstring);
                $sqlstring .= ' LIMIT ' . $start . ',' . $paramarr['perpage'];
            }
        }
    } elseif (!empty($paramarr['limit'])) {
        $paramarr['limit'] = getdotstring($paramarr['limit'], 'int', true, array(), 1, false);
        if ($paramarr['limit']) {
            //SQL文
            $sqlstring = preg_replace("/ LIMIT(.+?)\$/is", '', $sqlstring);
            $sqlstring .= ' LIMIT ' . $paramarr['limit'];
        }
    }
    return array($sqlstring, $listcount);
}
Exemplo n.º 5
0
function runsql($paramarr, $bbsdb = '')
{
    global $_SGLOBAL, $_SGET;
    //处理SQL
    $sqlstring = getblocksql($paramarr['sql']);
    //初始化
    $listcount = 1;
    //连接数据库
    $thedb = empty($bbsdb) ? $_SGLOBAL['db'] : $bbsdb;
    //分页
    if (!empty($paramarr['perpage'])) {
        $countsql = '';
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)WHERE(.+?)ORDER', 2, 3);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)WHERE(.+?)LIMIT', 2, 3);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)WHERE(.+?)$', 2, 3);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)ORDER', 2, -1);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)LIMIT', 2, -1);
        }
        if (empty($countsql)) {
            $countsql = getcountsql($sqlstring, 'SELECT(.+?)FROM(.+?)$', 2, -1);
        }
        if (!empty($countsql)) {
            $query = $thedb->query($countsql);
            $listcount = $thedb->result($query, 0);
            if ($listcount) {
                $paramarr['perpage'] = intval($paramarr['perpage']);
                if (empty($paramarr['perpage'])) {
                    $paramarr['perpage'] = 20;
                }
                if (empty($_SGET['page'])) {
                    $_SGET['page'] = 1;
                }
                $_SGET['page'] = intval($_SGET['page']);
                if ($_SGET['page'] < 1) {
                    $_SGET['page'] = 1;
                }
                $start = ($_SGET['page'] - 1) * $paramarr['perpage'];
                //SQL文
                $sqlstring = preg_replace("/ LIMIT(.+?)\$/is", '', $sqlstring);
                $sqlstring .= ' LIMIT ' . $start . ',' . $paramarr['perpage'];
            }
        }
    } elseif (!empty($paramarr['limit'])) {
        $paramarr['limit'] = getdotstring($paramarr['limit'], 'int', true, array(), 1, false);
        if ($paramarr['limit']) {
            //SQL文
            $sqlstring = preg_replace("/ LIMIT(.+?)\$/is", '', $sqlstring);
            $sqlstring .= ' LIMIT ' . $paramarr['limit'];
        }
    }
    return array($sqlstring, $listcount);
}
Exemplo n.º 6
0
$dateline = !empty($_GET['dateline']) ? intval($_GET['dateline']) : 0;
$updatetime = !empty($_GET['updatetime']) ? intval($_GET['updatetime']) : 0;
$start = !empty($_GET['start']) ? intval($_GET['start']) : 0;
$limit = !empty($_GET['limit']) ? intval($_GET['limit']) : 10;

$friendnum[] = empty($_GET['startfriendnum']) ? 0 : intval($_GET['startfriendnum']);
$friendnum[] = empty($_GET['endfriendnum']) ? 0 : intval($_GET['endfriendnum']);

$viewnum[] = empty($_GET['startviewnum']) ? 0 : intval($_GET['startviewnum']);
$viewnum[] = empty($_GET['endviewnum']) ? 0 : intval($_GET['endviewnum']);

$credit[] = empty($_GET['startcredit']) ? 0 : intval($_GET['startcredit']);
$credit[] = empty($_GET['endcredit']) ? 0 : intval($_GET['endcredit']);


$uids = getdotstring($uid, 'int');
if($uids) $wherearr[] = 'uid IN ('.$uids.')';
if($dateline) $wherearr[] = "dateline>'".($_SGLOBAL['timestamp']-$dateline)."'";
if($updatetime) $wherearr[] = "updatetime>'".($_SGLOBAL['timestamp']-$updatetime)."'";

$friendnumstr = getscopequery('friendnum', $friendnum);
if($friendnumstr) $wherearr[] = $friendnumstr;

$viewnumstr = getscopequery('viewnum', $viewnum);
if($viewnumstr) $wherearr[] = $viewnumstr;

$creditstr = getscopequery('credit', $credit);
if($creditstr) $wherearr[] = $creditstr;

if(isset($_GET['avatar'])) {
	$wherearr[] = "avatar='".(empty($_GET['avatar']) ? 0 : intval($_GET['avatar']))."'";
 $wherestro[] = "uname='" . $_USERS['uname'] . "'";
 $wherestro[] = "oid in(" . $oids . ")";
 if (!empty($wherestro)) {
     $wheresqlo = implode(' AND ', $wherestro);
 }
 //条件汇总
 $dataarray = $o->getdata("", $wheresqlo, "", "oid,uid,uname,goodsurl,goodsname,goodsprice,goodsnum,goodssite,siteurl,orderweight");
 //计算商品总价格和总重量
 $countmoney = $countweight = 0;
 $tempoids = array();
 foreach ($dataarray as $value) {
     $tempoids[] = $value['oid'];
     $countmoney += $value['goodsprice'] * $value['goodsnum'];
     $countweight += $value['orderweight'];
 }
 $ids = getdotstring($tempoids, 'int');
 $auth = $ids . "\t" . $countmoney . "\t" . $countweight;
 $LOCKDATA = cookie_authcode($auth, 'ENCODE');
 //加密数据
 //print_r($dataarray);
 //获取地区信息
 $areaobj = new TableClass('area', 'aid');
 $areaarray = $areaobj->getdata('', 'state=1');
 //获取用户地址
 $addressobj = new TableClass('address', 'aid');
 $addressarray = $addressobj->getdata('', "uname='" . $_USERS['uname'] . "'", "def desc,aid desc");
 //获取优惠卷
 include_once INC_PATH . "/coupon.class.php";
 $couponobj = CouponClass::init();
 $wherestrc[] = "uname='" . $_USERS['uname'] . "'";
 $wherestrc[] = "endtime >= " . time();
Exemplo n.º 8
0
 function joinid($id)
 {
     //ID处理
     if (is_numeric($id)) {
         $wherestr = "gid = '{$id}'";
     } elseif (is_array($id)) {
         $ids = getdotstring($id, 'int');
         $wherestr = "gid in ({$ids})";
     } elseif (is_string($id) && (strexists($id, ',') || strexists($id, '|'))) {
         if (strexists($id, ',')) {
             $ids = getdotstring($id, 'int');
         } else {
             $tempids = explode('|', $id);
             $ids = getdotstring($tempids, 'int');
         }
         $wherestr = "gid in ({$ids})";
     } else {
         return '';
     }
     return $wherestr;
 }
Exemplo n.º 9
0
    //总信息数
    $pagesize = 20;
    //一页显示信息数
    $page = isset($page) ? max(1, intval($page)) : 1;
    //处理页码变量
    $offset = ($page - 1) * $pagesize;
    //偏移量
    $dataarray = $Table->getdata("{$offset},{$pagesize}", $wheresql, $orderstr);
    //获取团购数据
    //print_r($dataarray);
    //包含后台模板文件
    include "tpl/admin_list.htm";
} elseif ($action == "updatestate" && !empty($ids)) {
    //更改状态
    $state = GetNum($state);
    $ids = getdotstring(explode('|', $ids));
    $wheresqlarr = "adminid in({$ids})";
    editstate($Table->table, "state", $wheresqlarr, $state);
    //更改状态操作
    exit("1");
} elseif ($action == "del" && !empty($did)) {
    //执行删除操作
    $did = GetNum($did);
    $info = $Table->del($did);
    if ($info == "OK") {
        showmsg("删除成功!", PHP_SELF);
    } else {
        showmsg($info, PHP_SELF);
    }
} elseif ($action == "dels") {
    if (empty($delids)) {
Exemplo n.º 10
0
             $sql['from'] = ', ' . tname('album') . ' a ';
             if ($groupids) {
                 $sql['from'] .= ', ' . tname('space') . ' s ';
                 $wherearr[] = "s.groupid IN({$groupids})";
                 $wherearr[] = "p.uid = s.uid";
             }
             $wherearr[] = "a.friend='0' AND a.albumid=p.albumid";
             $picids = getdotstring($_POST['network'][$key]['picid'], 'int');
             if ($picids) {
                 $wherearr[] = 'p.picid IN (' . $picids . ')';
             }
             $albumids = getdotstring($_POST['network'][$key]['albumid'], 'int');
             if ($albumids) {
                 $wherearr[] = 'p.albumid IN (' . $albumids . ')';
             }
             $uids = getdotstring($_POST['network'][$key]['uid'], 'int');
             if ($uids) {
                 $wherearr[] = 'p.uid IN (' . $uids . ')';
             }
             if ($wherearr) {
                 $sql['where'] = 'WHERE ' . implode(' AND ', $wherearr);
             }
             $sql['order'] = 'ORDER BY p.dateline DESC';
             $sql['limit'] = getlimit($_POST['network'][$key]['start'], $_POST['network'][$key]['limit']);
             break;
     }
     $sqlstring = implode(' ', $sql);
     $_POST['network'][$key]['sql'] = $sqlstring;
     $network[$key] = $_POST['network'][$key];
 } else {
     $network[$key] = array();
        showmessage('block_thread_code_sql');
    }
    $_POST['sql'] = getblocksql($_POST['sql']);
    $blockcodearr[] = 'sql/' . rawurlencode($_POST['sql']);
} else {
    //向导模式
    if ($_POST['setaid']) {
        //指定id
        $_POST['id'] = getdotstring($_POST['id'], 'int');
        if (empty($_POST['aid'])) {
            showmessage('block_announcement_code_aid');
        } else {
            $blockcodearr[] = 'id/' . $_POST['id'];
        }
    } else {
        $_POST['author'] = getdotstring($_POST['author'], 'char', false, array(), 0);
        if (!empty($_POST['author'])) {
            $blockcodearr[] = 'author/' . rawurlencode($_POST['author']);
        }
    }
    $orderarr = array();
    if ($_POST['order']) {
        foreach ($_POST['order'] as $okey => $order) {
            if (!empty($order)) {
                $sc = $_POST['sc'][$okey];
                if (!empty($sc)) {
                    $sc = ' ' . $sc;
                }
                $orderarr[] = $order . $sc;
            }
        }
Exemplo n.º 12
0
                $s[$val['goodsseller']] = $val['sendprice'];
            }
        } else {
            $s[$val['goodsseller']] = $val['sendprice'];
        }
    }
    $countdata = $Cart->countmoney($dataarray);
    //生成校验数据
    $ids = getdotstring($gids, 'int');
    $auth = $ids . "\t" . $countdata['totalmoney'];
    $paydata = cookie_authcode($auth, 'ENCODE');
    include template('payconfirm');
    //包含输出指定模板
} else {
    //处理提交信息
    @(list($ids, $totalmoney) = explode("\t", cookie_authcode($__PAYDATA, 'DECODE')));
    if ($ids == getdotstring($gids, 'int') and !empty($ids)) {
        $tempids = $ids;
    } else {
        exit(lang('Data_exception'));
    }
    //处理扣费和订单转移并且记录日志操作
    $info = $Cart->carttoorder($tempids);
    if ($info == 'OK') {
        print "<script language='javascript'>alert(" . lang('Submitted_successfully') . ");</script>";
        jumpurl(url("m.php"));
    } else {
        print "<script language='javascript'>alert('" . $info . "');</script>";
        jumpurl(url("m.php"));
    }
}
Exemplo n.º 13
0
     }
     $scopestring = getscopestring('goodrate', $_POST['goodrate']);
     if ($scopestring) {
         $blockcodearr[] = $scopestring;
     }
     $scopestring = getscopestring('badrate', $_POST['badrate']);
     if ($scopestring) {
         $blockcodearr[] = $scopestring;
     }
     if (!empty($_POST['digest'])) {
         $blockcodearr[] = 'digest/' . implode(',', $_POST['digest']);
     }
     if (!empty($_POST['top'])) {
         $blockcodearr[] = 'top/' . implode(',', $_POST['top']);
     }
     $_POST['haveattach'] = getdotstring($_POST['haveattach'], 'int');
     if (!empty($_POST['haveattach'])) {
         $blockcodearr[] = 'haveattach/' . $_POST['haveattach'];
     }
     if (!empty($_POST['showspacename'])) {
         $blockcodearr[] = 'showspacename/1';
     }
     if (!empty($_POST['showgroupname'])) {
         $blockcodearr[] = 'showgroupname/1';
     }
 }
 $orderarr = array();
 if ($_POST['order']) {
     foreach ($_POST['order'] as $okey => $order) {
         if (!empty($order)) {
             $sc = $_POST['sc'][$okey];
    }
    $_POST['sql'] = getblocksql($_POST['sql']);
    $blockcodearr[] = 'sql/' . rawurlencode($_POST['sql']);
} else {
    //向导模式
    if ($_POST['setuid']) {
        //指定tid
        $_POST['uid'] = getdotstring($_POST['uid'], 'int');
        if (empty($_POST['uid'])) {
            showmessage('block_member_code_uid');
        } else {
            $blockcodearr[] = 'uid/' . $_POST['uid'];
        }
    } else {
        if (!empty($_POST['groupid'])) {
            $_POST['groupid'] = getdotstring($_POST['groupid'], 'int');
            if (!empty($_POST['groupid'])) {
                $blockcodearr[] = 'groupid/' . $_POST['groupid'];
            }
        }
        if (!empty($_POST['regdate'])) {
            $blockcodearr[] = 'regdate/' . $_POST['regdate'];
        }
        if (!empty($_POST['lastvisit'])) {
            $blockcodearr[] = 'lastvisit/' . $_POST['lastvisit'];
        }
        if (!empty($_POST['lastpost'])) {
            $blockcodearr[] = 'lastpost/' . $_POST['lastpost'];
        }
        $scopestring = getscopestring('posts', $_POST['posts']);
        if ($scopestring) {
Exemplo n.º 15
0
$Table = new TableClass("order", "oid");
AjaxHead();
//禁止页面缓存
set_time_limit(0);
if (!empty($type) || !empty($oid)) {
    if (!empty($oid)) {
        if (is_numeric($oid)) {
            $wherestr[] = "oid" . " = " . $oid;
        } elseif (is_array($oid)) {
            $ids = getdotstring($oid, 'int');
            $wherestr[] = "oid" . " in ({$ids})";
        } elseif (is_string($oid) && (strexists($oid, ',') || strexists($oid, '|'))) {
            if (strexists($oid, ',')) {
                $ids = getdotstring($oid, 'int');
            } else {
                $ids = getdotstring(explode('|', $ids), 'int');
            }
            $wherestr[] = "oid" . " in ({$ids})";
        } else {
            exit("ID格式错误");
        }
    } elseif (!empty($type)) {
        if ($type == "all") {
        } elseif ($type == "idlist") {
            if (GetNum($startid) and GetNum($endid)) {
                $wherestr[] = "oid >={$startid}";
                $wherestr[] = "oid <={$endid}";
            } else {
                showmsg("ID范围必须填写!", PHP_SELF);
            }
        } elseif ($type == "timelist") {
Exemplo n.º 16
0
if (!defined('IN_SUPESITE_ADMINCP')) {
    exit('Access Denied');
}
$blockcodearr = array();
if ($_POST['blockmodel'] == '2') {
    //高级模式
    if (empty($_POST['sql'])) {
        showmessage('block_thread_code_sql');
    }
    $_POST['sql'] = getblocksql($_POST['sql']);
    $blockcodearr[] = 'sql/' . rawurlencode($_POST['sql']);
} else {
    //向导模式
    if ($_POST['setpollid']) {
        //指定tid
        $_POST['pollid'] = getdotstring($_POST['pollid'], 'int');
        if (empty($_POST['pollid'])) {
            showmessage('block_poll_code_pollid');
        } else {
            $blockcodearr[] = 'pollid/' . $_POST['pollid'];
        }
    } else {
        if (!empty($_POST['dateline'])) {
            $blockcodearr[] = 'dateline/' . $_POST['dateline'];
        }
    }
    $orderarr = array();
    if ($_POST['order']) {
        foreach ($_POST['order'] as $okey => $order) {
            if (!empty($order)) {
                $sc = $_POST['sc'][$okey];
    $blockcodearr[] = 'sql/' . rawurlencode($_POST['sql']);
} else {
    //向导模式
    if ($_POST['setblogid']) {
        //指定aid
        $_POST['blogid'] = getdotstring($_POST['blogid'], 'int');
        if (empty($_POST['blogid'])) {
            showmessage('block_uchblog_code_blogid');
        } else {
            $blockcodearr[] = 'blogid/' . $_POST['blogid'];
        }
    } else {
        if (!empty($_POST['picflag'])) {
            $blockcodearr[] = 'picflag/' . $_POST['picflag'];
        }
        $_POST['uid'] = getdotstring($_POST['uid'], 'int');
        if (!empty($_POST['uid'])) {
            $blockcodearr[] = 'uid/' . $_POST['uid'];
        }
        if (!empty($_POST['dateline'])) {
            $blockcodearr[] = 'dateline/' . $_POST['dateline'];
        }
        $scopestring = getscopestring('viewnum', $_POST['viewnum']);
        if ($scopestring) {
            $blockcodearr[] = $scopestring;
        }
        $scopestring = getscopestring('replaynum', $_POST['replaynum']);
        if ($scopestring) {
            $blockcodearr[] = $scopestring;
        }
        $scopestring = getscopestring('tracenum', $_POST['tracenum']);
    }
    $blockcodearr[] = 'perpage/' . $_POST['perpage'];
}
$_POST['cachetime'] = intval($_POST['cachetime']);
if (empty($_POST['perpage']) && !empty($_POST['cachetime'])) {
    $blockcodearr[] = 'cachetime/' . $_POST['cachetime'];
}
$_POST['subjectlen'] = intval($_POST['subjectlen']);
if (!empty($_POST['subjectlen'])) {
    $blockcodearr[] = 'subjectlen/' . $_POST['subjectlen'];
    if (!empty($_POST['subjectdot'])) {
        $blockcodearr[] = 'subjectdot/' . $_POST['subjectdot'];
    }
}
if (!empty($_POST['bbsurltype'])) {
    $_POST['bbsurltype'] = getdotstring($_POST['bbsurltype'], 'char', false, array('bbs', 'site'), 0);
    if (!empty($_POST['bbsurltype'])) {
        $blockcodearr[] = 'bbsurltype/' . $_POST['bbsurltype'];
    }
}
if ($_POST['showdetail']) {
    $blockcodearr[] = 'showdetail/' . $_POST['showdetail'];
    $_POST['messagelen'] = intval($_POST['messagelen']);
    if (!empty($_POST['messagelen'])) {
        $blockcodearr[] = 'messagelen/' . $_POST['messagelen'];
        if (!empty($_POST['messagedot'])) {
            $blockcodearr[] = 'messagedot/' . $_POST['messagedot'];
        }
    }
}
if ($_POST['tpl'] == 'data' && empty($_POST['cachename'])) {
Exemplo n.º 19
0
     $htmlurl = $catarr[$row['catid']]['domain'];
 } else {
     $htmlurl = S_URL_ALL . '/' . substr($_SCONFIG['newspath'], 2) . '/' . substr($catarr[$row['catid']]['htmlpath'], 2);
 }
 $htmlpath = S_HTML_ROOT . '/' . substr($catarr[$row['catid']]['htmlpath'], 2);
 if (!is_dir($htmlpath)) {
     @mkdir($htmlpath);
 }
 $hotnews2 = $chotnews2[$row['catid']];
 $picnews = $cpicnews[$row['catid']];
 $newcomments = $cnewcomments[$row['catid']];
 //子分类处理
 $subnewlist = array();
 if (!empty($csubarr[$row['catid']])) {
     foreach ($csubarr[$row['catid']] as $cvalue) {
         $tparam['catids'] = getdotstring($cvalue['subcatid'], 'int');
         $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spaceitems') . " WHERE folder = 1 AND catid IN (" . $tparam['catids'] . ") ORDER BY dateline DESC LIMIT 0, 6");
         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
             $value['subject'] = cutstr($value['subject'], 36, 0);
             //标题样式
             if (!empty($value['styletitle'])) {
                 $value['subject'] = '<span style=\'' . mktitlestyle($value['styletitle']) . '\'>' . $value['subject'] . '</span>';
             }
             $value['url'] = gethtmlurl2($value['catid']) . '/' . sgmdate($value['dateline'], 'Y') . '/' . sgmdate($value['dateline'], 'n') . '/' . $catarr[$value['catid']]['pre_html'] . $value['itemid'] . '.html';
             $subnewlist[] = $value;
         }
     }
 }
 $newslist = array();
 $syear = $smoon = '';
 $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spaceitems') . " WHERE catid = '{$row['catid']}' AND itemid >= '{$row['eitemid']}'  AND itemid <= '{$row['sitemid']}' ORDER BY dateline DESC");
Exemplo n.º 20
0
 $gtype = $typeobj->getone($tid);
 if ($gtype['node'] == 0) {
     $childgtype = $typeobj->getdata('', "node=" . $gtype['typeid']);
     foreach ($childgtype as $child) {
         $tids[] = $child['typeid'];
     }
     $position = "<span>&gt;</span><a href='recommend.php?action=list&tid=" . $gtype['typeid'] . "'>" . $gtype['typename'] . "</a>";
     $typename = $gtype['typename'];
 } else {
     $cgtype = $typeobj->getone($gtype['node']);
     $typename = $cgtype['typename'];
     $position = "<span>&gt;</span><a href='recommend.php?action=list&tid=" . $cgtype['typeid'] . "'>" . $cgtype['typename'] . "</a>";
     $position .= "<span>&gt;</span><a href='recommend.php?action=list&tid=" . $gtype['typeid'] . "'>" . $gtype['typename'] . "</a>";
 }
 $tids[] = $tid;
 $wherestr[] = "gtypeid in(" . getdotstring($tids, 'int') . ")";
 $wherestr[] = "Audit=1";
 if (!empty($wherestr)) {
     $wheresql = implode(' AND ', $wherestr);
 }
 //条件汇总
 //获取当前页码
 $total = $goodsobj->getcount($wheresql);
 //总信息数
 $pagesize = 12;
 //一页显示信息数
 $page = isset($page) ? max(1, intval($page)) : 1;
 //处理页码变量
 $offset = ($page - 1) * $pagesize;
 //偏移量
 $dataarray = $goodsobj->getdata("{$offset},{$pagesize}", $wheresql, 'listorder asc,gid desc', 'gid,gtypeid,goodsurl,goodsname,goodsprice,goodsseller,goodsimg,sellerurl,shopname,rindex,views,buynum,listorder,flag,addtime');
Exemplo n.º 21
0
function block_uchspace($paramarr)
{
    global $_SGLOBAL, $_SC, $_SGET;
    dbconnect(2);
    if (empty($paramarr['sql'])) {
        $sql = array();
        $sql['select'] = 'SELECT s.*';
        $sql['from'] = 'FROM ' . tname('space', '2') . ' s';
        if (!empty($paramarr['showdetail'])) {
            $sql['select'] = 'SELECT sf.*, s.*';
            $sql['from'] .= ' LEFT JOIN ' . tname('spacefield', '2') . ' sf ON sf.uid=s.uid';
        }
        $wherearr = array();
        //where
        if (!empty($paramarr['uid'])) {
            $paramarr['uid'] = getdotstring($paramarr['uid'], 'int');
            if ($paramarr['uid']) {
                $wherearr[] = 's.uid IN (' . $paramarr['uid'] . ')';
            }
        } else {
            if (!empty($paramarr['avatar'])) {
                if ($paramarr['avatar'] == 1) {
                    $wherearr[] = 's.avatar = 0';
                } else {
                    $wherearr[] = 's.avatar = 1';
                }
            }
            $scopequery = getscopequery('s', 'viewnum', $paramarr);
            if (!empty($scopequery)) {
                $wherearr[] = $scopequery;
            }
            $scopequery = getscopequery('s', 'friendnum', $paramarr);
            if (!empty($scopequery)) {
                $wherearr[] = $scopequery;
            }
        }
        $sql['where'] = '';
        if (!empty($wherearr)) {
            $sql['where'] = 'WHERE ' . implode(' AND ', $wherearr);
        }
        //order
        if (!empty($paramarr['order'])) {
            $sql['order'] = 'ORDER BY ' . $paramarr['order'];
        }
        //limit
        if (!empty($paramarr['perpage'])) {
            $paramarr['perpage'] = intval($paramarr['perpage']);
            if (empty($paramarr['perpage'])) {
                $paramarr['perpage'] = 20;
            }
            if (empty($_SGET['page'])) {
                $_SGET['page'] = 1;
            }
            $_SGET['page'] = intval($_SGET['page']);
            if ($_SGET['page'] < 1) {
                $_SGET['page'] = 1;
            }
            $start = ($_SGET['page'] - 1) * $paramarr['perpage'];
            $sql['limit'] = 'LIMIT ' . $start . ',' . $paramarr['perpage'];
        } else {
            if (empty($paramarr['limit'])) {
                $sql['limit'] = 'LIMIT 0,1';
            } else {
                $paramarr['limit'] = getdotstring($paramarr['limit'], 'int', true, array(), 1, false);
                if ($paramarr['limit']) {
                    $sql['limit'] = 'LIMIT ' . $paramarr['limit'];
                } else {
                    $sql['limit'] = 'LIMIT 0,1';
                }
            }
        }
        //query
        $sqlstring = implode(' ', $sql);
        //multi
        $listcount = 1;
        if (!empty($paramarr['perpage'])) {
            $listcount = $_SGLOBAL['db_uch']->result($_SGLOBAL['db_uch']->query('SELECT COUNT(*) FROM ' . tname('space', '2') . ' ' . $sql['where']), 0);
            if ($listcount) {
                $urlarr = $_SGET;
                unset($urlarr['page']);
                $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0);
            }
        }
    } else {
        $uchdb = $_SGLOBAL['db_uch'];
        include_once S_ROOT . './function/block_sql.func.php';
        list($sqlstring, $listcount) = runsql($paramarr, $uchdb);
        if (!empty($paramarr['perpage'])) {
            if ($listcount) {
                $urlarr = $_SGET;
                unset($urlarr['page']);
                $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0);
            }
        }
    }
    //查询数据
    if ($listcount) {
        //预处理
        include_once S_ROOT . './uc_client/client.php';
        //查询
        $query = $_SGLOBAL['db_uch']->query($sqlstring);
        while ($value = $_SGLOBAL['db_uch']->fetch_array($query)) {
            //头像处理
            $value['avatarflash'] = uc_avatar($_SGLOBAL['supe_uid']);
            $theblockarr[] = $value;
        }
    }
    return $theblockarr;
}
Exemplo n.º 22
0
 if (!empty($_POST) and !empty($adminname) and !empty($adminid)) {
     $adminid = GetNum($adminid);
     if (empty($adminid)) {
         showmsg("缺少ID参数!", "-1");
     }
     //出错!
     if (empty($adminname)) {
         showmsg("管理员名不能为空!", "-1");
     }
     //出错!
     if (strlen($adminpwd) != 32) {
         $adminpwd = md5($adminpwd);
     }
     //用户密码加密
     if (is_array($mid)) {
         $adminmid = getdotstring($mid, 'int');
     }
     //格式化成id,id形式
     foreach ($menuarray as $value) {
         if (in_array($value['mid'], $mid)) {
             $temparray[] = $value['mcode'];
         }
     }
     $adminpurview = implode_field_value($temparray);
     //格式化成id,id形式
     $arrayadd = array("adminname" => Char_cv($adminname), "adminpwd" => Char_cv($adminpwd), "adminmid" => $adminmid, "adminpurview" => $adminpurview);
     $info = $Table->edit($adminid, $arrayadd);
     if ($info == "OK") {
         exit("<script language='javascript'>alert('编辑成功');parent.\$.fn.colorbox.close();</script>");
     } else {
         exit("<script language='javascript'>alert('编辑失败');history.go(-1);</script>");