コード例 #1
0
ファイル: Upload.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $signedUserInfo = $registry->get('signedUserInfo');
     $uploadStatus = $registry->get("uploadStatus");
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $file = new Zend_Form_Element_File('file');
     $file->setRequired(false);
     $file->setLabel('What do you want to share today?');
     if ($uploadStatus['bandwidth']['remainingbytes'] > 0) {
         $maxFileSize = $uploadStatus['filesize']['maxbytes'];
     } else {
         $maxFileSize = 0;
     }
     $file->addValidator('Size', false, $maxFileSize);
     $file->setMaxFileSize($maxFileSize);
     $file->setMultiFile(4);
     $file->addValidator('Count', false, array('min' => 0, 'max' => 4));
     $this->addElement($file, 'file');
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'submitupload', array('label' => 'Upload!', 'class' => 'btn primary'));
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #2
0
ファイル: NewPassword.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $auth = Zend_Auth::getInstance();
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     if ($auth->hasIdentity()) {
         $this->addElement('password', 'currentpassword', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'matchPassword')), 'autocomplete' => 'off', 'required' => true, 'label' => 'Current Password:'******'class' => 'span3'));
     }
     $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'description' => "Six or more characters required; case-sensitive", 'validators' => array(array('validator' => 'StringLength', 'options' => array(6, 20)), array('validator' => 'Hardpassword'), array('validator' => 'newPassword'), array('validator' => 'newPasswordRepeat')), 'autocomplete' => 'off', 'required' => true, 'label' => 'New Password:'******'class' => 'span3'));
     $this->addElement('password', 'password_confirm', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'Confirm Password:'******'autocomplete' => 'off', 'class' => 'span3'));
     if ($registry->isRegistered("changeUserProperPassword")) {
         $this->addElement(Ml_Model_AntiAttack::captchaElement());
     }
     $this->addElement('submit', 'submit', array('label' => 'Change it!', 'class' => 'btn primary'));
     if ($config['ssl']) {
         $this->getElement("submit")->addValidator("Https");
         //By default the submit element doesn't display a error decorator
         $this->getElement("submit")->addDecorator("Errors");
     }
     if ($auth->hasIdentity()) {
         $this->addElement(Ml_Model_MagicCookies::formElement());
     }
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #3
0
ファイル: DeleteTag.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'deleteTag', array('label' => 'Delete tag', 'class' => 'btn danger'));
 }
コード例 #4
0
ファイル: RemoveTwitter.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement('submit', 'remove', array('label' => 'Remove Twitter!', 'required' => true, 'class' => 'btn danger'));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #5
0
ファイル: Authorize.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->setMethod('post');
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'allow', array('label' => 'Yes!'));
     $this->addElement('submit', 'deny', array('label' => 'No!'));
 }
コード例 #6
0
ファイル: Logout.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement('submit', 'remote_signout', array('label' => 'Sign out all other sessions', 'class' => 'btn'));
     $this->addElement('submit', 'signout', array('label' => 'Sign out!', 'class' => 'btn danger'));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #7
0
ファイル: Favorite.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'favoriteSubmit', array('label' => 'Yes', 'class' => 'btn primary'));
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #8
0
ファイル: Tweet.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $registry = Zend_Registry::getInstance();
     $tweet = $this->addElement('textarea', 'tweet', array('label' => 'Tell them...', 'description' => 'Tweet something…', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 140)))));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'tweetSubmit', array('label' => 'Tweet!', 'class' => 'btn primary'));
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #9
0
ファイル: Tags.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('text', 'tags', array('label' => 'Add a tag', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 300))), 'placeholder' => 'Add a tag', 'class' => 'span2'));
     $this->addElement('submit', 'tagsSubmit', array('label' => 'Add', 'required' => false, 'class' => 'btn primary'));
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #10
0
ファイル: Redeem.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement('text', 'redeem', array('label' => 'Type your redeem code:', 'required' => true, 'autoInsertNotEmptyValidator' => false, 'validators' => array(array('validator' => 'Redeem'))));
     $this->addElement('submit', 'submit_redeem', array('label' => 'Redeem!', 'class' => 'btn success'));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #11
0
ファイル: Relationship.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $contactRelation = $this->addElement('checkbox', 'contact_relation', array('label' => 'Contact'));
     /*
             $this->addElement('checkbox', 'friend_relation', array(
                 'label'    => 'Friend'));*/
     $this->addElement('submit', 'update_relation', array('label' => "Change relation", 'required' => false));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #12
