func_usercp.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 1,800 行 · 第 1/4 页
PHP
1,800 行
<?php/*+--------------------------------------------------------------------------| Invision Power Board v2.1.5| =============================================| by Matthew Mecham| (c) 2001 - 2005 Invision Power Services, Inc.| | =============================================| Web: | Time: Wed, 01 Mar 2006 19:11:29 GMT| Release: | Licence Info: +---------------------------------------------------------------------------| > $Date: 2006-02-17 14:52:09 +0000 (Fri, 17 Feb 2006) $| > $Revision: 142 $| > $Author: bfarber $+---------------------------------------------------------------------------|| > UserCP functions library| > Module written by Matt Mecham| > Date started: 20th February 2002|| > Module Version Number: 1.0.0| > DBA Checked: Fri 21 May 2004+--------------------------------------------------------------------------*/class func_usercp{ var $ipsclass; var $class; var $image; var $jump_html; /*-------------------------------------------------------------------------*/ // CONSTRUCTOR /*-------------------------------------------------------------------------*/ function func_usercp(&$class) { $this->class = &$class; require_once( KERNEL_PATH.'class_image.php' ); $this->image = new class_image(); } /*-------------------------------------------------------------------------*/ // Generate the UserCP menu /*-------------------------------------------------------------------------*/ function ucp_generate_menu() { //----------------------------------------- // INIT //----------------------------------------- $menu_html = ""; $component_html = ""; $folder_links = ""; //----------------------------------------- // Get all member info.. //----------------------------------------- $this->ipsclass->DB->cache_add_query( 'generic_get_all_member', array( 'mid' => $this->ipsclass->member['id'] ) ); $this->ipsclass->DB->cache_exec_query(); if ( ! $member = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->DB->do_insert( 'member_extra', array( 'id' => $this->ipsclass->member['id'] ) ); } else { $this->ipsclass->member = array_merge( $member, $this->ipsclass->member ); } //----------------------------------------- // Get enabled components //----------------------------------------- if ( is_array( $this->ipsclass->cache['components'] ) and count( $this->ipsclass->cache['components'] ) ) { foreach( $this->ipsclass->cache['components'] as $id => $data ) { $file = ROOT_PATH.'sources/components_ucp/'.$data['com_filename'].'.php'; if ( file_exists( $file ) ) { require_once( $file ); $name = 'components_ucp_'.$data['com_filename']; $tmp = new $name(); $tmp->ipsclass =& $this->ipsclass; $component_html .= $tmp->ucp_build_menu(); unset($tmp); } } } //----------------------------------------- // Print the top button menu //----------------------------------------- $menu_html = $this->ipsclass->compiled_templates['skin_ucp']->Menu_bar( $component_html ); //----------------------------------------- // Messenger //----------------------------------------- if ( $this->ipsclass->member['g_use_pm'] ) { //----------------------------------------- // Do a little set up, do a litle dance, get // down tonight! *boogie* //----------------------------------------- $this->jump_html = "<select name='VID' class='forminput'>\n"; $this->ipsclass->member['dir_data'] = array(); //----------------------------------------- // Do we have VID? // No, it's just the way we walk! Haha, etc. //----------------------------------------- if ($this->ipsclass->input['VID']) { $this->vid = $this->ipsclass->input['VID']; } else { $this->vid = 'in'; } //----------------------------------------- // Print folder links //----------------------------------------- if ( ! $this->ipsclass->member['vdirs'] ) { $this->ipsclass->member['vdirs'] = "in:Inbox|sent:Sent Items"; } foreach( explode( "|", $this->ipsclass->member['vdirs'] ) as $dir ) { list ($id , $data) = explode( ":", $dir ); list ($real, $count) = explode( ";", $data ); if ( ! $id ) { continue; } $this->ipsclass->member['dir_data'][$id] = array( 'id' => $id, 'real' => $real, 'count' => $count ); if ($this->vid == $id) { $this->ipsclass->member['current_dir'] = $real; $this->ipsclass->member['current_id'] = $id; $this->jump_html .= "<option value='$id' selected='selected'>$real</option>\n"; } else { $this->jump_html .= "<option value='$id'>$real</option>\n"; } if ( $count ) { $real .= " ({$count})"; } $folder_links .= $this->ipsclass->compiled_templates['skin_ucp']->menu_bar_msg_folder_link($id, $real); } if ( $folder_links != "" ) { $menu_html = str_replace( "<!--IBF.FOLDER_LINKS-->", $folder_links, $menu_html ); } } $this->jump_html .= "<!--EXTRA--></select>\n\n"; return $menu_html; } /*-------------------------------------------------------------------------*/ // HANDLE SUBSCRIPTION START /*-------------------------------------------------------------------------*/ function subs_choose($save="") { //----------------------------------------- // Topic - forum - what? //----------------------------------------- $method = $this->ipsclass->input['method'] == 'forum' ? 'forum' : 'topic'; $tid = intval($this->ipsclass->input['tid']); $fid = intval($this->ipsclass->input['fid']); if ( $method == 'topic' ) { //----------------------------------------- // Get the details from the DB (TOPIC) //----------------------------------------- $topic = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid='.$tid ) ); if ( ! $topic['tid'] ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') ); } $forum = $this->ipsclass->forums->forum_by_id[ $topic['forum_id'] ]; } else { //----------------------------------------- // Get the details (FORUM) //----------------------------------------- $forum = $this->ipsclass->forums->forum_by_id[ $fid ]; } //----------------------------------------- // Permy check //----------------------------------------- if ( $this->ipsclass->check_perms( $this->ipsclass->forums->forum_by_id[ $forum['id'] ]['read_perms'] ) != TRUE ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') ); } //----------------------------------------- // Passy check //----------------------------------------- if ( $forum['password'] != "" ) { if ( $this->ipsclass->forums->forums_compare_password( $forum['id'] ) != TRUE ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'forum_no_access') ); } } //----------------------------------------- // Have we already subscribed? //----------------------------------------- if ( $method == 'forum' ) { $tmp = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'frid as tmpid', 'from' => 'forum_tracker', 'where' => "forum_id={$fid} AND member_id=".$this->ipsclass->member['id'] ) ); } else { $tmp = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'trid as tmpid', 'from' => 'tracker', 'where' => "topic_id={$tid} AND member_id=".$this->ipsclass->member['id'] ) ); } if ( $tmp['tmpid'] ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'already_sub') ); } //----------------------------------------- // What to do... //----------------------------------------- if ( ! $save ) { //----------------------------------------- // Okay, lets do the HTML //----------------------------------------- $this->class->output .= $this->ipsclass->compiled_templates['skin_ucp']->subs_show_choice_page( $forum, $topic, $method, $this->class->md5_check ); } else { //----------------------------------------- // Method.. //----------------------------------------- switch ($this->ipsclass->input['emailtype']) { case 'immediate': $this->method = 'immediate'; break; case 'delayed': $this->method = 'delayed'; break; case 'none': $this->method = 'none'; break; case 'daily': $this->method = 'daily'; break; case 'weekly': $this->method = 'weekly'; break; default: $this->method = 'delayed'; break; } //----------------------------------------- // Add it to the DB //----------------------------------------- if ( $method == 'forum' ) { $this->ipsclass->DB->do_insert( 'forum_tracker', array ( 'member_id' => $this->ipsclass->member['id'], 'forum_id' => $fid, 'start_date' => time(), 'forum_track_type' => $this->method, ) ); $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['sub_added'], "showforum=$fid" ); } else { $this->ipsclass->DB->do_insert( 'tracker', array ( 'member_id' => $this->ipsclass->member['id'], 'topic_id' => $tid, 'start_date' => time(), 'topic_track_type' => $this->method, ) ); $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['sub_added'], "showtopic=$tid&st={$this->ipsclass->input['st']}" ); } } $this->class->page_title = $this->ipsclass->lang['t_welcome']; $this->class->nav = array( "<a href='".$this->ipsclass->base_url."act=usercp&CODE=00'>".$this->ipsclass->lang['t_title']."</a>" ); } /*-------------------------------------------------------------------------*/ // HANDLE PHOTO OP'S /*-------------------------------------------------------------------------*/ function do_photo() { if ($_POST['act'] == "") { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form' ) ); } //----------------------------------------- // Nawty, Nawty! //----------------------------------------- if ($this->ipsclass->input['auth_key'] != $this->class->md5_check ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'del_post') ); } //----------------------------------------- // Did we press "remove"? //----------------------------------------- if ( $this->ipsclass->input['remove'] ) { $this->bash_uploaded_photos($this->ipsclass->member['id']); $this->ipsclass->DB->simple_construct( array( 'select' => 'id', 'from' => 'member_extra', 'where' => "id=".$this->ipsclass->member['id'] ) ); $this->ipsclass->DB->simple_exec(); if ( $this->ipsclass->DB->get_num_rows() ) { $this->ipsclass->DB->do_update( 'member_extra', array( 'photo_location' => '', 'photo_type' => '', 'photo_dimensions' => '', ), 'id='.$this->ipsclass->member['id'] ); } else { $this->ipsclass->DB->do_insert( 'member_extra', array( 'photo_location' => '', 'photo_type' => '', 'photo_dimensions' => '', 'id' => $this->ipsclass->member['id'] ) ); } $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['photo_c_up'], "act=UserCP&CODE=photo" ); } //----------------------------------------- // NO? CARRY ON!! //----------------------------------------- list($p_max, $p_width, $p_height) = explode( ":", $this->ipsclass->member['g_photo_max_vars'] ); //----------------------------------------- // Check to make sure we don't just have // http:// in the URL box.. //----------------------------------------- if ( preg_match( "/^http:\/\/$/i", $this->ipsclass->input['url_photo'] ) ) { $this->ipsclass->input['url_photo'] = ""; } if ( empty($this->ipsclass->input['url_photo']) ) { //----------------------------------------- // Lets check for an uploaded photo.. //----------------------------------------- if ($_FILES['upload_photo']['name'] != "" and ($_FILES['upload_photo']['name'] != "none") ) { //----------------------------------------- // Are we allowed to upload this avatar? //----------------------------------------- if ( $p_max < 0 ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_av_upload' ) ); } //----------------------------------------- // Remove any uploaded photos... //----------------------------------------- $this->bash_uploaded_photos($this->ipsclass->member['id']); $real_name = 'photo-'.$this->ipsclass->member['id']; $real_type = 'upload'; //----------------------------------------- // Load the library //----------------------------------------- require_once( KERNEL_PATH.'class_upload.php' ); $upload = new class_upload(); //----------------------------------------- // Set up the variables //----------------------------------------- $upload->out_file_name = 'photo-'.$this->ipsclass->member['id'];
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?