Пример #1
0
    $orgPrefVrfObj = new OrganizationPreferenceToverify();
}
if (isset($_POST) && is_array($_POST) && count($_POST) > 0) {
    $ere = '';
    //
    ### SERVER SIDE VALIDATION ####
    include SITE_CLASS_GEN . "class.validation.php";
    $validation = new Validation();
    $RequiredFiledArr = array('vUserName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_USER_NAME'), 'vPassword' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_PASSWORD'), 'vFirstName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_FIRST_NAME'), 'vLastName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_LAST_NAME'), 'vCompanyName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_ORGANIZATION'), 'vCompCode' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMP_CODE'), 'vCompanyRegNo' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMP_REG_NO'), 'eOrganizationType' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_ORGANIZATION'), 'vEmail' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMPANY') . ' ' . $smarty->get_template_vars('LBL_EMAIL'), 'vpEmail' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_PERSONAL') . ' ' . $smarty->get_template_vars('LBL_EMAIL'), 'vPhone' => $smarty->get_template_vars('LBL_ENTER_PHONE_NO'), 'vCity' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_CITY'), 'vCountry' => $smarty->get_template_vars('LBL_SELECT_COUNTRY'), 'vState' => $smarty->get_template_vars('LBL_SELECT_STATE'), 'vZipcode' => $smarty->get_template_vars('LBL_SELECT_STATE'), 'vVatId' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_ZIP_CODE'), 'vAddressLine1' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMPANY') . ' ' . $smarty->get_template_vars('LBL_ADDR_LINE'));
    $resArr = $validation->isEmpty($RequiredFiledArr);
    $tempData = $_POST;
    $vNum = $validation->isNum(array($tempData['vPhone'], $tempData['vZipcode']), array('Valid Phone Number', 'Valid ZipCode'), 'empty');
    ###check Valid Email###
    // prints($tempData['vEmail']);exit;
    if ($tempData['vEmail'] != '') {
        $vmail = $validation->isEmail(array($tempData['vEmail']), array($smarty->get_template_vars('MSG_VALID_EMAIL')));
    }
    ###check duplicate Email###
    if ($tempData['vEmail'] != '') {
        $vlmsg[] = $smarty->get_template_vars('MSG_DUP_EMAIL');
        $DupEmail = $validation->ChekDupEmail('', 'iOrganizationID', PRJ_DB_PREFIX . "_organization_master", $tempData['vEmail'], $vlmsg);
    }
    if ($tempData['vpEmail'] != '') {
        $vlmsg[] = $smarty->get_template_vars('MSG_DUP_EMAIL');
        $pDupEmail = $validation->ChekDupEmail('', 'iUserID', PRJ_DB_PREFIX . "_organization_user", $tempData['vpEmail'], $vlmsg);
    }
    ###End check duplicate Email###
    ###check duplicate Username###
    $vlmsg[] = $smarty->get_template_vars('MSG_VALID_USER');
    if ($tempData['vUserName'] != '') {
        $DupUser = $validation->ChekDupUserName("", 'iUserID', PRJ_DB_PREFIX . "_organization_user", $tempData['vUserName'], $vlmsg, "");
 /**
  * Method used to perform a specific action to an issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @param   array $reminder The reminder details
  * @param   array $action The action details
  * @return  boolean
  */
 function perform($issue_id, $reminder, $action)
 {
     $type = '';
     // - see which action type we're talking about here...
     $action_type = Reminder_Action::getActionType($action['rma_rmt_id']);
     // - do we also need to alert the group leader about this?
     $group_leader_usr_id = 0;
     if ($action['rma_alert_group_leader']) {
         if (Reminder::isDebug()) {
             echo "  - Processing Group Leader notification\n";
         }
         $group_id = Issue::getGroupID($issue_id);
         // check if there's even a group associated with this issue
         if (empty($group_id)) {
             if (Reminder::isDebug()) {
                 echo "  - No group associated with issue {$issue_id}\n";
             }
         } else {
             $group_details = Group::getDetails($group_id);
             if (!empty($group_details['grp_manager_usr_id'])) {
                 $group_leader_usr_id = $group_details['grp_manager_usr_id'];
             }
         }
     }
     if (Reminder::isDebug()) {
         echo "  - Performing action '{$action_type}' for issue #{$issue_id}\n";
     }
     switch ($action_type) {
         case 'email_assignee':
             $type = 'email';
             $assignees = Issue::getAssignedUserIDs($issue_id);
             $to = array();
             foreach ($assignees as $assignee) {
                 $to[] = User::getFromHeader($assignee);
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id)) {
                 $leader_email = User::getFromHeader($group_leader_usr_id);
                 if (!empty($leader_email) && !in_array($leader_email, $to)) {
                     $to[] = $leader_email;
                 }
             }
             break;
         case 'email_list':
             $type = 'email';
             $list = Reminder_Action::getUserList($action['rma_id']);
             $to = array();
             foreach ($list as $key => $value) {
                 // add the recipient to the list if it's a simple email address
                 if (Validation::isEmail($key)) {
                     $to[] = $key;
                 } else {
                     $to[] = User::getFromHeader($key);
                 }
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id)) {
                 $leader_email = User::getFromHeader($group_leader_usr_id);
                 if (!empty($leader_email) && !in_array($leader_email, $to)) {
                     $to[] = $leader_email;
                 }
             }
             break;
         case 'sms_assignee':
             $type = 'sms';
             $assignees = Issue::getAssignedUserIDs($issue_id);
             $to = array();
             foreach ($assignees as $assignee) {
                 if (User::isClockedIn($assignee)) {
                     $sms_email = User::getSMS($assignee);
                     if (!empty($sms_email)) {
                         $to[] = $sms_email;
                     }
                 }
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
                 $leader_sms_email = User::getSMS($group_leader_usr_id);
                 if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
                     $to[] = $leader_sms_email;
                 }
             }
             break;
         case 'sms_list':
             $type = 'sms';
             $list = Reminder_Action::getUserList($action['rma_id']);
             $to = array();
             foreach ($list as $key => $value) {
                 // add the recipient to the list if it's a simple email address
                 if (Validation::isEmail($key)) {
                     $to[] = $key;
                 } else {
                     // otherwise, check for the clocked-in status
                     if (User::isClockedIn($key)) {
                         $sms_email = User::getSMS($key);
                         if (!empty($sms_email)) {
                             $to[] = $sms_email;
                         }
                     }
                 }
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
                 $leader_sms_email = User::getSMS($group_leader_usr_id);
                 if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
                     $to[] = $leader_sms_email;
                 }
             }
             break;
     }
     $data = Notification::getIssueDetails($issue_id);
     $conditions = Reminder_Condition::getAdminList($action['rma_id']);
     // alert IRC if needed
     if ($action['rma_alert_irc']) {
         if (Reminder::isDebug()) {
             echo "  - Processing IRC notification\n";
         }
         $irc_notice = "Issue #{$issue_id} (Priority: " . $data['pri_title'];
         // also add information about the assignee, if any
         $assignment = Issue::getAssignedUsers($issue_id);
         if (count($assignment) > 0) {
             $irc_notice .= "; Assignment: " . implode(', ', $assignment);
         }
         if (!empty($data['iss_grp_id'])) {
             $irc_notice .= "; Group: " . Group::getName($data['iss_grp_id']);
         }
         $irc_notice .= "), Reminder action '" . $action['rma_title'] . "' was just triggered";
         Notification::notifyIRC(Issue::getProjectID($issue_id), $irc_notice, $issue_id);
     }
     $setup = Setup::load();
     // if there are no recipients, then just skip to the next action
     if (count($to) == 0) {
         if (Reminder::isDebug()) {
             echo "  - No recipients could be found\n";
         }
         // if not even an irc alert was sent, then save
         // a notice about this on reminder_sent@, if needed
         if (!$action['rma_alert_irc']) {
             if (@$setup['email_reminder']['status'] == 'enabled') {
                 Reminder_Action::_recordNoRecipientError($issue_id, $type, $reminder, $action);
             }
             return false;
         }
     }
     // - save a history entry about this action
     Reminder_Action::saveHistory($issue_id, $action['rma_id']);
     // - save this action as the latest triggered one for the given issue ID
     Reminder_Action::recordLastTriggered($issue_id, $action['rma_id']);
     // - perform the action
     if (count($to) > 0) {
         // send a copy of this reminder to reminder_sent@, if needed
         if (@$setup['email_reminder']['status'] == 'enabled' && !empty($setup['email_reminder']['addresses'])) {
             $addresses = Reminder::_getReminderAlertAddresses();
             if (count($addresses) > 0) {
                 $to = array_merge($to, $addresses);
             }
         }
         $tpl = new Template_API();
         $tpl->setTemplate('reminders/' . $type . '_alert.tpl.text');
         $tpl->bulkAssign(array("data" => $data, "reminder" => $reminder, "action" => $action, "conditions" => $conditions, "has_customer_integration" => Customer::hasCustomerIntegration(Issue::getProjectID($issue_id))));
         $text_message = $tpl->getTemplateContents();
         foreach ($to as $address) {
             // send email (use PEAR's classes)
             $mail = new Mail_API();
             $mail->setTextBody($text_message);
             $setup = $mail->getSMTPSettings();
             $mail->send($setup["from"], $address, "[#{$issue_id}] Reminder: " . $action['rma_title'], 0, $issue_id, 'reminder');
         }
     }
     // - eventum saves the day once again
     return true;
 }
