Example #1
0
 }
 // Validate Email
 if (strlen($sEmail) > 0) {
     if (checkEmail($sEmail) == false) {
         $sEmailError = "<span style=\"color: red; \">" . gettext("Email is Not Valid") . "</span>";
         $bErrorFlag = true;
     } else {
         $sEmail = $sEmail;
     }
 }
 // Validate all the custom fields
 $aCustomData = array();
 while ($rowCustomField = mysql_fetch_array($rsCustomFields, MYSQL_BOTH)) {
     extract($rowCustomField);
     $currentFieldData = FilterInput($_POST[$fam_custom_Field]);
     $bErrorFlag |= !validateCustomField($type_ID, $currentFieldData, $fam_custom_Field, $aCustomErrors);
     // assign processed value locally to $aPersonProps so we can use it to generate the form later
     $aCustomData[$fam_custom_Field] = $currentFieldData;
 }
 //If no errors, then let's update...
 if (!$bErrorFlag) {
     // Format the phone numbers before we store them
     if (!$bNoFormat_HomePhone) {
         $sHomePhone = CollapsePhoneNumber($sHomePhone, $sCountry);
     }
     if (!$bNoFormat_WorkPhone) {
         $sWorkPhone = CollapsePhoneNumber($sWorkPhone, $sCountry);
     }
     if (!$bNoFormat_CellPhone) {
         $sCellPhone = CollapsePhoneNumber($sCellPhone, $sCountry);
     }
$rsGroupInfo = RunQuery($sSQL);
extract(mysql_fetch_array($rsGroupInfo));
// We assume that the group selected has a special properties table and that it is populated
//  with values for each group member.
// Get the properties list for this group: names, descriptions, types and prop_ID for ordering;  will process later..
$sSQL = "SELECT groupprop_master.* FROM groupprop_master\n\t\t\tWHERE grp_ID = " . $iGroupID . " ORDER BY prop_ID";
$rsPropList = RunQuery($sSQL);
// Is this the second pass?
if (isset($_POST["GroupPropSubmit"])) {
    // Process all HTTP post data based upon the list of properties data we are expecting
    // If there is an error message, it gets assigned to an array of strings, $aPropErrors, for use in the form.
    $bErrorFlag = false;
    while ($rowPropList = mysql_fetch_array($rsPropList, MYSQL_BOTH)) {
        extract($rowPropList);
        $currentFieldData = FilterInput($_POST[$prop_Field]);
        $bErrorFlag |= !validateCustomField($type_ID, $currentFieldData, $prop_Field, $aPropErrors);
        // assign processed value locally to $aPersonProps so we can use it to generate the form later
        $aPersonProps[$prop_Field] = $currentFieldData;
    }
    // If no errors, then update.
    if (!$bErrorFlag) {
        mysql_data_seek($rsPropList, 0);
        $sSQL = "UPDATE groupprop_" . $iGroupID . " SET ";
        while ($rowPropList = mysql_fetch_array($rsPropList, MYSQL_BOTH)) {
            extract($rowPropList);
            $currentFieldData = trim($aPersonProps[$prop_Field]);
            sqlCustomField($sSQL, $type_ID, $currentFieldData, $prop_Field, $sPhoneCountry);
        }
        // chop off the last 2 characters (comma and space) added in the last while loop iteration.
        $sSQL = substr($sSQL, 0, -2);
        $sSQL .= " WHERE per_ID = " . $iPersonID;