I saw this piece of code which does not use a bracket or : before the if/else statement. I thought that every statement should start with { or : What is the reason they do not use it here?
if (!$this->Article)
throw NotFoundException('Article');
// Set required permission.
$UserModel = new UserModel();
if ($this->Article->Status != ArticleModel::STATUS_PUBLISHED)
if (($this->Article->AttributionUserID == Gdn::Session()->UserID)
&& !$UserModel->CheckPermission($this->Article->AttributionUserID, 'Articles.Articles.Edit')
)
$this->Permission('Articles.Articles.View');
else
$this->Permission('Articles.Articles.Edit');
else
$this->Permission('Articles.Articles.View');
Aucun commentaire:
Enregistrer un commentaire