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


PHP UserManager::getCurrent方法代码示例

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


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

示例1: PDO

<?php

// ________ TOOLS ________
session_start();
// $db = mysqli_connect('192.168.1.7', 'root', 'troiswa', 'ecommerce');
$db = new PDO("mysql:host=192.168.1.7;dbname=ecommerce", 'root', 'troiswa');
if ($db === false) {
    require 'apps/404.php';
}
spl_autoload_register(function ($class) {
    require 'models/' . $class . '.class.php';
});
if (isset($_SESSION['id'])) {
    $userManager = new UserManager($db);
    $currentUser = $userManager->getCurrent();
} else {
    $_SESSION['visiteur'] = true;
}
// Init constantes
require 'init_const.php';
// ________ HUB ________
// Pages
$access_public = array('404', 'home', 'category', 'sub_category', 'list-product', 'product', 'basket', 'register', 'login');
$access_user = array('404', 'home', 'category', 'sub_category', 'list-product', 'product', 'basket', 'profil', 'logout', 'edit_profil', 'edit_address');
$access_admin = array('404', 'home', 'create_category', 'category', 'create_sub_category', 'sub_category', 'create_product', 'list-product', 'product', 'basket', 'profil', 'logout', 'dashboard_user', 'dashboard_message', 'dashboard_order', 'edit_profil', 'edit_address');
// Traitements
$traitements_public = array('product' => 'product', 'basket' => 'basket', 'register' => 'user', 'login' => 'user');
$traitements_user = array('product' => 'product', 'product' => 'message', 'basket' => 'basket', 'profil' => 'user', 'logout' => 'user', 'edit_profil' => 'user', 'edit_address' => 'user');
$traitements_admin = array('create_category' => 'sections', 'create_sub_category' => 'sections', 'create_product' => 'product', 'product' => 'product', 'product' => 'message', 'basket' => 'basket', 'profil' => 'user', 'logout' => 'user', 'dashboard_user' => 'user', 'dashboard_message' => 'message', 'dashboard_order' => 'order', 'edit_profil' => 'user', 'edit_address' => 'user');
$page = 'home';
$errors = array();
开发者ID:berserkr1,项目名称:e-commerce,代码行数:31,代码来源:index.php

示例2: realpath

