コード例 #1
0
ファイル: BitForumTopic.php プロジェクト: bitweaver/forums
 /**
  * Any method named Store inherently implies data will be written to the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  * This is the ONLY method that should be called in order to store( create or update )an bitforum!
  * It is very smart and will figure out what to do for you. It should be considered a black box.
  *
  * @param array pParams hash of values that will be used to store the page
  *
  * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why
  *
  * @access public
  **/
 function store(&$pParamHash)
 {
     $this->mDb->StartTrans();
     if ($this->verify($pParamHash) && LibertyAttachable::store($pParamHash)) {
         $table = BIT_DB_PREFIX . "bitforums_topics";
         if ($this->mBitForumTopicId) {
             $result = $this->mDb->associateUpdate($table, $pParamHash['topic_store'], array("bitforum_topic_id" => $pParamHash['bitforum_topic_id']));
         } else {
             $pParamHash['topic_store']['content_id'] = $pParamHash['content_id'];
             if (@$this->verifyId($pParamHash['bitforum_id'])) {
                 // if pParamHash['bitforum_id'] is set, some is requesting a particular bitforum_id. Use with caution!
                 $pParamHash['topic_store']['bitforum_topic_id'] = $pParamHash['bitforum_id'];
             } else {
                 $pParamHash['topic_store']['bitforum_topic_id'] = $this->mDb->GenID('bitforums_topic_id_seq');
             }
             $this->mBitForumTopicId = $pParamHash['topic_store']['bitforum_topic_id'];
             $result = $this->mDb->associateInsert($table, $pParamHash['topic_store']);
         }
     }
     $this->mDb->CompleteTrans();
     return count($this->mErrors) == 0;
 }
コード例 #2
0
ファイル: YellowPages.php プロジェクト: bitweaver/yellowpages
 /**
  * Any method named Store inherently implies data will be written to the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  * This is the ONLY method that should be called in order to store( create or update )an yellowpages!
  * It is very smart and will figure out what to do for you. It should be considered a black box.
  *
  * @param array pParams hash of values that will be used to store the page
  *
  * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why
  *
  * @access public
  **/
 function store(&$pParamHash)
 {
     if ($this->verify($pParamHash) && LibertyAttachable::store($pParamHash)) {
         $table = BIT_DB_PREFIX . "yellowpages";
         $this->mDb->StartTrans();
         if ($this->mYellowPagesId) {
             $locId = array("name" => "yellowpages_id", "value" => $pParamHash['yellowpages_id']);
             $result = $this->mDb->associateUpdate($table, $pParamHash['yellowpages_store'], $locId);
         } else {
             $pParamHash['yellowpages_store']['content_id'] = $pParamHash['content_id'];
             if (isset($pParamHash['yellowpages_id']) && is_numeric($pParamHash['yellowpages_id'])) {
                 // if pParamHash['yellowpages_id'] is set, some is requesting a particular yellowpages_id. Use with caution!
                 $pParamHash['yellowpages_store']['yellowpages_id'] = $pParamHash['yellowpages_id'];
             } else {
                 $pParamHash['yellowpages_store']['yellowpages_id'] = $this->mDb->GenID('yellowpages_yellowpages_id_seq');
             }
             $this->mYellowPagesId = $pParamHash['yellowpages_store']['yellowpages_id'];
             $result = $this->mDb->associateInsert($table, $pParamHash['yellowpages_store']);
         }
         $this->mDb->CompleteTrans();
         $this->load();
     }
     return count($this->mErrors) == 0;
 }
コード例 #3
0
ファイル: Client.php プロジェクト: bitweaver/warehouse
 /**
  * Store client data
  * @param $pParamHash contains all data to store the contact
  * @param $pParamHash[title] title of the new contact
  * @param $pParamHash[edit] description of the contact
  * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why
  **/
 function store(&$pParamHash)
 {
     if ($this->verify($pParamHash)) {
         // Start a transaction wrapping the whole insert into liberty
         $this->mDb->StartTrans();
         if (LibertyAttachable::store($pParamHash)) {
             $table = BIT_DB_PREFIX . "warehouse_client";
             // mContentId will not be set until the secondary data has commited
             if ($this->verifyId($this->mClientId)) {
                 if (!empty($pParamHash['client_store'])) {
                     $result = $this->mDb->associateUpdate($table, $pParamHash['client_store'], array("content_id" => $this->mContentId));
                 }
             } else {
                 $pParamHash['client_store']['content_id'] = $pParamHash['content_id'];
                 $pParamHash['client_store']['contact_id'] = $pParamHash['content_id'];
                 if (isset($pParamHash['contact_id']) && is_numeric($pParamHash['contact_id'])) {
                     $pParamHash['client_store']['contact_id'] = $pParamHash['contact_id'];
                 } else {
                     $pParamHash['client_store']['contact_id'] = $this->mDb->GenID('contact_id_seq');
                 }
                 $pParamHash['client_store']['parent_id'] = $pParamHash['client_store']['content_id'];
                 $this->mClientId = $pParamHash['client_store']['content_id'];
                 $this->mParentId = $pParamHash['client_store']['parent_id'];
                 $this->mContentId = $pParamHash['content_id'];
                 $result = $this->mDb->associateInsert($table, $pParamHash['client_store']);
             }
             // load before completing transaction as firebird isolates results
             $this->load();
             $this->mDb->CompleteTrans();
         } else {
             $this->mDb->RollbackTrans();
             $this->mErrors['store'] = 'Failed to store this contact.';
         }
     }
     return count($this->mErrors) == 0;
 }
コード例 #4
0
ファイル: BitSiteHome.php プロジェクト: bitweaver/sitehome
 /**
  * Any method named Store inherently implies data will be written to the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  * This is the ONLY method that should be called in order to store( create or update )an sitehome!
  * It is very smart and will figure out what to do for you. It should be considered a black box.
  *
  * @param array pParams hash of values that will be used to store the page
  *
  * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why
  *
  * @access public
  **/
 function store(&$pParamHash)
 {
     if ($this->verify($pParamHash) && LibertyAttachable::store($pParamHash)) {
         $table = BIT_DB_PREFIX . "sitehomes";
         $this->mDb->StartTrans();
         if ($this->mSiteHomeId) {
             $locId = array("sitehome_id" => $pParamHash['sitehome_id']);
             $result = $this->mDb->associateUpdate($table, $pParamHash['sitehome_store'], $locId);
         } else {
             $pParamHash['sitehome_store']['content_id'] = $pParamHash['content_id'];
             if (@$this->verifyId($pParamHash['sitehome_id'])) {
                 // if pParamHash['sitehome_id'] is set, some is requesting a particular sitehome_id. Use with caution!
                 $pParamHash['sitehome_store']['sitehome_id'] = $pParamHash['sitehome_id'];
             } else {
                 $pParamHash['sitehome_store']['sitehome_id'] = $this->mDb->GenID('sitehomes_sitehome_id_seq');
             }
             $this->mSiteHomeId = $pParamHash['sitehome_store']['sitehome_id'];
             $result = $this->mDb->associateInsert($table, $pParamHash['sitehome_store']);
         }
         $this->mDb->CompleteTrans();
         $this->load();
     }
     return count($this->mErrors) == 0;
 }