当前位置: 首页>>代码示例>>PHP>>正文


PHP Site::HasHttps方法代码示例

本文整理汇总了PHP中Site::HasHttps方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::HasHttps方法的具体用法?PHP Site::HasHttps怎么用?PHP Site::HasHttps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Site的用法示例。


在下文中一共展示了Site::HasHttps方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * 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);
         }
     }
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:38,代码来源:CommentView.php

示例2: __construct

 /**
  * 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);
     }
 }
开发者ID:iensenfirippu,项目名称:RTK,代码行数:36,代码来源:commentview.php

示例3: GetBaseURL

 /**
  * Returns true if the client is connecting via HTTPS, otherwise it returns false.
  * @param boolean $forcehttps Specify if the link has to have https
  */
 public static function GetBaseURL($forcehttps = false)
 {
     if (Site::HasHttps() || $forcehttps) {
         return 'https://' . BASEURL;
     } else {
         return 'http://' . BASEURL;
     }
 }
开发者ID:iensenfirippu,项目名称:RTK,代码行数:12,代码来源:functions.php

示例4: Insert

 public static function Insert($message, $recipe, $id = EMPTYSTRING)
 {
     $result = false;
     if (Site::HasHttps() && Login::IsLoggedIn()) {
         if (Value::SetAndNotEmpty($message) && Value::SetAndNotNull($recipe)) {
             $path = 'R=' . $recipe;
             if ($id != EMPTYSTRING) {
                 if ($stmt = Database::GetLink()->prepare('SELECT `comment_path` FROM `Comment` WHERE `comment_path` LIKE ?;')) {
                     $stmt->bindParam(1, $path, PDO::PARAM_STR, 255);
                     $stmt->execute();
                     $stmt->bindColumn(1, $result);
                     $stmt->fetch();
                     $stmt->closeCursor();
                     if ($result != null && _string::StartsWith($result, $path)) {
                         $path = $result . '>' . $id;
                     } else {
                         $path = null;
                     }
                 }
             }
             if ($path != null) {
                 $userid = Login::GetId();
                 $timestamp = time();
                 if ($stmt = Database::GetLink()->prepare('INSERT INTO `Comment` (`user_id`, `comment_path`, `comment_contents`, `sent_at`) VALUES (?, ?, ?, ?);')) {
                     $stmt->bindParam(1, $userid, PDO::PARAM_INT);
                     $stmt->bindParam(2, $path, PDO::PARAM_STR, 255);
                     $stmt->bindParam(3, $message, PDO::PARAM_STR, 255);
                     $stmt->bindParam(4, $timestamp, PDO::PARAM_INT);
                     $stmt->execute();
                     $stmt->closeCursor();
                 }
             }
         }
     }
     return $result;
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:36,代码来源:Comment.php

示例5: RTK_Textview

// 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:');
    $loginform->AddPasswordField('loginpass', 'Password:');
    $loginform->AddButton('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);
开发者ID:iensenfirippu,项目名称:securipe,代码行数:31,代码来源:Login.php

示例6: TryToLogin

 /**
  * Tries to login, given that all the requirements are met.
  **/
 public static function TryToLogin()
 {
     $result = false;
     // Check if the site is connected to via https, and if there is input from the login form
     if (Site::HasHttps() && Login::HasLoginInput()) {
         $username = hash('sha512', $_POST['loginname']);
         $password = $_POST['loginpass'];
         $salt1 = STATIC_SALT;
         // Static salt
         $salt2 = Login::FetchUserSalt($username);
         // Dynamic salt
         if ($salt2 != EMPTYSTRING) {
             $password = hash('sha512', $salt1 . $password . $salt2 . $username);
             if ($password != EMPTYSTRING) {
                 $id = Login::FetchUserId($username, $password);
                 if ($id > 0) {
                     Login::SetId($id);
                     Login::SetUsername(Login::FetchUsername($id));
                     Login::SetAttempts(0);
                     $result = true;
                 }
             }
         }
         Login::LogAttempt($username, $result);
     }
     return $result;
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:30,代码来源:Login.php

示例7: array

<?php

// Page Logic
if (!Site::HasHttps() || Login::IsLoggedIn()) {
    Site::BackToHome();
}
$errors = null;
$userName = EMPTYSTRING;
$firstName = EMPTYSTRING;
$lastName = EMPTYSTRING;
$email = EMPTYSTRING;
$telNo = EMPTYSTRING;
if (Value::SetAndNotNull($_POST, 'Submit') && Site::CheckSecurityToken()) {
    $errors = array();
    $userName = Site::GetPostValueSafely("UserName");
    // need to be hashed client-side
    $password = Site::GetPostValueSafely("Password");
    // need to be hashed client-side
    $password2 = Site::GetPostValueSafely("Password2");
    // need to be hashed client-side
    $firstName = Site::GetPostValueSafely("FirstName");
    $lastName = Site::GetPostValueSafely("LastName");
    $email = Site::GetPostValueSafely("email");
    $telNo = Site::GetPostValueSafely("telNo");
    Site::ValidateUserName($userName, $errors);
    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);
开发者ID:iensenfirippu,项目名称:securipe,代码行数:31,代码来源:CreateUser.php


注:本文中的Site::HasHttps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。