public function Insert()
 {
     $_POST['comment_time'] = time();
     $_POST['comment_status'] = 1;
     $_POST['comment_ip'] = _ipi();
     $id = $this->model->Create($_POST);
     Redirect(UR_MP . 'Comment/Index');
 }
Esempio n. 2
0
 /**
  * Discount user view
  * @return boolean
  */
 public function Discount()
 {
     // if is visited count
     $rs = $this->db->Select('SELECT statistic_id FROM %table% WHERE statistic_ip = ' . _ipi() . ' AND statistic_last_visit > ' . (time() - VISIT_LONG), array('statistic'));
     if (is_array($rs) && count($rs) > 0) {
         $this->db->Select('UPDATE %table%  SET statistic_visit = statistic_visit - 1' . ', statistic_last_visit = ' . time() . ' WHERE statistic_id = ' . $rs[0]['statistic_id'], array('statistic'));
     }
     return TRUE;
 }
Esempio n. 3
0
 /**
  * @todo log try
  * @param int $type type of try
  * @return bool
  */
 public function Log($type = 0)
 {
     // pre hook
     _hk('P' . ':' . __CLASS__ . ':' . __FUNCTION__, $this, $type);
     // make value
     $data = array('type' => 'iii', 'trylog_type' => $type, 'trylog_ip' => _ipi(), 'trylog_time' => time());
     // send to insert in regiery
     return $this->db->Insert('trylog', $data);
 }
Esempio n. 4
0
             $result['success'] = $r->Remove($_COOKIE['mid'], $clean['id'], REALTION_FRIEND);
             $result['value'] = 'افزودن با موفقیت انجام نشد';
             echo json_encode($result);
             die;
         }
     }
     $result['success'] = false;
     $result['value'] = 'اعتبار حساب کاربری شما برای لایک خدشه دار است.';
     echo json_encode($result);
     break;
 case 'comment':
     if (isset($_COOKIE['mid'])) {
         $valid = array('comment_parent', 'comment_text', 'comment_topic_id');
         $edit = promis($clean, $valid);
         $m = new TModel('comment', 'comment_');
         $data = array('comment_parent' => $clean['comment_parent'], 'comment_text' => $clean['comment_text'], 'comment_topic_id' => $clean['comment_topic_id'], 'comment_member_id' => $_COOKIE['mid'], 'comment_time' => time(), 'comment_ip' => _ipi());
         $tmp = $m->Create($data);
         if (isset($clean['ajax'])) {
             $result['success'] = $tmp != false ? true : false;
             echo json_encode($result);
             die;
         } else {
             GoBack();
         }
     } else {
         $result['value'] = 'شما بایستی وارده شده باشید';
         echo json_encode($result);
         die;
     }
     break;
 default: