Commit 05662178 authored by thomas craipeau's avatar thomas craipeau
Browse files

replace Yii::$container->get > Yii::get

parent 829d1ff3
......@@ -30,16 +30,16 @@ class NewsModule extends \yii\base\Module {
public function getAssetsUrl()
{
if ($this->_assetsUrl === null) {
Yii::$container->get('assetManager')->publish(
Yii::get('assetManager')->publish(
Yii::getAlias('@modules/'.$this->id.'/assets') );
$this->_assetsUrl = Yii::$container->get('assetManager')->getPublishedUrl(Yii::getAlias('@modules/'.$this->id.'/assets'));
$this->_assetsUrl = Yii::get('assetManager')->getPublishedUrl(Yii::getAlias('@modules/'.$this->id.'/assets'));
}
return $this->_assetsUrl;
}
public function getParentAssetsUrl()
{
return ( @Yii::$container->get('yii\base\Module')->params["module"]["parent"] ) ? Yii::$container->get('yii\base\Module')->getModule( Yii::$container->get('yii\base\Module')->params["module"]["parent"] )->getAssetsUrl() : $this->module->assetsUrl;
return ( @Yii::get('yii\base\Module')->params["module"]["parent"] ) ? Yii::get('yii\base\Module')->getModule( Yii::get('yii\base\Module')->params["module"]["parent"] )->getAssetsUrl() : $this->module->assetsUrl;
}
public function beforeControllerAction($controller, $action)
......@@ -60,18 +60,18 @@ class NewsModule extends \yii\base\Module {
// you may place code here to customize the module or the application
Yii::$container->get('yii\web\Application')->homeUrl = Yii::$container->get('urlManager')->createUrl($this->id);
Yii::get('yii\web\Application')->homeUrl = Yii::get('urlManager')->createUrl($this->id);
//Apply theme
$themeName = $this->getTheme();
ThemeHelper::setWebsiteTheme($themeName);
if(@Yii::$container->get('request')->cookies['lang'] && !empty(Yii::$container->get('request')->cookies['lang']->value))
Yii::$container->get('yii\web\Application')->language = (string)Yii::$container->get('request')->cookies['lang'];
if(@Yii::get('request')->cookies['lang'] && !empty(Yii::get('request')->cookies['lang']->value))
Yii::get('yii\web\Application')->language = (string)Yii::get('request')->cookies['lang'];
else
Yii::$container->get('yii\web\Application')->language = (isset(Yii::$container->get('session')["lang"])) ? Yii::$container->get('session')["lang"] : 'fr';
Yii::get('yii\web\Application')->language = (isset(Yii::get('session')["lang"])) ? Yii::get('session')["lang"] : 'fr';
Yii::$container->get('yii\base\Module')->params["module"] = array(
Yii::get('yii\base\Module')->params["module"] = array(
"name" => self::getPageTitle(),
"parent" => "co2",
"overwriteList" => array(
......@@ -92,13 +92,13 @@ class NewsModule extends \yii\base\Module {
*/
public function getTheme() {
//$theme = "CO2";
$theme = (@Yii::$container->get('session')["theme"]) ? Yii::$container->get('session')["theme"] : "CO2";
$theme = (@Yii::get('session')["theme"]) ? Yii::get('session')["theme"] : "CO2";
//$theme = "notragora";
if (!empty(Yii::$container->get('yii\base\Module')->params['theme'])) {
$theme = Yii::$container->get('yii\base\Module')->params['theme'];
if (!empty(Yii::get('yii\base\Module')->params['theme'])) {
$theme = Yii::get('yii\base\Module')->params['theme'];
}
Yii::$container->get('session')["theme"] = $theme;
Yii::get('session')["theme"] = $theme;
return $theme;
}
}
......@@ -26,7 +26,7 @@ class DefaultController extends CommunecterController {
{
//echo "hello there"; exit ;
// if(Yii::$container->get('request')->isAjax)
// if(Yii::get('request')->isAjax)
// echo $this->renderPartial("index");
// else
// {
......@@ -34,7 +34,7 @@ class DefaultController extends CommunecterController {
// $this->render("index");
// }
if(Yii::$container->get('request')->isAjax)
if(Yii::get('request')->isAjax)
return $this->renderPartial("index");
else{
$this->layout = "//layouts/directory";
......
......@@ -18,7 +18,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::$container->get('session')["userId"], true);
$res = News::delete($id, Yii::get('session')["userId"], true);
if($activity = Activitypub::createDeleteNoteActivity($id))
Handler::handle($activity);
......
......@@ -42,10 +42,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::$container->get('session')["userId"])){
$params["canManageNews"]=($id == Yii::$container->get('session')["userId"] && $isLive!=true) ? true : false;
if (isset(Yii::get('session')["userId"])){
$params["canManageNews"]=($id == Yii::get('session')["userId"] && $isLive!=true) ? true : false;
}
if(!empty($isLive) && $isLive !== "false" && (@Yii::$container->get('session')["userId"] && $id == Yii::$container->get('session')["userId"])){
if(!empty($isLive) && $isLive !== "false" && (@Yii::get('session')["userId"] && $id == Yii::get('session')["userId"])){
$authorFollowedAndMe=[];
$arrayIds=[$id];
$followsArrayIds=[];
......@@ -120,9 +120,9 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
array("sharedBy.id"=>array('$in'=>array($id)),"verb"=> "share"))
);
}
if((!@$params["canManageNews"] || $params["canManageNews"] == false ) && @Yii::$container->get('session')["userId"]){
if((!@$params["canManageNews"] || $params["canManageNews"] == false ) && @Yii::get('session')["userId"]){
array_push($orRequest,
array("author"=> Yii::$container->get('session')["userId"],
array("author"=> Yii::get('session')["userId"],
"target.id"=> $id)
);
}
......@@ -131,13 +131,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::$container->get('session')["userId"]){
if($type!= Event::COLLECTION && @$parent["links"][Element::$connectTypes[$type]][Yii::$container->get('session')["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::$container->get('session')["userId"]][Link::TO_BE_VALIDATED])
if(@Yii::get('session')["userId"]){
if($type!= Event::COLLECTION && @$parent["links"][Element::$connectTypes[$type]][Yii::get('session')["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::get('session')["userId"]][Link::TO_BE_VALIDATED])
$params["canManageNews"]=true;
else if($type==Event::COLLECTION &&
((@$parent["links"]["attendees"][Yii::$container->get('session')["userId"]] && @$parent["links"]["attendees"][Yii::$container->get('session')["userId"]]["isAdmin"]) ||
@$parent["links"]["organizer"][Yii::$container->get('session')["userId"]]) )
((@$parent["links"]["attendees"][Yii::get('session')["userId"]] && @$parent["links"]["attendees"][Yii::get('session')["userId"]]["isAdmin"]) ||
@$parent["links"]["organizer"][Yii::get('session')["userId"]]) )
$params["canManageNews"]=true;
}
$scope=["public","restricted"];
......@@ -183,7 +183,7 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
array("target.id"=>$id,
'$or'=> array(
array("scope.type"=>array('$in'=>$scope)),
array("author"=>Yii::$container->get('session')["userId"])
array("author"=>Yii::get('session')["userId"])
)
)
);
......@@ -358,7 +358,7 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
$params["removeNews"]=$removeNewsArray;
}
if(@$parent){
$params["edit"] = Authorisation::canEditItem(Yii::$container->get('session')["userId"], $type, $parent["_id"]);
$params["edit"] = Authorisation::canEditItem(Yii::get('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::$container->get('session')["userId"], $type, $parent["_id"]);
$params["edit"] = Authorisation::canEditItem(Yii::get('session')["userId"], $type, $parent["_id"]);
$params["openEdition"] = Authorisation::isOpenEdition($parent["_id"], $type, @$parent["preferences"]);
}
if(@Yii::$container->get('session')["userId"]){
if(@Yii::get('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::$container->get('session')["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::$container->get('session')["userId"]][Link::TO_BE_VALIDATED])
if($type!= Event::COLLECTION && @$parent["links"][Element::$connectTypes[$type]][Yii::get('session')["userId"]]
&& !@$parent["links"][Element::$connectTypes[$type]][Yii::get('session')["userId"]][Link::TO_BE_VALIDATED])
$params["canManageNews"]=true;
else if($type==Event::COLLECTION && ((@$parent["links"]["attendees"][Yii::$container->get('session')["userId"]] && @$parent["links"]["attendees"][Yii::$container->get('session')["userId"]]["isAdmin"]) || @$parent["links"]["organizer"][Yii::$container->get('session')["userId"]]) )
else if($type==Event::COLLECTION && ((@$parent["links"]["attendees"][Yii::get('session')["userId"]] && @$parent["links"]["attendees"][Yii::get('session')["userId"]]["isAdmin"]) || @$parent["links"]["organizer"][Yii::get('session')["userId"]]) )
$params["canManageNews"]=true;
}else if($type == Person::COLLECTION && Yii::$container->get('session')["userId"]==$id && $isLive!=true)
}else if($type == Person::COLLECTION && Yii::get('session')["userId"]==$id && $isLive!=true)
$params["canManageNews"]=true;
}
......@@ -93,7 +93,7 @@ class IndexAction extends \PixelHumain\PixelHumain\components\Action
$params["inline"]=$inline;
if (in_array($type,[Organization::COLLECTION, Project::COLLECTION, Event::COLLECTION, Person::COLLECTION]))
$params["deletePending"] = Element::isElementStatusDeletePending($type, $id);
if(Yii::$container->get('request')->isAjax)
if(Yii::get('request')->isAjax)
return $ctrl->renderPartial("news.views.co.index", $params);
else
return $ctrl->render("news.views.co.index", $params);
......
......@@ -64,7 +64,7 @@ class ModerateAction extends \PixelHumain\PixelHumain\components\Action
'isAnAbuse' => $_REQUEST['isAnAbuse']
);
$resAction = Action::addAction(Yii::$container->get('session')["userId"] , $_REQUEST['id'], "news", Action::ACTION_MODERATE, false, false, $details);
$resAction = Action::addAction(Yii::get('session')["userId"] , $_REQUEST['id'], "news", Action::ACTION_MODERATE, false, false, $details);
//Save => OK
if($resAction['userActionSaved']){
......
......@@ -19,7 +19,7 @@ class SaveAction extends \PixelHumain\PixelHumain\components\Action
if(Person::logguedAndValid()){
$result=News::save($_POST);
$user = Person::getById(Yii::$container->get('session')["userId"]);
$user = Person::getById(Yii::get('session')["userId"]);
if(Preference::isActivitypubActivate($user["preferences"]))
Handler::handle(Activitypub::createNoteActivity($_POST), ["newsId"=>(string)$result["object"]["_id"]]);
......
......@@ -15,9 +15,9 @@ class News {
"collection" => self::COLLECTION,
"controller" => self::CONTROLLER,
"module" => self::MODULE,
"assets" => Yii::$container->get('yii\base\Module')->getModule( self::MODULE )->assetsUrl,
"init" => Yii::$container->get('yii\base\Module')->getModule( self::MODULE )->assetsUrl."/js/init.js" ,
"form" => Yii::$container->get('yii\base\Module')->getModule( self::MODULE )->assetsUrl."/js/dynForm.js" ,
"assets" => Yii::get('yii\base\Module')->getModule( self::MODULE )->assetsUrl,
"init" => Yii::get('yii\base\Module')->getModule( self::MODULE )->assetsUrl."/js/init.js" ,
"form" => Yii::get('yii\base\Module')->getModule( self::MODULE )->assetsUrl."/js/dynForm.js" ,
//"categories" => CO2::getModuleContextList(self::MODULE,"categories"),
"lbhp" => true
);
......@@ -159,7 +159,7 @@ class News {
public static function save($params)
{
//check a user is loggued
$user = Person::getById(Yii::$container->get('session')["userId"]);
$user = Person::getById(Yii::get('session')["userId"]);
//TODO : if type is Organization check the connected user isAdmin
if(empty($user))
......@@ -173,7 +173,7 @@ class News {
|| (isset($_POST["mediaFile"]) && !empty($_POST["mediaFile"])))
{
$news=self::prepData($params);
//Yii::$container->get('mongodb')->selectCollection(self::COLLECTION)->insert($news);
//Yii::get('mongodb')->selectCollection(self::COLLECTION)->insert($news);
$news = PHDB::insert(self::COLLECTION, $news);
//NOTIFICATION MENTIONS
......@@ -183,7 +183,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::$container->get('session')["userId"],"type"=>Person::COLLECTION, "name" => Yii::$container->get('session')["user"]["name"]);
$author=array("id" => Yii::get('session')["userId"],"type"=>Person::COLLECTION, "name" => Yii::get('session')["user"]["name"]);
}
Notification::notifyMentionOn($author , $target, $news["mentions"], null, $news["scope"]);
}
......@@ -192,13 +192,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::$container->get('session')["userId"])
else if($params["parentType"]==Person::COLLECTION && $params["parentId"] != Yii::get('session')["userId"])
$target["userWall"]=true;
if($params["parentType"] != Person::COLLECTION || $params["parentId"] != Yii::$container->get('session')["userId"]){
Notification::constructNotification(ActStr::VERB_POST, array("id" => Yii::$container->get('session')["userId"],"name" => Yii::$container->get('session')["user"]["name"]) , $target, null, null, null, $news["text"]);
if($params["parentType"] != Person::COLLECTION || $params["parentId"] != Yii::get('session')["userId"]){
Notification::constructNotification(ActStr::VERB_POST, array("id" => Yii::get('session')["userId"],"name" => Yii::get('session')["user"]["name"]) , $target, null, null, null, $news["text"]);
}
$news=NewsTranslator::convertParamsForNews($news);
$news["author"] = Person::getSimpleUserById(Yii::$container->get('session')["userId"]);
$news["author"] = Person::getSimpleUserById(Yii::get('session')["userId"]);
/* Send email alert to contact@pixelhumain.com */
//if(@$type && $type=="pixels"){
......@@ -213,11 +213,11 @@ class News {
$typeNews=@$params["type"] ? $params["type"] : "news";
$news = array("type" => $typeNews, //"news",
"text" => $params["text"],
"author" => Yii::$container->get('session')["userId"],
"author" => Yii::get('session')["userId"],
"date"=>PHDB::MongoDate(time()),
"collection"=>self::COLLECTION,
"sharedBy"=> array(
array("id"=>Yii::$container->get('session')["userId"],
array("id"=>Yii::get('session')["userId"],
"type"=>Person::COLLECTION,
"updated"=>PHDB::MongoDate(time())
)
......@@ -241,8 +241,8 @@ 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::$container->get('session')["userId"]);
$news["media"]["content"]["image"]= Yii::$container->get('Url')::base()."/".$urlImage;
$urlImage = self::uploadNewsImage($params["media"]["content"]["image"],$params["media"]["content"]["imageSize"],Yii::get('session')["userId"]);
$news["media"]["content"]["image"]= Yii::get('Url')::base()."/".$urlImage;
}
}
if (isset($params["mediaImg"]))
......@@ -341,12 +341,12 @@ class News {
if($authorization===true || (@$countShare && $countShare==1)){
//Delete image
if(isset($news["media"]) && isset($news["media"]["content"]) && isset($news["media"]["content"]["image"]) && !isset($news["media"]["content"]["imageId"])){
$endPath=explode(Yii::$container->get('yii\base\Module')->params['uploadUrl'],$news["media"]["content"]["image"]);
$pathFileDelete= Yii::$container->get('yii\base\Module')->params['uploadDir'].$endPath[1];
$endPath=explode(Yii::get('yii\base\Module')->params['uploadUrl'],$news["media"]["content"]["image"]);
$pathFileDelete= Yii::get('yii\base\Module')->params['uploadDir'].$endPath[1];
/*if(file_exists ( $pathFileDelete ))
unlink($pathFileDelete);*/
if(Yii::$container->get('fs')->has ( $pathFileDelete )) {
Yii::$container->get('fs')->delete($pathFileDelete);
if(Yii::get('fs')->has ( $pathFileDelete )) {
Yii::get('fs')->delete($pathFileDelete);
}
}
......@@ -401,7 +401,7 @@ class News {
);
if(@$shareUpdate){
$followsArrayIds=[];
$parent=Element::getElementSimpleById(Yii::$container->get('session')["userId"],Person::COLLECTION,null, array("links"));
$parent=Element::getElementSimpleById(Yii::get('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);
......@@ -467,14 +467,14 @@ class News {
$allShare = array();
//regarde tous les sharedBy
foreach ($share["sharedBy"] as $key => $value) {
if($value["id"] != Yii::$container->get('session')["userId"]){ //si ce n'est pas moi je garde ce partage
if($value["id"] != Yii::get('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::$container->get('session')["userId"],
array(array( "id" => Yii::get('session')["userId"],
"type"=> Person::COLLECTION,
"comment"=>@$comment,
"updated" => PHDB::MongoDate(time())),
......@@ -491,11 +491,11 @@ class News {
"verb" => $verb,
"target" => array("id" => $targetId,
"type"=> $targetType),
"author" => Yii::$container->get('session')["userId"],
"author" => Yii::get('session')["userId"],
"object" => $activityValue,
"scope" => array("type"=>"restricted"),
"created" => PHDB::MongoDate(time()),
"sharedBy" => array(array( "id" => Yii::$container->get('session')["userId"],
"sharedBy" => array(array( "id" => Yii::get('session')["userId"],
"type"=> Person::COLLECTION,
"comment"=>@$comment,
"updated" => PHDB::MongoDate(time()))),
......@@ -568,10 +568,10 @@ class News {
}else{
$set["media"] = $params["media"];
if(isset($params["media"]["content"]) && isset($params["media"]["content"]["image"]) && !isset($params["media"]["content"]["imageId"])){
$endPath=explode(Yii::$container->get('yii\base\Module')->params['uploadUrl'],$params["media"]["content"]["image"]);
if(isset($endPath[1]) && !empty($endPath[1]) && !file_exists ( Yii::$container->get('yii\base\Module')->params['uploadDir'].$endPath[1])){
$urlImage = self::uploadNewsImage($params["media"]["content"]["image"],$params["media"]["content"]["imageSize"],Yii::$container->get('session')["userId"]);
$set["media"]["content"]["image"]= Yii::$container->get('Url')::base()."/".$urlImage;
$endPath=explode(Yii::get('yii\base\Module')->params['uploadUrl'],$params["media"]["content"]["image"]);
if(isset($endPath[1]) && !empty($endPath[1]) && !file_exists ( Yii::get('yii\base\Module')->params['uploadDir'].$endPath[1])){
$urlImage = self::uploadNewsImage($params["media"]["content"]["image"],$params["media"]["content"]["imageSize"],Yii::get('session')["userId"]);
$set["media"]["content"]["image"]= Yii::get('Url')::base()."/".$urlImage;
}
}
}
......@@ -647,7 +647,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::$container->get('session')["userId"] => array('$exists'=>0)
,"moderate.".Yii::get('session')["userId"] => array('$exists'=>0)
);
if(count($whereAdditional)){
$where = array_merge($where,$whereAdditional);
......@@ -676,11 +676,11 @@ class News {
$upload_dir = $dir.'/'.$folder;
$upload_dir_tmp = $dir.'/tmp';
$returnUrl= Yii::$container->get('yii\base\Module')->params['uploadUrl'].$dir.'/'.$folder;
$returnUrl_tmp= Yii::$container->get('yii\base\Module')->params['uploadUrl'].$dir.'/tmp';
$returnUrl= Yii::get('yii\base\Module')->params['uploadUrl'].$dir.'/'.$folder;
$returnUrl_tmp= Yii::get('yii\base\Module')->params['uploadUrl'].$dir.'/tmp';
if(!Yii::$container->get('fs')->has($upload_dir )) {
Yii::$container->get('fs')->createDir($upload_dir );
if(!Yii::get('fs')->has($upload_dir )) {
Yii::get('fs')->createDir($upload_dir );
}
$name=time()."_".$authorId.".".$ext;
......@@ -703,8 +703,8 @@ class News {
//$tmpfname = tempnam("/tmp", "UL_IMAGE");
if(!Yii::$container->get('fs')->has($upload_dir_tmp)) {
Yii::$container->get('fs')->createDir($upload_dir_tmp);
if(!Yii::get('fs')->has($upload_dir_tmp)) {
Yii::get('fs')->createDir($upload_dir_tmp);
}
$context = stream_context_create(
......@@ -718,7 +718,7 @@ class News {
// file_put_contents($tmpfname, $img);
Yii::$container->get('fs')->put($upload_dir_tmp."/".$name, $img, ['visibility' => 'public']);
Yii::get('fs')->put($upload_dir_tmp."/".$name, $img, ['visibility' => 'public']);
$imageUtils = new ImagesUtils($upload_dir_tmp."/".$name);
......@@ -726,8 +726,8 @@ class News {
$returnUrl=$returnUrl."/".$name;
$imageUtils->resizePropertionalyImage($maxWidth,$maxHeight)->save($destPathThumb,$quality);
if(Yii::$container->get('fs')->has($upload_dir_tmp."/".$name)) {
Yii::$container->get('fs')->delete($upload_dir_tmp."/".$name);
if(Yii::get('fs')->has($upload_dir_tmp."/".$name)) {
Yii::get('fs')->delete($upload_dir_tmp."/".$name);
}
return $returnUrl;
......@@ -798,7 +798,7 @@ class News {
}
public static function addParamsForNewsFromActivitypub($type, $id, $params){
$connectedUserId = Yii::$container->get('session')["userId"];
$connectedUserId = Yii::get('session')["userId"];
$connectedUser = Person::getById($connectedUserId);
$activitypubEnable = Preference::isActivitypubActivate($connectedUser["preferences"]);
......
......@@ -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::$container->get('session')["userId"]){
@$value["id"] == Yii::get('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::$container->get('session')["userId"]){//si j'ai pas la liste des follows de l'element => journal
}else if(@$value["id"] == Yii::get('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::$container->get('session')[ "costum" ][ "app" ][ "#live" ]["title"] ) ) { ?>
<h3 class="title-section col-sm-8"><?php echo Yii::$container->get('session')[ "costum" ][ "app" ][ "#live" ]["title"] ?></h3>
if( isset( Yii::get('session')[ "costum" ][ "app" ][ "#live" ]["title"] ) ) { ?>
<h3 class="title-section col-sm-8"><?php echo Yii::get('session')[ "costum" ][ "app" ][ "#live" ]["title"] ?></h3>
<?php }
if(isset(Yii::$container->get('session')['userId'])){ ?>
if(isset(Yii::get('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::$container->get('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::$container->get('session')["userId"]; ?>"/>
value="<?php if($contextParentType != "city") echo $contextParentId; else echo Yii::get('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::$container->get('session')['userId'])){ ?>
<?php if((@$canManageNews && $canManageNews==true)
|| (@Yii::$container->get('session')["userId"]
|| (@Yii::get('session')["userId"]
&& $contextParentType==Person::COLLECTION
&& Yii::$container->get('session')["userId"]==$contextParentId)){ ?>
&& Yii::get('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::$container->get('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::$container->get('session')["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::$container->get('Url')::base(true).Yii::$container->get('session')["user"]["profilThumbImageUrl"]; ?>'>
<?php if(@Yii::get('session')["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::get('Url')::base(true).Yii::get('session')["user"]["profilThumbImageUrl"]; ?>'>
<?php } else { ?>
<img height=20 width=20 src='<?php echo $this->module->assetsUrl.'/images/thumb/default_citoyens.png' ?>'>
<?php } ?>
......@@ -241,7 +241,7 @@ if(isset(Yii::$container->get('session')['userId'])){ ?>
<a href="javascript:;" class="targetIsAuthor" data-value="1">
<h4 class="list-group-item-heading">
<?php if(@$parent["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::$container->get('Url')::base(true).$parent["profilThumbImageUrl"] ?>'>
<img height=20 width=20 src='<?php echo Yii::get('Url')::base(true).$parent["profilThumbImageUrl"] ?>'>
<?php } else { ?>
<img height=20 width=20 src='<?php echo $this->module->assetsUrl.'/images/thumb/default_'.$contextParentType.'.png' ?>'>
<?php } ?>
......@@ -251,8 +251,8 @@ if(isset(Yii::$container->get('session')['userId'])){ ?>
</li>
<li>
<a href="javascript:;" class="targetIsAuthor" data-value="0"><h4 class="list-group-item-heading">
<?php if(@Yii::$container->get('session')["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::$container->get('Url')::base(true).Yii::$container->get('session')["user"]["profilThumbImageUrl"]; ?>'>
<?php if(@Yii::get('session')["user"]["profilThumbImageUrl"]){ ?>
<img height=20 width=20 src='<?php echo Yii::get('Url')::base(true).Yii::get('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::$container->get('session')['userId'])){ ?>
<?php if(!@$contextParentType || $contextParentType=="city"){ ?>
<input type="hidden" name="scope" value="public"/>
<?php } else if((@$canManageNews && $canManageNews=="true") || (
@Yii::$container->get('session')["userId"] &&
$contextParentType==Person::COLLECTION && Yii::$container->get('session')["userId"]==$contextParentId)){
@Yii::get('session')["userId"] &&
$contextParentType==Person::COLLECTION && Yii::get('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::$container->get('session')['userId'])){ ?>
<?php } else {
if( isset( Yii::$container->get('session')[ "costum" ][ "app" ][ "#live" ]["showAskLogin"] )
&& Yii::$container->get('session')[ "costum" ][ "app" ][ "#live" ]["showAskLogin"] == false ) {
if( isset( Yii::get('session')[ "costum" ][ "app" ][ "#live" ]["showAskLogin"] )
&& Yii::get('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::$container->get('session')["userId"]) ) echo $this->renderPartial('modalShare', array()); ?>
if( isset(Yii::get('session')["userId"]) ) echo $this->renderPartial('modalShare', array()); ?>
<script type="text/javascript" >
modules.news = <?php echo json_encode( News::getConfig() ) ?> ;
......@@ -60,7 +60,7 @@
var canPostNews = <?php echo json_encode(@$canPostNews) ?>;
var timelineHtml = <?php echo json_encode(@$timelineHtml) ?>;
var canManageNews = <?php echo json_encode(@$canManageNews) ?>;
var uploadUrl = "<?php echo Yii::$container->get('yii\base\Module')->params['uploadUrl'] ?>";
var uploadUrl = "<?php echo Yii::get('yii\base\Module')->params['uploadUrl'] ?>";
var docType="<?php echo Document::DOC_TYPE_IMAGE; ?>";
var contentKey = "<?php echo Document::IMG_SLIDER; ?>";
var urlData=baseUrl+"/news/co/get";
......
......@@ -81,8 +81,8 @@
<div class="col-sm-12 container text-left">
<?php
$marginClass="margin-top-50";
if(isset(Yii::$container->get('session')['userId'])){
$me = Element::getByTypeAndId(Person::COLLECTION, Yii::$container->get('session')['userId']);
if(isset(Yii::get('session')['userId'])){
$me = Element::getByTypeAndId(Person::COLLECTION, Yii::get('session')['userId']);
$profilThumbImageUrl = Element::getImgProfil($me, "profilThumbImageUrl", $this->module->assetsUrl);
$marginClass="margin-top-10";
?>
......
......@@ -7,7 +7,7 @@ $cssAnsScriptFilesModule = array(
'/js/news.js',
'/js/init.js'
);