Пример #1
0
     $type = $_GET['type'];
     $where = $_GET['where'];
     $shareCheckResult = dbUtil::SELECT("SELECT clmnID FROM tblUsers WHERE clmnUserName=:usrname", array(':usrname' => $toShare));
     if (count($shareCheckResult) == 0) {
         xml_encode("error", "Sharer Not Found!");
         die;
     }
     $userIdResult = dbUtil::SELECT("SELECT clmnId FROM tblUsers WHERE clmnUserName=:uname", array(':uname' => $_SESSION['un']));
     if (count($userIdResult) != 0) {
         $userId = $userIdResult[0]['clmnId'];
     }
     $fCheckResult = dbUtil::SELECT("SELECT clmnFileID FROM tblFiles WHERE clmnFileName=:fileName AND clmnFoldIn=:foldin AND clmnUNFile=:uname", array(':fileName' => $fName, ':uname' => $_SESSION['un'], ':foldin' => $where));
     if (count($fCheckResult) != 0) {
         $sCheckResult = dbUtil::SELECT("SELECT clmnShrId FROM tblSharedFiles WHERE clmnFileID=:fileId", array(':fileId' => $fCheckResult[0]['clmnFileID']));
         if (count($sCheckResult) == 0) {
             $exc = dbUtil::INSERT("INSERT INTO tblSharedFiles VALUES('', :fileid, :fileown, :unfold)", array(':fileid' => $fCheckResult[0]['clmnFileID'], ':unfold' => $shareCheckResult[0]['clmnID'], ':fileown' => $userId));
             if ($exc == true) {
                 //sucess
             }
         }
     }
     break;
 case 'fUnShare':
     $fName = $_GET['name'];
     $type = $_GET['type'];
     $where = $_GET['where'];
     $fCheckResult = dbUtil::SELECT("SELECT clmnFileID FROM tblFiles WHERE clmnFileName=:fileName AND clmnFoldIn=:foldin AND clmnUNFile=:uname", array(':fileName' => $fName, ':uname' => $_SESSION['un'], ':foldin' => $where));
     if (count($fCheckResult) != 0) {
         dbUtil::DELETE("DELETE FROM tblSharedFiles WHERE clmnFileID=:fileId", array(':fileId' => $fCheckResult[0]['clmnFileID']));
     }
     break;
Пример #2
0
            $cursPos = $_GET['pos'];
            $val = validateAction($actMode);
            if ($val == true) {
                $fileIdResult = dbUtil::SELECT("SELECT clmnFileId FROM tblFiles WHERE clmnFileName=:name AND clmnUNFile=:uname", array(':name' => $fileName, ':uname' => $_SESSION['un']));
                if (count($fileIdResult) != 0) {
                    $fileId = $fileIdResult[0]['clmnFileId'];
                } else {
                    die;
                }
                $userIdResult = dbUtil::SELECT("SELECT clmnId FROM tblUsers WHERE clmnUserName=:uname", array(':uname' => $_SESSION['un']));
                if (count($userIdResult) != 0) {
                    $userId = $userIdResult[0]['clmnId'];
                } else {
                    die;
                }
                $exc = dbUtil::INSERT("INSERT INTO tblFileModif VALUES('', :clmnfileid, :clmnuserid, :clmnfileline, :clmnmode, :clmntext, :clmnpos)", array(':clmnfileid' => $fileId, ':clmnuserid' => $userId, ':clmnfileline' => $lineNo, ':clmnmode' => $actMode, ':clmntext' => $text, ':clmnpos' => $curPos));
                if ($exc == true) {
                    //sucess
                }
            }
        }
    }
}
printXML("/shareRequest");
header('Content-Type: application/xml; charset=utf-8');
function getWatchers($fileId, $userId, $delete)
{
    $lastActivityResult = dbUtil::SELECT("SELECT clmnUserId, clmnActivity FROM tblFileWatch WHERE clmnFileId=:fileid", array(':fileid' => $fileId));
    if (count($lastActivityResult) != 0) {
        //File has Watchers (Check if there are on-line)
        foreach ($lastActivityResult as $row) {