Beispiel #1
0
 /**
  * 
  * 返回总店的所有分店信息
  * param: parentId
  */
 public function shopbranches_get()
 {
     $url = HOST . "/classes/Shop?";
     $parentId = $this->get('parentId');
     if (empty($parentId)) {
         outputError(-1, '没有总店信息');
     }
     $where = array('parent' => avosPointer('Shop', $parentId));
     $url .= 'where=' . json_encode($where);
     $json = $this->kq->get($url);
     $error = checkResponseError($json);
     if (!empty($error)) {
         return $error;
     }
     $results = resultsWithJson($json);
     foreach ($results as $result) {
         $array[] = array_slice_keys($result, array('title', 'objectId', 'phone', 'address', 'openTime', 'location'));
     }
     if (!isLocalhost()) {
         $this->output->cache(CacheTime);
     }
     return $this->output_results($array);
 }
Beispiel #2
0
 public function district_get()
 {
     $url = HOST . "/classes/District?include=city&";
     $json = $this->jsonWithGETUrl($url);
     $error = checkResponseError($json);
     if (!empty($error)) {
         return $error;
     }
     $results = resultsWithJson($json);
     foreach ($results as $result) {
         $array[] = array_slice_keys($result, array('title', 'objectId'));
     }
     if (!isLocalhost()) {
         $this->output->cache(CacheTime);
     }
     return $this->outputArray($array);
 }
function sendBackground($options = array())
{
    if (@$options['disabled']) {
        return;
    }
    // don't send if 'disabled' option set
    $hasText = array_key_exists('text', $options);
    $hasHTML = array_key_exists('html', $options);
    // error checking
    $errors = '';
    if (!isValidEmail(@$options['to'], true)) {
        $errors .= "'to' isn't a valid email '" . htmlencode($options['to']) . "'!<br/>\n";
    }
    if (!isValidEmail(@$options['from'])) {
        $errors .= "'from' isn't a valid email '" . htmlencode($options['from']) . "'!<br/>\n";
    }
    if (!array_key_exists('subject', $options)) {
        $errors .= "'subject' must be defined!<br/>\n";
    }
    if (!$hasText && !$hasHTML) {
        $errors .= "Either 'text' or 'html' or both must be defined!<br/>\n";
    }
    if (!isValidEmail(@$options['from'])) {
        $errors .= "'from' isn't a valid email '" . htmlencode($options['from']) . "'!<br/>\n";
    }
    if (!array_key_exists('subject', $options)) {
        $errors .= "'subject' must be defined!<br/>\n";
    }
    if (array_key_exists('headers', $options)) {
        $errors .= "'headers' not supported by sendBackground yet.<br/>\n";
    }
    if (array_key_exists('attachments', $options)) {
        $errors .= "'attachments' not supported by sendBackground yet.<br/>\n";
    }
    if ($errors) {
        return $errors;
    }
    // save message
    $colsToValues = array_slice_keys($options, array('from', 'to', 'subject', 'text', 'html'));
    $colsToValues['createdDate='] = 'NOW()';
    $colsToValues['sent'] = '';
    $colsToValues['backgroundSend'] = '1';
    $colsToValues['reply-to'] = @$colsToValues['headers']['Reply-To'];
    $colsToValues['cc'] = @$colsToValues['headers']['CC'];
    $colsToValues['bcc'] = @$colsToValues['headers']['BCC'];
    mysql_insert('_outgoing_mail', $colsToValues, true);
}