Files
Testing/js/whatshot/get_member_blogs.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

109 lines
3.9 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php header('Content-type: application/json; charset=utf-8');
ini_set('display_errors', 0);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/');
include_once(PATHTOINCLUDES."bebop/regular.php");
date_default_timezone_set('UTC'); // don't know
//http://www.the-art-of-web.com/php/truncate/;
function myTruncate($string, $limit, $break=".", $pad="...")
{
// return with no change if string is shorter than $limit
if(strlen($string) <= $limit) return $string;
// is $break present between $limit and the end of the string?
if(false !== ($breakpoint = strpos($string, $break, $limit))) {
if($breakpoint < strlen($string) - 1) {
$string = substr($string, 0, $breakpoint) . $pad;
}
}
return $string;
}
$em="";
$sql="SELECT
`se_blogentries`.`blogentry_id`,
`se_blogentries`.`blogentry_user_id`,
`se_blogentries`.`blogentry_date`,
`se_blogentries`.`blogentry_views`,
`se_blogentries`.`blogentry_title`,
`se_blogentries`.`blogentry_body`,
`se_blogentries`.`blogentry_search`,
`se_blogentries`.`blogentry_privacy`,
`se_blogentries`.`blogentry_comments`,
`se_blogentries`.`blogentry_totalcomments`,
`se_blogentries`.`blogentry_id`,
`se_blogentries`.`blogentry_user_id`,
`se_blogentries`.`blogentry_date`,
`se_blogentries`.`blogentry_views`,
`se_blogentries`.`blogentry_title`,
`se_blogentries`.`blogentry_body`,
`se_blogentries`.`blogentry_search`,
`se_blogentries`.`blogentry_privacy`,
`se_blogentries`.`blogentry_comments`,
`se_blogentries`.`blogentry_totalcomments`,
`se_users`.`user_id`,
`se_users`.`user_username`,
`se_users`.`user_blocklist`,
`se_users`.`thumb`,
`se_users`.`user_photo`
FROM
`se_blogentries`
Right Outer Join `se_users` ON `se_users`.`user_id` = `se_blogentries`.`blogentry_user_id`
WHERE
`se_blogentries`.`blogentry_user_id` <> 70022 AND `se_blogentries`.`blogentry_privacy` = 31 AND `se_users`.`user_wh_privacy` = 'N' AND `se_blogentries`.`blogentry_user_id` <> 70695 AND `se_users`.`user_enabled` = 1
ORDER BY
`se_blogentries`.`blogentry_date` DESC,
`se_blogentries`.`blogentry_comments` DESC,
`se_blogentries`.`blogentry_views` DESC
LIMIT 8";
$result=$database->database_query($sql) or $em.= $database->database_error();
//echo error_reporting();
while ($row = $database->database_fetch_array($result)) {
$blocklist = explode(",", $row["user_blocklist"]);
if(!isset($_GET["uid"])){$_GET["uid"]=-1;}
$key = array_search($_GET["uid"], $blocklist);//array search will only evaluate to false or not false;
$_GET["ubl"]="";
if($key!==false){continue;}
$viewerbl=explode(",", $_GET["ubl"]);
$vkey = array_search($row["user_id"], $viewerbl);//array search will only evaluate to false or not false;
if($vkey!==false){continue;}
$weirdnumber = (((int)($row["blogentry_user_id"]/1000))*1000)+1000;
$bimage="/uploads_user/".$weirdnumber."/".$row["blogentry_user_id"]."/".$row["user_photo"];
$chkbimage=$_SERVER["DOCUMENT_ROOT"].$bimage;
if(!is_file($chkbimage))
{
$bimage="/images/nophoto.png";
}
$buname=$row["user_username"];
$bid=$row["blogentry_id"];
$btitle=$row["blogentry_title"];
//echo $btitle;
//$btitle=htmlentities($btitle);
//echo $btitle;
//$btitle="Ten signs you\’re totally addicted to masturbation";
$btitle=htmlentities($btitle, ENT_QUOTES, 'UTF-8');
//$htmlfreecontent = strip_tags(html_entity_decode($row["blogentry_body"]));
//$htmlfreecontent = str_replace('&#160;','',$htmlfreecontent);
//$bsdesc = myTruncate($htmlfreecontent, 70);
$bviews=$row["blogentry_views"];
$bcomments=$row["blogentry_totalcomments"];
break;
}
$bsdesc="";
if($btitle==""){$btitle="Read Blog";}
$arr = array ('error'=>$em, 'uimg'=>$bimage, 'uname'=>$buname, 'bid'=>$bid, 'btitle'=>$btitle, 'bdesc'=> $bsdesc, 'bviews'=>$bviews, 'bcom' => $bcomments);
echo json_encode($arr);
?>