Example #1
0
 /**
  * 搜索
  */
 public function index()
 {
     $error = 0;
     if (IS_POST) {
         $data = $this->input->post('data');
         $data['id'] = (int) $data['id'];
         if (!$data['name'] && !$data['id'] && !$data['author'] && !$data['ext']) {
             $error = lang('215');
         } elseif (!$data['name'] && $data['id']) {
             $error = lang('214');
         } else {
             $where = array();
             if ($data['name'] && $data['id']) {
                 $where[] = '`related`="' . $data['name'] . '-' . $data['id'] . '"';
             } elseif ($data['name']) {
                 $where[] = '`related` LIKE "' . $data['name'] . '-%"';
             } else {
                 $where[] = '`related` <> ""';
             }
             if ($data['author']) {
                 $uid = get_member_id($data['author']);
                 if ($uid) {
                     $where[] = '`uid`=' . $uid;
                 } else {
                     $error = lang('043');
                     $where = NULL;
                 }
             }
             if (!$error && $data['ext']) {
                 $ext = explode(',', $data['ext']);
                 $_ext = array();
                 foreach ($ext as $t) {
                     $_ext[] = '`fileext`="' . $t . '"';
                 }
                 $where[] = '(' . implode(' OR ', $_ext) . ')';
             }
             if ($where) {
                 $where = implode(' AND ', $where);
                 $attach = $this->db->select('id')->where($where)->get($this->db->dbprefix('attachment'))->result_array();
                 if ($attach) {
                     $cache = array();
                     foreach ($attach as $t) {
                         $cache[] = (int) $t['id'];
                     }
                     $this->cache->file->save($this->cache_file, $cache, 7200);
                     $this->admin_msg(lang('217'), dr_url('attachment/result'), 2, 3);
                 }
             }
             $error = lang('216');
         }
         $data['id'] = $data['id'] ? $data['id'] : '';
     }
     $this->template->assign(array('data' => $data, 'error' => $error));
     $this->template->display('attachment_index.html');
 }
 /**
  * 修改审核文档
  */
 public function verifyedit()
 {
     $id = (int) $this->input->get('id');
     $cid = (int) $this->input->get('catid');
     $data = $this->content_model->get($id);
     $catid = $cid ? $cid : $data['catid'];
     $error = array();
     // 数据验证
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     $category = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid, 'field');
     // 可用字段
     $myfield = $this->_get_field($catid);
     if (IS_POST) {
         $cid = (int) $this->input->post('catid');
         // 判断栏目权限
         if ($cid != $catid && !$this->is_category_auth($catid, 'add')) {
             $this->admin_msg(lang('160'));
         }
         $catid = $cid;
         $category = $cid != $catid ? $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid) : $category;
         unset($cid);
         // 设置uid便于校验处理
         $uid = $this->input->post('data[author]') ? get_member_id($this->input->post('data[author]')) : 0;
         $_POST['data']['id'] = $id;
         $_POST['data']['uid'] = $uid;
         $status = $this->input->post('status');
         $post = $this->validate_filter($myfield, $data);
         if (isset($post['error'])) {
             $error = $post;
             $data = $this->input->post('data', TRUE);
         } elseif (!$catid) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'catid', 'msg' => lang('cat-22'));
         } else {
             $post[1]['uid'] = $uid;
             $post[1]['catid'] = $catid;
             $post[1]['status'] = $status;
             $result = $this->_verify($id, $post, '`id`=' . $id);
             $this->system_log('处理站点【#' . SITE_ID . '】模块【' . APP_DIR . '】审核内容【#' . $id . '】');
             // 记录日志
             if (is_array($result)) {
                 $this->admin_msg(lang('000') . (MODULE_HTML ? dr_module_create_show_file($id) . dr_module_create_list_file($catid) : ''), $this->input->post('backurl'), 1, 1);
             } elseif ($result) {
                 $this->admin_msg($result);
             }
             $this->admin_msg(lang('000'), $this->input->post('backurl'), 1);
         }
     }
     if ($data['status'] == 0) {
         // 退回
         $backuri = APP_DIR . '/admin/home/verify/status/0';
     } elseif ($data['status'] > 0 && $data['status'] < 9) {
         $backuri = APP_DIR . '/admin/home/verify/status/' . $data['status'];
     } else {
         $backuri = APP_DIR . '/admin/home/verify/';
     }
     $this->template->assign(array('data' => $data, 'menu' => $this->get_menu(array(lang('back') => $backuri, lang('edit') => APP_DIR . '/admin/home/verifyedit/id/' . $data['id'])), 'catid' => $catid, 'error' => $error, 'select' => $this->select_category($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category'), $catid, 'id=\'dr_catid\' name=\'catid\' onChange="show_category_field(this.value)"', '', 1), 'backurl' => $_SERVER['HTTP_REFERER'], 'myfield' => $this->new_field_input($myfield, $data, TRUE), 'is_category_field' => $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category_field')));
     $this->template->display('content_edit.html');
 }
 $date = format_date(date("Y-m-d"));
 if (isset($_GET['date'])) {
     $date = format_date($_GET['date']);
 }
 $table_id = "";
 if (isset($_GET['table_id'])) {
     $table_id = $_GET['table_id'];
     $query_history = select_history($table_id);
 }
 if ($table_id == "") {
     $check_table = 0;
     $tot_id = "";
     $member_id = "";
 } else {
     $check_table = check_table($table_id);
     $member_id = get_member_id($table_id);
     $tot_id = get_tot_id($table_id);
     $table_type = get_table_type($table_id);
 }
 $customer_number = 1;
 if (isset($_GET['mt_id'])) {
     $param = $_GET['mt_id'];
 } else {
     $param = '';
 }
 $branch_id = $_SESSION['branch_id'];
 $query_cat = select_cat($param);
 $query = select($branch_id);
 $query2 = select($branch_id);
 $query_find = select($branch_id);
 $action = "transaction.php?page=save";
function importfase6($action, $version)
{
    global $db, $table_prefix, $umil, $phpbb_root_path, $phpEx;
    global $eqdkp_table_prefix, $dkpid, $game_id;
    switch ($action) {
        case 'install':
            if ($umil->table_exists($eqdkp_table_prefix . 'raids')) {
                $raididdata = array();
                $raidvalue = array();
                $text = '';
                if (!$umil->table_column_exists($table_prefix . 'bbdkp_raids', 'eqdkpraid_id')) {
                    // add a new key in raids table to store the old eqdkp unique key.
                    $umil->table_column_add($table_prefix . 'bbdkp_raids', 'eqdkpraid_id', array('UINT', 0));
                }
                if (!$umil->table_column_exists($table_prefix . 'bbdkp_raids', 'raid_value')) {
                    // add temp column to hold raid value
                    $umil->table_column_add($table_prefix . 'bbdkp_raids', 'raid_value', array('DECIMAL:11', 0));
                }
                $number_raids = 0;
                $sql = 'SELECT * FROM ' . $eqdkp_table_prefix . 'raids ';
                $result = $db->sql_query($sql);
                // insert the raid
                while ($row = $db->sql_fetchrow($result)) {
                    // get the event id from the raid_name derived from the event_name
                    // note the event_name is NOT unique in eqdkp+ so we will have to select distinct to get the id...
                    $sql = 'SELECT DISTINCT event_id FROM ' . $table_prefix . "bbdkp_events WHERE event_name = '" . $db->sql_escape($row['raid_name']) . "' and event_dkpid = " . $dkpid;
                    $result1 = $db->sql_query($sql);
                    $event_id = intval($db->sql_fetchfield('event_id', false, $result1));
                    $db->sql_freeresult($result1);
                    if ($event_id == 0) {
                        // no valid event_id found, get first event...
                        $sql = 'SELECT DISTINCT event_id FROM ' . $table_prefix . "bbdkp_events WHERE event_dkpid = " . $dkpid;
                        $result1 = $db->sql_query($sql);
                        $event_id = intval($db->sql_fetchfield('event_id', false, $result1));
                        $db->sql_freeresult($result1);
                    }
                    $number_raids++;
                    //bbdkp raid_id is set to autoincrease
                    $query[] = array('event_id' => $event_id, 'eqdkpraid_id' => $row['raid_id'], 'raid_note' => $row['raid_note'], 'raid_start' => $row['raid_date'], 'raid_value' => $row['raid_value'], 'raid_end' => $row['raid_date'] + 3600, 'raid_added_by' => isset($row['raid_added_by']) ? $row['raid_added_by'] : '', 'raid_updated_by' => isset($row['raid_updated_by']) ? $row['raid_updated_by'] : '');
                    $text .= "<br/>" . $number_raids . ') Raid inserted for ' . $row['raid_value'] . ' points ';
                }
                $db->sql_multi_insert($table_prefix . 'bbdkp_raids', $query);
                unset($query);
                $db->sql_freeresult($result);
                //make link array between eqdkp and bbdkp raid_id
                $sql = 'SELECT raid_id, eqdkpraid_id, raid_value FROM ' . $table_prefix . 'bbdkp_raids';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $raididdata[$row['eqdkpraid_id']] = $row['raid_id'];
                    $raidvalue[$row['eqdkpraid_id']] = $row['raid_value'];
                }
                $db->sql_freeresult($result);
                // Raid detail
                if ($umil->table_exists($eqdkp_table_prefix . 'raid_attendees')) {
                    $number_raidattendees = 0;
                    $sql = 'select a.raid_id, a.member_name from ' . $eqdkp_table_prefix . 'raid_attendees a, eqdkp_raids b 
						where a.raid_id = b.raid_id group by a.raid_id, a.member_name having count(*) = 1 ';
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $number_raidattendees++;
                        $query[] = array('raid_id' => $raididdata[$row['raid_id']], 'raid_value' => $raidvalue[$row['raid_id']], 'member_id' => get_member_id($row['member_name']));
                    }
                    $db->sql_multi_insert($table_prefix . 'bbdkp_raid_detail', $query);
                    unset($query);
                    $db->sql_freeresult($result);
                }
                // Raid items
                if ($umil->table_exists($eqdkp_table_prefix . 'items')) {
                    $number_items = 0;
                    $sql = 'SELECT * FROM ' . $eqdkp_table_prefix . 'items ';
                    $result = $db->sql_query($sql);
                    // build bbdkp insert query
                    while ($row = $db->sql_fetchrow($result)) {
                        $number_items++;
                        //item id is auto_increment
                        $query[] = array('raid_id' => $raididdata[$row['raid_id']], 'member_id' => get_member_id($row['item_buyer']), 'item_name' => $row['item_name'], 'item_value' => $row['item_value'], 'item_date' => $row['item_date'], 'item_added_by' => $row['item_added_by'], 'item_updated_by' => isset($row['item_updated_by']) ? $row['item_updated_by'] : '', 'item_group_key' => $row['item_group_key']);
                        $text .= "<br/>" . $number_items . ') ' . $db->sql_escape($row['item_name']) . ' bought by : 
						' . $db->sql_escape($row['item_buyer']) . ' for : ' . $row['item_value'] . ' inserted. ';
                    }
                    $db->sql_multi_insert($table_prefix . 'bbdkp_raid_items', $query);
                    unset($query);
                    $db->sql_freeresult($result);
                }
                return array('command' => array('UMIL_INSERT_RAID', $text), 'result' => 'SUCCESS');
            } else {
                return array('command' => array('UMIL_RAID_FAIL'), 'result' => 'FAIL');
            }
            break;
    }
    return true;
}
Example #5
0
 /**
  * 修改审核文档
  */
 public function verifyedit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->content_model->get_verify($id);
     $catid = $data['catid'];
     $error = array();
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     if (IS_POST) {
         $_data = $data;
         $catid = (int) $this->input->post('catid');
         $cate = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid, 'field');
         $field = $cate ? array_merge($this->field, $cate) : $this->field;
         // 设置uid便于校验处理
         $uid = $this->input->post('data[author]') ? get_member_id($this->input->post('data[author]')) : 0;
         $_POST['data']['id'] = $id;
         $_POST['data']['uid'] = $uid;
         $data = $this->validate_filter($field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } elseif (!$catid) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'catid', 'msg' => lang('cat-22'));
         } elseif (!$this->input->post('flagid')) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'flagid', 'msg' => lang('161'));
         } else {
             $data[1]['uid'] = $uid;
             $data[1]['catid'] = $catid;
             $result = $this->_verify($id, $data, '`id`=' . $id);
             if (is_array($result)) {
                 $this->admin_msg(lang('000') . (MODULE_HTML ? dr_module_create_show_file($id) . dr_module_create_list_file($catid) : ''), $this->input->post('backurl'), 1, 1);
             } elseif ($result) {
                 $this->admin_msg($result);
             }
             $this->admin_msg(lang('000'), $this->input->post('backurl'), 1);
         }
     }
     if ($data['status'] == 0) {
         // 退回
         $backuri = APP_DIR . '/admin/home/verify/status/0';
     } elseif ($data['status'] > 0 && $data['status'] < 9) {
         $backuri = APP_DIR . '/admin/home/verify/status/' . $data['status'];
     } else {
         $backuri = APP_DIR . '/admin/home/verify/';
     }
     $this->template->assign(array('data' => $data, 'page' => max((int) $this->input->post('page'), 0), 'menu' => $this->get_menu(array(lang('back') => $backuri, lang('edit') => APP_DIR . '/admin/home/verifyedit/id/' . $data['id'])), 'catid' => $catid, 'error' => $error, 'select' => $this->select_category($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category'), $data['catid'], 'id=\'dr_catid\' name=\'catid\' onChange="show_category_field(this.value)"', '', 1), 'backurl' => $_SERVER['HTTP_REFERER'], 'myfield' => $this->field_input($this->field, $data, TRUE)));
     $this->template->display('content_edit.html');
 }
