Commit 5af581f4 authored by thomas craipeau's avatar thomas craipeau
Browse files

update session

parent 9b3f29ea
......@@ -72,7 +72,7 @@ class NewsModule extends \yii\base\Module {
if(@Yii::app()->request->cookies['lang'] && !empty(Yii::app()->request->cookies['lang']->value))
Yii::app()->language = (string)Yii::app()->request->cookies['lang'];
else
Yii::app()->language = (isset(Yii::app()->session["lang"])) ? Yii::app()->session["lang"] : 'fr';
Yii::app()->language = (isset(Yii::$app->session["lang"])) ? Yii::$app->session["lang"] : 'fr';
Yii::app()->params["module"] = array(
"name" => self::getPageTitle(),
......@@ -95,17 +95,17 @@ class NewsModule extends \yii\base\Module {
*/
public function getTheme() {
//$theme = "CO2";
$theme = (@Yii::app()->session["theme"]) ? Yii::app()->session["theme"] : "CO2";
$theme = (@Yii::$app->session["theme"]) ? Yii::$app->session["theme"] : "CO2";
//$theme = "notragora";
if (!empty(Yii::app()->params['theme'])) {
$theme = Yii::app()->params['theme'];
} else if (empty(Yii::app()->theme)) {
$theme = (@Yii::app()->session["theme"]) ? Yii::app()->session["theme"] : "CO2";
$theme = (@Yii::$app->session["theme"]) ? Yii::$app->session["theme"] : "CO2";
//$theme = "CO2";
//$theme = "notragora";
}
Yii::app()->session["theme"] = $theme;
Yii::$app->session["theme"] = $theme;
return $theme;
}
}
......@@ -16,7 +16,7 @@ class DeleteAction extends \PixelHumain\PixelHumain\components\Action {
$res = array("result"=>false, "msg"=>"You must be loggued to delete a comment");
return Rest::json( $res );
} else {
$res = News::delete($id, Yii::app()->session["userId"], true);
$res = News::delete($id, Yii::$app->session["userId"], true);
if(@$res["newsUp"] && $_POST["isLive"]){
$params=array(
"news"=>array( $id=>$res["newsUp"]),
......
......@@ -39,10 +39,10 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
//Define condition of each wall generated datas
if($type == Person::COLLECTION) {
$parent = Element::getElementSimpleById( $id,$type,null, array("links"));
if (isset(Yii::app()->session["userId"])){
$params["canManageNews"]=($id == Yii::app()->session["userId"] && $isLive!=true) ? true : false;
if (isset(Yii::$app->session["userId"])){
$params["canManageNews"]=($id == Yii::$app->session["userId"] && $isLive!=true) ? true : false;
}
if(!empty($isLive) && $isLive !== "false" && (@Yii::app()->session["userId"] && $id == Yii::app()->session["userId"])){
if(!empty($isLive) && $isLive !== "false" && (@Yii::$app->session["userId"] && $id == Yii::$app->session["userId"])){
$authorFollowedAndMe=[];
$arrayIds=[$id];
$followsArrayIds=[];
......@@ -117,9 +117,9 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
array("sharedBy.id"=>array('$in'=>array($id)),"verb"=> "share"))
);
}
if((!@$params["canManageNews"] || $params["canManageNews"] == false ) && @Yii::app()->session["userId"]){
if((!@$params["canManageNews"] || $params["canManageNews"] == false ) && @Yii::$app->session["userId"]){
array_push($orRequest,
array("author"=> Yii::app()->session["userId"],
array("author"=> Yii::$app->session["userId"],
"target.id"=> $id)
);
}
......@@ -128,13 +128,13 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
}
else if(in_array($type, [Organization::COLLECTION, Project::COLLECTION, Event::COLLECTION])){
$parent = Element::getElementSimpleById($id,$type,null, array("links"));
if(@Yii::app()->session["userId"]){
if($type!= Event::COLLECTION && @$parent["links"][Element::$connectTypes[$type]][Yii::app()->session["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::app()->session["userId"]][Link::TO_BE_VALIDATED])
if(@Yii::$app->session["userId"]){
if($type!= Event::COLLECTION && @$parent["links"][Element::$connectTypes[$type]][Yii::$app->session["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::$app->session["userId"]][Link::TO_BE_VALIDATED])
$params["canManageNews"]=true;
else if($type==Event::COLLECTION &&
((@$parent["links"]["attendees"][Yii::app()->session["userId"]] && @$parent["links"]["attendees"][Yii::app()->session["userId"]]["isAdmin"]) ||
@$parent["links"]["organizer"][Yii::app()->session["userId"]]) )
((@$parent["links"]["attendees"][Yii::$app->session["userId"]] && @$parent["links"]["attendees"][Yii::$app->session["userId"]]["isAdmin"]) ||
@$parent["links"]["organizer"][Yii::$app->session["userId"]]) )
$params["canManageNews"]=true;
}
$scope=["public","restricted"];
......@@ -180,7 +180,7 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
array("target.id"=>$id,
'$or'=> array(
array("scope.type"=>array('$in'=>$scope)),
array("author"=>Yii::app()->session["userId"])
array("author"=>Yii::$app->session["userId"])
)
)
);
......@@ -345,7 +345,7 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
$params["removeNews"]=$removeNewsArray;
}
if(@$parent){
$params["edit"] = Authorisation::canEditItem(Yii::app()->session["userId"], $type, $parent["_id"]);
$params["edit"] = Authorisation::canEditItem(Yii::$app->session["userId"], $type, $parent["_id"]);
$params["openEdition"] = Authorisation::isOpenEdition($parent["_id"], $type, @$parent["preferences"]);
}else{
$params["edit"] = false;
......
......@@ -38,19 +38,19 @@ class IndexAction extends \PixelHumain\PixelHumain\components\Action
"clickEvent"=>false
);
if(@$parent){
$params["edit"] = Authorisation::canEditItem(Yii::app()->session["userId"], $type, $parent["_id"]);
$params["edit"] = Authorisation::canEditItem(Yii::$app->session["userId"], $type, $parent["_id"]);
$params["openEdition"] = Authorisation::isOpenEdition($parent["_id"], $type, @$parent["preferences"]);
}
if(@Yii::app()->session["userId"]){
if(@Yii::$app->session["userId"]){
$params["canPostNews"]=true;
if(in_array($type, [Organization::COLLECTION, Project::COLLECTION, Event::COLLECTION])){
$parent = Element::getElementSimpleById($id,$type,null, array("links", "name", "profilThumbImageUrl"));
if($type!= Event::COLLECTION && @$parent["links"][Element::$connectTypes[$type]][Yii::app()->session["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::app()->session["userId"]][Link::TO_BE_VALIDATED])
if($type!= Event::COLLECTION && @$parent["links"][Element::$connectTypes[$type]][Yii::$app->session["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::$app->session["userId"]][Link::TO_BE_VALIDATED])
$params["canManageNews"]=true;
else if($type==Event::COLLECTION && ((@$parent["links"]["attendees"][Yii::app()->session["userId"]] && @$parent["links"]["attendees"][Yii::app()->session["userId"]]["isAdmin"]) || @$parent["links"]["organizer"][Yii::app()->session["userId"]]) )
else if($type==Event::COLLECTION && ((@$parent["links"]["attendees"][Yii::$app->session["userId"]] && @$parent["links"]["attendees"][Yii::$app->session["userId"]]["isAdmin"]) || @$parent["links"]["organizer"][Yii::$app->session["userId"]]) )
$params["canManageNews"]=true;
}else if($type == Person::COLLECTION && Yii::app()->session["userId"]==$id && $isLive!=true)
}else if($type == Person::COLLECTION && Yii::$app->session["userId"]==$id && $isLive!=true)
$params["canManageNews"]=true;
}
......
......@@ -64,7 +64,7 @@ class ModerateAction extends \PixelHumain\PixelHumain\components\Action
'isAnAbuse' => $_REQUEST['isAnAbuse']
);
$resAction = Action::addAction(Yii::app()->session["userId"] , $_REQUEST['id'], "news", Action::ACTION_MODERATE, false, false, $details);
$resAction = Action::addAction(Yii::$app->session["userId"] , $_REQUEST['id'], "news", Action::ACTION_MODERATE, false, false, $details);
//Save => OK
if($resAction['userActionSaved']){
......
......@@ -159,7 +159,7 @@ class News {
public static function save($params)
{
//check a user is loggued
$user = Person::getById(Yii::app()->session["userId"]);
$user = Person::getById(Yii::$app->session["userId"]);
//TODO : if type is Organization check the connected user isAdmin
if(empty($user))
......@@ -182,7 +182,7 @@ class News {
$authorName=Element::getElementSimpleById($news["parentId"], $news["parentType"]);
$author=array("id"=>$news["parentId"], "type"=>$news["parentType"],"name"=>$authorName["name"]);
}else{
$author=array("id" => Yii::app()->session["userId"],"type"=>Person::COLLECTION, "name" => Yii::app()->session["user"]["name"]);
$author=array("id" => Yii::$app->session["userId"],"type"=>Person::COLLECTION, "name" => Yii::$app->session["user"]["name"]);
}
Notification::notifyMentionOn($author , $target, $news["mentions"], null, $news["scope"]);
}
......@@ -191,13 +191,13 @@ class News {
$target=$news["target"];//array("id"=>$news["parentId"],"type"=>$news["parentType"]);
if(@$news["targetIsAuthor"])
$target["targetIsAuthor"]=true;
else if($params["parentType"]==Person::COLLECTION && $params["parentId"] != Yii::app()->session["userId"])
else if($params["parentType"]==Person::COLLECTION && $params["parentId"] != Yii::$app->session["userId"])
$target["userWall"]=true;
if($params["parentType"] != Person::COLLECTION || $params["parentId"] != Yii::app()->session["userId"]){
Notification::constructNotification(ActStr::VERB_POST, array("id" => Yii::app()->session["userId"],"name" => Yii::app()->session["user"]["name"]) , $target, null, null, null, $news["text"]);
if($params["parentType"] != Person::COLLECTION || $params["parentId"] != Yii::$app->session["userId"]){
Notification::constructNotification(ActStr::VERB_POST, array("id" => Yii::$app->session["userId"],"name" => Yii::$app->session["user"]["name"]) , $target, null, null, null, $news["text"]);
}
$news=NewsTranslator::convertParamsForNews($news);
$news["author"] = Person::getSimpleUserById(Yii::app()->session["userId"]);
$news["author"] = Person::getSimpleUserById(Yii::$app->session["userId"]);
/* Send email alert to contact@pixelhumain.com */
//if(@$type && $type=="pixels"){
......@@ -212,11 +212,11 @@ class News {
$typeNews=@$params["type"] ? $params["type"] : "news";
$news = array("type" => $typeNews, //"news",
"text" => $params["text"],
"author" => Yii::app()->session["userId"],
"author" => Yii::$app->session["userId"],
"date"=>new MongoDate(time()),
"collection"=>self::COLLECTION,
"sharedBy"=> array(
array("id"=>Yii::app()->session["userId"],
array("id"=>Yii::$app->session["userId"],
"type"=>Person::COLLECTION,
"updated"=>new MongoDate(time())
)
......@@ -240,7 +240,7 @@ class News {
if (isset($params["media"])){
$news["media"] = $params["media"];
if(isset($params["media"]["content"]) && isset($params["media"]["content"]["image"]) && !isset($params["media"]["content"]["imageId"])){
$urlImage = self::uploadNewsImage($params["media"]["content"]["image"],$params["media"]["content"]["imageSize"],Yii::app()->session["userId"]);
$urlImage = self::uploadNewsImage($params["media"]["content"]["image"],$params["media"]["content"]["imageSize"],Yii::$app->session["userId"]);
$news["media"]["content"]["image"]= Yii::app()->baseUrl."/".$urlImage;
}
}
......@@ -400,7 +400,7 @@ class News {
);
if(@$shareUpdate){
$followsArrayIds=[];
$parent=Element::getElementSimpleById(Yii::app()->session["userId"],Person::COLLECTION,null, array("links"));
$parent=Element::getElementSimpleById(Yii::$app->session["userId"],Person::COLLECTION,null, array("links"));
if(@$parent["links"]["follows"] && !empty($parent["links"]["follows"])){
foreach ($parent["links"]["follows"] as $key => $data){
array_push($followsArrayIds,$key);
......@@ -466,14 +466,14 @@ class News {
$allShare = array();
//regarde tous les sharedBy
foreach ($share["sharedBy"] as $key => $value) {
if($value["id"] != Yii::app()->session["userId"]){ //si ce n'est pas moi je garde ce partage
if($value["id"] != Yii::$app->session["userId"]){ //si ce n'est pas moi je garde ce partage
$allShare[] = $value;
}
}
//je me rajoute à la liste des allShare
$share["sharedBy"] = array_merge($allShare,
array(array( "id" => Yii::app()->session["userId"],
array(array( "id" => Yii::$app->session["userId"],
"type"=> Person::COLLECTION,
"comment"=>@$comment,
"updated" => new MongoDate(time())),
......@@ -490,11 +490,11 @@ class News {
"verb" => $verb,
"target" => array("id" => $targetId,
"type"=> $targetType),
"author" => Yii::app()->session["userId"],
"author" => Yii::$app->session["userId"],
"object" => $activityValue,
"scope" => array("type"=>"restricted"),
"created" => new MongoDate(time()),
"sharedBy" => array(array( "id" => Yii::app()->session["userId"],
"sharedBy" => array(array( "id" => Yii::$app->session["userId"],
"type"=> Person::COLLECTION,
"comment"=>@$comment,
"updated" => new MongoDate(time()))),
......@@ -569,7 +569,7 @@ class News {
if(isset($params["media"]["content"]) && isset($params["media"]["content"]["image"]) && !isset($params["media"]["content"]["imageId"])){
$endPath=explode(Yii::app()->params['uploadUrl'],$params["media"]["content"]["image"]);
if(isset($endPath[1]) && !empty($endPath[1]) && !file_exists ( Yii::app()->params['uploadDir'].$endPath[1])){
$urlImage = self::uploadNewsImage($params["media"]["content"]["image"],$params["media"]["content"]["imageSize"],Yii::app()->session["userId"]);
$urlImage = self::uploadNewsImage($params["media"]["content"]["image"],$params["media"]["content"]["imageSize"],Yii::$app->session["userId"]);
$set["media"]["content"]["image"]= Yii::app()->baseUrl."/".$urlImage;
}
}
......@@ -646,7 +646,7 @@ class News {
//One news has to be moderated X times
,"reportAbuseCount" => array('$gt' => 0)
//One moderator can't moderate 2 times a news
,"moderate.".Yii::app()->session["userId"] => array('$exists'=>0)
,"moderate.".Yii::$app->session["userId"] => array('$exists'=>0)
);
if(count($whereAdditional)){
$where = array_merge($where,$whereAdditional);
......
......@@ -209,13 +209,13 @@ class NewsTranslator {
//et que l'id du sharedBy est dans la liste des follows
//ou que l'id du sharedBy est mon id
if( in_array(@$value["id"], $followsArrayIds) ||
@$value["id"] == Yii::app()->session["userId"]){
@$value["id"] == Yii::$app->session["userId"]){
$dateUpdated = $value["updated"]; //memorise la date du share
$lastComment = @$value["comment"]; //memorise la date du share
$lastAuthorShare = $clearShare; //memorise l'auteur du share
$lastKey = count($sharedBy);
}
}else if(@$value["id"] == Yii::app()->session["userId"]){//si j'ai pas la liste des follows de l'element => journal
}else if(@$value["id"] == Yii::$app->session["userId"]){//si j'ai pas la liste des follows de l'element => journal
$dateUpdated = $value["updated"]; //memorise la date du share
$lastComment = @$value["comment"]; //memorise la date du share
$lastKey = count($sharedBy);
......
......@@ -105,11 +105,11 @@
//<!-- <div id="newLiveFeedForm" class="col-xs-12 no-padding margin-bottom-10"></div> -->
//top page Title
if( isset( Yii::app()->session[ "costum" ][ "app" ][ "#live" ]["title"] ) ) { ?>
<h3 class="title-section col-sm-8"><?php echo Yii::app()->session[ "costum" ][ "app" ][ "#live" ]["title"] ?></h3>
if( isset( Yii::$app->session[ "costum" ][ "app" ][ "#live" ]["title"] ) ) { ?>
<h3 class="title-section col-sm-8"><?php echo Yii::$app->session[ "costum" ][ "app" ][ "#live" ]["title"] ?></h3>
<?php }
if(isset(Yii::app()->session['userId'])){ ?>
if(isset(Yii::$app->session['userId'])){ ?>
<div id="formCreateNewsTemp" style="float: none;" class="center-block hidden">
<div class='no-padding form-create-news-container <?php echo $sizeForm ?>'>
......@@ -166,7 +166,7 @@ if(isset(Yii::app()->session['userId'])){ ?>
<div id='form-news' class="col-xs-12 no-padding">
<input type="hidden" id="parentId" name="parentId"
value="<?php if($contextParentType != "city") echo $contextParentId; else echo Yii::app()->session["userId"]; ?>"/>
value="<?php if($contextParentType != "city") echo $contextParentId; else echo Yii::$app->session["userId"]; ?>"/>
<input type="hidden" id="parentType" name="parentType"
value="<?php if($contextParentType != "city") echo $contextParentType; else echo Person::COLLECTION; ?>"/>
......@@ -205,9 +205,9 @@ if(isset(Yii::app()->session['userId'])){ ?>
<?php if((@$canManageNews && $canManageNews==true)
|| (@Yii::app()->session["userId"]
|| (@Yii::$app->session["userId"]
&& $contextParentType==Person::COLLECTION
&& Yii::app()->session["userId"]==$contextParentId)){ ?>
&& Yii::$app->session["userId"]==$contextParentId)){ ?>
<div class="dropdown col-md-6 no-padding">
<a data-toggle="dropdown" class="btn btn-default" id="btn-toogle-dropdown-scope" href="#"><i class="fa fa-<?php echo @$contextScopeNews[$contextParentType][$contextScopeNews[$contextParentType]["init"]["admin"]]["icon"] ?>"></i> <?php echo @$contextScopeNews[$contextParentType][$contextScopeNews[$contextParentType]["init"]["admin"]]["label"] ?> <i class="fa fa-caret-down" style="font-size:inherit;"></i></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
......@@ -229,8 +229,8 @@ if(isset(Yii::app()->session['userId'])){ ?>
<?php if($contextParentType == Organization::COLLECTION || $contextParentType == Project::COLLECTION || $contextParentType == Event::COLLECTION){ ?>
<div class="dropdown no-padding pull-right">
<a data-toggle="dropdown" class="btn btn-default" id="btn-toogle-dropdown-targetIsAuthor" href="#">
<?php if(@Yii::app()->session["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::app()->getRequest()->getBaseUrl(true).Yii::app()->session["user"]["profilThumbImageUrl"]; ?>'>
<?php if(@Yii::$app->session["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::app()->getRequest()->getBaseUrl(true).Yii::$app->session["user"]["profilThumbImageUrl"]; ?>'>
<?php } else { ?>
<img height=20 width=20 src='<?php echo $this->module->assetsUrl.'/images/thumb/default_citoyens.png' ?>'>
<?php } ?>
......@@ -251,8 +251,8 @@ if(isset(Yii::app()->session['userId'])){ ?>
</li>
<li>
<a href="javascript:;" class="targetIsAuthor" data-value="0"><h4 class="list-group-item-heading">
<?php if(@Yii::app()->session["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::app()->getRequest()->getBaseUrl(true).Yii::app()->session["user"]["profilThumbImageUrl"]; ?>'>
<?php if(@Yii::$app->session["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::app()->getRequest()->getBaseUrl(true).Yii::$app->session["user"]["profilThumbImageUrl"]; ?>'>
<?php } else { ?>
<img height=20 width=20 src='<?php echo $this->module->assetsUrl.'/images/thumb/default_citoyens.png' ?>'>
<?php } ?>
......@@ -271,8 +271,8 @@ if(isset(Yii::app()->session['userId'])){ ?>
<?php if(!@$contextParentType || $contextParentType=="city"){ ?>
<input type="hidden" name="scope" value="public"/>
<?php } else if((@$canManageNews && $canManageNews=="true") || (
@Yii::app()->session["userId"] &&
$contextParentType==Person::COLLECTION && Yii::app()->session["userId"]==$contextParentId)){
@Yii::$app->session["userId"] &&
$contextParentType==Person::COLLECTION && Yii::$app->session["userId"]==$contextParentId)){
if(in_array($contextParentType,array(Event::COLLECTION,Person::COLLECTION,Project::COLLECTION,Organization::COLLECTION))){ ?>
<input type="hidden" name="scope" value="restricted"/>
<?php } else { ?>
......@@ -296,8 +296,8 @@ if(isset(Yii::app()->session['userId'])){ ?>
<?php } else {
if( isset( Yii::app()->session[ "costum" ][ "app" ][ "#live" ]["showAskLogin"] )
&& Yii::app()->session[ "costum" ][ "app" ][ "#live" ]["showAskLogin"] == false ) {
if( isset( Yii::$app->session[ "costum" ][ "app" ][ "#live" ]["showAskLogin"] )
&& Yii::$app->session[ "costum" ][ "app" ][ "#live" ]["showAskLogin"] == false ) {
// we could do any else scenario
......
......@@ -37,7 +37,7 @@
</div>
<?php echo $this->renderPartial('modalModeration', array());
if( isset(Yii::app()->session["userId"]) ) echo $this->renderPartial('modalShare', array()); ?>
if( isset(Yii::$app->session["userId"]) ) echo $this->renderPartial('modalShare', array()); ?>
<script type="text/javascript" >
modules.news = <?php echo json_encode( News::getConfig() ) ?> ;
......
......@@ -81,8 +81,8 @@
<div class="col-sm-12 container text-left">
<?php
$marginClass="margin-top-50";
if(isset(Yii::app()->session['userId'])){
$me = Element::getByTypeAndId(Person::COLLECTION, Yii::app()->session['userId']);
if(isset(Yii::$app->session['userId'])){
$me = Element::getByTypeAndId(Person::COLLECTION, Yii::$app->session['userId']);
$profilThumbImageUrl = Element::getImgProfil($me, "profilThumbImageUrl", $this->module->assetsUrl);
$marginClass="margin-top-10";
?>
......
......@@ -76,14 +76,14 @@ HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFiles, Yii::app()->request->
"nbCol"=> 1,
"endStream"=>true,
"inline"=>true) );
if( @Yii::app()->session["userId"] ) echo $this->renderPartial('news.views.co.modalShare', array());
if( @Yii::$app->session["userId"] ) echo $this->renderPartial('news.views.co.modalShare', array());
}else{ ?>
<p class="col-md-12 col-sm-12 col-xs-12">
<?php echo Yii::t("news","This link points to a dead news")?>.<br>
<?php echo Yii::t("news","The author has probably deleted the news") ?> !!<br>
<?php if (@Yii::app()->session["userId"]){ ?>
<a href="#page.type.<?php echo Person::COLLECTION ?>.id.<?php echo Yii::app()->session["userId"] ?>" class="btn btn-warning lbh"><i class="fa fa-sign-in"></i> <?php echo Yii::t("news","Back to my page") ?></a>
<?php if (@Yii::$app->session["userId"]){ ?>
<a href="#page.type.<?php echo Person::COLLECTION ?>.id.<?php echo Yii::$app->session["userId"] ?>" class="btn btn-warning lbh"><i class="fa fa-sign-in"></i> <?php echo Yii::t("news","Back to my page") ?></a>
<?php } else { ?>
<a href="#" class="btn btn-warning lbh"><i class="fa fa-sign-in"></i> <?php echo Yii::t("news","Back to home") ?></a>
<?php } ?>
......@@ -109,7 +109,7 @@ HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFiles, Yii::app()->request->
else text = news.text;
}
<?php if(isset(Yii::app()->session["userId"])) { ?>
<?php if(isset(Yii::$app->session["userId"])) { ?>
initCommentsTools(new Array(news));
<?php } ?>
......
......@@ -156,9 +156,9 @@ if(@$media["object"]){
if(@$media["target"]["id"] != @$contextId){
$where=Yii::t("news","in the newspaper of {who}",
array("{who}"=>'<a href="#page.type.'.@$media["target"]["type"].'.id.'.@$media["target"]["id"].'" class="lbh">'.@$media["target"]["name"].' </a>'));
}else if(@$media["target"]["id"] == @$contextId && @$contextId == Yii::app()->session["userId"] ){
}else if(@$media["target"]["id"] == @$contextId && @$contextId == Yii::$app->session["userId"] ){
$where=Yii::t("news","in your newspaper");
}else if(@$media["target"]["id"] == @$contextId && @$contextId != Yii::app()->session["userId"] ){
}else if(@$media["target"]["id"] == @$contextId && @$contextId != Yii::$app->session["userId"] ){
$where=Yii::t("news","in this newspaper");
}
} ?>
......@@ -189,9 +189,9 @@ if(@$media["object"]){
class="lbh">
<?php echo @$media["target"]["name"]; ?>
</a>
<?php }else if(@$media["target"]["id"] == @$contextId && @$contextId == Yii::app()->session["userId"] ){ ?>
<?php }else if(@$media["target"]["id"] == @$contextId && @$contextId == Yii::$app->session["userId"] ){ ?>
<?php echo Yii::t("news","in your newspaper"); ?>
<?php }else if(@$media["target"]["id"] == @$contextId && @$contextId != Yii::app()->session["userId"] ){ ?>
<?php }else if(@$media["target"]["id"] == @$contextId && @$contextId != Yii::$app->session["userId"] ){ ?>
<?php echo Yii::t("news","in this newspaper"); ?>
<?php } ?>
<?php } ?>
......@@ -218,25 +218,25 @@ if(@$media["object"]){
</small>
<?php if(!@$media["documentation"]){
if (@Yii::app()->session["userId"]){ ?>
if (@Yii::$app->session["userId"]){ ?>
<div class="btn dropdown pull-right no-padding settingsNews">
<strong></strong>
<a class="dropdown-toggle" type="button" data-toggle="dropdown" style="color:#8b91a0;">
<i class="fa fa-cog"></i> <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<?php if ( (@$media["author"]["id"]==Yii::app()->session["userId"] && @$media["verb"] != "share")
|| (@$media["sharedBy"] && in_array(Yii::app()->session["userId"],array_column($media["sharedBy"],"id")))
<?php if ( (@$media["author"]["id"]==Yii::$app->session["userId"] && @$media["verb"] != "share")
|| (@$media["sharedBy"] && in_array(Yii::$app->session["userId"],array_column($media["sharedBy"],"id")))
|| (@$canManageNews && $canManageNews) || Authorisation::isInterfaceAdmin()){ ?>
<li>
<a href="javascript:;" class="deleteNews" onclick="deleteNews('<?php echo $key ?>', '<?php echo $media["type"] ?>', $(this))" data-id="'<?php echo $key ?>"><small><i class="fa fa-times"></i> <?php echo Yii::t("common", "Delete")?></small></a></li>
<?php if (@$media["type"] != "activityStream"
&& ( (@$media["targetIsAuthor"] && $media["targetIsAuthor"])
|| @$media["author"]["id"]==Yii::app()->session["userId"])){ ?>
|| @$media["author"]["id"]==Yii::$app->session["userId"])){ ?>
<li><a href="javascript:" class="modifyNews" onclick="modifyNews('<?php echo $key ?>','<?php echo $media["type"] ?>')" data-id="<?php echo $key ?>"><small><i class="fa fa-pencil"></i> <?php echo Yii::t("common", "Update publication")?></small></a></li>
<?php }
} ?>
<?php if (!@$media["reportAbuse"] || (@$media["reportAbuse"] && !@$media["reportAbuse"][@Yii::app()->session["userId"]])) { ?>
<?php if (!@$media["reportAbuse"] || (@$media["reportAbuse"] && !@$media["reportAbuse"][@Yii::$app->session["userId"]])) { ?>
<li><a href="javascript:;" class="reportAbuse" data-id="<?php echo $key ?>" data-type="<?php echo News::COLLECTION ?>"><small><i class="fa fa-flag"></i> <?php echo Yii::t("common", "Report an abuse")?></small></a></li>
<?php } ?>
</ul>
......
......@@ -153,7 +153,7 @@ foreach($news as $key => $media){
<?php } ?>
</small>
</h6>
<?php if(@$media["reportAbuseCount"] >= $abuseMax && isset(Yii::app()->session["userId"])){ ?>
<?php if(@$media["reportAbuseCount"] >= $abuseMax && isset(Yii::$app->session["userId"])){ ?>
<button class="btn btn-link bg-orange pull-right margin-right-10 margin-top-10 btn-start-moderation"
data-newsid="<?php echo @$media["_id"]; ?>"
data-toggle="modal" data-target="#modal-moderation">
......@@ -177,7 +177,7 @@ foreach($news as $key => $media){
);
?>
<?php
// if( isset(Yii::app()->session["userId"]) &&
// if( isset(Yii::$app->session["userId"]) &&
// (!isset($timelineHtml) || !isset($timelineHtml["footer"]))) {
?>
<div class="timeline-footer pull-left col-md-12 col-sm-12 col-xs-12 padding-top-5">
......@@ -210,7 +210,7 @@ foreach($news as $key => $media){
var canPostNews = <?php echo json_encode(@$canPostNews) ?>;
var canManageNews = <?php echo json_encode(@$canManageNews) ?>;
var actionController = <?php echo json_encode(@$actionController) ?>;
var idSession = "<?php echo Yii::app()->session["userId"] ?>";
var idSession = "<?php echo Yii::$app->session["userId"] ?>";
var uploadUrl = "<?php echo Yii::app()->params['uploadUrl'] ?>";
var docType="<?php echo Document::DOC_TYPE_IMAGE; ?>";
var months = ["<?php echo Yii::t('common','january') ?>", "<?php echo Yii::t('common','febuary') ?>", "<?php echo Yii::t('common','march') ?>", "<?php echo Yii::t('common','april') ?>", "<?php echo Yii::t('common','may') ?>", "<?php echo Yii::t('common','june') ?>", "<?php echo Yii::t('common','july') ?>", "<?php echo Yii::t('common','august') ?>", "<?php echo Yii::t('common','september') ?>", "<?php echo Yii::t('common','october') ?>", "<?php echo Yii::t('common','november') ?>", "<?php echo Yii::t('common','december') ?>"];
......@@ -334,7 +334,7 @@ foreach($news as $key => $media){
uiModeration.getNewsToModerate(newsid);
});
<?php
//if(isset(Yii::app()->session["userId"])) {
//if(isset(Yii::$app->session["userId"])) {
?>
initCommentsTools(news, "news");
<?php
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment