Esempio n. 1
0
                         $eData['emailUser'] = $responce['emailUser'];
                         $eData['allfiles'] = $responce['allfiles'];
                         $eData['caseNo'] = $responce['caseNo'];
                         $eData['emailTitle'] = $responce['emailTitle'];
                         $eData['emailMsg'] = $responce['emailMsg'];
                         $eData['casePriority'] = $responce['casePriority'];
                         $eData['caseTypeId'] = $responce['caseTypeId'];
                         $eData['msg'] = $responce['msg'];
                         $eData['emailbody'] = $responce['emailbody'];
                         $eData['caseIstype'] = $responce['caseIstype'];
                         $eData['csType'] = $responce['csType'];
                         $eData['caUid'] = $responce['caUid'];
                         $eData['caseid'] = $responce['caseid'];
                         $eData['caseUniqId'] = $responce['caseUniqId'];
                         //echo '<pre>';print_r($eData);
                         $email_res = curlPostData(HTTP_ROOT . 'easycases/ajaxemail', $eData);
                         //print '<pre>';print_r($email_res);
                     }
                 }
             } else {
                 write2log("Daily Update Error: No message to add reply.", $message, $mail_id, $header->subject, $header->date);
             }
         } else {
             write2log("Daily Update Error: There is no task for this reply.", $message, $mail_id, $header->subject, $header->date);
         }
     } else {
         write2log("Daily Update Error: The account is cancelled:", $message, $mail_id, $header->subject, $header->date);
     }
 } else {
     write2log("Daily Update Error: This user not associate with project: {$row_pid['name']} ({$row_pid['short_name']}).", $message, $mail_id, $header->subject, $header->date);
 }
Esempio n. 2
0
 /**
  * Get the URL to retrieve CSV data from for a given date.  The web form we
  * access generates the CSV file when we POST our query and generates a web
  * page with a link to the CSV file to be downloaded.  This function submits
  * the query and retrieves the URL of the CSV file from the resulting web
  * page.
  *
  * @param DateTime $date
  * @return string The URL the CSV data can be loaded from
  */
 public function getCSVURL(&$date)
 {
     if ($date->getTimestamp() < strtotime(self::EARLIEST_WEB_DATE)) {
         die('Error: Specified date (' . $date->format('Y-m-d') . ') is ' . 'earlier than the earliest data available via this interface (' . self::EARLIEST_WEB_DATE . ')' . "\n");
     }
     $url = self::FILTON_BASE_URL . self::FILTON_SQL_URL_SUFFIX;
     $postFields = array('formYear' => $date->format('Y'), 'formMonth' => $date->format('m'), 'formDate' => $date->format('d'), 'submit1' => 'submit');
     $putResult = curlPostData($url, $postFields, array('Content-type: application/x-www-form-urlencoded', 'Accept: text/html'));
     $startAt = 0;
     $csvURL = FALSE;
     while ($hrefOffset = strpos($putResult, '<a href=', $startAt)) {
         $matches = array();
         if (preg_match('/[a-zA-Z0-9\\-\\/]+\\.csv/', substr($putResult, $hrefOffset + 8), $matches)) {
             $csvURL = self::FILTON_BASE_URL . '/' . $matches[0];
             break;
         }
     }
     return $csvURL;
 }