Example #6
0
 /**
  * 发送短消息
  *
  * @param	intval	$fromuid		发送者uid
  * @param	string	$fromusername	发送者username
  * @param	array	$data			发送数据
  * @return	string
  */
 public function send($fromuid, $fromusername, $data)
 {
     if (!$fromuid || !$fromusername || !$data['username'] || !$data['message']) {
         return lang('m-062');
     }
     $subject = dr_safe_replace(htmlspecialchars($data['subject']));
     $message = dr_safe_replace(htmlspecialchars($data['message']));
     // 查询会员数据
     $member = array();
     $username = explode(',', $data['username']);
     foreach ($username as $name) {
         $uid = get_member_id($name);
         if ($uid) {
             $member[$uid] = $name;
         }
     }
     if (!$member) {
         return lang('m-066');
     }
     // 建立对应关系
     $relationship = $existplid = $pm_member_insertsql = array();
     // 多个对象是,关系数组为多位数组
     foreach ($member as $key => $value) {
         if ($fromuid == $key) {
             return lang('m-067');
         }
         //$key是接收者id
         $relationship[$key] = $this->_relationship($fromuid, $key);
     }
     // 处理标题
     $subject = !$subject ? dr_strcut(dr_clearhtml($message), 80) : $subject;
     // 作为最后一条消息内容
     $lastsummary = dr_strcut(dr_clearhtml($message), 150);
     // 短消息会话表中按“对应关系”来查询
     $list = $this->db->select('plid, min_max')->where_in('min_max', $relationship)->get('pm_lists')->result_array();
     if ($list) {
         foreach ($list as $t) {
             $existplid[$t['min_max']] = $t['plid'];
             // 获取到该关系的plid
         }
     }
     // 最后一条消息的数据组装
     $lastmessage = array('lastauthorid' => $fromuid, 'lastauthor' => $fromusername, 'lastsummary' => $lastsummary);
     $lastmessage = dr_array2string($lastmessage);
     // 按照对应关系来插入消息表中,当对应关系在库中不存在时,重新创建一个对应关系表
     foreach ($relationship as $key => $value) {
         if (!isset($existplid[$value])) {
             // 插入新的列表id
             $this->db->insert('pm_lists', array('authorid' => $fromuid, 'author' => $fromusername, 'pmtype' => 1, 'subject' => $subject, 'members' => 2, 'min_max' => $value, 'dateline' => SYS_TIME, 'lastmessage' => $lastmessage));
             // 获取会话列表ID
             $plid = $this->db->insert_id();
             // 将列表id插入到消息索引表中
             $this->db->insert('pm_indexes', array('plid' => $plid));
             // 得到一个短消息ID
             $pmid = $this->db->insert_id();
             // 以回话列表id作为散列存储
             $this->db->insert($this->_pm_tablename($plid), array('pmid' => $pmid, 'plid' => $plid, 'authorid' => $fromuid, 'message' => $message, 'dateline' => SYS_TIME, 'delstatus' => 0));
             // 存储到“接受者的”消息状态表
             $this->db->insert('pm_members', array('plid' => $plid, 'uid' => $key, 'isnew' => 1, 'pmnum' => 1, 'lastupdate' => 0, 'lastdateline' => SYS_TIME));
             // 存储到“发送者的”消息状态表
             $this->db->insert('pm_members', array('plid' => $plid, 'uid' => $fromuid, 'isnew' => 0, 'pmnum' => 1, 'lastupdate' => SYS_TIME, 'lastdateline' => SYS_TIME));
         } else {
             // 获取上面查询的会话列表ID
             $plid = $existplid[$value];
             // 将列表id插入到消息索引表中
             $this->db->insert('pm_indexes', array('plid' => $plid));
             // 得到一个短消息ID
             $pmid = $this->db->insert_id();
             // 以回话列表id作为散列存储
             $this->db->insert($this->_pm_tablename($plid), array('pmid' => $pmid, 'plid' => $plid, 'authorid' => $fromuid, 'message' => $message, 'dateline' => SYS_TIME, 'delstatus' => 0));
             // 存储到“接受者的”消息状态表
             if ($this->db->where('plid', $plid)->where('uid', $key)->count_all_results('pm_members')) {
                 // 如果已经存在了就更新状态表
                 $this->db->where('plid', $plid)->where('uid', $key)->set('isnew', 1)->set('lastdateline', SYS_TIME)->set('pmnum', 'pmnum+1', FALSE)->update('pm_members');
             } else {
                 $this->db->insert('pm_members', array('plid' => $plid, 'uid' => $key, 'isnew' => 1, 'pmnum' => 1, 'lastupdate' => 0, 'lastdateline' => SYS_TIME));
             }
             // 存储到“发送者的”消息状态表
             if ($this->db->where('plid', $plid)->where('uid', $fromuid)->count_all_results('pm_members')) {
                 // 如果已经存在了就更新状态表
                 $this->db->where('plid', $plid)->where('uid', $fromuid)->set('isnew', 0)->set('lastdateline', SYS_TIME)->set('pmnum', 'pmnum+1', FALSE)->update('pm_members');
             } else {
                 $this->db->insert('pm_members', array('plid' => $plid, 'uid' => $fromuid, 'isnew' => 0, 'pmnum' => 1, 'lastupdate' => SYS_TIME, 'lastdateline' => SYS_TIME));
             }
             // 更新最后一条消息信息
             $this->db->where('plid', $plid)->set('lastmessage', $lastmessage)->update('pm_lists');
         }
     }
     // 插入用户的新短消息表
     foreach ($member as $key => $value) {
         $this->db->replace('newpm', array('uid' => $key));
     }
     return NULL;
 }
     update_config("transaction_tmp_details", $data, "transaction_detail_id", $id);
     break;
 case 'get_menu':
     $keyword = $_GET['keyword'];
     $data['menu_id'] = select_menu($keyword);
     return $data;
     break;
 case 'delete_history':
     $id = get_isset($_GET['id']);
     $table_id = get_isset($_GET['table_id']);
     delete_history($id);
     header("Location: transaction_new.php?table_id={$table_id}&did=3");
     break;
 case 'delete_item':
     $id = get_isset($_GET['id']);
     $member_id = get_member_id($id);
     $table_id = get_table_id($id);
     delete_item($id);
     header("Location: transaction_new.php?table_id={$table_id}&member_id={$member_id}&did=3");
     break;
 case 'delete_item_edit':
     $id = get_isset($_GET['id']);
     $table_id = get_isset($_GET['table_id']);
     delete_item_edit($id);
     header("Location: transaction_new.php?page=list_edit&table_id={$table_id}");
     break;
 case 'list_history':
     //get_header($title);
     $table_id = get_isset($_GET['table_id']);
     $check_table = check_table($table_id);
     if ($check_table > 0) {
Example #8
0
function is_follower($followed_unique_id)
{
    $followed_id = get_member_id($followed_unique_id);
    if ($_SESSION['m_id'] != '') {
        $my_id = $_SESSION['m_id'];
    }
    if ($_SESSION['visitorid'] != '') {
        $my_id = $_SESSION['visitorid'];
    }
    $sql = "select * from trans_member_follow where followed_id='" . $followed_id . "' and follower_id='" . $my_id . "' and follower_type='" . $_SESSION['user_type'] . "'";
    $rs = mysql_query($sql);
    if (mysql_num_rows($rs) > 0) {
        return 'y';
    } else {
        return 'n';
    }
}