( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
// Define a new class based on an existing class
class NewsSQL extends DBSQL
{
// Method to test if the DBSQL is also a square
public function isSquare(){
if($this->length == $this->width){
return true; // Square
} else{
return false; // Not a square
}
}
function getmycampaign($view1)
{
$sql = "select * from campaign where newsid='$view1'";
$result = $this->select($sql);
return $result;
}
function twitterphotos()
{
$sql = "select * from raw_tweets order by tweetid limit 0,400";
$result = $this->select($sql);
return $result;
}
function twittermedia()
{
$sql = "select * from tweets_media order by newsid";
$result = $this->select($sql);
return $result;
}
function layersTheme($id)
{
global $link;
$sql = "select * from layerorder where themeid='$id'";
$result = $this->select($sql);
$layers = $result[0]["layers"];
return $layers;
}
function checkFontNew($name)
{
global $link;
$sql = "select * from brandfonts where name LIKE '%$name%' and (isdisplay='3' OR isdisplay='8' OR isdisplay='1') order by fontid DESC LIMIT 0,1";
$result = $this->select($sql);
$filename = $result[0]["filename"]. ".ttf";
$name = $result[0]["name"];
if ((strpos($filename, '[') !== false) ||(strpos($result[0]["description"], '[') !== false)) {
$theString = "{ family: 'Bebas Neue', src: '../../assets/fonts/BebasNeue.ttf' },";
}
else{
$theString = "{ family: '$name', src: '../../assets/fonts/$filename' },";
}
return $theString ;
}
function checkFontNewX($name)
{
global $link;
$sql = "select * from brandfonts where name LIKE '%$name%' and (weight='400' OR weight='800' ) and style='normal' order by fontid DESC LIMIT 0,1";
$result = $this->select($sql);
$filename = $result[0]["filename"]. ".ttf";
$name = $result[0]["name"];
if ((strpos($filename, '[') !== false) ||(strpos($result[0]["description"], '[') !== false)) {
$theString = "{ family: 'Bebas Neue', src: '../../assets/fonts/BebasNeue.ttf' },";
}
else{
$theString = "{ family: '$name', src: '../../assets/fonts/$filename' },";
}
return $theString ;
}
function checkFontNewGoogle($name)
{
global $link;
$sql = "select * from gfonts where fullName LIKE '%$name%' order by fontid ASC LIMIT 0,1";
$result = $this->select($sql);
$filename = basename($result[0]["url"]);
$name = $result[0]["fullName"];
$theString = "{ family: '$name', src: '../../assets/gfonts2/$filename' },";
return $theString ;
}
function checkFontNewGoogleV2($name)
{
global $link;
$sql = "select * from gfonts where fullName LIKE '%$name%' order by fontid ASC LIMIT 0,1";
$result = $this->select($sql);
$filename = basename($result[0]["url"]);
$name = $result[0]["family"];
$theString = '<link rel="stylesheet" href="css.php?name='.$name.'&filename='.$filename.'" media="all">';
$theString = "
@font-face {
font-family: '$name';
font-style: normal;
font-weight: 400;
src: url(https://www.thebrand.ai/assets/gfonts2/$filename) format('ttf');
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
} \n";
return $theString ;
}
function checkStyleNew($name)
{
global $link;
$sql = "select * from brandfonts where name LIKE '%$name%' and (isdisplay='3' OR isdisplay='8' OR isdisplay='1') order by fontid DESC LIMIT 0,1";
$result = $this->select($sql);
$filename = $result[0]["filename"]. ".ttf";
$name = $result[0]["name"];
if ((strpos($filename, '[') !== false) ||(strpos($result[0]["descrption"], '[') !== false)) {
}
else{
$theStyle = "@font-face {
font-family: '$name';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(../assets/fonts/$filename) format('ttf');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}";
}
return $theStyle ;
}
function checkStyleNewGoogle($name)
{
global $link;
$sql = "select * from gfonts where fullName LIKE '%$name%' order by fontid ASC LIMIT 0,1";
$result = $this->select($sql);
$filename = basename($result[0]["url"]);
$name = $result[0]["fullName"];
$theStyle = "@font-face {
font-family: '$name';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(../assets/gfonts2/$filename) format('ttf');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}";
return $theStyle ;
}
function getEachLayerJson($themeid,$layerPosition)
{
global $link;
$sql = "select * from layerorder where themeid='$themeid' and graphic_order ='$layerPosition'";
$result = $this->select($sql);
$layers = $result[0]["layers2"];
return $layers;
}
function getEachLayerJsonV2($themeid,$layerPosition)
{
global $link;
$sql = "select * from layerorder where themeid='$themeid' and graphic_order ='$layerPosition'";
$result = $this->select($sql);
if(!empty($result[0]["layers3"])) {
$layers3 = $result[0]["layers3"];
return $layers3;
}
else
{
include("includes/processFunctionsX.php");
$theJson = $result[0]["layers2"];
$old_json = json_decode($theJson); // decode old json string
$height = $old_json->canvasHeight;
$width = $old_json->canvasWidth;
include("TheBrandZ/jsonb.php");
$json = $jsonheader.$json;
$json = $json.$jsonfooter;
$json = html_entity_decode($json);
return $json;
}
}
function checkHttps() {
$isSecure = false;
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$isSecure = true;
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
$isSecure = true;
}
return $REQUEST_PROTOCOL = $isSecure ? 'https' : 'http';
}
function multi_thread_curl($urlArray, $optionArray, $nThreads) {
//Group your urls into groups/threads.
$curlArray = array_chunk($urlArray, $nThreads, $preserve_keys = true);
//Iterate through each batch of urls.
$ch = 'ch_';
foreach($curlArray as $threads) {
//Create your cURL resources.
foreach($threads as $thread=>$value) {
${$ch . $thread} = curl_init();
curl_setopt_array(${$ch . $thread}, $optionArray); //Set your main curl options.
curl_setopt(${$ch . $thread}, CURLOPT_URL, $value); //Set url.
}
//Create the multiple cURL handler.
$mh = curl_multi_init();
//Add the handles.
foreach($threads as $thread=>$value) {
curl_multi_add_handle($mh, ${$ch . $thread});
}
$active = null;
//execute the handles.
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
//Get your data and close the handles.
foreach($threads as $thread=>$value) {
$results[$thread] = curl_multi_getcontent(${$ch . $thread});
curl_multi_remove_handle($mh, ${$ch . $thread});
}
//Close the multi handle exec.
curl_multi_close($mh);
}
return $results;
}
public function checkIfJoined($teamid,$me)
{
global $link;
$sql ="select * FROM `share` WHERE themeid='$teamid' and friend_two='$me' ";
$result = $this->select($sql);
return $result;
}
public function listNotification($who)
{
global $link;
$sql ="select * FROM `notifications` WHERE (catalogid='0' and yanani='$who') or (catalogid='$who') or (yanani='$who') order by msg_id desc";
$result = $this->select($sql);
return $result;
}
function randomPrefix($length)
{
$random= "";
$data = "AbcDE123IJKLMN67QRSTUVWXYZ";
$data .= "aBCdefghijklmn123opq45rs67tuv89wxyz";
$data .= "0FGH45OP89";
for($i = 0; $i < $length; $i++)
{
$random .= substr($data, (rand()%(strlen($data))), 1);
}
return $random;
}
function checkIfNew($newsid)
{
$sql = "SELECT * FROM campaign where `newsid` ='$newsid' and `description` ='1'";
$result = $this->select($sql);
if (!empty($result)) {
$resultX=1;
}
else
{
$resultX=0;
}
return $resultX;
}
function showCampaign($newsid)
{
$sql = "SELECT * FROM campaign where `newsid` ='$newsid'";
$result = $this->select($sql);
return $result;
}
function Insert_Font_New($description,$category,$weight,$style,$jina,$new_name,$isdisplay,$type)
{
$sql = "SELECT * FROM brandfonts WHERE name LIKE '%$description%';";
$result = $this->select($sql);
$id = $result[0]["fontid"];
if(empty($id))
{
echo $sql = "INSERT INTO `brandfonts` (description,category,weight,style,name,filename,isdisplay,type) VALUES ('$description','$category','$weight','$style','$jina','$new_name','$isdisplay','$type'); ";
//$results = $this->insert($sql);
echo "$new_name added ............................................... <br>";
}
else{
echo "$new_name already existing ............................................... <br>";
}
}
function Insert_Font_Gfonts($id,$family,$fullName,$postScriptName,$preview,$style,$url,$category)
{
global $link;
$query = mysqli_query($link,"SELECT id FROM `gfonts` WHERE id='$id' order by fontid desc limit 1") or die(mysql_error());
$result = mysqli_fetch_array($query);
if (empty($result['fontid'])) {
//$query = mysqli_query($link,"INSERT INTO `gfonts` (id,family,fullName,postscriptname,preview,style,url,category) VALUES ('$id','$family','$fullName','$postScriptName','$preview','$style','$url','$category')") or die(mysql_error());
echo "ADDED:$fullName <br>";
}
}
function Insert_Templates_New($id,$family,$fullName,$postScriptName,$preview,$style,$url,$category)
{
global $link;
$query = mysqli_query($link,"SELECT id FROM `gfonts` WHERE id='$id' order by fontid desc limit 1") or die(mysql_error());
$result = mysqli_fetch_array($query);
if (empty($result['fontid'])) {
//$query = mysqli_query($link,"INSERT INTO `gfonts` (id,family,fullName,postscriptname,preview,style,url,category) VALUES ('$id','$family','$fullName','$postScriptName','$preview','$style','$url','$category')") or die(mysql_error());
echo "ADDED:$fullName <br>";
}
}
function Insert_Font($category,$weight,$style,$name,$filename,$isdisplay,$type)
{
/* $filename=mysql_real_escape_string($filename);
global $link;
$query = mysqli_query($link,"SELECT fontid FROM `brandfonts` WHERE filename='$filename' order by fontid desc limit 1") or die(mysql_error());
$result = mysqli_fetch_array($query);
if (empty($result['fontid'])) {
global $link;
$query = mysqli_query($link,"INSERT INTO `brandfonts` (category,weight,style,name,filename,isdisplay) VALUES ('$category','$weight','$style','$name','$filename','$isdisplay')") or die(mysql_error());
echo "ADDED: $weight- ".$name."-". $filename."<br>";
}
*/
}
function wysiwygTheme($id)
{ global $link;
$sql = "select * from layerorder where themeid='$id' and type='2' limit 0,1";
$result = $this->select($sql);
$id = $result[0]["id"];
return $id;
}
function getEachLayer($myTheme,$catalogid,$position)
{
$sql = "select * from layerorder where themeid='$myTheme' and catalogid='$catalogid' and position=$position";
$resultLayer = $this->select($sql);
return $resultLayer;
}
function checkLayerType($brand)
{
global $link; if (strpos($brand, 'route=theUpdate') !== false){$type = "theUpdate" ; }
if (strpos($brand, 'route=thePlain') !== false){$type = "thePlain" ; }
if (strpos($brand, 'route=theUrl') !== false){$type = "theUrl" ; }
if (strpos($brand, 'route=theName') !== false){$type = "theName" ; }
if (strpos($brand, 'route=profile') !== false){$type = "theProfile" ; }
if (strpos($brand, 'route=theUser') !== false){$type = "theUser" ; }
if (strpos($brand, 'route=theGraphics') !== false){$type = "theGraphics" ; }
if (strpos($brand, '/filters/mood/') !== false){$type = "theGraphics" ; }
if (strpos($brand, 'route=profilePic') !== false){$type = "ProfilePic" ; }
if (strpos($brand, 'v/uploads/gthumbs') !== false){$type = "Uploaded" ; }
return $type;
}
function checkTypeA($brand)
{
global $link;if (strpos($brand, 'route=theUpdate') !== false){$type = "theUpdate" ; }
if (strpos($brand, 'route=theUrl') !== false){$type = "theUrl" ; }
if (strpos($brand, 'route=theName') !== false){$type = "theName" ; }
if (strpos($brand, 'route=profile') !== false){$type = "theProfile" ; }
if (strpos($brand, '/filters/mood') !== false){$type = "theGraphics" ; }
if (strpos($brand, 'route=profilePic') !== false){$type = "ProfilePic" ; }
if (strpos($brand, 'v/uploads/gthumbs') !== false){$type = "Uploaded" ; }
return $type;
}
function multiRequest($data, $options = array()) {
global $link;
// array of curl handles
$curly = array();
// data to be returned
$result = array();
// multi handle
$mh = curl_multi_init();
// loop through $data and create curl handles
// then add them to the multi-handle
foreach ($data as $id => $d) {
$curly[$id] = curl_init();
$url = (is_array($d) && !empty($d['url'])) ? $d['url'] : $d;
curl_setopt($curly[$id], CURLOPT_URL, $url);
curl_setopt($curly[$id], CURLOPT_HEADER, 0);
curl_setopt($curly[$id], CURLOPT_RETURNTRANSFER, 1);
// post?
if (is_array($d)) {
if (!empty($d['post'])) {
curl_setopt($curly[$id], CURLOPT_POST, 1);
curl_setopt($curly[$id], CURLOPT_POSTFIELDS, $d['post']);
}
}
// extra options?
if (!empty($options)) {
curl_setopt_array($curly[$id], $options);
}
curl_multi_add_handle($mh, $curly[$id]);
}
// execute the handles
$running = null;
do {
curl_multi_exec($mh, $running);
} while($running > 0);
// get content and remove handles
foreach($curly as $id => $c) {
$result[$id] = curl_multi_getcontent($c);
curl_multi_remove_handle($mh, $c);
}
// all done
curl_multi_close($mh);
return $result;
}
function textLimit($str,$limit=10)
{ global $link;
if(stripos($str," "))
{
$ex_str=explode(" ",$str);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
return $str_s;
}
else{
return $str;
}
}else{
return $str;
}
}
function username($catalogid)
{
global $link; $nani = $catalogid;
$rs_settings = mysqli_query($link,"select * from users where catalogid='$nani'");
while ($row_settings = mysqli_fetch_array($rs_settings)) {
$un = strtolower($row_settings['user_name']);
return $un ; }
}
function removeslashes($string)
{
global $link;$string=implode("",explode("\\",$string));
return stripslashes(trim($string));
}
function user($catalogid)
{
global $link;
$nani = $catalogid;
$rs_settings = mysqli_query($link,"select * from users where catalogid='$nani'");
while ($row_settings = mysqli_fetch_array($rs_settings)) {
$ca = $row_settings['catalogname'] ;
return $ca ;
}
}
function addUser($fullname2,$ids,$value1,$value2,$fullname,$level_expiry,$users_ip,$email2,$email,$timezone,$package,$permission,$activation_code,$activation_key,$reset_key,$expiration_date,$expiry_datetime,$status,$last_login,$changed,$login_type,$password,$pwd,$admin,$approved,$banned,$user_name,$date)
{
global $link;
$created = date("Y-m-d H:i:s");
$birthday = date("Y-m-d");
$sql = "INSERT into `users` (`catalogname`,`ids`,`parentid`,`catalogid`,`fullname`,`level_expiry`,`users_ip`,`email`,`user_email`,`timezone`,`package`,`permission`,`activation_code`,`activation_key`,`reset_key`,`expiration_date`,`expiry_datetime`,`status`,`last_login`,`changed`,`login_type`,`password`,`pwd`,`admin`,`approved`,`banned`,`user_name`,`date`,`created`)
VALUES
('$fullname','$ids','$value1','$value2','$fullname','$level_expiry','$users_ip','$email','$email','$timezone','$package','$permission','$activation_code','$activation_key','$reset_key','$expiration_date','$expiry_datetime','$status','$last_login','$changed','$login_type','$password','$pwd','$admin','$approved','$banned','$user_name','$date','$created')";
$newid = $this->insert($sql);
$sql = "update users set catalogid='$newid',slug='$user_name' WHERE id='$newid'";
$results = $this->update($sql);
return $newid;
}
function addFont($catalogid5 ,$themeid)
{
global $link;
$myidis = $_SESSION['euserid'];
$text = "Lorem Ipsum is simply dummy text of the printing, digital and typesetting industry. ";
$sql = "
INSERT INTO textlayer (catalogid, themeid, font_Username, font_Name, font_Url, font_Text, text_w, text_h, text_line_height, text_x, text_y, text_align, text_size, text_color, url_color, name_color, username_color, url_size, name_size, username_size, text_pad, text) VALUES
('$myidis', '$themeid', 'MyriadPro-Semibold.otf', 'HelveticaNeueLTStd-UltLt.otf', 'HelveticaNeueLTStd-UltLt.otf', 'HelveticaNeueLTStd-BdCn.otf', '500', '0', '30', '50', '223', 'center', '28', 'ffffff', 'ffffff', 'ffffff', 'ffffff', '30', '20', '20', '30','$text')";
$results = $this->insert($sql);
return $results;
}
function updateFont($catalogid5 ,$themeid)
{
global $link;
$myidis = $_SESSION['euserid'];
$text = "Lorem Ipsum is simply dummy text of the printing, digital and typesetting industry. ";
$sql = "
INSERT INTO textlayer (catalogid, themeid, font_Username, font_Name, font_Url, font_Text, text_w, text_h, text_line_height, text_x, text_y, text_align, text_size, text_color, url_color, name_color, username_color, url_size, name_size, username_size, text_pad, text) VALUES
('$myidis', '$themeid', 'MyriadPro-Semibold.otf', 'HelveticaNeueLTStd-UltLt.otf', 'HelveticaNeueLTStd-UltLt.otf', 'HelveticaNeueLTStd-BdCn.otf', '500', '0', '30', '0', '0', 'center', '28', 'ffffff', 'ffffff', 'ffffff', 'ffffff', '30', '20', '20', '30','$text')";
$results = $this->insert($sql);
return $results;
}
function deleteMessaging($catalogid,$newsid)
{
global $link;
$sql = "delete from tweets where catalogid='$catalogid' and id='$newsid'";
$sql = "delete from tweets where id='$newsid'";
$result = $this->delete($sql);
}
function clearEmptyFonts()
{ global $link;$sql = "delete from brandfonts where type IS 'NULL' and isdisplay='3'";
$result = $this->delete($sql);
}
function deleteLayer($catalogid,$layerid,$themeid)
{
$sql = "select * from layerorder where catalogid='$catalogid' and themeid='$themeid' and position='$layerid'";
$result = $this->select($sql);
$picture = $result[0]["name"];
if (!empty($picture))
{
$sql = "select * from profilepicture where isdisplay =11 and type=3 and picture='$picture'";
$resultpic = $this->select($sql);
$pic = $resultpic[0]["picture"];
if (empty($picture))
{
if (strpos($picture, '/gthumbs') !== false )
{
$picture = basename($picture) ;
$picture = str_replace("?type=profile","",$picture) ;
$PicturePath = "uploads/gthumbs/";
$file = $PicturePath.$picture;
unlink($file);
} }
}
$sql = "delete from layerorder where catalogid='$catalogid' and themeid='$themeid' and position='$layerid'";
$result = $this->delete($sql);
}
function deleteFont($catalogid,$layerid,$themeid)
{
$sql = "select * from myfonts where catalogid='$catalogid' and themeid='$themeid' and font='$layerid'";
$result = $this->select($sql);
$font = $result[0]["font"];
$PicturePath = "../assets/newfont/";
$file = $PicturePath.$font;
unlink($file);
$sql = "delete from myfonts where catalogid='$catalogid' and themeid='$themeid' and font='$layerid'";
$result = $this->delete($sql);
}
function updateTheme($catalogid,$themeid,$startag)
{
$time = time();;
$sql = "update profilepicture set isdisplay='13',title='$startag',adddate='$time' WHERE id='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);
return $results;
}
function logs($catalogid,$data,$message)
{
$sql = "INSERT INTO brand_logs (userid,data,message) VALUES ('$catalogid','$data','$message')";
$results = $this->insert($sql);
}
function campaigndata($newsid,$cat,$catalogid,$title)
{
$sql = "update campaign set description='2' WHERE newsid='$newsid'";
$results = $this->update($sql);
$sql = "INSERT INTO campaigndata (id, cat, catalogid, title) VALUES ('$newsid', '$cat', '$catalogid', '$title')";
$results = $this->insert($sql);
}
function updateThemeForMigration($themeParams,$alias,$themeid)
{
$sqld = "delete from layerorder where themeid='$themeid' and type='2'";
$resultd = $this->delete($sqld);
$time = time();
$sql = "update profilepicture set params='$themeParams',alias='$alias',settings='NULL' WHERE id='$themeid'";
$results = $this->update($sql);
/* $sql = "SELECT * FROM layerorder WHERE themeid='$themeid' order by position desc";
$result2 = mysqli_query($sql) or die (mysql_error());
echo $num_rows = mysqli_num_rows($result2);
while($row2 = mysqli_fetch_array($result2))
{ $row2["type"];
}*/
$sql = "SELECT COUNT(themeid) AS mycount from layerorder where themeid='$themeid' order by position asc";
$result = $this->select($sql);
$numX = $result[0]["mycount"] -2;
$startfrom =$result[0]["mycount"] -1; ;
//count no of layers
//select respective layers
$sql = "select * from layerorder where themeid='$themeid' order by position asc limit 0,20";
$myLayers = $this->select($sql);
/* for ($x = 0; $x <= $result[0]["mycount"]; $x++) {
echo $uniqueId =$myLayers[$x]["name"]."<br><br>";
}*/
for ($x = 0; $x <= $numX; $x++) {
$uniqueId =$myLayers[$x]["id"];
$layer_x=$myLayers[$x]['layerx'];
$layer_y=$myLayers[$x]['layery'];
$layer_w=$myLayers[$x]['layerw'];
$layer_h=$myLayers[$x]['layerh'];
$layeropacity=$myLayers[$x]['layeropacity'];
$layer_r=$myLayers[$x]['layerr'];
$brand =$myLayers[$x]["name"];
$check = LayerOrderType($brand,$uniqueId,$layer_x,$layer_y,$layer_w,$layer_h,$layeropacity,$layer_r);
$check = $check.",";
$values .= $check;
}
$uniqueId =$myLayers[$startfrom]["id"];
$uniqueId =$myLayers[$startfrom]["id"];
$layer_x=$myLayers[$startfrom]['layerx'];
$layer_y=$myLayers[$startfrom]['layery'];
$layer_w=$myLayers[$startfrom]['layerw'];
$layer_h=$myLayers[$startfrom]['layerh'];
$layeropacity=$myLayers[$startfrom]['layeropacity'];
$layer_r=$myLayers[$startfrom]['layerr'];
$brand =$myLayers[$startfrom]["name"];
$lastRecord = LayerOrderType($brand,$uniqueId,$layer_x,$layer_y,$layer_w,$layer_h,$layeropacity,$layer_r);
$layers = "[".$values.$lastRecord."]" ;
$layers =str_replace(",,",",","$layers");
$layers =str_replace(",,",",","$layers");
$layers =str_replace("http://localhost/thebrand/","","$layers");
include('v/json/jsonSettings.php');
$sql = "INSERT INTO layerorder (themeid,type, graphic_order, params, layers, settings) VALUES
('$themeid', '2', '1', '$LayerParams', '$layers', '$LayerSettings')";
$results = $this->insert($sql);
/* $select = "SELECT * FROM layerorder WHERE themeid='$themeid' order by id DESC limit 0,1";
global $link;
$query = mysqli_query($link,"$select") or die(mysql_error());
$row=mysqli_fetch_array($query);
echo $id = $row['id'];*/
return $results;
}
function updateData($data,$newid)
{
$sql = "update campaign set text='$data', description='1' WHERE newsid='$newid'";
$results = $this->update($sql);
return $results;
}
function updateDataColumn($newsid,$column)
{
$sql = "update campaign set mytheme='$column' WHERE newsid='$newsid'";
$results = $this->update($sql);
return $results;
}
function build_table($array){
// start table
$html = '<table>';
// header row
$html .= '<tr>';
foreach($array[0] as $key=>$value){
$html .= '<th>' . htmlspecialchars($key) . '</th>';
}
$html .= '</tr>';
// data rows
foreach( $array as $key=>$value){
$html .= '<tr>';
foreach($value as $key2=>$value2){
$html .= '<td>' . htmlspecialchars($value2) . '</td>';
}
$html .= '</tr>';
}
// finish table and return it
$html .= '</table>';
return $html;
}
function updateEffect($catalogid,$pic,$cl,$fx)
{
if ($fx == 0)
{
$sql = "update profilepicture set description='$cl' WHERE picture='$pic' and catalogid='$catalogid'";
}
else
{
$sql = "update profilepicture set description='$cl', fx='$fx' WHERE picture='$pic' and catalogid='$catalogid'";
}
$time = time();;
$results = $this->update($sql);
return $results;
}
function addLayer($catalogid5 ,$themeid,$layer0,$layer1,$layer0w,$layer0h,$layer1w,$layer1h,$layer0x,$layer0y,$layer1x,$layer1y,$catalognameX,$slugX,$user_nameX,$pichaC,$siteaddress2)
{
$pichaC = $siteaddress2."/".$pichaC."?type=profile";
$myidis = $_SESSION['euserid'];
$sql = "update profilepicture set isdisplay='12' WHERE id='$themeid' and catalogid='$myidis'";
$results = $this->update($sql);
$catalognameX = urlencode($catalognameX);
$text = "The Brand is a unique application that allows you to create and share beautiful branded posts in a matter of seconds! ";
$text = urlencode($text);
$sql = "
INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph, layerbg, text) VALUES
('$siteaddress2/taswira.php?quality=100&width=600w&height=600&cropratio=1:1&image=/v/uploads/gthumbs/$layer0', 'Background', '$catalogid5', '$themeid', 0, '600', '600', '0', '0', '0', '100', 0, 0, '#666666', NULL),
('$siteaddress2/taswira.php?quality=100&width=600&height=600&cropratio=1:1&image=/filters/mood/mesh.png', 'Graphics', '$catalogid5', '$themeid', 1, '600', '600', '2', '-1', '0', '100', 0, 0, '#666666', NULL),
('$siteaddress2/taswira.php?quality=100&width=600&height=600&cropratio=1:1&image=/filters/mood/awesome.png', 'Graphics', '$catalogid5', '$themeid', 1, '600', '600', '0', '0', '0', '100', 0, 0, '#666666', NULL),
('$siteaddress2/processFont.php?route=theUpdate&fontid=$themeid&myfont=&fontcatalogid=$catalogid5&themeid=$themeid&font_Username=MyriadPro-Semibold.otf&font_Name=HelveticaNeueLTStd-UltLt.otf&font_Url=HelveticaNeueLTStd-UltLt.otf&font_Text=HelveticaNeueLTStd-BdCn.otf&text_w=500&text_h=0&text_x=50&text_y=288&text_align=center&text_size=28&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=30&name_size=20&username_size=20&text_pad=5&text_line_height=30&text=$text', 'Caption', '$catalogid5', '$themeid', 4, '500', '500', '54', '253', '0', '100', 0, 0, '#666666', NULL),
('$siteaddress2/processFont.php?route=theUser&fontid=$themeid&myfont=10&fontcatalogid=$catalogid5&themeid=$themeid&font_Username=BebasNeue.otf%20%20&font_Name=BebasNeue.otf%20%20&font_Url=BebasNeue.otf%20%20&font_Text=BebasNeue.otf%20%20&text_w=200&text_h=0&text_x=undefined&text_y=undefined&text_align=left&text_size=23&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=23&name_size=23&username_size=23&text_pad=0&text_line_height=0&text=$user_nameX', 'Graphics', '$catalogid5', '$themeid', 1, '250', '20', '322', '49', '0', '100', 0, 0, '#666666', NULL) ,
( '$siteaddress2/processFont.php?route=theUrl&fontid=$themeid&myfont=&fontcatalogid=$catalogid5&themeid=$themeid&font_Username=MyriadPro-Semibold.otf&font_Name=HelveticaNeueLTStd-UltLt.otf&font_Url=HelveticaNeueLTStd-UltLt.otf&font_Text=HelveticaNeueLTStd-UltLt.otf&text_w=400&text_h=0&text_x=50&text_y=288&text_align=left&text_size=30&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=30&name_size=20&username_size=20&text_pad=0&text_line_height=0&text=thebrand.co.ke/$user_nameX', 'Url', '$catalogid5', '$themeid', 3, '300', '30', '29', '544', '0', '100', 0, 0, '#666666', NULL),
( '$siteaddress2/processFont.php?route=theName&fontid=$themeid&myfont=&fontcatalogid=$catalogid5&themeid=$themeid&font_Username=MyriadPro-Semibold.otf&font_Name=HelveticaNeueLTStd-UltLt.otf&font_Url=HelveticaNeueLTStd-UltLt.otf&font_Text=HelveticaNeueLTStd-BdCn.otf&text_w=300&text_h=0&text_x=50&text_y=288&text_align=left&text_size=28&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=30&name_size=20&username_size=20&text_pad=0&text_line_height=30&text=$catalognameX', 'Name', '$catalogid5', '$themeid', 2, '300', '30', '329', '10', '0', '100', 0, 0, '#666666', NULL)
";
/*
$sql = "
INSERT INTO layers ( layer0type, layer1type, layer2type, layer3type, layer4type, layer5type, catalogid, themeid, layertype, layertext, layeroverlay, layer0, layer1, layer2, layer3, layer4, layer5, layerorder, layer0w, layer0x, layer0y, layer1x, layer1y, layer2x, layer2y, layer3x, layer3y, layer4x, layer4y, layer5x, layer5y, layer1w, layer2w, layer3w, layer4w, layer5w, layer0h, layer1h, layer2h, layer3h, layer4h, layer5h, layer0r, layer1r, layer2r, layer3r, layer4r, layer5r, layer0opacity, layer1opacity, layer2opacity, layer3opacity, layer4opacity, layer5opacity, layer0flipv, layer1flipv, layer2flipv, layer3flipv, layer4flipv, layer5flipv, layer0fliph, layer1fliph, layer2fliph, layer3fliph, layer4fliph, layer5fliph, layerbg, layermark) VALUES
('Background', 'Graphics', 'Text', 'Text', 'Profile', 'Caption', $catalogid5, '$themeid', NULL, NULL, NULL, '$siteaddress2/taswira.php?quality=100&width=600w&height=600&cropratio=1:1&image=/v/uploads/gthumbs/$layer0', '$siteaddress2/taswira.php?quality=100&width=600&height=600&cropratio=1:1&image=/filters/mood/awesome.png', '$siteaddress2/processFont.php?route=theName&fontid=$themeid&myfont=&fontcatalogid=$catalogid5&themeid=$themeid&font_Username=MyriadPro-Semibold.otf&font_Name=HelveticaNeueLTStd-UltLt.otf&font_Url=HelveticaNeueLTStd-UltLt.otf&font_Text=HelveticaNeueLTStd-BdCn.otf&text_w=300&text_h=0&text_x=50&text_y=288&text_align=left&text_size=28&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=30&name_size=20&username_size=20&text_pad=0&text_line_height=30&text=$catalognameX', '$siteaddress2/processFont.php?route=theUrl&fontid=$themeid&myfont=&fontcatalogid=$catalogid5&themeid=$themeid&font_Username=MyriadPro-Semibold.otf&font_Name=HelveticaNeueLTStd-UltLt.otf&font_Url=HelveticaNeueLTStd-UltLt.otf&font_Text=HelveticaNeueLTStd-UltLt.otf&text_w=400&text_h=0&text_x=50&text_y=288&text_align=left&text_size=30&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=30&name_size=20&username_size=20&text_pad=0&text_line_height=30&text=thebrand.co.ke/$user_nameX', 'v/uploads/gthumbs/$pichaC', '$siteaddress2/processFont.php?route=theUpdate&fontid=$themeid&myfont=&fontcatalogid=$catalogid5&themeid=$themeid&font_Username=MyriadPro-Semibold.otf&font_Name=HelveticaNeueLTStd-UltLt.otf&font_Url=HelveticaNeueLTStd-UltLt.otf&font_Text=HelveticaNeueLTStd-BdCn.otf&text_w=500&text_h=0&text_x=50&text_y=288&text_align=center&text_size=28&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=30&name_size=20&username_size=20&text_pad=30&text_line_height=30&text=$text', NULL, '600', '0', '0', '2', '-1', '330', '10', '29', '544', '499', '500', '58', '215', '600', '300', '400', '77', '500', '600', '600', '30', '30', '77', '150', '0', '0', '0', '0', '0', '0', '100', '100', '100', '100', '100', '100', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '#666666', 0)"; */
$results = $this->insert($sql);
return $results;
}
function addDuplicateLayer($name,$layertype,$who,$newthemeid,$graphic_order,$params,$layers,$settings,$position,$layerw,$layerh,$layerx,$layery,$layerr,$layeropacity,$layerflipv,$layerfliph,$layerbg,$text,$font,$type,$adddate)
{
$sql = "
INSERT INTO `layerorder` (`name`, `layertype`, `themeid`, `graphic_order`, `params`, `layers`, `settings`, `position`, `layerw`, `layerh`, `layerx`, `layery`, `layerr`, `layeropacity`, `layerflipv`, `layerfliph`, `layerbg`, `text`, `font`, `type`, `adddate`) VALUES
('$name', '$layertype','$newthemeid', '$graphic_order', '$params', '$layers', '$settings', '0', '$layerw', '$layerh', '$layerx', '$layery', '$layerr', '$layeropacity','$layerflipv', '$layerfliph', '$layerbg', '$text', '$font', '$type', '$adddate')";
$results = $this->insert($sql);
return $results;
}
function addGraphicLayer($catalogid ,$themeid,$filename,$siteaddress2)
{
global $link;
$query = mysqli_query($link,"SELECT position FROM layerorder WHERE catalogid='$catalogid' and themeid='$themeid' order by position DESC limit 0,1") or die(mysql_error());
$row=mysqli_fetch_array($query);
$position = $row['position'] + 1;
$filename = $siteaddress2."/".$filename."?type=profile";
$sql = "
INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph, layerbg) VALUES
('$filename', 'Uploaded', '$catalogid', '$themeid', '$position', '600', '600', '0', '0', '0', '100', 0, 0, '#666666')
";
$results = $this->insert($sql);
return $results;
}
function addMyFont($catalogid,$filename,$themeid,$type,$name)
{
$filename = basename($filename);
$sql = "select font from myfonts where catalogid='$catalogid' and layertype='$type' and file='$name' ";
$result = $this->select($sql);
$font = $result[0]["font"];
if (!empty($font)){
$fontfile="assets/newfont/$font";
unlink($fontfile);
$sql = "delete from myfonts where file='$name' and catalogid='$catalogid' and layertype='$type'";
$result = $this->delete($sql);
}
else
{
$sql="insert into myfonts(catalogid,layertype,font,file) values('$catalogid','$type','$filename','$name')";
$result = $this->insert($sql);
}
return $result;
}
function addMyLogo($ids,$uid,$file_name)
{
$sql = "select picture from profilepicture where catalogid='$uid' and type='1'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
$id = $result[0]["id"];
if (!empty($picture)){
$file = "../v/uploads/gthumbs/$picture";
unlink($file);
}
$sqlC = "select * from profilepicture where catalogid='$uid' and type='1'";
$resultC = $this->select($sqlC);
while ( list($key,$val)=each($resultC) ) {
$picture = $val["picture"];
$id = $val["id"];
if (!empty($picture))
{
$file = "../v/uploads/gthumbs/$picture";
if (file_exists($file)) {
unlink($file);
}
}
}
$sql = "DELETE FROM profilepicture where type='1' and catalogid='$uid'";
$results = $this->delete($sql);
$sql = "select user_name from users where catalogid='$uid'";
$result = $this->select($sql);
$user_name = $result[0]["user_name"];
$time=time();
$sql = "insert into profilepicture (catalogid,title,type,picture,poster,adddate) values ('$uid','$user_name','1','$file_name','$file_name','$time')";
$results = $this->insert($sql);
return $results;
$sql = "insert into profilepicture (catalogid,title,type) values ('$uid','Profile Picture','1')";
$result = $this->insert($sql);
return $result;
}
function addMyPhoto($ids,$uid,$file_name,$image_type, $file_ext,$file_size,$is_image,$image_width, $image_height,$isdisplay, $created)
{
$sql="insert into general_file_manager(ids,uid,file_name,image_type,file_ext,file_size,is_image,image_width,image_height,isdisplay, created) values('$ids','$uid','$file_name','$image_type','$file_ext','$file_size','$is_image','$image_width','$image_height','$isdisplay','$created')";
$result = $this->insert($sql);
return $result;
}
function addMyTeam($catalogid,$teamtype,$teamdescription,$picture,$teamname)
{
$filename = basename($filename);
$sql = "select teamname from myteam where catalogid='$catalogid' and teamname='$name'";
$result = $this->select($sql);
$font = $result[0]["font"];
if (!empty($font)){
echo "0";
}
else
{
$sql="insert into myteam(catalogid,teamtype,teamdescription,picture,teamname) values('$catalogid','$teamtype','$teamdescription','$picture','$teamname')";
$result = $this->insert($sql);
}
return $result;
}
function addFontCombination($catalogid,$name,$body,$title,$otherX)
{
$sql = "select * from fontcombination where catalogid='$catalogid' and name='$name'";
$result = $this->select($sql);
if (empty($result)){
$sql = "select * from fontcombination where body='$body' and title='$title'";
$result = $this->select($sql);
if (!empty($result)){echo 'already added!';}
$sql="insert into fontcombination(catalogid,name,body,title,other) values('$catalogid','$name','$body','$title','$otherX')";
$result = $this->insert($sql);
}
else
{
echo 'already added!';
}
return $result;
}
function addCampaign($catalogid,$themeid,$mytheme,$title,$hashtag,$type,$sort,$search)
{
$sql = "select * from campaign where themeid='$themeid' and catalogid='$catalogid' and hashtag='$hashtag' ";
$result = $this->select($sql);
$hash = $result[0]["hashtag"];
$theid = $result[0]["themeid"];
if (empty($hash ))
{
$sql="insert into campaign(catalogid,themeid,title,hashtag,type,sort,search) values('$catalogid','$themeid','$title','$hashtag','$type','$sort','$search')";
$result = $this->insert($sql); exit(1);
}
else
{
exit(0);
}
return $result;
}
function addData($catalogid,$themeid,$mytheme,$title,$hashtag,$type)
{
echo $sql = "select * from campaign where themeid='$themeid' and catalogid='$catalogid' and hashtag='$hashtag' ";
$result = $this->select($sql);
$hash = $result[0]["hashtag"];
$theid = $result[0]["themeid"];
if (empty($hash ))
{
$sql="insert into campaign(catalogid,themeid,title,hashtag,type) values('$catalogid','$themeid','$title','$hashtag','data')";
$result = $this->insert($sql); exit(1);
}
else
{
exit(0);
}
return $result;
}
function addPhotoshopLayers($catalogid,$file_name,$type,$title,$theme)
{
/* echo $sql = "select * from layerorder where catalogid='$catalogid' and type='3' ";
$result = $this->select($sql);
$file = $result[0]["name"];
if (empty($hash ))
{
$PicturePath = "v/uploads/json/";
$sql = "select * from layerorder where catalogid='$catalogid' and type='3'";
$result = $this->select($sql);
$file = $result[0]["file"];
if (!empty($file)){
$file = $PicturePath.$file;
unlink($file);
}
}*/
$sql = "select * from photoshop where catalogid='$catalogid' and name='$file_name' and themeid='$theme'";
$result = $this->select($sql);
$file = $result[0]["name"];
if (!empty($file))
{}
else
{
$sql = "INSERT INTO photoshop (name, type, catalogid, layertype, themeid) VALUES ('$file_name', '$type', '$catalogid', '$title', '$theme')";
$results = $this->insert($sql);
}
return $results;
}
function addJson($catalogid,$title,$file,$alias,$width,$height)
{
$PicturePath = "v/uploads/json/";
$sql = "select * from profilepicture where catalogid='$catalogid' and title='$title' and type='4'";
$result = $this->select($sql);
if (!empty($result)){
exit(0);
}
$sql="insert into profilepicture(w,h,catalogid,title,json,alias,type) values('$width','$height','$catalogid','$title','$file','$alias','4')";
$result = $this->insert($sql);
$sql = "select * from profilepicture where catalogid='$catalogid' and title='$title' and type='4' order by id desc";
$result = $this->select($sql);
$id = $result[0]["id"];
$id = base64_encode($id);
$id = strtr($id, '+/=', '-_,');
return $id;
}
function addRss($catalogid,$themeid,$mytheme,$title,$hashtag,$type)
{
$sql = "select * from campaign where themeid='$themeid' and catalogid='$catalogid' and hashtag='$hashtag' ";
$result = $this->select($sql);
$hash = $result[0]["hashtag"];
$theid = $result[0]["themeid"];
if (empty($hash ))
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/thebrand/brandRSS/p/i/?c=feed&a=add");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
"_csrf" => "e1e0b31d782ac4ea55651e27da9fe3fd13229990",
"url_rss"=> "$hashtag",
"category" => "3",
"new_category" => "New category"
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$hashtagX =str_replace(".rss","","$hashtag");
$sql = "select * from rssadmin_feed where url='$hashtagX'";
$result = $this->select($sql);
$url = $result[0]["url"];
$id = $result[0]["id"];
if (!empty($url))
{
$sql="insert into campaign(catalogid,themeid,title,hashtag,type,description) values('$catalogid','$themeid','$title','$hashtag','$type','$id')";
$result = $this->insert($sql); exit("1");
}
else{
exit("0");
}
}
else{
exit("0");
}
}
function addRss2($catalogid,$themeid,$mytheme,$title,$hashtag,$type)
{
$sql = "select * from rssadmin_category where themeid='$themeid' and catalogid='$catalogid' and name='$title' ";
$result = $this->select($sql);
$hash = $result[0]["hashtag"];
$theid = $result[0]["themeid"];
if (empty($hash ))
{
$sql="insert into rssadmin_category(catalogid,themeid,name,hashtag,type) values('$catalogid','$themeid','$title','$hashtag','$type')";
$result = $this->insert($sql);
/*
$sql = "select * from rssadmin_category where themeid='$themeid' and catalogid='$catalogid' and name='$title' ";
$result = $this->select($sql);
$id = $result[0]["id"];
echo $sql="insert into rssadmin_feed(url,category,name) values('$hashtag','$id','$title')";
echo $result = $this->insert($sql); */
exit(1);
}
else
{
exit(0);
}
return $result;
}
function checkAddedTheme($who,$themeid)
{
$sql = "select * from profilepicture where affiliate='$themeid' and catalogid='$who'";
$result = $this->select($sql);
$newsid = $result[0]["newsid"];
if (!empty($newsid ))
{
$result =0;
}
else
{
$result =1;
}
return $result;
}
function clearTags($who)
{
$sql = "delete from mytags where who='$who' and type='0'";
$result = $this->delete($sql);
echo "Cleared My Tags";
}
function clearInterest($who)
{
$sql = "delete from myinterests where who='$who' and type='0'";
$result = $this->delete($sql);
echo "Cleared My Interests";
}
function clearEmotion($who)
{
$sql = "delete from myinterests where who='$who' and type='1'";
$result = $this->delete($sql);
echo "Cleared My Color Emotions";
}
function checkAddedEmotion($who,$interest,$title)
{
$sql = "select * from myinterests where who='$who' and title='$title' and type='1'";
$result = $this->select($sql);
$sqlC = "select * from myinterests where who='$who' and type='1'";
$resultC = $this->select($sqlC);
$resultCount = count($resultC);
$myid = $result[0]["id"];
if (!empty($myid))
{
$sql = "delete from myinterests where who='$who' and title='$title' and type='1'";
$result = $this->delete($sql);
/* echo "$title <strong>removed</strong> .";*/
}
else
{
if($resultCount > 6){
global $link;
$rs_settings = mysqli_query($link,"select * from myinterests where who='$who' and type='1'");
while ($row_settings = mysqli_fetch_array($rs_settings)) {
echo strtolower($row_settings['title']).",";
} echo " <strong> Maximum added!" ;exit();
}
$sql = "insert into myinterests (who,interest,title,type) values ('$who','$interest','$title','1' )";
$results = $this->insert($sql);
/* echo "$title <strong>added</strong>";*/
}
echo " <strong>Selected :</strong>";
global $link;
/* echo "select * from myinterests where who='$who' AND type='1'";*/
$rs_settings = mysqli_query($link,"select * from myinterests where who='$who' AND type='1'");
while ($row_settings = mysqli_fetch_array($rs_settings)) {
echo strtolower($row_settings['title']).",";
}
return $result;
}
function checkAddedInterest($who,$interest,$title)
{
$sql = "select * from myinterests where who='$who' and interest='$interest' and type='0'";
$result = $this->select($sql);
$sqlC = "select * from myinterests where who='$who' and type='0'";
$resultC = $this->select($sqlC);
$resultCount = count($resultC);
$myid = $result[0]["id"];
if (!empty($myid))
{
$sql = "delete from myinterests where who='$who' and interest='$interest' and type='0'";
$result = $this->delete($sql);
echo "$title interest <strong>removed</strong>";
}
else
{
if($resultCount > 19){ exit("Maximum interests added!");}
$sql = "insert into myinterests (who,interest,title,type) values ('$who','$interest','$title','0' )";
$results = $this->insert($sql);
echo "$title interest <strong>added</strong>";
}
return $result;
}
function checkAddedTag($who,$interest,$title)
{
$sql = "select * from mytags where who='$who' and interest='$interest' and type='0'";
$result = $this->select($sql);
$sqlC = "select * from mytags where who='$who' and type='0'";
$resultC = $this->select($sqlC);
$resultCount = count($resultC);
$myid = $result[0]["id"];
if (!empty($myid))
{
$sql = "delete from mytags where who='$who' and interest='$interest' and type='0'";
$result = $this->delete($sql);
/* echo "$title tag <strong>removed</strong>";*/
}
else
{
if($resultCount > 10){
$sqlC = "select * from mytags where who='$who' and type='0' order by id asc ";
$resultC = $this->select($sqlC);
while ( list($key,$val)=each($resultC) ) {
$title = stripslashes($val["title"]).", ";
echo $title ;
}
exit();}
$sql = "insert into mytags (who,interest,title,type) values ('$who','$interest','$title','0' )";
$results = $this->insert($sql);
/* echo "$title tag <strong>added</strong>";*/
}
$sqlC = "select * from mytags where who='$who' and type='0' order by id asc ";
$resultC = $this->select($sqlC);
while ( list($key,$val)=each($resultC) ) {
$title = stripslashes($val["title"]).", ";
echo $title ;
}
}
function addFontPair($who,$themeid,$title)
{
$sql = "select * from myfonts where catalogid='$who' and themeid='$themeid'";
$result = $this->select($sql);
$sqlC = "select * from myfonts where catalogid='$who' ";
$resultC = $this->select($sqlC);
$resultCount = count($resultC);
$myid = $result[0]["layerid"];
if (!empty($myid))
{
$sql = "delete from myfonts where catalogid='$who' and themeid='$themeid'";
$result = $this->delete($sql);
echo ' <span style="color:#cc0000"> '.$title.' <strong>removed</strong></span>';
}
else
{
if($resultCount > 30){ exit(' <span style="color:#cc0000"> Maximum fonts added!');}
$sql = "insert into myfonts (catalogid,themeid,file,isdisplay) values ('$who','$themeid','$title','2')";
$results = $this->insert($sql);
echo "$title font <strong>added</strong>";
}
return $result;
}
function updateBrandHex($brandid,$color,$tag)
{
$sql = "update brandcolorstext set tag='$tag',color='$color' WHERE brandid='$brandid'";
$results = $this->update($sql);
return $results;
}
function addBrandColor($who,$themeid,$title)
{
$sql = "delete from myfonts where catalogid='$who' and isdisplay='3'";
$result = $this->delete($sql);
$sql = "insert into myfonts (catalogid,themeid,file,isdisplay) values ('$who','$themeid','$title','3')";
$results = $this->insert($sql);
echo "Brand colors <strong> updated </strong>";
return $result;
}
function addMyBrandColor($catalogid,$body,$tagline,$background,$title)
{
$sql = "delete from brandcolors where catalogid='$catalogid' and type='1'";
$result = $this->delete($sql);
$sql = "insert into brandcolors (catalogid,body,tagline,background,title,type,brandname) values ('$catalogid','$body','$tagline','$background','$title','1','$catalogid')";
$results = $this->insert($sql);
$sql = "delete from myfonts where catalogid='$catalogid' and isdisplay='4'";
$result = $this->delete($sql);
$sql = "insert into myfonts (catalogid,themeid,file,isdisplay) values ('$catalogid','$results','$catalogid','4')";
$results = $this->insert($sql);
echo "Brand colors <strong> updated </strong>";
return $result;
}
function addBrandDetails($catalogidBrand,$nameBrand,$websiteBrand,$phoneBrand,$emailBrand,$typeBrand,$creatorBrand,$countryBrand,$teamBrand,$sloganBrand,$interestsBrand,$fbBrand,$twBrand,$ytBrand,$liBrand ,$fontBrand,$colorBrand,$logoBrand,$bioBrand,$graphicBrand,$detailsBrand)
{
$sql = "delete from detailsbrand where catalogid='$catalogidBrand'";
$result = $this->delete($sql);
$sql="insert into detailsbrand(catalogid, name, website, phone, email, details, type, creator, country, team, slogan, interests, fb, tw, li, yt, font, color, logo, bio, graphic) values
('$catalogidBrand', '$nameBrand', '$websiteBrand', '$phoneBrand', '$emailBrand', '$detailsBrand', '$typeBrand', '$creatorBrand', '$countryBrand', '$teamBrand', '$sloganBrand', '$interestsBrand', '$fbBrand', '$twBrand', '$liBrand', '$ytBrand', '$fontBrand', '$colorBrand', '$logoBrand', '$bioBrand', '$graphicBrand')";
$result = $this->insert($sql);
return $result;
}
function addMessaging($catalogid,$view,$description,$newnani)
{
$sql = "select * from users where catalogid='$newnani'";
$result = $this->select($sql);
$catalogname = $result[0]["catalogname"];
$user_name = $result[0]["user_name"];
$date =date("Y-m-d H:i:s");
$sql="insert into tweets(user_name, screen_name,catalogid,campaign,tweet,tweetid, retweet_count, retweet_id, retweet_user, followers_count, listed_count, source,location, date_tweeted) values
('$catalogname','$user_name','$catalogid','$view','$description','0', '0', '0', '0', '0', '0', '0','0', '$date')";
$result = $this->insert($sql); exit($sql);
return $result;
}
function editCampaign($catalogid,$themeid,$mytheme,$title,$hashtag,$type,$view)
{
$sql = "update campaign set title='$title',hashtag='$hashtag',type='$type',themeid='$themeid' WHERE newsid='$view'";
$results = $this->update($sql);
return $result;
}
function editMessaging($salutation,$description,$newsid,$themeidX,$viewX,$typeX,$contextual)
{
$sql = "update campaign_message set salutation='$salutation',description='$description',type='$typeX',contextual='$contextual' WHERE newsid='$newsid'";
$results = $this->update($sql);
return $result;
}
function clearLayer1($catalogid,$themeid)
{
$sql = "update layers set layer1='' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);
return $results;
}
function clearLayer2($catalogid,$themeid)
{
$sql = "update layers set layer2='' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);
return $results;
}
function clearLayer3($catalogid,$themeid)
{
$sql = "update layers set layer3='' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);
return $results;
}
function clearLayer4($catalogid,$themeid)
{
$sql = "update layers set layer4='' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);
return $results;
}
function clearLayer5($catalogid,$themeid)
{
$sql = "update layers set layer5='' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);
return $results;
}
function updateAdapt($catalogid,$filename,$themeid,$level)
{
$sql = "update layers set layer".$level."='$filename',layer".$level."w='600',layer".$level."h='600',layer".$level."r='0',layer".$level."opacity='100',layer".$level."x='0',layer".$level."y='0',layer".$level."Index='$level',layer".$level."fliph='0',layer".$level."flipv='0' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);
return $results;
}
function updateLayer5($catalogid,$themeid,$layer5,$layer5w,$layer5h,$layer5r,$layer5opacity,$layer5x,$layer5y,$type,$layer5fliph,$layer5flipv,$position5)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer5', '$type', '$catalogid', '$themeid', '$position5', '$layer5w', '$layer5h', '$layer5x', '$layer5y', '$layer5r', '$layer5opacity', '$layer5flipv', '$layer5fliph')";
$results = $this->insert($sql);
/* $sql = "update layers set layer5type='$type',layer5='$layer5',layer5w='$layer5w',layer5h='$layer5h',layer5r='$layer5r',layer5opacity='$layer5opacity',layer5x='$layer5x',layer5y='$layer5y',layer5fliph='$layer5fliph',layer5flipv='$layer5flipv' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);*/
return $results;
}
function updateLayer6($catalogid,$themeid,$layer6,$layer6w,$layer6h,$layer6r,$layer6opacity,$layer6x,$layer6y,$type,$layer6fliph,$layer6flipv,$position6)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer6', '$type', '$catalogid', '$themeid', '$position6', '$layer6w', '$layer6h', '$layer6x', '$layer6y', '$layer6r', '$layer6opacity', '$layer6flipv', '$layer6fliph')";
$results = $this->insert($sql);
return $results;
}
function updateLayer8($catalogid,$themeid,$layer8,$layer8w,$layer8h,$layer8r,$layer8opacity,$layer8x,$layer8y,$type,$layer8fliph,$layer8flipv,$position8)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer8', '$type', '$catalogid', '$themeid', '$position8', '$layer8w', '$layer8h', '$layer8x', '$layer8y', '$layer8r', '$layer8opacity', '$layer8flipv', '$layer8fliph')";
$results = $this->insert($sql);
return $results;
}
function updateLayer9($catalogid,$themeid,$layer9,$layer9w,$layer9h,$layer9r,$layer9opacity,$layer9x,$layer9y,$type,$layer9fliph,$layer9flipv,$position9)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer9', '$type', '$catalogid', '$themeid', '$position9', '$layer9w', '$layer9h', '$layer9x', '$layer9y', '$layer9r', '$layer9opacity', '$layer9flipv', '$layer9fliph')";
$results = $this->insert($sql);
return $results;
}
function updateLayer10($catalogid,$themeid,$layer10,$layer10w,$layer10h,$layer10r,$layer10opacity,$layer10x,$layer10y,$type,$layer10fliph,$layer10flipv,$position10)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer10', '$type', '$catalogid', '$themeid', '$position10', '$layer10w', '$layer10h', '$layer10x', '$layer10y', '$layer10r', '$layer10opacity', '$layer10flipv', '$layer10fliph')";
$results = $this->insert($sql);
return $results;
}
function updateLayer7($catalogid,$themeid,$layer7,$layer7w,$layer7h,$layer7r,$layer7opacity,$layer7x,$layer7y,$type,$layer7fliph,$layer7flipv,$position7)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer7', '$type', '$catalogid', '$themeid', '$position7', '$layer7w', '$layer7h', '$layer7x', '$layer7y', '$layer7r', '$layer7opacity', '$layer7flipv', '$layer7fliph')";
$results = $this->insert($sql);
return $results;
}
function updateLayer4($catalogid,$themeid,$layer4,$layer4w,$layer4h,$layer4r,$layer4opacity,$layer4x,$layer4y,$type,$layer4fliph,$layer4flipv,$position4)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer4', '$type', '$catalogid', '$themeid', '$position4', '$layer4w', '$layer4h', '$layer4x', '$layer4y', '$layer4r', '$layer4opacity', '$layer4flipv', '$layer4fliph')";
$results = $this->insert($sql);
/* $sql = "update layers set layer4type='$type',layer4='$layer4',layer4w='$layer4w',layer4h='$layer4h',layer4r='$layer4r',layer4opacity='$layer4opacity',layer4x='$layer4x',layer4y='$layer4y',layer4fliph='$layer4fliph',layer4flipv='$layer4flipv' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);*/
return $results;
}
function updateLayer3($catalogid,$themeid,$layer3,$layer3w,$layer3h,$layer3r,$layer3opacity,$layer3x,$layer3y,$type,$layer3fliph,$layer3flipv,$position3)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer3', '$type', '$catalogid', '$themeid', '$position3', '$layer3w', '$layer3h', '$layer3x', '$layer3y', '$layer3r', '$layer3opacity', '$layer3flipv', '$layer3fliph')";
$results = $this->insert($sql);
/* $sql = "update layers set layer3type='$type',layer3='$layer3',layer3w='$layer3w',layer3h='$layer3h',layer3r='$layer3r',layer3opacity='$layer3opacity',layer3x='$layer3x',layer3y='$layer3y',layer3fliph='$layer3fliph',layer3flipv='$layer3flipv' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);*/
return $results;
}
function updateLayer2($catalogid,$themeid,$layer2,$layer2w,$layer2h,$layer2r,$layer2opacity,$layer2x,$layer2y,$type,$layer2fliph,$layer2flipv,$position2)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer2', '$type', '$catalogid', '$themeid', '$position2', '$layer2w', '$layer2h', '$layer2x', '$layer2y', '$layer2r', '$layer2opacity', '$layer2flipv', '$layer2fliph')";
$results = $this->insert($sql);
return $results;
}
function updateLayer1($catalogid,$themeid,$layer1,$layer1w,$layer1h,$layer1r,$layer1opacity,$layer1x,$layer1y,$type,$layer1fliph,$layer1flipv,$position1)
{
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer1', '$type', '$catalogid', '$themeid', '$position1', '$layer1w', '$layer1h', '$layer1x', '$layer1y', '$layer1r', '$layer1opacity', '$layer1flipv', '$layer1fliph')";
$results = $this->insert($sql);
/* $sql = "update layers set layer1type='$type',layer1='$layer1',layer1w='$layer1w',layer1h='$layer1h',layer1r='$layer1r',layer1opacity='$layer1opacity',layer1x='$layer1x',layer1y='$layer1y',layer1fliph='$layer1fliph',layer1flipv='$layer1flipv' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);*/
return $results;
}
function updateLayer0($catalogid,$themeid,$layer0,$layer0w,$layer0h,$layer0r,$layer0opacity,$layer0x,$layer0y,$type,$layer0fliph,$layer0flipv,$position0)
{
$sql = "delete from layerorder where themeid='$themeid'";
$result = $this->delete($sql);
$sql = "INSERT INTO layerorder (name, layertype, catalogid, themeid, position, layerw, layerh, layerx, layery, layerr, layeropacity, layerflipv, layerfliph) VALUES ('$layer0', '$type', '$catalogid', '$themeid', '$position0', '$layer0w', '$layer0h', '$layer0x', '$layer0y', '$layer0r', '$layer0opacity', '$layer0flipv', '$layer0fliph')";
$results = $this->insert($sql);
/* $sql = "update layers set layer0type='$type',layer0='$layer0',layer0w='$layer0w',layer0h='$layer0h',layer0r='$layer0r',layer0opacity='$layer0opacity',layer0x='$layer0x',layer0y='$layer0y' WHERE themeid='$themeid' and catalogid='$catalogid'";
$results = $this->update($sql);*/
return $results;
}
function prepareStartag($brand, $amount,$msg_id)
{
$size = GetImageSize($brand);
$mime = $size['mime'];
switch ($size['mime'])
{
case 'image/gif':
// We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
// This is maybe not the ideal solution, but IE6 can suck it
$creationFunction = 'ImageCreateFromGif';
$outputFunction = 'ImagePng';
$mime = 'image/png'; // We need to convert GIFs to PNGs
$quality = round(10 - ($quality / 10));
/* if (empty($_GET['execute'])) {$quality = round(10 - (35 / 10));}*/
// We are converting the GIF to a PNG and PNG needs a compression level of 0 (no compression) through 9
break;
case 'image/png':
$quality=100;
$creationFunction = 'ImageCreateFromPng';
$outputFunction = 'ImagePng';
$quality = round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
/* if (empty($_GET['execute'])) {$quality = round(10 - (35 / 10));}*/
break;
default:
$creationFunction = 'ImageCreateFromJpeg';
$outputFunction = 'ImageJpeg';
$quality=100;
/* if (empty($_GET['execute'])) {$quality = 35;}*/
break;
}
$width = 600; $height = 600;
$photoFrame2 = imagecreatetruecolor($width, $height);
imagealphablending($photoFrame2, false);
imagesavealpha($photoFrame2, true);
$trans_colour = imagecolorallocatealpha($photoFrame2, 0, 0, 0, 127);
imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
$photo2 = $creationFunction($brand);
/* include("mags/switch.php");*/
imagecopyresampled($photoFrame2, $photo2, 0, 0, 0, 0, $width, $height, $width, $height);
$photoFrame = imagecreatetruecolor($width, $height);
imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
imagecopymerge($brand, $photoFrame, 0, 0, 0, 0, $width, $height, $amount);
$outputFunction($photoFrame, $brand, $quality);
imagedestroy($photoFrame);
$myidis = $_SESSION['euserid'];
$sql = "update profilepicture set isdisplay='4' WHERE id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
}
public function Profile_Pic($catalogid5)
{
global $link;
$myidis = $_SESSION['euserid'];
$sql = "SELECT picture FROM `profilepicture` WHERE catalogid='$catalogid5' and type=1";
$query = mysqli_query($link,$sql) or die(mysql_error());
$row=mysqli_fetch_array($query);
return $row['picture'];
}
public function lastProcessedPhoto($catalogid5,$campaign,$method)
{
global $link;
$myidis = $_SESSION['euserid'];
$sql = "SELECT * FROM `reporta` WHERE uid='$catalogid5' and vcat='$campaign' order by msg_id $method limit 0,1";
$result = $this->select($sql);
return $result;
}
public function getmeUser($catalogid5)
{
global $link;
$myidis = $_SESSION['euserid'];
$sql = "SELECT * FROM `users` WHERE catalogid='$catalogid5'";
$query = mysqli_query($link,$sql) or die(mysql_error());
$row=mysqli_fetch_array($query);
return $row;
}
public function mynewTheme($catalogid5)
{
global $link;
$query = mysqli_query($link,"SELECT id FROM `profilepicture` WHERE catalogid='$catalogid5' order by id desc limit 0,1") or die(mysql_error());
$row=mysqli_fetch_array($query);
return $row['id'];
}
public function getLevel($level_id)
{
global $link;
$query = mysqli_query($link,"SELECT admin FROM `users` WHERE id='$level_id'") or die(mysql_error());
$row=mysqli_fetch_array($query);
return $row['admin'];
}
public function convoText($convoId)
{
$sql = "SELECT * from `tweets` WHERE id='$convoId' ";
$result = $this->select($sql);
return $result;
}
public function Profile_Pic_ID()
{ $myidis = $_SESSION['euserid'];
global $link;
$query = mysqli_query($link,"SELECT * FROM `profilepicture` WHERE catalogid='$myidis' and type=1") ;
$row=mysqli_fetch_array($query);
return $row['newsid'];
}
function getcount2($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(catalogid) AS mycount from mytv where catalogid='$myidis' and category_id=1 order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function countPlaylist()
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(newsid) AS mycount from mytv where catalogid='$myidis'";
$result = $this->select($sql);
$mycount = $result[0]["mycount"];
return $mycount;
}
function getplaylist($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "select * from mytv where catalogid='$myidis' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function editcata($catalogid)
{ $sql = "select * from catalog where catalogid=$catalogid order by catalogid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function editcatalog($catalogname,$description,$catid)
{
$myidis = $_SESSION['euserid'];
$slug = mysqli_real_escape_string($link,$catalogname);
$slug = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $slug);
$slug = strtolower($slug);
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $slug);
$sql = "update catalog set catalogname='$catalogname',description='$description',slug='$slug' where catalogid='$catid' and parentid='$myidis'";
$results = $this->update($sql);
return $results;
}
function delepisode($catid,$PicturePath)
{$myidis = $_SESSION['euserid'];
$sql = "delete from catalog where catalogid=$catid and parentid=$myidis";
$result = $this->delete($sql);
}
function addepisode($cat,$description,$parentid,$userfile_name)
{
$im = $_SESSION['fn'];
$myidis = $_SESSION['euserid'];
$slug = mysqli_real_escape_string($link,$cat);
$slug = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $slug);
$slug = strtolower($slug);
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $slug);
$sql = "insert into catalog (catalogname,parentid,picture,slug) values ('$cat ','$myidis','$im','$slug')";
$results = $this->insert($sql);
return $results;
}
function editepisode($cat,$description,$catid,$userfile_name)
{
$myidis = $_SESSION['euserid'];$im = $_SESSION['fn'];
$slug = mysqli_real_escape_string($link,$cat);
$slug = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $slug);
$slug = strtolower($slug);
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $slug);
$sql = "update catalog set catalogname='$cat',description='$description',slug='$slug',picture='$im',slug='$slug' where catalogid='$catid' and parentid='$myidis'";
$results = $this->update($sql);
return $results;
}
function getallepisodes($page,$record)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from catalog where parentid=$myidis order by catalogid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function addprofilepicture()
{
$myidis = $_SESSION['euserid'];
$sql = "insert into profilepicture (catalogid,title,type) values ('$myidis','Profile Picture','1')";
$results = $this->insert($sql);
return $results;
}
function addsplashpicture($catalogid,$title,$description,$isdisplay)
{
$myidis = $_SESSION['euserid'];
$sql = "insert into splash (catalogid,title,description,isdisplay) values ('$myidis','$title','$description','$isdisplay')";
$results = $this->insert($sql);
return $results;
}
function add_catalogPicture($catalogid,$userfile_name,$PicturePath)
{
$sql = "select picture from catalog where catalogid='$catalogid'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
if (!empty($picture)){
$file = $PicturePath.$picture;
unlink($file);
}
$sql = "UPDATE catalog SET picture=\"$userfile_name\" WHERE catalogid='$catalogid'";
$result = $this->update($sql);
return $result;
}
function add_profilePicture($newsid,$userfile_name,$PicturePath)
{
$myidis = $_SESSION['euserid'];
$sql = "select picture from profilepicture where id='$newsid' and type='1'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
if (!empty($picture)){
$file = "v/uploads/gthumbs/$picture";
unlink($file);
}
$sql = "DELETE FROM profilepicture where id='$newsid' and type='1'";
$results = $this->delete($sql);
$sql = "select user_name from users where catalogid='$myidis'";
$result = $this->select($sql);
$user_name = $result[0]["user_name"];
$time=time();
$sql = "insert into profilepicture (catalogid,title,type,picture,poster,adddate,affiliate) values ('$myidis','$user_name','1','$userfile_name','$userfile_name','$time','1438')";
$results = $this->insert($sql);
return $results;
}
function add_splashPicture($newsid,$userfile_name,$PicturePath)
{
$sql = "select picture from splash where newsid='$newsid'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
if (!empty($picture)){
$file = $PicturePath.$picture;
unlink($file);
}
$sql = "UPDATE splash SET picture=\"$userfile_name\" WHERE newsid='$newsid'";
$result = $this->update($sql);
return $result;
}
function delnewsrep($msg_id,$VideoPath)
{
/* $result = $this->select($sql);
$video = $result[0]["video"];
if (!empty($video)){
$file = $VideoPath.$video.$exte;
unlink($file);*/
$sql = "DELETE FROM reporta where msg_id='$msg_id'";
$results = $this->delete($sql);
return $results;
}
function getallprofilepictures()
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and type='1' order by id DESC LIMIT 0,1";
$resultZ = $this->select($sql);
return $resultZ;
}
function getchannelsplashpictures($catalogid)
{
$start = $page*$record;
$sql = "select * from splash where catalogid='$catalogid' order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getallsplashpictures($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "select * from splash where catalogid='$myidis' order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getpicturecount($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(catalogid) AS mycount from profilepicture where catalogid='$myidis' and def='2' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getsplashcount($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(catalogid) AS mycount from splash where catalogid='$myidis' order by newsid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getslidenamebyid($slideid)
{
$sql = "select slidename from slideshows where slideid='$slideid'";
$result = $this->select($sql);
$parentname = $result[0]["slidename"];
return $parentname;
}
function delprofilepicture($pichaC)
{
global $link;
$myidis = $_SESSION['euserid'];
$sql = "select picture from profilepicture where catalogid='$myidis' and type='1'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
if (!empty($picture)){
$gthumbs="v/uploads/gthumbs/$picture";
$gthumbs2="v/uploads/gallery/$picture";
unlink($gthumbs2);unlink($gthumbs);
}
$sql = "DELETE FROM profilepicture where catalogid='$myidis' and type='1'";
$result = $this->delete($sql);
return $result;
}
function delsplashpicture($newsid,$PicturePath)
{
$sql = "select picture from splash where newsid='$newsid'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
if (!empty($picture)){
$file = $PicturePath.$picture;
unlink($file);
}
$sql = "DELETE FROM splash where newsid='$newsid'";
$result = $this->delete($sql);
return $result;
}
function editprofilepicture($catalogid,$title,$description,$isdisplay,$newsid)
{
$myidis = $_SESSION['euserid'];
echo $sql = "update profilepicture set catalogid='$catalogid',title='$title',description='$description',isdisplay='$isdisplay' where id='$newsid' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function getCompanyCategories()
{
$sql = "select * from categories where industry=0 order by categoryname ASC";
$result = $this->select($sql);
return $result;
}
function getProductCategories()
{
$sql = "select * from categories where industry=1 order by categoryname ASC";
$result = $this->select($sql);
return $result;
}
function getprofilepicturebyid()
{
global $link;
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and type='2'";
$result = $this->select($sql);
return $result;
}
function getcatalognewsreport($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from distribute where (isdisplay =10 or isdisplay = 3 or isdisplay = 11 or isdisplay =12 or isdisplay = 5) and catalogid='$myidis' order by newsid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function delDistribution($newsid,$VideoPath)
{
$sql = "select * from distribute where newsid='$newsid'";
$result = $this->select($sql);
$original = $result[0]["original"];
$video = $result[0]["video"];
$picture = $result[0]["picture"];
$type = $result[0]["type"];
if (!empty($video)){
$PicturePath = "v/uploads/picdir/";
$file = $PicturePath.$video.$type;
unlink($file);
$PicturePath = "v/uploads/raw/";
$file = $PicturePath.$video.$type;
unlink($file);
}
$sql = "DELETE FROM distribute where newsid='$newsid'";
$results = $this->delete($sql);
$sql = "DELETE FROM distributions where distribution='$newsid'";
$results = $this->update($sql);
return $results;
}
function getcatalognewsreport2($page,$record,$filter)
{ $myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from reporta where catalogid_fk=$myidis and catalogid_fk <>99 and type <>6 $filter order by created DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getcatalognewsreport6($page,$record,$filter)
{ $myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from profilepicture where catalogid='$myidis' and type=3 order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function layouts($no)
{
$sql = "SELECT *
FROM layouts
WHERE type='2' ORDER BY title ASC
LIMIT 0,$no ";
$result = $this->select($sql);
return $result;
}
function getlayouts($page,$record,$filter)
{
$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "SELECT *
FROM layouts
WHERE type='2' ORDER BY title ASC
LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getmystartags($page,$record,$filter)
{ $myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from profilepicture where catalogid='$myidis' and type=2 and (isdisplay=3 or isdisplay=4 or isdisplay=12 or isdisplay=13 or isdisplay=5 or isdisplay=7 or isdisplay=6 or isdisplay=8 or isdisplay=9) order by adddate DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getmytheme($themeid)
{ $myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from profilepicture where id='$themeid'";
$result = $this->select($sql);
return $result;
}
function getmyconversations($page,$record,$filter,$view1)
{ $myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from tweets where campaign='$view1' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getfavstartag()
{ $myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and def='1' LIMIT 0,1";
$resultG = $this->select($sql);
return $resultG;
}
function getsharedstartag($msg_id)
{ $myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where id='$msg_id' LIMIT 0,1";
$resultG = $this->select($sql);
return $resultG;
}
function makefavstartag()
{ $myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and isdisplay='13' order by adddate desc LIMIT 0,1";
$resultG = $this->select($sql);
return $resultG;
}
function getcatalognewsreport4($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from reporta where catalogid=99 order by viewnum DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getcatalognewsreport5($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from cart where catalogid='$myidis' order by viewnum DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getDetails($newsid)
{
$sql = "select * from elements where newsid =$newsid";
$result2 = $this->select($sql);
return $picture = $result2[0]["picture"];
return $vcat = $result2[0]["vcat"];
}
function getCategory($vcat)
{
$sql = "select * from categories where id =$vcat";
$result = $this->select($sql);
return $categoryname = $result[0]["categoryname"];
}
function getcatalognewsreport3($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from reporta where isdisplay = 15 and type=15 and catalogid_fk=$myidis order by msg_id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function addgratitude($user,$owner,$AppNo,$nani,$upload)
{
$time=time();
$adddate = date("y-m-d");
$viewnum = "1";
$ratenum = "1";
$owner = ucwords($owner);
$title = "Message from $owner: Thank you $user for joining. ";
$sql = "select * from reporta where episodeid=23 and catalogid_fk=$nani";
$result = $this->select($sql);
$episodeid = $result[0]["episodeid"];
if (empty($episodeid)){
$time=time();
$adddate = date("y-m-d");
$viewnum = "1";
$ratenum = "1";
$sql = "insert into reporta (appno,isdisplay,yanani,catalogid_fk,catalogid,original,picture,title,message,type,adddate,viewnum,created,episodeid) values ('$AppNo','15','$nani','$nani','$nani','$upload','$upload','$title','$title','6',' $adddate',' $viewnum',' $time','23')";
$results = $this->insert($sql);
return $results;
}
}
function addtshirt($user,$owner,$AppNo,$nani,$upload,$message)
{
$time=time();
$adddate = date("y-m-d");
$viewnum = "1";
$ratenum = "1";
$title = "$owner: Check out this Tshirt. ";
$sql = "insert into reporta (isdisplay,yanani,catalogid_fk,catalogid,original,picture,title,message,type,adddate,viewnum,created) values ('3','$nani','$nani','$nani','$upload','$upload','$title','$title','0',' $adddate',' $viewnum',' $time')";
$results = $this->insert($sql);
return $results;
}
function addhbd($user,$owner,$AppNo,$nani,$upload,$message)
{
$time=time();
$adddate = date("y-m-d");
$viewnum = "1";
$ratenum = "1";
$title = "$owner: I wish you Happy Birthday $user. ";
$sql = "insert into reporta (isdisplay,yanani,catalogid_fk,catalogid,original,picture,title,message,type,adddate,viewnum,created) values ('3','$nani','$nani','$nani','$upload','$upload','$title','$title','0',' $adddate',' $viewnum',' $time')";
$results = $this->insert($sql);
return $results;
}
function addxmas($user,$owner,$AppNo,$nani,$upload)
{
$time=time();
$adddate = date("y-m-d");
$viewnum = "1";
$ratenum = "1";
$title = "$owner: I wish you Merry Christmas $user. ";
$sql = "insert into reporta (isdisplay,yanani,catalogid_fk,catalogid,original,picture,title,message,type,adddate,viewnum,created) values ('3','$nani','$nani','$nani','$upload','$upload','$title','$title','0',' $adddate',' $viewnum',' $time')";
$results = $this->insert($sql);
return $results;
}
function Insert_UpdateX($nani,$text,$uploads,$AppNo,$upload,$owner)
{
$update=mysql_real_escape_string($update);
$time=time();
$ip=$_SERVER['REMOTE_ADDR'];
global $link;
$query = mysqli_query($link,"SELECT msg_id,message FROM `reporta` WHERE catalogid_fk='$nani' order by msg_id desc limit 1") or die(mysql_error());
$result = mysqli_fetch_array($query);
if ($text!=$result['message'] || $text==$result['message']) {
$uploads_array=explode(',',$uploads);
$uploads=implode(',',array_unique($uploads_array));
$isdisplay = 15;
if(!empty($_GET['newnani']))
{
$nani = $_GET['newnani'];
}
mysqli_query($link, "SET SESSION sql_mode = ''");
global $link;
$ids = rand(111111111111111,1111111111111111);
$uid =$nani;
$file_name = $upload;
$image_type = "image/jpeg";
$file_ext = "jpg" ;
$file_size = 2;
$is_image = 1;
$image_width = 600;
$image_height = 600;
if(!empty($_GET['mydataID']) && !empty($_GET['mydataRecord']))
{
$mydataID=$_GET['mydataID'];
$mydataRecord=$_GET['mydataRecord'];
$max=$_GET['count'];
global $link;
$query = mysqli_query($link,"SELECT * FROM `reporta` WHERE episodeid='$mydataRecord' and vcat='$mydataID'") or die(mysql_error());
$row=mysqli_fetch_array($query);
if(empty($row))
{
$query = mysqli_query($link,"INSERT INTO `reporta` (message,original, catalogid_fk,catalogid, ip,created,type,isdisplay,yanani,appno,filter,ids,uid,file_name,image_type,file_ext,file_size,is_image,image_width,image_height,vcat,episodeid,newsid)
VALUES
(N'$text', '$upload', '$nani','$nani', '$ip','$time',6,'$isdisplay','$yanani','$appno','$mood','$ids','$uid','$file_name','$image_type','$file_ext','$file_size','$is_image','$image_width','$image_height','$mydataID','$mydataRecord','$max')") or die(mysql_error());
}
}
else
{
$theme_id=$_GET['theme_id'];
$query = mysqli_query($link,"INSERT INTO `reporta` (message,original, catalogid_fk,catalogid, ip,created,type,isdisplay,yanani,appno,filter,ids,uid,file_name,image_type,file_ext,file_size,is_image,image_width,image_height,newsid)
VALUES
(N'$text', '$upload', '$nani','$nani', '$ip','$time',6,'$isdisplay','$yanani','$appno','$mood','$ids','$uid','$file_name','$image_type','$file_ext','$file_size','$is_image','$image_width','$image_height','$theme_id')") or die(mysql_error());
}
}
}
function mobilePost($nani,$context,$AppNo,$pic)
{
$time=time();
$ip=$_SERVER['REMOTE_ADDR'];
$isdisplay = 15;
global $link;
$query = mysqli_query($link,"INSERT INTO `reporta`
(message,original, catalogid_fk,catalogid, ip,created,type,isdisplay,yanani,appno,filter)
VALUES
(N'$context', '$pic', '$nani','$AppNo', '$ip','$time',6,'$isdisplay','$nani','$appno','elated')") or die(mysql_error());
}
function updatePost($user,$owner,$AppNo,$nani,$upload,$context)
{
$sql = "select * from reporta where catalogid_fk=$nani order by msg_id desc limit 0,1";
$result = $this->select($sql);
$msg_id = $result[0]["msg_id"];
$sql = "UPDATE reporta SET original='$upload' WHERE catalogid_fk='$nani' and msg_id='$msg_id'";
$result = $this->update($sql);
return $result;
}
function updateVideo($user,$owner,$AppNo,$nani,$vidme,$context)
{
$sql = "select * from reporta where catalogid_fk=$nani order by msg_id desc limit 0,1";
$result = $this->select($sql);
$msg_id = $result[0]["msg_id"];
$sql = "UPDATE reporta SET picture='$vidme' WHERE catalogid_fk='$nani' and msg_id='$msg_id'";
$result = $this->update($sql);
return $result;
}
function addshop($user,$owner,$AppNo,$nani,$upload,$newsid)
{
$sql = "select * from reporta where episodeid='$newsid' and catalogid_fk=$nani";
$result = $this->select($sql);
$episodeid = $result[0]["episodeid"];
if (empty($episodeid)){
$time=time();
$adddate = date("y-m-d");
$viewnum = "1";
$ratenum = "1"; $title = ' I like this! ';
$title = '<a class="viewopen2" id='.$newsid.'> <img src="images/shop2.png" height="40" style="-webkit-transform: translate3d(0,0,0); "> I like this product... | More</a>';
$sql = "insert into reporta (isdisplay,yanani,catalogid_fk,catalogid,original,picture,title,message,type,adddate,viewnum,created,episodeid) values ('3','$nani','$nani','$nani','$upload','$upload','$title','$title','9',' $adddate',' $viewnum',' $time','$newsid')";
$results = $this->insert($sql);
return $results;
}
}
function addmessage($user,$owner,$AppNo,$nani,$upload,$message)
{
$time=time();
$adddate = date("y-m-d");
$viewnum = "1";
$ratenum = "1";
$title = "$owner: I wish you Merry Christmas $user. ";
$sql = "insert into reporta (isdisplay,yanani,catalogid_fk,catalogid,original,picture,title,message,type,adddate,viewnum,created) values ('0','$nani','$nani','$nani','$upload','$upload','$title','$title','0',' $adddate',' $viewnum',' $time')";
$results = $this->insert($sql);
return $results;
}
function addwardrobe($appno,$videouser,$yanani,$db_file,$new_image,$titleme,$url,$type,$upload)
{
$time=time();
$ip=$_SERVER['REMOTE_ADDR'];
$newsid=rand(1111111111111,9999999999999999);
$isdisplay = 15;
$part = substr($titleme,-500);
$part = explode('.',$part);
$part = $part[0];
$part = preg_replace('/[\!@#$%^&*()+=,.;:]/', '', $part);
$slugx = "$part";
$type = "15";
$sql = "INSERT INTO `reporta`
(appno,message,catalogid_fk,catalogid,created,type,original,isdisplay,yanani,ip)
VALUES
('$appno','$titleme', '$yanani', '$yanani','$time',$type,'$upload','$isdisplay','$yanani','$ip')";
$results = $this->insert($sql);
return $results;
}
function getelements($category,$page,$record)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from elements where vcat=$category order by viewnum DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getcatalognewsreportP($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from reporta where yanani='$myidis' and isdisplay=4 or isdisplay=5 order by newsid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getSubmission($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from distributions where catalogid='$myidis' and isdisplay=1 and order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getsentReport($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from distributions where catalogid='$myidis' and isdisplay=1 order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getallReports($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from distributions where catalogid='1005023688676301' or catalogid='1005023688676299' or catalogid='1005023688676299' or catalogid='1005023688676282' or catalogid='1005023688676281' or catalogid='1005023688676280' or catalogid='10050236886762' or catalogid='1005023688676277' and isdisplay=1 order by yanani DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getRating($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$start = $page*$record;
$sql = "select * from distributions where catalogid='1005023688676278' and isdisplay=1 order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getmydistributions($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
if (!empty($catid))
{
$sqlstatement = "and distribution= $catid ";
}
$start = $page*$record;
$sql = "select * from distributions where yanani='$myidis' and isdisplay !=4 $sqlstatement order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getmyconnections($page,$record,$yanani,$kind)
{$myidis = $_SESSION['euserid'];
if (!empty($yanani))
{
$sqlstatement = "and yanani= $yanani ";
}
if (!empty($kind))
{
$sqlstatement2 = "and type= $kind ";
}
$start = $page*$record;
$sql = "select * from connections where catalogid='$myidis' or yanani='$myidis' $sqlstatement $sqlstatement2 order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function delAllReport($msg_id,$VideoPath)
{
$sql = "select * from reporta where msg_id='$msg_id'";
$result = $this->select($sql);
$original = $result[0]["original"];
$video = $result[0]["video"];
$picture = $result[0]["picture"];
if (!empty($original)){
$PicturePath = "v/uploads/picdir/";
$file = $PicturePath.$original;
unlink($file);
}
if (!empty($picture)){
$PicturePath = "v/uploads/raw/";
$file = $PicturePath.$original;
unlink($file);
}
$sql = "DELETE FROM reporta where msg_id='$msg_id'";
$results = $this->update($sql);
return $results;
}
function create_slug($string){
$string = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $string );
$string = strtolower($string);
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
return $result;
}
function getallcounties()
{
$sql = "select * from county order by catalogname ASC";
$result = $this->select($sql);
return $result;
}
function getallcountries()
{
$sql = "select * from country order by name ASC";
$result = $this->select($sql);
return $result;
}
function editnewsr2($mytitle,$msg_id,$action,$filter)
{
$myidis = $_SESSION['euserid'];
$time = time();
if($action=="cards"){$type='14'; } else {$type='0';}
$sql = "update reporta set message='$mytitle',created='$time',type='$type',isdisplay='5',action='$action',filter='$filter' where msg_id='$msg_id' and catalogid_fk='$myidis'";
$results = $this->update($sql);
return $results;
}
function editstar2($mytitle,$msg_id)
{
$myidis = $_SESSION['euserid'];
$time = time();
$sql = "update profilepicture set title='$mytitle' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function replaceBrand($pic2,$msg_id1)
{
$myidis = $_SESSION['euserid'];
$time = time();
$sql = "UPDATE posts SET id='0' where catalogid='$myidis'";
$result = $this->update($sql);
global $link;
$query = mysqli_query($link,"INSERT INTO `posts` (themeid,catalogid,picture,title,id) VALUES ('$msg_id1', '$myidis','$pic2','picture','1')") or die(mysql_error());
return $results;
}
function addNewTheme($pichaC,$user_nameX,$appno)
{
$myidis = $_SESSION['euserid'];
$time = time();
$user_nameX = $user_nameX.rand(111,999);
$sql = "DELETE FROM profilepicture where type='2' and catalogid='$myidis'";
$results = $this->delete($sql);
$file = "v/bg.jpg";
$newfile = "v/uploads/gthumbs/".rand(111,999)."$pichaC";
if (!copy($file, $newfile)) {
exit("failed to copy");
}
$newfile =basename($newfile);
global $link;
$query = mysqli_query($link,"INSERT INTO `profilepicture` (`catalogid`, `title`, `picture`, `viewnum`, `adddate`, `ratenum`, `isdisplay`, `description`, `fx`, `appno`, `ip`, `keywords`, `slug`, `overlay`, `def`, `x`, `y`, `type`) VALUES ('$myidis', '$user_nameX', '$newfile', 0, '$time', 0, 7, 'blogmain', '', NULL, '127.0.0.1', '', '', 1, 1, 0, 0, 2)") or die(mysql_error());
return $results;
}
function updateBrand($user_nameX,$msg_id1)
{
$myidis = $_SESSION['euserid'];
$time = time();
$rand =$user_nameX.rand(100,999);
$sql = "update profilepicture set def='0' where catalogid='$myidis'";
$results = $this->update($sql);
/*$sql = "update profilepicture set picture='$pic2',isdisplay='9' where id='$msg_id1' and catalogid='$myidis'"; */
$sql = "update profilepicture set isdisplay='7',def='1', adddate='$time', description='newsupdate',fx='mesh', title='$rand' where id='$msg_id1' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function editnewsr3($catalogid,$mytitle,$msg_id)
{
$myidis = $_SESSION['euserid'];
$time = time();
$sql = "update reporta set catalogid='$catalogid',isdisplay='5',message='$mytitle',created='$time' where msg_id='$msg_id' and catalogid_fk='$myidis'";
$results = $this->update($sql);
return $results;
}
function mag2($pic,$AppNo)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$time=time();
$sql = "update reporta set isdisplay='12',appno='$AppNo',created='$time' where original='$original'";
$results = $this->update($sql);
return $results;
}
function mag7($pic,$AppNo,$cl,$overlay,$mytitle,$x,$y,$msg_id)
{
$mytitle = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $mytitle);
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$time=time();
$mytitle= rand(100,999);
$sql = "update profilepicture set isdisplay='5',appno='$AppNo',x='$x',y='$y',description='$cl',title='$mytitle',overlay='$overlay',adddate='$time' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function mag9($msg_id,$ren)
{
$time=time();
$myidis = $_SESSION['euserid'];
$sql = "update profilepicture set title='$ren' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function mag8($pic,$fx,$msg_id,$ren)
{
$time=time();
$myidis = $_SESSION['euserid'];
$sql = "update profilepicture set isdisplay='7',fx='$fx',adddate='$time' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function mag6($pic,$AppNo)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$time=time();
$sql = "update reporta set isdisplay='5',appno='$AppNo',created='$time' where original='$original'";
$results = $this->update($sql);
return $results;
}
function mag($original,$action,$AppNo)
{
$myidis = $_SESSION['euserid']; $time=time();
$adddate = date("y-m-d");
$sql = "update reporta set isdisplay='11',created='$time',description='$action',AppNo='$AppNo' where original='$original'";
$results = $this->update($sql);
return $results;
}
function mag10($pic,$AppNo,$cl,$overlay,$mytitle,$x,$y,$msg_id)
{
$mytitle = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $mytitle);
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$time=time();
$mytitle= rand(100,999);
$sql = "update profilepicture set isdisplay='10',appno='$AppNo',x='$x',y='$y',description='$cl',title='$mytitle',overlay='$overlay',adddate='$time' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function editGal($mytitle,$msg_id)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d"); $time=time();
$sql = "update profilepicture set isdisplay='11' ,adddate='$time',title='$mytitle' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function cropGal($msg_id)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d"); $time=time();
$sql = "update profilepicture set isdisplay='10' ,adddate='$time' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function crop($msg_id,$action,$appno)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d"); $time=time();
/*$sql = "update reporta set isdisplay='4',created='$time',appno='$appno',description='$action' where msg_id='$msg_id'"; */
$sql = "update reporta set isdisplay='11',created='$time',appno='$appno',description='$action' where msg_id='$msg_id'";
$results = $this->update($sql);
return $results;
}
function cropS($msg_id)
{
$myidis = $_SESSION['euserid'];
$adddate =time();
$sql = "update profilepicture set isdisplay='4',adddate='$adddate' where id='$msg_id'";
$results = $this->update($sql);
return $results;
}
function cropF($msg_id)
{
$myidis = $_SESSION['euserid'];
$adddate =time();
$sql = "update profilepicture set isdisplay='6',adddate='$adddate' where id='$msg_id' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function crop2($msg_id,$action,$appno)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d"); $time=time();
$sql = "update reporta set isdisplay='11',created='$time',appno='$appno',description='$action' where msg_id='$msg_id'";
$results = $this->update($sql);
return $results;
}
function pimped($msg_id,$appno)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d"); $time=time();
$sql = "update reporta set created='$time',appno='$appno' where msg_id='$msg_id' and catalogid_fk='$myidis'";
$results = $this->update($sql);
return $results;
}
function order($newsid)
{
$id = $newsid ;
$myidis = $_SESSION['euserid'];
echo $sql = "update cart set isdisplay=1 where newsid=$newsid and catalogid='$myidis'";
$result = $this->update($sql);
return $result;
}
function cart($newsid)
{
$newsid = str_replace("obj_", "", $newsid);
$id = $newsid ;
$myidis = $_SESSION['euserid'];
$sql = "select * from cart where newsid='$newsid' and catalogid='$myidis'";
$result = $this->select($sql);
$newsid = $result[0]["newsid"];
$viewnum = $result[0]["viewnum"];
if (empty($newsid)){
$sql="insert into cart (catalogid,newsid) values('$myidis', '$id')";
$result = $this->insert($sql);
$sql = "update cart set viewnum=1 where newsid=$newsid and catalogid='$myidis'";
$result = $this->update($sql);
return $result;
}
if (!empty($newsid)){
$sql = "update cart set viewnum=$viewnum+1 where newsid=$newsid and catalogid='$myidis' ";
$result = $this->update($sql);
}
$sqlX = "select * from elements where newsid='$newsid'";
$resultX = $this->select($sqlX);
$viewnumX =$resultX[0]["viewnum"];
$sqlX = "update elements set viewnum=$viewnumX+1 where newsid=$newsid";
$resultX = $this->update($sqlX);
}
function share($msg_id)
{
$sqlX = "select * from reporta where msg_id='$msg_id'";
$resultX = $this->select($sqlX);
$viewnumX =$resultX[0]["viewnum"];
$sqlX = "update reporta set viewnum=$viewnumX+1 where msg_id=$msg_id";
$resultX = $this->update($sqlX);
}
function pimpedWard($newsid)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$sql = "update reporta set isdisplay='14' where newsid='$newsid' and yanani='$myidis'";
$results = $this->update($sql);
return $results;
}
function editDistribution2($comments,$id)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$sql = "update distributions set comments='$comments' where id='$id'";
$results = $this->update($sql);
return $results;
}
function editDistribution($mytitle,$content,$keywords,$isdisplay,$vcat,$newsid)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$sql = "update distribute set title='$mytitle',content='$content',isdisplay='5',keywords='$keywords',vcat='$vcat' where newsid='$newsid' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function delConnection($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "update connections set isdisplay=7 where id='$msg_id' and yanani='$myidis'";
$results = $this->update($sql);
}
function delnews2($msg_id,$VideoPath,$distri)
{
if($distri == 0)
{
$sql = "update distributions set isdisplay=4 where id='$newsid'";
$results = $this->update($sql);
return $results;
}
else {
$sql = "DELETE FROM distributions where id='$newsid'";
$results = $this->delete($sql);
return $results;
}
}
function delnews3($newsid3,$VideoPath)
{
$myidis = $_SESSION['euserid'];
$sql = "update distributions set isdisplay=0 where id='$newsid3' and catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function delOpenGallery($msg_id,$VideoPath)
{
$sql = "select * from profilepicture where id='$msg_id'";
$result = $this->select($sql);
$original = $result[0]["original"];
$video = $result[0]["video"];
$original = $result[0]["picture"];
$type = $result[0]["type"];
if (!empty($original)){
$PicturePath = "v/uploads/gallery/";
$PicturePath2 = "v/uploads/gthumbs/";
$file = $PicturePath.$original;
$file2 = $PicturePath2.$original;
unlink($file);
unlink($file2);
}
$myidis = $_SESSION['euserid'];
$sql = "DELETE FROM profilepicture where id='$msg_id' and catalogid='$myidis'";
$results = $this->delete($sql);
}
function delcart($newsid)
{
$myidis = $_SESSION['euserid'];
$sql = "DELETE FROM cart where newsid='$newsid' and catalogid='$myidis'";
$results = $this->delete($sql);
}
function delnews($msg_id,$VideoPath)
{
$sql = "select * from reporta where msg_id='$msg_id'";
$result = $this->select($sql);
$original = $result[0]["original"];
$video = $result[0]["video"];
$picture = $result[0]["picture"];
$type = $result[0]["type"];
if (!empty($original)){
$PicturePath = "v/uploads/raw/";
$file = $PicturePath.$original;
unlink($file);
}
}
function getmygifs($catalogid)
{
global $link;
$sql = "select * from elements where catalogid='$catalogid' order by newsid asc limit 0,11";
$result = $this->select($sql);
return $result;
}
function delgif()
{
global $link;
$myidis = $_SESSION['euserid'];
echo "select * from elements where catalogid='$myidis'";
$rs_settings = mysqli_query($link,"select * from elements where catalogid='$myidis'");
$num = mysqli_num_rows($rs_settings);
while ($row_settings = mysqli_fetch_array($rs_settings)) {
$picture = "v/uploads/gif/".$row_settings['picture'] ;
unlink($picture);
}
/*Header ( 'Content-type:image/gif' );
echo $gif->GetAnimation ( );
*/
$rs_settings = mysqli_query($link,"delete from elements where catalogid='$myidis'");
}
function delconversation($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "DELETE FROM tweets where catalogid='$myidis' and campaign ='$msg_id'";
$results = $this->delete($sql);
$sql = "DELETE FROM campaign where newsid ='$msg_id'";
$results = $this->delete($sql);
return $results;
}
function delconversation_data($msg_id)
{
$sql = "select * from campaign where newsid='$msg_id'";
$resultpic = $this->select($sql);
$picture = $resultpic[0]["hashtag"];
if (!empty($picture))
{
$PicturePath = "v/uploads/mydata/";
$file = $PicturePath.$picture;
unlink($file);
}
$results = $this->delete($sql);
$sql = "DELETE FROM campaign where newsid ='$msg_id'";
$results = $this->delete($sql);
return $results;
}
function delconversation_font($msg_id)
{
$sql = "select * from myfonts where layerid='$msg_id'";
$resultpic = $this->select($sql);
$picture = $resultpic[0]["font"];
if (!empty($picture))
{
$PicturePath = "assets/newfont/";
$file = $PicturePath.$picture;
unlink($file);
}
$results = $this->delete($sql);
$sql = "DELETE FROM myfonts where layerid ='$msg_id'";
$results = $this->delete($sql);
return $results;
}
function delstar($msg_id)
{
$sql = "select * from profilepicture where id='$msg_id'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
if (!empty($picture)){
$PicturePath = "v/uploads/startags/";
$file = $PicturePath.$original;
unlink($file);
$PicturePath = "v/uploads/thumbs/";
$file = $PicturePath.$original;
unlink($file);
}
$sql = "DELETE FROM profilepicture where id='$msg_id'";
$results = $this->delete($sql);
/// clear layers
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and type='1' order by id DESC LIMIT 0,1";
$picture = $result[0]["picture"];
$sql = "select * from layers where themeid='$msg_id'";
$result = $this->select($sql);
$layer0 = $result[0]["layer0"];
$layer1 = $result[0]["layer1"];
$layer2 = $result[0]["layer2"];
$layer3 = $result[0]["layer3"];
$layer4 = $result[0]["layer4"];
if (!empty($layer0) && ($layer0 != $picture )){
$PicturePath = "v/uploads/gthumbs/";
$file = $PicturePath.$layer0;
unlink($file);
}
if (!empty($layer1) && ($layer1 != $picture ))
{
$file = $PicturePath.$layer1;
unlink($file);
}
if (!empty($layer2) && ($layer2 != $picture ))
{
$file = $PicturePath.$layer2;
unlink($file);
}
if (!empty($layer3) && ($layer3 != $picture ))
{
$file = $PicturePath.$layer3;
unlink($file);
}
if (!empty($layer4) && ($layer3 != $picture ))
{
$file = $PicturePath.$layer4;
unlink($file);
}
$sql = "DELETE FROM layers where themeid='$msg_id'";
$results = $this->delete($sql);
return $results;
}
function def($msg_id)
{
$time = time();
$myidis = $_SESSION['euserid'];
$sql = "update profilepicture set def='0' where catalogid='$myidis'";
$results = $this->update($sql);
$sql = "update profilepicture set def='1',adddate='$time' where id='$msg_id'";
$results = $this->update($sql);
return $results;
}
function onboarded($userid)
{
$sql = "update users set onboarded='1' where catalogid='$userid'";
$results = $this->update($sql);
return $results;
}
function saveContent($msg_id)
{
}
function addPosterX($idImport,$poster)
{
$sql = "update profilepicture set poster='$poster',picture='$poster' where id='$idImport'";
$results = $this->update($sql);
}
function importPhotoshopLayers($idImport,$layerContent,$layerParams,$editor2Json)
{
$time = time();
$myidis = $_COOKIE['euserid'];
$sql = "DELETE FROM layerorder where themeid='$idImport'";
$result = $this->delete($sql);
$sql = "INSERT INTO layerorder (themeid,graphic_order,catalogid,params,layers,settings,type,position,layers2) VALUES ('$idImport','1','$myidis','','','','2','0','$editor2Json')";
$results = $this->insert($sql);
return $results;
}
function importPhotoshopTheme($idImport,$themeParams)
{
$time = time();
$myidis = $_SESSION['euserid'];
$settings = '{"version":5}';
$sql = "update profilepicture set def='0' where catalogid='$myidis'";
$results = $this->update($sql);
$sql = "update profilepicture set def='1',adddate='$time',settings='$settings' ,isdisplay='13',description='elated',y='0',x='0',type='2' where id='$idImport'";
$results = $this->update($sql);
$sql = "update profilepicture set params='$themeParams' where id='$idImport'";
$results = $this->update($sql);
/*$sql = "select * from profilepicture where id='$idImport'";
$result = $this->select($sql);
$params = $result[0]["params"];
$layers =str_replace("[brandsystem_theme]","[brandsystem_theme alias=\"eededed\"]",$params);
$sql = "update profilepicture set params='$layers' where id='$idImport'";
$results = $this->update($sql);
*/
return $results;
}
function getAlphabetFile($pic)
{
global $link;
$sql = "select * from 3dfonts where picture = '$pic' limit 0,1";
$result = $this->select($sql);
$params = $result[0]["params"];
return $params;
}
function jointeam($msg_id)
{
$time = time();
$myidis = $_SESSION['euserid'];
$sql = "update share set info='1' where friend_two='$myidis' and type='1' and role='memb' and themeid='$msg_id'";
$results = $this->update($sql);
return $results;
}
function createCategoryColors($brandname)
{
$sqlone = "SELECT * FROM `brandcolors` WHERE brandname='$brandname' limit 0,1";
$result = $this->select($sqlone);
$brandnameX = $result[0]["brandname"];
if (empty($brandnameX)){
$sql = "INSERT INTO brandcolors (brandname) VALUES ('$brandname')";
$results = $this->insert($sql);
}
return $results;
}
function createCategoryColorsDetails($uniqueID,$brandname,$colorhex)
{
$sql = "INSERT INTO brandcolorstext (label,uniqueid,hex) VALUES ('$brandname','$uniqueID','$colorhex')";
$results = $this->insert($sql);
return $results;
}
function createCategoryColorsPDFs($url,$resource)
{
$sql = "INSERT INTO brandpdfs (url,brandname) VALUES ('$url','$resource')";
$results = $this->insert($sql);
return $results;
}
function clearDef()
{
$time = time();
$myidis = $_SESSION['euserid'];
$sql = "update profilepicture set def='0' where catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function removePostPicture()
{
$time = time();
$myidis = $_SESSION['euserid'];
$sql = "update posts set id='0' where catalogid='$myidis'";
$results = $this->update($sql);
return $results;
}
function normalizeTheme($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "update profilepicture set def='0' where catalogid='$myidis'";
$results = $this->update($sql);
$sql = "update profilepicture set def='1' where id='$msg_id'";
$results = $this->update($sql);
return $results;
}
function editnewsr($catalogid,$mytitle,$content,$keywords,$isdisplay,$description,$vcat,$summary,$thumb,$newsid,$slug,$episodeid)
{
$myidis = $_SESSION['euserid'];
$adddate = date("y-m-d");
$sql = "update distributions set catalogid='$catalogid',title='$mytitle',content='$content',episodeid='$episodeid',slug='$slug',keywords='$keywords',isdisplay='$isdisplay',description='$description',adddate='$adddate',vcat='$vcat',summary='$summary',thumb='$thumb' where newsid='$newsid' and yanani='$myidis'";
$results = $this->update($sql);
return $results;
}
function editslugr($newsid,$slug,$mytitle,$str)
{
$str = $mytitle;
$str = rtrim($str);
$bad_words = array('video5','uservideo');
$replace_str = "eziki";
if (!is_array($bad_words))
{
$bad_words = explode(',', $bad_words);
}
for ($x=0; $x < count($bad_words); $x++)
{
$fix = isset($bad_words[$x]) ? $bad_words[$x] : '';
$_replace_str = $replace_str;
if (strlen($replace_str)==1){
$_replace_str = str_pad($_replace_str, strlen($fix), $replace_str);
}
$str = preg_replace('/'.$fix.'/i', $_replace_str, $str);
}
$str = ereg_replace("[^A-Za-z0-9]", "-", $str);
$str = preg_replace('/[\--]/', '-', $str );
//$str = preg_replace('/[\!-@#$%^&*()+=,.;: ]/', '-', $str);
/*$extt = "$newsid";
$str = $str.$extt ;
*/
$str = strtolower($str);
/* $sql = "UPDATE distributions SET slug=\"$str\" WHERE newsid='$newsid'";
$result = $this->update($sql);*/
return $result;
}
function getOriginal($original)
{
$sql = "select * from reporta where original='$original'";
$result = $this->select($sql);
return $result;
}
function getnewsbyidr2($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from reporta where msg_id='$msg_id' and catalogid_fk=$myidis";
$result = $this->select($sql);
return $result;
}
function getnewsbyidr6($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where id='$msg_id' and catalogid='$myidis' and type=3";
$result = $this->select($sql);
return $result;
}
function get3DFont($msg_id)
{
$myidis = $_SESSION['euserid'];
if($msg_id=="0")
{
$sql = "select * from 3DFonts where catalogid='$myidis' and type=3 order by id desc limit 0,1";
}
else
{
$sql = "select * from 3DFonts where id='$msg_id' and catalogid='$myidis' and type=3";
}
$result = $this->select($sql);
return $result;
}
function get3DFontX($msg_id)
{
$myidis = $_SESSION['euserid'];
if($msg_id=="0")
{
$sql = "select x,y,width,height from 3DFonts where catalogid='$myidis' and type=3 order by id desc limit 0,1";
}
else
{
$sql = "select x,y,width,height from 3DFonts where id='$msg_id' and catalogid='$myidis' and type=3";
}
$result = $this->select($sql);
return $result;
}
function getnewsbyidr7($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from picture where newsid='$msg_id' and catalogid='$myidis'";
$result = $this->select($sql);
return $result;
}
function getstar5($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where id='$msg_id'";
$result = $this->select($sql);
return $result;
}
function getstar2($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where id='$msg_id'";
$result = $this->select($sql);
return $result;
}
function getThemeStar($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from posts where newsid='$msg_id'";
$result = $this->select($sql);
return $result;
}
function getPost()
{
$myidis = $_SESSION['euserid'];
$sql = "select * from posts where catalogid='$myidis' and id='1'";
$result = $this->select($sql);
return $result;
}
function preparePng($picture,$msg_id)
{
$size = GetImageSize("v/uploads/gthumbs/$picture");
echo $mime = $size['mime'];
/*
$blank="js/blank.jpg";
$brand = imagecreatefrompng($gthumbs);
$brand_width = imagesx($brand);
$brand_height = imagesy($brand);
$background = imagecreatefromjpeg($blank);
$size = getimagesize($blank);
$dest_x = 0;
$dest_y =0;
imagecopy($background, $brand, $dest_x, $dest_y, 0, 0, $brand_width, $brand_height);
header('content-type: image/jpeg');
imagejpeg($background);
imagedestroy($background);
imagedestroy($brand);*/
/* $sql = "select picture from profilepicture where id='$newsid'";
$result = $this->select($sql);
$picture = $result[0]["picture"];
if (!empty($picture)){
$gthumbs="v/uploads/gthumbs/$picture";
$gthumbs2="v/uploads/gallery/$picture";
unlink($gthumbs2);unlink($gthumbs);
*/
}
function getFont($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from textlayer where themeid='$msg_id' and catalogid='$myidis'";
$result = $this->select($sql);
return $result;
}
function getlayers($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from layerorder where themeid='$msg_id' and catalogid='$myidis' and type='2' order by position asc";
$result = $this->select($sql);
if(empty($result)){
$sql = "select * from layerorder where themeid='$msg_id' and catalogid='$myidis' and type='1' order by position asc";
$result = $this->select($sql);
}
return $result;
}
function checkMyType($brand)
{
if (strpos($brand, 'route=theUpdate') !== false){$type = "theUpdate" ; }
if (strpos($brand, 'route=thePlain') !== false){$type = "thePlain" ; }
if (strpos($brand, 'route=theUrl') !== false){$type = "theUrl" ; }
if (strpos($brand, 'route=theName') !== false){$type = "theName" ; }
if (strpos($brand, 'route=theUser') !== false){$type = "theUser" ; }
if (strpos($brand, 'route=profile') !== false){$type = "theProfile" ; }
if (strpos($brand, '/filters/mood') !== false){$type = "theGraphics" ; }
if (strpos($brand, 'route=profilePic') !== false){$type = "ProfilePic" ; }
if (strpos($brand, 'v/uploads/gthumbs') !== false){$type = "Uploaded" ; }
return $type;
}
function checkLayer($type,$column,$catalogid,$themeid)
{
$sql = "select * from myfonts where catalogid='$catalogid' and themeid='$themeid' and layertype='$type' order by id DESC LIMIT 0,1";
$result = $this->select($sql);
$type = $result[0]["$column"];
return $type;
}
function updateLayerFont($type,$column,$catalogid,$themeid,$font)
{
$sql = "update myfonts set font='$font' where catalogid='$catalogid' and themeid='$themeid' and layertype='$type' ";
$result = $this->update($sql);
return $result;
}
function getmylayers($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from layerorder where themeid='$msg_id' and catalogid='$myidis' and type='2' order by position asc limit 1,11";
$result = $this->select($sql);
if(empty($result)){
$sql = "select * from layerorder where themeid='$msg_id' and catalogid='$myidis' and type='1' order by position asc limit 1,11";
$result = $this->select($sql);
}
return $result;
}
function getmylayersduplicate($themeid,$catalogid)
{
$sql = "select * from layerorder where themeid='$themeid' order by graphic_order asc limit 0,40";
$result = $this->select($sql);
return $result;
}
function getAllHexColors($page)
{
$sql = "select * from brandcolorstext order by brandid asc limit $page,2010";
$result = $this->select($sql);
return $result;
}
function getMyLayerDetails($themeid)
{
$sql = "select * from profilepicture where id='$themeid'";
$result = $this->select($sql);
return $result;
}
function getMyDesignDetails($themeid,$userid)
{
$sql = "select * from profilepicture where id='$themeid' and catalogid='$userid'";
$result = $this->select($sql);
return $result;
}
function getMyFontDetails($userid,$isdisplay)
{
$sql = "select * from myfonts where isdisplay='$isdisplay' and catalogid='$userid'";
$result = $this->select($sql);
return $result;
}
function getMyColorDetails($userid,$isdisplay,$kind)
{
if($kind == "custom")
{
$sql = "select * from brandcolors where type=1 and catalogid='$userid' limit 0,1";
$colorCustomDetails = $this->select($sql);
return $colorCustomDetails;
}
else{
/* $sql = "select * from myfonts where isdisplay='$isdisplay' and catalogid='$userid' limit 0,1";
$colorDetails = $this->select($sql);
while ( list($key,$val)=each($colorDetails) ) {
$colorID = stripslashes($val["themeid"]);
$sql = "SELECT brandcolorstext.hex FROM brandcolors LEFT JOIN brandcolorstext ON brandcolors.brandname = brandcolorstext.uniqueid WHERE brandcolors.type = 0 AND brandcolors.brandid = $colorID";
$colorSets = $this->select($sql);
return $colorSets;
}*/
$sql = "SELECT * FROM myfonts WHERE isdisplay = '$isdisplay' AND catalogid = '$userid' LIMIT 1";
$colorDetails = $this->select($sql);
if (!empty($colorDetails)) {
$colorID = (int)$colorDetails[0]["themeid"]; // At least cast to integer
$sql = "SELECT brandcolorstext.hex
FROM brandcolors
LEFT JOIN brandcolorstext ON brandcolors.brandname = brandcolorstext.uniqueid
WHERE brandcolors.type = 0 AND brandcolors.brandid = $colorID";
$colorSets = $this->select($sql);
return $colorSets;
}
return [];
}
}
function getlayerDetails($msg_id,$position)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from layerorder where themeid='$msg_id' and position=$position";
$result = $this->select($sql);
return $result;
}
function getlayers2($msg_id, $myidis)
{
$sql = "select * from layers where themeid='$msg_id' and catalogid='$myidis'";
$result = $this->select($sql);
return $result;
}
function getstarpost($moodswing)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where title='%$moodswing%'";
$result = $this->select($sql);
return $result;
}
function getnewsbyidr3($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from reporta where catalogid_fk=$myidis and isdisplay=3 order by msg_id desc limit 0,1";
$result = $this->select($sql);
return $result;
}
function getstar4($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and isdisplay='3' order by adddate desc limit 0,1";
$result = $this->select($sql);
return $result;
}
function getstar3($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and isdisplay='3' order by id desc limit 0,1";
$result = $this->select($sql);
return $result;
}
function getReplace($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from posts where catalogid='$myidis' and id='1' order by newsid desc limit 0,1";
$result = $this->select($sql);
return $result;
}
function getgal($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where catalogid='$myidis' and type='3' order by id desc limit 0,1";
$result = $this->select($sql);
return $result;
}
function getnewsbyidr($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from reporta where msg_id='$msg_id' and catalogid_fk=$myidis";
$result = $this->select($sql);
return $result;
}
function getdistributionbyany($newsid)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from distribute where newsid='$newsid'";
$result = $this->select($sql);
return $result;
}
function getuser($id)
{
$sql = "select * from users where catalogid='$id'";
$resultU = $this->select($sql);
return $resultU;
}
function getconnectionbyid($view)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from connections where id='$view'";
$result = $this->select($sql);
return $result;
}
function getdistributionbyid($newsid)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from distribute where newsid='$newsid' and catalogid='$myidis'";
$result = $this->select($sql);
return $result;
}
function getstarbyid($msg_id)
{
$myidis = $_SESSION['euserid'];
$sql = "select * from profilepicture where id='$msg_id' and catalogid='$myidis'";
$result = $this->select($sql);
return $result;
}
function getallcategoriesC($cataress)
{
$sql = "select * from catalog where catalogid = $cataress order by catalogid DESC";
$result = $this->select($sql);
return $result;
}
function getallcategoriesR($catalogid5)
{
$sql = "select * from catalog where parentid = $catalogid5 order by catalogid DESC";
$result = $this->select($sql);
return $result;
}
function getallcategoriesthisR($videouser)
{
$sql = "select * from users where catalogid=$videouser";
$result = $this->select($sql);
return $result;
}
function getallcategoriesthis($videouser)
{
$sql = "select * from users where catalogid=$videouser";
$result = $this->select($sql);
return $result;
}
function getcatalognews($page,$record,$catid)
{$myidis = $_SESSION['euserid'];
$sqlone = "select * from usercontent where isdisplay !=5 and catalogid='$myidis' and positions !='0' order by newsid desc limit 0,1";
$result = $this->select($sqlone);
$newsid = $result[0]["newsid"];
if (empty($newsid)){
$start = $page*$record;
$sql = "select * from usercontent where isdisplay !=5 and catalogid='$myidis' order by newsid DESC LIMIT $start,$record";
$result = $this->select($sql);
}
if (!empty($newsid)){
$start = $page*$record;
$sql = "select * from usercontent where isdisplay !=5 and catalogid='$myidis' order by positions DESC LIMIT $start,$record";
$result = $this->select($sql);
}
return $result;
}
function autoUpdatingCopyright($startYear){
// given start year (e.g. 2004)
$startYear = intval($startYear);
// current year (e.g. 2007)
$year = intval(date('Y'));
// is the current year greater than the
// given start year?
if ($year > $startYear)
return $year;
else
return $startYear;
}
function text2links($str='') {
if($str=='' or !preg_match('/(http|www\.|@)/i', $str)) { return $str; }
$lines = explode("\n", $str); $new_text = '';
while (list($k,$l) = each($lines)) {
// replace links:
$l = preg_replace("/([ \t]|^)www\./i", "\\1http://www.", $l);
$l = preg_replace("/([ \t]|^)ftp\./i", "\\1ftp://ftp.", $l);
$l = preg_replace("/(http:\/\/[^ )\r\n!]+)/i",
"<a href=\"\\1\">\\1</a>", $l);
$l = preg_replace("/(https:\/\/[^ )\r\n!]+)/i",
"<a href=\"\\1\">\\1</a>", $l);
$l = preg_replace("/(ftp:\/\/[^ )\r\n!]+)/i",
"<a href=\"\\1\">\\1</a>", $l);
$l = preg_replace(
"/([-a-z0-9_]+(\.[_a-z0-9-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)+))/i",
"<a href=\"mailto:\\1\">\\1</a>", $l);
$new_text .= $l."\n";
}
return $new_text;
}
function get_status($twitter_id, $hyperlinks = true) {
/* $c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$src = curl_exec($c);
curl_close($c);
preg_match('/<text>(.*)<\/text>/', $src, $m);
$status = htmlentities($m[1]);
if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a href="%5C%22%5C%5C0%5C%22">\\0</a>', $status);
return($status); */
}
function shorten($string){
$sep = '...';
$length = 8;
echo substr_replace ($string, $sep, $length, - $length);
}
function gethall($catalogid) { $sql = "select * from api where code=$catalogid order by id ASC LIMIT $start,30";
$result = $this->select($sql); return $result; }
function getchannels6() { $sql = "select * from users where admin=4 order by viewnum ASC LIMIT 0,24";
$result = $this->select($sql); return $result; }
function sizeinput($input, $len){
(int)$len;
(string)$input;
$n = substr($input, 0,$len);
$ret = trim($n);
$out = htmlentities($ret, ENT_QUOTES);
return $out;
}
function getallcatalogname()
{
$sql = "select catalogid,catalogname,description from catalog";
$result = $this->select($sql);
return $result;
}
function base64url_encode($plainText) {
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/=', '-_,');
$value = "3";
return $base64url;
}
function base64url_decode($plainText) {
$base64url = strtr($plainText, '-_,', '+/=');
$base64 = base64_decode($base64url);
return $base64;
}
function getalllike2($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "select * from ilikethis where topicid='$myidis' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function recommendation1($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "select * from ratedilike where topicidr='$myidis' order by rid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getcount3()
{
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(topicid) AS mycount from ilikethis where topicid='$myidis' order by id DESC";
$result = $this->select($sql);
return $result;
}
function getcount($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(topicid) AS mycount from ilikethis where topicid='$myidis' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getcountwidgets($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(user) AS mycount from api where user='$myidis' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function gettrackers($page,$record,$catalogid)
{
$start = $page*$record;
$sql = "SELECT COUNT(id) AS mycount from api where code='$catalogid' order by id";
$result = $this->select($sql);
return $result;
}
function getlikers($page,$record,$newsid7)
{
$start = $page*$record;
$sql = "SELECT COUNT(id) AS mycount from ilikethis where address='$newsid7' order by id";
$result = $this->select($sql);
return $result;
}
function getcountnav($page,$record)
{
$start = $page*$record;
$myidis = isset($_SESSION['euserid']);
$sql = "SELECT COUNT(topicid) AS mycount from ilikethis where topicid='$myidis' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getratednav($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT COUNT(topicidr) AS mycount from ratedilike where topicidr='$myidis' order by rid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function userinfo($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "SELECT catalogname from users where catalogid ='$myidis' LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getalllike($page,$record)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "select * from ilikethis where topicid='$myidis' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function getallslidename()
{
$sql = "select slideid,slidename from slideshows";
$result = $this->select($sql);
return $result;
}
function getAllTeams($catalogidX)
{
$sql = "select * from myteam where catalogid='$catalogidX'";
$result = $this->select($sql);
return $result;
}
function myrelatednews()
{
$sql = "select * from news order by newsid DESC LIMIT 1,2 ";
$result = $this->select($sql);
return $result;
}
function myothernews($record)
{
$sql = "select newsid,title,description,picture from news where video='0' and isdisplay=1 order by newsid DESC LIMIT 0,10";
$result = $this->select($sql);
return $result;
}
function mytopshows($record)
{
$sql = "select newsid,title,description,picture from news where catalogid='24' and isdisplay=1 order by newsid DESC LIMIT 0,10";
$result = $this->select($sql);
return $result;
}
function allrelatednews()
{
$sql = "select * from news order by newsid DESC LIMIT 1,14";
$result = $this->select($sql);
return $result;
}
function getallcomments()
{
$sql="select * from icomment where type=1 order by sn DESC LIMIT 0,8";
$result = $this->select($sql);
return $result;
}
function allchannelvideos($catalogid)
{
$sql = "select * from users where catalogid='$catalogid'";
$result = $this->select($sql);
$parentname = $result[0]["catalogname"];
return $parentname;
}
function unprocessed($catalogid)
{
$sql = "select COUNT(msg_id) AS mycount from reporta where catalogid_fk='$catalogid' and isdisplay=3";
$result = $this->select($sql);
$unprocessed = $result[0]["mycount"];
return $unprocessed;
}
function nextvideo($page,$newsid,$catid)
{
$sql = "select * from usercontent where isdisplay=1 and catalogid='$catid' and isdisplay=1 and newsid > $newsid order by newsid ASC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function previousvideo($page,$newsid,$catid)
{
$sql = "select * from usercontent where isdisplay=1 and catalogid='$catid' and isdisplay=1 and newsid < $newsid order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function ugcgetnewsbycatid($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,slug,title,description,picture,viewnum from usercontent where isdisplay=1 and catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function ugcgetnewsbycatidmobile($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from usercontent where isdisplay=1 and catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function ugcgetbrowsebycatid2($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from usercontent where isdisplay=1 and vcat='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,10";
$result = $this->select($sql);
return $result;
}
function getallcomments2($pagenext,$newsid)
{
$start = $page*$record;
$sql="select * from icomment where type=0 order by sn DESC LIMIT $start,4";
$result = $this->select($sql);
return $result;
}
function getallcomments4($pagenext,$newsid)
{
$start = $page*$record;
$sql="select * from icomment where type=0 order by sn DESC LIMIT $start,4";
$result = $this->select($sql);
return $result;
}
function ugcchannel($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from usercontent where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function allEpisodes($page,$record,$epi)
{
$start = $page*$record;
$sql = "select * from usercontent where episodeid='$epi' and isdisplay=1 order by newsid DESC LIMIT $start,200";
$result = $this->select($sql);
return $result;
}
function ugcchannelpopular($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from usercontent where catalogid='$catid' and isdisplay=1 order by viewnum DESC LIMIT 3,6";
$result = $this->select($sql);
return $result;
}
function ugcchannelsimilarvideos($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from usercontent where catalogid='$catid' and isdisplay=1 order by viewnum DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function ugcchannelgetsimilarvideos($page,$record,$vcat,$catalogid5)
{
$start = $page*$record;
$sql = "select * from usercontent where vcat='$vcat' and catalogid != '$catalogid5' and isdisplay=1 order by viewnum DESC LIMIT 15,6";
$result = $this->select($sql);
return $result;
}
function ugcchannelgetsimilarchannels($page,$record,$vcat,$catalogid5)
{
$start = $page*$record;
$sql = "select * from usercontent where vcat='$vcat' and catalogid != '$catalogid5' and isdisplay=1 order by viewnum DESC LIMIT 0,6";
$result = $this->select($sql);
return $result;
}
function browsebycatid($page,$record,$categoryid2)
{
$start = $page*$record;
$sql = "select newsid,slug,title,description,picture,viewnum from usercontent vcat='$categoryid2' and isdisplay=1 order by newsid DESC LIMIT $start,200";
$result = $this->select($sql);
return $result;
}
function getallthetags($newsid4)
{
$sql="select * from tags where newsid=$newsid4 and (votes_up - votes_down > -5) order by frequency DESC LIMIT 0,8";
$result = $this->select($sql);
return $result;
}
function gettimedisplay()
{
$sql="select * from timeadmin order by timeid DESC LIMIT 0,100";
$result = $this->select($sql);
return $result;
}
function getslidedisplay()
{
$sql="select * from slideshows order by slideid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getslideshow()
{
$sql="select * from inewsgallery order by newsid DESC LIMIT 0,100";
$result = $this->select($sql);
return $result;
}
function gettimeline()
{
$sql="select * from timeline order by newsid DESC LIMIT 0,100";
$result = $this->select($sql);
return $result;
}
function icomments()
{
$sql="select id, mycomment, myname, newsid from icomment ";
$result = $this->select($sql);
return $result;
}
function getchildcatalog2($catid)
{
$sql = "select * from users order by viewnum desc";
$result = $this->select($sql);
return $result;
}
function getfeaturedchannel($catid)
{
$sql = "select * from users where admin=1 order by catalogid desc limit 8,4";
$result = $this->select($sql);
return $result;
}
function getlivec($catid)
{
$sql = "select * from users where admin=4 order by catalogid desc limit 0,4";
$result = $this->select($sql);
return $result;
}
function getchildcatalog($catid)
{
$sql = "select catalogid,catalogname,slug from users where parentid='$catid' order by catalogid LIMIT 0,10";
$result = $this->select($sql);
return $result;
}
function getbrowse($catid)
{
$sql = "select * from categories order by categoryname LIMIT $catid,100";
$result = $this->select($sql);
return $result;
}
function browsechannels($catid2)
{
$sql = "select * from users where admin=1 order by catalogname asc LIMIT $catid2,100";
$result = $this->select($sql);
return $result;
}
function browsechannelsX($start,$stop)
{
$sql = "select * from users where admin=1 order by catalogname asc LIMIT $start,$stop";
$result = $this->select($sql);
return $result;
}
function browsechannelsgo($page,$record,$order,$ascdesc)
{
$start = $page*$record;
if (empty($ascdesc)) {
$ascdesc = "ASC";
}
if (empty($order)) {
$order = "viewnum";
}
if ($order == "viewnum") {
$order = "viewnum";
}
elseif ($order == "date")
{
$order = "date";
}
elseif ($order == "ratenum")
{
$order = "ratenum";
}
elseif ($order == "catalogname")
{
$order = "catalogname";
}
$sql = "select * from users where admin = 12 or admin = 13 or admin = 14 or admin = 15 or admin = 1 and approved=1 order by $order $ascdesc LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function ugcgetnewsbycatidgo($page,$record,$channel)
{
$start = $page*$record;
$sql = "select * from catalog where parentid='$channel' order by catalogname ASC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function mailinglist($page,$record,$channel)
{
$start = $page*$record;
$myidis = $_SESSION['euserid'];
$sql = "select * from mailing where catalogid='$myidis' order by id DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function browsego($newcategory,$page,$record,$order,$ascdesc)
{
$start = $page*$record;
if (empty($ascdesc)) {
$ascdesc = "ASC";
}
if (empty($order)) {
$order = "catalogname";
}
if ($order == "viewnum") {
$order = "viewnum";
}
elseif ($order == "date")
{
$order = "date";
}
elseif ($order == "ratenum")
{
$order = "ratenum";
}
elseif ($order == "catalogname")
{
$order = "catalogname";
}
$sql = "select * from users where admin=1 and category=$newcategory order by $order $ascdesc LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function browsechannelsmobile($catid2)
{
$randomCrit = rand(1,4);
$ascdesc = rand(1,2);
if($ascdesc == 1){
$ascdesc = "desc";
}
if($ascdesc == 2){
$ascdesc = "asc";
}
if($randomCrit == 1){
$criteria = "catalogid";
}
if($randomCrit == 2){
$criteria = "viewnum";
}
if($randomCrit == 3){
$criteria = "catalogname";
}
if($randomCrit == 4){
$criteria = "date";
}
$sql = "select * from users where admin=1 order by $randomCrit $ascdesc LIMIT 0,30";
$result = $this->select($sql);
return $result;
}
function browsevidss($catid2)
{
$sql = "select * from usercontent order by viewnum desc LIMIT $catid2,500";
$result = $this->select($sql);
return $result;
}
function selecttheme()
{
$sql = "select * from themes order by newsid asc";
$result = $this->select($sql);
return $result;
}
function selectdefaulttheme()
{
$sql = "select * from themes";
$result = $this->select($sql);
return $result;
}
function getcategoryall()
{
$sql = "select * from categories where isdisplay=1 order by categoryname";
$result = $this->select($sql);
return $result;
}
function getcategoryallX($from,$to)
{
$sql = "select * from categories where isdisplay=1 order by categoryname limit $from , $to";
$result = $this->select($sql);
return $result;
}
function getcategorymusic($from,$to)
{
$sql = "select * from categories where isdisplay=2 order by categoryname limit $from , $to";
$result = $this->select($sql);
return $result;
}
function getcategoryallgo()
{
$sql = "select * from onthegocategory order by categoryname";
$result = $this->select($sql);
return $result;
}
function getepisodes()
{
$sql = "select * from catalog order by catalogid asc LIMIT 0,30";
$result = $this->select($sql);
return $result;
}
function getepisodes2($catalogid5)
{
if($catalogid5 ==0)
{
$statement = " ";
}
else
{
$statement = "where parentid=$catalogid5 ";
}
$sql = "select * from catalog $statement order by catalogid desc LIMIT 0,30";
$result = $this->select($sql);
return $result;
}
function getepisodeschannel($catalogid)
{
$sql = "select * from catalog where parentid=$catalogid order by catalogid desc LIMIT 0,30";
$result = $this->select($sql);
return $result;
}
function getvideos()
{
$sql = "select * from usercontent order by newsid DESC LIMIT 0,500";
$result = $this->select($sql);
return $result;
}
function getmusicvideos2($page,$front_latestoncatarecord)
{
$start = $page*$front_latestoncatarecord;
$sql = "select * from usercontent where vcat=27 order by newsid DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function getkeywords($vcat)
{
$start = $page*$front_latestoncatarecord;
$sql = "select * from usercontent where vcat=$vcat order by newsid DESC LIMIT 0,15";
$result = $this->select($sql);
return $result;
}
function getmusicvideos($page,$front_latestoncatarecord)
{
$start = $page*$front_latestoncatarecord;
$sql = "select * from usercontent where vcat=27 order by newsid DESC LIMIT $start,$front_latestoncatarecord";
$result = $this->select($sql);
return $result;
}
function getmusicvideosmobile($page,$front_latestoncatarecord)
{
$start = $page*$front_latestoncatarecord;
$sql = "select * from usercontent where vcat=27 order by newsid DESC LIMIT $start,10";
$result = $this->select($sql);
return $result;
}
function getallvideoscategories($page,$front_latestoncatarecord,$vcat)
{
$start = $page*$front_latestoncatarecord;
$sql = "select * from usercontent where vcat=$vcat order by newsid DESC LIMIT $start,48";
$result = $this->select($sql);
return $result;
}
function getallmobilevideoscategories($page,$front_latestoncatarecord,$vcat)
{
$start = $page*$front_latestoncatarecord;
$sql = "select * from usercontent where vcat=$vcat order by newsid DESC LIMIT $start,10";
$result = $this->select($sql);
return $result;
}
function getallvideos($page,$front_latestoncatarecord,$vcat)
{
$start = $page*$front_latestoncatarecord;
$sql = "select * from usercontent where vcat=$vcat order by newsid DESC LIMIT $start,50";
$result = $this->select($sql);
return $result;
}
function ugcgetnewsbycatid2($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,slug,title,description,picture,viewnum from usercontent where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,10";
$result = $this->select($sql);
return $result;
}
function getchannels4()
{
$sql = "select * from users where admin=1 order by viewnum ASC LIMIT 0,24";
$result = $this->select($sql);
return $result;
}
function getchannels3()
{
$sql = "select * from users order by catalogid DESC LIMIT 0,10000";
$result = $this->select($sql);
return $result;
}
function getchannels5()
{
$sql = "select * from users where admin = 0 order by viewnum DESC LIMIT 0,20";
$result = $this->select($sql);
return $result;
}
function getchannels2()
{
$sql = "select * from users where admin=1 order by catalogid DESC LIMIT 0,100";
$result = $this->select($sql);
return $result;
}
function getchannels()
{
$myidis = $_SESSION['euserid'];
$sql = "select distinct U.user_name,U.slug,U.catalogid,U.friend_count from contacts M, users U,friends F WHERE U.approved='1' AND M.phone=U.catalogid AND M.source = 'phone' and M.catalogid='$myidis' and M.status='0' AND F.friend_two != $myidis AND F.friend_one != $myidis order by rand() desc limit 0,2 ";
$result = $this->select($sql);
return $result;
}
function trending($no)
{
$time = time();
$pasthours =$time -100000;
$myidis = $_SESSION['euserid'];
$sql = "SELECT *
FROM reporta
WHERE type='6' and created >= $pasthours
ORDER BY viewnum DESC
LIMIT $no ";
$result = $this->select($sql);
return $result;
}
function selectAssets($catalogid,$newsid)
{
$sql = "SELECT *
FROM photoshop
WHERE catalogid='$catalogid' and themeid = '$newsid'
ORDER BY id DESC";
$result = $this->select($sql);
return $result;
}
function elements($no,$pic)
{
$sql = "SELECT *
FROM elements where pic='$pic'
ORDER BY title ASC
LIMIT $no ";
$result = $this->select($sql);
return $result;
}
function secondsToTime($seconds) {
$dtF = new DateTime("@0");
$dtT = new DateTime("@$seconds");
return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds');
}
function getcategory2()
{
$sql = "select * from categories order by categoryname LIMIT 13,30";
$result = $this->select($sql);
return $result;
}
function ugcgetchildcatalog($catid)
{
$sql = "select catalogid,catalogname from users where parentid='$catid' order by catalogid LIMIT 0,5";
$result = $this->select($sql);
return $result;
}
function browsecatalog($catid)
{
$sql = "select * from categories where parentid='$catid' order by id LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function getnewsbycatid($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,title,description,picture,viewnum from news where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function browse($page,$record,$catid)
{
$sql = "select newsid,title,description,picture,viewnum from usercontent where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function getnewsbycatidsmall($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,title,description,picture from news where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,2";
$result = $this->select($sql);
return $result;
}
function ugcgetnewsbycatidsmall($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,title,description,picture from usercontent where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,2";
$result = $this->select($sql);
return $result;
}
function channel($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from usercontent where isdisplay=1 and catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function ugcseochannel($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,title,description,video,picture from usercontent where slug='$slug' and isdisplay=1 order by newsid DESC LIMIT 5,20";
$result = $this->select($sql);
return $result;
}
function userplaylist($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from ilikethis where topicid='$catid' order by id DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function channelblog($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from blogs where channelpost='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function channelblog2($page,$record,$catalogid)
{
$start = $page*$record;
$sql = "select * from blogs where catalogid='$catalogid' order by newsid DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function ugcrated($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from ratedilike where topicidr='$catid' order by positions DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function ezikiinaflash($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from usercontent where isdisplay=1 and catalogid=53 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function ugcilike($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from ilikethis where topicid='$catid' order by positions DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function latestvids()
{
$sql = "select * from usercontent where admin='1' order by newsid DESC LIMIT 0,15";
$result = $this->select($sql);
return $result;
}
function ugcchannelsmall($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,title,description,video,picture from usercontent where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function channel2($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,title,description,video,picture from news where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,15";
$result = $this->select($sql);
return $result;
}
function ugcchannel2($page,$record,$catid)
{
$start = $page*$record;
$sql = "select newsid,title,description,video,picture from usercontent where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function addriven($page,$record,$catid,$picha)
{
$start = $page*$record;
$sql = "select * from usercontent where catalogid='$catid' and newsid >= $picha and isdisplay=1 order by newsid ASC LIMIT $start,30";
$result = $this->select($sql);
return $result;
}
function musicplay($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from music where catalogid='$catid' order by newsid DESC LIMIT $start,20";
$result = $this->select($sql);
return $result;
}
function ugcrated2($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from ratedilike where topicidr='$catid' order by positions DESC LIMIT $start,15";
$result = $this->select($sql);
return $result;
}
function ugcilike2($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from ilikethis where topicid='$catid' order by id DESC LIMIT $start,15";
$result = $this->select($sql);
return $result;
}
function gettopnewsbycatid($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from news where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT $start,5";
$result = $this->select($sql);
return $result;
}
function gettopnewsbycatid2($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from news where catalogid='$catid' and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getbranding($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from branding where catalogid='$catid' order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getugcbranding($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from ugcbranding where catalogid='$catid' and isdisplay='1' order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function gettheme($page,$record,$themeid)
{
$start = $page*$record;
$sql = "select * from themes where themeid='$themeid' order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function mainprofile()
{
$sql = "select * from profiletheme";
$result = $this->select($sql);
return $result;
}
function getallprofilepic()
{
$sql = "select * from profilepicture";
$result = $this->select($sql);
return $result;
}
function getoneprofilepic($catalogid)
{
$sql = "select * from profilepicture where catalogid=$catalogid limit 0,1 desc";
$result = $this->select($sql);
return $result;
}
function getallsubmitted()
{ $myidis = $_SESSION['euserid'];
$sql = "select * from distribute";
$result = $this->select($sql);
return $result;
}
function getallshows()
{ $myidis = $_SESSION['euserid'];
$sql = "select * from catalog where parentid = $myidis";
$result = $this->select($sql);
return $result;
}
function inaflashlogo()
{
$sql = "select * from profilepicture where catalogid='53' order by id DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function userX($yanani)
{
$rs_settings = mysqli_query($link,"select * from users where catalogid=$yanani");
while ($row_settings = mysqli_fetch_array($rs_settings)) {
$user_name = strtolower($row_settings['user_name']);
return $user_name;
} }
function getlogo($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from profilepicture where catalogid='$catid' and isdisplay='1' order by id DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getmast($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from header where catalogid='$catid' and isdisplay='1' order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function bgcontent($page,$record,$catid)
{
$start = $page*$record;
$sql = "select * from bg where catalogid='$catid' and isdisplay='1' order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getlatestonhome($record)
{
}
function getlatestblog($record)
{
$sql = "select newsid,myname,mycomment from icomment where id=1 order by sn DESC LIMIT 0,4";
$result = $this->select($sql);
return $result;
}
function breakingnews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=9 and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function politicsnews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=12 and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function sportsnews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=11 and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function worldnews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=14 and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function businessnews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=10 and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function businessnews2($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=10 and isdisplay=1 order by newsid DESC LIMIT 0,4";
$result = $this->select($sql);
return $result;
}
function marketsnews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=17 and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function technologynews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid=13 and isdisplay=1 order by newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function topstory($record)
{
$sql = "select newsid,title,description,video,picture from news where catalogid='22' and isdisplay=1 order by newsid DESC LIMIT 0,7";
$result = $this->select($sql);
return $result;
}
function editorschoice1($record)
{
$sql = "select newsid,title,description,video,picture from news where catalogid='22' and isdisplay=1 order by newsid DESC LIMIT 0,5";
$result = $this->select($sql);
return $result;
}
function topsearched($record)
{
$sql = "select * from searches where isdisplay=0 order by id DESC LIMIT 0,5";
$result = $this->select($sql);
return $result;
}
function picgen($record)
{
$sql = "SELECT * FROM news ORDER BY newsid DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function mostratedcomment($record,$newsid)
{
$sql = "select * from icomment where newsid=$newsid order by votes_up DESC";
$result = $this->select($sql);
return $result;
}
function getrelevant2($newsid)
{
$sql = "select * from relevance where newsid=$newsid order by weight DESC LIMIT 1,2";
$result = $this->select($sql);
return $result;
}
function getrelevant($newsid)
{
$sql = "select * from relevance where newsid=$newsid order by weight DESC LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function headlines($record)
{
$sql = "select newsid,title,description,picture from news where catalogid='22' and isdisplay=1 order by newsid DESC LIMIT 0,11";
$result = $this->select($sql);
return $result;
}
function slide2($record)
{
$sql = "select newsid,title,description,picture from news where isdisplay=1 order by newsid DESC LIMIT 0,4";
$result = $this->select($sql);
return $result;
}
function getcatalognamebyid($catalogid)
{
$sql = "select * from catalog where catalogid='$catalogid'";
$result = $this->select($sql);
$parentname = $result[0]["catalogname"];
return $parentname;
}
function ugcseogetcatalognamebyid($slug)
{
$sql = "select * from users where $slug='$slug'";
$result = $this->select($sql);
$parentname = $result[0]["catalogname"];
return $parentname;
}
function ugcgetcatalognamebyid($catalogid)
{
$sql = "select * from users where catalogid='$catalogid'";
$result = $this->select($sql);
$parentname = $result[0]["catalogname"];
return $parentname;
}
function videobyid($newsid)
{
$sql = "select * from usercontent where isdisplay=1 and newsid='$newsid'";
$result = $this->select($sql);
return $result;
}
function reportabyid($newsid)
{
$sql = "select * from reporta where isdisplay=1 and newsid='$newsid'";
$result = $this->select($sql);
return $result;
}
function browsename($catalogid)
{
$checkSlug = explode("/", $_SERVER["REQUEST_URI"]);
// analyze rewritten url
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$findSlug = $checkSlug[$n]; // isolate the last part of the url
$slug = str_replace("browser.php?slug=", "", $findSlug); // isolate the slug
$sql = "select * from categories where slug='$slug'";
$result = $this->select($sql);
$parentname = $result[0]["categoryname"];
$categoryid = $result[0]["categoryid"];
return $result;
}
function browsename2($vcat)
{
$sql = "select * from categories where categoryid='$vcat'";
$result = $this->select($sql);
$parentname = $result[0]["categoryname"];
$categoryid = $result[0]["categoryid"];
$slug = $result[0]["slug"];
return $result;
}
function ugcgetcatalognamebyslug($catalogid)
{
$checkSlug = explode("/", $_SERVER["REQUEST_URI"]);
// analyze rewritten url
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$findSlug = $checkSlug[$n]; // isolate the last part of the url
$slug = str_replace("ugcchannel.php?slug=", "", $findSlug); // isolate the slug
$sql = "select * from users where slug='$slug'";
$result = $this->select($sql);
return $result;
}
function slugdad($catalogid) { $checkSlug2 = explode("?", $_SERVER["REQUEST_URI"]);
$checkSlug2 = explode("/", $_SERVER["REQUEST_URI"]); $checkfb = explode("&", $_SERVER["REQUEST_URI"]);
$checkUrl = count($checkfb); $part1 = $checkUrl - 3; $part2 = $checkUrl - 2; if($checkUrl >=0)
{ $findPart = $checkfb[$part1]; $slugfb = str_replace("/ugcchannel.php?slug=", "", $findPart);
$slugfb = str_replace("/eziki4", "", $slugfb);
} $checkDir2 = count($checkSlug2); $n2 = $checkDir2 - 1;
$V3e73e47b2 = $checkSlug2[$n2]; $slug2 = str_replace("ugcchannel.php?slug=", "", $V3e73e47b2); $episode = str_replace("ugcchannel.php?episode=", "", $V3e73e47b2);
$checkSlug = explode("&", $slug2);
$checkDir = count($checkSlug); $n = $checkDir - 1; $V3e73e47b = $checkSlug[$n];
$slug = str_replace("slug=", "", $V3e73e47b); if (!empty($slugfb)){ $slug = "$slugfb"; } $sql = "select * from users where slug='$slug'";
$result = $this->select($sql); $cwdbbbcwyvuyvu = $result[0]["catalogname"]; if(!empty($cwdbbbcwyvuyvu))
{ unset($_SESSION['episodeid']); }
if(empty($cwdbbbcwyvuyvu)) { $sql = "select * from catalog where slug='$slug'";
$result = $this->select($sql); $parentid = $result[0]["parentid"]; $episodeName = $result[0]["catalogname"];
$episodeid = $result[0]["catalogid"]; $episodeDescription = $result[0]["description"]; $_SESSION['episodeid']= $episodeid;
$sql4 = "select * from users where catalogid='$parentid'"; $result = $this->select($sql4); } return $result;
}
function checkPublic($catalogidX,$msg_id)
{
$sql = "select * from profilepicture where catalogid='$catalogidX' and id='$msg_id' and public='1'";
$result = $this->select($sql);
return $result;
}
function checkreadyAccount()
{
$myidis = $_SESSION['euserid'];
$sql = "select * from users where catalogid='$myidis'";
$result = $this->select($sql);
$user_name= $result[0]["user_name"];
$catalogid = $result[0]["catalogid"];
$time=time();
$ip=$_SERVER['REMOTE_ADDR'];
//add a coffee theme for a user
$sql = "SELECT picture FROM `profilepicture` WHERE catalogid='$myidis' and type='1'";
$resultp = $this->select($sql);
if(empty($resultp[0]["picture"])) {
$themeid = 1438;
$picme = rand(1,10);
if($picme == 1) { $image ="images/defaults/1.jpg"; }
if($picme == 2) { $image ="images/defaults/2.jpg";}
if($picme == 3) { $image ="images/defaults/3.jpg"; }
if($picme == 4) { $image ="images/defaults/4.jpg"; }
if($picme == 5) { $image ="images/defaults/5.jpg"; }
if($picme == 6) { $image ="images/defaults/6.jpg"; }
if($picme == 7) { $image ="images/defaults/7.jpg";}
if($picme == 8) { $image ="images/defaults/8.jpg"; }
if($picme == 9) { $image ="images/defaults/9.jpg"; }
if($picme == 10) { $image ="images/defaults/10.jpg"; }
if($picme == 11) { $image ="images/defaults/11.jpg"; }
if($picme == 12) { $image ="images/defaults/12.jpg";}
if($picme == 13) { $image ="images/defaults/13.jpg"; }
if($picme == 14) { $image ="images/defaults/14.jpg"; }
if($picme == 15) { $image ="images/defaults/15.jpg"; }
if($picme == 16) { $image ="images/defaults/16.jpg"; }
if($picme == 17) { $image ="images/defaults/17.jpg";}
$pic = basename($image);
$date = md5(time);
$copyimage ="v/uploads/gthumbs/$date".$pic;
$final ="$date".$pic;
copy($image,$copyimage);
$pic = $final;
//add profile picture
$sql_insert = "INSERT INTO `profilepicture` (title,catalogid, ip,adddate,picture,poster,type,affiliate) VALUES ('$user_name', '$catalogid','$ip','$time','$final','$final','1','$themeid')"; $results = $this->insert($sql_insert);
/* exit();
header("Location: indexAlone.php?mode=themes"); */
/*header("Location: index.php");*/
}
/* $sql = "SELECT picture FROM `profilepicture` WHERE catalogid='$myidis' and type='1'";
$resultp = $this->select($sql);
$sql = "select * from profilepicture where catalogid='$myidis' and isdisplay='13' order by adddate desc LIMIT 0,1";
$resultG = $this->select($sql);
$makeit = $resultG[0]["id"] ;
if (!empty($makeit))
{
$sql = "SELECT picture FROM `profilepicture` WHERE catalogid='$myidis' and type='1'";
$resultp = $this->select($sql);
$final = $resultp[0]["picture"];
$makeit = $resultG[0]["id"] ;
$image ="v/uploads/gthumbs/$final";
$date = md5(time);
$copyimage ="v/uploads/gthumbs/$date".$pic;
$final ="$date".$pic;
copy($image,$copyimage);
$pic = $final;
$title = $user_name.rand(111,999);
$alias = $title;
$time=time();
$ip=$_SERVER['REMOTE_ADDR'];
$newsid=md5(time);
if ($ext == "png") {$upload = basename($desti);}
if ($ext == "gif") {$upload = basename($desti);}
include('v/json/jsonTheme.php');
$sql_insert = "INSERT INTO `profilepicture` (title,alias,catalogid, ip,adddate,picture,poster,isdisplay,type,affiliate) VALUES ('$title', '$alias', '$myidis','$ip','$time','$final','$final','13','2','$themeid')";
$results = $this->insert($sql_insert);
exit($results);
}
*/
}
function prepareAccount($ids,$uid2,$file_name,$uid,$created,$file_ext,$file_size,$image_type,$is_image,$image_width,$image_height,$isdisplay)
{
//add profile picture
$sql_insert = "INSERT INTO `general_file_manager` (ids,uid, file_name,created,file_ext,file_size,image_type,is_image,image_width,image_height,isdisplay) VALUES ('$ids','$uid','$file_name','$created','$file_ext','$file_size','$image_type','$is_image','$image_width','$image_height','$isdisplay')";
$results = $this->insert($sql_insert);
}
function addNotification($catalogid,$type,$yanani,$message,$created,$content)
{
global $link;
$time=time();
if($type == "expired")
{
$sql ="select count(*) as total from notifications where yanani='$yanani' and catalogid='$catalogid' and type='expired'";
$rs_duplicate = mysqli_query($link,$sql);
list($total) = mysqli_fetch_row($rs_duplicate);
if ($total > 0)
{ }
else
{
$query = mysqli_query($link,"INSERT INTO `notifications` (catalogid, type, yanani, message, created,original) VALUES ('$catalogid','$type','$yanani','$message','$time','$content')");
}
}
elseif($type == "daysleft")
{
//normal notification
$sql ="select count(*) as total from notifications where yanani='$yanani' and catalogid='$catalogid' and type='daysleft' and message='$message'";
$rs_duplicate = mysqli_query($link,$sql);
list($total) = mysqli_fetch_row($rs_duplicate);
if ($total == 0)
{
$query = mysqli_query($link,"INSERT INTO `notifications` (catalogid, type, yanani, message, created,original) VALUES ('$catalogid','$type','$yanani','$message','$time','$content')"); }
}
else
{
//normal notification
$query = mysqli_query($link,"INSERT INTO `notifications` (catalogid, type, yanani, message, created,original) VALUES ('$catalogid','$type','$yanani','$message','$time','$content')");
}
}
function autologin($id)
{
session_start();
$sql = "select * from users where id='$id'";
$result = $this->select($sql);
$_SESSION['admini']= $result[0]["admin"];
$_SESSION['sluga']= $result[0]["slug"];
$_SESSION['uid']= $result[0]["uid"];
$_SESSION['euserid'] = $result[0]["catalogid"];
$catalogid=$result[0]["catalogid"];
$ids =$result[0]["ids"];
$fullname =$result[0]["fullname"];
$package =$result[0]["package"];
global $link;
$qf=mysqli_query($link,"SELECT * FROM friends WHERE friend_one='$catalogid' and friend_two='$catalogid' and role='me' ");
if(mysqli_num_rows($qf)==0)
{
$sqlf = mysqli_query($link,"INSERT into `friends` (`friend_one`,`friend_two`,`role`) VALUES ('$catalogid','$catalogid','me')");
}
$qf=mysqli_query($link,"SELECT * FROM friends WHERE friend_one='$catalogid' and role='fri' ");
if(mysqli_num_rows($qf)==0)
{
$sqlj= mysqli_query($link,"INSERT into `friends` (`friend_one`,`friend_two`,`role`) VALUES ('$catalogid','81','fri')");
$sqlj= mysqli_query($link,"INSERT into `friends` (`friend_one`,`friend_two`,`role`) VALUES ('81','$catalogid','fri')");
}
if(empty($fullname) || empty($package)){
$email = $result[0]["user_email"];
$catalogname = $result[0]["catalogname"];
$ids =rand(11111111111111111111,22222222222222222222);
$ids=str_replace("-","",$ids);
$date = date("Y-m-d H:i:s");
$permissions = '{"0":"facebook_enable","1":"facebook\/post","2":"instagram_enable","3":"instagram\/post","4":"linkedin_enable","5":"linkedin\/post","6":"twitter_enable","7":"twitter\/post","8":"google_drive","9":"dropbox","10":"photo_type","11":"video_type","max_storage_size":1000,"max_file_size":5,"watermark":"watermark","image_editor":"image_editor"}';
$date2 = date("Y-m-d");
$sql = "update users set ids='$ids',created='$date',date='$date2',fullname='$catalogname',full_name='$catalogname',email='$email',status='1',package='9',expiry_datetime='2022-07-01 17:56:56' where catalogid='$catalogid'";
$result = $this->update($sql);
}
}
function slugtoRecord($catalogid)
{
if (!empty($catalogid)){
$slug = "$catalogid";
}
$sql = "select * from users where slug='$slug'";
$result = $this->select($sql);
$catalogname = $result[0]["catalogname"];
if(!empty($catalogname))
{
unset($_SESSION['episodeid']);
}
//check if episodes with these name exists
if(empty($catalogname)) {
$sql = "select * from catalog where slug='$slug'";
$result = $this->select($sql);
$parentid = $result[0]["parentid"];
$episodeName = $result[0]["catalogname"];
$episodeid = $result[0]["catalogid"];
$episodeDescription = $result[0]["description"];
$_SESSION['episodeid']= $episodeid;
$sql4 = "select * from users where catalogid='$parentid'";
$result = $this->select($sql4);
}
return $result;
}
function checkFileManager($catalogid)
{
$ids = mt_rand().mt_rand();
$sql = "select * from general_file_manager where uid='$catalogid'";
$result = $this->select($sql);
return $result;
}
function checkBrandDetails($catalogid)
{
$sql = "select * from detailsbrand where catalogid='$catalogid'";
$result = $this->select($sql);
return $result;
}
function checkPhotoshopDetails($catalogid,$newsid)
{
$sql = "select * from profilepicture where catalogid='$catalogid' and id='$newsid' order by id desc limit 0,1";
$result = $this->select($sql);
return $result;
}
function checkBrandIdentity($catalogid)
{
$sql = "select * from myfonts where catalogid='$catalogid'";
$result = $this->select($sql);
return $result;
}
function getTeamDetails($view)
{
$sql4 = "select * from myteam where teamid='$view'";
$result = $this->select($sql4);
return $result;
}
function hashbrandtoRecord($view)
{
$sql = "select * from campaign where newsid='$view'";
$result = $this->select($sql);
return $result;
}
function DoYouHaveTheme($nani)
{
$sql = "select * from profilepicture where catalogid='$nani' and isdisplay='13' limit 0,1 ";
$result = $this->select($sql);
$HaveTheme = $result[0]["picture"];
return $HaveTheme;
}
function countTweets($catalogidX,$campaign)
{
$sql = "SELECT COUNT(*) AS count FROM tweets WHERE catalogid='$catalogidX' and campaign ='$campaign'";
$result = $this->select($sql);
$count = $result[0]["count"];
return $count;
}
public function getCampaignTheme($themeid)
{ $myidis = $_SESSION['euserid'];
global $link;
$query = mysqli_query($link,"SELECT * FROM `profilepicture` WHERE id='$themeid'") or die(mysql_error());
$row=mysqli_fetch_array($query);
return $row['title'];
}
function idtoCampaign($catalogid,$viewid)
{
$sql = "select * from campaign where catalogid='$catalogid' and newsid='$viewid'";
$result = $this->select($sql);
return $result;
}
function idtoCampaign2($viewid)
{
$sql = "select * from campaign where newsid='$viewid'";
$result = $this->select($sql);
return $result;
}
function idtoAnyCampaign($viewid)
{
$sql = "select * from campaign where newsid='$viewid'";
$result = $this->select($sql);
return $result;
}
function idtoRecord($catalogid)
{
$sql = "select * from users where id='$catalogid'";
$result = $this->select($sql);
return $result;
}
function idtoBrand($catalogid)
{
$sql = "select * from lovelybrands where catalogid='$catalogid'";
$result = $this->select($sql);
return $result;
}
function idtoDigital($catalogid)
{
$sql = "select * from usersdigital where id='$catalogid'";
$result = $this->select($sql);
return $result;
}
function checkifExpired($catalogid)
{
$sql = "select * from h_users_membership_plans where user_id='$catalogid'";
$result = $this->select($sql);
return $result;
}
function checkCampaignDetails($catalogid,$campaign)
{
$sql = "select * from campaign where catalogid='$catalogid' and newsid='$campaign'";
$result = $this->select($sql);
return $result;
}
function getTemplateDetails($catalogid,$themeid)
{
$sql = "select * from profilepicture where catalogid='$catalogid' and id='$themeid'";
$result = $this->select($sql);
return $result;
}
function checkMyDataOutput($i,$campaign,$who)
{
$sql = "select * from reporta where uid='$who' and episodeid='$i' and vcat='$campaign' ";
$result = $this->select($sql);
return $result;
}
function pageApi($catalogid)
{
$checkSlug2 = explode("?", $_SERVER["REQUEST_URI"]);
$checkSlug2 = explode("/", $_SERVER["REQUEST_URI"]);
$checkfb = explode("&", $_SERVER["REQUEST_URI"]);
$checkUrl = count($checkfb);
$part1 = $checkUrl - 3;
$part2 = $checkUrl - 2; // find last element
if($checkUrl >=0)
{
$findPart = $checkfb[$part1];
$slugfb = str_replace("/pageApi.php?slug=", "", $findPart);
$slugfb = str_replace("/eziki4", "", $slugfb);
}
$checkDir2 = count($checkSlug2);
$n2 = $checkDir2 - 1; // find last element
$findSlug2 = $checkSlug2[$n2];
$slug2 = str_replace("pageApi.php?slug=", "", $findSlug2); // isolate the slug
$episode = str_replace("pageApi.php?episode=", "", $findSlug2);
$checkSlug = explode("&", $slug2);
// analyze rewritten url
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$findSlug = $checkSlug[$n]; // isolate the last part of the url
//$findSlug = preg_replace('/[\!-@#$%^&*()+=,.;: ]/', '', $findSlug);
$slug = str_replace("slug=", "", $findSlug); // isolate the slug
//$slug = str_replace("ugcchannel.php?slug=", "", $findSlug); // isolate the slug
if (!empty($slugfb)){
$slug = "$slugfb";
}
$sql = "select * from users where slug='$slug'";
$result = $this->select($sql);
$catalogname = $result[0]["catalogname"];
if(!empty($catalogname))
{
unset($_SESSION['episodeid']);
}
//check if episodes with these name exists
if(empty($catalogname)) {
$sql = "select * from catalog where slug='$slug'";
$result = $this->select($sql);
$parentid = $result[0]["parentid"];
$episodeName = $result[0]["catalogname"];
$episodeid = $result[0]["catalogid"];
$episodeDescription = $result[0]["description"];
$_SESSION['episodeid']= $episodeid;
$sql4 = "select * from users where catalogid='$parentid'";
$result = $this->select($sql4);
}
return $result;
}
function ugcgetepisodes($catalogid)
{
$checkSlug2 = explode("?", $_SERVER["REQUEST_URI"]);
$checkSlug2 = explode("/", $_SERVER["REQUEST_URI"]);
$checkDir2 = count($checkSlug2);
$n2 = $checkDir2 - 1; // find last element
$findSlug2 = $checkSlug2[$n2];
$slug2 = str_replace("kipindi.php?slug=", "", $findSlug2); // isolate the slug
//exit($slug2);
$checkSlug = explode("&", $slug2);
$subslug2 = substr($slug2,-5);
$pureslug = str_replace("$subslug2", "",$slug2 );
// analyze rewritten url
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$findSlug = $checkSlug[$n]; // isolate the last part of the url
//$findSlug = preg_replace('/[\!-@#$%^&*()+=,.;: ]/', '', $findSlug);
$slug = str_replace("slug=", "", $findSlug); // isolate the slug
//$slug = str_replace("ugcchannel.php?slug=", "", $findSlug); // isolate the slug
$sql = "select * from catalog where slug='$pureslug'";
$result = $this->select($sql);
return $result;
}
function videostream($myuserid)
{
$sql = "select * from api where user=$myuserid and code != 1 order by id DESC LIMIT 0,9";
$result = $this->select($sql);
return $result;
}
function socialconnect($record,$myuserid)
{
$sql = "select * from socialconnect where uid=$myuserid";
$result = $this->select($sql);
return $result;
}
function getvideostream($myquery)
{
$sql = $myquery;
$result = $this->select($sql);
return $result;
}
function countvideostream($myuserid)
{
$sql = "select count(*) as total from api where user=$myuserid order by id DESC LIMIT 0,3";
$result = $this->select($sql);
return $result;
}
function F132369b1old($newsid) { $checkSlug = explode("/", $_SERVER["REQUEST_URI"]);
// analyze rewritten url
$str = $_SERVER["REQUEST_URI"];
$last = $str[strlen($str)-1];
if ($last == "/")
{
header("Location: http://eziki.tv/sconnect/index.php");exit();
}
if ($last == "/")
{
header("Location: http://eziki.tv/sconnect/index.php");exit();
}
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$V3e73e47b = $checkSlug[$n]; // isolate the last part of the url
if ($V3e73e47b == "?ref=bookmarks")
{
header("Location: http://eziki.tv/sconnect/index.php");exit();
}
$string = $_SERVER["REQUEST_URI"];
$pos = strpos($string, "?");
if ($pos == true) {
header("Location: http://eziki.tv/sconnect/index.php");exit();
} else {
}
$slug = str_replace("angalia.php?slug=", "", $V3e73e47b); // isolate the slug
$slug = preg_replace('/#_/', '', $slug);
$sql = "select * from usercontent where isdisplay=1 and slug='$slug'"; $result = $this->select($sql);
return $result; }
function getseougcnewsbyid($newsid)
{
$URI = $_SERVER["REQUEST_URI"];
$needle = "&";
$pos = strpos($URI,$needle);
if($pos === true) {
// string needle NOT found in haystack
//exit("not found");
}
else {
$checkAnd = explode("&", $_SERVER["REQUEST_URI"]);
$checkDirAnd = count($checkAnd); // count elements
$nAnd = $checkDirAnd - 3; // find last element
$findSlugAnd = $checkAnd[$nAnd];
$newslug = str_replace("/FlashPlayer/angalia.php?slug=", "", "$findSlugAnd");
}
$checkSlug = explode("/", $_SERVER["REQUEST_URI"]);
// analyze rewritten url
$str = $_SERVER["REQUEST_URI"];
$last = $str[strlen($str)-1];
if ($last == "/")
{
header("Location: http://eziki.tv/sconnect/index.php");exit();
}
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$findSlug = $checkSlug[$n]; // isolate the last part of the url
$slug = str_replace("angalia.php?slug=", "", $findSlug); // isolate the slug
if(!empty($newslug))
{
$slug = $newslug;
}
$slug = preg_replace('/#_/', '', $slug);
$sql = "select * from usercontent where isdisplay=1 and slug='$slug'";
$result = $this->select($sql);
return $result;
}
function gettypeid($typeid)
{ $checkSlug = explode("/", $_SERVER["REQUEST_URI"]);
// analyze rewritten url
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$findSlug = $checkSlug[$n]; // isolate the last part of the url
$slug = str_replace("all.php?slug=", "", $findSlug); // isolate the slug
$sql = "select * from categories where slug='$slug'";
$result = $this->select($sql);
return $result;
}
function gettypeidgo($media)
{
$sql = "select * from onthegocategory where slug='$media'";
$result = $this->select($sql);
return $result;
}
function runinga($newsid)
{
$sql = "select * from usercontent where isdisplay=1 and newsid='$newsid'";
$result = $this->select($sql);
return $result;
}
function getseoblogbyid($newsid)
{
$checkSlug = explode("/", $_SERVER["REQUEST_URI"]);
// analyze rewritten url
$checkDir = count($checkSlug); // count elements
$n = $checkDir - 1; // find last element
$findSlug = $checkSlug[$n]; // isolate the last part of the url
$slug = str_replace("seoblog.php?slug=", "", $findSlug); // isolate the slug
$sql = "select * from blogs where slug='$slug'";
$result = $this->select($sql);
return $result;
}
function ugcratedbyid($catalogid)
{
$sql = "select * from ratedilike where topicidr='$catalogid' order by positions DESC";
$result = $this->select($sql);
$parentname = $result[0]["catalogname"];
return $parentname;
}
function ugcilikebyid($catalogid)
{
$sql = "select * from ilikethis where topicid='$catalogid' ";
$result = $this->select($sql);
$parentname = $result[0]["catalogname"];
return $parentname;
}
function getnewsbykeyword($page,$record,$keyword)
{
$start = $page*$record;
$sql = "select newsid,title,description,slug,picture,viewnum from usercontent where ((title like '%$keyword%') or (content like '%$keyword%')) and isdisplay=1 order by viewnum DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function basedonsaved($sql)
{
$result = $this->select($sql);
return $result;
}
function recommend($page,$record,$mytags,$related,$newsid5)
{
$start = $page*$record;
if (!empty($newsid5)) {
$newsid5 = "and newsid != $newsid5";
}
else
{
$newsid5 = "";
}
if (!empty($related)) {
$related = "and newsid != $related";
}
else
{
$related = "";
}
$desctag = preg_replace('/title/', 'description', $mytags);
$contenttag = preg_replace('/title/', 'content', $mytags);
$sql = "select * from usercontent where ($mytags $desctag $contenttag (title like '%bnbnn%')) and isdisplay=1 $related $newsid5 order by ratenum DESC LIMIT 0,5";
$result = $this->select($sql);
return $result;
}
function recommendfromcomments($mytags)
{
$searchtag = preg_replace('/title/', 'mycomment', $mytags);
$sql = "select * from icomment where ($searchtag (sn like '%bnbnn%')) order by votes_up DESC LIMIT 0,2";
$result = $this->select($sql);
return $result;
}
function idtocontentrelevant($page,$record,$id)
{
$start = $page*$record;
if (!empty($newsid5)) {
$newsid5 = "and newsid != $newsid5";
}
else
{
$newsid5 = "";
}
if (!empty($related)) {
$related = "and newsid != $related";
}
else
{
$related = "";
}
$start = $page*$record;
$sql = "select * from usercontent where newsid=$id $related $newsid5 and isdisplay=1 LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function idtocontent($page,$record,$id)
{
$start = $page*$record;
$sql = "select * from usercontent where newsid=$id and isdisplay=1 LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function idtoreporta($id)
{
$start = $page*$record;
$sql = "select * from reporta where newsid=$id LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function idtodistribution($id)
{
$start = $page*$record;
$sql = "select * from distribute where newsid=$id LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getidtovideo($page,$record,$id)
{
$start = $page*$record;
$sql = "select * from usercontent where newsid=$id and isdisplay=1";
$result = $this->select($sql);
return $result;
}
function getidtochannel($id)
{
$sql = "select * from users where catalogid=$id";
$result = $this->select($sql);
return $result;
}
function getrecommendbyid($page,$record,$related)
{
$start = $page*$record;
$sql = "select * from usercontent where newsid=$related and isdisplay=1 LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getrecommendbyid2($page,$record,$related2)
{
$start = $page*$record;
$sql = "select * from usercontent where newsid=$related2 and isdisplay=1 LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function recommend3($page,$record,$tags3)
{
$start = $page*$record;
$sql = "select newsid,title,description,slug,picture,viewnum from usercontent where ((title like '%$tags3%') or (content like '%$tags3%')) and isdisplay=1 order by viewnum DESC LIMIT $start,3";
$result = $this->select($sql);
return $result;
}
function getnewsbykeywordapi($page,$record,$keyword)
{
$start = $page*$record;
$sql = "select newsid,title,description,slug,picture,viewnum from usercontent where ((title like '%$keyword%') or (content like '%$keyword%')) and isdisplay=1 order by newsid DESC LIMIT 0,10";
$result = $this->select($sql);
return $result;
}
function getrelation($page,$record,$keyword)
{
$start = $page*$record;
$sql = "select newsid,title,keywords from news where ((title like '%$keyword%') and isdisplay=1 order by newsid DESC LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
function addlike($topicid,$image,$topic,$video2,$category,$site,$address,$vcat,$slug,$videoid)
{
session_start();
$_SESSION['cate']= $vcat;
$myidis = $_SESSION['euserid'];
$sql = "select count(*) as total from ilikethis where address=$address and topicid=$myidis ";
$result = $this->select($sql);
$icount = $result[0]["total"];
if ($icount < 1) {
$sql = "select count(*) as total2 from ilikethis where topicid=$myidis";
$result = $this->select($sql);
$icount2 = $result[0]["total2"];
if ($icount2 < 10) {
$time=date(y).date(m).date(d).date(h).date(i).date(s); //get current time
$nick= $_SESSION['user_name'];
$words= "likes the video <a href=$slug target=_blank>$video2</a>";
$sql="insert into socialroom (chtime,nick,words,videoid,slug) values('$time', '$nick' , '$words', '$videoid', '$slug')";
$result = $this->insert($sql);
$sql="insert into ilikethis(topicid,address,image,topic,video2,site,category,vcat) values('$topicid','$address','$image','$topic','$video2','$site','$category','$vcat')";
$results = $this->insert($sql);
return $results;
}
}
}
function mayalsolike()
{
$myidis = $_SESSION['euserid'];
$sql = "select * from ratedilike where topicidr='$myidis' order by rid DESC LIMIT 1,10";
$result = $this->select($sql);
return $result;
foreach ($result as $key => $val) {
$vcat = stripslashes($val["vcat"]);
print "$vcat";
}
}
function set_Rating($newsid,$Rating,$topicidr,$imager,$topicr,$videor,$categoryr,$siter,$addressr)
{
if (($Rating>=4)){
$sql = "select count(*) as total from ratedilike where addressr=$addressr";
$result = $this->select($sql);
$icount = $result[0]["total"];
if ($icount < 1) {
$sql="insert into ratedilike(topicidr,addressr,imager,topicr,videor,siter,categoryr) values('$topicidr','$addressr','$imager','$topicr','$videor','$siter','$categoryr')";
$result = $this->insert($sql);
}
}
$sql = "select rating,ratenum from news where newsid=$newsid";
$result = $this->select($sql);
$OldR = $result[0]["rating"];
$OldN = $result[0]["ratenum"];
$NewN = $OldN+1;
$NewR = ($OldR*$OldN+$Rating)/$NewN;
$sql = "update news set rating=$NewR,ratenum=$NewN where newsid=$newsid";
$result = $this->update($sql);
return $result;
}
function set_ugcRating($newsid,$Rating,$topicidr,$imager,$topicr,$videor,$categoryr,$siter,$addressr,$slug,$videoid)
{
if (($Rating>=4)){
$time=date(y).date(m).date(d).date(h).date(i).date(s); //get current time
$nick= $_SESSION['user_name'];
$words= "has rated <a href=$slug target=_blank>$videor</a> with $Rating stars";
$sql="insert into socialroom (chtime,nick,words,videoid,slug) values('$time', '$nick' , '$words', '$videoid', '$slug')";
$result = $this->insert($sql);
$sql = "select count(*) as total from ratedilike where addressr=$addressr";
$result = $this->select($sql);
$icount = $result[0]["total"];
if ($icount < 1) {
$sql="insert into ratedilike(topicidr,addressr,imager,topicr,videor,siter,categoryr) values('$topicidr','$addressr','$imager','$topicr','$videor','$siter','$categoryr')";
$result = $this->insert($sql);
}
}
$sql = "select rating,ratenum from usercontent where isdisplay=1 and newsid=$newsid";
$result = $this->select($sql);
$OldR = $result[0]["rating"];
$OldN = $result[0]["ratenum"];
$NewN = $OldN+1;
$NewR = ($OldR*$OldN+$Rating)/$NewN;
$sql = "update usercontent set rating=$NewR,ratenum=$NewN where newsid=$newsid";
$result = $this->update($sql);
return $result;
}
function derecomm($rid)
{
$sql = "DELETE FROM ratedilike where rid='$rid'";
$result = $this->delete($sql);
return $result;
}
function delilike($id)
{
$sql = "DELETE FROM ilikethis where id='$id'";
$result = $this->delete($sql);
return $result;
}
function getnewsbyid($newsid)
{
$sql = "select * from news where newsid='$newsid'";
$result = $this->select($sql);
return $result;
}
function getnewsbyid2($newsid)
{
$sql = "select * from news where newsid='$newsid'";
$result = $this->select($sql);
return $result;
}
function getugcnewsbyid($newsid)
{
$sql = "select * from usercontent where isdisplay=1 and newsid='$newsid'";
$result = $this->select($sql);
return $result;
}
function getallugccatalogname5()
{
$sql = "select catalogid,slug,catalogname,address,description from users";
$result = $this->select($sql);
return $result;
}
function getallcategory()
{
$sql = "select * from categories";
$result = $this->select($sql);
return $result;
}
function getallvideocategory($catalogid)
{
$sql = "select * from usercontent where catalogid=$catalogid order by newsid desc limit 1,5";
$result = $this->select($sql);
return $result;
}
function getallAssignment($catalogid)
{
$sql = "select * from catalog where catalogid=$catalogid";
$result = $this->select($sql);
return $result;
}
function addrivenHTML5($page,$record,$catid,$picha)
{
$start = $page*$record;
$sql = "select * from reporta where newsid = $picha LIMIT 0,1";
$result = $this->select($sql);
return $result;
}
function getalldistributions($catalogidd,$distribute,$nnewsid)
{
$sql = "select * from distributions where catalogid=$catalogidd and distribution=$distribute and newsid=$nnewsid";
$result = $this->select($sql);
return $result;
}
function getReceivers($cat)
{
if($cat==0) {$str=""; } else {$str="and category=$cat";}
$sql = "select * from users where admin='20' $str order by id desc";
$result = $this->select($sql);
return $result;
}
function getMedia($cat)
{
if($cat==0) {$str=""; } else {$str="and category=$cat";}
$sql = "select * from users where admin='90' $str order by id desc";
$result = $this->select($sql);
return $result;
}
function getallugccatalogname()
{
$sql = "select * from users";
$result = $this->select($sql);
return $result;
}
function getallmusic()
{
$sql = "select * from users where admin=1 and category=27 order by catalogname asc";
$result = $this->select($sql);
return $result;
}
function getepisode($epi)
{
$sql = "select * from catalog where catalogid=$epi";
$result = $this->select($sql);
return $result;
}
function getassignments($catalogid5)
{
$sql = "select * from catalog where parentid=$catalogid5 order by catalogid desc";
$result = $this->select($sql);
return $result;
}
function widgetdetails()
{
$sql = "select * from users";
$result = $this->select($sql);
return $result;
}
function trackers()
{
$sql = "select catalogid,slug,catalogname,address,description from users";
$result = $this->select($sql);
return $result;
}
function getallwidgets()
{
$myidis = $_SESSION['euserid'];
$sql = "select * from api where user = $myidis ";
$result = $this->select($sql);
return $result;
}
function addhit($viewnum,$userid)
{
$sql = "update users set viewnum=$viewnum+1 where newsid=$newsid";
$result = $this->update($sql);
return $result;
}
function addugchit($viewnum,$newsid)
{
$sql = "update usercontent set viewnum=$viewnum+1 where newsid=$newsid";
$result = $this->update($sql);
return $result;
}
function channelbookmark($channel,$catalogid5)
{
echo $sql = "update users set bookmark=$channel where catalogid=$catalogid5";
$result = $this->update($sql);
return $result;
}
function getbookmark($catalogid5)
{
$sql = "select * from users where catalogid=$catalogid5";
$result = $this->select($sql);
return $result;
}
function addchannelcate($vcat2,$catalogid)
{
$sql = "update users set category=$vcat2 where catalogid=$catalogid";
$result = $this->update($sql);
return $result;
}
function userDetails($user_name,$who)
{
global $link;
/* echo "select * from users where catalogid='$who'";*/
$rs_settings = mysqli_query($link,"select * from users where catalogid='$who'");
while ($row_settings = mysqli_fetch_array($rs_settings)) {
$result = strtolower($row_settings["$user_name"]);
return $result;
} }
function themeDetails($type,$themeid,$catalogid)
{
$rs_settings = mysqli_query($link,"select * from profilepicture where catalogid=$catalogid and id=$themeid");
while ($row_settings = mysqli_fetch_array($rs_settings)) {
$result = strtolower($row_settings["$type"]);
return $result;
} }
function addchannelhit($viewnum,$catalogid)
{
$sql = "update users set viewnum=$viewnum+1 where catalogid=$catalogid";
$result = $this->update($sql);
return $result;
}
function addassignment($episodeid,$videouser)
{
$sql = "update users set episodeid=$episodeid where catalogid=$videouser";
$result = $this->update($sql);
return $result;
}
function enterHall($catalogid)
{
$myidis = $_SESSION['euserid'];
$myname =$_SESSION['user_name'];
$mycomment = "$myname has just entered the Hall...<br />
<strong>Eziki Admin:</strong>Welcome! <strong>";
$sql="insert into scomment(mycomment,myname,id,catalogid,type) values('$mycomment','$myname','$myidis','$catalogid','0')";
$result = $this->insert($sql);
}
function addtosocialroom($title,$lastwatched,$catalogid,$video,$slug)
{
if (isset($_SESSION['euserid'])) {
$myidis = $_SESSION['user_name'];
}
else {
$myidis = "A guest ";
}
$title = "is watching <a href=".$slug." target=_blank>$title</a>";
$time=date(y).date(m).date(d).date(h).date(i).date(s);
$sql="insert into socialroom(nick,words,videoid,chtime,slug) values('$myidis','$title','$catalogid','$time','$slug')";
$results = $this->insert($sql);
return $results;
}
function lastviewed($lastwatched,$newsid)
{
$sql = "update usercontent set lastwatched=$lastwatched where newsid=$newsid";
$result = $this->update($sql);
return $result;
}
function getname($newsid)
{
$sql = "select title from news where newsid=$newsid";
$result = $this->select($sql);
$title = $result[0]["title"];
return $title;
}
function relatednews($record)
{
$sql = "select newsid,title,description,picture from news where catalogid='$catalogid' and isdisplay=1 order by newsid DESC LIMIT 0,2";
$result = $this->select($sql);
return $result;
}
function getallcategories()
{
$sql = "select * from categories order by categoryname ASC";
$result = $this->select($sql);
return $result;
}
function popchannels()
{
$sql = "select * from users where admin=1 order by viewnum DESC LIMIT 0,12";
$result = $this->select($sql);
return $result;
}
function topvids($page,$record)
{
$start = $page*$record;
$sql = "select * from usercontent order by viewnum desc LIMIT $start,$record";
$result = $this->select($sql);
return $result;
}
}
?>