Ejemplo n.º 1
0
 /**
  * Save attachment meta data
  * 
  * @return integer saved attachment id
  * 
  * @todo implement update case
  */
 public function saveMeta()
 {
     $faqattTableName = sprintf('%sfaqattachment', SQLPREFIX);
     if (null == $this->id) {
         $this->id = $this->db->nextID($faqattTableName, 'id');
         $sql = sprintf("\n                INSERT INTO \n                    %s\n                (id, record_id, record_lang, real_hash, virtual_hash,\n                password_hash, filename, filesize, encrypted, mime_type)\n                    VALUES\n                (%d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s')", $faqattTableName, $this->id, $this->recordId, $this->recordLang, $this->realHash, $this->virtualHash, $this->passwordHash, $this->filename, $this->filesize, $this->encrypted ? 1 : 0, $this->mimeType);
         $result = $this->db->query($sql);
     } else {
         // do update here
     }
     return $this->id;
 }
Ejemplo n.º 2
0
 /**
  * Add new entry into faqlinkverifyrules table
  *
  * @param   string $type
  * @param   string $url
  * @param   string $reason
  * @return  void
  * @access  public
  * @author  Thorsten Rinne <*****@*****.**>
  */
 function addVerifyRule($type = '', $url = '', $reason = '')
 {
     if ($type != '' && $url != '') {
         $query = sprintf("INSERT INTO\n                            %sfaqlinkverifyrules\n                            (id, type, url, reason, enabled, locked, owner, dtInsertDate, dtUpdateDate)\n                        VALUES\n                            (%d, '%s', '%s', '%s', 'y', 'n', '%s', '%s', '%s')", SQLPREFIX, $this->db->nextID(SQLPREFIX . "faqlinkverifyrules", "id"), $this->db->escapeString($type), $this->db->escapeString($url), $this->db->escapeString($reason), $this->db->escapeString($this->user->getLogin()), $this->db->escapeString(date('YmdHis')), $this->db->escapeString(date('YmdHis')));
         $this->db->query($query);
     }
 }