Beispiel #1
0
 public function delete()
 {
     $this->execute();
     $user = new \User\User();
     $id = I("param.id");
     $data = $user->delete($id);
     echo $data;
 }
Beispiel #2
0
 public function execute()
 {
     $user = new \User\User();
     $status = $user->status();
     if (!$user->is_login()) {
         header("Location:" . __APP__ . "/index/Iuser");
     }
     $area = $user->call_area();
     $data = $area->all_select();
     $this->assign("name", $status['name']);
     $this->assign("nav", $data);
     return $user;
 }
 public function init()
 {
     $me = User\User::get();
     if (!$me) {
         session_destroy();
     }
     $rids = $me->rids;
     self::$rids = $rids;
     $qry = 'SELECT plg_name,plg_type,plg_status,region,title,content,pages,visibility FROM ' . PREFIX . 'codo_plugins AS p' . ' LEFT JOIN ' . PREFIX . 'codo_blocks AS b ON p.plg_name=b.module ' . ' LEFT JOIN ' . PREFIX . 'codo_block_roles AS r ON b.id=r.bid ' . ' WHERE r.rid IN (' . implode(",", $rids) . ') OR r.rid IS NULL  ORDER BY b.weight';
     $result = $this->db->query($qry)->fetchAll();
     foreach ($result as $res) {
         $path = PLUGIN_DIR . $res['plg_name'] . '/' . $res['plg_name'] . '.php';
         if (file_exists($path) && $res['plg_status'] == 1) {
             $this->loadPlugin($res, $path);
         }
         self::$plugin[$res['plg_name']] = array("status" => $res['plg_status'], "block" => $res['region']);
     }
     $this->storeHtmlBlocks();
 }
Beispiel #4
0
<?php

namespace index;

