コード例 #1
0
 /**
  * Обработка отправки формы при редактировании страницы
  *
  * @param unknown_type $oPageEdit
  */
 protected function EventPagesEditSubmit($oPageEdit)
 {
     $this->Security_ValidateSendForm();
     // * Проверяем корректность полей
     if (!$this->EventPagesCheckFields()) {
         return;
     }
     if ($oPageEdit->getId() == getRequest('page_pid')) {
         $this->_messageError($this->Lang_Get('system_error'), 'page:edit');
         return;
     }
     // * Обновляем свойства страницы
     $oPageEdit->setAutoBr(getRequest('page_auto_br') ? 1 : 0);
     $oPageEdit->setActive(getRequest('page_active') ? 1 : 0);
     $oPageEdit->setMain(getRequest('page_main') ? 1 : 0);
     $oPageEdit->setDateEdit(date("Y-m-d H:i:s"));
     if (getRequest('page_pid') == 0) {
         $oPageEdit->setUrlFull(getRequest('page_url'));
         $oPageEdit->setPid(null);
     } else {
         $oPageEdit->setPid(getRequest('page_pid'));
         $oPageParent = $this->PluginPage_Page_GetPageById(getRequest('page_pid'));
         $oPageEdit->setUrlFull($oPageParent->getUrlFull() . '/' . getRequest('page_url'));
     }
     $oPageEdit->setSeoDescription(getRequest('page_seo_description'));
     $oPageEdit->setSeoKeywords(getRequest('page_seo_keywords'));
     $oPageEdit->setText(getRequest('page_text'));
     $oPageEdit->setTitle(getRequest('page_title'));
     $oPageEdit->setUrl(getRequest('page_url'));
     $oPageEdit->setSort(intval(getRequest('page_sort')));
     $oPageEdit->setOtherUrl(getRequest('page_other_url'));
     // * Обновляем страницу
     if ($this->PluginPage_Page_UpdatePage($oPageEdit)) {
         $this->PluginPage_Page_RebuildUrlFull($oPageEdit);
         $this->_messageNotice($this->Lang_Get('page_edit_submit_save_ok'), 'page:edit');
         $this->SetParam(0, null);
         $this->SetParam(1, null);
     } else {
         $this->_messageError($this->Lang_Get('system_error'), 'page:edit');
     }
 }
コード例 #2
0
ファイル: Server.php プロジェクト: fire1/web-socket
 /**
  * Start a child process for pushing data
  * @param unknown_type $client
  */
 private function startProcess($client)
 {
     $this->console("Start a client process");
     $pid = pcntl_fork();
     if ($pid == -1) {
         die('could not fork');
     } elseif ($pid) {
         // process
         $client->setPid($pid);
     } else {
         // we are the child
         while (true) {
             // check if the client is connected
             if (!$client->isConnected()) {
                 break;
             }
             // push something to the client
             $seconds = rand(2, 5);
             $this->send($client, "I am waiting {$seconds} seconds");
             sleep($seconds);
         }
     }
 }
コード例 #3
0
 /**
  * Обработка отправки формы при редактировании страницы
  *
  * @param unknown_type $oPageEdit
  */
 protected function SubmitEditPage($oPageEdit)
 {
     /**
      * Проверяем корректность полей
      */
     if (!$this->CheckPageFields()) {
         return;
     }
     if ($oPageEdit->getId() == getRequest('page_pid')) {
         $this->Message_AddError($this->Lang_Get('system_error'));
         return;
     }
     /**
      * Обновляем свойства страницы
      */
     $oPageEdit->setActive(getRequest('page_active') ? 1 : 0);
     $oPageEdit->setAutoBr(getRequest('page_auto_br') ? 1 : 0);
     $oPageEdit->setMain(getRequest('page_main') ? 1 : 0);
     $oPageEdit->setDateEdit(date("Y-m-d H:i:s"));
     if (getRequest('page_pid') == 0) {
         $oPageEdit->setUrlFull(getRequest('page_url'));
         $oPageEdit->setPid(null);
     } else {
         $oPageEdit->setPid(getRequest('page_pid'));
         $oPageParent = $this->PluginPage_Page_GetPageById(getRequest('page_pid'));
         $oPageEdit->setUrlFull($oPageParent->getUrlFull() . '/' . getRequest('page_url'));
     }
     $oPageEdit->setSeoDescription(getRequest('page_seo_description'));
     $oPageEdit->setSeoKeywords(getRequest('page_seo_keywords'));
     $oPageEdit->setText(getRequest('page_text'));
     $oPageEdit->setTitle(getRequest('page_title'));
     $oPageEdit->setUrl(getRequest('page_url'));
     $oPageEdit->setSort(getRequest('page_sort'));
     /**
      * Обновляем страницу
      */
     if ($this->PluginPage_Page_UpdatePage($oPageEdit)) {
         $this->PluginPage_Page_RebuildUrlFull($oPageEdit);
         $this->Message_AddNotice($this->Lang_Get('plugin.page.edit_submit_save_ok'));
         $this->SetParam(0, null);
         $this->SetParam(1, null);
     } else {
         $this->Message_AddError($this->Lang_Get('system_error'));
     }
 }
コード例 #4
0
ファイル: Server.php プロジェクト: CalvinJameson/Checkers
 /**
  * Start a child process for pushing data
  * @param unknown_type $client
  */
 private function startProcess($client)
 {
     $this->console("Start a client process");
     $pid = pcntl_fork();
     if ($pid == -1) {
         die('could not fork');
     } elseif ($pid) {
         // process
         $client->setPid($pid);
     } else {
         // we are the child
         while (true) {
             //if the client is broken, exit the child process
             if ($client->exists == false) {
                 break;
             }
             // push something to the client
             $seconds = rand(2, 5);
             //$this->send($client, "I am waiting {$seconds} seconds");
             sleep($seconds);
         }
     }
 }