예제 #1
0
 public function login($form, Showcase_Content $content)
 {
     $errors = array();
     $pass = false;
     if ($this->getRequest()->isPost()) {
         $login = $this->getRequest()->getPost($form);
         $user = $this->getRequest()->getParam('User');
         if (is_array($login) && count($login)) {
             unset($user->currentChatRoom);
             unset($user->chatroomKey);
             unset($user->alias);
             if (empty($login['alias'])) {
                 $errors['alias'] = 'You must choose a name, alias or nickname to enter this chat';
             } else {
                 $alias = trim($login['alias']);
                 $showId = $content->show->id;
                 $showPostId = !empty($login['cid']) ? $login['cid'] : null;
                 if ($showId == $showPostId) {
                     $portalId = $this->getRequest()->getParam('Portal')->id;
                     $sessionKey = $user->getSessionKey();
                     $stmt = Zend_Registry::get('dbh')->proc('show_login_public');
                     $stmt->bindParam(':alias', $alias, PDO::PARAM_STR);
                     $stmt->bindParam(':show', $showId, PDO::PARAM_INT);
                     $stmt->bindParam(':portal', $portalId, PDO::PARAM_INT);
                     $stmt->bindParam(':session', $sessionKey, PDO::PARAM_STR);
                     try {
                         $stmt->execute();
                         $result = $stmt->fetch(Zend_Db::FETCH_OBJ);
                         $stmt->closeCursor();
                         if ($result) {
                             $user->currentShow = $showId;
                             $user->chatroomKey = $result->show_key;
                             $user->alias = $alias;
                             $content->userLogin($user);
                             $pass = true;
                         }
                     } catch (Zend_Db_Statement_Exception $e) {
                         switch ($stmt->errorCode()) {
                             case 23000:
                                 $errors['unique'] = 'That name already exists, please choose another one';
                                 break;
                             default:
                                 $errors['error'] = 'An unknown error occurred.  Please try again';
                         }
                     }
                 }
             }
         }
     }
     return count($errors) ? $errors : $pass;
 }
예제 #2
0
파일: Content.php 프로젝트: roycocup/Tests
 protected function _getContent($jobId, $contentStatus = 1)
 {
     try {
         $stmt = Zend_Registry::get('dbh')->proc('get_content_by_jobid');
         $stmt->bindParam(':id', $jobId, PDO::PARAM_INT);
         $stmt->bindParam(':status', $contentStatus, PDO::PARAM_INT);
         try {
             $stmt->execute();
             $content = $stmt->fetchall(PDO::FETCH_OBJ);
             $stmt->closeCursor();
         } catch (Zend_Db_Statement_Exception $e) {
             die($e->getMessage());
         }
     } catch (Zend_Db_Statement_Exception $e) {
         die(__LINE__ . ':' . __FILE__ . ':' . $e->getMessage());
     }
     $image = Zend_Controller_Action_HelperBroker::getStaticHelper('MediaImage');
     $media = Zend_Controller_Action_HelperBroker::getStaticHelper('Media');
     $article = Zend_Controller_Action_HelperBroker::getStaticHelper('Article');
     $status = Zend_Controller_Action_HelperBroker::getStaticHelper('Status');
     $numConts = count($content) - 1;
     for ($i = 0; $i <= $numConts; $i++) {
         $content[$i]->image = $image->direct($content[$i]->image);
         $content[$i]->media = $media->direct($content[$i]->id);
         $content[$i]->article = $article->getArticle($content[$i]->article);
         $content[$i]->status = $status->getStatus($content[$i]->status);
         $content[$i] = Showcase_Content::factory($content[$i]);
     }
     return $content;
 }
예제 #3
0
 protected function _factory($type, $userId, $userIp, $cache = true, $preview = null, $portals = null, $channels = null, $seriesId = null, $offset = 0, $limit = null, Zend_Date $start = null, Zend_Date $finish = null, $showId = null, $exclude = null, $searchTerm = null, $searchFilter = null, $transcript = null)
 {
     $validator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_DNS, true, false);
     $userIp = $validator->isValid($userIp) ? $userIp : null;
     unset($validator);
     $start = $start ? strval($start) : null;
     $finish = $finish ? strval($finish) : null;
     $stmt = Zend_Registry::get('dbh')->proc('page_content_load');
     $stmt->bindParam(':preview', $preview, PDO::PARAM_INT);
     $stmt->bindParam(':portals', $portals, PDO::PARAM_INT);
     $stmt->bindParam(':channels', $channels, PDO::PARAM_INT);
     /*
     $stmt->bindParam(':series', $seriesId, PDO::PARAM_INT);
     $stmt->bindParam(':exclude', $exclude, PDO::PARAM_INT);
     $stmt->bindParam(':show', $showId, PDO::PARAM_STR);
     $stmt->bindParam(':start', $start, PDO::PARAM_STR);
     $stmt->bindParam(':finish', $finish, PDO::PARAM_STR);		
     $stmt->bindParam(':search', $searchTerm, PDO::PARAM_STR);
     $stmt->bindParam(':filter', $searchFilter, PDO::PARAM_STR);
     $stmt->bindParam(':user', $user->id, PDO::PARAM_INT);
     $stmt->bindParam(':ip', $userIp, PDO::PARAM_STR);
     $stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
     $stmt->bindParam(':limit', $limit, PDO::PARAM_INT);
     $stmt->bindParam(':type', $type, PDO::PARAM_STR);
     */
     $results = array();
     try {
         $stmt->execute();
         $pageContent = array();
         $rowCount = 0;
         do {
             $results[] = $stmt->fetchAll(Zend_Db::FETCH_OBJ);
         } while ($stmt->nextRowset());
         $stmt->closeCursor();
     } catch (Zend_Db_Statement_Exception $e) {
         if ('HYC00' == $stmt->errorCode()) {
             $results[] = $stmt->fetchAll(Zend_Db::FETCH_OBJ);
         }
     }
     foreach ($results as $rowset) {
         foreach ($rowset as $row) {
             if (isset($row->found_rows)) {
                 $rowCount = $row->found_rows;
                 continue;
             } else {
                 $pageContent[] = Showcase_Content::factory($row, $cache);
             }
         }
     }
     $binds = array($user->id, $userIp, $offset, $limit, $type, $portals, $channels, $seriesId, $exclude, $showId, $start, $finish, $searchTerm, $searchFilter, $preview);
     //print_r($binds);
     //print_r($results);
     //echo "CALL page_content_load(".implode($binds,',').")";
     return array('contents' => $showId ? $pageContent[0] : $pageContent, 'rows' => !$rowCount ? count($pageContent) : $rowCount);
 }