session_start();
include_once "User.php";
include_once 'captcha/CaptchaBuilderInterface.php';
include_once 'captcha/PhraseBuilderInterface.php';
include_once 'captcha/CaptchaBuilder.php';
include_once 'captcha/PhraseBuilder.php';
use Gregwar\Captcha\CaptchaBuilder;
try {
    $user = new \User\User();
    switch ($_GET["page"]) {
        case "login":
            if ($user->is_logged()) {
                $usr = $user->get_user();
                echo "id:" . $user["id"] . "<br>";
                echo "Last visited:" . date("d-M-Y", $user["last_visited"]);
            } else {
                echo ' <form name="login_form" method="POST" action="post.php">';
                echo 'E-mail: <input type="text" name="email"><br>';
                echo 'Password: <input type="password" name="password"><br>';
                if (isset($_SESSION["incorect_logins"]) && $_SESSION["incorect_logins"] >= 2) {
                    $builder = new CaptchaBuilder();
                    $builder->build();
                    echo '<img src="' . $builder->inline() . '" /><br>';
                    echo 'Captcha: <input type="text" name="captcha"><br>';
                    $_SESSION["captcha_answer"] = $builder->getPhrase();
                }
                echo '<input type="submit" name="submit" value="Login">';
Beispiel #5
0
/*
Template Name:J4
Description:J4主题使用介绍请点击:<a href="http://blog.jjonline.cn/theme/J4.html" target=_blank>勾肆介绍</a>
Version:1.0_dev
Author:Jea杨
Author Url:http://blog.jjonline.cn
Sidebar Amount:1
*/
if (!defined('EMLOG_ROOT')) {
    exit('<a href="http://blog.jjonline.cn/theme/J4.html">J4</a> Requrire Emlog!');
}
require_once View::getView('module');
$Hashids = new Library\Hashids('jjonline', 16);
dump($Hashids->encode(1));
#调试类库自动加载
$UserInfo = User\User::isLogin();
define('IS_USER_LOGIN', !!$UserInfo);
check_system_base();
?>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<link rel="dns-prefetch" href="//apps.bdimg.com">
<link rel="dns-prefetch" href="//hm.baidu.com">
<meta name="apple-mobile-web-app-title" content="<?php 
echo $site_title;
?>
">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
Beispiel #6
0
<?php

namespace Post;

session_start();
include_once "User.php";
$user = new \User\User();
if (isset($_POST["email"]) && !empty($_POST["email"]) && isset($_POST["password"]) && !empty($_POST["password"])) {
    if (isset($_POST["captcha"]) && !empty($_POST["captcha"])) {
        if ($_SESSION["captcha_answer"] == $_POST["captcha"]) {
            if ($user->login($_POST["email"], $_POST["password"]) != false) {
                echo "ok";
            } else {
                echo "failed";
            }
        } else {
            echo "failed captcha";
        }
    }
    if (!isset($_SESSION["incorect_logins"]) || $_SESSION["incorect_logins"] < 2) {
        if ($user->login($_POST["email"], $_POST["password"]) != false) {
            echo "ok";
        } else {
            echo "failed";
        }
    }
    exit;
} else {
    echo "failed";
}
Beispiel #7
0
 public static function set_promoted_or_demoted_rid()
 {
     $user = User\User::get();
     $rids = \DB::table(PREFIX . 'codo_promotion_rules')->where(function ($query) use($user) {
         $query->where('reputation', '<=', $user->reputation)->where('type', '=', 1);
     })->orWhere(function ($query) use($user) {
         $query->where('posts', '<=', $user->no_posts)->where('type', '=', 1);
     })->orWhere(function ($query) use($user) {
         $query->where('reputation', '<=', $user->reputation)->where('posts', '<=', $user->no_posts)->where('type', '=', 0);
     })->lists('rid');
     $current_roles = \DB::table(PREFIX . 'codo_user_roles')->select('rid', 'is_promoted')->where('uid', '=', $user->id)->get();
     $deletions = array();
     $additions = array();
     $current_rids = array();
     foreach ($current_roles as $role) {
         if ($role['is_promoted'] == '1' && !in_array($role['rid'], $rids)) {
             //the promoted roles is no longer applicable
             //demote him i.e remove this role for the user
             $deletions[] = $role['rid'];
         }
         $current_rids[] = $role['rid'];
         //used in next loop
     }
     foreach ($rids as $rid) {
         if (!in_array($rid, $current_rids)) {
             //the user has a promoted role which is not added, so add it
             $additions[] = $rid;
         }
     }
     if (!empty($additions)) {
         $new_roles = array();
         foreach ($additions as $addition) {
             $new_roles[] = array('uid' => $user->id, 'rid' => $addition, 'is_primary' => 0, 'is_promoted' => 1);
         }
         \DB::table(PREFIX . 'codo_user_roles')->insert($new_roles);
     }
     if (!empty($deletions)) {
         \DB::table(PREFIX . 'codo_user_roles')->where('uid', '=', $user->id)->whereIn('rid', $deletions)->delete();
     }
 }
Beispiel #8
0
 public function out()
 {
     $user = new \User\User();
     $user->out();
     header("Location:" . __APP__ . "/index/Iuser");
 }
Beispiel #9
0
    <div class="container">

        <div id="header">
            <a href="/../shop/" class="btn btn-default">Shop</a>
            <a href="/../user/" class="btn btn-default">Users</a>
            <a href="/../user/AddUser.php" class="btn btn-default">Add User</a>
            <a href="/../products/index.php" class="btn btn-default">Products</a>
            <a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a>
            <a href="/../orders/index.php" class="btn btn-default">Orders</a>
        </div>

        <?php 
if (isset($_POST['name'])) {
    $date = new DateTime('now');
    $date = $date->getTimestamp();
    $user = new \User\User();
    $user->setId($_GET['id']);
    $user->setUserName($_POST['name']);
    $user->setUpdatedAt($date);
    $user_update = new EntityManager();
    $user_update->update($user);
    header("Location: index.php");
    exit;
}
if (isset($_GET['id'])) {
    $get_user = new EntityManager();
    $user = $get_user->find('user', $_GET['id']);
}
?>

        <form method="post">