function addnews() { global $record_path; if (isset($_POST['title'])) { $Title = $_POST['title']; } if (isset($_POST['description'])) { $Description = $_POST['description']; } if (isset($_POST['date'])) { $Datepost = date("Y-m-d"); } //$isactive = $_POST['isactive']; // $externalLinks = ""; // $docLinks = ""; $i = 0; $query = mysql_query("select * from news "); while ($how = mysql_fetch_array($query)) { //echo $how['id']; $i = $how['id']; } echo $i; $id = $i + 1; $query = "INSERT INTO NEWS(id,Title,Description)\n\t\t\tVALUES ('{$id}','{$Title}','{$Description}')"; error_log("titleee" . $query); mysql_query($query) or die("MYSQL ERROR: " . mysql_error()); showSuccessMessage(); }
function changevideocategory() { global $s_message; $target_video = $_GET["videoid"]; $target_category = $_GET["category"]; echo "target video received = " . $target_video; echo "target category received= " . $target_category; $rs = mysql_query("UPDATE videonodes SET category='{$target_category}' where id='{$target_video}'"); $s_message = 'Success'; echo "<br>Success"; showSuccessMessage(); }
function addedge() { global $retString; $edgename = $_POST['edgename']; $fromID = $_POST['fromID']; $toID = $_POST['toID']; $t_rs = mysql_query("SELECT edgecolor,tooltip,intensity FROM edgetypes where name='{$edgename}'"); $row = mysql_fetch_array($t_rs); $edgecolor = $row['edgecolor']; $tooltip = $row['tooltip']; $intensity = $row['intensity']; // * if edge name is Has seen, then // * 1. increment the timesseen and change the lastseen fields corresponding to that user id and video id in edges table. // * 2. increment the timesseen and change the lastseen variable in videonodes table // * 3. delete the Is watching edge in log table if ($edgename == 'Has seen') { // * edges table // check if there exists an edge between the user id and video id. if yes, just change the timesseen // and lastseen fields. else create new edge. $t_rs = mysql_query("SELECT id FROM edges where name='{$edgename}' AND fromID='{$fromID}' AND toID='{$toID}'"); if (mysql_num_rows($t_rs) == 0) { $timesseen = '1'; mysql_query("INSERT INTO edges(name,tooltip,fromID,toID,intensity,edgecolor,timesseen,lastseen,creationtime) VALUES ('{$edgename}','{$tooltip}','{$fromID}','{$toID}','{$intensity}','{$edgecolor}','{$timesseen}',current_timestamp(),current_timestamp())"); } else { $row = mysql_fetch_array($t_rs); $edgeid = $row['id']; mysql_query("UPDATE edges SET timesseen=timesseen+1,lastseen=current_timestamp() WHERE id='{$edgeid}'"); } // * video nodes table mysql_query("UPDATE videonodes SET timesseen=timesseen+1,lastseen=current_timestamp() where id = '{$toID}'"); mysql_query("INSERT INTO useractions(action,TakenBy,TakenOn,Entity,Datetime) VALUES ('WatchVideo','{$fromID}','{$toID}','',current_timestamp())"); mysql_query("DELETE FROM useractions WHERE action='Is watching' AND TakenBy='{$fromID}' AND TakenOn='{$toID}'"); showSuccessMessage(); } else { mysql_query("INSERT INTO edges(name,tooltip,fromID,toID,intensity,edgecolor,creationtime) VALUES ('{$edgename}','{$tooltip}','{$fromID}','{$toID}','{$intensity}','{$edgecolor}',current_timestamp())"); $t_rs = mysql_query("SELECT id,creationtime FROM edges where name='{$edgename}' AND fromID='{$fromID}' AND toID='{$toID}'"); $row = mysql_fetch_array($t_rs); $id = $row['id']; $time = $row['creationtime']; echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; echo "<rsp><message>Success</message><id>{$id}</id><creationtime>{$time}</creationtime></rsp>"; } }
function modifytag() { global $s_message; $tagid = $_POST['tag']; $newtag = $_POST['newtag']; mysql_query("UPDATE tagnodes SET name='{$newtag}' where id='{$tagid}'") or die(mysql_error()); $s_message = 'Success'; showSuccessMessage(); }
function deletecomment() { showSuccessMessage(); }
function editprofile() { $id = $_POST['id']; $name = $_POST['name']; $alias = isset($_POST['alias']) ? $_POST['alias'] : $name . ' alias'; $company = $_POST['company']; $title = $_POST['title']; $nationality = $_POST['nationality']; $picture = $_POST['picture']; $webpage = $_POST['webpage']; $email = $_POST['email']; $location = $_POST['location']; //$interests = $_POST['interests']; $interests = gettagarrayid2($_POST['interests']); $description = $_POST['description']; //error_log("$description".$description); $competences = $_POST['competences']; $default_py = '#EVERYBODY#'; $name_py = isset($_POST['name_py']) ? $_POST['name_py'] : $default_py; $title_py = isset($_POST['invitedby_py']) ? $_POST['invitedby_py'] : $default_py; $company_py = isset($_POST['company_py']) ? $_POST['company_py'] : $default_py; $nationality_py = isset($_POST['nationality_py']) ? $_POST['nationality_py'] : $default_py; $picture_py = isset($_POST['picture_py']) ? $_POST['picture_py'] : $default_py; $url_py = isset($_POST['url_py']) ? $_POST['url_py'] : $default_py; $interests_py = isset($_POST['interests_py']) ? $_POST['interests_py'] : $default_py; $profile_py = isset($_POST['profile_py']) ? $_POST['profile_py'] : $default_py; $emailid_py = isset($_POST['emailid_py']) ? $_POST['emailid_py'] : $default_py; $location_py = isset($_POST['location_py']) ? $_POST['location_py'] : $default_py; $competences_py = isset($_POST['competences_py']) ? $_POST['competences_py'] : $default_py; // parse $interests and add new ones to tagnodes table $fin_interests = ''; $list = explode(',', $interests); foreach ($list as $single) { $single = trim($single, " ,\t,\n,\r"); //$rs = mysql_query ("SELECT name from tagnodes where name='$single'"); $rs = mysql_query("SELECT name from tagnodes where id='{$single}'"); //Thses are used for testing only /* $mingle = " tag1234 1 "; $mingle = trim($mingle," ,\t,\n,\r"); error_log("the ids are".$single); error_log("the mingle is".$mingle); */ if (mysql_num_rows($rs) == 0 && trim($single) != '') { //error_log("inside".$single); //mysql_query ("INSERT INTO tagnodes(name,submittime) VALUES('$single',current_timestamp())"); $rstag = mysql_query("SELECT max(number) FROM tagnodes"); while ($row1 = mysql_fetch_array($rstag)) { $number = $row1[0]; } $number += 1; mysql_query("INSERT INTO tagnodes(number,id,name,nodetype,picture,submittime) VALUES ('{$number}','Tag{$number}','" . $single . "','Tags','http://labs.calt.insead.edu/prototyping/Tentube/GraphData/media/tag_img.jpg',current_timestamp())"); //$fin_interests = $single.','.$fin_interests; $fin_interests = 'Tag' . $number . ',' . $fin_interests; } else { $row = mysql_fetch_array($rs); //$temp = $row['name']; $temp = $single; $fin_interests = $temp . ',' . $fin_interests; } } $fin_interests = substr($fin_interests, 0, -1); // $splcharacters = array("&","'","<",">"); // $description = str_replace($splcharacters, "",$description); $splcharacters = array("'"); $description = str_replace($splcharacters, "\\'", $description); $query = "UPDATE peoplenodes SET name='{$name}',alias='{$alias}',company='{$company}',title='{$title}',nationality='{$nationality}',picture='{$picture}',url='{$webpage}',emailid='{$email}',location='{$location}',interests='{$fin_interests}',profile='{$description}',competences='{$competences}',\n\t\t\t\tname_py='{$name_py}',company_py='{$company_py}',title_py='{$title_py}',nationality_py='{$nationality_py}',picture_py='{$picture_py}',url_py='{$url_py}',emailid_py='{$emailid_py}',interests_py='{$interests_py}',profile_py='{$profile_py}',location_py='{$location_py}',competences_py='{$competences_py}' WHERE id='{$id}'"; //error_log($query); mysql_query($query) or die(mysql_error()); showSuccessMessage(); }