<commit_before><?php
// Initialization
require_once('tiki-setup.php');

if($feature_blogs != 'y') {
  $smarty->assign('msg',tra("This feature is disabled"));
  $smarty->display('error.tpl');
  die;  
}

if(!isset($_REQUEST["blogId"])) {
  $smarty->assign('msg',tra("No blog indicated"));
  $smarty->display('error.tpl');
  die;  
}

$smarty->assign('individual','n');
if($userlib->object_has_one_permission($_REQUEST["blogId"],'blog')) {
  $smarty->assign('individual','y');
  if($tiki_p_admin != 'y') {
    // Now get all the permissions that are set for this type of permissions 'image gallery'
    $perms = $userlib->get_permissions(0,-1,'permName_desc','','blogs');
    foreach($perms["data"] as $perm) {
      $permName=$perm["permName"];
      if($userlib->object_has_permission($user,$_REQUEST["blogId"],'blog',$permName)) {
        $$permName = 'y';
        $smarty->assign("$permName",'y');
      } else {
        $$permName = 'n';
        $smarty->assign("$permName",'n');
      }
    }
  }
}
if($tiki_p_blog_admin == 'y') {
  $tiki_p_create_blogs = 'y';
  $smarty->assign('tiki_p_create_blogs','y');
  $tiki_p_blog_post = 'y';
  $smarty->assign('tiki_p_blog_post','y');
  $tiki_p_read_blog = 'y';
  $smarty->assign('tiki_p_read_blog','y');
}

if($tiki_p_read_blog != 'y') {
  $smarty->assign('msg',tra("Permission denied you cant view this section"));
  $smarty->display('error.tpl');
  die;  
}



$blog_data = $tikilib->get_blog($_REQUEST["blogId"]);
if($user) {
  if($user == $blog_data["user"]) {
    $ownsblog = 'y';
  } else {
    $ownsblog = 'n';
  }
}
$smarty->assign('ownsblog',$ownsblog);
if(!$blog_data) {
  $smarty->assign('msg',tra("Blog not found"));
  $smarty->display('error.tpl');
  die;  
}
$tikilib->add_blog_hit($_REQUEST["blogId"]);
$smarty->assign('blogId',$_REQUEST["blogId"]);
$smarty->assign('title',$blog_data["title"]);
$smarty->assign('description',$blog_data["description"]);
$smarty->assign('created',$blog_data["created"]);
$smarty->assign('lastModif',$blog_data["lastModif"]);
$smarty->assign('posts',$blog_data["posts"]);
$smarty->assign('public',$blog_data["public"]);
$smarty->assign('hits',$blog_data["hits"]);
$smarty->assign('creator',$blog_data["user"]);
$smarty->assign('activity',$blog_data["activity"]);

if(isset($_REQUEST["remove"])) {
  $data = $tikilib->get_post($_REQUEST["remove"]);
  if(!$ownsblog) {
    if(!$user || $data["user"]!=$user) {
      if($tiki_p_blog_admin != 'y') {<commit_msg>Bugfix: Warning: Undefined variable: ownsblog<commit_after><?php
// Initialization
require_once('tiki-setup.php');

if($feature_blogs != 'y') {
  $smarty->assign('msg',tra("This feature is disabled"));
  $smarty->display('error.tpl');
  die;  
}

if(!isset($_REQUEST["blogId"])) {
  $smarty->assign('msg',tra("No blog indicated"));
  $smarty->display('error.tpl');
  die;  
}

$smarty->assign('individual','n');
if($userlib->object_has_one_permission($_REQUEST["blogId"],'blog')) {
  $smarty->assign('individual','y');
  if($tiki_p_admin != 'y') {
    // Now get all the permissions that are set for this type of permissions 'image gallery'
    $perms = $userlib->get_permissions(0,-1,'permName_desc','','blogs');
    foreach($perms["data"] as $perm) {
      $permName=$perm["permName"];
      if($userlib->object_has_permission($user,$_REQUEST["blogId"],'blog',$permName)) {
        $$permName = 'y';
        $smarty->assign("$permName",'y');
      } else {
        $$permName = 'n';
        $smarty->assign("$permName",'n');
      }
    }
  }
}
if($tiki_p_blog_admin == 'y') {
  $tiki_p_create_blogs = 'y';
  $smarty->assign('tiki_p_create_blogs','y');
  $tiki_p_blog_post = 'y';
  $smarty->assign('tiki_p_blog_post','y');
  $tiki_p_read_blog = 'y';
  $smarty->assign('tiki_p_read_blog','y');
}

if($tiki_p_read_blog != 'y') {
  $smarty->assign('msg',tra("Permission denied you cant view this section"));
  $smarty->display('error.tpl');
  die;  
}



$blog_data = $tikilib->get_blog($_REQUEST["blogId"]);
$ownsblog = 'n';
if($user && $user == $blog_data["user"]) {
    $ownsblog = 'y';
}
$smarty->assign('ownsblog',$ownsblog);
if(!$blog_data) {
  $smarty->assign('msg',tra("Blog not found"));
  $smarty->display('error.tpl');
  die;  
}
$tikilib->add_blog_hit($_REQUEST["blogId"]);
$smarty->assign('blogId',$_REQUEST["blogId"]);
$smarty->assign('title',$blog_data["title"]);
$smarty->assign('description',$blog_data["description"]);
$smarty->assign('created',$blog_data["created"]);
$smarty->assign('lastModif',$blog_data["lastModif"]);
$smarty->assign('posts',$blog_data["posts"]);
$smarty->assign('public',$blog_data["public"]);
$smarty->assign('hits',$blog_data["hits"]);
$smarty->assign('creator',$blog_data["user"]);
$smarty->assign('activity',$blog_data["activity"]);

if(isset($_REQUEST["remove"])) {
  $data = $tikilib->get_post($_REQUEST["remove"]);
  if(!$ownsblog) {
    if(!$user || $data["user"]!=$user) {
      if($tiki_p_blog_admin != 'y') {
{'fraction_non_alphanumeric': 0.24460285132382892, 'fraction_numerical': 0.000814663951120163, 'mean_word_length': 5.946251768033946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2815323', 'n_tokens_mistral': 1868, 'n_tokens_neox': 1853, 'n_words': 221}