Beispiel #1
0
 /**
  * Deletes row from table
  *
  * @return boolean
  * @access private
  */
 function sql_delete($commit = true)
 {
     if ($this->_data_in[$this->id_key]) {
         $db = vivvo_lite_site::get_instance()->get_db();
         $sql = 'DELETE FROM `' . $this->_sql_table . '` WHERE ' . $this->id_key . ' = ' . $db->quote($this->_data_in[$this->id_key], 'integer');
         if (defined('VIVVO_DEBUG_MODE')) {
             echo "<hr/>{$sql}<hr/>\n";
         }
         $sm = vivvo_lite_site::get_instance();
         $sm->debug_push("sql:", $sql->query);
         if ($commit == true || !$db->supports('transactions')) {
             $hook = 'db_' . get_class($this->data_object) . '_delete';
             if (vivvo_hooks_manager::call($hook . '_pre', array(&$this)) !== false) {
                 $res = $db->query($sql);
                 if (is_a($res, 'mdb2_error')) {
                     $sm->debug_push("sql:", $res->getMessage(), 1);
                     return false;
                 }
                 vivvo_hooks_manager::call($hook . '_post', array(&$this));
             } elseif (!vivvo_hooks_manager::get_status()) {
                 return false;
             }
         } else {
             $this->stack[] = $sql;
         }
         /**
          * call on_delete method
          *
          * {@link vivvo_post_object::on_delete}
          */
         if (is_a($this->data_object, 'vivvo_post_object')) {
             $this->data_object->on_delete($this);
         }
         return true;
     }
     $this->metod = 'delete';
     return false;
 }
Beispiel #2
0
 /**
  * Sets object properties from array uses populate from vivvo_framework
  *
  * @param	array	$row
  */
 function populate($row, $dump = NULL)
 {
     $status = parent::populate($row, $dump);
     $this->answer =& new vivvo_poll_answer_list(vivvo_lite_site::get_instance());
     $this->answer->get_answer($this->id);
     return $status;
 }
Beispiel #3
0
 function __destruct()
 {
     parent::__destruct();
 }
Beispiel #4
0
 /**
  * Populate object properties
  *
  * @param	array	$data
  * @param	bool	$dump
  * @return	bool
  */
 public function populate($data, $dump = null)
 {
     if ($status = parent::populate($data, $dump) and $this->user_id) {
         $user = vivvo_lite_site::get_instance()->get_user_manager()->get_user_by_id($this->user_id);
         if ($user) {
             $this->set_author($user->get_name());
             $this->set_www($user->get_www());
             $this->set_email($user->get_email_address());
             $this->author_href = $user->get_href();
             $this->avatar_url = $user->get_picture();
             if ($this->avatar_url and !preg_match('/^[^:\\/\\.\\?]+:/', $this->avatar_url)) {
                 $this->avatar_url = VIVVO_STATIC_URL . 'thumbnail.php?size=avatar&file=' . $this->avatar_url;
             }
         }
     }
     return $status;
 }