Esempio n. 1
0
 /**
  * A widget that lists all comments for a given recipe
  * @param Recipe $recipe A recipe object
  **/
 public function __construct($recipe)
 {
     $GLOBALS['RTK']->AddJavascript('/commentview.js');
     parent::__construct('CommentView');
     if (is_a($recipe, 'Recipe')) {
         $this->AddChild(new RTK_Header('Comments'));
         $comments = Comment::LoadComments('R=' . $recipe->GetId());
         $box = null;
         if (sizeof($comments) > 0) {
             $box = new RTK_Box('Comments');
             $this->TraverseComment($box, $comments);
         } else {
             if (Login::IsLoggedIn()) {
                 $message = 'No comments yet, be the first to comment on this recipe!';
             } else {
                 $message = 'No comments yet, log in and be the first to comment on this recipe!';
             }
             $box = new RTK_Textview($message, false, null, 'commentnone');
         }
         if (Site::HasHttps() && Login::IsLoggedIn()) {
             $form = new RTK_Form('CommentForm');
             $form->AddChild($box);
             $inputbox = new RTK_Box('NewComment');
             $inputbox->AddChild(new HtmlElement('a', array('href' => '#', 'onclick' => 'SelectComment(\'\')'), 'New comment'));
             $inputbox->AddChild(new HtmlElement('input', array('name' => 'CommentSelect', 'id' => 'CommentSelect', 'type' => 'hidden')));
             $inputbox->AddChild(new HtmlElement('input', array('name' => 'CommentInput', 'id' => 'CommentInput', 'type' => 'text', 'autocomplete' => 'off')));
             $inputbox->AddChild(new RTK_Button('submit', 'Send'));
             $form->AddChild($inputbox);
             $this->AddChild($form);
         } else {
             $this->AddChild($box);
         }
     }
 }
Esempio n. 2
0
 /**
  * A widget that lists all comments for a given article
  * @param string $articleid The id of the article
  **/
 public function __construct($articleid)
 {
     parent::__construct('CommentView');
     $this->AddJavascript(RTK_DIRECTORY . 'script/rtk-commentview.js');
     if ($articleid != null) {
         $this->AddChild(new RTK_Header('Comments'));
         $this->_display = new HtmlElement();
         $this->_commentbox = new RTK_Box('Comments');
         $this->_comments = Comment::LoadComments($articleid);
         if (sizeof($this->_comments) > 0) {
             $this->TraverseComment($this->_commentbox, $this->_comments);
         }
         if (Login::IsLoggedIn()) {
             $message = 'No comments yet, be the first to comment on this recipe!';
         } else {
             $message = 'No comments yet, log in and be the first to comment on this recipe!';
         }
         $this->_nocomments = new RTK_Textview($message, false, null, 'commentnone');
         if (Site::HasHttps() && Login::IsLoggedIn()) {
             $form = new RTK_Form('CommentForm', EMPTYSTRING, 'POST', true, array('autocomplete' => 'off'));
             $form->AddChild($this->_commentbox);
             $inputbox = new RTK_Box('NewComment');
             $inputbox->AddChild(new HtmlElement('a', array('href' => '#', 'onclick' => 'SelectComment(\'\')'), 'New comment'));
             $inputbox->AddChild(new HtmlElement('input', array('name' => 'CommentSelect', 'id' => 'CommentSelect', 'type' => 'hidden')));
             $inputbox->AddChild(new HtmlElement('input', array('name' => 'CommentInput', 'id' => 'CommentInput', 'type' => 'text', 'autocomplete' => 'off')));
             $inputbox->AddChild(new RTK_Button('submit', 'Send'));
             $form->AddChild($inputbox);
             $this->_commentbox = $form;
         }
         $this->AddChild($this->_display);
     }
 }
