Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Commit

Permalink
Codesniff fixes for event/Getcomments.php
Browse files Browse the repository at this point in the history
  • Loading branch information
dstockto committed Dec 6, 2012
1 parent c627869 commit 968e4d8
Showing 1 changed file with 76 additions and 18 deletions.
94 changes: 76 additions & 18 deletions src/system/application/libraries/wsactions/event/Getcomments.php
@@ -1,37 +1,95 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
/**
* Joindin webservice for getting comments
*
* PHP version 5
*
* @category Joind.in
* @package Configuration
* @copyright 2009 - 2012 Joind.in
* @license http://github.com/joindin/joind.in/blob/master/doc/LICENSE JoindIn
*/

class Getcomments extends BaseWsRequest {

var $CI = null;
var $xml= null;
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}

/**
* Joindin webservice for getting comments
*
* PHP version 5
*
* @category Joind.in
* @package Configuration
* @copyright 2009 - 2012 Joind.in
* @license http://github.com/joindin/joind.in/blob/master/doc/LICENSE JoindIn
*/
class Getcomments extends BaseWsRequest
{
public $CI = null;
public $xml = null;

public function Getcomments($xml) {
$this->CI=&get_instance();
$this->xml=$xml;

/**
* Instantiates the webservice to get comments
*
* @param string $xml XML sent to service
*/
public function Getcomments($xml)
{
$this->CI = &get_instance();
$this->xml = $xml;
}
public function checkSecurity($xml) {

/**
* Ensures that the caller sent the event id, otherwise the
* API is public
*
* @param string $xml XML sent to webservice
*
* @return boolean
*
* @todo Investigate if checking on event id would give back a bogus
* error message for when there is no event id.
*/
public function checkSecurity($xml)
{
//public function!
// Be sure they've given us an event ID
if (!isset($xml->action->event_id)) { return false; }
if (!isset($xml->action->event_id)) {
return false;
}

return true;

}
//-----------------------
public function run() {

/**
* Does the work to get the comments for an event
*
* @return array
*/
public function run()
{
$this->CI->load->library('wsvalidate');

$rules=array(
'event_id' =>'required|isevent',
$rules = array(
'event_id' =>'required|isevent',
);
$eid=$this->xml->action->event_id;
$valid=$this->CI->wsvalidate->validate($rules, $this->xml->action);
$eid = $this->xml->action->event_id;
$valid = $this->CI->wsvalidate->validate($rules, $this->xml->action);
if (!$valid) {
$this->CI->load->model('event_comments_model');
$ret=$this->CI->event_comments_model->getEventComments($eid);
$ret = $this->CI->event_comments_model->getEventComments($eid);
return array('output'=>'json','data'=>array('items'=>$ret));
} else {
return array('output'=>'json','data'=>array('items'=>array('msg'=>'Invalid Event ID!')));
return array(
'output'=>'json',
'data'=>array(
'items'=>array(
'msg'=>'Invalid Event ID!')
)
);
}
}

Expand Down

0 comments on commit 968e4d8

Please sign in to comment.