Пример #1
0
  function request ($method, $resource, $params=array(), $format=false)
  {
    if ($format != false)
    {
      $this->rest->format($format);
    }

    // Reformat Paramaters as Array
    if (is_string($params))
    {
      parse_str($params,$params_a);
      $params = $params_a;
    }

    if (method_exists($this->rest,$method) === true)
    {
      $result = $this->rest->{$method}($resource,$params);

      if (isset($result->error) === true)
      {
        User_Notice::error($result->error);
        return false;
      }
      elseif ($this->rest->status() >= 500)
      {
        User_Notice::error('The API server responded with an error code. ('.$this->rest->status().')');
      }
      elseif (empty($result) === true  AND $this->rest->status() != 200)
      {
        User_Notice::error('The API server responded with an empty result.');
        return false;
      }

      return $result;
    }
    else
    {
      return false;
    }
  }
Пример #2
0
  // Load jQuery
  google.load("jquery", "1");
</script>
<script type="text/javascript" src="<?=assets_url()?>js/jquery-ui-1.7.2.custom.min.js"></script>
</head>

<body class="minimal">

<div id="hd">
	<div id="suphd">
		<a href="<?=site_url('dashboard')?>" id="ScreenBug" title="Go to Dashboard"><span>Go to Dashboard</span></a>
	</div>
	<div id="subhd">
		<h1>G-LAB</h1>
	</div>
</div>
<div id="bd">
	<h2><?php echo $pageTitle ?></h2>
	<?php foreach (User_Notice::fetch_array() as $notice) : ?>
		<div class="notice <?=$notice->type?>">
			<?=$notice?>
		</div>
	<?php endforeach; ?>
	<?php echo $content['body'] ?>
</div>
<div id="ft">
<?php $this->load->view('_footer'); ?>
</div>

</body>
</html>
Пример #3
0
 function email($tmpl, $data, $recipients, $brand = false, $reply_to = false)
 {
     $CI =& get_instance();
     $CI->load->library('email');
     $CI->load->library('parser');
     $CI->load->model('profile');
     $CI->load->helper('typography');
     $CI->load->helper('glib_validation');
     $config['mailtype'] = 'html';
     $CI->email->initialize($config);
     // Defalt Brand
     if ($brand == false) {
         $brand = 'glab';
     }
     // Parse Recipients
     if (is_string($recipients) === true) {
         $recipients = explode(',', $recipients, 20);
     }
     foreach ($recipients as $recip) {
         $profile = $CI->profile->get($recip);
         // Lookup Recipient
         if ($profile->exists() === true) {
             $email['entity']['name'] = $profile->name->friendly;
             if (is_email($recip)) {
                 $email['entity']['email'] = $recip;
             } elseif ($profile->email->primary() !== false) {
                 $email['entity']['email'] = $profile->email->primary();
             } else {
                 $email['entity']['email'] = false;
             }
         } elseif (is_email($recip)) {
             $email['entity']['name'] = "Hello";
             $email['entity']['email'] = $recip;
         } else {
             $email['entity']['email'] = false;
         }
         $body_text = $CI->parser->parse('_emails/' . $tmpl, $data, TRUE);
         $body_html = $CI->load->view('_emails/msg_' . $brand, array_merge(array('body' => $body_text, 'from' => 'G LAB Studios'), $email), TRUE);
         if (file_exists(APPPATH . 'views/_emails/' . $tmpl . '_subject.php')) {
             $subject = $CI->parser->parse('_emails/' . $tmpl . '_subject', $data, TRUE);
         } else {
             $subject = 'Important Message from G LAB';
         }
         $CI->email->from('*****@*****.**', 'G LAB');
         $CI->email->to($email['entity']['email']);
         if (is_string($reply_to) === true and is_email($reply_to) === true) {
             $CI->email->reply_to($reply_to);
         }
         $CI->email->subject($subject);
         $CI->email->message($body_html);
         $CI->email->set_alt_message($body_text);
         if (is_string($email['entity']['email']) === true) {
             if (strtolower(ENVIRONMENT) === 'production') {
                 $success = $CI->email->send();
             } else {
                 User_Notice::warning('Notification to ' . $email['entity']['email'] . ' suppressed.');
             }
         }
     }
     $CI->email->clear();
     if (isset($success) and $success === true) {
         return $email['entity']['email'];
     } else {
         return false;
     }
 }
Пример #4
0
 protected function validate($key,$value)
 {
   switch($key)
   {
       case 'type':
         return true;
       break;
       case 'label':
         return true;
       break;
       case 'tel':
           if(is_tel($value))
           {
             return true;
           }
           else
           {
             User_Notice::error($value.' is not a valid US or international phone number.');
           }
       break;
       default:
           return false;
       break;
   }
 }