0
ファイル: Filepage.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement('text', 'title', array('label' => 'Title:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 100)))));
     $this->addElement('text', 'filename', array('label' => 'Filename:', 'required' => true, 'description' => "Don't forget the extension (i.e., .txt, .jpg, .pdf)", 'filters' => array('StringTrim', 'StringToLower', 'Filename'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 60)), array('validator' => 'filename'))));
     $this->addElement('text', 'short', array('label' => 'Short description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 120)))));
     $this->addElement('textarea', 'description', array('label' => 'Description:', 'required' => false, 'description' => '<small><a href="/help/html" class="new-window">' . 'HTML formatting</a></small>', 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 4096)))));
     $this->addElement('submit', 'submit', array('label' => 'Save!', 'class' => 'btn primary'));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #13
0
ファイル: Key.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement('text', 'application_title', array('label' => 'Application Title:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 80)))));
     $this->addElement('textarea', 'application_descr', array('label' => 'Description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 1024)))));
     $this->addElement('textarea', 'application_notes', array('label' => 'Notes (anything our admins should want know about your app):', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 1024)))));
     $this->addElement('checkbox', 'application_commercial', array('label' => 'Commercial'));
     $this->addElement('text', 'application_uri', array('label' => 'Application URI:', 'required' => false, 'filters' => array('StringTrim', 'UrlFilter'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 255)), array('validator' => 'Url'))));
     $this->addElement('text', 'callback_uri', array('label' => 'Application Callback:', 'required' => false, 'filters' => array('StringTrim', 'UrlFilter'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 255)), array('validator' => 'Url'))));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'submit', array('label' => 'Submit!'));
 }
コード例 #14
0
ファイル: DeleteShare.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'submit', array('label' => 'Yes, delete it!', 'class' => 'btn danger'));
     /*
     $this->addElement('submit', 'forget', array(
         'label'    => 'No!',
     ));
     */
     /*$this->addElement('hash', 'no_csrf_foo',
       array('salt' => '%(N*UN(*U00CI7c45v9', 'timeout' => 1200));*/
 }
コード例 #15
0
ファイル: AccountSettings.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $this->addElement('text', 'name', array('label' => 'Name:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 50)))));
     $email = $this->addElement('text', 'email', array('label' => 'E-mail address:', 'required' => true, 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 60)), array('validator' => 'emailCheckUser'), array('validator' => 'EmailAddress'))));
     $emailprivacy = $this->addElement('checkbox', 'private_email', array('label' => 'Hide e-mail from public search'));
     $website = $this->addElement('text', 'website', array('label' => 'Your homepage:', 'required' => false, 'filters' => array('StringTrim', 'UrlFilter'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 100)), array('validator' => 'Url'))));
     $location = $this->addElement('text', 'location', array('label' => 'Location:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 40)))));
     $about = $this->addElement('textarea', 'about', array('label' => 'About:', 'description' => '<small><a href="' . $this->getView()->staticUrl("/help/html") . '" class="new-window">HTML formatting</a></small>', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 4096)))));
     $this->addElement('submit', 'submit', array('label' => 'Save!', 'class' => 'btn primary'));
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->setAttrib('class', 'form-stacked');
 }
コード例 #16
0
ファイル: Comment.php プロジェクト: henvic/MediaLab
 public function init()
 {
     if (Zend_Registry::getInstance()->isRegistered("commentInfo")) {
         $altLabel = true;
     }
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     if (isset($altLabel)) {
         $commentLabel = "Edit your comment:";
         $postCommentLabel = "Save Changes";
     } else {
         $commentLabel = "Add your comment:";
         $postCommentLabel = "Post comment";
     }
     $this->addElement('textarea', 'commentMsg', array('label' => $commentLabel, 'required' => true, 'placeholder' => "Write your comment here", 'description' => '<small><a href="/help/html" class="new-window">' . 'HTML formatting</a></small>', 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 4096)))));
     $this->addElement('submit', 'getCommentPreview', array('label' => 'Preview', 'required' => false, 'class' => 'btn'));
     $this->addElement('submit', 'commentPost', array('label' => $postCommentLabel, 'required' => false, 'class' => 'btn primary'));
     $this->addElement(Ml_Model_MagicCookies::formElement());
 }
コード例 #17
0
ファイル: Picture.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $file = new Zend_Form_Element_File('Image');
     $file->setLabel('Choose a picture:');
     $file->addValidator('Count', false, 1);
     $file->addValidator('Size', false, array('max' => '1MB'));
     $file->setMaxFileSize(2048 * 1024);
     $file->addValidator('Extension', false, 'jpg,png,gif');
     $file->setRequired(false);
     $file->setOptions(array('ignoreNoFile' => true));
     $this->addElement($file, 'Image');
     $this->addElement('submit', 'submit', array('label' => 'Submit!', 'class' => 'btn primary'));
     $this->addElement('submit', 'delete', array('label' => 'Delete current', 'class' => 'btn danger'));
     $this->setAttrib('class', 'form-stacked');
     $this->addElement(Ml_Model_MagicCookies::formElement());
 }