Пример #3
0
 /**
  * Save the data of a user
  *
  * @param int $id		user's id
  * @param array $data	user's data
  */
 public function save($id, $data)
 {
     $user_data = array();
     // Email
     if (isset($data['mail'])) {
         if ($data['mail'] != '' && !Validation::isEmail($data['mail'])) {
             throw new FormException('mail');
         }
         $user_data['mail'] = $data['mail'];
     }
     // MSN
     if (isset($data['msn'])) {
         if ($data['msn'] != '' && !Validation::isEmail($data['msn'])) {
             throw new FormException('msn');
         }
         $user_data['msn'] = $data['msn'];
     }
     // Jabber
     if (isset($data['jabber'])) {
         if ($data['jabber'] != '' && !Validation::isEmail($data['jabber'])) {
             throw new FormException('jabber');
         }
         $user_data['jabber'] = $data['jabber'];
     }
     // Address
     if (isset($data['address'])) {
         $user_data['address'] = $data['address'];
     }
     // Zipcode
     if (isset($data['zipcode'])) {
         if ($data['zipcode'] != '' && !ctype_digit(trim($data['zipcode']))) {
             throw new FormException('zipcode');
         }
         $user_data['zipcode'] = $data['zipcode'] == '' ? null : (int) trim($data['zipcode']);
     }
     // City
     if (isset($data['city'])) {
         $user_data['city'] = $data['city'];
     }
     // Cellphone
     if (isset($data['cellphone'])) {
         if ($data['cellphone'] != '' && !preg_match('#^0[67]([ \\.-]?)[0-9]{2}(?:\\1[0-9]{2}){3}$#', $data['cellphone'])) {
             throw new FormException('cellphone');
         }
         $user_data['cellphone'] = $data['cellphone'];
     }
     // Phone
     if (isset($data['phone'])) {
         if ($data['phone'] != '' && !preg_match('#^0[1-59]([ \\.-]?)[0-9]{2}(?:\\1[0-9]{2}){3}$#', $data['phone'])) {
             throw new FormException('phone');
         }
         $user_data['phone'] = $data['phone'];
     }
     // Birthday
     if (isset($data['birthday'])) {
         if (!($birthday = strptime($data['birthday'], __('USER_EDIT_FORM_BIRTHDAY_FORMAT_PARSE')))) {
             throw new FormException('birthday');
         }
         $user_data['birthday'] = $birthday['tm_year'] + 1900 . '-' . ($birthday['tm_mon'] + 1) . '-' . $birthday['tm_mday'];
     }
     // Update the DB
     $this->createQuery()->set($user_data)->update($id);
 }
