Exemplo n.º 1
0
 function insert($data, &$message)
 {
     if (!$this->findError($data, $message)) {
         return false;
     }
     parent::insert($data);
     return true;
 }
Exemplo n.º 2
0
 function insert($data)
 {
     if (has_unsafeword($data['prt_tmpl_title'])) {
         trigger_error('无法保存,标题含有非法字符', E_USER_ERROR);
     }
     $sql = 'select prt_tmpl_id from sdb_print_tmpl where prt_tmpl_title="' . $this->db->quote($data['prt_tmpl_title']) . '"';
     if ($this->db->selectrow($sql)) {
         trigger_error('无法保存,存在同名模板', E_USER_ERROR);
     }
     return parent::insert($data);
 }
Exemplo n.º 3
0
 function insert($data)
 {
     $role_id = parent::insert($data);
     if ($role_id && is_array($data['actions'])) {
         $sql = 'INSERT INTO `sdb_lnk_acts` (`role_id`,`action_id`) VALUES ';
         foreach ($data['actions'] as $action_id) {
             $actions[] = "({$role_id},{$action_id})";
         }
         $sql .= implode($actions, ',') . ';';
         $a = $this->db->exec($sql);
     }
     return $role_id;
 }
Exemplo n.º 4
0
 function insert($data)
 {
     $tags = $data['tags'];
     unset($data['tags']);
     if ($imgId = parent::insert($data)) {
         $tag =& $this->system->loadModel('system/tag');
         foreach ($tags as $t) {
             if ($tagid = $tag->tagId($t, 'image')) {
                 $tagList[] = $tagid;
                 $this->db->exec('insert into sdb_tag_rel (tag_id,rel_id) values (' . $tagid . ',' . $imgId . ')');
             }
         }
         $tag->recount($tagList);
         return $imgId;
     } else {
         return false;
     }
 }
Exemplo n.º 5
0
 function insert($data)
 {
     $data['userpass'] = md5(trim($data['userpass']));
     $op_id = parent::insert($data);
     if ($op_id && is_array($data['roles'])) {
         $sql = 'INSERT INTO `sdb_lnk_roles` (`op_id`,`role_id`) VALUES ';
         foreach ($data['roles'] as $role_id) {
             $roles[] = "({$op_id},{$role_id})";
         }
         $sql .= implode($roles, ',') . ';';
         $a = $this->db->exec($sql);
     }
     return $op_id;
 }