예제 #1
0
 static function insert($content, $author, $kind, $upid = null)
 {
     if (is_array($content)) {
         if (!$upid) {
             //在没有upid的情况下自动将第一个content的id作为根节点
             $i = 1;
             foreach ($content as $c) {
                 $values = array($upid, $author, $kind, $c, time(), time(), time());
                 $o = sql_use::insert(self::$data_table, self::$data_columns, $values);
                 if (1 == $i) {
                     $out = $o;
                     $i--;
                 } else {
                     $upid = $out;
                 }
             }
         } else {
             foreach ($content as $c) {
                 $values = array($upid, $author, $kind, $c, time(), time(), time());
                 $out = sql_use::insert(self::$data_table, self::$data_columns, $values);
             }
         }
         return $out;
     } else {
         $values = array($upid, $author, $kind, $content, time(), time(), time());
         return sql_use::insert(self::$data_table, self::$data_columns, $values);
     }
 }
예제 #2
0
 static function insert($value, $kind, $upid = null, $author = null)
 {
     if (!$author) {
         $author = data_use::get_usr('userid');
         if (!$author) {
             die("请登录后重试!");
         }
     }
     if (is_array($value)) {
         foreach ($value as $c) {
             $values = array($upid, $author, $kind, $c, time(), time(), time());
             $out = sql_use::insert(self::$data_table, self::$data_columns, $values);
         }
         return $out;
     } else {
         $values = array($upid, $author, $kind, $value, time(), time(), time());
         return sql_use::insert(self::$data_table, self::$data_columns, $values);
     }
 }
예제 #3
0
 protected function register_in()
 {
     if (!empty($this->columns)) {
         $col = ',' . data_use::format_columns($this->columns);
     }
     if (!empty($this->values)) {
         $val = ',' . data_use::format_values($this->values);
     }
     return sql_use::insert($this->table, "{$this->usr_col},{$this->psw_col}{$col}", "'{$this->usr}','{$this->psw}'{$val}");
 }