Пример #4
0
 /**
  * Check value
  *
  * @param array $options
  */
 public final function checkOptions($checkOptions)
 {
     $attributes = get_object_vars($this);
     $checkPass = true;
     foreach ($attributes as $attribute => $value) {
         if (in_array($attribute, array('primary', 'tableName', 'fieldMap', 'conditions'))) {
             continue;
         }
         $checkOptionString = trim($checkOptions[$attribute]);
         if (strlen($checkOptionString) <= 0) {
             continue;
         }
         $checkList = explode(';', $checkOptionString);
         //var_dump($checkList);
         foreach ($checkList as $check) {
             //var_dump($check);
             $field = strtoupper($attribute);
             $checkInfo = explode(':', $check);
             //var_dump($checkInfo);
             //var_dump($valueObject->$attribute, $field, $checkInfo[1]);
             switch ($checkInfo[0]) {
                 case 'required':
                     if (!trim($this->{$attribute})) {
                         $message = Language::content($checkInfo[1]);
                         Errors::addError($message, $field);
                         $checkPass = false;
                     }
                     break;
                 case 'number':
                     if (strlen(trim($this->{$attribute})) <= 0) {
                         break;
                     }
                     if (strlen($valueObject->{$attribute}) > 0 && !is_numeric($valueObject->{$attribute})) {
                         $message = Language::content($checkInfo[1]);
                         Errors::addError($message, $field);
                         $checkPass = false;
                     }
                     break;
                 case 'email':
                     if (strlen(trim($this->{$attribute})) <= 0) {
                         break;
                     }
                     if (!Validation::isEmail($valueObject->{$attribute})) {
                         $message = Language::content($checkInfo[1]);
                         Errors::addError($message, $field);
                         $checkPass = false;
                     }
                     break;
                 case 'date':
                     //var_dump($valueObject->$attribute);
                     if (strlen(trim($this->{$attribute})) <= 0) {
                         break;
                     }
                     if (!Validation::isDate($valueObject->{$attribute})) {
                         $message = Language::content($checkInfo[1]);
                         Errors::addError($message, $field);
                         $checkPass = false;
                         break;
                     }
                 case 'alnum':
                     if (strlen(trim($this->{$attribute})) <= 0) {
                         break;
                     }
                     if (!Validation::isAlnum($valueObject->{$attribute})) {
                         $message = Language::content($checkInfo[1]);
                         Errors::addError($message, $field);
                         $checkPass = false;
                     }
                     break;
                 case 'minLength':
                     if (strlen(trim($this->{$attribute})) <= 0) {
                         break;
                     }
                     if (strlen($valueObject->{$attribute}) < $checkInfo[2]) {
                         $messageTpl = Language::content($checkInfo[1]);
                         $message = str_replace('{0}', $checkInfo[2], $messageTpl);
                         Errors::addError($message, $field);
                         $checkPass = false;
                     }
                     break;
                 case 'maxLength':
                     if (strlen(trim($this->{$attribute})) <= 0) {
                         break;
                     }
                     if (strlen($valueObject->{$attribute}) > $checkInfo[2]) {
                         $messageTpl = Language::content($checkInfo[1]);
                         $message = str_replace('{0}', $checkInfo[2], $messageTpl);
                         Errors::addError($message, $field);
                         $checkPass = false;
                     }
                     break;
             }
         }
     }
     return $checkPass;
 }
 /**
  * Method used to perform a specific action to an issue.
  *
  * @param   integer $issue_id The issue ID
  * @param   array $reminder The reminder details
  * @param   array $action The action details
  * @return  boolean
  */
 public static function perform($issue_id, $reminder, $action)
 {
     $type = '';
     // - see which action type we're talking about here...
     $action_type = self::getActionType($action['rma_rmt_id']);
     // - do we also need to alert the group leader about this?
     $group_leader_usr_id = 0;
     if ($action['rma_alert_group_leader']) {
         if (Reminder::isDebug()) {
             echo '  - ' . ev_gettext('Processing Group Leader notification') . "\n";
         }
         $group_id = Issue::getGroupID($issue_id);
         // check if there's even a group associated with this issue
         if (empty($group_id)) {
             if (Reminder::isDebug()) {
                 echo '  - ' . ev_gettext('No group associated with issue %1$s', $issue_id) . "\n";
             }
         } else {
             $group_details = Group::getDetails($group_id);
             if (!empty($group_details['grp_manager_usr_id'])) {
                 $group_leader_usr_id = $group_details['grp_manager_usr_id'];
             }
         }
     }
     if (Reminder::isDebug()) {
         echo '  - ' . ev_gettext('Performing action %1$s for issue # %2$s', $action_type, $issue_id) . "\n";
     }
     switch ($action_type) {
         case 'email_assignee':
             $type = 'email';
             $assignees = Issue::getAssignedUserIDs($issue_id);
             $to = array();
             foreach ($assignees as $assignee) {
                 $to[] = User::getFromHeader($assignee);
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id)) {
                 $leader_email = User::getFromHeader($group_leader_usr_id);
                 if (!empty($leader_email) && !in_array($leader_email, $to)) {
                     $to[] = $leader_email;
                 }
             }
             break;
         case 'email_list':
             $type = 'email';
             $list = self::getUserList($action['rma_id']);
             $to = array();
             foreach ($list as $key => $value) {
                 // add the recipient to the list if it's a simple email address
                 if (Validation::isEmail($key)) {
                     $to[] = $key;
                 } else {
                     $to[] = User::getFromHeader($key);
                 }
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id)) {
                 $leader_email = User::getFromHeader($group_leader_usr_id);
                 if (!empty($leader_email) && !in_array($leader_email, $to)) {
                     $to[] = $leader_email;
                 }
             }
             break;
         case 'sms_assignee':
             $type = 'sms';
             $assignees = Issue::getAssignedUserIDs($issue_id);
             $to = array();
             foreach ($assignees as $assignee) {
                 if (User::isClockedIn($assignee)) {
                     $sms_email = User::getSMS($assignee);
                     if (!empty($sms_email)) {
                         $to[] = $sms_email;
                     }
                 }
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
                 $leader_sms_email = User::getSMS($group_leader_usr_id);
                 if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
                     $to[] = $leader_sms_email;
                 }
             }
             break;
         case 'sms_list':
             $type = 'sms';
             $list = self::getUserList($action['rma_id']);
             $to = array();
             foreach ($list as $key => $value) {
                 // add the recipient to the list if it's a simple email address
                 if (Validation::isEmail($key)) {
                     $to[] = $key;
                 } else {
                     // otherwise, check for the clocked-in status
                     if (User::isClockedIn($key)) {
                         $sms_email = User::getSMS($key);
                         if (!empty($sms_email)) {
                             $to[] = $sms_email;
                         }
                     }
                 }
             }
             // add the group leader to the recipient list, if needed
             if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
                 $leader_sms_email = User::getSMS($group_leader_usr_id);
                 if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
                     $to[] = $leader_sms_email;
                 }
             }
             break;
     }
     $data = Issue::getDetails($issue_id);
     $conditions = Reminder_Condition::getAdminList($action['rma_id']);
     // alert IRC if needed
     if ($action['rma_alert_irc']) {
         if (Reminder::isDebug()) {
             echo "  - Processing IRC notification\n";
         }
         $irc_notice = "Issue #{$issue_id} (";
         if (!empty($data['pri_title'])) {
             $irc_notice .= 'Priority: ' . $data['pri_title'];
         }
         if (!empty($data['sev_title'])) {
             $irc_notice .= 'Severity: ' . $data['sev_title'];
         }
         // also add information about the assignee, if any
         $assignment = Issue::getAssignedUsers($issue_id);
         if (count($assignment) > 0) {
             $irc_notice .= '; Assignment: ' . implode(', ', $assignment);
         }
         if (!empty($data['iss_grp_id'])) {
             $irc_notice .= '; Group: ' . Group::getName($data['iss_grp_id']);
         }
         $irc_notice .= "), Reminder action '" . $action['rma_title'] . "' was just triggered; " . $action['rma_boilerplate'];
         Notification::notifyIRC(Issue::getProjectID($issue_id), $irc_notice, $issue_id, false, APP_EVENTUM_IRC_CATEGORY_REMINDER);
     }
     $setup = Setup::get();
     // if there are no recipients, then just skip to the next action
     if (count($to) == 0) {
         if (Reminder::isDebug()) {
             echo "  - No recipients could be found\n";
         }
         // if not even an irc alert was sent, then save
         // a notice about this on reminder_sent@, if needed
         if (!$action['rma_alert_irc']) {
             if ($setup['email_reminder']['status'] == 'enabled') {
                 self::_recordNoRecipientError($issue_id, $type, $reminder, $action, $data, $conditions);
             }
             return false;
         }
     }
     // - save a history entry about this action
     self::saveHistory($issue_id, $action['rma_id']);
     // - save this action as the latest triggered one for the given issue ID
     self::recordLastTriggered($issue_id, $action['rma_id']);
     // - perform the action
     if (count($to) > 0) {
         // send a copy of this reminder to reminder_sent@, if needed
         if ($setup['email_reminder']['status'] == 'enabled' && $setup['email_reminder']['addresses']) {
             $addresses = Reminder::_getReminderAlertAddresses();
             if (count($addresses) > 0) {
                 $to = array_merge($to, $addresses);
             }
         }
         $tpl = new Template_Helper();
         $tpl->setTemplate('reminders/' . $type . '_alert.tpl.text');
         $tpl->assign(array('data' => $data, 'reminder' => $reminder, 'action' => $action, 'conditions' => $conditions, 'has_customer_integration' => CRM::hasCustomerIntegration(Issue::getProjectID($issue_id))));
         $text_message = $tpl->getTemplateContents();
         foreach ($to as $address) {
             // send email (use PEAR's classes)
             $mail = new Mail_Helper();
             $mail->setTextBody($text_message);
             $setup = $mail->getSMTPSettings();
             // TRANSLATORS: %1 - issue_id, %2 - rma_title
             $subject = ev_gettext('[#%1$s] Reminder: %2$s', $issue_id, $action['rma_title']);
             $mail->send($setup['from'], $address, $subject, 0, $issue_id, 'reminder');
         }
     }
     // - eventum saves the day once again
     return true;
 }
