Example #1
0
 public static function cleanHtml($html)
 {
     $chain = new Zend_filter();
     //$chain->addFilter(new Zend_Filter_StripTags(self::$tags));
     $chain->addFilter(new Zend_Filter_StringTrim());
     //$chain = new Zend_Filter_HtmlEntities();
     $html = $chain->filter($html);
     $html = stripslashes($html);
     //echo $html;
     $temp = $html;
     while (1) {
         $html = preg_replace('/(<[^>]*)javascript:([^>]*>)/i', '$1$2', $html);
         //if nothing changed this iteration then break the loop
         if ($html == $temp) {
             break;
         }
         $temp = $html;
     }
     return $html;
 }
 public function signAction()
 {
     $data = array();
     if ($this->_hasParam('id')) {
         $id = Zend_filter::filterStatic($this->_getParam('id'), 'int');
         if (Application_Model_Classroom::isAvailable($id)) {
             $session = new Zend_Session_Namespace('data');
             $session->classroom_id = $id;
             $classroom = new Zend_Db_Table('classroom');
             $row = $classroom->fetchRow(array('id = ?' => $id));
             if (PAYMENT && $row->amount && $row->amount > 0) {
                 $this->_redirect('/classroom/pay');
             } else {
                 $this->_redirect('/classroom/register');
             }
         }
     }
     $this->view->messages = array('Unavailable');
 }
 public function deleteAction()
 {
     $id = Zend_filter::filterStatic($this->_getParam('id'), 'int');
     $userId = Zend_filter::filterStatic($this->_getParam('userId'), 'int');
     $classroomUser = new Tri_Db_Table('classroom_user');
     $classroomUser->delete(array('user_id = ?' => $userId, 'classroom_id = ?' => $id));
     $this->_helper->_flashMessenger->addMessage('Success');
     $this->_redirect('admin/classroom/list-user/id/' . $id);
 }