Source for file rainTail.php

Documentation is available at rainTail.php

  1. <?
  2.  
  3. /**  
  4.  * °Ô½ÃÆÇ µ¡±Û °ü¸®
  5.  * @package com.rain
  6.  * @version 1.0
  7.  * @author http://cafen.net (outmind@cafen.net)
  8. */
  9. class rainTail {
  10.  
  11.     /**  
  12.      * ´ë»ó °Ô½ÃÆÇ ¾ÆÀ̵ð
  13.      *
  14.      * @var String 
  15.     */
  16.     var $board_id = null;
  17.  
  18.     /**  
  19.      * ´ë»ó ±Û °íÀ¯¹øÈ£
  20.      *
  21.      * @var Int 
  22.     */
  23.     var $muid = 0;
  24.  
  25.     /**  
  26.      * ±âº» Äõ¸®
  27.      *
  28.      * @var String 
  29.     */
  30.     var $base_query = "";
  31.  
  32.     /**  
  33.      * Mysql ÀÛ¾÷ Class
  34.      *
  35.      * @var rainMysql 
  36.     */
  37.     var $db_class = null;
  38.  
  39.     /**  
  40.      * ¸¶Áö¸· ¿À·ù ¸Þ¼¼Áö
  41.      *
  42.      * @var String 
  43.     */
  44.     var $error_msg = "";
  45.     
  46.     /**  
  47.      * »ý¼ºÀÚ
  48.      *
  49.      * @param  String  °Ô½ÃÆÇ ¾ÆÀ̵ð
  50.      * @param  Int  ±Û °íÀ¯¹øÈ£
  51.     */
  52.     function rainTail($board_id$muid{
  53.         $this->board_id = $board_id;
  54.         $this->muid = $muid;
  55.         $this->base_query = "select * from multi_board_tail where board_id = '" $this->board_id . "' and muid = '" $this->muid . "' ";
  56.         $this->db_class = new rainMysql("mysql");
  57.     }
  58.  
  59.     /**  
  60.      * ¸ñ·Ï °¡Á®¿À±â
  61.      *
  62.      * @param  Int  ½ÃÀÛ ½ÃÁ¡
  63.      * @param  rainRequest rainRequest°´Ã¼(¹Ì»ç¿ë - ÃßÈÄ »ç¿ë¿¹Á¤)
  64.      * @param  Int  °¡Á®¿Ã °´¼ö
  65.      * @return  rainData 
  66.     */
  67.     function getList($cline$req$getnum{
  68.         $qm $this->base_query . " order by tuid ";
  69.         return $this->db_class->query2Array($qm$cline$getnum);
  70.     }
  71.     
  72.     /**  
  73.      * URL °¡Á®¿À±â
  74.      *
  75.      * @param  String  °ü·Ã ¸ðµå(list : µ¡±Û ¸ñ·Ï, view : µ¡±Û ³»¿ë)
  76.      * @param  rainBoard rainRequest°´Ã¼
  77.      * @return  String URL
  78.     */
  79.     function getUrl($mode$board_class{
  80.         if ($mode == "list")
  81.             return $board_class->getConf("url_view""?board_id=" $this->board_id . "&muid=" $this->muid;
  82.         else
  83.             return $board_class->getConf("url_tail""?board_id="  $this->board_id . "&muid=" $this->muid;
  84.     }
  85.  
  86.     /**  
  87.      * Æ¯Á¤µ¡±Û °¡Á®¿À±â
  88.      *
  89.      * @param  Int  µ¡±Û °íÀ¯¹øÈ£
  90.      * @return  rainData 
  91.     */
  92.     function getView($tailuid{
  93.         $qm $this->base_query . " and  tailuid = '" $tailuid "' "
  94.         return $this->db_class->queryFetch($qm);
  95.     }
  96.  
  97.     /**  
  98.      * µ¡±Û ÀÔ·Â
  99.      *
  100.      * @param  rainRequest  ÀÔ·ÂÇÒ ³»¿ë
  101.      * @param  Int  µ¡±Û ´ä±ÛÀÇ °æ¿ì ÇØ´ç µ¡±ÛÀÇ °íÀ¯¹øÈ£
  102.      * @return  Boolean ¼º°ø¿©ºÎ
  103.     */
  104.     function insertData($data$reply_tailuid 0{
  105.         if (!rainUtil::chkAuth($data->get("authcode"))) {
  106.             $this->error_msg = "ÀÎÁõÄڵ尡 ´Þ¶ó¼­ Ã³¸® ÇÒ¼ö ¾ø½À´Ï´Ù <br><br>¹Ù¸¥ÀÎÁõÄÚµå(<u>" rainUtil::getPassCode(."</u>) ";
  107.             return false;
  108.         }
  109.         $tailuid $this->db_class->getLastID("multi_board_tail""tailuid");
  110.         $tuid 1;
  111.         $tail_dep 0;
  112.         if ($reply_tailuid {
  113.             $old_tailinfo $this->db_class->queryFetch("select tuid, tail_dep from multi_board_tail where tailuid = '" $reply_tailuid "' ");
  114.             if ($old_tailinfo->first()) 
  115.                 $tuid $old_tailinfo->getInt("tuid"1;
  116.                 $tail_dep $old_tailinfo->getInt("tail_dep"1;
  117.                 $this->db_class->change("update multi_board_tail set tuid = tuid + 1 where board_id muid = ".$this->muid." and tuid >= '".$tuid."' ")
  118.             }
  119.         else {
  120.             $tuid_str $this->db_class->queryOne("select max(tuid)+1 as tuid from multi_board_tail where muid = ".$this->muid." ");
  121.             if ($tuid_str == ''
  122.                 $tuid 1;
  123.             else
  124.                 $tuid intval($tuid_str);
  125.             $tail_dep 0;
  126.         }
  127.         $qm ""
  128.             .  "insert into multi_board_tail ( "
  129.             .  " tailuid , "
  130.             .  " tail_dep , "
  131.             .  " tuid , "
  132.             .  " board_id , "
  133.             .  " muid , "
  134.             .  " user_pw , "
  135.             .  " user_nm , "
  136.             .  " user_id , "
  137.             .  " user_email , "
  138.             .  " user_ip , "
  139.             .  " emotion , "
  140.             .  " contents , "
  141.             .  " regdate  "
  142.             .  " ) values ( "
  143.             .  " '".  $tailuid "' , "
  144.             .  " '".  $tail_dep "' , "
  145.             .  " '".  $tuid "' , "
  146.             .  " '".  $this->board_id . "' , "
  147.             .  " '".  $this->muid . "' , "
  148.             .  " '".  $data->get("user_pw""' , "
  149.             .  " '".  $data->getName($data->get("user_nm")) "' , "
  150.             .  " '".  $data->getID("' , "
  151.             .  " '".  $data->getEmail($data->get("user_email")) "' , "
  152.             .  " '".  $data->getIP("' , "
  153.             .  " '".  $data->get("emotion""' , "
  154.             .  " '".  rainUtil::htmlSpecialchars($data->get("contents")) "' , "
  155.             .  " '".  $data->getNow("'  "
  156.             .  ") ";
  157.         $this->db_class->change($qm);    
  158.         $this->synkData();
  159.         return true;
  160.     }
  161.     
  162.     /**  
  163.      * µ¡±Û »èÁ¦
  164.      *
  165.      * @param  Int  µ¡±Û °íÀ¯¹øÈ£
  166.      * @param  String  °ü¸® ºñ¹Ð¹øÈ£
  167.      * @return  Boolean ¼º°ø¿©ºÎ
  168.     */
  169.     function deleteData($tailuid$passwd{
  170.         if ($this->checkPass($tailuid,$passwd)) {
  171.             $this->db_class->change("delete from multi_board_tail where board_id = '" $this->board_id . "' and muid = '" $this->muid . "' and tailuid = " $tailuid " ");
  172.             $this->synkData();
  173.             return true;
  174.         else {
  175.             $this->error_msg = "ÇØ´ç ±ÛÀÇ Á¢±Ù ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.";
  176.             return false;
  177.         }
  178.     }
  179.  
  180.     /**  
  181.      * °Ô½Ã±Û¿¡ µ¡±Û ¼ýÀÚ ½ÌÅ©
  182.     */
  183.     function synkData({
  184.         $tail_result $this->db_class->queryFetch("select count(*) as tail, max(regdate) as tail_date from multi_board_tail where board_id = '" $this->board_id . "' and muid = '" $this->muid . "' ");
  185.         if ($tail_result->first()) {
  186.             $qm "update multi_board set tail ='" $tail_result->getString("tail""',  tail_date = '" $tail_result->getString("tail_date""' where board_id = '" $this->board_id . "' and muid = '" $this->muid . "' ";
  187.             $this->db_class->change($qm);
  188.         }
  189.     }
  190.  
  191.     /**  
  192.      * ÇØ´ç ±Û¿¡ ÇØ´ç Çϴ ¸ðµç µ¡±Û »èÁ¦
  193.     */
  194.     function deleteAllData({
  195.         $this->db_class->change("delete from multi_board_tail where board_id = '"$this->board_id . "' and muid = '" $this->muid . "' ");
  196.     }
  197.  
  198.     /**  
  199.      * Á¢±Ù ±ÇÇÑ È®ÀÎ
  200.      *
  201.      * @param  Int µ¡±Û °íÀ¯¹øÈ£
  202.      * @param  String °ü¸®¾ÏÈ£
  203.      * @return  Boolean Á¢±Ù °¡´É¿©ºÎ
  204.     */
  205.     function checkPass($tailuid$passwd{
  206.         $result $this->getView($tailuid);
  207.         if ($result->first()) {
  208.             $old_passwd $result->getString("user_pw");
  209.             $user_id $result->getString("user_id");
  210.             if (rainUtil::chkUser($user_id|| rainUtil::chkPass($old_passwd$passwd))
  211.                 return true;
  212.             else
  213.                 return false;
  214.         else
  215.             return false;
  216.     }
  217.     
  218. }
  219.  
  220.  
  221. ?>

Documentation generated on Mon, 17 Mar 2008 12:17:54 +0900 by phpDocumentor 1.4.0a2 | Copyright 2005 cafen.net