<table class="commenttable">
<tbody>
<?php 
//I really don't know if I want to have this page serve json and have browsers turn the json into html
//or if I want to send an html table like this
//header("Content-Type: application/json");
//echo(json_encode(include(realpath(dirname(__DIR__) . "/private/json/getComments.php"))));
include_once realpath(dirname(__DIR__) . "/private/class/UserManager.php");
$response = (include realpath(dirname(__DIR__) . "/private/json/getPageCommentsWithUsers.php"));
$user = UserManager::getCurrent();
if (empty($response)) {
    echo "<tr style=\"vertical-align:top\">";
    echo "<td colspan=\"2\" style=\"text-align: center;\">";
    echo "Bad Request.";
    echo "</td></tr>";
} else {
    $users = $response['users'];
    $comments = $response['comments'];
    if ($user) {
        echo "<tr style=\"vertical-align:top\">";
        echo "<td>Leave a comment:</td>";
        echo "<td style=\"text-align:center\"><textarea name=\"comment\" style=\"font-size:0.6em;\"></textarea><input type=\"submit\" value=\"Post\">";
        echo "</td></tr>";
    }
    if (empty($comments)) {
        echo "<tr style=\"vertical-align:top\">";
        echo "<td colspan=\"2\" style=\"text-align: center;\">";
        echo "There are no comments here yet.";
        echo "</td></tr>";
    } else {
        foreach ($comments as $comment) {
开发者ID:BlocklandGlass,项目名称:GlassWebsite,代码行数:31,代码来源:getComments.php

示例3: session_start

<?php

session_start();
require_once realpath(dirname(__DIR__) . "/../private/class/AddonManager.php");
var_dump($_POST);
$userObject = UserManager::getCurrent();
if (!$userObject || !$userObject->inGroup("Reviewer")) {
    header('Location: /addons');
    return;
}
if (isset($_POST['action']) && is_object($userObject)) {
    if ($_POST['action'] == "Approve") {
        // approve
        AddonManager::approveAddon($_POST['aid'], $_POST['board'], $userObject->getBLID());
        header('Location: list.php');
    } else {
        if ($_POST['action'] == "Reject") {
            AddonManager::rejectAddon($_POST['aid'], $_POST['reason'], $userObject->getBLID());
            header('Location: list.php');
        }
    }
}
开发者ID:BlocklandGlass,项目名称:GlassWebsite,代码行数:22,代码来源:approve.php

示例4: realpath

<?php

require_once realpath(dirname(__DIR__) . "/private/class/AddonManager.php");
$uo = UserManager::getCurrent();
if (isset($_REQUEST['aid']) && isset($_REQUEST['rating'])) {
    $aid = $_REQUEST['aid'];
    $rating = $_REQUEST['rating'];
    $blid = $uo->getBLID();
    $newAvg = AddonManager::submitRating($aid, $blid, $rating);
    echo $newAvg;
}
开发者ID:BlocklandGlass,项目名称:GlassWebsite,代码行数:11,代码来源:submitRating.php

示例5: create

 public function create($idTopic, $content)
 {
     $post = new Post();
     $set = $post->setContent($content);
     if ($set === true) {
         $manager = new TopicManager($this->db);
         $topic = $manager->findById($idTopic);
         $set = $post->setIdTopic($topic);
         if ($set === true) {
             if (isset($_SESSION['id'])) {
                 $manager = new UserManager($this->db);
                 $user = $manager->getCurrent();
                 $set = $post->setIdAuthor($user);
                 if ($set === true) {
                     $idAuthor = intval($user->getId());
                     $idTopic = intval($post->getIdTopic());
                     $content = mysqli_real_escape_string($this->db, $post->getContent());
                     $query = "INSERT INTO post (id_author, id_topic, content) VALUES (" . $idAuthor . ", " . $idTopic . ", '" . $content . "')";
                     $result = mysqli_query($this->db, $query);
                     if ($result) {
                         $id = mysqli_insert_id($this->db);
                         if ($id) {
                             return $this->findById($id);
                         } else {
                             return "Erreur serveur.";
                         }
                     } else {
                         return mysqli_error();
                     }
                 } else {
                     return $set;
                 }
             } else {
                 return "Utilisateur déconnecté.";
             }
         } else {
             return $set;
         }
     } else {
         return $set;
     }
 }
开发者ID:Hollux,项目名称:Fennec,代码行数:42,代码来源:PostManager.class.php

示例6: realpath

</h1>
  <hr />
  You can reclaim your old RTB add-ons and have them automatically imported and updated, reclaiming your old users and issuing them the latest version.<br />
  <br />
  Name of Current Add-On on Glass: <input type="text" id="addon" />
  <form method="post" action="">
    <input type="hidden" name="action" value="reclaim" />
    <div id="options">

    </div>
  </form>
</div>
<script type="text/javascript">
$("#addon").keyup(function() {
  $.ajax({
    url: "/ajax/searchAddonNames.php?owner=<?php 
echo UserManager::getCurrent()->getBlid();
?>
&query=" + $("#addon").val()
  }).done(function(data) {
    res = JSON.parse(data);
    var html = "";
    for(i = 0; i < res.length; i++) {
      html = html + "<b>" + res[i].name + "</b> <button name=\"aid\" type=\"submit\" value=\"" + res[i].id + "\">Reclaim</button><br />";
    }
    $("#options").html(html);
  })
});
</script>
<?php 
include realpath(dirname(__DIR__) . "/../private/footer.php");
开发者ID:BlocklandGlass,项目名称:GlassWebsite,代码行数:31,代码来源:reclaim.php

示例7: utf8_encode

					$('#star' + (i+2)).attr("src","/img/icons32/draw_star.png");
				}
			});
		});
		<?php 
}
?>
	});
</script>
<div class="maincontainer">
	<?php 
echo "<span style=\"font-size: 0.8em; padding-left: 10px\"><a href=\"/addons/\">Add-Ons</a> >> ";
echo "<a href=\"/addons/boards.php\">Boards</a> >> ";
echo "<a href=\"board.php?id=" . $boardObject->getID() . "\">" . utf8_encode($boardObject->getName()) . "</a> >> ";
echo "<a href=\"#\">" . $addonObject->getName() . "</a></span>";
if ($current = UserManager::getCurrent()) {
    if ($current->inGroup("Moderator")) {
        echo "<div style=\"background-color: #aabbcc; padding: 10px; border-radius:10px; margin-top:10px; text-align:center\"><a href=\"moderate.php?id=" . $addonObject->getId() . "\">Moderator Settings</a></div>";
    }
}
echo '<div class="tile">';
echo "<h2 style=\"margin-bottom: 0px;\">" . $addonObject->getName() . "</h2>";
$authors = $addonObject->getAuthorInfo();
echo "Uploaded by ";
if (sizeof($authors) == 1) {
    //$uo = new UserHandler();
    //$uo->initFromId($authors[0]->id);
    $name = UserLog::getCurrentUsername($authors[0]->blid);
    echo "<a href=\"/user/view.php?blid=" . $authors[0]->blid . "\">" . utf8_encode($name) . "</a>";
} else {
    if (sizeof($authors) == 2) {
开发者ID:BlocklandGlass,项目名称:GlassWebsite,代码行数:31,代码来源:addon.php


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