Пример #6
0
 } else {
     include SITE_CLASS_GEN . "class.validation.php";
     $validation = new Validation();
     ### SERVER SIDE VALIDATION ####
     $RequiredFiledArr = array('vFirstName' => $smarty->get_template_vars('LBL_ENTER_FIRST_NAME'), 'vLastName' => $smarty->get_template_vars('LBL_ENTER_LAST_NAME'), 'vUserName' => $smarty->get_template_vars('LBL_ENTER_USER_NAME'), 'vPassword' => $smarty->get_template_vars('LBL_ENTER_PASSWORD'), 'cPassword' => $smarty->get_template_vars('LBL_ENTER_CPASSWORD'), 'vCountry' => $smarty->get_template_vars('LBL_ENTER_COUNTRY'), 'vState' => $smarty->get_template_vars('LBL_ENTER_STATE'), 'vZipCode' => $smarty->get_template_vars('LBL_ZIPCODE'), 'vEmail' => $smarty->get_template_vars('LBL_EMAIL_ADDRESS'), 'vCity' => $smarty->get_template_vars('LBL_ENTER_CITY'), 'iOrganizationID' => $smarty->get_template_vars('MSG_SELECT_ORGANIZATION'), 'vAddressLine1' => $smarty->get_template_vars('LBL_ENTER_ADDRESSLINE1'), 'vAnswer' => $smarty->get_template_vars('LBL_ENTER_ANSWER'), 'iSecretQuestion1ID' => $smarty->get_template_vars('LBL_ENTER_QESTION'));
     $resArr = $validation->isEmpty($RequiredFiledArr);
     //prints($resArr);exit;
     ### ENDS HERE ###
     $id = $Data['iUserID'];
     $val = $Data['vEmail'];
     $user = $Data['vUserName'];
     ###check Valid Email###
     $chekemail = array('vEmail' => $val);
     $validEmailmsg[] = $smarty->get_template_vars('MSG_VALID_EMAIL');
     if ($Data['vEmail'] != '') {
         $vmail = $validation->isEmail($chekemail, $validEmailmsg);
     }
     ###  End check Valid Email###
     if ($Data['vZipcode'] != '') {
         $vZipCode = $Data['vZipcode'];
     }
     $arr = array();
     if ($Data['vPhone'] != '') {
         $arr = $Data['vPhone'];
     }
     $ar = array(explode('-', $arr));
     $Data['vPhone'] = $ar[0][1];
     $Data['vPhoneCode'] = $ar[0][0];
     if ($Data['vMobile'] != '') {
         $arr = $Data['vMobile'];
     }
Пример #7
0
 /**
  * Create a group
  *
  * @param array $data	Group's data
  * @return string	URL name
  */
 public function create($data)
 {
     $group_data = array();
     // Name
     $change_name = false;
     if (!isset($data['name'])) {
         throw new FormException('invalid_name');
     }
     $name = trim($data['name']);
     $group_data['name'] = $name;
     // URL name
     $url_name = Text::forURL($name);
     if ($url_name == '') {
         throw new FormException('invalid_name');
     }
     $i = '';
     while (self::urlExists($url_name . $i)) {
         $i = $i == '' ? 1 : $i + 1;
     }
     $url_name .= $i;
     $group_data['url_name'] = $url_name;
     // Creation date
     if (!isset($data['creation_date']) || !($creation_date = strptime($data['creation_date'], __('GROUP_EDIT_FORM_CREATION_DATE_FORMAT_PARSE')))) {
         throw new FormException('invalid_creation_date');
     }
     $group_data['creation_date'] = $creation_date['tm_year'] + 1900 . '-' . ($creation_date['tm_mon'] + 1) . '-' . $creation_date['tm_mday'];
     // Email
     if (isset($data['mail'])) {
         if ($data['mail'] != '' && !Validation::isEmail($data['mail'])) {
             throw new FormException('invalid_mail');
         }
         $group_data['mail'] = $data['mail'];
     }
     // Description
     if (isset($data['description'])) {
         $group_data['description'] = $data['description'];
     }
     // Avatar
     if (!isset($data['avatar_path']) || !File::exists($data['avatar_path']) || !isset($data['avatar_big_path']) && !File::exists($data['avatar_big_path'])) {
         throw new FormException('avatar');
     }
     // Insertion in the DB
     $id = $this->createQuery()->set($group_data)->insert();
     // Avatar
     $avatar_path = self::getAvatarPath($id, true);
     $avatar_dir = File::getPath($avatar_path);
     if (!is_dir($avatar_dir)) {
         File::makeDir($avatar_dir, 0777, true);
     }
     File::rename($data['avatar_path'], $avatar_path);
     $avatar_path = self::getAvatarPath($id, false);
     $avatar_dir = File::getPath($avatar_path);
     if (!is_dir($avatar_dir)) {
         File::makeDir($avatar_dir, 0777, true);
     }
     File::rename($data['avatar_big_path'], $avatar_path);
     // Members
     if (isset($data['members']) && is_array($data['members'])) {
         $i = 0;
         foreach ($data['members'] as &$member) {
             $member['order'] = $i++;
         }
         if (count($data['members']) != 0) {
             $users = DB::createQuery('users')->fields('id')->where('id IN (' . implode(',', array_keys($data['members'])) . ')')->select();
             foreach ($users as $user) {
                 DB::createQuery('groups_users')->set(array('group_id' => $id, 'user_id' => $user['id'], 'title' => $data['members'][(int) $user['id']]['title'], 'admin' => $data['members'][(int) $user['id']]['admin'] ? '1' : '0', 'order' => $data['members'][(int) $user['id']]['order']))->insert();
             }
         }
     }
     // Add to the search index
     $search_model = new Search_Model();
     $search_model->index(array('name' => Search_Model::sanitize($group_data['name']), 'url_name' => $group_data['url_name'], 'description' => Search_Model::sanitize($group_data['description'])), 'group', $id);
     self::clearCache();
     return $url_name;
 }
Пример #8
0
<?php

require 'validation.php';
$validation = new Validation();
$nome = $_POST['nome'];
$email = $_POST['email'];
$site = $_POST['site'];
$telefone = $_POST['telefone'];
$mensagem = $validation->purifier($_POST['mensagem']);
if (!$validation->isLetter($nome)) {
    $nome = '';
}
if (!$validation->isEmail($email)) {
    $email = '';
}
if (!$validation->isTelephone($telefone)) {
    $telefone = '';
}
$assunto = '[tmartins.com.br] Contato do Site';
$sender = '*****@*****.**';
$senderCopy = '*****@*****.**';
$senderName = 'Thais Martins';
if (PATH_SEPARATOR == ";") {
    $quebra_linha = "\r\n";
} else {
    $quebra_linha = "\n";
}
$headers = "MIME-Version: 1.1" . $quebra_linha;
$headers .= "Content-type: text/html; charset=utf-8" . $quebra_linha;
$headers .= "From:" . $senderName . "<" . $sender . ">" . $quebra_linha;
$headers .= "Reply-To: " . $email . $quebra_linha;