Esempio n. 3
0
$box1 = new RTK_Box(null, 'widgettest');
$box1->AddChild(new RTK_Pagination(Site::GetBaseURL() . 'notreallyalink/', 100, 10, 5));
$box2 = new RTK_Box(null, 'subtest1');
$box2->AddChild(new RTK_Header("Example Recipe #" . rand(100, 1000)));
$box2->AddChild(new RTK_Image('/imgtest.png', 'alttext', array('class' => 'right')));
$box2->AddChild(new RTK_Textview($text1 . $text4, true));
$box2->AddChild(new RTK_Link('woop', 'a link'));
$box2->AddChild(new RTK_Box(null, 'clearfix'));
$box3 = new RTK_Box(null, 'subtest3');
$list = new RTK_ListView(array('woop', 'test', 'wahoo', 'pebkac', 'kesmit'));
$list->AddRow(array('1111', '1111', '1111', '1111', '1111'));
$list->AddRow(array('2222', '2222', '2222', '2222', '2222'));
$list->AddRow(array('3333', '3333', '3333', '3333', '3333'));
$box3->AddChild($list);
$box4 = new RTK_Box(null, 'subtest4');
$form = new RTK_Form('testform');
$form->AddText($text2 . $text3);
$form->AddHiddenField('supersecret', 2);
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddFileUpload('pffile', 'Phajl!');
$form->AddTextField('pfffffffth', 'Pffffft!', null, 5);
$form->AddPasswordField('passw0rds', 'A password: '******'chk_salmon', 'Has salmon: ', true, 'salmon');
$form->AddRadioButtons('rad_options', '_buttons: ', array(array('opt_1', 'fisk'), 'opt_2', array('opt_3', 'ikkefisk')), 'opt_2');
$form->AddDropDown('DROP', 'daun', array(array('opt_1', 'fisk'), 'opt_2', array('opt_3', 'ikkefisk')), 'opt_3');
$form->AddElement('custom', 'Custom "input": ', new RTK_Image('/imgtest.png', 'bleh', array('customarg1' => 'nisser')));
$form->AddButton('submit2', 'Submit2!');
Esempio n. 4
0
// Handle the login
if (!Login::IsLoggedIn() && Site::CheckSecurityToken()) {
    if (Login::TryToLogin()) {
        Site::BackToHome();
    }
}
// Page Output
include_once 'Pages/OnAllPages.php';
$RTK->AddJavascript('/jquery-2.1.4.min.js');
$RTK->AddJavascript('/login.js');
if (Login::GetError() != EMPTYSTRING) {
    $RTK->AddElement(new RTK_Textview(Login::GetError()));
}
$loginbox = new RTK_Box('loginbox');
if (Login::IsLoggedIn()) {
    // If a user is logged in
    $loginbox->AddChild(new RTK_Textview('You are logged in as: ' . Login::GetUsername()));
    $loginbox->AddChild(new RTK_Link('Logout' . URLPAGEEXT, 'click here for log out', true));
} elseif (Site::HasHttps()) {
    // If a user is not logged in, but the site is running secure
    $loginform = new RTK_Form('loginform', EMPTYSTRING, 'POST');
    $loginform->AddTextField('loginname', 'Username:'******'loginpass', 'Password:'******'submit', 'log in');
    $loginbox->AddChild($loginform);
} else {
    // If a user is not logged in, and the site is not running secure
    $loginbox->AddChild(new RTK_Textview('You are not running secure and therefore cannot be allowed to log in.'));
    $loginbox->AddChild(new RTK_Link('Login' . URLPAGEEXT, 'click here for encrypted login', true));
}
$RTK->AddElement($loginbox);
Esempio n. 5
0
    $showpage = $pages[0];
}
if (!in_array($showstyle, $styles)) {
    $showstyle = $styles[0];
}
// create the requested page
$RTK = new HtmlDocument("RTK example test site");
$RTK->ClearStylesheets();
$faviconpath = 'image' . DIRECTORY_SEPARATOR . 'favicon.png';
if (file_exists($faviconpath)) {
    $RTK->SetFavicon($faviconpath);
}
$RTK->AddStylesheet(RTK_DIRECTORY . 'style/rtk-' . $showstyle . '.css');
$RTK->AddStylesheet('style' . DIRECTORY_SEPARATOR . 'style.css');
$topbar = new RTK_Box('topbar');
$pagestyleform = new RTK_Form('pagestyleform', 'index.php', 'GET', false);
$pagestyleform->AddDropDown('page', 'Page:', $pages, $showpage);
$pagestyleform->AddDropDown('style', 'Style:', $styles, $showstyle);
$topbar->AddChild($pagestyleform);
$button = new RTK_Button();
$button->AddAttributes(array('onclick' => "document.getElementById('pagestyleform').submit()"));
$topbar->AddChild($button);
$RTK->AddElement($topbar, 'BODY', 'topbar');
$wrapper = new RTK_Box('wrapper');
$RTK->AddElement($wrapper, 'BODY', 'wrapper');
$main = new RTK_Box('main');
$RTK->AddElement($main, 'wrapper', 'main');
include_once 'example/' . $showpage . '.php';
echo $RTK;
//Database::Disconnect();
//echo "\n".(microtime(true) - STARTTIME);*/
Esempio n. 6
0
}
$text1 = "Here you can add a recipe to securipe.";
// Page Output
include_once 'Pages/OnAllPages.php';
$box1 = new RTK_Box(null, 'createrecipe');
$box2 = new RTK_Box(null, 'subtest1');
$box2->AddChild(new RTK_Header("Create a recipe"));
$box2->AddChild(new RTK_Textview($text1, true));
$box2->AddChild(new RTK_Box(null, 'clearfix'));
$box3 = new RTK_Box(null, 'subtest3');
$items = array();
$items[] = array('0', 'fisk');
$items[] = array('1', 'ost');
$items[] = array('2', 'ikkefisk');
$box4 = new RTK_Box(null, 'subtest4');
$form = new RTK_Form('testform');
$form->AddTextField('title', 'Recipe title:');
$form->AddTextField('description', 'Description:', null, 5);
$form->AddDropDown('type', 'Type:', $items, $items[2][0]);
$form->AddFileUpload('imagepath', 'Image: ');
$form->AddButton('Submit', 'Submit recipe');
$box4->AddChild($form);
$box4->AddChild(new RTK_Box(null, 'clearfix'));
$box1->AddChild($box2);
$box1->AddChild($box3);
$box1->AddChild($box4);
$RTK->AddElement($box1);
//$recipeId = "1";
if (Value::SetAndNotNull($_POST, 'Submit')) {
    $imagepath = Site::GetPostValueSafely("imagepath");
    $title = Site::GetPostValueSafely("title");
Esempio n. 7
0
// Page Logic
//if (Value::SetAndNotNull($_POST, 'submit2')) {
//	$image = Site::GetUploadedImage('pffile');
//}
$text = "Normally, both your asses would be dead as f*****g fried chicken, but you happen to pull this shit while I'm in a transitional period so I don't wanna kill you, I wanna help you. But I can't give you this case, it don't belong to me. Besides, I've already been through too much shit this morning over this case to hand it over to your dumb ass. Look, just because I don't be givin' no man a foot massage don't make it right for Marsellus to throw Antwone into a glass motherfuckin' house, f****n' up the way the nigger talks. M**********r do that shit to me, he better paralyze my ass, 'cause I'll kill the m**********r, know what I'm sayin'? Your bones don't break, mine do. That's clear. Your cells react to bacteria and viruses differently than mine. You don't get sick, I do. That's also clear. But for some reason, you and I react the exact same way to water. We swallow it too fast, we choke. We get some in our lungs, we drown. However unreal it may seem, we are connected, you and I. We're on the same curve, just on opposite ends. Now that we know who you are, I know who I am. I'm not a mistake! It all makes sense! In a comic, you know how you can tell who the arch-villain's going to be? He's the exact opposite of the hero. And most times they're friends, like you and me! I should've known way back when... You know why, David? Because of the kids. They called me Mr Glass";
// Page Output
$box1 = new RTK_Box(null, 'widgettest');
$box1->AddChild(new RTK_Pagination('#', 100, 10, 5));
$prof = new RTK_Box(null, 'subtest1');
$prof->AddChild(new RTK_Header('User profile for: "Ztudmuffin02"'));
$prof->AddChild(new RTK_Image('image/img00.png', 'alttext', array('class' => 'right')));
$prof->AddChild(new RTK_Textview($text, true));
$prof->AddChild(new RTK_Link('woop', 'a link'));
$prof->AddChild(new RTK_Box(null, 'clearfix'));
$box1->AddChild($prof);
$form = new RTK_Form('testform');
$form->AddHiddenField('supersecret', 2);
$form->AddTextField('username', 'Username:'******'Ztudmuffin02');
$form->AddTextField('firstname', 'First name:', 'John');
$form->AddTextField('lastname', 'Last name:', 'Doe');
$form->AddTextField('phonenumber', 'Phone number:');
$form->AddTextField('email', 'Email:');
$form->AddFileUpload('pffile', 'Phajl!');
$form->AddTextField('pfffffffth', 'Pffffft!', null, 5);
$form->AddPasswordField('passw0rds', 'A password: '******'chk_salmon', 'Has salmon: ', true, 'salmon');
$form->AddRadioButtons('rad_options', '_buttons: ', array(array('opt_1', 'fisk'), 'opt_2', array('opt_3', 'ikkefisk')), 'opt_2');
$form->AddDropDown('DROP', 'daun', array(array('opt_1', 'fisk'), 'opt_2', array('opt_3', 'ikkefisk')), 'opt_3');
$form->AddElement('custom', 'Custom "input": ', new RTK_Image('/imgtest.png', 'bleh', array('customarg1' => 'nisser')));
$form->AddButton('submit2', 'Submit2!');
$box1->AddChild($form);
Esempio n. 8
0
    Site::ValidatePassword($password, $password2, $errors);
    Site::ValidateEmail($email, $errors);
    Site::ValidatePhoneNo($telNo, $errors);
    if (sizeof($errors) == 0) {
        $user = new User();
        $user->create($userName, $password, $firstName, $lastName, $email, $telNo);
        $user->save();
        Site::BackToHome();
    } else {
        $errors = implode('<br />', $errors);
    }
}
// Page Output
include_once 'Pages/OnAllPages.php';
$RTK->AddJavascript('jquery-2.1.4.min.js');
$RTK->AddJavascript('login.js');
$RTK->AddElement(new RTK_Header("Create User"));
$RTK->AddElement(new RTK_Textview("Please fill out this form to recieve your very own user account at our magnificent site.\n" . "Please note however that we have a few rules. For instance: Usernames have to be at least 5 characters long.\n" . "Passwords have to be at least 8 characters long, and must contain numbers as well as both lower and upper case letters."));
$form = new RTK_Form("createUserForm");
$form->AddTextField("UserName", "User Name", $userName);
$form->AddPasswordField("Password", "Password");
$form->AddPasswordField("Password2", "Password repeat");
$form->AddTextField("FirstName", "First Name", $firstName);
$form->AddTextField("LastName", "Last Name", $lastName);
$form->AddTextField("email", "Email", $email);
$form->AddTextField("telNo", "Phone No", $telNo);
$form->AddButton("Submit", "Create my user account");
$RTK->AddElement($form);
if ($errors != null) {
    $RTK->AddElement(new RTK_Textview($errors));
}