function manage_links($contents_list)
 {
     global $base_url;
     $cnt = count($contents_list);
     $link_array = array();
     if ($cnt > 0) {
         // Loading all users
         for ($i = 0; $i < $cnt; $i++) {
             $user_listing[$i] = $contents_list[$i]['user_id'];
         }
         $usr = new User();
         $user_info = $usr->load_users($user_listing, 'user_id');
         $cnt_no = count($user_info);
         for ($j = 0; $j < $cnt_no; $j++) {
             $user_array[$user_info[$j]['user_id']] = $user_info[$j]['login_name'];
         }
         for ($i = 0; $i < $cnt; $i++) {
             $link_array[$i]['time'] = $contents_list[$i]['created'];
             $link_array[$i]['comment'] = $contents_list[$i]['comment'];
             $link_array[$i]['comment_title'] = $contents_list[$i]['comment_title'];
             $link_array[$i]['type'] = 'comment';
             $link_array[$i]['author_id'] = $contents_list[$i]['user_id'];
             if ($link_array[$i]['author_id'] == ANONYMOUS_USER_ID) {
                 $link_array[$i]['author_name'] = 'Anonymous';
             } else {
                 $login = User::get_login_name_from_id($link_array[$i]['author_id']);
                 $current_url = $base_url . '/' . FILE_USER_BLOG . '?uid=' . $link_array[$i]['author_id'];
                 $url_perms = array('current_url' => $current_url, 'login' => $login);
                 $url = get_url(FILE_USER_BLOG, $url_perms);
                 $link_array[$i]['author_name'] = '<a href="' . $url . '">' . $user_array[$contents_list[$i]['user_id']] . '</a>';
             }
             $link_array[$i]['comment_id'] = $contents_list[$i]['comment_id'];
             $link_array[$i]['delete_url'] = $base_url . '/deletecomment.php?comment&comment_id=' . $link_array[$i]['comment_id'];
             $link_array[$i]['hyper_link'] = $base_url . '/content.php?cid=' . $contents_list[$i]['content_id'];
             // Here we calcuting the number of total abuse on comment
             $link_array[$i]['abuses'] = total_abuse($contents_list[$i]['comment_id'], TYPE_COMMENT);
         }
     }
     // End of If condition
     return $link_array;
 }
 function manage_content($contents_list)
 {
     global $base_url, $login_uid;
     $i = 0;
     if (empty($contents_list)) {
         $contents_list = array();
     }
     $new_content = array();
     foreach ($contents_list as $contt) {
         $new_content[$i]['content_id'] = $contt['content_id'];
         $new_content[$i]['title'] = $contt['title'];
         $new_content[$i]['body'] = $contt['body'];
         $new_content[$i]['author_id'] = $contt['author_id'];
         $new_content[$i]['type'] = $contt['type'];
         $new_content[$i]['changed'] = $contt['changed'];
         $new_content[$i]['created'] = $contt['created'];
         $new_content[$i]['type_name'] = $contt['type_name'];
         $new_content[$i]['comment_count'] = $contt['comment_count'];
         $new_content[$i]['author_name'] = $contt['author_name'];
         $new_content[$i]['content_type_id'] = $contt['content_type_id'];
         if (!empty($contt['parent_info'])) {
             $type = $contt['parent_info']['type'] == ALBUM_COLLECTION_TYPE ? 'Album' : 'Group';
             $new_content[$i]['parent_name'] = $contt['parent_info']['title'] . '(' . $type . ')';
         }
         // Route media and normal content through to the correct display/editing pages
         if (!in_array($contt['content_type_id'], array(IMAGE, AUDIO, VIDEO))) {
             $link_for_editing = $base_url . "/post_content.php?cid=" . $new_content[$i]['content_id'];
             $image_hyperlink = $base_url . "/content.php?cid=" . $new_content[$i]['content_id'];
         } else {
             $link_for_editing = $base_url . "/edit_media.php?uid=" . $login_uid . "&amp;cid=" . $new_content[$i]['content_id'] . "&amp;type=image";
             $image_hyperlink = $base_url . "/media_full_view.php?gid&cid=" . $new_content[$i]['content_id'];
         }
         $new_content[$i]['edit_link'] = $link_for_editing;
         $new_content[$i]['hyper_link'] = $image_hyperlink;
         $new_content[$i]['abuses'] = total_abuse($contt['content_id'], TYPE_CONTENT);
         $i++;
     }
     return $new_content;
 }