コード例 #1
0
      */
 /**
  * New message for IM
  */
 case 'newMessage':
     //--- check online status of the recipient ---//
     $iContactRid = getContactId($sRspId, $sSndId);
     if (!empty($iContactRid)) {
         $sColor = $_REQUEST['color'] ? $_REQUEST['color'] : "0";
         $sBold = $_REQUEST['bold'] ? $_REQUEST['bold'] : FALSE_VAL;
         $sUnderline = $_REQUEST['underline'] ? $_REQUEST['underline'] : FALSE_VAL;
         $sItalic = $_REQUEST['italic'] ? $_REQUEST['italic'] : FALSE_VAL;
         $iSize = $_REQUEST['size'] ? $_REQUEST['size'] : 12;
         $sFont = $_REQUEST['font'] ? $_REQUEST['font'] : "Arial";
         $sStyle = serialize(array('color' => $sColor, 'bold' => $sBold, 'underline' => $sUnderline, 'italic' => $sItalic, 'smileset' => $sSmileset, 'size' => $iSize, 'font' => $sFont));
         $iContactSid = getContactId($sSndId, $sRspId);
         if (!empty($iContactSid)) {
             $rResult = getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Messages` (`ContactID`, `Message`, `Style`, `When`) VALUES ('" . $iContactSid . "', '" . $sMsg . "', '" . $sStyle . "', '" . time() . "')");
         }
     } else {
         $rResult = addPend($sSndId, $sRspId, $sMsg);
     }
     $sContents = parseXml($aXmlTemplates['result'], $rResult ? TRUE_VAL : FALSE_VAL);
     break;
 case 'help':
     $sApp = isset($_REQUEST['app']) ? $_REQUEST['app'] : "user";
     $sContents = makeGroup("", "topics");
     $sFileName = $sModulesPath . $sModule . "/help/" . $sApp . ".xml";
     if (file_exists($sFileName)) {
         $rHandle = @fopen($sFileName, "rt");
         $sContents = @fread($rHandle, filesize($sFileName));
コード例 #2
0
function insertContact($user)
{
    // should error check that all post fields are set
    $fname = $_POST["fname"];
    $lname = $_POST["lname"];
    $email = $_POST["email"];
    $phone = $_POST["phone"];
    $facebook = $_POST["facebook"];
    $linkedin = $_POST["linkedin"];
    $github = $_POST["github"];
    // add to contacts if it doesnt' exist already
    if (contactExists($fname, $lname, $email, $phone, $facebook, $linkedin, $github) !== true) {
        if (addContact($fname, $lname, $email, $phone, $facebook, $linkedin, $github) !== true) {
            return "error adding to contacts";
        }
    }
    // return addContact($fname,$lname,$email,$phone,$facebook,$linkedin,$github);
    $contactId = getContactId($fname, $lname, $email, $phone, $facebook, $linkedin, $github);
    // return "contact id = " . $contactId;
    // add to user_contacts if it doesn't already exist
    if (userContactExists($user, $contactId) !== true) {
        // return "contact $contactId exists";
        if (addUserContact($user, $contactId) !== true) {
            return "error adding to user_contacts";
        } else {
            return true;
        }
    } else {
        return "existential problem. for {$contactId}";
    }
}