/** * 搜索用户 */ public function search() { $page = isset($GLOBALS['page']) ? intval($GLOBALS['page']) : 1; $page = max($page, 1); $uid = $this->memberinfo['uid']; $publisher = $this->memberinfo['username']; $username = isset($GLOBALS['username']) ? sql_replace($GLOBALS['username']) : MSG('请输入会员名'); $cityid = get_cookie('cityid'); $result_rs = $this->db->get_list('member', "`username` LIKE '%{$username}%'", '*', 0, 20, $page, 'uid DESC'); $result = array(); foreach ($result_rs as $r) { $r['member_info'] = $r; $v1 = $this->db->get_one('myfriend', array('myuid' => $r['uid'], 'uid' => $uid)); $v2 = $this->db->get_one('myfriend', array('myuid' => $uid, 'uid' => $r['uid'])); if ($v2 && $v1) { //相互关注 $r['rtype'] = 1; } elseif ($v2) { $r['rtype'] = 2; //已添加 } elseif ($v1) { $r['rtype'] = 3; //请求添加 } $result[] = $r; } $pages = $this->db->pages; $total = $this->db->number; include T('member', 'friend_search_listing'); }
public function listing() { $where = ''; $keywords = ''; $cid = intval($GLOBALS['cid']); $categorys = get_cache('category', 'content'); $modelid = $categorys[$cid]['modelid']; $model_r = $this->db->get_one('model', array('modelid' => $modelid)); $master_table = $model_r['master_table']; $where = "cid='{$cid}'"; if (isset($GLOBALS['keywords'])) { if (isset($GLOBALS['charset']) && strtolower(CHARSET) == 'gbk') { $keywords = iconv('utf-8', 'gbk', $GLOBALS['keywords']); } else { $keywords = $GLOBALS['keywords']; } $keywords = trim(sql_replace($keywords)); // $master_table = 'content_share'; if (isset($GLOBALS['keytype']) && $GLOBALS['keytype'] == 'username') { $where .= " AND `publisher` = '{$keywords}'"; } else { $GLOBALS['keytype'] = 'keywords'; $where .= "AND `title` LIKE '%{$keywords}%'"; } } $page = isset($GLOBALS['page']) ? intval($GLOBALS['page']) : 1; $result = $this->db->get_list($master_table, $where, '*', 0, 10, $page, 'id DESC'); $form = load_class('form'); include $this->template('relation_listing'); }
public function adduser() { if ($GLOBALS['submit']) { $username = sql_replace($GLOBALS['username']); $r = $this->db->get_one('member', array('username' => $username)); if (!$r) { MSG('用户名不存在'); } $rs = $this->db->get_one('admin', array('uid' => $r['uid'])); if (!$rs) { MSG('请先在添加管理员处,添加该用户'); } $workflowid = intval($GLOBALS['workflowid']); $level = intval($GLOBALS['level']); $wr = $this->db->get_one('workflow', array('workflowid' => $workflowid)); $users = array(); if ($wr['level' . $level . '_user'] != '') { $users = unserialize($wr['level' . $level . '_user']); } $users[$r['uid']] = $rs['truename'] ? $rs['truename'] : $username; $users = serialize($users); $this->db->update('workflow', array('level' . $level . '_user' => $users), array('workflowid' => $workflowid)); MSG(L('add success'), $GLOBALS['forward']); } else { $show_formjs = 1; include $this->template('workflow_adduser'); } }
function envoi_replace_fragments($replaces) { $desc = $GLOBALS['tables_auxiliaires']['spip_versions_fragments']; foreach ($replaces as $r) { sql_replace('spip_versions_fragments', $r, $desc); } }
/** * 后台用户列表 */ public function listing() { $page = max(1, isset($GLOBALS['page']) ? intval($GLOBALS['page']) : 1); $keyArr = array('username' => '用户名', 'uid' => 'UID', 'email' => 'Email', 'mobile' => '手机'); $keyType = isset($GLOBALS['keyType']) && isset($keyArr[$GLOBALS['keyType']]) ? $GLOBALS['keyType'] : 'username'; $keyValue = isset($GLOBALS['keyType']) ? sql_replace($GLOBALS['keyValue']) : ''; $regTimeStart = isset($GLOBALS['regTimeStart']) ? strtotime($GLOBALS['regTimeStart']) : ''; $regTimeEnd = isset($GLOBALS['regTimeEnd']) ? strtotime($GLOBALS['regTimeEnd']) : ''; $loginTimeStart = isset($GLOBALS['loginTimeStart']) ? strtotime($GLOBALS['loginTimeStart']) : ''; $loginTimeEnd = isset($GLOBALS['loginTimeEnd']) ? strtotime($GLOBALS['loginTimeEnd']) : ''; $groupid = isset($GLOBALS['groupid']) ? intval($GLOBALS['groupid']) : ''; $where = ''; if (isset($GLOBALS['search'])) { if ($keyValue) { $where = ' AND ' . $keyType . '="' . $keyValue . '"'; } else { $where .= $groupid ? ' AND groupid = ' . $groupid : ''; $where .= $regTimeStart ? ' AND regtime >= ' . $regTimeStart : ''; $where .= $regTimeEnd ? ' AND regtime <= ' . $regTimeEnd + 86400 : ''; $where .= $loginTimeStart ? ' AND lasttime >= ' . $loginTimeStart : ''; $where .= $loginTimeEnd ? ' AND lasttime <= ' . $loginTimeEnd + 86400 : ''; } $where = substr($where, 4); } $result = $this->db->get_list('member', $where, '*', 0, 20, $page, 'uid DESC'); $pages = $this->db->pages; $group = $this->group; include $this->template('member_listing', M); }
private function keyword($field, $value) { if ($value == '') { return ''; } $data = array(); if (strpos($value, ',') === false) { $data = explode(' ', $value); } else { $data = explode(',', $value); } foreach ($data as $v) { $v = sql_replace($v); $v = str_replace(array('/', '#', '.'), '', $v); $tag_info = $this->db->get_one('tag', array('tag' => $v), 'tid'); if (empty($tag_info)) { $tid = $this->db->insert('tag', array('tag' => $v, 'addtime' => SYS_TIME)); $this->keyword_pro($v, $tid); } else { $tid = $tag_info['tid']; } $id = $this->id; $exists_where = array('tid' => $tid, 'modelid' => $this->modelid, 'cid' => $this->cid, 'id' => $id); if (!$this->db->get_one('tag_data', $exists_where)) { $this->db->insert('tag_data', $exists_where); $this->db->update('tag', "`number`=(`number`+1)", array('tid' => $tid)); } } }
/** * 优惠券激活 */ public function getit() { $order_no = sql_replace($GLOBALS['order_no']); $r = $this->db->get_one('coupon_card', "`card_no`='{$order_no}'"); if ($r) { if ($r['status'] == 2) { MSG('您输入的优惠券已经被激活,不能重复使用'); } $memberinfo = $this->memberinfo; $formdata = array(); $formdata['cardid'] = $r['cardid']; $formdata['card_no'] = $r['card_no']; $formdata['title'] = $r['title']; $formdata['remark'] = $r['remark']; $formdata['mount'] = $r['mount']; $formdata['id'] = $r['id']; $formdata['addtime'] = SYS_TIME; $formdata['endtime'] = $r['endtime']; $formdata['url'] = $r['url']; $formdata['uid'] = $memberinfo['uid']; $formdata['status'] = 0; $this->db->insert('coupon_card_active', $formdata); $formdata2 = array(); if ($r['usetype']) { $formdata2 = array('uid' => $memberinfo['uid']); } else { //仅能使用一次 $formdata2 = array('uid' => $memberinfo['uid'], 'status' => 2); } $this->db->update('coupon_card', $formdata2, array('cardid' => $r['cardid'])); MSG('优惠券激活成功', 'index.php?m=coupon&f=coupon&v=listing'); } else { MSG('您输入的优惠券不存在'); } }
/** * 内容页面 * url规则 /index.php?m=tags&f=index&v=show&tid=2,tid=id/pinyin/tag/其中一个 */ public function show() { $siteconfigs = $this->siteconfigs; $page = max(1, output($GLOBALS, 'page')); if (isset($GLOBALS['tid']) && is_numeric($GLOBALS['tid'])) { $tid = intval($GLOBALS['tid']); $where = array('tid' => $tid); } elseif (isset($GLOBALS['tid']) && ctype_alnum($GLOBALS['tid'])) { $tid = sql_replace($GLOBALS['tid']); $where = array('pinyin' => $tid); } else { if (strtolower(CHARSET) == 'gbk') { $tid = iconv('utf-8', 'gbk', urldecode($GLOBALS['tid'])); } else { $tid = urldecode($GLOBALS['tid']); } $where = array('tag' => $tid); } $tag_info = $this->db->get_one('tag', $where); if (empty($tag_info)) { MSG(L('parameter_error')); } $tid = is_numeric($tid) ? $tid : $tag_info['tid']; $this->html_tags->show($tid, $tag_info); }
/** * 公共模型搜索 */ public function init() { $siteconfigs = $this->siteconfigs; $seo_title = '搜索 - ' . $siteconfigs['sitename']; $seo_keywords = $siteconfigs['seo_keywords']; $seo_description = $siteconfigs['seo_description']; $categorys = get_cache('category', 'content'); $keywords = sql_replace($GLOBALS['keywords']); $starttime = isset($GLOBALS['starttime']) ? intval($GLOBALS['starttime']) : 0; $runtime = ''; $history_result = array(); $search_cookie = get_cookie('search_cookie'); $history_result = explode('||', $search_cookie); $models = get_cache('model_content', 'model'); $modelid = isset($GLOBALS['modelid']) ? intval($GLOBALS['modelid']) : 0; if ($keywords) { if ($starttime) { $stime = SYS_TIME - $starttime * 86400; $where = "`status`=9 AND (`addtime`>{$stime} AND `title` LIKE '%{$keywords}%') or (`addtime`>{$stime} AND `remark` LIKE '%{$keywords}%')"; } else { $where = "`status`=9 AND `title` LIKE '%{$keywords}%' or `remark` LIKE '%{$keywords}%'"; } $page = intval($GLOBALS['page']); if ($modelid) { $tablename = $models[$modelid]['master_table']; } else { $tablename = 'content_share'; } $result = $this->db->get_list($tablename, $where, '*', 0, 20, $page, 'id DESC'); $result_pages = $this->db->pages; $total_number = $this->db->number; if ($search_cookie) { if (!in_array($keywords, $history_result)) { $search_cookie = $keywords . "||" . $search_cookie; } } else { $search_cookie = $keywords; } set_cookie('search_cookie', $search_cookie, SYS_TIME + 86400 * 30); $_endTime = microtime(true); $runtime = $_endTime - $GLOBALS['_startTime']; $runtime = sprintf("%.3f", $runtime); } else { $result = array(); $page = 0; $result_pages = ''; $total_number = 0; $runtime = '0.00001'; } if ($search_cookie) { if (count($history_result) > 10) { array_pop($history_result); $search_cookie = implode('||', $history_result); set_cookie('search_cookie', $search_cookie, SYS_TIME + 86400 * 30); } } include T('content', 'search', TPLID); }
public function listing() { $show_dialog = 1; $result = array(); $stype = isset($GLOBALS['stype']) ? intval($GLOBALS['stype']) : 1; $status = isset($GLOBALS['status']) ? intval($GLOBALS['status']) : 9; $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : 0; $keywords = isset($GLOBALS['keywords']) ? sql_replace($GLOBALS['keywords']) : ''; $start = isset($GLOBALS['start']) ? $GLOBALS['start'] : ''; $end = isset($GLOBALS['end']) ? $GLOBALS['end'] : ''; $modelid = $GLOBALS['modelid']; $form = load_class('form'); $where = array('modelid' => $modelid); $categorys = $this->db->get_list('category', $where, '*', 0, 200, 0, '', '', 'cid'); $options = array(1 => '标题', 2 => '描述', 3 => '发布人'); $model_r = $this->db->get_one('model', array('modelid' => $modelid)); $master_table = $model_r['master_table']; $where = "status=9"; $model_r = $this->db->get_one('model', array('modelid' => $modelid)); $master_table = $model_r['master_table']; if ($cid) { $where = "`cid`='{$cid}' AND `status`='{$status}'"; } else { $where = "`status`='{$status}'"; } switch ($stype) { case 1: if ($keywords) { $where .= " AND `title` LIKE '%{$keywords}%'"; } break; case 2: if ($keywords) { $where .= " AND `remark` LIKE '%{$keywords}%'"; } break; case 3: if ($keywords) { $where .= " AND `publisher`='{$keywords}'"; } break; } if ($start) { $where .= " AND `addtime`>'" . strtotime($start) . "'"; } if ($end) { $where .= " AND `addtime`<'" . strtotime($end) . "'"; } $page = intval($GLOBALS['page']); $page = max($page, 1); $result = $this->db->get_list($master_table, $where, '*', 0, 20, $page, 'sort DESC'); $pages = $this->db->pages; $form = load_class('form'); include $this->template('sundry_listing'); }
public function init() { $uid = get_cookie('_uid'); if (!$uid) { exit('0'); } $serverId = $GLOBALS['serverId']; $localId = md5($GLOBALS['localId']); //$r = $this->db->get_one('weixin_uploadfile', array('uid'=>$uid,'localId' => $localId)); //if($r) exit('1'); $formdata = array(); $formdata['uid'] = $uid; $formdata['pageid'] = sql_replace($GLOBALS['pageid']); $formdata['localId'] = $localId; $formdata['serverId'] = strip_tags($serverId); $formdata['addtime'] = SYS_TIME; $formdata['ip'] = get_ip(); $this->db->insert('weixin_uploadfile', $formdata); echo '1'; }
public function add() { $seo_title = '发私信'; $memberinfo = $this->memberinfo; if (isset($GLOBALS['submit'])) { $tousername = sql_replace($GLOBALS['tousername']); if ($tousername == '') { MSG('用户名错误'); } $r = $this->db->get_one('member', array('username' => $tousername)); if (!$r) { MSG('用户名错误'); } $content = remove_xss($GLOBALS['content']); $this->db->insert('message', array('uid' => $memberinfo['uid'], 'touid' => $r['uid'], 'username' => $memberinfo['username'], 'addtime' => SYS_TIME, 'content' => $content)); MSG('私信发送成功', HTTP_REFERER); } else { $username = isset($GLOBALS['username']) ? remove_xss($GLOBALS['username']) : ''; include T('message', 'add'); } }
/** * 添加推荐用户 */ public function add() { if (isset($GLOBALS['submit'])) { $username = sql_replace($GLOBALS['username']); $r = $this->db->get_one('member', array('username' => $username)); if (!$r) { MSG('用户不存在'); } $formdata = array(); $formdata['cityid'] = intval($GLOBALS['cityid']); $formdata['uid'] = $r['uid']; $this->db->insert('friend_elite', $formdata); MSG(L('operation_success'), '?m=member&f=friend&v=listing' . $this->su()); } else { $group = $this->group; $form = load_class('form'); $where = array('modelid' => 3); $categorys = $this->db->get_list('category', $where, '*', 0, 2000, 0, '', '', 'cid'); $show_formjs = 1; include $this->template('friend_add'); } }
function action_petitionner_dist() { include_spip('inc/autoriser'); $securiser_action = charger_fonction('securiser_action', 'inc'); $arg = $securiser_action(); $id_article = intval($arg); if (!autoriser('modererpetition', 'article', $id_article)) return; switch(_request('change_petition')) { case 'on': $email_unique = (_request('email_unique') == 'on') ? 'oui' : 'non'; $site_obli = (_request('site_obli') == 'on') ? 'oui' : 'non'; $site_unique = (_request('site_unique') == 'on') ? 'oui' : 'non'; $message = (_request('message') == 'on') ? 'oui' : 'non'; include_spip('base/auxiliaires'); sql_replace('spip_petitions', array('id_article' => $id_article, 'email_unique' => $email_unique, 'site_obli' => $site_obli, 'site_unique' => $site_unique, 'message' => $message), $GLOBALS['tables_auxiliaires']['spip_petitions']); include_spip('inc/modifier'); revision_petition($id_article, array('texte' => _request('texte_petition')) ); break; case 'off': sql_delete("spip_petitions", "id_article=$id_article"); break; } }
/** * 预约卡登陆 */ public function login() { if (isset($GLOBALS['card_no'])) { if (empty($GLOBALS['card_no']) || empty($GLOBALS['password'])) { MSG('卡号和密码必须填写', '?m=order&f=card&v=login', 2000); } $card_no = sql_replace($GLOBALS['card_no']); $r = $this->db->get_one('order_card', array('card_no' => $card_no)); if ($r) { $password = decode($r['password'], 'Hx0si1'); if ($password != $GLOBALS['password']) { MSG('卡号或者密码错误'); } if ($r['status'] == 2) { MSG('您的预约卡已经使用过,不能重复预约,您可以通过登录“会员中心”查看详情!'); } //验证成功 $mr = $this->db->get_one('member', array('username' => $card_no)); if ($mr) { $formdata = $mr; } else { $factor = random_string('diy', 6, 'abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); $password = md5(md5($password) . $factor); $formdata = array('username' => $card_no, 'password' => $password, 'factor' => $factor, 'groupid' => 6, 'points' => 0, 'modelid' => 10, 'email' => '', 'regtime' => SYS_TIME, 'lasttime' => SYS_TIME); $formdata['uid'] = $this->db->insert('member', $formdata); $this->db->update('order_card', array('uid' => $formdata['uid']), array('cardid' => $r['cardid'])); } $this->create_cookie($formdata, SYS_TIME + 604800); MSG('欢迎您的光临,即将进入预约信息页', '?m=order&f=order_form&v=order_workflow&acbar=3'); } else { MSG('卡号或者密码错误'); } } else { include T('order', 'index'); } }
} } # there is no error in submited datas if ($nb_erreur == 0) { # case : new item to add if (!isset($_POST['id']) or empty($_POST['id'])) { $sql_add = sql_replace($sql['member']['insert_level'], $_POST); $sgbd = sql_connect(); if (sql_query($sql_add) != false) { $page['L_message'] = $lang['member']['form_level_add_1']; } else { $page['L_message'] = $lang['member']['form_level_add_0']; } sql_close($sgbd); } else { $sql_modification = sql_replace($sql['member']['edit_level'], $_POST); $sgbd = sql_connect(); if (sql_query($sql_modification) != false) { $page['L_message'] = $lang['member']['form_level_edit_1']; } else { $page['L_message'] = $lang['member']['form_level_edit_0']; } sql_close($sgbd); } } else { # there is some errors: we show the datas again if (isset($_POST['id'])) { $page['value_id'] = $_POST['id']; } if (isset($_POST['name'])) { $page['value_name'] = $_POST['name'];
include_once create_path("competition/lg_competition_" . LANG . ".php"); include_once create_path("member/sql_member.php"); include_once create_path("member/lg_member_" . LANG . ".php"); include_once create_path("competition/tpl_competition.php"); $sql_liste = $sql['competition']['select_season']; $sgbd = sql_connect(); $res_liste = sql_query($sql_liste); $nb_ligne_s = sql_num_rows($res_liste); $is = "0"; $page['nb_dirigeant'] = 0; while ($ligne = sql_fetch_array($res_liste)) { # manager for the season $var['condition'] = " WHERE mc.club_id='" . $page['id'] . "' AND mc.season_id='" . $ligne['season_id'] . "' AND mf.season_id='" . $ligne['season_id'] . "'"; $var['order'] = " ORDER BY f.job_name ASC"; $var['limit'] = ""; $sql_dirigeant = sql_replace($sql['member']['select_member_job_club'], $var); $sgbd = sql_connect(); $res_dirigeant = sql_query($sql_dirigeant); $nb_ligne_dirigeant = sql_num_rows($res_dirigeant); if ($nb_ligne_dirigeant != "0") { $j = "0"; while ($ligne_dirigeant = sql_fetch_array($res_dirigeant)) { $page['season'][$is]['dirigeant'][$j]['i'] = $page['nb_dirigeant']; $page['season'][$is]['dirigeant'][$j]['season'] = $is; $page['season'][$is]['dirigeant'][$j]['job'] = $ligne_dirigeant['job_name']; $page['season'][$is]['dirigeant'][$j]['dirigeant'] = $ligne_dirigeant['member_id']; $page['season'][$is]['dirigeant'][$j]['dirigeant_text'] = $ligne_dirigeant['member_firstname'] . " " . $ligne_dirigeant['member_lastname']; $page['season'][$is]['dirigeant'][$j]['season_dirigeant'] = $ligne_dirigeant['season_id']; $page['season'][$is]['dirigeant'][$j]['link_view'] = convert_url("index.php?r=" . $lang['general']['idurl_member'] . "&v1=view&v2=" . $ligne_dirigeant['member_id']); $page['season'][$is]['dirigeant'][$j]['mod'] = $j % 2; $j++;
if (!isset($_POST['id']) or empty($_POST['id'])) { # on recupere l'ordre max $sql_ordre_max = $sql['match']['select_stats_order']; $sgbd = sql_connect(); $res_ordre_max = sql_query($sql_ordre_max); $ligne_ordre_max = sql_fetch_array($res_ordre_max); $_POST['ordre'] = $ligne_ordre_max['max'] + 1; $sql_add = sql_replace($sql['match']['insert_stats'], $_POST); if (sql_query($sql_add) != false) { $page['L_message'] = $lang['match']['form_stats_add_1']; } else { $page['L_message'] = $lang['match']['form_stats_add_0']; } sql_close($sgbd); } else { $sql_modification = sql_replace($sql['match']['edit_stats'], $_POST); $sgbd = sql_connect(); if (sql_query($sql_modification) != false) { $page['L_message'] = $lang['match']['form_stats_edit_1']; } else { $page['L_message'] = $lang['match']['form_stats_edit_0']; } sql_close($sgbd); } } else { # there is some errors: we show the datas again if (isset($_POST['id'])) { $page['value_id'] = $_POST['id']; } if (isset($_POST['name'])) { $page['value_name'] = $_POST['name'];
/** * 根据GET传值,返回where条件给主方法使用 * * @author tuzwu * @createtime 2014-7-30 21:43:48 * @modifytime * @param * @return string */ private function search_where() { $where = ''; $GLOBALS['start'] = isset($GLOBALS['start']) ? remove_xss($GLOBALS['start']) : ''; $GLOBALS['end'] = isset($GLOBALS['end']) ? remove_xss($GLOBALS['end']) : ''; $GLOBALS['userid'] = isset($GLOBALS['userid']) && $GLOBALS['userid'] ? intval($GLOBALS['userid']) : ''; $GLOBALS['name'] = isset($GLOBALS['name']) ? sql_replace($GLOBALS['name']) : ''; $GLOBALS['tags'] = isset($GLOBALS['tags']) ? sql_replace($GLOBALS['tags']) : ''; $GLOBALS['order'] = isset($GLOBALS['order']) ? intval($GLOBALS['order']) : '0'; if (!isset($GLOBALS['dosearch'])) { return ''; } if ($GLOBALS['start'] || $GLOBALS['end']) { if ($GLOBALS['start'] && !$GLOBALS['end']) { $where_end_time = SYS_TIME; } if (!$GLOBALS['start'] && $GLOBALS['end']) { $where_start_time = SYS_TIME - 2592000; } if ($GLOBALS['start'] && $GLOBALS['end']) { $where_start_time = strtotime($GLOBALS['start']); $where_end_time = strtotime($GLOBALS['end']); if ($where_start_time > $where_end_time) { list($where_start_time, $where_end_time) = array($where_end_time, $where_start_time); } } $where .= " and `addtime` BETWEEN '{$where_start_time}' AND '{$where_end_time}' "; } if ($GLOBALS['userid']) { $where .= ' and userid ="' . $GLOBALS['userid'] . '" '; } if ($GLOBALS['name']) { $where .= ' and instr (`name`,"' . $GLOBALS['name'] . '") '; } if ($GLOBALS['tags']) { $where .= ' and tags like "%' . $GLOBALS['tags'] . '%" '; } if ($GLOBALS['order']) { switch ($GLOBALS['order']) { case 1: $order_by = 'filesize DESC'; break; case 2: $order_by = 'filesize ASC'; break; case 4: $order_by = 'id ASC'; break; default: $order_by = 'id DESC'; break; } $this->order_by = $order_by; } return $where; }
function maj_1_950($installee) { // oubli de gerer le prefixe lors l'introduction de l'abstraction // => Relancer les MAJ concernees si la version dont on part les avait fait if ($installee >= 1.946) { serie_alter('950a', $GLOBALS['maj'][1946]); } if ($installee >= 1.947) { serie_alter('950b', $GLOBALS['maj'][1947]); } if ($installee >= 1.949) { @serie_alter('950c', $GLOBALS['maj'][1949]); } global $tables_auxiliaires; include_spip('base/auxiliaires'); $v = $tables_auxiliaires[$k = 'spip_urls']; sql_create($k, $v['field'], $v['key'], false, false); foreach (array('article' => 'id_article', 'rubrique' => 'id_rubrique', 'breve' => 'id_breve', 'auteur' => 'id_auteur', 'mot' => 'id_mot', 'syndic' => 'id_syndic') as $type => $id_objet) { $table = $type == 'syndic' ? $type : $type . "s"; $date = $type == 'breve' ? 'date_heure' : ($type == 'auteur' ? 'maj' : ($type == 'mot' ? 'maj' : 'date')); $q = @sql_select("url_propre AS url, {$id_objet} AS id_objet, '{$type}' AS type, {$date} as date", "spip_{$table}", "url_propre<>''"); if (!$q) { return; } // anormal, mais ne pas boucler en erreur while ($r = sql_fetch($q)) { sql_replace('spip_urls', $r); } spip_log("table {$table} : " . sql_count($q) . " urls propres copiees"); sql_alter("TABLE spip_{$table} DROP INDEX `url_propre`"); sql_alter("TABLE spip_{$table} DROP `url_propre`"); } }
$page['stats_player'][$i]['name'] = $ligne['stats_player_name']; $page['stats_player'][$i]['abbreviation'] = $ligne['stats_player_abbreviation']; $stats_player_id[$i] = $ligne['stats_player_id']; $stats_player_code[$i] = $ligne['stats_player_code']; $i++; } } } sql_free_result($res_stats_player); sql_close($sgbd); # match_stats_player_home $page['stats_player_home'] = array(); $page['stats_player_visitor'] = array(); $var['match'] = $page['id']; if (!empty($page['id'])) { $sql_stats_player = sql_replace($sql['match']['select_match_stats_player'], $var); $sgbd = sql_connect(); $res_stats_player = sql_query($sql_stats_player); $nb_ligne = sql_num_rows($res_stats_player); if ($nb_ligne != "0") { while ($ligne = sql_fetch_array($res_stats_player)) { $member = $ligne['member_id']; $stats_player = $ligne['stats_player_id']; $match_stats_player[$member][$stats_player] = $ligne['value']; } } sql_free_result($res_stats_player); sql_close($sgbd); } $nb_stats_player = sizeof($stats_player_id); # home
} } if ($_POST['action'][$i] == "import") { # we add the match ksort($field_list); ksort($value_list); $var['field'] = implode(", ", $field_list); $var['values'] = "'" . implode("', '", $value_list) . "'"; $sql_import = sql_replace($sql['match']['import_match'], $var); sql_query($sql_import); $match_id = sql_insert_id($sgbd); } elseif ($_POST['action'][$i] == "merge") { # we merge the match with the one found (we update only the not empty field) $var['field_value'] = implode(", ", $field_value_list); $var['id'] = $_POST['match'][$i]; $sql_merge = sql_replace($sql['match']['merge_match'], $var); sql_query($sql_merge); } } sql_close($sgbd); $page['value_step'] = ''; $page['num_step'] = ''; $page['show_step_1'] = ''; $page['show_step_2'] = ''; $page['show_step_3'] = ''; $page['show_step_4'] = ''; $page['L_message'] = $lang['match']['import_match_1']; } else { # there are some errors # match_field $column = $_POST['match_field'];
/** * * 搜索图片 * @return array */ public static function searchimg() { $seatchtype = intval($GLOBALS['s']); //1 文件名搜索,2文件夹搜索 $callback = $GLOBALS['callback']; if (!$callback) { return ''; } $db = load_class('db'); $pagesize = isset($GLOBALS['size']) ? intval($GLOBALS['size']) : 20; $page = $GLOBALS['start'] ? intval($GLOBALS['start']) : 1; if ($page > 1) { $page = ceil($page / $pagesize); } $q = sql_replace(iconv('gbk', 'utf-8', $GLOBALS['word'])); $where = ''; if ($seatchtype == 1) { $where = "`name` like '%{$q}%' AND `isimage`=1"; } elseif ($seatchtype == 2) { $where = "`diycat` like '%{$q}%' AND `isimage`=1"; } $lists = $db->get_list('attachment', $where, 'path,addtime,name', 0, $pagesize, $page, 'id DESC'); $return_list = $files = array(); foreach ($lists as $k => $v) { $file_name = pathinfo($v['name'], PATHINFO_FILENAME); $files[] = array('url' => ATTACHMENT_URL . $v['path'], 'mtime' => $v['addtime'], 'title' => $file_name); $return_list = $files; } $total = $db->number; unset($lists, $files); $result = array("listNum" => 1996, "data" => $return_list); return $result; }
$page['link_previous_page'] = convert_url($url . ($page_num - 1) . $end_url); $page['first_page'] = "1"; $page['previous_page'] = $page_num - 1; } # next page (except on the last one) if ($page_num != $nb_page) { $page['link_last_page'] = convert_url($url . $nb_page . $end_url); $page['link_next_page'] = convert_url($url . ($page_num + 1) . $end_url); $page['next_page'] = $page_num + 1; $page['last_page'] = $nb_page; } /******************/ /* END PAGINATION */ /******************/ } $sql_match = sql_replace($sql['match']['select_match_condition'], $var); $sgbd = sql_connect(); $res_match = sql_query($sql_match); $nb_ligne = sql_num_rows($res_match); $page['nb_match'] = $nb_ligne; if (!$right_user['match_list']) { $page['L_message_match'] = $lang['general']['acces_reserve_admin']; } elseif ($nb_ligne == "0") { $page['L_message_match'] = $lang['match']['E_match_not_found']; } else { $i = 0; $tmp_date = ''; while ($ligne = sql_fetch_array($res_match)) { $page['match'][$i]['id'] = $ligne['match_id']; $page['match'][$i]['club_visitor'] = $ligne['club_visitor_name']; $page['match'][$i]['club_home'] = $ligne['club_home_name'];
if ($execution) { $page['L_message'] = $lang['member']['form_country_add_1']; } else { $page['L_message'] = $lang['member']['form_country_add_0']; } $page['value_id'] = sql_insert_id($sgbd); sql_close($sgbd); # si l'add vient d'une page pop, c'est que l'on vient d'un autre formulaire. # on va donc renvoyer l'information au formulaire parent if ($execution and isset($_GET['fen']) and $_GET['fen'] == "pop") { $page['pop'] = "1"; $page['nouveau_text'] = $_POST['name']; $page['nouveau_id'] = $page['value_id']; } } else { $sql_modification = sql_replace($sql['member']['edit_country'], $_POST); $sgbd = sql_connect(); if (sql_query($sql_modification) != false) { $page['L_message'] = $lang['member']['form_country_edit_1']; } else { $page['L_message'] = $lang['member']['form_country_edit_0']; } sql_close($sgbd); } } else { # there is some errors: we show the datas again if (isset($_POST['id'])) { $page['value_id'] = $_POST['id']; } if (isset($_POST['name'])) { $page['value_name'] = $_POST['name'];
if ($nb_erreur == 0) { $_POST['status'] = 0; // simple member $_POST['valid'] = -1; // we ask for an activation if (isset($_POST['pass_member'])) { $_POST['pass_md5'] = md5($_POST['pass_member']); } if (isset($_POST['date_birth']) and !empty($_POST['date_birth'])) { $_POST['date_birth'] = convert_date_sql($_POST['date_birth']); } if (!isset($_POST['sex'])) { $_POST['sex'] = ""; } # we save data $sql_add = sql_replace($sql['member']['insert_member_registration'], $_POST); $sgbd = sql_connect(); $execution = sql_query($sql_add); if ($execution) { $page['L_message'] = $lang['member']['form_registration_add_1']; $page['value_id'] = sql_insert_id($sgbd); # we send an email if (MAIL == 1 and REGISTRATION_MAIL == 1) { $var['firstname'] = $_POST['login']; $var['site_title'] = SITE_TITLE; $var['site_url'] = ROOT_URL; $var['sender_email'] = SENDER_EMAIL; $var['sender_name'] = SENDER_NAME; $var['login'] = $_POST['login']; $var['pass'] = $_POST['pass_member']; $subject = text_replace($lang['member']['mail_registration_subject'], $var);
$included = 1; include create_path("competition/season_list.php"); unset($included); $page['season'] = $page['season']; if (!isset($page['season']['0']['id']) or empty($page['season']['0']['id'])) { $var['value_season'] = ""; } elseif (!isset($var['value_season']) or empty($var['value_season'])) { $var['value_season'] = $page['season']['0']['id']; } $var['condition'] = " WHERE mf.season_id='" . $var['value_season'] . "' "; if (isset($var['value_club']) and !empty($var['value_club'])) { $var['condition'] .= " AND mc.club_id='" . $var['value_club'] . "' AND mc.season_id='" . $var['value_season'] . "' "; } $var['order'] = " ORDER BY f.job_name ASC"; $var['limit'] = ""; $sql_member = sql_replace($sql['member']['select_member_job_club'], $var); $sgbd = sql_connect(); $res_member = sql_query($sql_member); $nb_ligne = sql_num_rows($res_member); if (!$right_user['member_job_list']) { $page['L_message_member_job'] = $lang['general']['acces_reserve_admin']; } elseif ($nb_ligne == "0") { $page['L_message_member_job'] = $lang['member']['E_member_not_found']; } else { $i = "-1"; $j = "0"; $tmp = ""; while ($ligne = sql_fetch_array($res_member)) { if ($tmp != $ligne['job_name']) { $i++; $page['member_job'][$i]['job'] = $ligne['job_name'];
$ligne = sql_fetch_array($res); sql_free_result($res); sql_close($sgbd); $page['value_name'] = $ligne['forum_name']; $page['value_idurl'] = $ligne['forum_idurl']; $page['value_description'] = $ligne['forum_description']; $page['value_status'] = $ligne['forum_status']; $page['value_order'] = $ligne['forum_order']; } # other forum list (for the order) $page['order'] = array(); $sgbd = sql_connect(); $var['condition'] = ""; $var['limit'] = ""; $var['order'] = "ORDER BY forum_order"; $res = sql_query(sql_replace($sql['forum']['select_forum_condition'], $var)); $nb_ligne = sql_num_rows($res); $page['nb_forum'] = $nb_ligne; if ($nb_ligne != "0") { $i = "0"; while ($ligne = sql_fetch_array($res)) { if ($page['value_order'] == $ligne['forum_order']) { $page['order'][$i]['order'] = ""; $page['order'][$i]['name'] = $lang['forum']['same_position']; $page['order'][$i]['selected'] = 'selected="selected"'; } else { $page['order'][$i]['order'] = $ligne['forum_order'] - 1; $page['order'][$i]['name'] = $lang['forum']['before'] . " " . $ligne['forum_name']; $page['order'][$i]['selected'] = ""; } $i++;
/** * 检查GLOBALS中是否存在变量 * @param $key * @param int $check_sql 是否sql_replace过滤 * @return mixed|string */ function input($key, $check_sql = 1) { if (isset($GLOBALS[$key])) { return $check_sql ? sql_replace($GLOBALS[$key]) : $GLOBALS[$key]; } else { return ''; } }
$page['season'][$is]['team_coach'][$j]['coach'] = $ligne_ee['member_id']; $page['season'][$is]['team_coach'][$j]['coach_text'] = $ligne_ee['member_firstname'] . " " . $ligne_ee['member_lastname']; $page['season'][$is]['team_coach'][$j]['season_coach'] = $ligne_ee['season_id']; $page['season'][$is]['team_coach'][$j]['link_view'] = convert_url("index.php?r=" . $lang['general']['idurl_member'] . "&v1=view&v2=" . $ligne_ee['member_id']); $j++; $page['nb_coach']++; } } else { // $page['season'][$is]['team_coach']=array(); } sql_free_result($res_team_coach); // players de l'team pour la season $var['condition'] = " WHERE ej.team_id='" . $page['id'] . "' AND ej.season_id='" . $ligne['season_id'] . "'"; $var['order'] = " ORDER BY ej.player_number ASC"; $var['limit'] = ""; $sql_team_player = sql_replace($sql['team']['select_team_player'], $var); $sgbd = sql_connect(); $res_team_player = sql_query($sql_team_player); $nb_ligne_ej = sql_num_rows($res_team_player); if ($nb_ligne_ej != "0") { $ij = "0"; while ($ligne_ej = sql_fetch_array($res_team_player)) { $page['season'][$is]['team_player'][$ij]['i'] = $page['nb_player']; $page['season'][$is]['team_player'][$ij]['season'] = $is; $page['season'][$is]['team_player'][$ij]['player'] = $ligne_ej['member_id']; $page['season'][$is]['team_player'][$ij]['player_text'] = $ligne_ej['member_firstname'] . " " . $ligne_ej['member_lastname']; $page['season'][$is]['team_player'][$ij]['number_player'] = $ligne_ej['player_number']; $page['season'][$is]['team_player'][$ij]['position'] = $ligne_ej['position_id']; $page['season'][$is]['team_player'][$ij]['position_text'] = $ligne_ej['position_name']; if ($ligne_ej['player_captain'] == 0) { $page['season'][$is]['team_player'][$ij]['captain_player'] = "";