usercp.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 1,953 行 · 第 1/5 页
PHP
1,953 行
$this->mod_ip_tool_start( $this->ipsclass->lang['cp_safe_fail'] ); return; } else { $this->mod_ip_tool_start( sprintf($this->ipsclass->lang['ip_resolve_result'], $final_ip_string, $resolved) ); } } else if ($this->ipsclass->input['iptool'] == 'members') { if ($exact_match == 0) { $sql = "ip_address LIKE '$final_ip_string'"; } else { $sql = "ip_address='$final_ip_string'"; } $this->ipsclass->DB->simple_construct( array( 'select' => 'count(id) as max', 'from' => 'members', 'where' => $sql ) ); $this->ipsclass->DB->simple_exec(); $total_possible = $this->ipsclass->DB->fetch_row(); if ($total_possible['max'] < 1) { $this->mod_ip_tool_start( $this->ipsclass->lang['cp_no_matches'] ); return; } $pages = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $total_possible['max'], 'PER_PAGE' => 20, 'CUR_ST_VAL' => $this->start_val, 'L_SINGLE' => $this->ipsclass->lang['single_page_forum'], 'L_MULTI' => $this->ipsclass->lang['multi_page_forum'], 'BASE_URL' => $this->ipsclass->base_url."act=usercp&CODE=doiptool&iptool=members&ip={$this->ipsclass->input['ip']}", ) ); $content = ""; if ( $this->ipsclass->member['mgroup'] != $this->ipsclass->vars['admin_group'] ) { $sql .= "AND mgroup != {$this->ipsclass->vars['admin_group']}"; } $this->ipsclass->DB->simple_construct( array( 'select' => 'name, members_display_name,id, ip_address, posts, joined, mgroup', 'from' => 'members', 'where' => $sql, 'order' => "joined DESC", 'limit' => array( $this->start_val,20 ) ) ); $this->ipsclass->DB->simple_exec(); while( $row = $this->ipsclass->DB->fetch_row() ) { $row['joined'] = $this->ipsclass->get_date( $row['joined'], 'JOINED' ); $row['groupname'] = $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['prefix'] . $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_title'] . $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['suffix']; $content .= $this->ipsclass->compiled_templates['skin_ucp']->mod_ip_member_row( $row, $this->ipsclass->return_md5_check() ); } $this->mod_ip_tool_start( $this->ipsclass->compiled_templates['skin_ucp']->mod_ip_member_results($pages, $content) ); } else { // Find posts then! if ($exact_match == 0) { $sql = "ip_address LIKE '$final_ip_string'"; } else { $sql = "ip_address='$final_ip_string'"; } // Get forums we're allowed to view $aforum = array(); foreach( $this->ipsclass->forums->forum_by_id as $id => $data ) { if ( $this->ipsclass->check_perms($data['read_perms']) == TRUE ) { $aforum[] = $data['id']; } } if ( count($aforum) < 1) { $this->mod_ip_tool_start( $this->ipsclass->lang['cp_no_matches'] ); return; } $the_forums = implode( ",", $aforum); $this->ipsclass->DB->cache_add_query( 'ucp_mod_ip_tool_one', array( 'the_forums' => $the_forums, 'sql' => $sql ) ); $this->ipsclass->DB->cache_exec_query(); $max_hits = $this->ipsclass->DB->get_num_rows(); $posts = ""; while ($row = $this->ipsclass->DB->fetch_row() ) { $posts .= $row['pid'].","; } $posts = preg_replace( "/,$/", "", $posts ); //----------------------------------------- // Do we have any results? //----------------------------------------- if ($posts == "") { $this->mod_ip_tool_start( $this->ipsclass->lang['cp_no_matches'] ); return; } //----------------------------------------- // If we are still here, store the data into the database... //----------------------------------------- $unique_id = md5(uniqid(microtime(),1)); $this->ipsclass->DB->do_insert( 'search_results', array ( 'id' => $unique_id, 'search_date'=> time(), 'post_id' => $posts, 'post_max' => $max_hits, 'sort_key' => 'p.post_date', 'sort_order' => 'desc', 'member_id' => $this->ipsclass->member['id'], 'ip_address' => $this->ipsclass->input['IP_ADDRESS'], ) ); $this->mod_ip_tool_start( $this->ipsclass->compiled_templates['skin_ucp']->mod_ip_post_results($unique_id, $max_hits) ); return TRUE; } } /*-------------------------------------------------------------------------*/ // Attachments /*-------------------------------------------------------------------------*/ function attachments() { $info = array(); $start = intval($this->ipsclass->input['st']); $perpage = 15; $sort_key = ""; switch ($this->ipsclass->input['sort']) { case 'date': $sort_key = 'a.attach_date ASC'; $info['date_order'] = 'rdate'; $info['size_order'] = 'size'; break; case 'rdate': $sort_key = 'a.attach_date DESC'; $info['date_order'] = 'date'; $info['size_order'] = 'size'; break; case 'size': $sort_key = 'a.attach_filesize DESC'; $info['date_order'] = 'date'; $info['size_order'] = 'rsize'; break; case 'rsize': $sort_key = 'a.attach_filesize ASC'; $info['date_order'] = 'date'; $info['size_order'] = 'size'; break; default: $sort_key = 'a.attach_date DESC'; $info['date_order'] = 'date'; $info['size_order'] = 'size'; break; } $this->page_title = $this->ipsclass->lang['m_attach']; $this->nav = array( "<a href='".$this->ipsclass->base_url."act=UserCP&CODE=00'>".$this->ipsclass->lang['t_title']."</a>" ); //----------------------------------------- // Get the ID's to delete //----------------------------------------- $ids = array(); foreach ($this->ipsclass->input as $key => $value) { if ( preg_match( "/^attach_(\d+)$/", $key, $match ) ) { if ($this->ipsclass->input[$match[0]]) { $ids[] = $match[1]; } } } $affected_ids = count($ids); if ( $affected_ids > 0 ) { $this->ipsclass->DB->cache_add_query( 'usercp_get_to_delete', array( 'mid' => $this->ipsclass->member['id'], 'aid_array' => $ids ) ); $o = $this->ipsclass->DB->cache_exec_query(); while ( $killmeh = $this->ipsclass->DB->fetch_row( $o ) ) { if ( $killmeh['attach_location'] ) { @unlink( $this->ipsclass->vars['upload_dir']."/".$killmeh['attach_location'] ); } if ( $killmeh['attach_thumb_location'] ) { @unlink( $this->ipsclass->vars['upload_dir']."/".$killmeh['attach_thumb_location'] ); } if ( $killmeh['topic_id'] ) { $this->ipsclass->DB->simple_construct( array( 'update' => 'topics', 'set' => 'topic_hasattach=topic_hasattach-1', 'where' => 'tid='.$killmeh['topic_id'] ) ); $this->ipsclass->DB->simple_shutdown_exec(); } } $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'attachments', 'where' => 'attach_id IN ('.implode(",",$ids).') and attach_member_id='.$this->ipsclass->member['id'] ) ); } //----------------------------------------- // Get some stats... //----------------------------------------- $maxspace = intval($this->ipsclass->member['g_attach_max']); if ( $this->ipsclass->member['g_attach_max'] == -1 ) { $this->ipsclass->Error( array( 'MSG' => 'no_permission', 'LEVEL' => 1 ) ); } //----------------------------------------- // Limit by forums //----------------------------------------- $stats = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as count, sum(attach_filesize) as sum', 'from' => 'attachments', 'where' => 'attach_member_id='.$this->ipsclass->member['id'] ) ); if ( $maxspace > 0 ) { //----------------------------------------- // Figure out percentage used //----------------------------------------- $info['has_limit'] = 1; $info['full_percent'] = $stats['sum'] ? sprintf( "%.0f", ( ( $stats['sum'] / ($maxspace * 1024) ) * 100) ) : 0; if ( $info['full_percent'] > 100 ) { $info['full_percent'] = 100; } $info['img_width'] = $info['full_percent'] > 0 ? intval($info['full_percent']) - 4 . "%" : 1;// * 2.4 : 1; //if ($info['img_width'] > 235) //{ // $info['img_width'] = 235; //} $this->ipsclass->lang['attach_space_count'] = sprintf( $this->ipsclass->lang['attach_space_count'], $stats['count'], $info['full_percent'] ); $this->ipsclass->lang['attach_space_used'] = sprintf( $this->ipsclass->lang['attach_space_used'] , $this->ipsclass->size_format(intval($stats['sum'])), $this->ipsclass->size_format($maxspace * 1024) ); } else { $info['has_limit'] = 0; $this->ipsclass->lang['attach_space_used'] = sprintf( $this->ipsclass->lang['attach_space_unl'] , $this->ipsclass->size_format(intval($stats['sum'])) ); } //----------------------------------------- // Pages //----------------------------------------- $pages = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $stats['count'], 'PER_PAGE' => $perpage, 'CUR_ST_VAL' => $start, 'L_SINGLE' => "", 'L_MULTI' => $this->ipsclass->lang['msg_pages'], 'BASE_URL' => $this->ipsclass->base_url."act=usercp&CODE=attach&sort={$this->ipsclass->input['sort']}", ) ); //----------------------------------------- // Get attachments... //----------------------------------------- $this->ipsclass->DB->cache_add_query( 'usercp_get_attachments', array( 'mid' => $this->ipsclass->member['id'], 'order' => $sort_key, 'limit_a' => $start, 'limit_b' => $perpage ) ); $this->ipsclass->DB->cache_exec_query(); $temp_html = ""; $this->ipsclass->load_language('lang_topic'); while ( $row = $this->ipsclass->DB->fetch_row() ) { if ( $this->ipsclass->check_perms($this->ipsclass->forums->forum_by_id[ $row['forum_id'] ]['read_perms']) != TRUE ) { $row['title'] = $this->ipsclass->lang['attach_topicmoved']; } //----------------------------------------- // Full attachment thingy //----------------------------------------- if ( $row['attach_pid'] ) { $row['_type'] = 'post'; } else { $row['_type'] = 'msg'; $row['title'] = $this->ipsclass->lang['attach_inpm']; } $row['image'] = $this->ipsclass->cache['attachtypes'][ $row['attach_ext'] ]['atype_img']; $row['short_name'] = $this->ipsclass->txt_truncate( $row['attach_file'], 30 ); $row['attach_date'] = $this->ipsclass->get_date( $row['attach_date'], 'SHORT' ); $row['real_size'] = $this->ipsclass->size_format( $row['attach_filesize'] ); $temp_html .= $this->ipsclass->compiled_templates['skin_ucp']->attachments_row( $row ); } $this->output .= $this->ipsclass->compiled_templates['skin_ucp']->attachments_top($info, $pages, $temp_html); } /*-------------------------------------------------------------------------*/ // Ignore user. /*-------------------------------------------------------------------------*/ function ignore_user_splash($msg="") { $this->page_title = $this->ipsclass->lang['t_welcome']; $this->nav = array( "<a href='".$this->ipsclass->base_url."act=UserCP&CODE=00'>".$this->ipsclass->lang['t_title']."</a>" ); $final_users = array(); $temp_users = array(); //----------------------------------------- // Do we have a MESSAGE FRROM GAWD???!@ //----------------------------------------- if ( $msg ) { $this->output .= $this->ipsclass->compiled_templates['skin_ucp']->ucp_message( $this->ipsclass->lang['mi5_error'], $msg ); } //----------------------------------------- // Do we have incoming? //----------------------------------------- if ( intval($this->ipsclass->input['uid']) ) { $this->ipsclass->DB->simple_construct( array( 'select' => 'id, name, members_display_name', 'from' => 'members', 'where' => "id=".intval($this->ipsclass->input['uid']) ) ); $this->ipsclass->DB->simple_exec(); $newmem = $this->ipsclass->DB->fetch_row(); $this->ipsclass->input['newbox_1'] = $newmem['members_display_name']; } //----------------------------------------- // Stored as userid,userid,userid //----------------------------------------- $ignored_users = explode( ',', $this->ipsclass->member['ignored_users'] ); //----------------------------------------- // Get members and check to see if they've // since been moved into a group that cannot // be ignored //----------------------------------------- foreach( $ignored_users as $id )
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?