Ejemplo n.º 1
0
 public function paste()
 {
     $group = reset($this->group);
     if (DB::GetOne('SELECT 1 FROM utils_attachment_local WHERE attachment=%d AND local=%s', array($_SESSION['attachment_copy']['id'], $group))) {
         return;
     }
     if (isset($_SESSION['attachment_cut']) && $_SESSION['attachment_cut']) {
         $source_group = reset($_SESSION['attachment_copy']['group']);
         DB::Execute('UPDATE utils_attachment_local SET local=%s,func=%s,args=%s WHERE attachment=%d AND local=%s', array($group, serialize($this->func), serialize($this->args), $_SESSION['attachment_copy']['id'], $source_group));
         Utils_AttachmentCommon::new_watchdog_event($group, '+', $_SESSION['attachment_copy']['id']);
         Utils_AttachmentCommon::new_watchdog_event($source_group, '-', $_SESSION['attachment_copy']['id']);
         unset($_SESSION['attachment_cut']);
         unset($_SESSION['attachment_copy']);
     } else {
         DB::Execute('INSERT INTO utils_attachment_local(local,attachment,func,args) VALUES(%s,%d,%s,%s)', array($group, $_SESSION['attachment_copy']['id'], serialize($this->func), serialize($this->args)));
         Utils_AttachmentCommon::new_watchdog_event($group, '+', $_SESSION['attachment_copy']['id']);
     }
 }