当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPWS_DB::unlockTables方法代码示例

本文整理汇总了PHP中PHPWS_DB::unlockTables方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::unlockTables方法的具体用法?PHP PHPWS_DB::unlockTables怎么用?PHP PHPWS_DB::unlockTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPWS_DB的用法示例。


在下文中一共展示了PHPWS_DB::unlockTables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveUnregistered

 public function saveUnregistered()
 {
     /* @var $peep Signup_Peep Current signup person */
     $peep = $this->peep;
     /* @var $slot Signup_Slot Current slot peep is requesting */
     $slot = $this->slot;
     $db = new PHPWS_DB('signup_peeps');
     $db->addWhere('slot_id', $peep->slot_id);
     // lock carries over to saving of peep.
     $db->setLock('signup_peeps', 'read');
     /**
      * Check peeps table to count the number of registrations for the
      * requested slot
      * (addColumn has "count" indicated)
      */
     $db->addColumn('id', null, null, true);
     $db->addWhere('registered', 1);
     /**
      * @var $filled Number of registered peeps in the slot
      */
     $filled = $db->select('one');
     /**
      * See if the peep previous signed up for this sheet. If multiple is
      * allowed, previous is automatically false
      */
     if ($this->sheet->multiple) {
         $previous = false;
     } else {
         $db->reset();
         $db->addWhere('sheet_id', $peep->sheet_id);
         $db->addWhere('email', $peep->email);
         $db->addColumn('id');
         /* @var $previous integer */
         $previous = $db->select('one');
     }
     if (PHPWS_Error::logIfError($previous)) {
         $this->forwardMessage(dgettext('signup', 'An error occurred when trying to save your application.'), dgettext('signup', 'Sorry'));
         $this->sendMessage();
         return false;
     } elseif ($previous) {
         $this->forwardMessage(dgettext('signup', 'You cannot signup for more than one slot.'), dgettext('signup', 'Sorry'));
         $this->sendMessage();
         return false;
     }
     if ($slot->openings <= $filled) {
         $this->message = dgettext('signup', 'Sorry, the slot you chose is no longer available.');
         return false;
     }
     $peep->registered = 0;
     $peep->hashcheck = md5(rand());
     $peep->timeout = time() + SIGNUP_WINDOW;
     if (PHPWS_Error::logIfError($peep->save())) {
         $db->unlockTables();
         return false;
     } else {
         // success
         $db->unlockTables();
         if (PHPWS_Error::logIfError($this->emailRegistration())) {
             $peep->delete();
             $this->forwardMessage(dgettext('signup', 'There is a problem with our email server. Please try again later.'), dgettext('signup', 'Sorry'));
             $this->sendMessage();
             return false;
         } else {
             return true;
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:67,代码来源:Signup.php


注:本文中的PHPWS_DB::unlockTables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。