| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /* Copyright (C) NAVER <http://www.navercorp.com> */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @class  boardController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @author NAVER ([email protected]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @brief  board module Controller class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class boardController extends board | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 	 * @brief initialization | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	function init() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	 * @brief insert document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	function procBoardInsertDocument() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 		// check grant | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 		if($this->module_info->module != "board") | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 			return new Object(-1, "msg_invalid_request"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 		if(!$this->grant->write_document) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 			return new Object(-1, 'msg_not_permitted'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 		$logged_info = Context::get('logged_info'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 		// setup variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 		$obj = Context::getRequestVars(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 		$obj->module_srl = $this->module_srl; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 		$obj->commentStatus = $obj->comment_status; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		settype($obj->title, "string"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 		//setup dpcument title tp 'Untitled' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 		if($obj->title == '') $obj->title = 'Untitled'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 		// unset document style if the user is not the document manager | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		if(!$this->grant->manager) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 			unset($obj->title_color); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 			unset($obj->title_bold); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		// generate document module model object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		$oDocumentModel = getModel('document'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 		// generate document module의 controller object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 		$oDocumentController = getController('document'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		// check if the document is existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 		// update the document if it is existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 		$is_update = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 			$is_update = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 		// if use anonymous is true | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 		if($this->module_info->use_anonymous == 'Y') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 			$this->module_info->admin_mail = ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 			$obj->notify_message = 'N'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 			if($is_update===false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 				$obj->member_srl = -1*$logged_info->member_srl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			$obj->email_address = $obj->homepage = $obj->user_id = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 			$obj->user_name = $obj->nick_name = 'anonymous'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 			$bAnonymous = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 			if($is_update===false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 				$oDocument->add('member_srl', $obj->member_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 			$bAnonymous = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 		if($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 			$use_status = explode('|@|', $this->module_info->use_status); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 			if(!is_array($use_status) || !in_array('SECRET', $use_status)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 				unset($obj->is_secret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 				$obj->status = 'PUBLIC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 		// update the document if it is existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 		if($is_update) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 			if(!$oDocument->isGranted()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 				return new Object(-1,'msg_not_permitted'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 			if($this->module_info->use_anonymous == 'Y') { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 				$obj->member_srl = abs($oDocument->get('member_srl')) * -1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 				$oDocument->add('member_srl', $obj->member_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 115 |  | View Code Duplication | 			if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 				return new Object(-1,'msg_protect_content'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 			if(!$this->grant->manager) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 				// notice & document style same as before if not manager | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 				$obj->is_notice = $oDocument->get('is_notice'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 				$obj->title_color = $oDocument->get('title_color'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 				$obj->title_bold = $oDocument->get('title_bold'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 			 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 			// modify list_order if document status is temp | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 			if($oDocument->get('status') == 'TEMP') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 				$obj->last_update = $obj->regdate = date('YmdHis'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 				$obj->update_order = $obj->list_order = (getNextSequence() * -1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 			$output = $oDocumentController->updateDocument($oDocument, $obj, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 			$msg_code = 'success_updated'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 		// insert a new document otherwise | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 			$output = $oDocumentController->insertDocument($obj, $bAnonymous); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 			$msg_code = 'success_registed'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 			$obj->document_srl = $output->get('document_srl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 			// send an email to admin user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 			if($output->toBool() && $this->module_info->admin_mail) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 				$oMail = new Mail(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 				$oMail->setTitle($obj->title); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 				$oMail->setContent( sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('','document_srl',$obj->document_srl), getFullUrl('','document_srl',$obj->document_srl), $obj->content)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 				$oMail->setSender($obj->user_name, $obj->email_address); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 				$target_mail = explode(',',$this->module_info->admin_mail); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 153 |  | View Code Duplication | 				for($i=0;$i<count($target_mail);$i++) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 					$email_address = trim($target_mail[$i]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 					if(!$email_address) continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 					$oMail->setReceiptor($email_address, $email_address); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 					$oMail->send(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 		// if there is an error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 		if(!$output->toBool()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 			return $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		// return the results | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 		$this->add('mid', Context::get('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 		$this->add('document_srl', $output->get('document_srl')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 		// alert a message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 		if(Context::get('xeVirtualRequestMethod') !== 'xml') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 			$this->setMessage($msg_code); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 	 * @brief delete the document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 	function procBoardDeleteDocument() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 		// get the document_srl | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 		$document_srl = Context::get('document_srl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 		// if the document is not existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 		if(!$document_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 			return $this->doError('msg_invalid_document'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 		$oDocumentModel = &getModel('document'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 		$oDocument = $oDocumentModel->getDocument($document_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 		// check protect content | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 197 |  | View Code Duplication | 		if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 			return new Object(-1, 'msg_protect_content'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 		// generate document module controller object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 		$oDocumentController = getController('document'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 		// delete the document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 		$output = $oDocumentController->deleteDocument($document_srl, $this->grant->manager); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 		if(!$output->toBool()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 			return $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 		// alert an message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 		$this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '', 'page', Context::get('page'), 'document_srl', '')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 		$this->add('mid', Context::get('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 		$this->add('page', Context::get('page')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 		if(Context::get('xeVirtualRequestMethod') !== 'xml') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 			$this->setMessage('success_deleted'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 	 * @brief vote | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 	function procBoardVoteDocument() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 		// generate document module controller object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 		$oDocumentController = getController('document'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 		$document_srl = Context::get('document_srl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 		return $oDocumentController->updateVotedCount($document_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 	 * @brief insert comments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 	function procBoardInsertComment() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 		// check grant | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 		if(!$this->grant->write_comment) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 			return new Object(-1, 'msg_not_permitted'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 		$logged_info = Context::get('logged_info'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 		// get the relevant data for inserting comment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 		$obj = Context::getRequestVars(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 		$obj->module_srl = $this->module_srl; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 		if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 		if(!is_array($this->module_info->use_status)) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 			$this->module_info->use_status = explode('|@|', $this->module_info->use_status); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 		if(in_array('SECRET', $this->module_info->use_status)) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | 			$this->module_info->secret = 'Y'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  | 			unset($obj->is_secret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 			$this->module_info->secret = 'N'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 		// check if the doument is existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 		$oDocumentModel = getModel('document'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 		$oDocument = $oDocumentModel->getDocument($obj->document_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 		if(!$oDocument->isExists()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 			return new Object(-1,'msg_not_founded'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  | 		// For anonymous use, remove writer's information and notifying information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  | 		if($this->module_info->use_anonymous == 'Y') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  | 			$this->module_info->admin_mail = ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  | 			$obj->notify_message = 'N'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  | 			$obj->member_srl = -1*$logged_info->member_srl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 			$obj->email_address = $obj->homepage = $obj->user_id = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  | 			$obj->user_name = $obj->nick_name = 'anonymous'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  | 			$bAnonymous = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  | 			$bAnonymous = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  | 		// generate comment  module model object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  | 		$oCommentModel = getModel('comment'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  | 		// generate comment module controller object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  | 		$oCommentController = getController('comment'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  | 		// check the comment is existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  | 		// if the comment is not existed, then generate a new sequence | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  | 		if(!$obj->comment_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  | 			$obj->comment_srl = getNextSequence(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  | 			$comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  | 		// if comment_srl is not existed, then insert the comment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  | 		if($comment->comment_srl != $obj->comment_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  | 			// parent_srl is existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  | 			if($obj->parent_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  | 				$parent_comment = $oCommentModel->getComment($obj->parent_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  | 				if(!$parent_comment->comment_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  | 					return new Object(-1, 'msg_invalid_request'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  | 				$output = $oCommentController->insertComment($obj, $bAnonymous); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  | 			// parent_srl is not existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  | 				$output = $oCommentController->insertComment($obj, $bAnonymous); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  | 		// update the comment if it is not existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  | 			// check the grant | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  | 			if(!$comment->isGranted()) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  | 				return new Object(-1,'msg_not_permitted'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  | 			$obj->parent_srl = $comment->parent_srl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  | 			$output = $oCommentController->updateComment($obj, $this->grant->manager); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  | 			$comment_srl = $obj->comment_srl; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  | 		if(!$output->toBool()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  | 			return $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  | 		if(Context::get('xeVirtualRequestMethod') !== 'xml') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  | 			$this->setMessage('success_registed'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  | 		$this->add('mid', Context::get('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  | 		$this->add('document_srl', $obj->document_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  | 		$this->add('comment_srl', $obj->comment_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  | 	 * @brief delete the comment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 353 |  | View Code Duplication | 	function procBoardDeleteComment() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  | 		// get the comment_srl | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  | 		$comment_srl = Context::get('comment_srl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  | 		if(!$comment_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  | 			return $this->doError('msg_invalid_request'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  | 		// generate comment  controller object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  | 		$oCommentController = getController('comment'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  | 		$output = $oCommentController->deleteComment($comment_srl, $this->grant->manager); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  | 		if(!$output->toBool()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  | 			return $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  | 		$this->add('mid', Context::get('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  | 		$this->add('page', Context::get('page')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  | 		$this->add('document_srl', $output->get('document_srl')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  | 		if(Context::get('xeVirtualRequestMethod') !== 'xml') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  | 			$this->setMessage('success_deleted'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  | 	 * @brief delete the tracjback | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 382 |  |  | 	 **/ | 
            
                                                                        
                            
            
                                                                    
                                                                                                        
            
            
                | 383 |  | View Code Duplication | 	function procBoardDeleteTrackback() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 384 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 385 |  |  | 		$trackback_srl = Context::get('trackback_srl'); | 
            
                                                                        
                            
            
                                    
            
            
                | 386 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 387 |  |  | 		// generate trackback module controller object | 
            
                                                                        
                            
            
                                    
            
            
                | 388 |  |  | 		$oTrackbackController = getController('trackback'); | 
            
                                                                        
                            
            
                                    
            
            
                | 389 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 390 |  |  | 		if(!$oTrackbackController) return; | 
            
                                                                        
                            
            
                                    
            
            
                | 391 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 392 |  |  | 		$output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 393 |  |  | 		if(!$output->toBool()) | 
            
                                                                        
                            
            
                                    
            
            
                | 394 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 395 |  |  | 			return $output; | 
            
                                                                        
                            
            
                                    
            
            
                | 396 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 397 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 398 |  |  | 		$this->add('mid', Context::get('mid')); | 
            
                                                                        
                            
            
                                    
            
            
                | 399 |  |  | 		$this->add('page', Context::get('page')); | 
            
                                                                        
                            
            
                                    
            
            
                | 400 |  |  | 		$this->add('document_srl', $output->get('document_srl')); | 
            
                                                                        
                            
            
                                    
            
            
                | 401 |  |  | 		if(Context::get('xeVirtualRequestMethod') !== 'xml') | 
            
                                                                        
                            
            
                                    
            
            
                | 402 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 403 |  |  | 			$this->setMessage('success_deleted'); | 
            
                                                                        
                            
            
                                    
            
            
                | 404 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 405 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  | 	 * @brief check the password for document and comment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  | 	function procBoardVerificationPassword() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  | 		// get the id number of the document and the comment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  | 		$password = Context::get('password'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  | 		$document_srl = Context::get('document_srl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  | 		$comment_srl = Context::get('comment_srl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  | 		$oMemberModel = getModel('member'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  | 		// if the comment exists | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  | 		if($comment_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  | 			// get the comment information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  | 			$oCommentModel = getModel('comment'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  | 			$oComment = $oCommentModel->getComment($comment_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  | 			if(!$oComment->isExists()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  | 				return new Object(-1, 'msg_invalid_request'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  | 			// compare the comment password and the user input password | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  | 			if(!$oMemberModel->isValidPassword($oComment->get('password'),$password)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  | 				return new Object(-1, 'msg_invalid_password'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  | 			$oComment->setGrant(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  | 			 // get the document information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  | 			$oDocumentModel = getModel('document'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  | 			$oDocument = $oDocumentModel->getDocument($document_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  | 			if(!$oDocument->isExists()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  | 				return new Object(-1, 'msg_invalid_request'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  | 			// compare the document password and the user input password | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  | 			if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  | 				return new Object(-1, 'msg_invalid_password'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  | 			$oDocument->setGrant(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  | 	 * @brief the trigger for displaying 'view document' link when click the user ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  | 	 **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  | 	function triggerMemberMenu(&$obj) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  | 		$member_srl = Context::get('target_srl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  | 		$mid = Context::get('cur_mid'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  | 		if(!$member_srl || !$mid) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  | 			return new Object(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  | 		$logged_info = Context::get('logged_info'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  | 		// get the module information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  | 		$oModuleModel = getModel('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  | 		$columnList = array('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  | 		$cur_module_info = $oModuleModel->getModuleInfoByMid($mid, 0, $columnList); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  | 		if($cur_module_info->module != 'board') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  | 			return new Object(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  | 		// get the member information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  | 		if($member_srl == $logged_info->member_srl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  | 			$member_info = $logged_info; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  | 			$oMemberModel = getModel('member'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  | 			$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  | 		if(!$member_info->user_id) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  | 			return new Object(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  | 		//search | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  | 		$url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  | 		$oMemberController = getController('member'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  | 		$oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  | 		return new Object(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 502 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 503 |  |  |  | 
            
                        
This check looks for access to properties that are not accessible from the current context.
If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.