├── README.md
├── aec
├── aec.php
├── aec.xml
└── aec
│ ├── createuser.php
│ ├── planslist.php
│ ├── setexpiration.php
│ ├── setusertoplan.php
│ └── userlist.php
├── akeebasubs
├── akeebasubs.php
├── akeebasubs.xml
└── akeebasubs
│ ├── subscription.php
│ └── subscriptions.php
├── articles
├── README.md
├── articles.php
├── articles.xml
└── articles
│ ├── article.php
│ ├── blogs
│ ├── blog
│ │ ├── comment.php
│ │ └── post.php
│ ├── category.php
│ └── person.php
│ ├── category.php
│ ├── helper
│ ├── contenthelper.php
│ └── simpleschema.php
│ └── latest.php
├── categories
├── README.md
├── categories.php
├── categories.xml
└── categories
│ ├── categories.php
│ └── category.php
├── easyblog
├── components
│ └── com_easyblog
│ │ └── helpers
│ │ └── simpleschema.php
├── easyblog.php
├── easyblog.xml
├── easyblog4
│ ├── blog.php
│ ├── category.php
│ ├── comments.php
│ ├── easyblog_users.php
│ ├── image.php
│ ├── latest.php
│ ├── rating.php
│ ├── subscribe.php
│ └── tags.php
├── easyblog5
│ ├── blog.php
│ ├── category.php
│ ├── comments.php
│ ├── easyblog_users.php
│ ├── image.php
│ ├── latest.php
│ ├── rating.php
│ ├── report.php
│ ├── subscribe.php
│ └── tags.php
├── helper
│ └── simpleschema.php
├── language
│ └── en-GB
│ │ ├── en-GB.plg_api_easyblog.ini
│ │ └── en-GB.plg_api_easyblog.sys.ini
├── libraries
│ └── simpleschema
│ │ ├── blog
│ │ ├── comment.php
│ │ └── post.php
│ │ ├── category.php
│ │ └── person.php
└── script.php
├── easysocial
├── easysocial.php
├── easysocial.xml
├── easysocial
│ ├── album.php
│ ├── block.php
│ ├── comments.php
│ ├── discussion.php
│ ├── event.php
│ ├── event_category.php
│ ├── event_guest.php
│ ├── event_schedule.php
│ ├── eventinvite.php
│ ├── events.php
│ ├── fblogin.php
│ ├── follower.php
│ ├── friend.php
│ ├── friends.php
│ ├── gcm.php
│ ├── getalbums.php
│ ├── googlelogin.php
│ ├── group.php
│ ├── group_category.php
│ ├── group_members.php
│ ├── groupinvite.php
│ ├── groups.php
│ ├── hashsearch.php
│ ├── hashtag.php
│ ├── leaderboard.php
│ ├── like.php
│ ├── manage_friends.php
│ ├── message.php
│ ├── newsfeed.php
│ ├── notification.php
│ ├── page.php
│ ├── pages.php
│ ├── photoadd.php
│ ├── polls.php
│ ├── profile.php
│ ├── pushnotify.php
│ ├── removetags.php
│ ├── reply.php
│ ├── report.php
│ ├── request.php
│ ├── search.php
│ ├── share.php
│ ├── slogin.php
│ ├── social_share.php
│ ├── sociallogin.php
│ ├── stream.php
│ ├── streams.php
│ ├── tags.php
│ ├── terms.php
│ ├── videos.php
│ ├── videos_link.php
│ └── votes.php
├── language
│ └── en-GB
│ │ ├── en-GB.plg_api_easysocial.ini
│ │ ├── en-GB.plg_api_easysocial.ini~
│ │ └── en-GB.plg_api_easysocial.sys.ini
└── libraries
│ ├── mappingHelper.php
│ ├── schema
│ ├── albums.php
│ ├── category.php
│ ├── createalbum.php
│ ├── discussion.php
│ ├── events.php
│ ├── group.php
│ ├── group_members.php
│ ├── message.php
│ ├── page.php
│ ├── person.php
│ ├── photos.php
│ ├── profile.php
│ ├── stream.php
│ ├── user.php
│ └── videos.php
│ └── uploadHelper.php
├── jticketing
├── jticket.php
├── jticket.xml
├── jticket
│ ├── checkin.php
│ ├── getattendeelist.php
│ ├── geteventdetails.php
│ ├── getpayouts.php
│ ├── getticketlist.php
│ ├── getticketsales.php
│ ├── gettickettypes.php
│ ├── getuserevents.php
│ ├── index.html
│ └── login.php
└── language
│ └── en-GB
│ └── en-GB.plg_api_jticket.ini
├── redshop
├── index.html
├── redshop.php
├── redshop.xml
└── redshop
│ ├── details.php
│ ├── helper.php
│ ├── index.html
│ └── summary.php
├── socialads
├── socialads.php
├── socialads.xml
└── socialads
│ ├── details.php
│ ├── helper.php
│ ├── index.html
│ └── summary.php
└── users
├── README.md
├── language
└── en-GB
│ ├── en-GB.plg_api_users.ini
│ └── en-GB.plg_api_users.sys.ini
├── users.php
├── users.xml
└── users
├── config.php
├── login.php
└── users.php
/aec/aec.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 |
13 | class plgAPIAec extends ApiPlugin
14 | {
15 | public function __construct()
16 | {
17 | parent::__construct();
18 |
19 | ApiResource::addIncludePath(dirname(__FILE__).'/aec');
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/aec/aec.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - aec
4 | 1.0
5 | 10/11/2014
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | API plugins of AEC components of the Joomla!
12 |
13 |
14 | aec.php
15 | aec/userlist.php
16 | aec/createuser.php
17 | aec
18 |
19 |
20 |
--------------------------------------------------------------------------------
/aec/aec/planslist.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die;
10 |
11 | jimport('joomla.plugin.plugin');
12 | //function in file - /var/www/mppronline/administrator/components/com_acctexp/admin.acctexp.php
13 |
14 |
15 | class AecApiResourcePlanslist extends ApiResource
16 | {
17 | public function get()
18 | {
19 | require_once JPATH_SITE .'/components/com_acctexp/acctexp.class.php';
20 | $limitstart = JRequest::getInt('limitstart',0);
21 | $limit = JRequest::getInt('limit',20);
22 | $active = JRequest::getInt('active',0);
23 | $visible = JRequest::getInt('visible',0);
24 | $name = JRequest::getVar('name','');
25 | $pattern = '/' . preg_quote($name, '/') . '/';
26 |
27 | $limit = ($limit>100)?100:$limit;
28 |
29 | $t_plans = SubscriptionPlanHandler::getFullPlanList();
30 | $plans = SubscriptionPlanHandler::getFullPlanList($limitstart,$limit);
31 | $data = array();
32 | $data["total"] = count($t_plans);
33 | $sel_plan = array();
34 | foreach($plans as $k=>$val)
35 | {
36 |
37 | //$val->group_id = ItemGroupHandler::getItemListItem($val);
38 | unset($val->params);
39 | unset($val->custom_params);
40 | unset($val->restrictions);
41 | unset($val->micro_integrations);
42 | unset($val->lifetime);
43 | unset($val->email_desc);
44 |
45 | if($active && $visible && $val->active == 1 && $val->visible == 1 )
46 | {
47 | $sel_plan[$val->id] = $val;
48 | }
49 | elseif($active && $val->active == $active && $val->visible != 0 )
50 | {
51 |
52 | $sel_plan[$val->id] = $val;
53 | }
54 | elseif($visible && $val->visible == $visible && $val->active != 0)
55 | {
56 |
57 | $sel_plan[$val->id] = $val;
58 | }
59 | elseif($visible ==0 && $active == 0 && $name == '' )
60 | {
61 | $sel_plan[$val->id] = $val;
62 | }
63 |
64 | }
65 | //$match = preg_match($pattern, $val->name);
66 | $name_arr = array();
67 | foreach($sel_plan as $k=>$v)
68 | {
69 |
70 | if(preg_match($pattern, $v->name))
71 | {
72 |
73 | $name_arr[$v->id] = $v;
74 | }
75 | $sel_plan =$name_arr;
76 | }
77 |
78 |
79 |
80 | $data['count']=count($sel_plan);
81 | $data['users']=$sel_plan;
82 | $this->plugin->setResponse($data);
83 |
84 |
85 | }
86 |
87 | /**
88 | * This is not the best example to follow
89 | * Please see the category plugin for a better example
90 | */
91 | public function post()
92 | {
93 |
94 | $this->plugin->setResponse( "this is post data" );
95 | }
96 |
97 | public function put()
98 | {
99 | // Simply call post as K2 will just save an item with an id
100 | /*$this->post();
101 |
102 | $response = $this->plugin->get( 'response' );
103 | if ( isset( $response->success ) && $response->success ) {
104 | JResponse::setHeader( 'status', 200, true );
105 | $response->code = 200;
106 | $this->plugin->setResponse( $response );
107 | }*/
108 | }
109 |
110 | function qry()
111 | {
112 | $db = &JFactory::getDBO();
113 | $qry = "SELECT count(*) FROM #__acctexp_subscr AS a INNER JOIN #__users AS b ON a.userid = b.id WHERE ((a.status = 'Active' || a.status = 'Trial'))";
114 | $db->setQuery( $query );
115 | $total = $db->loadResult();
116 | }
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/aec/aec/setexpiration.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die;
10 |
11 | jimport('joomla.plugin.plugin');
12 | //function in file - /var/www/mppronline/administrator/components/com_acctexp/admin.acctexp.php
13 |
14 |
15 | class AecApiResourceSetexpiration extends ApiResource
16 | {
17 | public function get()
18 | {
19 |
20 |
21 | }
22 |
23 | /**
24 | * This is not the best example to follow
25 | * Please see the category plugin for a better example
26 | */
27 | public function post()
28 | {
29 |
30 | require_once JPATH_SITE .'/components/com_acctexp/acctexp.class.php';
31 |
32 | $db = &JFactory::getDBO();
33 | $app = JFactory::getApplication();
34 |
35 | $userid = JRequest::getInt('user_id',0);
36 | $planid = JRequest::getInt('plan_id',0);
37 | $new_expiry = JRequest::getString('date',0);
38 | //convert date in format
39 | $new_expiry = date("Y-m-d h:i:s",strtotime($new_expiry));
40 |
41 | $obj = new stdClass();
42 | //validate plan
43 | $plans = SubscriptionPlanHandler::getPlanList();
44 | $muser = metaUserDB::getIDbyUserid($userid);
45 | $plnuser = SubscriptionPlanHandler::getPlanUserlist($planid);
46 |
47 | if(!$userid)
48 | {
49 | $obj->success = 0;
50 | $obj->code = 21;
51 | $obj->message = "invalid user id";
52 | }
53 | elseif(!$plans[array_search($planid, $plans)])
54 | {
55 | $obj->success = 0;
56 | $obj->code = 22;
57 | $obj->message = "invalid plan id";
58 | }
59 | elseif($userid == $plnuser[array_search($userid, $plnuser)])
60 | {
61 |
62 | $plan = new SubscriptionPlan( $db );
63 | $plan->load( $planid );
64 |
65 |
66 | $metaUser = new metaUser( $userid );
67 | $renew = $metaUser->is_renewing();
68 |
69 | $lifetime = $metaUser->focusSubscription->lifetime;
70 | $metaUser->focusSubscription->plan = $planid;
71 | $metaUser->focusSubscription->status = 'Active';
72 | $metaUser->temporaryRFIX();
73 |
74 | $metaUser->focusSubscription->lifetime = 0;
75 | //set expiration
76 | //$now = (int) gmdate('U');
77 | $metaUser->focusSubscription->expiration = $new_expiry;
78 | //$metaUser->objSubscription->expiration = $new_expiry;
79 |
80 | $reply = $metaUser->focusSubscription->storeload();
81 |
82 | if($reply && $planid)
83 | {
84 |
85 | $obj->success = 1;
86 | $obj->message = "Expiry updated";
87 | }
88 | }
89 | else
90 | {
91 | $obj->success = 0;
92 | $obj->code = 31;
93 | $obj->message = "Plan not assigned to user";
94 |
95 | }
96 |
97 | $this->plugin->setResponse($obj);
98 |
99 |
100 | }
101 |
102 | public function put()
103 | {
104 |
105 | }
106 |
107 | function qry()
108 | {
109 | /*$db = &JFactory::getDBO();
110 | $qry = "SELECT count(*) FROM #__acctexp_subscr AS a INNER JOIN #__users AS b ON a.userid = b.id WHERE ((a.status = 'Active' || a.status = 'Trial'))";
111 | $db->setQuery( $query );
112 | $total = $db->loadResult(); */
113 | }
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/aec/aec/setusertoplan.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die;
10 |
11 | jimport('joomla.plugin.plugin');
12 | //function in file - /var/www/mppronline/administrator/components/com_acctexp/admin.acctexp.php
13 |
14 |
15 | class AecApiResourceSetusertoplan extends ApiResource
16 | {
17 | public function get()
18 | {
19 |
20 |
21 | }
22 |
23 | /**
24 | * This is not the best example to follow
25 | * Please see the category plugin for a better example
26 | */
27 | public function post()
28 | {
29 |
30 | require_once JPATH_SITE .'/components/com_acctexp/acctexp.class.php';
31 | $db = &JFactory::getDBO();
32 | $app = JFactory::getApplication();
33 |
34 | $userid = JRequest::getInt('user_id',0);
35 | $planid = JRequest::getInt('plan_id',0);
36 | //$new_expiry = JRequest::getString('date',0);
37 |
38 | $obj = new stdClass();
39 | //validate plan
40 | $plans = SubscriptionPlanHandler::getPlanList();
41 | $muser = metaUserDB::getIDbyUserid($userid);
42 |
43 | //$pplan = metaUserDB::getPreviousPlan($muser);
44 | //$uplan = metaUserDB::getUsedPlans($muser);
45 | //print_r($new_expiry);die;
46 | if(!$userid)
47 | {
48 | $obj->success = 0;
49 | $obj->code = 21;
50 | $obj->message = "invalid user id";
51 | }
52 | elseif(!$plans[array_search($planid, $plans)])
53 | {
54 | $obj->success = 0;
55 | $obj->code = 22;
56 | $obj->message = "invalid plan id";
57 | }
58 | else
59 | {
60 |
61 | $plan = new SubscriptionPlan( $db );
62 | $plan->load( $planid );
63 | //print_r($plan->params['full_period']);die;
64 | //check user is metauser
65 | /*if ( is_a( $user, 'metaUser' ) ) {
66 | $metaUser = $user;
67 | } elseif( is_a( $user, 'Subscription' ) ) {
68 | $metaUser = new metaUser( $user->userid );
69 |
70 | $metaUser->focusSubscription = $user;
71 | }*/
72 |
73 |
74 | $metaUser = new metaUser( $userid );
75 | $renew = $metaUser->is_renewing();
76 |
77 | //$metaUser->focusSubscription->lifetime;
78 | $metaUser->focusSubscription->plan = $planid;
79 | $metaUser->focusSubscription->status = 'Active';
80 | $metaUser->temporaryRFIX();
81 |
82 | //$metaUser->focusSubscription->lifetime = 1;
83 | //set expiration
84 | $now = (int) gmdate('U');
85 | //$current = strtotime($new_expiry);
86 | //$metaUser->focusSubscription->expiration = $new_expiry;
87 |
88 |
89 | //$metaUser->objSubscription->expiration = $new_expiry;
90 |
91 | $reply = $metaUser->focusSubscription->storeload();
92 |
93 | if($reply && $planid)
94 | {
95 | $history = new logHistory( $db );
96 | $obj->success = 1;
97 | $obj->message = "User added to plan";
98 | }
99 | }
100 |
101 | $this->plugin->setResponse($obj);
102 |
103 | }
104 |
105 | public function put()
106 | {
107 | // Simply call post as K2 will just save an item with an id
108 | /*$this->post();
109 |
110 | $response = $this->plugin->get( 'response' );
111 | if ( isset( $response->success ) && $response->success ) {
112 | JResponse::setHeader( 'status', 200, true );
113 | $response->code = 200;
114 | $this->plugin->setResponse( $response );
115 | }*/
116 | }
117 |
118 | function qry()
119 | {
120 | $db = &JFactory::getDBO();
121 | $qry = "SELECT count(*) FROM #__acctexp_subscr AS a INNER JOIN #__users AS b ON a.userid = b.id WHERE ((a.status = 'Active' || a.status = 'Trial'))";
122 | $db->setQuery( $query );
123 | $total = $db->loadResult();
124 | }
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/aec/aec/userlist.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die;
10 |
11 | jimport('joomla.plugin.plugin');
12 |
13 |
14 | class AecApiResourceUserlist extends ApiResource
15 | {
16 | public function get()
17 | {
18 | $limitstart = JRequest::getInt('limitstart',0);
19 | $limit = JRequest::getInt('limit',20);
20 | $userid = JRequest::getInt('id',0);
21 | $name = JRequest::getVar('name','');
22 | $username = JRequest::getVar('username','');
23 | $email = JRequest::getVar('email','');
24 | $plan_status = JRequest::getVar('plan_status','');
25 | $ordering = JRequest::getVar('ordering','registerDate');
26 | $orderingdir = JRequest::getVar('orderingdir','ASC');
27 |
28 |
29 | $db = &JFactory::getDBO();
30 | //total active users
31 | $query = "SELECT count(*) FROM #__acctexp_subscr AS a INNER JOIN #__users AS b ON a.userid = b.id ";
32 | /*if($plan_status != '')
33 | {
34 | $query .="WHERE a.status = '{$plan_status}'";
35 |
36 | }*/
37 |
38 | $db->setQuery( $query );
39 | $total = $db->loadResult();
40 |
41 | $query = "SELECT a.*, b.name, b.username, b.email, c.name AS plan_name FROM #__acctexp_subscr AS a INNER JOIN #__users AS b ON a.userid = b.id LEFT JOIN #__acctexp_plans AS c ON a.plan = c.id ";
42 |
43 | $where = array();
44 |
45 |
46 | if ( $userid)
47 | {
48 |
49 | $where[] = "b.id ={$userid}";
50 | }
51 | if ($name)
52 | {
53 |
54 | $where[] = " b.name LIKE '%{$name}%' ";
55 | }
56 | if ($username !='' )
57 | {
58 | $where[] = " b.username LIKE '%{$username}%' ";
59 | }
60 | if ($email)
61 | {
62 | $where[] = "b.email = '{$email}'";
63 | }
64 |
65 | if($plan_status != '')
66 | {
67 | $where[] = "a.status = '{$plan_status}'";
68 | }
69 |
70 | $where = count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ;
71 | $query .= $where;
72 | $query .= " ORDER BY {$ordering} {$orderingdir} LIMIT {$limitstart},{$limit}";
73 | //die("in userlist api");
74 | $db->setQuery( $query );
75 | $users = $db->loadObjectList();
76 | $pln = new stdClass;
77 | foreach($users as $key=>$val)
78 | {
79 | $pln->plan = $val->plan;
80 | $pln->id = $val->id;
81 | $pln->type = $val->type;
82 | $pln->status = $val->status;
83 | $pln->signup_date = $val->signup_date;
84 | $pln->expiration = $val->expiration;
85 |
86 | unset($val->params);
87 | unset($val->primary);
88 | unset($val->plan_name);
89 | unset($val->recurring);
90 | unset($val->lifetime);
91 | unset($val->customparams);
92 | unset($val->lastpay_date);
93 | unset($val->eot_date);
94 | unset($val->eot_cause);
95 | unset($val->plan);
96 | unset($val->id);
97 | unset($val->type);
98 | unset($val->status);
99 | unset($val->signup_date);
100 | unset($val->expiration);
101 | unset($val->cancel_date);
102 | $val->id = $val->userid;
103 | $val->plan = $pln;
104 |
105 | unset($val->userid);
106 |
107 | $users[$key] = $val;
108 | }
109 |
110 | $data = array('total'=>$total,'count'=>count($users),'data'=>$users);
111 |
112 | $this->plugin->setResponse($data);
113 |
114 |
115 | }
116 |
117 | /**
118 | * This is not the best example to follow
119 | * Please see the category plugin for a better example
120 | */
121 | public function post()
122 | {
123 |
124 | $this->plugin->setResponse( "this is post data" );
125 | }
126 |
127 | public function put()
128 | {
129 | // Simply call post as K2 will just save an item with an id
130 | /*$this->post();
131 |
132 | $response = $this->plugin->get( 'response' );
133 | if ( isset( $response->success ) && $response->success ) {
134 | JResponse::setHeader( 'status', 200, true );
135 | $response->code = 200;
136 | $this->plugin->setResponse( $response );
137 | }*/
138 | }
139 |
140 | /*function qry()
141 | {
142 | $db = &JFactory::getDBO();
143 | $qry = "SELECT count(*) FROM #__acctexp_subscr AS a INNER JOIN #__users AS b ON a.userid = b.id WHERE ((a.status = 'Active' || a.status = 'Trial'))";
144 | $db->setQuery( $query );
145 | $total = $db->loadResult();
146 | }*/
147 |
148 | }
149 |
--------------------------------------------------------------------------------
/akeebasubs/akeebasubs.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 |
13 | class plgAPIAkeebasubs extends ApiPlugin
14 | {
15 | public function __construct(&$subject, $config = array())
16 | {
17 | parent::__construct($subject, $config = array());
18 |
19 | ApiResource::addIncludePath(dirname(__FILE__).'/akeebasubs');
20 |
21 | // Set public resources if needed
22 | // $this->setResourceAccess('resourcename', 'public');
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/akeebasubs/akeebasubs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - Akeeba Subs
4 | 1.6
5 | 10/11/2014
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | This plugin exposes Akeeba subs as an API. Supports creating and listing subscriptions.
13 | The methods in this API use Akeeba's ACL. So create subscriptions, list subscriptions etc. honour the user levels allowed to perform those actions.
14 |
15 | Create Subscription
16 | POST /index.php?option=com_api&app=akeebasubs&format=raw&resource=subscription&key=[key]
17 | By default only the users who have permissions for creating subscriptions can use this API. However this can be overriden via the parameters.
18 | Input Variables
19 | name (mandatory) : name of the user for whom subscription will be created
20 | email (mandatory) : email of the user for whom subscription will be created. Will be used to check for an existing user
21 | subscription (mandatory) : Level id for the subscription to created
22 | enabled (optional) : 1 = Enable the subscription, 0 = Create disabled subscription (useful for testing)
23 | Output
24 | Success : Returns a 200 code and the id of the subscription that got created
25 |
26 | Failure : Returns an error code (404/403) upon failure and a message containing the reason for failure
27 |
28 | List Subscriptions
29 | GET /index.php?option=com_api&app=akeebasubs&format=raw&resource=subscriptions&key=[key]
30 | Input Variables
31 | limit (optional) : Defaults to 10
32 | limitstart (optional) : Defaults to 0
33 | enabled (optional) : Setting this to 1/0 will filter the list by enabled
34 | status (optional) : Setting this to C/P/X/N will filter the list by status
35 | Output
36 | Success : Returns an array of subscription objects
37 |
38 | Failure : Returns an error code (404/403) upon failure and a message containing the reason for failure
39 |
40 |
41 | ]]>
42 |
43 |
44 | akeebasubs.php
45 | akeebasubs
46 |
47 |
48 |
49 |
50 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/akeebasubs/akeebasubs/subscriptions.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 | jimport('joomla.user.user');
11 |
12 | class AkeebasubsApiResourceSubscriptions extends ApiResource
13 | {
14 |
15 | static public function routes() {
16 | $routes[] = 'users/';
17 |
18 | return $routes;
19 | }
20 |
21 | public function delete()
22 | {
23 | $this->plugin->setResponse( 'in delete' );
24 | }
25 |
26 | public function post()
27 | {
28 | $this->plugin->setResponse( 'in post' );
29 | }
30 |
31 | public function get() {
32 |
33 | $input = JFactory::getApplication()->input;
34 | $user = $this->plugin->getUser();
35 | $filters = array(
36 | 'search'=>'',
37 | 'title'=>'',
38 | 'enabled'=>'',
39 | 'level'=>'',
40 | 'publish_up'=>'',
41 | 'publish_down'=>'',
42 | 'user_id',
43 | 'paystate'=>'',
44 | 'processor'=>'',
45 | 'paykey'=>'',
46 | 'since'=>'',
47 | 'until'=>'',
48 | 'contact_flag'=>'',
49 | 'expires_from'=>'',
50 | 'expires_to'=>'',
51 | 'refresh'=>'',
52 | 'groupbydate'=>'',
53 | 'groupbyweek'=>'',
54 | 'groupbylevel'=>'',
55 | 'moneysum'=>'',
56 | 'coupon_id'=>'',
57 | 'filter_discountmode'=>'',
58 | 'filter_discountcode'=>'',
59 | 'nozero'=>'',
60 | 'nojoins'=>''
61 | );
62 |
63 | if (!$user) {
64 | $this->plugin->setResponse( $this->getErrorResponse(404, JText::_('JERROR_ALERTNOAUTHOR')) );
65 | return;
66 | }
67 |
68 | $authorised = $user->authorise('core.manage', 'com_akeebasubs');
69 |
70 | if (!$authorised) {
71 | $this->plugin->setResponse( $this->getErrorResponse(404, JText::_('JERROR_ALERTNOAUTHOR')) );
72 | return;
73 | }
74 |
75 | $subscriptionsmodel = FOFModel::getTmpInstance('Subscriptions', 'AkeebasubsModel');
76 | $order = $input->get('filter_order','akeebasubs_subscription_id');
77 | $orderdir = $input->get('filter_order_Dir','DESC');
78 | if(!in_array($order, array_keys($subscriptionsmodel->getTable()->getData()))) $order = 'akeebasubs_subscription_id';
79 | $subscriptionsmodel->setState('filter_order', $order);
80 | $subscriptionsmodel->setState('filter_order_Dir', $orderdir);
81 |
82 | foreach ($filters as $filter=>$val) {
83 | $subscriptionsmodel->setState($filter, $input->get($filter, $val));
84 | }
85 |
86 | $subscriptionsmodel->limit($input->get('limit', 10))->limitstart($input->get('limit', 0));
87 |
88 | $this->plugin->setResponse( $subscriptionsmodel->getList() );
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/articles/README.md:
--------------------------------------------------------------------------------
1 | API to create and get content
2 |
3 | ## Create / Update Content
4 |
5 | ```http
6 | POST /index.php?option=com_api&app=articles&resource=article&format=raw
7 | ```
8 | OR update an existing article
9 | ```http
10 | POST /index.php?option=com_api&app=articles&resource=article&format=raw&id=:id
11 | ```
12 |
13 | #### Request Params
14 |
15 | | Param Name | Required | Type | Comment |
16 | | ---------- | -------- | ------- | :---- |
17 | | title | YES | STRING | |
18 | | alias | NO | STRING | URL alias. Will be generated based on title if kept empty |
19 | | introtext | YES | STRING | |
20 | | fulltext | NO | STRING | |
21 | | state | NO | INT | 1 = Published (Default) / 0 = Unpublished / -1 = Archived |
22 | | catid | YES | INT | Category ID |
23 | | publish_up | NO | DATETIME | Defaults to current date/time |
24 | | publish_down | NO | DATETIME | Defaults to 0000-00-00 i.e. never |
25 | | language | NO | STRING |Will use the site's default language if none provided. |
26 |
27 |
28 | #### Response Params
29 |
30 | | Param Name | Comment |
31 | | ---------- | :------ |
32 | | success | true if the article was created, false if there was a problem |
33 | | message | Error mesage in case success is false |
34 | | data.results | Array containing a single [Article Object](#article-object) in case of success. Empty array in case of failure. |
35 |
36 | ## Get Articles List
37 | ```http
38 | GET /index.php?option=com_api&app=articles&resource=article&format=raw
39 | ```
40 | #### Request Params
41 |
42 | | Param Name | Required | Comment |
43 | | ---------- | -------- | :------ |
44 | | limit | NO | Defaults to 20 |
45 | | limitstart | NO | Defaults to 0 |
46 | | filters | NO | Key value pairs of values to filter on |
47 | | search | NO | search key for searching article titles |
48 | | fields | NO | Defaults to id, title, modified, created_by, catid |
49 |
50 |
51 | #### Response Params
52 |
53 | | Param Name | Comment |
54 | | ---------- | :------- |
55 | | success | true if the article was created, false if there was a problem |
56 | | message | Error mesage in case success is false |
57 | | data.results | Array of [Article Objects](#article-object) in case of success. Empty array in case of failure. |
58 | | data.total | Total should be the total count that match the filters, not the total of items in the current set, i.e. if there are 240 articles matching the filters, and the API returns first 20 then the total should contain 240 not 20. |
59 |
60 |
61 | ## Get Single Article
62 | ```http
63 | GET /index.php?option=com_api&app=articles&resource=article&format=raw&id=:id
64 | ```
65 |
66 | #### Request Params
67 |
68 | | Param Name | Required | Comment |
69 | | ---------- | -------- | :------ |
70 | | fields | NO | Defaults to id, title, modified, created_by, catid |
71 |
72 |
73 | #### Response Params
74 |
75 | | Param Name | Comment |
76 | | ---------- | :------- |
77 | | success | true if the request succeeds, false if there was a problem |
78 | | message | Error mesage in case success is false |
79 | | data.results | Array containing a single [Article Object](#article-object) in case of success. Empty array in case of failure. |
80 |
81 |
82 | ## Article Object
83 | The actual contents of the article object will vary based on which fields are requested, however the below is the list of all possible fields.
84 |
85 | ```json
86 | {
87 | "id" : "",
88 | "title" : "",
89 | "alias" : "",
90 | "introtext" : "",
91 | "fulltext" : "",
92 | "catid" : {
93 | "id" : "",
94 | "title" : ""
95 | },
96 | "state" : "",
97 | "created" : "",
98 | "modified" : "",
99 | "publish_up" : "",
100 | "publish_down" : "",
101 | "images" : "",
102 | "access" : "",
103 | "featured" : "",
104 | "language" : "",
105 | "hits": "",
106 | "created_by": {
107 | "id" : "",
108 | "name" : "",
109 | "avatar" : ""
110 | },
111 | "tags" : {}
112 | }
113 | ```
114 |
--------------------------------------------------------------------------------
/articles/articles.php:
--------------------------------------------------------------------------------
1 | setResourceAccess('article', 'public', 'get');
28 | $this->setResourceAccess('category', 'public', 'get');
29 | $this->setResourceAccess('latest', 'public', 'get');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/articles/articles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - Articles
4 | 1.0
5 | Sept 2015
6 | AppCarvers
7 | support@appcarvers.com
8 | http://www.appcarvers.com
9 | Appcarvers. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | This plugin use for get data from joomla site.
12 |
13 |
14 | articles.php
15 | articles/category.php
16 | articles
17 |
18 |
19 |
20 |
21 |
22 |
35 |
36 |
42 |
43 |
49 |
50 |
56 |
95 |
96 |
137 |
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/articles/articles/blogs/blog/comment.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | class CommentSimpleSchema {
9 |
10 | public $commentid;
11 |
12 | public $postid;
13 |
14 | public $title;
15 |
16 | public $text;
17 |
18 | public $textplain;
19 |
20 | public $created_date;
21 |
22 | public $updated_date;
23 |
24 | public $created_date_elapsed;
25 |
26 | public $author;
27 |
28 | public function __construct() {
29 | $this->author = new PersonSimpleSchema;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/articles/articles/blogs/blog/post.php:
--------------------------------------------------------------------------------
1 | author = new PersonSimpleSchema;
41 | $this->category = new CategorySimpleSchema;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/articles/articles/blogs/category.php:
--------------------------------------------------------------------------------
1 |
7 | * @copyright Copyright (C) 2009 - 2019 Techjoomla, Tekdi Technologies Pvt. Ltd. All rights reserved.
8 | * @license GNU GPLv2
9 | */
10 |
11 | // No direct access.
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | /**
15 | * Category API plugin class
16 | *
17 | * @package API
18 | * @since 1.6.0
19 | */
20 | class PlgAPICategories extends ApiPlugin
21 | {
22 | /**
23 | * Constructor.
24 | *
25 | * @param object &$subject The object to observe.
26 | * @param array $config An optional associative array of configuration settings.
27 | *
28 | * @since 1.6.0
29 | */
30 | public function __construct(&$subject, $config = array())
31 | {
32 | parent::__construct($subject, $config = array());
33 |
34 | ApiResource::addIncludePath(dirname(__FILE__) . '/categories');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/categories/categories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - categories
4 | 1.6
5 | 22 July 2015
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | This plugin is for content Request
12 |
13 | categories.php
14 | categories
15 |
16 |
17 | en-GB.plg_api_categories.ini
18 | en-GB.plg_api_categories.sys.ini
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/categories/categories/categories.php:
--------------------------------------------------------------------------------
1 |
7 | * @copyright Copyright (C) 2009 - 2019 Techjoomla, Tekdi Technologies Pvt. Ltd. All rights reserved.
8 | * @license GNU GPLv2
9 | */
10 |
11 | // No direct access.
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | // Load category list model from admin
15 | JLoader::register('CategoriesModelCategories', JPATH_ROOT . '/administrator/components/com_categories/models/categories.php');
16 |
17 | /**
18 | * Categories API resource class
19 | *
20 | * @package API
21 | * @since 1.6.0
22 | */
23 | class CategoriesApiResourceCategories extends ApiResource
24 | {
25 | /**
26 | * Get categories
27 | *
28 | * @return object Categories list wrapped inside standard api response wrapper
29 | */
30 | public function get()
31 | {
32 | $this->plugin->setResponse($this->getCategoriesList());
33 | }
34 |
35 | /**
36 | * Get list of categories based on input params
37 | *
38 | * @return array
39 | *
40 | * @since 1.6.0
41 | */
42 | public function getCategoriesList()
43 | {
44 | // Get an instance of the generic articles model
45 | $model = JModelLegacy::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true));
46 |
47 | // Set application parameters in model
48 | $app = JFactory::getApplication();
49 | $input = $app->input;
50 |
51 | // Get inputs params
52 | $limit = $input->get->get('limit', 20, 'int');
53 | $limitStart = $input->get->get('limitstart', 0, 'int');
54 | $search = $input->get->get('search', '', 'string');
55 |
56 | // Get filters
57 | $filters = $input->get->get('filters', '', 'array');
58 | $jInputFilter = JFilterInput::getInstance();
59 |
60 | // Cleanup and set default values
61 | $access = isset($filters['access']) ? $jInputFilter->clean($filters['access'], 'cmd') : '';
62 | $extension = isset($filters['extension']) ? $jInputFilter->clean($filters['extension'], 'cmd') : 'com_content';
63 | $language = isset($filters['language']) ? $jInputFilter->clean($filters['language'], 'string') : '';
64 | $level = isset($filters['level']) ? $jInputFilter->clean($filters['level'], 'string') : '';
65 | $published = isset($filters['published']) ? $jInputFilter->clean($filters['published'], 'int') : 1;
66 |
67 | // Set the filters based on the module params
68 | $model->setState('list.limit', $limit);
69 | $model->setState('list.start', $limitStart);
70 | $model->setState('filter.search', $search);
71 |
72 | $model->setState('filter.access', $access);
73 | $model->setState('filter.extension', $extension);
74 | $model->setState('filter.language', $language);
75 | $model->setState('filter.level', $level);
76 | $model->setState('filter.published', $published);
77 |
78 | // Extract the component name, Extract the optional section name
79 | $parts = explode('.', $extension);
80 | $model->setState('filter.component', $parts[0]);
81 | $model->setState('filter.section', (count($parts) > 1) ? $parts[1] : null);
82 |
83 | return $model->getItems();
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/categories/categories/category.php:
--------------------------------------------------------------------------------
1 |
7 | * @copyright Copyright (C) 2009 - 2019 Techjoomla, Tekdi Technologies Pvt. Ltd. All rights reserved.
8 | * @license GNU GPLv2
9 | */
10 |
11 | // No direct access.
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | JLoader::register('CategoriesModelCategory', JPATH_ROOT . '/administrator/components/com_categories/models/category.php');
15 |
16 | /**
17 | * Category API resource class
18 | *
19 | * @package API
20 | * @since 1.6.0
21 | */
22 | class CategoriesApiResourceCategory extends ApiResource
23 | {
24 | /**
25 | * Get categories
26 | *
27 | * @return object Category details wrapped inside standard api response wrapper
28 | */
29 | public function get()
30 | {
31 | $this->plugin->setResponse($this->getCategory());
32 | }
33 |
34 | /**
35 | * Save category - create / update
36 | *
37 | * @return object Category details wrapped inside standard api response wrapper
38 | */
39 | public function post()
40 | {
41 | // $this->plugin->setResponse($this->saveCategory());
42 | }
43 |
44 | /**
45 | * Get category details
46 | *
47 | * @return array
48 | *
49 | * @since 1.6.0
50 | */
51 | public function getCategory()
52 | {
53 | // 1. Important to include category table first
54 | JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_categories/tables');
55 |
56 | // 2. Then, get an instance of the generic articles model
57 | $model = JModelLegacy::getInstance('Category', 'CategoriesModel', array('ignore_request' => true));
58 |
59 | // Set application parameters in model
60 | $app = JFactory::getApplication();
61 | $input = $app->input;
62 |
63 | // Important to get from input directly and not from $input->get->get()
64 | $id = $input->get('id', 0, 'int');
65 |
66 | if (!$id)
67 | {
68 | // Not Found Error sets HTTP 404
69 | ApiError::raiseError(404, "Record not found", 'APINotFoundException');
70 | }
71 |
72 | $item = $model->getItem($id);
73 |
74 | // Exists?
75 | if (empty($item->id))
76 | {
77 | // Not Found Error sets HTTP 404
78 | ApiError::raiseError(404, "Record not found", 'APINotFoundException');
79 | }
80 |
81 | return $item;
82 | }
83 |
84 | /**
85 | * CreateUpdateCategory is to create / upadte Category
86 | *
87 | * @return Bolean
88 | *
89 | * @since 3.5
90 | */
91 | /*public function saveCategory()
92 | {
93 | if (version_compare(JVERSION, '3.0', 'lt'))
94 | {
95 | JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table');
96 | }
97 |
98 | $obj = new stdclass;
99 |
100 | $app = JFactory::getApplication();
101 | $cat_id = $app->input->post->get('id', 0, 'INT');
102 |
103 | if (empty($app->input->post->get('title', '', 'STRING')))
104 | {
105 | $obj->code = 'ER001';
106 | $obj->message = 'Title Field is Missing';
107 |
108 | return $obj;
109 | }
110 |
111 | if (empty($app->input->post->get('extension', '', 'STRING')))
112 | {
113 | $obj->code = 'ER002';
114 | $obj->message = 'Extension Field is Missing';
115 |
116 | return $obj;
117 | }
118 |
119 | if ($cat_id)
120 | {
121 | $category = JTable::getInstance('Content', 'JTable', array());
122 | $category->load($cat_id);
123 | $data = array(
124 | 'title' => $app->input->post->get('title', '', 'STRING'),
125 | );
126 |
127 | if (!$cat_id->bind($data))
128 | {
129 | $this->setError($article->getError());
130 |
131 | return false;
132 | }
133 | }
134 | else
135 | {
136 | $category = JTable::getInstance('content');
137 | $category->title = $app->input->post->get('title', '', 'STRING');
138 | $category->alias = $app->input->post->get('alias', '', 'STRING');
139 | $category->description = $app->input->post->get('description', '', 'STRING');
140 | $category->published = $app->input->post->get('published', '', 'STRING');
141 | $category->parent_id = $app->input->post->get('parent_id', '', 'STRING');
142 | $category->extension = $app->input->post->get('language', '', 'INT');
143 | $category->access = $app->input->post->get('catid', '', 'INT');
144 | }
145 |
146 | if (!$category->check())
147 | {
148 | $this->setError($category->getError());
149 |
150 | return false;
151 | }
152 |
153 | if (!$category->store())
154 | {
155 | $this->setError($category->getError());
156 |
157 | return false;
158 | }
159 | }*/
160 | }
161 |
--------------------------------------------------------------------------------
/easyblog/components/com_easyblog/helpers/simpleschema.php:
--------------------------------------------------------------------------------
1 | load( $row->id );
24 |
25 | $profile = EasyBlogHelper::getTable( 'Profile', 'Table' );
26 | $profile->load( $row->created_by );
27 |
28 | $created = EasyBlogDateHelper::dateWithOffSet( $row->created );
29 | $formatDate = true;
30 | if(EasyBlogHelper::getJoomlaVersion() >= '1.6')
31 | {
32 | $langCode = EasyBlogStringHelper::getLangCode();
33 | if($langCode != 'en-GB' || $langCode != 'en-US')
34 | $formatDate = false;
35 | }
36 | $blog->created = $created->toMySQL();
37 |
38 | if( $config->get( 'main_rss_content' ) == 'introtext' )
39 | {
40 | $blog->text = ( !empty( $row->intro ) ) ? $row->intro : $row->content;
41 | }
42 | else
43 | {
44 | $blog->text = $row->intro . $row->content;
45 |
46 | }
47 | $blog->text = EasyBlogHelper::getHelper( 'Videos' )->strip( $blog->text );
48 | $blog->text = EasyBlogGoogleAdsense::stripAdsenseCode( $blog->text );
49 |
50 | $category = EasyBlogHelper::getTable( 'Category', 'Table' );
51 | $category->load( $row->category_id );
52 |
53 | $item = new PostSimpleSchema;
54 | $item->textplain = $blog->text;
55 |
56 | // @TODO : Take care of a case when strip tags and length are used together
57 | if ($strip_tags) {
58 | $item->textplain = strip_tags($blog->text, $strip_tags);
59 | }
60 |
61 | if ($text_length > 0) {
62 | $pos = JString::strpos(strip_tags($item->textplain), ' ', $text_length);
63 | $item->textplain = JString::substr(strip_tags($blog->text), 0, $pos);
64 | }
65 |
66 | $image_data = json_decode($blog->image);
67 |
68 | $item->postid = $blog->id;
69 | $item->title = $blog->title;
70 |
71 | $item->text = $blog->text;
72 | $item->textplain = $this->sanitize($item->textplain);
73 |
74 | $item->image = $blog->getImage();
75 | $item->image->url = $image_data->url;
76 | $item->created_date = $blog->created;
77 | $item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime( $blog->created );
78 |
79 | $item->author->name = $profile->nickname;
80 | $item->author->photo = JURI::root() . $profile->avatar;
81 |
82 | $item->category->categoryid = $category->id;
83 | $item->category->title = $category->title;
84 |
85 | $item->url = JURI::root() . trim('index.php?option=com_easyblog&view=entry&id=' . $blog->id, '/');
86 |
87 | foreach ($skip as $v) {
88 | unset($item->$v);
89 | }
90 |
91 | return $item;
92 | }
93 |
94 | public function sanitize($text) {
95 | $text = htmlspecialchars_decode($text);
96 | $text = str_ireplace(' ', ' ', $text);
97 |
98 | return $text;
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/easyblog/easyblog.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 |
13 | class plgAPIEasyblog extends ApiPlugin
14 | {
15 | public function __construct(&$subject, $config = array())
16 | {
17 | parent::__construct($subject, $config = array());
18 |
19 | /*load language file for plugin frontend*/
20 | $lang = JFactory::getLanguage();
21 | $lang->load('plg_api_easyblog', JPATH_ADMINISTRATOR,'',true);
22 |
23 | $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
24 | if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easyblog', true)) {
25 | ApiError::raiseError(404, 'Easyblog not installed');
26 | return;
27 | }
28 |
29 | //load helper file
30 | require_once JPATH_SITE.'/plugins/api/easyblog/helper/simpleschema.php';
31 | // Load Easyblog language & bootstrap files
32 | $language = JFactory::getLanguage();
33 | $language->load('com_easyblog');
34 |
35 | $xml = JFactory::getXML(JPATH_ADMINISTRATOR .'/components/com_easyblog/easyblog.xml');
36 | $version = (string)$xml->version;
37 |
38 | if($version<5)
39 | {
40 | require_once( JPATH_ROOT . '/components/com_easyblog/constants.php' );
41 | require_once( JPATH_ROOT . '/components/com_easyblog/helpers/helper.php' );
42 | ApiResource::addIncludePath(dirname(__FILE__).'/easyblog4');
43 | }
44 | else
45 | {
46 | ApiResource::addIncludePath(dirname(__FILE__).'/easyblog5');
47 | require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/easyblog.php';
48 | require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/constants.php' ;
49 | //require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/gettable/gettable.php' ;
50 | require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/date/date.php' );
51 | require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/string/string.php' );
52 | require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/adsense/adsense.php' );
53 | }
54 |
55 | // Set resources & access
56 | $this->setResourceAccess('latest', 'public', 'get');
57 | $this->setResourceAccess('category', 'public', 'get');
58 | $this->setResourceAccess('blog', 'public', 'get');
59 | $this->setResourceAccess('blog', 'public', 'post');
60 | $this->setResourceAccess('comments', 'public', 'get');
61 | $this->setResourceAccess('easyblog_users', 'public', 'get');
62 |
63 | $config = EasyBlogHelper::getConfig();
64 | if ($config->get('main_allowguestcomment')) {
65 | $this->setResourceAccess('comments', 'public', 'post');
66 | }
67 |
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/easyblog/easyblog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - Easyblog
4 | 1.8.5
5 | 10/11/2014
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | PLG_API_EASYBLOG_DESCRIPTION
12 |
13 | easyblog.php
14 | easyblog4
15 | easyblog5
16 | helper
17 | components
18 | libraries
19 |
20 |
21 |
22 | en-GB/en-GB.plg_api_easyblog.ini
23 | en-GB/en-GB.plg_api_easyblog.sys.ini
24 |
25 |
26 |
27 |
28 |
29 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/easyblog/easyblog4/category.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 |
10 | jimport('joomla.user.user');
11 | jimport( 'simpleschema.easyblog.category' );
12 | jimport( 'simpleschema.easyblog.person' );
13 | jimport( 'simpleschema.easyblog.blog.post' );
14 |
15 | require_once( EBLOG_HELPERS . '/date.php' );
16 | require_once( EBLOG_HELPERS . '/string.php' );
17 | require_once( EBLOG_CLASSES . '/adsense.php' );
18 |
19 | class EasyblogApiResourceCategory extends ApiResource
20 | {
21 |
22 | public function __construct( &$ubject, $config = array()) {
23 | parent::__construct( $ubject, $config = array() );
24 | }
25 |
26 | public function get() {
27 |
28 | $input = JFactory::getApplication()->input;
29 | $model = EasyBlogHelper::getModel( 'Blog' );
30 | $category = EasyBlogHelper::getTable( 'Category', 'Table' );
31 | $id = $input->get('id', null, 'INT');
32 | $search = $input->get('search', null, 'STRING');
33 |
34 | $limitstart = $input->get('limitstart',0,'INT');
35 | $limit = $input->get('limit',10,'INT');
36 |
37 | $posts = array();
38 |
39 |
40 | if (!isset($id)) {
41 | $categoriesmodel = EasyBlogHelper::getModel( 'Categories' );
42 | $categories = $categoriesmodel->getCategoryTree('ordering');
43 |
44 | $categories = array_slice($categories, $limitstart,$limit);
45 |
46 | $this->plugin->setResponse( $categories );
47 | return;
48 | }
49 |
50 | $category->load($id);
51 |
52 | // private category shouldn't allow to access.
53 | $privacy = $category->checkPrivacy();
54 |
55 | if(!$category->id || ! $privacy->allowed )
56 | {
57 | $this->plugin->setResponse( $this->getErrorResponse(404, JText::_( 'PLG_API_EASYBLOG_CATEGORY_NOT_FOUND_MESSAGE' )) );
58 | return;
59 | }
60 |
61 | $catIds = array();
62 | $catIds[] = $category->id;
63 | EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
64 |
65 | $sorting = $this->plugin->params->get( 'sorting' , 'latest' );
66 | $rows = $model->getBlogsBy( 'category' , $catIds , $sorting , 0, EBLOG_FILTER_PUBLISHED, $search );
67 |
68 | foreach ($rows as $k => $v) {
69 |
70 | $scm_obj = new EasyBlogSimpleSchema_4();
71 | $item = $scm_obj->mapPost($v, '', 100, array('text'));
72 |
73 | //$item = EasyBlogHelper::getHelper( 'SimpleSchema' )->mapPost($v, '', 100, array('text'));
74 | $item->isowner = ( $v->created_by == $this->plugin->get('user')->id )?true:false;
75 |
76 | if($v->blogpassword!='')
77 | {
78 | $item->ispassword=true;
79 | }
80 | else
81 | {
82 | $item->ispassword=false;
83 | }
84 | $item->blogpassword=$v->blogpassword;
85 | $model = EasyBlogHelper::getModel( 'Ratings' );
86 | $ratingValue = $model->getRatingValues( $item->postid, 'entry');
87 | $item->rate = $ratingValue;
88 | $item->isVoted = $model->hasVoted($item->postid,'entry',$this->plugin->get('user')->id);
89 | if($item->rate->ratings==0)
90 | {
91 | $item->rate->ratings=-2;
92 | }
93 |
94 | $posts[] = $item;
95 | }
96 | $posts = array_slice($posts, $limitstart,$limit);
97 | $this->plugin->setResponse( $posts );
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/easyblog/easyblog4/easyblog_users.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 | jimport('joomla.html.html');
13 | jimport('joomla.application.component.controller');
14 | jimport('joomla.application.component.model');
15 | jimport('joomla.user.helper');
16 | jimport('joomla.user.user');
17 | jimport('joomla.application.component.helper');
18 | jimport( 'simpleschema.easyblog.blog.post' );
19 | jimport( 'simpleschema.easyblog.category' );
20 | jimport( 'simpleschema.easyblog.person' );
21 |
22 | JModelLegacy::addIncludePath(JPATH_SITE.'components/com_api/models');
23 | require_once JPATH_SITE.'/components/com_easyblog/models/users.php';
24 | require_once JPATH_SITE.'/components/com_easyblog/models/blogger.php';
25 | require_once JPATH_SITE.'/components/com_easyblog/helpers/helper.php';
26 | //~ require_once JPATH_SITE.'/plugins/api/easyblog/libraries/simpleschema/bloggers.php';
27 |
28 | class EasyblogApiResourceEasyblog_users extends ApiResource
29 | {
30 | public function get()
31 | {
32 | $this->plugin->setResponse($this->getEasyBlog_user());
33 | }
34 | public function post()
35 | {
36 | $this->plugin->setResponse();
37 | }
38 | public function getEasyBlog_user()
39 | {
40 | $app = JFactory::getApplication();
41 | $limitstart = $app->input->get('limitstart',0,'INT');
42 | $limit = $app->input->get('limit',0,'INT');
43 | $search = $app->input->get('search','','STRING');
44 | $ob1 = new EasyBlogModelBlogger();
45 | $ob1->setState('limitstart',$limitstart);
46 | //$bloggers = $ob1->getAllBloggers('latest',$limit, $filter='showallblogger' , $search );
47 | $bloggers = $ob1->getBloggersWithPost('latest',$limit, $filter='showbloggerwithpost' , $search );
48 | $blogger = EasyBlogHelper::getTable( 'Profile', 'Table' );
49 | foreach( $bloggers as $usr )
50 | {
51 | $blogger->load($usr->id);
52 | //$avatar = $blogger->getAvatar();
53 | $usr->avatar = $blogger->getAvatar();
54 | }
55 |
56 | return $bloggers;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/easyblog/easyblog4/image.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 |
10 | jimport('joomla.user.user');
11 | require_once( EBLOG_CONTROLLERS . '/media.php' );
12 | require_once( EBLOG_HELPERS . '/date.php' );
13 | require_once( EBLOG_HELPERS . '/string.php' );
14 | require_once( EBLOG_CLASSES . '/adsense.php' );
15 |
16 | //for image upload
17 | require_once( EBLOG_CLASSES . '/mediamanager.php' );
18 | require_once( EBLOG_HELPERS . '/image.php' );
19 | require_once( EBLOG_CLASSES . '/easysimpleimage.php' );
20 | require_once( EBLOG_CLASSES . '/mediamanager/local.php' );
21 | require_once( EBLOG_CLASSES . '/mediamanager/types/image.php' );
22 |
23 | class EasyblogApiResourceImage extends ApiResource
24 | {
25 |
26 | public function __construct( &$ubject, $config = array()) {
27 | parent::__construct( $ubject, $config = array() );
28 | }
29 |
30 | public function post()
31 | {
32 | //old code
33 | /*$controller = new EasyBlogControllerMedia;
34 | $op = $controller->upload();
35 | */
36 |
37 | $input = JFactory::getApplication()->input;
38 | $log_user = $this->plugin->get('user')->id;
39 | $res = new stdClass;
40 | // Let's get the path for the current request.
41 | $file = JRequest::getVar( 'file' , '' , 'FILES' , 'array' );
42 |
43 | if($file['name'])
44 | {
45 | $place = 'user:'.$this->plugin->get('user')->id;
46 |
47 | // The user might be from a subfolder?
48 | $source = urldecode('/'.$file['name']);
49 |
50 | // @task: Let's find the exact path first as there could be 3 possibilities here.
51 | // 1. Shared folder
52 | // 2. User folder
53 | $absolutePath = EasyBlogMediaManager::getAbsolutePath( $source , $place );
54 | $absoluteURI = EasyBlogMediaManager::getAbsoluteURI( $source , $place );
55 |
56 | $allowed = EasyImageHelper::canUploadFile( $file , $message );
57 |
58 | if( $allowed !== true )
59 | {
60 | $res->status= 0;
61 | $res->message = JText::_( 'PLG_API_EASYBLOG_UPLOAD_DENIED_MESSAGE' );
62 | return $res;
63 | }
64 |
65 | $media = new EasyBlogMediaManager();
66 | $upload_result = $media->upload( $absolutePath , $absoluteURI , $file , $source , $place );
67 |
68 | //adjustment
69 | $upload_result->key = $place.$source;
70 | $upload_result->group = 'files';
71 | $upload_result->parentKey = $place.'|/';
72 | $upload_result->friendlyPath = 'My Media/'.$source;
73 | unset($upload_result->variations);
74 | $this->plugin->setResponse($upload_result);
75 |
76 | return $upload_result;
77 |
78 | }
79 | else
80 | {
81 | $this->plugin->setResponse( $this->getErrorResponse(404, __FUNCTION__ . JText::_( 'PLG_API_EASYBLOG_UPLOAD_UNSUCCESSFULL' ) ) );
82 | }
83 | }
84 |
85 | public function get() {
86 | $this->plugin->setResponse( $this->getErrorResponse(404, __FUNCTION__ . JText::_( 'PLG_API_EASYBLOG_NOT_SUPPORTED' ) ) );
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/easyblog/easyblog4/latest.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 | jimport('joomla.user.user');
10 | jimport( 'simpleschema.easyblog.category' );
11 | jimport( 'simpleschema.easyblog.person' );
12 | jimport( 'simpleschema.easyblog.blog.post' );
13 |
14 | require_once( EBLOG_HELPERS . '/date.php' );
15 | require_once( EBLOG_HELPERS . '/string.php' );
16 | require_once( EBLOG_CLASSES . '/adsense.php' );
17 |
18 | class EasyblogApiResourceLatest extends ApiResource
19 | {
20 |
21 | public function __construct( &$ubject, $config = array()) {
22 | parent::__construct( $ubject, $config = array() );
23 |
24 | }
25 |
26 | public function get() {
27 |
28 | $input = JFactory::getApplication()->input;
29 | $model = EasyBlogHelper::getModel( 'Blog' );
30 | $id = $input->get('id', null, 'INT');
31 | $search = $input->get('search', null, 'STRING');
32 | $featured = $input->get('featured',0,'INT');
33 | $tags = $input->get('tags',0,'INT');
34 | $limitstart = $input->get('limitstart',0,'INT');
35 | $limit = $input->get('limit',10,'INT');
36 | $user_id = $input->get('user_id',0,'INT');
37 | $posts = array();
38 | // If we have an id try to fetch the user
39 | $blog = EasyBlogHelper::getTable( 'Blog' );
40 | $blog->load( $id );
41 | $modelPT = EasyBlogHelper::getModel( 'PostTag' );
42 | //~ if ($id && !$tags) {
43 | //~ if(!$blog->id)
44 | //~ {
45 | //~ $this->plugin->setResponse( $this->getErrorResponse(404, 'Blog not found') );
46 | //~ return;
47 | //~ }
48 | //~ $this->plugin->setResponse( $blog );
49 | //~ }
50 | if($tags)
51 | {
52 | $rows = $model->getTaggedBlogs( $tags );
53 | }//for get featured blog
54 | else if($featured)
55 | {
56 | $rows = $this->getfeature_Blog();
57 | $sorting = $this->plugin->params->get( 'sorting' , 'featured' );
58 | }//for get users blog
59 | else if($user_id)
60 | { $blogs = EasyBlogHelper::getModel( 'Blog' );
61 | $rows = $blogs->getBlogsBy('blogger', $user_id, 'latest');
62 | }
63 | else
64 | { //to get latest blog
65 | $sorting = $this->plugin->params->get( 'sorting' , 'latest' );
66 | $rows = $model->getBlogsBy( $sorting , '' , $sorting , 0, EBLOG_FILTER_PUBLISHED, $search );
67 | }
68 | //data mapping
69 | foreach ($rows as $k => $v)
70 | {
71 | $scm_obj = new EasyBlogSimpleSchema_4();
72 | $item = $scm_obj->mapPost($v,'', 100, array('text'));
73 | $item->tags = $modelPT->getBlogTags($item->postid);
74 | $item->isowner = ( $v->created_by == $this->plugin->get('user')->id )?true:false;
75 |
76 | if($v->blogpassword!='')
77 | {
78 | $item->ispassword=true;
79 | }
80 | else
81 | {
82 | $item->ispassword=false;
83 | }
84 |
85 | $item->blogpassword=$v->blogpassword;
86 |
87 | $model = EasyBlogHelper::getModel( 'Ratings' );
88 | $ratingValue = $model->getRatingValues( $item->postid, 'entry');
89 | $item->rate = $ratingValue;
90 | $item->isVoted = $model->hasVoted($item->postid,'entry',$this->plugin->get('user')->id);
91 | if($item->rate->ratings==0)
92 | {
93 | $item->rate->ratings=-2;
94 | }
95 |
96 | $posts[] = $item;
97 | }
98 | $posts = array_slice($posts, $limitstart,$limit);
99 | $this->plugin->setResponse( $posts );
100 | }
101 | // get feature blog function.
102 | public function getfeature_Blog()
103 | {
104 | $app = JFactory::getApplication();
105 | $limit = $app->input->get('limit',10,'INT');
106 | $categories = $app->input->get('categories','','STRING');
107 | $blogss = new EasyBlogModelBlog();
108 | $blogss->setState('limit',$limit);
109 | $res = $blogss->getFeaturedBlog(array(),$limit);
110 | return $res;
111 | }
112 | public static function getName() {
113 |
114 | }
115 |
116 | public static function describe() {
117 |
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/easyblog/easyblog4/rating.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 | jimport('joomla.user.user');
10 | jimport( 'simpleschema.easyblog.category' );
11 | jimport( 'simpleschema.easyblog.person' );
12 | jimport( 'simpleschema.easyblog.blog.post' );
13 | require_once( EBLOG_HELPERS . '/date.php' );
14 | require_once( EBLOG_HELPERS . '/string.php' );
15 | require_once( EBLOG_CLASSES . '/adsense.php' );
16 | //for image upload
17 | require_once( EBLOG_CLASSES . '/mediamanager.php' );
18 | require_once( EBLOG_HELPERS . '/image.php' );
19 | require_once( EBLOG_CLASSES . '/easysimpleimage.php' );
20 | require_once( EBLOG_CLASSES . '/mediamanager/local.php' );
21 | require_once( EBLOG_CLASSES . '/mediamanager/types/image.php' );
22 | class EasyblogApiResourceRating extends ApiResource
23 | {
24 | public function post()
25 | {
26 | $this->plugin->setResponse($this->setRatings());
27 | }
28 | public function setRatings()
29 | {
30 | $input = JFactory::getApplication()->input;
31 | $user_id = $input->get('uid',0,'INT');
32 | $blog_id = $input->get('blogid',0,'INT');
33 | $values = $input->get('values',0,'INT');
34 | $model = EasyBlogHelper::getTable( 'Ratings' );
35 | $model->uid = $blog_id;
36 | $model->created_by = $user_id;
37 | $model->value = $values;
38 | $model->type = 'entry';
39 | $model->fill($user_id,$blog_id,'entry');
40 | $ratingValue = $model->store();
41 | return $ratingValue;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/easyblog/easyblog4/tags.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 | jimport('joomla.user.user');
10 | jimport( 'simpleschema.easyblog.category' );
11 | jimport( 'simpleschema.easyblog.person' );
12 | jimport( 'simpleschema.easyblog.blog.post' );
13 | require_once( EBLOG_HELPERS . '/date.php' );
14 | require_once( EBLOG_HELPERS . '/string.php' );
15 | require_once( EBLOG_CLASSES . '/adsense.php' );
16 | //for image upload
17 | require_once( EBLOG_CLASSES . '/mediamanager.php' );
18 | require_once( EBLOG_HELPERS . '/image.php' );
19 | require_once( EBLOG_CLASSES . '/easysimpleimage.php' );
20 | require_once( EBLOG_CLASSES . '/mediamanager/local.php' );
21 | require_once( EBLOG_CLASSES . '/mediamanager/types/image.php' );
22 | class EasyblogApiResourceTags extends ApiResource
23 | {
24 | public function get()
25 | {
26 | $this->plugin->setResponse($this->getTags());
27 | }
28 | //method for search tags
29 | public function post()
30 | {
31 | $this->plugin->setResponse($this->searchTag());
32 | }
33 | //get tags
34 | public function getTags()
35 | {
36 | $app = JFactory::getApplication();
37 | $limitstart = $app->input->get('limitstart',0,'INT');
38 | $limit = $app->input->get('limit',20,'INT');
39 | $Tagmodel = EasyBlogHelper::getModel( 'Tags' );
40 | //$allTags = $Tagmodel->getTags();
41 | $allTags = $Tagmodel->getTagCloud();
42 | $allTags = array_slice($allTags, $limitstart, $limit);
43 | return $allTags;
44 | }
45 |
46 | public function searchTag()
47 | {
48 | $app = JFactory::getApplication();
49 | $limitstart = $app->input->get('limitstart',0,'INT');
50 | $limit = $app->input->get('limit',20,'INT');
51 | $Tagmodel = EasyBlogHelper::getModel( 'Tags' );
52 | $input = JFactory::getApplication()->input;
53 | $keyword = $input->get('title','', 'STRING');
54 | $wordSearch = true;
55 | $db = EB::db();
56 | $query = array();
57 | $search = $wordSearch ? '%' . $keyword . '%' : $keyword . '%';
58 | $query[] = 'SELECT * FROM ' . $db->quoteName('#__easyblog_tag');
59 | $query[] = 'WHERE ' . $db->quoteName('title') . ' LIKE ' . $db->Quote($search);
60 | $query[] = 'AND ' . $db->quoteName('published') . '=' . $db->Quote(1);
61 |
62 | $query = implode(' ', $query);
63 | $db->setQuery($query);
64 | $result = $db->loadObjectList();
65 | $output = array_slice($result, $limitstart, $limit);
66 | return $output;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/easyblog/easyblog5/category.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 |
10 | jimport('joomla.user.user');
11 | jimport( 'simpleschema.easyblog.category' );
12 | jimport( 'simpleschema.easyblog.person' );
13 | jimport( 'simpleschema.easyblog.blog.post' );
14 | /*
15 | require_once( EBLOG_HELPERS . '/date.php' );
16 | require_once( EBLOG_HELPERS . '/string.php' );
17 | require_once( EBLOG_CLASSES . '/adsense.php' );
18 | */
19 |
20 | class EasyblogApiResourceCategory extends ApiResource
21 | {
22 |
23 | public function __construct( &$ubject, $config = array()) {
24 | parent::__construct( $ubject, $config = array() );
25 | }
26 |
27 | public function get() {
28 | $input = JFactory::getApplication()->input;
29 | $model = EasyBlogHelper::getModel( 'Blog' );
30 | $category = EasyBlogHelper::table( 'Category', 'Table' );
31 | $id = $input->get('id', null, 'INT');
32 | $search = $input->get('search', null, 'STRING');
33 |
34 | $limitstart = $input->get('limitstart', 0, 'INT');
35 | $limit = $input->get('limit', 10, 'INT');
36 |
37 | $posts = array();
38 |
39 |
40 | if (!isset($id)) {
41 | $categoriesmodel = EasyBlogHelper::getModel( 'Categories' );
42 | $categories = $categoriesmodel->getCategoryTree('ordering');
43 |
44 | $categories = array_slice($categories,$limitstart,$limit);
45 |
46 | $this->plugin->setResponse( $categories );
47 | return;
48 | }
49 |
50 | $category->load($id);
51 |
52 | // private category shouldn't allow to access.
53 | $privacy = $category->checkPrivacy();
54 |
55 | if(!$category->id || ! $privacy->allowed )
56 | {
57 | $this->plugin->setResponse( $this->getErrorResponse(404, JText::_( 'PLG_API_EASYBLOG_CATEGORY_NOT_FOUND_MESSAGE' )) );
58 | return;
59 | }
60 |
61 | //new code
62 | $category = EB::table('Category');
63 | $category->load($id);
64 |
65 | //get the nested categories
66 | $category->childs = null;
67 | // Build nested childsets
68 | EB::buildNestedCategories($category->id, $category, false, true);
69 |
70 | $catIds = array();
71 | $catIds[] = $category->id;
72 |
73 | EB::accessNestedCategoriesId($category, $catIds);
74 | // Get the category model
75 | $model = EB::model('Category');
76 |
77 | // Get total posts in this category
78 | $category->cnt = $model->getTotalPostCount($category->id);
79 |
80 | // Get teamblog posts count
81 | // $teamBlogCount = $model->getTeamBlogCount($category->id);
82 |
83 | //$limit = EB::call('Pagination', 'getLimit', array(EBLOG_PAGINATION_CATEGORIES));
84 |
85 | // Get the posts in the category
86 | $data = $model->getPosts($catIds);
87 | $rows = EB::formatter('list', $data);
88 |
89 | $rows = array_slice($rows,$limitstart,$limit);
90 | //end
91 |
92 | foreach ($rows as $k => $v) {
93 | //$item = EasyBlogHelper::getHelper( 'SimpleSchema' )->mapPost($v, '', 100, array('text'));
94 | $scm_obj = new EasyBlogSimpleSchema_plg();
95 | $item = $scm_obj->mapPost($v,'', 100, array('text'));
96 |
97 | $item->isowner = ( $v->created_by == $this->plugin->get('user')->id )?true:false;
98 |
99 | if($v->blogpassword!='')
100 | {
101 | $item->ispassword=true;
102 | }
103 | else
104 | {
105 | $item->ispassword=false;
106 | }
107 | $item->blogpassword=$v->blogpassword;
108 | $model = EasyBlogHelper::getModel( 'Ratings' );
109 | $ratingValue = $model->getRatingValues( $item->postid, 'entry');
110 | $item->rate = $ratingValue;
111 | $item->isVoted = $model->hasVoted($item->postid,'entry',$this->plugin->get('user')->id);
112 |
113 | if($item->rate->ratings==0)
114 | {
115 | $item->rate->ratings=-2;
116 | }
117 |
118 | $posts[] = $item;
119 | }
120 |
121 | $this->plugin->setResponse( $posts );
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/easyblog/easyblog5/easyblog_users.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 | jimport('joomla.html.html');
13 | jimport('joomla.application.component.controller');
14 | jimport('joomla.application.component.model');
15 | jimport('joomla.user.helper');
16 | jimport('joomla.user.user');
17 | jimport('joomla.application.component.helper');
18 | jimport( 'simpleschema.easyblog.blog.post' );
19 | jimport( 'simpleschema.easyblog.category' );
20 | jimport( 'simpleschema.easyblog.person' );
21 |
22 | JModelLegacy::addIncludePath(JPATH_SITE.'components/com_api/models');
23 | require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/models/users.php';
24 | require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/models/blogger.php';
25 |
26 | class EasyblogApiResourceEasyblog_users extends ApiResource
27 | {
28 | public function get()
29 | {
30 | $this->plugin->setResponse($this->getEasyBlog_user());
31 | }
32 | public function post()
33 | {
34 | $this->plugin->setResponse();
35 | }
36 | public function getEasyBlog_user()
37 | {
38 | $app = JFactory::getApplication();
39 | $limitstart = $app->input->get('limitstart',0,'INT');
40 | $limit = $app->input->get('limit',0,'INT');
41 | $search = $app->input->get('search','','STRING');
42 | $ob1 = new EasyBlogModelBlogger();
43 | $ob1->setState('limitstart',$limitstart);
44 | //$bloggers = $ob1->getAllBloggers('latest',$limit, $filter='showallblogger' , $search );
45 | $bloggers = $ob1->getBloggers('latest',$limit, $filter='showbloggerwithpost' , $search );
46 | $blogger = EasyBlogHelper::table( 'Profile' );
47 | foreach( $bloggers as $usr )
48 | {
49 | $blogger->load($usr->id);
50 | //$avatar = $blogger->getAvatar();
51 | $usr->avatar = $blogger->getAvatar();
52 | }
53 |
54 | return $bloggers;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/easyblog/easyblog5/image.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 |
10 | error_reporting(E_ERROR | E_PARSE);
11 |
12 | jimport('joomla.user.user');
13 | /*
14 | require_once( EBLOG_CONTROLLERS . '/media.php' );
15 | require_once( EBLOG_HELPERS . '/date.php' );
16 | require_once( EBLOG_HELPERS . '/string.php' );
17 | require_once( EBLOG_CLASSES . '/adsense.php' );
18 |
19 | //for image upload
20 | require_once( EBLOG_CLASSES . '/mediamanager.php' );
21 | require_once( EBLOG_HELPERS . '/image.php' );
22 | require_once( EBLOG_CLASSES . '/easysimpleimage.php' );
23 | require_once( EBLOG_CLASSES . '/mediamanager/local.php' );
24 | require_once( EBLOG_CLASSES . '/mediamanager/types/image.php' );*/
25 |
26 | //for image upload
27 | require_once( EBLOG_ADMIN_INCLUDES . '/mediamanager/mediamanager.php' );
28 | //require_once( EBLOG_HELPERS . '/image.php' );
29 | require_once( EBLOG_ADMIN_INCLUDES . '/image/image.php' );
30 | require_once( EBLOG_ADMIN_INCLUDES . '/blogimage/blogimage.php' );
31 | require_once( EBLOG_ADMIN_INCLUDES . '/mediamanager/adapters/local.php' );
32 | require_once( EBLOG_ADMIN_INCLUDES . '/mediamanager/adapters/post.php' );
33 | require_once( EBLOG_ADMIN_INCLUDES . '/mediamanager/adapters/posts.php' );
34 | require_once( EBLOG_ADMIN_INCLUDES . '/mediamanager/adapters/abstract.php' );
35 | //require_once( EBLOG_ADMIN_INCLUDES . '/mediamanager/adapters/types/image.php' );
36 |
37 | class EasyblogApiResourceImage extends ApiResource
38 | {
39 |
40 | public function __construct( &$ubject, $config = array()) {
41 | parent::__construct( $ubject, $config = array() );
42 | }
43 |
44 | public function post()
45 | {
46 | //old code
47 | /*$controller = new EasyBlogControllerMedia;
48 | $op = $controller->upload();
49 | */
50 |
51 | $input = JFactory::getApplication()->input;
52 | $log_user = $this->plugin->get('user')->id;
53 | $res = new stdClass;
54 | // Let's get the path for the current request.
55 | $file = JRequest::getVar( 'file' , '' , 'FILES' , 'array' );
56 |
57 |
58 | if($file['name'])
59 | {
60 | $post = EB::post(NULL);
61 | $post->create();
62 | $key = $post->id;
63 | $key = $key + 1;
64 | $place = 'post:'.$key;
65 | $key = null;
66 |
67 | // The user might be from a subfolder?
68 | $source = urldecode('/'.$file['name']);
69 |
70 | // @task: Let's find the exact path first as there could be 3 possibilities here.
71 | // 1. Shared folder
72 | // 2. User folder
73 | //$absolutePath = EasyBlogMediaManager::getAbsolutePath( $source , $place );
74 | //$absoluteURI = EasyBlogMediaManager::getAbsoluteURI( $source , $place );
75 |
76 | //$absolutePath = EasyBlogMediaManager::getPath( $source );
77 | //$absoluteURI = EasyBlogMediaManager::getUrl( $source );
78 |
79 | $allowed = EasyBlogImage::canUploadFile( $file , $message );
80 |
81 | if( $allowed !== true )
82 | {
83 | $res->status= 0;
84 | $res->message = JText::_( 'PLG_API_EASYBLOG_UPLOAD_DENIED_MESSAGE' );
85 | return $res;
86 | }
87 |
88 | $media = new EasyBlogMediaManager();
89 | //$upload_result = $media->upload( $absolutePath , $absoluteURI , $file , $source , $place );
90 | $upload_result = $media->upload( $file ,$place );
91 |
92 | //adjustment
93 | $upload_result->key = $place.$source;
94 | $upload_result->group = 'files';
95 | $upload_result->parentKey = $place.'|/';
96 | $upload_result->friendlyPath = 'My Media/'.$source;
97 | unset($upload_result->variations);
98 |
99 | $this->plugin->setResponse($upload_result);
100 |
101 | return $upload_result;
102 |
103 | }
104 | else
105 | {
106 | $this->plugin->setResponse( $this->getErrorResponse(404, __FUNCTION__ . JText::_( 'PLG_API_EASYBLOG_UPLOAD_UNSUCCESSFULL' ) ) );
107 | }
108 | }
109 |
110 | public function get() {
111 | $this->plugin->setResponse( $this->getErrorResponse(404, __FUNCTION__ . JText::_( 'PLG_API_EASYBLOG_NOT_SUPPORTED' ) ) );
112 | }
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/easyblog/easyblog5/latest.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 | jimport('joomla.user.user');
10 | jimport( 'simpleschema.easyblog.category' );
11 | jimport( 'simpleschema.easyblog.person' );
12 | jimport( 'simpleschema.easyblog.blog.post' );
13 | /*
14 | require_once( EBLOG_HELPERS . '/date.php' );
15 | require_once( EBLOG_HELPERS . '/string.php' );
16 | require_once( EBLOG_CLASSES . '/adsense.php' );
17 | */
18 | require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/date/date.php' );
19 | require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/string/string.php' );
20 | require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/adsense/adsense.php' );
21 | require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/formatter/formatter.php' );
22 |
23 |
24 | class EasyblogApiResourceLatest extends ApiResource
25 | {
26 |
27 | public function __construct( &$ubject, $config = array()) {
28 | parent::__construct( $ubject, $config = array() );
29 |
30 | }
31 |
32 | public function get() {
33 |
34 | $input = JFactory::getApplication()->input;
35 | $model = EasyBlogHelper::getModel( 'Blog' );
36 |
37 | //$id = $input->get('id', null, 'INT');
38 | $id = 0;
39 | $search = $input->get('search', '', 'STRING');
40 | $featured = $input->get('featured',0,'INT');
41 | $tags = $input->get('tags',0,'INT');
42 | $user_id = $input->get('user_id',0,'INT');
43 | $limitstart = $input->get('limitstart',0,'INT');
44 | $limit = $input->get('limit',10,'INT');
45 | $posts = array();
46 | // If we have an id try to fetch the user
47 | $blog = EasyBlogHelper::table( 'Blog' );
48 | $blog->load( $id );
49 | $modelPT = EasyBlogHelper::getModel( 'PostTag' );
50 |
51 | if($tags)
52 | {
53 | $rows = $model->getTaggedBlogs( $tags );
54 | }//for get featured blog
55 | else if($featured)
56 | {
57 | $rows = $this->getfeature_Blog();
58 | $sorting = $this->plugin->params->get( 'sorting' , 'featured' );
59 | }//for get users blog
60 | else if($user_id)
61 | { $blogs = EasyBlogHelper::getModel( 'Blog' );
62 | $rows = $blogs->getBlogsBy('blogger', $user_id, 'latest');
63 | }
64 | else
65 | { //to get latest blog
66 | //$sorting = $this->plugin->params->get( 'sorting' , 'latest' );
67 | //$rows = $model->getBlogsBy( $sorting , '' , $sorting , 0, EBLOG_FILTER_PUBLISHED, $search );
68 | $rows = $model->getBlogsBy('', '', 'latest', 0, EBLOG_FILTER_PUBLISHED, $search, true, array(), false, false, true, '', '', null, 'listlength', false);
69 | //$rows = EB::formatter('list', $rows, false);
70 | }
71 | $rows = EB::formatter('list', $rows, false);
72 | //data mapping
73 | foreach ($rows as $k => $v)
74 | {
75 | //$item = EB::helper( 'simpleschema' )->mapPost($v,'', 100, array('text'));
76 | $scm_obj = new EasyBlogSimpleSchema_plg();
77 | $item = $scm_obj->mapPost($v,'', 100, array('text'));
78 |
79 | $item->tags = $modelPT->getBlogTags($item->postid);
80 | $item->isowner = ( $v->created_by == $this->plugin->get('user')->id )?true:false;
81 |
82 | if($v->blogpassword != '')
83 | {
84 | $item->ispassword = true;
85 | }
86 | else
87 | {
88 | $item->ispassword = false;
89 | }
90 |
91 | $item->blogpassword = $v->blogpassword;
92 | $model = EasyBlogHelper::getModel( 'Ratings' );
93 | $ratingValue = $model->getRatingValues( $item->postid, 'entry');
94 | $item->rate = $ratingValue;
95 | $item->isVoted = $model->hasVoted($item->postid,'entry',$this->plugin->get('user')->id);
96 | if($item->rate->ratings==0)
97 | {
98 | $item->rate->ratings=-2;
99 | }
100 |
101 | $posts[] = $item;
102 | }
103 | $posts = array_slice($posts, $limitstart,$limit);
104 | $this->plugin->setResponse( $posts );
105 | }
106 | // get feature blog function.
107 | public function getfeature_Blog()
108 | {
109 | $app = JFactory::getApplication();
110 | $limit = $app->input->get('limit',10,'INT');
111 | $categories = $app->input->get('categories','','STRING');
112 | $blogss = new EasyBlogModelBlog();
113 | $blogss->setState('limit',$limit);
114 | $res = $blogss->getFeaturedBlog(array(),$limit);
115 | return $res;
116 | }
117 | public static function getName() {
118 |
119 | }
120 |
121 | public static function describe() {
122 |
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/easyblog/easyblog5/rating.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 | jimport('joomla.user.user');
10 | jimport( 'simpleschema.easyblog.category' );
11 | jimport( 'simpleschema.easyblog.person' );
12 | jimport( 'simpleschema.easyblog.blog.post' );
13 |
14 | /*
15 | require_once( EBLOG_HELPERS . '/date.php' );
16 | require_once( EBLOG_HELPERS . '/string.php' );
17 | require_once( EBLOG_CLASSES . '/adsense.php' );
18 | //for image upload
19 | require_once( EBLOG_CLASSES . '/mediamanager.php' );
20 | require_once( EBLOG_HELPERS . '/image.php' );
21 | require_once( EBLOG_CLASSES . '/easysimpleimage.php' );
22 | require_once( EBLOG_CLASSES . '/mediamanager/local.php' );
23 | require_once( EBLOG_CLASSES . '/mediamanager/types/image.php' );
24 | */
25 | class EasyblogApiResourceRating extends ApiResource
26 | {
27 | public function post()
28 | {
29 | $this->plugin->setResponse($this->setRatings());
30 | }
31 | public function setRatings()
32 | {
33 | $input = JFactory::getApplication()->input;
34 | $user_id = $input->get('uid',0,'INT');
35 | $blog_id = $input->get('blogid',0,'INT');
36 | $values = $input->get('values',0,'INT');
37 | $model = EasyBlogHelper::table( 'Ratings' );
38 | $model->uid = $blog_id;
39 | $model->created_by = $user_id;
40 | $model->value = $values;
41 | $model->type = 'entry';
42 | //$model->fill($user_id,$blog_id,'entry');
43 | $ratingValue = $model->store();
44 | return $ratingValue;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/easyblog/easyblog5/report.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.user.user');
12 | jimport( 'simpleschema.category' );
13 | jimport( 'simpleschema.person' );
14 | jimport( 'simpleschema.blog.post' );
15 |
16 |
17 | class EasyblogApiResourceReport extends ApiResource
18 | {
19 | public function get()
20 | {
21 | $this->plugin->setResponse(JText::_( 'PLG_API_EASYBLOG_USE_METHOD_POST' ));
22 | }
23 | public function post()
24 | {
25 | $this->plugin->setResponse($this->reportBlog());
26 | }
27 | public function reportBlog()
28 | {
29 | $app = JFactory::getApplication();
30 | // Get the composite keys
31 | $log_user = $this->plugin->get('user')->id;
32 | $id = $app->input->get('id', 0, 'int');
33 | $type = $app->input->get('type', '', 'POST');
34 | $reason = $app->input->get('reason', '', 'STRING');
35 | if (!$reason) {
36 | $message= JText::_( 'PLG_API_EASYBLOG_REASON_EMPTY' );
37 | $final_result['message'] = $message;
38 | $final_result['status'] = false;
39 | return $final_result;
40 | }
41 | $report = EB::table('Report');
42 | $report->obj_id = $id;
43 | $report->obj_type = $type;
44 | $report->reason = $reason;
45 | $report->created = EB::date()->toSql();
46 | $report->created_by = $log_user;
47 | $state = $report->store();
48 | if (!$state) {
49 | $message= JText::_( 'PLG_API_EASYBLOG_CANT_STORE_REPORT' );
50 | $final_result['message'] = $message;
51 | $final_result['status'] = false;
52 | return $final_result;
53 | }
54 | // Notify the site admin when there's a new report made
55 | $post = EB::post($id);
56 | $report->notify($post);
57 | $final_result['message'] = JText::_( 'PLG_API_EASYBLOG_REPORT_LOGGED_SUCCESS' );
58 | $final_result['status'] = true;
59 | return $final_result;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/easyblog/easyblog5/tags.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 | jimport('joomla.user.user');
10 | jimport( 'simpleschema.easyblog.category' );
11 | jimport( 'simpleschema.easyblog.person' );
12 | jimport( 'simpleschema.easyblog.blog.post' );
13 | /*
14 | require_once( EBLOG_HELPERS . '/date.php' );
15 | require_once( EBLOG_HELPERS . '/string.php' );
16 | require_once( EBLOG_CLASSES . '/adsense.php' );
17 | //for image upload
18 | require_once( EBLOG_CLASSES . '/mediamanager.php' );
19 | require_once( EBLOG_HELPERS . '/image.php' );
20 | require_once( EBLOG_CLASSES . '/easysimpleimage.php' );
21 | require_once( EBLOG_CLASSES . '/mediamanager/local.php' );
22 | require_once( EBLOG_CLASSES . '/mediamanager/types/image.php' );
23 | */
24 | class EasyblogApiResourceTags extends ApiResource
25 | {
26 | public function get()
27 | {
28 | $this->plugin->setResponse($this->getTags());
29 | }
30 | //method for search tags
31 | public function post()
32 | {
33 | $this->plugin->setResponse($this->searchTag());
34 | }
35 | //get tags
36 | public function getTags()
37 | {
38 | $app = JFactory::getApplication();
39 | $limitstart = $app->input->get('limitstart',0,'INT');
40 | $limit = $app->input->get('limit',20,'INT');
41 | $Tagmodel = EasyBlogHelper::getModel( 'Tags' );
42 | $input = JFactory::getApplication()->input;
43 | $keyword = $input->get('title','', 'STRING');
44 | //check EB config for this
45 | $wordSearch = true;
46 |
47 | $res = new stdClass;
48 |
49 | $Tagmodel = EasyBlogHelper::getModel( 'Tags' );
50 | //$allTags = $Tagmodel->getTagCloud();
51 | $res->count = $Tagmodel->getTotalTags();
52 | if(!empty($keyword))
53 | {
54 | $allTags = $Tagmodel->search($keyword,$wordSearch);
55 | }
56 | else
57 | {
58 | $allTags = $Tagmodel->getTagCloud('', $order='title', $sort='asc', $checkAccess = false);
59 | }
60 |
61 | $allTags = array_slice($allTags, $limitstart, $limit);
62 | //if need count uncomment this
63 | //$res->data = $allTags;
64 | return $allTags;
65 | }
66 |
67 | /*public function searchTag()
68 | {
69 | $app = JFactory::getApplication();
70 | $limitstart = $app->input->get('limitstart',0,'INT');
71 | $limit = $app->input->get('limit',20,'INT');
72 | $Tagmodel = EasyBlogHelper::getModel( 'Tags' );
73 | $input = JFactory::getApplication()->input;
74 | $keyword = $input->get('title','', 'STRING');
75 | $wordSearch = true;
76 | $db = EB::db();
77 | $query = array();
78 | $search = $wordSearch ? '%' . $keyword . '%' : $keyword . '%';
79 | $query[] = 'SELECT * FROM ' . $db->quoteName('#__easyblog_tag');
80 | $query[] = 'WHERE ' . $db->quoteName('title') . ' LIKE ' . $db->Quote($search);
81 | $query[] = 'AND ' . $db->quoteName('published') . '=' . $db->Quote(1);
82 |
83 | $query = implode(' ', $query);
84 | $db->setQuery($query);
85 | $result = $db->loadObjectList();
86 |
87 | $output = array_slice($result, $limitstart, $limit);
88 | return $output;
89 | }*/
90 | }
91 |
--------------------------------------------------------------------------------
/easyblog/language/en-GB/en-GB.plg_api_easyblog.ini:
--------------------------------------------------------------------------------
1 | PLG_API_EASYBLOG="Easyblog APIs"
2 | PLG_API_EASYBLOG_DESCRIPTION="Easyblog APIs"
3 | PLG_API_EASYBLOG_DELETE_MESSAGE="Blog deleted successfully"
4 | PLG_API_EASYBLOG_BLOG_ID_MESSAGE="Blog id cannot be kept blank"
5 | PLG_API_EASYBLOG_BLOG_NOT_FOUND_MESSAGE="Blog not found"
6 | PLG_API_EASYBLOG_BLOG_NOT_EXISTS_MESSAGE="Blog does not exist"
7 | PLG_API_EASYBLOG_CATEGORY_NOT_FOUND_MESSAGE="Category not found"
8 | PLG_API_EASYBLOG_INVALID_BLOG="Invalid Blog"
9 | PLG_API_EASYBLOG_COMMENT_PROBLEM_MESSAGE="There was a problem saving the comment"
10 | PLG_API_EASYBLOG_UPLOAD_DENIED_MESSAGE="Upload is not allowed"
11 | PLG_API_EASYBLOG_SUBSCRIPTION_SUCCESS="You have been subscribed successfully"
12 | PLG_API_EASYBLOG_ALREADY_SUBSCRIBED="You are already subscribed for this blog"
13 | PLG_API_EASYBLOG_UPLOAD_UNSUCCESSFULL="Uploading unsuccessful"
14 | PLG_API_EASYBLOG_NOT_SUPPORTED="not supported"
15 |
16 | PLG_API_EASYBLOG_COMMENT="Comment"
17 | PLG_API_EASYBLOG_TITLE="Title"
18 | PLG_API_EASYBLOG_ESUSERNAME="esusername"
19 | PLG_API_EASYBLOG_ESNAME="esname"
20 | PLG_API_EASYBLOG_ESEMAIL="esemail"
21 | PLG_API_EASYBLOG_ENTRY="entry"
22 | PLG_API_EASYBLOG_USE_METHOD_POST="Use method post"
23 | PLG_API_EASYBLOG_REASON_EMPTY="Reason is empty"
24 | PLG_API_EASYBLOG_CANT_STORE_REPORT="Cannot store your report"
25 | PLG_API_EASYBLOG_REPORT_LOGGED_SUCCESS="Report logged successfully"
26 |
--------------------------------------------------------------------------------
/easyblog/language/en-GB/en-GB.plg_api_easyblog.sys.ini:
--------------------------------------------------------------------------------
1 | PLG_API_EASYBLOG="Easyblog APIs"
2 | PLG_API_EASYBLOG_DESCRIPTION="Easyblog APIs"
3 |
--------------------------------------------------------------------------------
/easyblog/libraries/simpleschema/blog/comment.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | class CommentSimpleSchema {
9 |
10 | public $commentid;
11 |
12 | public $postid;
13 |
14 | public $title;
15 |
16 | public $text;
17 |
18 | public $textplain;
19 |
20 | public $created_date;
21 |
22 | public $updated_date;
23 |
24 | public $created_date_elapsed;
25 |
26 | public $author;
27 |
28 | public function __construct() {
29 | $this->author = new PersonSimpleSchema;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/easyblog/libraries/simpleschema/blog/post.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | jimport('simpleschema.easyblog.person');
9 | jimport('simpleschema.easyblog.category');
10 |
11 | class PostSimpleSchema {
12 |
13 | public $postid;
14 |
15 | public $title;
16 |
17 | public $text;
18 |
19 | public $textplain;
20 |
21 | public $image = array();
22 |
23 | public $created_date;
24 |
25 | public $created_date_elapsed;
26 |
27 | public $updated_date;
28 |
29 | public $author;
30 |
31 | public $comments;
32 |
33 | public $url;
34 |
35 | public $tags = array();
36 |
37 | public $rating;
38 |
39 | public $rate = array();
40 |
41 | public $category;
42 |
43 | public function __construct() {
44 | $this->author = new PersonSimpleSchema;
45 | $this->category = new CategorySimpleSchema;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/easyblog/libraries/simpleschema/category.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | class CategorySimpleSchema {
10 |
11 | public $categoryid;
12 |
13 | public $title;
14 |
15 | public $description;
16 |
17 | public $created_date;
18 |
19 | public $updated_date;
20 |
21 | public $scope;
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/easyblog/libraries/simpleschema/person.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | class PersonSimpleSchema {
10 |
11 | public $name;
12 |
13 | public $email;
14 |
15 | public $photo;
16 |
17 | public $website;
18 |
19 | public $bio;
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/easyblog/script.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | // No direct access to this file
10 | defined('_JEXEC') or die('Restricted access');
11 |
12 | //Script class
13 | class plgapieasyblogInstallerScript
14 | {
15 | public function postflight($type, $parent)
16 | {
17 | //If type is install
18 | if ($type == 'install')
19 | {
20 | //Move library file to Joomla libraries and delete it from plugin
21 | JFolder::move(JPATH_SITE.'/plugins/api/easyblog/libraries/simpleschema', JPATH_SITE.'/libraries/simpleschema');
22 | JFolder::delete(JPATH_SITE.'/plugins/api/easyblog/libraries');
23 |
24 | //Move helper file to easyblog helpers and delete it from plugin
25 | //JFile::move(JPATH_SITE.'/plugins/api/easyblog/components/com_easyblog/helpers/simpleschema.php', JPATH_SITE.'/components/com_easyblog/helpers/simpleschema.php');
26 | //JFolder::delete(JPATH_SITE.'/plugins/api/easyblog/components');
27 |
28 | $db = JFactory::getDbo();
29 | $query = $db->getQuery(true);
30 |
31 | $fields = array(
32 | $db->quoteName('enabled') . ' = ' . (int) 1,
33 | $db->quoteName('ordering') . ' = ' (int) 9999
34 | );
35 |
36 | $conditions = array(
37 | $db->quoteName('name') . ' = ' . $db->quote('Api - Easyblog'),
38 | $db->quoteName('type') . ' = ' . $db->quote('plugin')
39 | );
40 |
41 | $query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
42 |
43 | $db->setQuery($query);
44 | $db->execute();
45 | }
46 | return true;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/easysocial/easysocial.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 |
10 | jimport('joomla.plugin.plugin');
11 |
12 | // Added this line to EasySocial api compatible with EasySocial 2.1.0 package
13 | ES::import('site:/controllers/controller');
14 |
15 | /** plgAPIEasysocial
16 | *
17 | * @since 1.8.8
18 | */
19 | class PlgAPIEasysocial extends ApiPlugin
20 | {
21 | /** Construct
22 | *
23 | * @param int &$subject subject
24 | * @param int $config config
25 | */
26 | public function __construct(&$subject, $config = array())
27 | {
28 | parent::__construct($subject = 'api', $config = array());
29 |
30 | ApiResource::addIncludePath(dirname(__FILE__) . '/easysocial');
31 |
32 | /*load language file for plugin frontend*/
33 | $lang = JFactory::getLanguage();
34 | $lang->load('plg_api_easysocial', JPATH_ADMINISTRATOR, '', true);
35 | $lang->load('com_easysocial', JPATH_ADMINISTRATOR, '', true);
36 | $lang->load('com_easysocial', JPATH_SITE, '', true);
37 | $lang->load('com_users', JPATH_SITE, '', true);
38 | $this->setResourceAccess('terms', 'public', 'post');
39 | $this->setResourceAccess('sociallogin', 'public', 'post');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/easysocial/easysocial.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - Easysocial
4 | 2.2.0
5 | 1/03/2018
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | PLG_API_EASYSOCIAL_DESCRIPTION
12 |
13 |
14 | easysocial.php
15 | easysocial/friend.php
16 | libraries
17 | easysocial
18 |
19 |
20 |
21 | en-GB/en-GB.plg_api_easysocial.ini
22 | en-GB/en-GB.plg_api_easysocial.sys.ini
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | No
31 | Yes
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/easysocial/easysocial/block.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 | jimport('joomla.html.html');
13 |
14 | /** Block API
15 | *
16 | * @since 1.8.8
17 | */
18 | class EasysocialApiResourceBlock extends ApiResource
19 | {
20 | /** Get
21 | *
22 | * @return string Error Message
23 | */
24 | public function get()
25 | {
26 | $this->plugin->setResponse(JText::_('PLG_API_EASYSOCIAL_USE_POST_METHOD_MESSAGE'));
27 | }
28 |
29 | /** POST
30 | *
31 | * @return ApiPlugin response object
32 | */
33 | public function post()
34 | {
35 | $this->plugin->setResponse($this->processUser());
36 | }
37 |
38 | /** POST
39 | *
40 | * @return object
41 | */
42 | private function processUser()
43 | {
44 | $app = JFactory::getApplication();
45 | $reason = $app->input->get('reason', '', 'STRING');
46 | $target_id = $app->input->get('target_id', 0, 'INT');
47 | $block_this = $app->input->get('block', 0, 'INT');
48 |
49 | $res = ($block_this)?$this->block($target_id, $reason):$this->unblock($target_id);
50 |
51 | return $res;
52 | }
53 |
54 | /** POST
55 | * Block user function
56 | *
57 | * @param int $target_id integer for target id
58 | * @param String $reason string of reason to block the user
59 | *
60 | * @return object
61 | */
62 | private function block($target_id, $reason)
63 | {
64 | $res = new stdClass;
65 |
66 | if (!$target_id)
67 | {
68 | ApiError::raiseError(400, JText::_('PLG_API_EASYSOCIAL_INVALID_USER_MESSAGE'));
69 | }
70 |
71 | // Load up the block library
72 | $lib = ES::blocks();
73 | $result = $lib->block($target_id, $reason);
74 |
75 | if ($result->id)
76 | {
77 | $res->result->message = JText::_('PLG_API_EASYSOCIAL_BLOCK_USER');
78 | }
79 | else
80 | {
81 | $res->result->message = JText::_('PLG_API_EASYSOCIAL_BLOCK_USER_ERROR');
82 | }
83 |
84 | return $res;
85 | }
86 |
87 | /** POST
88 | * Unblock user function
89 | *
90 | * @param int $target_id integer for target id
91 | *
92 | * @return object
93 | */
94 |
95 | public function unblock($target_id)
96 | {
97 | $res = new stdClass;
98 |
99 | if (!$target_id)
100 | {
101 | ApiError::raiseError(400, JText::_('PLG_API_EASYSOCIAL_INVALID_USER_MESSAGE'));
102 | }
103 |
104 | // Load up the block library
105 | $lib = ES::blocks();
106 | $result = $lib->unblock($target_id);
107 |
108 | if ($result)
109 | {
110 | $res->result->message = JText::_('PLG_API_EASYSOCIAL_UNBLOCK_USER');
111 | }
112 | else
113 | {
114 | $res->result->message = $result->message;
115 | }
116 |
117 | return $res;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/easysocial/easysocial/event_category.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
18 |
19 | /**
20 | * API class EasysocialApiResourceEvent_category
21 | *
22 | * @since 1.0
23 | */
24 | class EasysocialApiResourceEvent_Category extends ApiResource
25 | {
26 | /**
27 | * Method get
28 | *
29 | * @return mixed
30 | *
31 | * @since 1.0
32 | */
33 | public function get()
34 | {
35 | $this->get_cat();
36 | }
37 |
38 | /**
39 | * Method getting all categories of event
40 | *
41 | * @return mixed
42 | *
43 | * @since 1.0
44 | */
45 | public function get_cat()
46 | {
47 | $app = JFactory::getApplication();
48 |
49 | // Getting log_user
50 | $log_user = $this->plugin->get('user')->id;
51 | $cat = FD::model('eventcategories');
52 |
53 | // Response object
54 | $res = new stdclass;
55 | $res->result = array();
56 | $res->empty_message = '';
57 |
58 | $res->result = $cat->getCategories();
59 | $this->plugin->setResponse($res);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/easysocial/easysocial/event_guest.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
18 | /**
19 | * API class PlgAPIEasysocial
20 | *
21 | * @since 1.0
22 | */
23 | class EasysocialApiResourceEvent_Guest extends ApiResource
24 | {
25 | /**
26 | * Method description
27 | *
28 | * @return mixed
29 | *
30 | * @since 1.0
31 | */
32 | public function get()
33 | {
34 | $this->plugin->setResponse($this->get_guests());
35 | }
36 |
37 | /**
38 | * Method description
39 | *
40 | * @return mixed
41 | *
42 | * @since 1.0
43 | */
44 | public function post()
45 | {
46 | $this->plugin->err_code = 405;
47 | $this->plugin->err_message = JText::_('PLG_API_EASYSOCIAL_USE_GET_METHOD_MESSAGE');
48 | $this->plugin->setResponse(null);
49 | }
50 |
51 | /**
52 | * Method description
53 | *
54 | * @return mixed
55 | *
56 | * @since 1.0
57 | */
58 | public function get_guests()
59 | {
60 | $app = JFactory::getApplication();
61 |
62 | // Getting log_user.
63 | $log_user = $this->plugin->get('user')->id;
64 |
65 | // Get event id,limit,limitstart.
66 | $event_id = $app->input->get('event_id', 0, 'INT');
67 | $limitstart = $app->input->get('limitstart', 0, 'INT');
68 | $limit = $app->input->get('limit', 10, 'INT');
69 | $options = array();
70 | $ordering = $this->plugin->get('ordering', 'name', 'STRING');
71 | $state = $app->input->get('state', '', 'STRING');
72 | $mapp = new EasySocialApiMappingHelper;
73 | $eguest = FD::model('Events');
74 |
75 | // Filter with guests state.
76 | switch ($state)
77 | {
78 | case 'going':
79 | $options['state'] = SOCIAL_EVENT_GUEST_GOING;
80 | break;
81 | case 'notgoing':
82 | $options['state'] = SOCIAL_EVENT_GUEST_NOT_GOING;
83 | break;
84 | case 'maybe':
85 | $options['state'] = SOCIAL_EVENT_GUEST_MAYBE;
86 |
87 | break;
88 | case 'admins':
89 | $options['admin'] = true;
90 | break;
91 | }
92 |
93 | $options['users'] = true;
94 | $options['limitstart'] = $limitstart;
95 | $options['limit'] = $limit;
96 | $res = $eguest->getGuests($event_id, $options);
97 |
98 | // Map the object to userobject.
99 | $eventGuests = $mapp->mapItem($res, 'user');
100 |
101 | return $eventGuests;
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/easysocial/easysocial/event_schedule.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
18 | /**
19 | * API class PlgAPIEasysocial
20 | *
21 | * @since 1.0
22 | */
23 | class EasysocialApiResourceEvent_Schedule extends ApiResource
24 | {
25 | /**
26 | * Method description
27 | *
28 | * @return mixed
29 | *
30 | * @since 1.0
31 | */
32 | public function get()
33 | {
34 | $this->plugin->setResponse($this->get_schedule());
35 | }
36 |
37 | /**
38 | * Method description
39 | *
40 | * @return mixed
41 | *
42 | * @since 1.0
43 | */
44 | public function post()
45 | {
46 | $this->plugin->setResponse(JText::_('PLG_API_EASYSOCIAL_USE_GET_METHOD_MESSAGE'));
47 | }
48 |
49 | /**
50 | * Method getting schedule of event
51 | *
52 | * @return mixed
53 | *
54 | * @since 1.0
55 | */
56 | public function get_schedule()
57 | {
58 | $app = JFactory::getApplication();
59 | $log_user = $this->plugin->get('user')->id;
60 | $event_id = $app->input->get('event_id', 0, 'INT');
61 | $event = FD::event($event_id);
62 | $options = array();
63 |
64 | // Getting params for sending array option.
65 | $params = $event->getParams();
66 |
67 | // Loading model for getting event schedule.
68 | $schedule = FD::model('Events');
69 |
70 | // Required parameters.
71 | $options['eventStart'] = $event->getEventStart();
72 | $options['end'] = $params->get('recurringData')->end;
73 | $options['type'] = $params->get('recurringData')->type;
74 | $options['daily'] = $params->get('recurringData')->daily;
75 |
76 | $data = $schedule->getRecurringSchedule($options);
77 |
78 | // Convert date in to require format.
79 | foreach ($data as $time)
80 | {
81 | $timings['schedule'][] = gmdate("Y-m-d\ TH:i:s\Z ", $time);
82 | }
83 |
84 | return $timings;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/easysocial/easysocial/eventinvite.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
19 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
20 | /**
21 | * API class PlgAPIEasysocial
22 | *
23 | * @since 1.0
24 | */
25 | class EasysocialApiResourceEventinvite extends ApiResource
26 | {
27 | /**
28 | * Method description
29 | *
30 | * @return mixed
31 | *
32 | * @since 1.0
33 | */
34 | public function get()
35 | {
36 | $this->plugin->setResponse(JText::_('PLG_API_EASYSOCIAL_USE_POST_METHOD_MESSAGE'));
37 | }
38 |
39 | /**
40 | * Method description
41 | *
42 | * @return mixed
43 | *
44 | * @since 1.0
45 | */
46 | public function post()
47 | {
48 | $this->plugin->setResponse($this->invite());
49 | }
50 |
51 | /**
52 | * Method invite friend to event.
53 | *
54 | * @return mixed
55 | *
56 | * @since 1.0
57 | */
58 | public function invite()
59 | {
60 | // Init variable
61 | $app = JFactory::getApplication();
62 | $log_user = JFactory::getUser($this->plugin->get('user')->id);
63 | $result = new stdClass;
64 | $event_id = $app->input->get('event_id', 0, 'INT');
65 | $target_users = $app->input->get('target_users', null, 'ARRAY');
66 | $user = FD::user($log_user->id);
67 | $event = FD::event($event_id);
68 | $guest = $event->getGuest($log_user->id);
69 |
70 | if (empty($event) || empty($event->id))
71 | {
72 | $result->message = JText::_('PLG_API_EASYSOCIAL_EVENT_NOT_FOUND_MESSAGE');
73 | $result->status = $state;
74 |
75 | return $result;
76 | }
77 |
78 | if ($event_id)
79 | {
80 | $not_invi = array();
81 | $invited = array();
82 | $es_params = FD::config();
83 |
84 | foreach ($target_users as $id)
85 | {
86 | $target_username = JFactory::getUser($id)->name;
87 |
88 | if ($es_params->get('users')->displayName == 'username')
89 | {
90 | $target_username = JFactory::getUser($id)->name;
91 | }
92 |
93 | $guest = $event->getGuest($id);
94 |
95 | if (! $guest->isGuest() && empty($guest->invited_by))
96 | {
97 | // Invite friend to event
98 | $state = $event->invite($id, $log_user->id);
99 | $result->message = JText::_('PLG_API_EASYSOCIAL_INVITED_MESSAGE');
100 | $result->status = $state;
101 | $invited[] = $target_username;
102 | }
103 | else
104 | {
105 | $result->message = JText::_('PLG_API_EASYSOCIAL_GUEST_CANT_INVITED_MESSAGE');
106 | $result->status = false;
107 | $not_invi[] = $target_username;
108 | }
109 | }
110 |
111 | $result->status = 1;
112 | $result->invited = $invited;
113 | $result->not_invtited = $not_invi;
114 | }
115 |
116 | return $result;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/easysocial/easysocial/getalbums.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/albums.php';
19 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
20 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/uploadHelper.php';
21 |
22 | /**
23 | * API class EasysocialApiResourceGetalbums
24 | *
25 | * @since 1.0
26 | */
27 | class EasysocialApiResourceGetalbums extends ApiResource
28 | {
29 | /**
30 | * Method description
31 | *
32 | * @return mixed
33 | *
34 | * @since 1.0
35 | */
36 | public function get()
37 | {
38 | $this->get_albums();
39 | }
40 |
41 | /**
42 | * Method Get user album as per id / login user
43 | *
44 | * @return object|boolean in success object will return, in failure boolean
45 | *
46 | * @since 1.0
47 | */
48 | public function get_albums()
49 | {
50 | $app = JFactory::getApplication();
51 |
52 | // Getting log_user
53 | $log_user = $this->plugin->get('user')->id;
54 |
55 | // Accepting user details.
56 | $uid = $app->input->get('uid', 0, 'INT');
57 | $type = $app->input->get('type', 0, 'STRING');
58 | $mapp = new EasySocialApiMappingHelper;
59 |
60 | // Accepting pagination values.
61 | $limitstart = $app->input->get('limitstart', 0, 'INT');
62 | $limit = $app->input->get('limit', 10, 'INT');
63 |
64 | // Taking values in array for pagination of albums.
65 | // $mydata['limitstart']=$limitstart;
66 |
67 | $mydata['excludeblocked'] = 1;
68 | $mydata['pagination'] = 1;
69 |
70 | // $mydata['limit'] = $limit;
71 | $mydata['privacy'] = true;
72 |
73 | // $mydata['order'] = 'a.assigned_date';
74 | $mydata['direction'] = 'DESC';
75 |
76 | // Response object
77 | $res = new stdclass;
78 | $res->result = array();
79 | $res->empty_message = '';
80 |
81 | // Creating object and calling relatvie method for data fetching.
82 | $obj = new EasySocialModelAlbums;
83 |
84 | if ($type == 'all')
85 | {
86 | // Getting all public photos
87 | $options = array();
88 |
89 | $options['pagination'] = true;
90 | $options['direction'] = 'DESC';
91 | $options['core'] = false;
92 | $options['privacy'] = true;
93 | $options['excludedisabled'] = true;
94 | $options['withCovers'] = true;
95 |
96 | $albums = $obj->getAlbums('', '', $options);
97 | }
98 | else
99 | {
100 | $albums = $obj->getAlbums($uid, $type, $mydata);
101 | }
102 |
103 | // Use to load table of album.
104 | $album = FD::table('Album');
105 |
106 | foreach ($albums as $album)
107 | {
108 | if ($album->cover_id)
109 | {
110 | $album->load($album->id);
111 | }
112 |
113 | $album->cover_featured = $album->getCover('featured');
114 | $album->cover_large = $album->getCover('large');
115 | $album->cover_square = $album->getCover('square');
116 | $album->cover_thumbnail = $album->getCover('thumbnail');
117 | }
118 |
119 | // Getting count of photos in every albums.
120 | foreach ($albums as $alb)
121 | {
122 | $alb->count = $obj->getTotalPhotos($alb->id);
123 | }
124 |
125 | $all_albums = $mapp->mapItem($albums, 'albums', $log_user);
126 | $output = array_slice($all_albums, $limitstart, $limit);
127 |
128 | if (count($output) == 0)
129 | {
130 | $res->empty_message = JText::_('COM_EASYSOCIAL_NO_ALBUM_AVAILABLE');
131 | }
132 | else
133 | {
134 | $res->result = $output;
135 | }
136 |
137 | $this->plugin->setResponse($res);
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/easysocial/easysocial/group_category.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die( 'Restricted access' );
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
19 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/groups.php';
20 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/covers.php';
21 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/albums.php';
22 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/fields.php';
23 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
24 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/uploadHelper.php';
25 |
26 | /**
27 | * API class EasysocialApiResourceGroup_category
28 | *
29 | * @since 1.0
30 | */
31 | class EasysocialApiResourceGroup_Category extends ApiResource
32 | {
33 | /**
34 | * Method description
35 | *
36 | * @return mixed
37 | *
38 | * @since 1.0
39 | */
40 | public function get()
41 | {
42 | $this->getCategory();
43 | }
44 |
45 | /**
46 | * Method description
47 | *
48 | * @return mixed
49 | *
50 | * @since 1.0
51 | */
52 | public function post()
53 | {
54 | $this->plugin->err_code = 405;
55 | $this->plugin->err_message = JText::_('PLG_API_EASYSOCIAL_USE_GET_METHOD_MESSAGE');
56 | $this->plugin->setResponse(null);
57 | }
58 |
59 | /**
60 | * Method function use for get friends data
61 | *
62 | * @return mixed
63 | *
64 | * @since 1.0
65 | */
66 | public function getCategory()
67 | {
68 | // Init variable
69 | $app = JFactory::getApplication();
70 | $log_user = $this->plugin->get('user')->id;
71 | $other_user_id = $app->input->get('user_id', 0, 'INT');
72 | $userid = ($other_user_id) ? $other_user_id : $log_user;
73 |
74 | $mapp = new EasySocialApiMappingHelper;
75 | $user = FD::user($userid);
76 |
77 | $res = new stdclass;
78 | $res->result = array();
79 | $res->empty_message = '';
80 |
81 | // Get a list of group categories
82 | $catModel = FD::model('GroupCategories');
83 | $cats = $catModel->getCategories(array('state' => SOCIAL_STATE_PUBLISHED, 'ordering' => 'ordering'));
84 | $res->result = $mapp->mapItem($cats, 'category', $log_user);
85 | $this->plugin->setResponse($res);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/easysocial/easysocial/hashsearch.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/hashtags.php';
19 |
20 | /**
21 | * API class PlgAPIEasysocial
22 | *
23 | * @since 1.0
24 | */
25 | class EasysocialApiResourceHashsearch extends ApiResource
26 | {
27 | /**
28 | * Method description
29 | *
30 | * @return mixed
31 | *
32 | * @since 1.0
33 | */
34 | public function get()
35 | {
36 | $this->plugin->setResponse($this->get_hash_list());
37 | }
38 |
39 | /**
40 | * Method description
41 | *
42 | * @return mixed
43 | *
44 | * @since 1.0
45 | */
46 | public function get_hash_list()
47 | {
48 | // Search for hashtag
49 | $app = JFactory::getApplication();
50 |
51 | // Accepting input
52 | $word = $app->input->get('type', null, 'STRING');
53 | $obj = new EasySocialModelHashtags;
54 |
55 | // Calling method and return result
56 | $result = $obj->search($word);
57 |
58 | return $result;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/easysocial/easysocial/hashtag.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/stream.php';
19 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/hashtags.php';
20 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
21 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/uploadHelper.php';
22 |
23 | /**
24 | * API class PlgAPIEasysocial
25 | *
26 | * @since 1.0
27 | */
28 | class EasysocialApiResourceHashtag extends ApiResource
29 | {
30 | /**
31 | * Method description
32 | *
33 | * @return mixed
34 | *
35 | * @since 1.0
36 | */
37 | public function get()
38 | {
39 | $this->plugin->setResponse($this->get_hash_list());
40 | }
41 |
42 | /**
43 | * Method get hashtag list
44 | *
45 | * @return mixed
46 | *
47 | * @since 1.0
48 | */
49 | public function get_hash_list()
50 | {
51 | // Search for hashtag
52 | $app = JFactory::getApplication();
53 |
54 | // Accepting input
55 | $word = $app->input->get('tag', null, 'STRING');
56 | $obj = new EasySocialModelHashtags;
57 |
58 | // Calling method and return result
59 | $result = $obj->search($word);
60 |
61 | return $result;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/easysocial/easysocial/leaderboard.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
19 |
20 | /**
21 | * API class EasysocialApiResourceLeaderboard
22 | *
23 | * @since 1.0
24 | */
25 | class EasysocialApiResourceLeaderboard extends ApiResource
26 | {
27 | /**
28 | * Method description
29 | *
30 | * @return mixed
31 | *
32 | * @since 1.0
33 | */
34 | public function get()
35 | {
36 | $this->get_leaderboard();
37 | }
38 |
39 | /**
40 | * Method description
41 | *
42 | * @return mixed
43 | *
44 | * @since 1.0
45 | */
46 | public function post()
47 | {
48 | $this->plugin->err_code = 405;
49 | $this->plugin->err_message = JText::_('PLG_API_EASYSOCIAL_USE_GET_METHOD_MESSAGE');
50 | $this->plugin->setResponse(null);
51 | }
52 |
53 | /**
54 | * Method Get leaderboards.
55 | *
56 | * @return mixed
57 | *
58 | * @since 1.0
59 | */
60 | public function get_leaderboard()
61 | {
62 | $app = JFactory::getApplication();
63 | $log_user = $this->plugin->get('user')->id;
64 | $limitstart = $app->input->get('limitstart', 0, 'INT');
65 | $limit = $app->input->get('limit', 10, 'INT');
66 | $mapp = new EasySocialApiMappingHelper;
67 | $model = FD::model('Leaderboard');
68 | $excludeAdmin = true;
69 | $options = array('ordering' => 'points', 'excludeAdmin' => $excludeAdmin,'state' => 1);
70 | $users = $model->getLadder($options, false);
71 |
72 | // Response object
73 | $res = new stdClass;
74 | $res->result = array();
75 | $res->empty_message = '';
76 |
77 | if (empty($users))
78 | {
79 | $res->empty_message = JText::_('PLG_API_EASYSOCIAL_NO_LEADERS');
80 |
81 | $this->plugin->setResponse($res);
82 | }
83 |
84 | $leaderusers = $mapp->mapItem($users, 'user');
85 |
86 | $output = array_slice($leaderusers, $limitstart, $limit);
87 | $res->result = $output;
88 |
89 | $this->plugin->setResponse($res);
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/easysocial/easysocial/like.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/groups.php';
19 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/covers.php';
20 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/albums.php';
21 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/fields.php';
22 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
23 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/uploadHelper.php';
24 |
25 | /**
26 | * API class EasysocialApiResourceLike
27 | *
28 | * @since 1.0
29 | */
30 | class EasysocialApiResourceLike extends ApiResource
31 | {
32 | /**
33 | * Method description
34 | *
35 | * @return mixed
36 | *
37 | * @since 1.0
38 | */
39 | public function get()
40 | {
41 | $this->plugin->err_code = 405;
42 | $this->plugin->err_message = JText::_('PLG_API_EASYSOCIAL_USE_POST_METHOD_MESSAGE');
43 | $this->plugin->setResponse(null);
44 | }
45 |
46 | /**
47 | * Method description
48 | *
49 | * @return mixed
50 | *
51 | * @since 1.0
52 | */
53 | public function post()
54 | {
55 | $this->toggleLike();
56 | }
57 |
58 | /**
59 | * Method description
60 | *
61 | * @return mixed
62 | *
63 | * @since 1.0
64 | */
65 | public function delete()
66 | {
67 | $this->plugin->err_code = 405;
68 | $this->plugin->err_message = JText::_('PLG_API_EASYSOCIAL_USE_POST_METHOD_MESSAGE');
69 | $this->plugin->setResponse(null);
70 | }
71 |
72 | /**
73 | * Method function use for get friends data
74 | *
75 | * @return mixed
76 | *
77 | * @since 1.0
78 | */
79 | public function toggleLike()
80 | {
81 | // Init variable
82 | $app = JFactory::getApplication();
83 | $log_user = JFactory::getUser($this->plugin->get('user')->id);
84 | $id = $app->input->get('id', 0, 'INT');
85 | $type = $app->input->get('type', null, 'STRING');
86 | $group = $app->input->get('group', 'user', 'STRING');
87 | $itemVerb = $app->input->get('verb', null, 'STRING');
88 | $streamid = $app->input->get('stream_id', 0, 'INT');
89 | $my = FD::user($log_user->id);
90 |
91 | $res = new stdClass;
92 |
93 | // Load likes library.
94 | $model = FD::model('Likes');
95 |
96 | // Build the key for likes
97 | $key = $type . '.' . $group;
98 |
99 | if ($itemVerb)
100 | {
101 | $key = $key . '.' . $itemVerb;
102 | }
103 |
104 | // Determine if user has liked this item previously.
105 | $hasLiked = $model->hasLiked($id, $key, $my->id);
106 | $useStreamId = ($type == 'albums') ? '' : $streamid;
107 |
108 | // If user had already liked this item, we need to unlike it.
109 | if ($hasLiked)
110 | {
111 | $state = $model->unlike($id, $key, $my->id, $useStreamId);
112 | }
113 | else
114 | {
115 | $state = $model->like($id, $key, $my->id, $useStreamId);
116 |
117 | // Now we need to update the associated stream id from the liked object
118 | if ($streamid)
119 | {
120 | $doUpdate = true;
121 |
122 | if ($type == 'photos')
123 | {
124 | $sModel = FD::model('Stream');
125 | $totalItem = $sModel->getStreamItemsCount($streamid);
126 |
127 | if ($totalItem > 1)
128 | {
129 | $doUpdate = false;
130 | }
131 | }
132 |
133 | if ($doUpdate)
134 | {
135 | $stream = FD::stream();
136 | $stream->updateModified($streamid);
137 | }
138 | }
139 | }
140 |
141 | // The current action
142 | $verb = $hasLiked ? JText::_('PLG_API_EASYSOCIAL_UNLIKE') : JText::_('PLG_API_EASYSOCIAL_LIKE');
143 | $res->result->status = $state;
144 |
145 | // $res->data = ($state && $verb == 'like')?$model->getLikesCount($id, $type):0;
146 | $res->result->message = ($state)? $verb . JText::_('PLG_API_EASYSOCIAL_SUCCESSFULL'): $verb . JText::_('PLG_API_EASYSOCIAL_UNSUCCESSFULL');
147 |
148 | $this->plugin->setResponse($res);
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/easysocial/easysocial/manage_friends.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/friends.php';
19 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/users.php';
20 |
21 | /**
22 | * API class EasysocialApiResourceManage_friends
23 | *
24 | * @since 1.0
25 | */
26 | class EasysocialApiResourceManage_Friends extends ApiResource
27 | {
28 | /**
29 | * Method description
30 | *
31 | * @return mixed
32 | *
33 | * @since 1.0
34 | */
35 | public function get()
36 | {
37 | $this->plugin->setResponse($this->manageFriends());
38 | }
39 |
40 | /**
41 | * Method description
42 | *
43 | * @return mixed
44 | *
45 | * @since 1.0
46 | */
47 | public function post()
48 | {
49 | $this->plugin->setResponse($this->manageFriends());
50 | }
51 |
52 | /**
53 | * Method function use for get friends data
54 | *
55 | * @return mixed
56 | *
57 | * @since 1.0
58 | */
59 | public function manageFriends()
60 | {
61 | // Init variable
62 | $app = JFactory::getApplication();
63 |
64 | $log_user = JFactory::getUser($this->plugin->get('user')->id);
65 | $db = JFactory::getDbo();
66 | $frnd_id = $app->input->post->get('friend_id', 0, 'INT');
67 | $choice = $app->input->post->get('choice', 0, 'INT');
68 | $userid = $log_user->id;
69 | $res = new stdClass;
70 |
71 | if (!$frnd_id)
72 | {
73 | return JText::_('PLG_API_EASYSOCIAL_FRIEND_ID_NOT_FOUND');
74 | }
75 |
76 | if ($choice)
77 | {
78 | $frnds_obj = new EasySocialModelFriends;
79 | $result = $frnds_obj->request($frnd_id, $userid);
80 |
81 | if ($result->id)
82 | {
83 | $res->frnd_id = $frnd_id;
84 | $res->code = 200;
85 | $res->message = JText::_('COM_EASYSOCIAL_FRIENDS_REQUEST_SENT');
86 | }
87 | else
88 | {
89 | $res->code = 403;
90 | $res->message = $result;
91 | }
92 | }
93 | else
94 | {
95 | $user = FD::user($id);
96 | $user->approve();
97 | $res->result = EasySocialModelUsers::deleteFriends($frnd_id);
98 |
99 | if ($res->result == true)
100 | {
101 | $res->code = 200;
102 | $res->message = JText::_('PLG_API_EASYSOCIAL_FRIEND_DELETED_MESSAGE');
103 | }
104 | else
105 | {
106 | $res->code = 403;
107 | $res->message = JText::_('PLG_API_EASYSOCIAL_UNABLE_DELETE_FRIEND_MESSAGE');
108 | }
109 | }
110 |
111 | return $res;
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/easysocial/easysocial/page.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
19 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/uploadHelper.php';
20 | /**
21 | * API class EasysocialApiResourceGroup
22 | *
23 | * @since 1.0
24 | */
25 | class EasysocialApiResourcePage extends ApiResource
26 | {
27 | /**
28 | * Method description
29 | *
30 | * @return object|boolean in success object will return, in failure boolean
31 | *
32 | * @since 1.0
33 | */
34 | public function get()
35 | {
36 | // Init variable
37 | $app = JFactory::getApplication();
38 | $log_user = JFactory::getUser($this->plugin->get('user')->id);
39 | $page_id = $app->input->get('id', 0, 'INT');
40 |
41 | // $other_user_id = $app->input->get('user_id', 0, 'INT');
42 | // $userid = ($other_user_id)?$other_user_id:$log_user->id;
43 |
44 | // $user = FD::user($userid);
45 | $mapp = new EasySocialApiMappingHelper;
46 |
47 | // $grp_model = FD::model('Groups');
48 |
49 | $res = new stdclass;
50 | $res->result = array();
51 | $res->empty_message = '';
52 | $page = array();
53 |
54 | if ($page_id)
55 | {
56 | $page[] = FD::page($page_id);
57 | $res->result = $mapp->mapItem($page, 'page', $log_user->id);
58 | $this->plugin->setResponse($res);
59 | }
60 | else
61 | {
62 | $this->plugin->err_code = 403;
63 | $this->plugin->err_message = 'PLG_API_EASYSOCIAL_PAGE_NOT_FOUND';
64 | $this->plugin->setResponse(null);
65 | }
66 | }
67 |
68 | /**
69 | * Method description
70 | *
71 | * @return mixed
72 | *
73 | * @since 1.0
74 | */
75 |
76 | public function post()
77 | {
78 | $this->plugin->setResponse(JText::_('PLG_API_EASYSOCIAL_UNSUPPORTED_POST_METHOD_MESSAGE'));
79 | }
80 |
81 | /**
82 | * Method description
83 | *
84 | * @return object|boolean in success object will return, in failure boolean
85 | *
86 | * @since 1.0
87 | */
88 | public function delete()
89 | {
90 | $app = JFactory::getApplication();
91 | $page_id = $app->input->get('id', 0, 'INT');
92 | $valid = 1;
93 | $page = FD::page($page_id);
94 |
95 | // Call groups model to get page owner
96 | $pagesModel = FD::model('groups');
97 | $res = new stdclass;
98 |
99 | if (!$page->id || !$page_id)
100 | {
101 | $res->result->status = 0;
102 | $res->result->message = JText::_('PLG_API_EASYSOCIAL_INVALID_PAGE_MESSAGE');
103 | $valid = 0;
104 | }
105 |
106 | // Only allow super admins to delete pages
107 | $my = FD::user($this->plugin->get('user')->id);
108 |
109 | if (!$my->isSiteAdmin() && !$pagesModel->isOwner($my->id, $page_id))
110 | {
111 | $res->result->status = 0;
112 | $res->result->message = JText::_('PLG_API_EASYSOCIAL_PAGE_ACCESS_DENIED_MESSAGE');
113 | $valid = 0;
114 | }
115 |
116 | if ($valid)
117 | {
118 | // Try to delete the page
119 | $page->delete();
120 | $res->result->status = 1;
121 | $res->result->message = JText::_('PLG_API_EASYSOCIAL_PAGE_DELETED_MESSAGE');
122 | }
123 |
124 | $this->plugin->setResponse($res);
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/easysocial/easysocial/pages.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 | defined('_JEXEC') or die('Restricted access');
13 |
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
18 |
19 | /**
20 | * API class EasysocialApiResourcePages
21 | *
22 | * @since 1.0
23 | */
24 | class EasysocialApiResourcePages extends ApiResource
25 | {
26 | /**
27 | * Method to get pages list
28 | *
29 | * @return mixed
30 | *
31 | * @deprecated 2.0 use post instead
32 | *
33 | * @since 1.0
34 | */
35 | public function post()
36 | {
37 | $this->plugin->setResponse(JText::_('PLG_API_EASYSOCIAL_UNSUPPORTED_METHOD_MESSAGE'));
38 | }
39 |
40 | /**
41 | * Method to get pages list
42 | *
43 | * @return object|boolean in success object will return, in failure boolean
44 | *
45 | * @since 2.0
46 | */
47 | public function get()
48 | {
49 | $app = JFactory::getApplication();
50 | $input = $app->input;
51 | $filters = $input->get("filters", array(), "ARRAY");
52 | $user = ES::user();
53 |
54 | $res = new stdclass;
55 | $res->result = array();
56 | $res->empty_message = '';
57 |
58 | $limit = $app->input->get('limit', 10, 'INT');
59 | $filters['limit'] = $limit;
60 |
61 | // Set default filters
62 | $filters['state'] = isset($filters['state']) ? $filters['state'] : SOCIAL_CLUSTER_PUBLISHED;
63 | $filters['types'] = isset($filters['types']) ? $filters['types'] : $user->isSiteAdmin() ? 'all' : 'user';
64 | $filters['ordering'] = isset($filters['ordering']) ? $filters['ordering'] : 'latest';
65 |
66 | $model = ES::model('Pages');
67 | $MappingHelper = new EasySocialApiMappingHelper;
68 |
69 | $pages = $model->getPages($filters);
70 | $pages = $MappingHelper->mapItem($pages, 'page', Jfactory::getUser()->id);
71 |
72 | if (empty($pages))
73 | {
74 | if (! empty($filters['all']))
75 | {
76 | $res->empty_message = JText::_('PLG_API_PAGES_EMPTY_ALL');
77 | }
78 | elseif (! empty($filters['featured']))
79 | {
80 | $res->empty_message = JText::_('PLG_API_PAGES_EMPTY_FEATURED');
81 | }
82 | elseif (! empty($filters['uid']))
83 | {
84 | $res->empty_message = JText::_('PLG_API_PAGES_EMPTY_CREATED');
85 | }
86 | elseif (! empty($filters['liked']))
87 | {
88 | $res->empty_message = JText::_('PLG_API_PAGES_EMPTY_LIKE');
89 | }
90 | else
91 | {
92 | $res->empty_message = JText::_('PLG_API_EASYSOCIAL_PAGE_NOT_FOUND');
93 | }
94 | }
95 |
96 | if (! empty($pages))
97 | {
98 | $res->empty_message = '';
99 | $res->result = $pages;
100 | }
101 |
102 | $this->plugin->setResponse($res);
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/easysocial/easysocial/photoadd.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die( 'Restricted access' );
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/albums.php';
19 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/models/photos.php';
20 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/tables/album.php';
21 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
22 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/uploadHelper.php';
23 | require_once JPATH_SITE . '/components/com_easysocial/controllers/albums.php';
24 |
25 | /**
26 | * API class PlgAPIEasysocial
27 | *
28 | * @since 1.0
29 | */
30 | class EasysocialApiResourcePhotoadd extends ApiResource
31 | {
32 | /**
33 | * Method description
34 | *
35 | * @return mixed
36 | *
37 | * @since 1.0
38 | */
39 | public function post()
40 | {
41 | $this->plugin->setResponse($this->addPhoto());
42 | }
43 |
44 | /**
45 | * Method description
46 | *
47 | * @return mixed
48 | *
49 | * @since 1.0
50 | */
51 | private function addPhoto()
52 | {
53 | $app = JFactory::getApplication();
54 | $userid = $app->input->get('userid', 0, 'INT');
55 | $album_id = $app->input->get('album_id', 0, 'INT');
56 | $canCreate = ES::user();
57 |
58 | if (! $canCreate->getAccess()->allowed('photos.create') && ! $canCreate->isSiteAdmin())
59 | {
60 | ApiError::raiseError(403, JText::_('PLG_API_EASYSOCIAL_PHOTO_NO_ACCESS_UPLOAD_PHOTO'));
61 | }
62 |
63 | // Load the album
64 | $album = ES::table('Album');
65 | $album->load($album_id);
66 | $photo_obj = new EasySocialApiUploadHelper;
67 | $addphoto = $photo_obj->addPhotoAlbum($album_id, $userid);
68 | $album->params = $addphoto;
69 | $album->title = JText::_($album->title);
70 | $album->caption = JText::_($album->caption);
71 |
72 | return $album;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/easysocial/easysocial/polls.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('libraries.schema.group');
17 | jimport('joomla.html.html');
18 | FD::import('site:/controllers/controller');
19 |
20 | /**
21 | * API class PlgAPIEasysocial
22 | *
23 | * @since 1.0
24 | */
25 | class EasysocialApiResourcePollsOne extends ApiResource
26 | {
27 | /**
28 | * Method processAction
29 | *
30 | * @return mixed
31 | *
32 | * @since 1.0
33 | */
34 | public function get()
35 | {
36 | $this->plugin->setResponse($this->processAction());
37 | }
38 |
39 | /**
40 | * Method processAction
41 | *
42 | * @return mixed
43 | *
44 | * @since 1.0
45 | */
46 | public function post()
47 | {
48 | $this->plugin->setResponse($this->processAction());
49 | }
50 |
51 | /**
52 | * Method processAction
53 | *
54 | * @return mixed
55 | *
56 | * @since 1.0
57 | */
58 | public function processAction()
59 | {
60 | $app = JFactory::getApplication();
61 | $log_user = JFactory::getUser($this->plugin->get('user')->id);
62 | $filterType = $app->input->get('type', 'hidden', 'STRING');
63 | $isloadmore = $app->input->get('loadmore', '', '');
64 | $limitstart = $app->input->get('limitstart', '0', '');
65 | $context = SOCIAL_STREAM_CONTEXT_TYPE_ALL;
66 | $my = FD::user();
67 | $stream = FD::stream();
68 | $activities = $stream->getActivityLogs(
69 | array(
70 | 'uId' => $log_user,
71 | 'context' => $context,
72 | 'filter' => $filterType,
73 | 'limitstart' => $limitstart
74 | )
75 | );
76 |
77 | $nextlimit = $stream->getActivityNextLimit();
78 |
79 | return $activities;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/easysocial/easysocial/removetags.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 | defined('_JEXEC') or die( 'Restricted access' );
13 |
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
18 | require_once JPATH_SITE . '/components/com_easysocial/controllers/videos.php';
19 | /**
20 | * API class EasysocialApiResourceRemoveTags
21 | *
22 | * @since 1.0
23 | */
24 | class EasysocialApiResourceRemoveTags extends ApiResource
25 | {
26 | /**
27 | * Method get
28 | *
29 | * @return mixed
30 | *
31 | * @since 1.0
32 | */
33 | public function get()
34 | {
35 | $this->plugin->err_code = 405;
36 | $this->plugin->err_message = JText::_('PLG_API_EASYSOCIAL_USE_POST_METHOD_MESSAGE');
37 | $this->plugin->setApiResponse(null);
38 | }
39 |
40 | /**
41 | * Method post
42 | *
43 | * @return mixed
44 | *
45 | * @since 1.0
46 | */
47 | public function post()
48 | {
49 | $app = JFactory::getApplication();
50 |
51 | // Get the tag id
52 | $id = $app->input->get('friends_tagsid', 0, 'int');
53 |
54 | // Get the tag
55 | $tag = ES::table('Tag');
56 | $tag->load($id);
57 |
58 | // Check for permissions to delete this tag
59 | $table = ES::table('Video');
60 | $table->load($tag->target_id);
61 |
62 | $video = ES::video($table->uid, $table->type, $table);
63 |
64 | // Delete the tag
65 | $tag->delete();
66 | $video = ES::video();
67 | $video->load($tag->target_id);
68 | $tag_peoples = $video->getTags();
69 |
70 | $res = array();
71 | $dataObj = new stdClass;
72 | $dataObj->results = $tag_peoples;
73 | $dataObj->empty_message = '';
74 | $res['data'] = $dataObj;
75 | $res['err_code'] = 200;
76 | $res['err_message'] = '';
77 |
78 | $this->plugin->setResponse($res);
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/easysocial/easysocial/social_share.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die('Restricted access');
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/sharing/sharing.php';
19 |
20 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
21 |
22 | /**
23 | * API class EasysocialApiResourceSocial_Share
24 | *
25 | * @since 1.0
26 | */
27 | class EasysocialApiResourceSocial_Share extends ApiResource
28 | {
29 | /**
30 | * Function for retrieve share data
31 | *
32 | * @return JSON
33 | */
34 | public function get()
35 | {
36 | $this->plugin->setResponse($this->get_content());
37 | }
38 |
39 | /**
40 | * call functionput_data
41 | *
42 | * @return JSON
43 | */
44 | public function post()
45 | {
46 | $this->plugin->setResponse($this->put_data());
47 | }
48 |
49 | /**
50 | * Data for get social share data
51 | *
52 | * @return JSON
53 | */
54 | public function get_content()
55 | {
56 | $obj = new SocialSharing;
57 | $data = $obj->getVendors();
58 |
59 | return $data;
60 | }
61 |
62 | /**
63 | * social share using easysocial method
64 | *
65 | * @return JSON
66 | */
67 | public function put_data()
68 | {
69 | $app = JFactory::getApplication();
70 | $recep = $app->input->get('recipient', '', 'STRING');
71 | $stream_id = $app->input->get('stream_uid', 0, 'INT');
72 | $msg = $app->input->get('message', '', 'STRING');
73 |
74 | $res = new stdClass;
75 |
76 | if (!$stream_id)
77 | {
78 | $res->success = 0;
79 | $res->message = JText::_('COM_EASYSOCIAL_STREAM_INVALID_STREAM_ID');
80 | }
81 |
82 | // Create sharing url
83 | $sharing = FD::get('Sharing', array('url' => FRoute::stream(
84 | array('layout' => 'item',
85 | 'id' => $stream_id,
86 | 'external' => true,
87 | 'xhtml' => true)
88 | ),
89 | 'display' => 'dialog',
90 | 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'),
91 | 'css' => 'fd-small')
92 | );
93 | $tok = base64_encode($sharing->url);
94 |
95 | if (is_string($recep))
96 | {
97 | $recep = explode(',', FD::string()->escape($recep));
98 | }
99 |
100 | if (is_array($recep))
101 | {
102 | foreach ($recep as &$recipient)
103 | {
104 | $recipient = FD::string()->escape($recipient);
105 |
106 | if (!JMailHelper::isEmailAddress($recipient))
107 | {
108 | return false;
109 | }
110 | }
111 | }
112 |
113 | $msg = FD::string()->escape($msg);
114 |
115 | // Check for valid data
116 | if (empty($recep))
117 | {
118 | return false;
119 | }
120 |
121 | if (empty($tok))
122 | {
123 | return false;
124 | }
125 |
126 | $session = JFactory::getSession();
127 |
128 | $config = FD::config();
129 |
130 | $limit = $config->get('sharing.email.limit', 0);
131 |
132 | $now = FD::date()->toUnix();
133 |
134 | $time = $session->get('easysocial.sharing.email.time');
135 |
136 | $count = $session->get('easysocial.sharing.email.count');
137 |
138 | if (is_null($time))
139 | {
140 | $session->set('easysocial.sharing.email.time', $now);
141 | $time = $now;
142 | }
143 |
144 | if (is_null($count))
145 | {
146 | $session->set('easysocial.sharing.email.count', 0);
147 | }
148 |
149 | $diff = $now - $time;
150 |
151 | if ($diff <= 3600)
152 | {
153 | if ($limit > 0 && $count >= $limit)
154 | {
155 | return false;
156 | }
157 |
158 | $count++;
159 | $session->set('easysocial.sharing.email.count', $count);
160 | }
161 | else
162 | {
163 | $session->set('easysocial.sharing.email.time', $now);
164 | $session->set('easysocial.sharing.email.count', 1);
165 | }
166 |
167 | $library = FD::get('Sharing');
168 | $result = $library->sendLink($recep, $tok, $msg);
169 |
170 | $res->success = 1;
171 | $res->message = JText::_('PLG_API_EASYSOCIAL_SHARE_SUCCESS_MESSAGE');
172 | $res->result = $result;
173 |
174 | return $res;
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/easysocial/easysocial/tags.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die( 'Restricted access' );
14 |
15 | jimport('joomla.plugin.plugin');
16 | jimport('joomla.html.html');
17 |
18 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
19 | require_once JPATH_SITE . '/components/com_easysocial/controllers/videos.php';
20 |
21 | /**
22 | * API class EasysocialApiResourceTerms
23 | *
24 | * @since 1.0
25 | */
26 | class EasysocialApiResourceTags extends ApiResource
27 | {
28 | /**
29 | * get.
30 | *
31 | * @see JController
32 | * @since 1.0
33 | * @return true or null
34 | */
35 | public function get()
36 | {
37 | $this->getTags();
38 | }
39 |
40 | /**
41 | * get videos throught api
42 | *
43 | * @return mixed
44 | *
45 | * @since 1.0
46 | */
47 | public function getTags()
48 | {
49 | $app = JFactory::getApplication();
50 | $log_user = $this->plugin->get('user')->id;
51 |
52 | // Get the video
53 | $videoid = $app->input->get('video_id', 0, 'INT');
54 | $video = ES::video();
55 | $video->load($videoid);
56 |
57 | $model = ES::model('Tags');
58 | $tag_peoples = $model->getTags($videoid, SOCIAL_TYPE_VIDEO);
59 | $mapp = new EasySocialApiMappingHelper;
60 |
61 | if ($tag_peoples)
62 | {
63 | foreach ( $tag_peoples as $tusr )
64 | {
65 | $tusr->target_user_obj[] = $mapp->mapItem($tusr->item_id, 'profile', $log_user);
66 | }
67 | }
68 |
69 | // Response object
70 | $res = new stdclass;
71 | $res->result = array();
72 | $res->empty_message = '';
73 |
74 | $res->result = $tag_peoples;
75 | $this->plugin->setResponse($res);
76 | }
77 |
78 | /**
79 | * friends tags
80 | *
81 | * @return mixed
82 | *
83 | * @since 1.0
84 | */
85 | public function post()
86 | {
87 | // Check for request forgeries
88 | // ES::checkToken();
89 |
90 | $app = JFactory::getApplication();
91 |
92 | // Get the user id's.
93 | $friends_tags = $app->input->get('friends_tags', null, 'ARRAY');
94 |
95 | // Get the video
96 | $cluster = $app->input->get('cluster_id', null, 'INT');
97 |
98 | $table = ES::table('Video');
99 | $table->load($cluster);
100 | $video = ES::video($table->uid, $table->type, $table);
101 |
102 | // Insert the user tags
103 | $tags = $video->insertTags($friends_tags);
104 |
105 | $video = ES::video();
106 | $video->load($cluster);
107 | $model = ES::model('Tags');
108 | $tag_peoples = $model->getTags($videoid, SOCIAL_TYPE_VIDEO);
109 |
110 | $this->plugin->setResponse($tag_peoples);
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/easysocial/easysocial/terms.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die( 'Restricted access' );
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 |
17 | /**
18 | * API class EasysocialApiResourceTerms
19 | *
20 | * @since 1.0
21 | */
22 | class EasysocialApiResourceTerms extends ApiResource
23 | {
24 | /**
25 | * Function for get
26 | *
27 | * @return JSON
28 | */
29 | public function get()
30 | {
31 | $this->plugin->setResponse("Use method post");
32 | }
33 |
34 | /**
35 | * Function for post appname and organization content
36 | *
37 | * @return JSON
38 | */
39 | public function post()
40 | {
41 | $this->plugin->setResponse($this->content());
42 | }
43 |
44 | /**
45 | * get videos throught api
46 | *
47 | * @return mixed
48 | *
49 | * @since 1.0
50 | */
51 | public function content()
52 | {
53 | $res = new stdClass;
54 | $jinput = JFactory::getApplication();
55 | $app = $jinput->input->get('appname', null, 'STRING');
56 | $company = $jinput->input->get('company', 'Appcarvers', 'STRING');
57 | $day = $jinput->input->get('day', 30, 'INT');
58 | /* $res->message = "" .
59 | JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_ONE', $company) .
60 | JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_TWO', $app, $company) .
61 | JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_THREE', $company) .
62 | JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_FOUR', $company, $day) . " ";
63 | */
64 |
65 | $res->message = JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_ONE', $company);
66 | $res->message_one = JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_TWO', $app, $company);
67 | $res->subtitle = JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_THREE', $company);
68 | $res->rules = JText::sprintf('PLG_API_EASYSOCIAL_APP_TERM_FOUR', $company, $day);
69 |
70 | return $res;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/easysocial/easysocial/votes.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://techjoomla.com
9 | * Work derived from the original RESTful API by Techjoomla (https://github.com/techjoomla/Joomla-REST-API)
10 | * and the com_api extension by Brian Edgerton (http://www.edgewebworks.com)
11 | */
12 |
13 | defined('_JEXEC') or die( 'Restricted access' );
14 | jimport('joomla.plugin.plugin');
15 | jimport('joomla.html.html');
16 | require_once JPATH_SITE . '/plugins/api/easysocial/libraries/mappingHelper.php';
17 |
18 |
19 | /**
20 | * API class EasysocialApiResourceVotes
21 | *
22 | * @since 1.0
23 | */
24 | class EasysocialApiResourceVotes extends ApiResource
25 | {
26 | /**
27 | * Function for retrieve poll data
28 | *
29 | * @return JSON
30 | */
31 | public function get()
32 | {
33 | $this->plugin->setResponse($this->getPollData());
34 | }
35 |
36 | /**
37 | * Function for vote
38 | *
39 | * @return JSON
40 | */
41 | public function post()
42 | {
43 | $this->processVote();
44 | }
45 |
46 | /**
47 | * Function for retrieve poll details
48 | *
49 | * @return JSON
50 | */
51 | private function getPollData()
52 | {
53 | $mapp = new EasySocialApiMappingHelper;
54 | $app = JFactory::getApplication();
55 | $poll_id = $app->input->get('poll_id', 0, 'INT');
56 | $poll = ES::table('Polls');
57 | $poll->load(array('uid' => $poll_id));
58 | $content = $mapp->createPollData($poll->id);
59 | $result = get_object_vars($content);
60 | $poll = array();
61 |
62 | return $result;
63 | }
64 |
65 | /**
66 | * Function userful for vote
67 | *
68 | * @return object
69 | */
70 | private function processVote()
71 | {
72 | $app = JFactory::getApplication();
73 | $pollId = $app->input->get('id', 0, 'int');
74 | $itemId = $app->input->get('itemId', 0, 'int');
75 | $action = $app->input->get('act', '', 'STRING');
76 | $log_user = $this->plugin->get('user')->id;
77 | $access = ES::access($log_user, SOCIAL_TYPE_USER);
78 | $allowed = $access->get('polls.vote');
79 | $res = new stdClass;
80 |
81 | if (!$allowed)
82 | {
83 | ApiError::raiseError(403, JText::_('PLG_API_EASYSOCIAL_VOTE_NOT_ALLOW_MESSAGE'));
84 | }
85 |
86 | $res->result->message = $this->votesCount($pollId, $itemId, $action);
87 | $this->plugin->setResponse($res);
88 | }
89 |
90 | /**
91 | * Give votes to poll
92 | *
93 | * @param string $pollId The poll id.
94 | *
95 | * @param string $itemId The itemId id.
96 | *
97 | * @param string $action The action.
98 | *
99 | * @return object
100 | */
101 | private function votesCount($pollId, $itemId, $action)
102 | {
103 | $my = ES::user();
104 | $res = new stdClass;
105 |
106 | $poll = ES::table('Polls');
107 | $pollItem = ES::table('PollsItems');
108 | $state_poll_id = $poll->load($pollId);
109 | $state_item_id = $pollItem->load($itemId);
110 |
111 | if (! $state_poll_id || !$state_item_id)
112 | {
113 | // Error. invalid poll id and poll item id.
114 | ApiError::raiseError(400, JText::_('PLG_API_EASYSOCIAL_INVALID_VOTE_ID'));
115 | }
116 |
117 | $pollLib = ES::get('Polls');
118 |
119 | // Error. if, missing any field
120 | if (!$pollId || !$itemId || !$action )
121 | {
122 | ApiError::raiseError(400, JText::_('PLG_API_EASYSOCIAL_VALID_DETAILS'));
123 | }
124 |
125 | // Action vote to give vote poll item and unvote to remove vote
126 | if ($action == 'vote')
127 | {
128 | $pollLib->vote($pollId, $itemId, $my->id);
129 | $res->message = JText::_('PLG_API_EASYSOCIAL_VOTING');
130 | }
131 | elseif ($action == 'unvote')
132 | {
133 | $pollLib->unvote($pollId, $itemId, $my->id);
134 | $res->message = JText::_('PLG_API_EASYSOCIAL_VOTE_REMOVED_SUCCESS');
135 | }
136 | else
137 | {
138 | ApiError::raiseError(400, JText::_('PLG_API_EASYSOCIAL_VALID_DETAILS'));
139 | }
140 |
141 | return $res;
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/easysocial/language/en-GB/en-GB.plg_api_easysocial.sys.ini:
--------------------------------------------------------------------------------
1 | PLG_API_EASYSOCIAL="EasySocial APIs"
2 | PLG_API_EASYSOCIAL_DESCRIPTION="This plugin use for get data from easysocial."
3 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/albums.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | class GetalbumsSimpleSchema {
10 | public $id;
11 | public $cover_id;
12 | public $uid;
13 | public $type;
14 | public $title;
15 | public $caption;
16 | public $created;
17 | public $assigned_date;
18 | public $cover_featured;
19 | public $cover_large;
20 | public $cover_square;
21 | public $cover_thumbnail;
22 | public $count;
23 | public $likes;
24 | public $total;
25 | public $comments;
26 | public $comment_element;
27 | public $commentcount;
28 | public $isowner;
29 | }
30 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/category.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 |
11 | class CategorySimpleSchema {
12 |
13 | public $categoryid;
14 |
15 | public $title;
16 |
17 | public $description;
18 |
19 | public $state;
20 |
21 | public $created_by;
22 |
23 | public $created_date;
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/createalbum.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | class CreatealbumSimpleSchema {
10 | public $id;
11 | public $cover_id;
12 | public $uid;
13 | public $type;
14 | public $user_id;
15 | public $title;
16 | public $caption;
17 | public $created;
18 | public $assigned_date;
19 | public $cover_featured;
20 | public $cover_large;
21 | public $cover_square;
22 | public $cover_thumbnail;
23 | }
24 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/discussion.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class discussionSimpleSchema {
11 |
12 | public $id;
13 | public $title;
14 | public $description;
15 | public $created_date;
16 | public $created_by;
17 | public $replies_count;
18 | public $last_replied;
19 | public $hits;
20 | public $lapsed;
21 | public $replies;
22 | }
23 |
24 | class discussionReplySimpleSchema {
25 |
26 | public $id;
27 | public $created_by;
28 | public $reply;
29 | public $created_date;
30 | public $lapsed;
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/events.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class EventsSimpleSchema {
11 | public $id;
12 | public $title;
13 | public $description;
14 | public $params;
15 | public $details;
16 | public $guests;
17 | public $featured;
18 | public $created;
19 | public $categoryId;
20 | public $start_date;
21 | public $end_date;
22 | public $start_date_unix;
23 | public $end_date_unix;
24 | public $category_name;
25 | public $isAttending;
26 | public $isOwner;
27 | public $isMaybe;
28 | public $location;
29 | public $longitude;
30 | public $latitude;
31 | public $cover_image;
32 | public $start_date_ios;
33 | public $end_date_ios;
34 | public $isoverevent;
35 | public $share_url;
36 | public $isPendingMember;
37 | public $isRecurring;
38 | public $hasRecurring;
39 | }
40 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/group.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class GroupSimpleSchema {
11 |
12 | public $id;
13 | public $title;
14 | public $description;
15 | public $category_id;
16 | public $category_name;
17 | //public $cover;
18 | public $type;
19 | public $avatar_large;
20 | public $member_count;
21 | public $hits;
22 | public $created_by;
23 | public $created_date;
24 | public $album_count;
25 | public $isowner;
26 | public $ismember;
27 | public $approval_pending;
28 | public $cover;
29 | public $more_info;
30 | public $params;
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/group_members.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class GroupMembersSimpleSchema {
11 |
12 | public $id;
13 | public $username;
14 | public $image;
15 | public $isself;
16 | public $cover;
17 | public $friend_count;
18 | public $follower_count;
19 | public $badges;
20 | public $points;
21 | public $more_info;
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/message.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class converastionSimpleSchema {
11 |
12 | public $conversion_id;
13 | public $created_date;
14 | public $lastreplied_date;
15 | public $isread;
16 | public $messages;
17 | public $lapsed;
18 | public $participant;
19 |
20 | }
21 |
22 | class MessageSimpleSchema {
23 |
24 | public $id;
25 | public $message;
26 | public $attachment;
27 | public $created_date;
28 | public $created_by;
29 | public $lapsed;
30 | public $isself;
31 |
32 | }
33 |
34 | class ReplySimpleSchema {
35 |
36 | public $id;
37 | public $created_by;
38 | public $reply;
39 | public $created_date;
40 | public $lapsed;
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/page.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | /**
11 | * To build page Schema
12 | *
13 | * @since 1.0
14 | */
15 | class PageSimpleSchema
16 | {
17 | public $id;
18 |
19 | public $title;
20 |
21 | public $alias;
22 |
23 | public $state;
24 |
25 | public $page_type;
26 |
27 | public $cover_position;
28 |
29 | public $creator_name;
30 |
31 | public $friends;
32 |
33 | public $isinvited;
34 |
35 | public $description;
36 |
37 | public $category_id;
38 |
39 | public $category_name;
40 |
41 | public $type;
42 |
43 | public $avatar_large;
44 |
45 | public $member_count;
46 |
47 | public $hits;
48 |
49 | public $created_by;
50 |
51 | public $created_date;
52 |
53 | public $album_count;
54 |
55 | public $isowner;
56 |
57 | public $ismember;
58 |
59 | public $approval_pending;
60 |
61 | public $cover;
62 |
63 | public $more_info;
64 |
65 | public $params;
66 | }
67 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/person.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class PersonSimpleSchema {
11 |
12 | public $name;
13 |
14 | public $email;
15 |
16 | public $photo;
17 |
18 | public $website;
19 |
20 | public $bio;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/photos.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | class PhotosSimpleSchema {
10 | public $id;
11 | public $album_id;
12 | public $user_id;
13 | public $uid;
14 | public $type;
15 | public $title;
16 | public $isowner;
17 | public $caption;
18 | public $created;
19 | public $state;
20 | public $assigned_date;
21 | public $image_large;
22 | public $image_square;
23 | public $image_thumbnail;
24 | public $image_featured;
25 | public $likes;
26 | public $comments;
27 | public $comment_element;
28 | }
29 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/profile.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | /**
10 | * To build page profile Simple Schema
11 | *
12 | * @since 1.0
13 | */
14 | class ProfileSimpleSchema
15 | {
16 | public $id;
17 |
18 | public $title;
19 |
20 | public $raw_content;
21 |
22 | public $content;
23 |
24 | public $actor;
25 |
26 | public $published;
27 |
28 | public $last_replied;
29 |
30 | public $likes;
31 |
32 | public $comment_element;
33 |
34 | public $comments;
35 | }
36 |
37 | /**
38 | * To build page field Simple Schema
39 | *
40 | * @since 1.0
41 | */
42 | class FildsSimpleSchema
43 | {
44 | public $title;
45 |
46 | public $unique_key;
47 |
48 | public $field_id;
49 |
50 | public $field_name;
51 |
52 | public $field_value;
53 |
54 | public $step;
55 |
56 | public $params;
57 | }
58 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/stream.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class streamSimpleSchema {
11 |
12 | public $id;
13 | public $title;
14 | public $type;
15 | public $group;
16 | public $element_id;
17 | public $preview;
18 | public $raw_content_url;
19 | public $content;
20 | public $actor;
21 | public $published;
22 | public $last_replied;
23 | public $likes;
24 | public $comment_element;
25 | public $comments;
26 | public $share_url;
27 | public $stream_url;
28 | public $with;
29 | public $isPinned;
30 | public $file_name;
31 | public $download_file_url;
32 |
33 | }
34 |
35 | class likesSimpleSchema {
36 |
37 | public $uid;
38 | public $type;
39 | public $stream_id;
40 | public $verb;
41 | public $created_by;
42 | public $total;
43 | //public $hasliked;
44 |
45 | }
46 |
47 | class commentsSimpleSchema {
48 |
49 | public $uid;
50 | public $element;
51 | public $element_id;
52 | public $comment;
53 | public $verb;
54 | public $group;
55 | public $stream_id;
56 | public $created_by;
57 | public $created;
58 | public $lapsed;
59 | public $params;
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/user.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die('Restricted access');
9 |
10 | class userSimpleSchema {
11 |
12 | public $id;
13 | public $username;
14 | public $name;
15 | public $image;
16 | public $isself;
17 | public $cover;
18 | public $friend_count;
19 | public $follower_count;
20 | public $badges;
21 | public $points;
22 | public $more_info;
23 | public $isOwner;
24 | public $isrequestor;
25 | public $display_name;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/easysocial/libraries/schema/videos.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | class VideoSimpleSchema {
10 | public $id;
11 | public $title;
12 | public $description;
13 | public $user_id;
14 | public $uid;
15 | public $type;
16 | public $created;
17 | public $state;
18 | public $featured;
19 | public $category_id;
20 | public $hits;
21 | public $duration;
22 | public $size;
23 | public $params;
24 | public $storage;
25 | public $path;
26 | public $original;
27 | public $file_title;
28 | public $source;
29 | public $thumbnail;
30 | public $likes;
31 | public $comments;
32 | public $comment_element;
33 | public $message;
34 | public $isAdmin;
35 | public $location;
36 | public $stream_id;
37 | }
38 | ?>
39 |
--------------------------------------------------------------------------------
/jticketing/jticket.php:
--------------------------------------------------------------------------------
1 |
4 | * @package JTicketing
5 | * @author Techjoomla
6 | * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved.
7 | * @license GNU General Public License version 2 or later.
8 | */
9 | defined('_JEXEC') or die( 'Restricted access');
10 | jimport('joomla.plugin.plugin');
11 |
12 | /**
13 | * Base Class for api plugin
14 | *
15 | * @package JTicketing
16 | * @subpackage component
17 | * @since 1.0
18 | */
19 | class PlgAPIJticket extends ApiPlugin
20 | {
21 | /**
22 | * Jticketing api plugin to load com_api classes
23 | *
24 | * @param string $subject originalamount
25 | * @param array $config coupon_code
26 | *
27 | * @since 1.0
28 | */
29 | public function __construct($subject, $config = array())
30 | {
31 | parent::__construct($subject, $config = array());
32 |
33 | // Load all required helpers.
34 | $component_path = JPATH_ROOT . '/components/com_jticketing';
35 |
36 | if (!file_exists($component_path))
37 | {
38 | return;
39 | }
40 |
41 | $jticketingmainhelperPath = JPATH_ROOT . '/components/com_jticketing/helpers/main.php';
42 |
43 | if (!class_exists('jticketingmainhelper'))
44 | {
45 | JLoader::register('jticketingmainhelper', $jticketingmainhelperPath);
46 | JLoader::load('jticketingmainhelper');
47 | }
48 |
49 | $jticketingfrontendhelper = JPATH_ROOT . '/components/com_jticketing/helpers/frontendhelper.php';
50 |
51 | if (!class_exists('jticketingfrontendhelper'))
52 | {
53 | JLoader::register('jticketingfrontendhelper', $jticketingfrontendhelper);
54 | JLoader::load('jticketingfrontendhelper');
55 | }
56 |
57 | $jteventHelperPath = JPATH_ROOT . '/components/com_jticketing/helpers/event.php';
58 |
59 | if (!class_exists('jteventHelper'))
60 | {
61 | JLoader::register('jteventHelper', $jteventHelperPath);
62 | JLoader::load('jteventHelper');
63 | }
64 |
65 | ApiResource::addIncludePath(dirname(__FILE__) . '/jticket');
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/jticketing/jticket.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - Jticketing
4 | 1.7.2
5 | 12th Feb 2016
6 | Tekdi
7 | support@tekdi.com
8 | http://www.tekdi.com
9 | 2012 users
10 | GNU General Public License v2
11 | API plugins of Jticketing components of the Joomla!
12 |
13 | jticket.php
14 | jticket/checkin.php
15 | jticket
16 |
17 |
18 | language/en-GB/en-GB.plg_api_jticket.ini
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/jticketing/jticket/getpayouts.php:
--------------------------------------------------------------------------------
1 |
4 | * @package JTicketing
5 | * @author Techjoomla
6 | * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved.
7 | * @license GNU General Public License version 2 or later.
8 | */
9 |
10 | defined('_JEXEC') or die;
11 | jimport('joomla.plugin.plugin');
12 | require_once JPATH_ADMINISTRATOR.'/components/com_jticketing/models/mypayouts.php';
13 |
14 | /**
15 | * Class for getting user events based on user id
16 | *
17 | * @package JTicketing
18 | * @subpackage component
19 | * @since 1.0
20 | */
21 | class JticketApiResourceGetPayouts extends ApiResource
22 | {
23 | /**
24 | * Get Event data
25 | *
26 | * @return json user list
27 | *
28 | * @since 1.0
29 | */
30 | public function get()
31 | {
32 |
33 | $com_params = JComponentHelper::getParams('com_jticketing');
34 | $integration = $com_params->get('integration');
35 | $input = JFactory::getApplication()->input;
36 | $lang = JFactory::getLanguage();
37 | $extension = 'com_jticketing';
38 | $base_dir = JPATH_SITE;
39 | $lang->load($extension, $base_dir);
40 | $obj_merged = array();
41 |
42 | $userid = $input->get('userid', '', 'INT');
43 | $search = $input->get('search', '', 'STRING');
44 |
45 | if (empty($userid))
46 | {
47 | $obj->success = 0;
48 | $obj->message = JText::_("COM_JTICKETING_INVALID_USER");
49 | $this->plugin->setResponse($obj);
50 |
51 | return;
52 | }
53 |
54 | $jticketingmainhelper = new jticketingmainhelper;
55 | $plugin = JPluginHelper::getPlugin('api', 'jticket');
56 |
57 | // Check if plugin is enabled
58 | if ($plugin)
59 | {
60 | // Get plugin params
61 | $pluginParams = new JRegistry($plugin->params);
62 | $users_allow_access_app = $pluginParams->get('users_allow_access_app');
63 | }
64 |
65 | // If user is in allowed user to access APP show all events to that user
66 | if (is_array($users_allow_access_app) and in_array($userid, $users_allow_access_app))
67 | {
68 | $eventdatapaid = $jticketingmainhelper->getMypayoutData();
69 | }
70 | else
71 | {
72 | $eventdatapaid = $jticketingmainhelper->getMypayoutData($userid,$search);
73 | }
74 |
75 | $db = JFactory::getDBO();
76 | $db->setQuery($eventdatapaid);
77 | $obj_merged = $db->loadObjectlist();
78 |
79 | $obj = new stdClass;
80 |
81 | if ($obj_merged)
82 | {
83 | $obj = $obj_merged;
84 | }
85 | else
86 | {
87 | $obj->success = "0";
88 | $obj->message = JText::_("COM_JTICKETING_NO_EVENT_DATA_USER");
89 | }
90 |
91 | $this->plugin->setResponse($obj);
92 | }
93 |
94 | /**
95 | * Post Method
96 | *
97 | * @return void
98 | *
99 | * @since 1.0
100 | */
101 | public function post()
102 | {
103 | $obj = new stdClass;
104 | $obj->success = 0;
105 | $obj->code = 20;
106 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
107 | $this->plugin->setResponse($obj);
108 | }
109 |
110 | /**
111 | * Put method
112 | *
113 | * @return void
114 | *
115 | * @since 1.0
116 | */
117 | public function put()
118 | {
119 | $obj = new stdClass;
120 | $obj->success = 0;
121 | $obj->code = 20;
122 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
123 | $this->plugin->setResponse($obj);
124 | }
125 |
126 | /**
127 | * Delete method
128 | *
129 | * @return void
130 | *
131 | * @since 1.0
132 | */
133 | public function delete()
134 | {
135 | $obj = new stdClass;
136 | $obj->success = 0;
137 | $obj->code = 20;
138 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
139 | $this->plugin->setResponse($obj);
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/jticketing/jticket/getticketsales.php:
--------------------------------------------------------------------------------
1 |
4 | * @package JTicketing
5 | * @author Techjoomla
6 | * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved.
7 | * @license GNU General Public License version 2 or later.
8 | */
9 |
10 | defined('_JEXEC') or die;
11 | jimport('joomla.plugin.plugin');
12 |
13 | /**
14 | * Class for getting user events based on user id
15 | *
16 | * @package JTicketing
17 | * @subpackage component
18 | * @since 1.0
19 | */
20 | class JticketApiResourceGetTicketSales extends ApiResource
21 | {
22 | /**
23 | * Get Event data
24 | *
25 | * @return json user list
26 | *
27 | * @since 1.0
28 | */
29 | public function get()
30 | {
31 | $com_params = JComponentHelper::getParams('com_jticketing');
32 | $integration = $com_params->get('integration');
33 | $input = JFactory::getApplication()->input;
34 | $lang = JFactory::getLanguage();
35 | $extension = 'com_jticketing';
36 | $base_dir = JPATH_SITE;
37 | $lang->load($extension, $base_dir);
38 | $obj_merged = array();
39 |
40 | $userid = $input->get('userid', '', 'INT');
41 | //$obj_merged = array();
42 |
43 | // $userid = $this->plugin->get('user')->id;
44 |
45 | if (empty($userid))
46 | {
47 | $obj->success = 0;
48 | $obj->message = JText::_("COM_JTICKETING_INVALID_USER");
49 | $this->plugin->setResponse($obj);
50 |
51 | return;
52 | }
53 |
54 | $jticketingmainhelper = new jticketingmainhelper;
55 | $plugin = JPluginHelper::getPlugin('api', 'jticket');
56 |
57 | // Check if plugin is enabled
58 | if ($plugin)
59 | {
60 | // Get plugin params
61 | $pluginParams = new JRegistry($plugin->params);
62 | $users_allow_access_app = $pluginParams->get('users_allow_access_app');
63 | }
64 |
65 | // If user is in allowed user to access APP show all events to that user
66 | if (is_array($users_allow_access_app) and in_array($userid, $users_allow_access_app))
67 | {
68 | $eventdatapaid = $jticketingmainhelper->getMypayoutDataAPI();
69 | $obj_merged = $eventdatapaid;
70 | }
71 | else
72 | {
73 | $eventid = 84;
74 | $eventdatapaid = $jticketingmainhelper->getSalesDataAdmin($userid,$eventid);
75 |
76 | $db = JFactory::getDBO();
77 | $db->setQuery($eventdatapaid);
78 | $results = $db->loadObjectlist();
79 | $obj_merged = $results;
80 | }
81 |
82 | $obj = new stdClass;
83 |
84 | if ($obj_merged)
85 | {
86 | $obj = $obj_merged;
87 | }
88 | else
89 | {
90 | $obj->success = "0";
91 | $obj->message = JText::_("COM_JTICKETING_NO_EVENT_DATA_USER");
92 | }
93 |
94 | $this->plugin->setResponse($obj);
95 | }
96 |
97 | /**
98 | * Post Method
99 | *
100 | * @return void
101 | *
102 | * @since 1.0
103 | */
104 | public function post()
105 | {
106 | $obj = new stdClass;
107 | $obj->success = 0;
108 | $obj->code = 20;
109 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
110 | $this->plugin->setResponse($obj);
111 | }
112 |
113 | /**
114 | * Put method
115 | *
116 | * @return void
117 | *
118 | * @since 1.0
119 | */
120 | public function put()
121 | {
122 | $obj = new stdClass;
123 | $obj->success = 0;
124 | $obj->code = 20;
125 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
126 | $this->plugin->setResponse($obj);
127 | }
128 |
129 | /**
130 | * Delete method
131 | *
132 | * @return void
133 | *
134 | * @since 1.0
135 | */
136 | public function delete()
137 | {
138 | $obj = new stdClass;
139 | $obj->success = 0;
140 | $obj->code = 20;
141 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
142 | $this->plugin->setResponse($obj);
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/jticketing/jticket/gettickettypes.php:
--------------------------------------------------------------------------------
1 |
4 | * @package JTicketing
5 | * @author Techjoomla
6 | * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved.
7 | * @license GNU General Public License version 2 or later.
8 | */
9 |
10 | defined('_JEXEC') or die;
11 | jimport('joomla.plugin.plugin');
12 |
13 | /**
14 | * Class for getting ticket types based on event id
15 | *
16 | * @package JTicketing
17 | * @subpackage component
18 | * @since 1.0
19 | */
20 | class JticketApiResourceGettickettypes extends ApiResource
21 | {
22 | /**
23 | * Get ticket types based on event id
24 | *
25 | * @return json user list
26 | *
27 | * @since 1.0
28 | */
29 | public function get()
30 | {
31 | $lang = JFactory::getLanguage();
32 | $extension = 'com_jticketing';
33 | $base_dir = JPATH_SITE;
34 | $input = JFactory::getApplication()->input;
35 | $lang->load($extension, $base_dir);
36 | $eventid = $input->get('eventid', '0', 'INT');
37 | $search = $input->get('search', '', 'STRING');
38 |
39 | if (empty($eventid))
40 | {
41 | $obj->success = 0;
42 | $obj->message = JText::_("COM_JTICKETING_INVALID_EVENT");
43 | $this->plugin->setResponse($obj);
44 |
45 | return;
46 | }
47 |
48 | $jticketingmainhelper = new jticketingmainhelper;
49 | $tickettypes = $jticketingmainhelper->GetTicketTypes($eventid, '', $search);
50 |
51 | if ($tickettypes)
52 | {
53 | foreach ($tickettypes as &$tickettype)
54 | {
55 | if ($tickettype->available == 0 || $tickettype->unlimited_seats == 1)
56 | {
57 | $tickettype->available = JText::_('COM_JTICKETING_UNLIMITED_SEATS');
58 | }
59 |
60 | $tickettype->soldticket = (int) $jticketingmainhelper->GetTicketTypessold($tickettype->id);
61 |
62 | if (empty($tickettype->soldticket) or $tickettype->soldticket < 0)
63 | {
64 | $tickettype->soldticket = 0;
65 | }
66 |
67 | $tickettype->checkins = (int) $jticketingmainhelper->GetTicketTypescheckin($tickettype->id);
68 |
69 | if (empty($tickettype->checkins) or $tickettype->checkins < 0)
70 | {
71 | $tickettype->checkins = 0;
72 | }
73 | }
74 | }
75 |
76 | $obj = new Stdclass;
77 |
78 | if (isset($tickettypes))
79 | {
80 | $obj->success = "1";
81 | $obj->data = $tickettypes;
82 | }
83 | else
84 | {
85 | $obj->success = "0";
86 | $obj->message = JText::_("COM_JTICKETING_INVALID_EVENT");
87 | }
88 |
89 | $this->plugin->setResponse($obj);
90 | }
91 |
92 | /**
93 | * Post Method
94 | *
95 | * @return void
96 | *
97 | * @since 1.0
98 | */
99 | public function post()
100 | {
101 | $obj = new stdClass;
102 | $obj->success = 0;
103 | $obj->code = 20;
104 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
105 | $this->plugin->setResponse($obj);
106 | }
107 |
108 | /**
109 | * Put method
110 | *
111 | * @return void
112 | *
113 | * @since 1.0
114 | */
115 | public function put()
116 | {
117 | $obj = new stdClass;
118 | $obj->success = 0;
119 | $obj->code = 20;
120 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
121 | $this->plugin->setResponse($obj);
122 | }
123 |
124 | /**
125 | * Delete method
126 | *
127 | * @return void
128 | *
129 | * @since 1.0
130 | */
131 | public function delete()
132 | {
133 | $obj = new stdClass;
134 | $obj->success = 0;
135 | $obj->code = 20;
136 | $obj->message = JText::_("COM_JTICKETING_SELECT_GET_METHOD");
137 | $this->plugin->setResponse($obj);
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/jticketing/jticket/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techjoomla/com_api-plugins/b1af3fe1f835eafd9d0beeb9c830d2a9640b61e7/jticketing/jticket/index.html
--------------------------------------------------------------------------------
/jticketing/jticket/login.php:
--------------------------------------------------------------------------------
1 |
4 | * @package JTicketing
5 | * @author Techjoomla
6 | * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved.
7 | * @license GNU General Public License version 2 or later.
8 | */
9 |
10 | defined('_JEXEC') or die('Restricted access');
11 | jimport('joomla.plugin.plugin');
12 | jimport('joomla.html.html');
13 | jimport('joomla.application.component.controller');
14 | jimport('joomla.application.component.model');
15 | jimport('joomla.user.helper');
16 | jimport('joomla.user.user');
17 | JModelLegacy::addIncludePath(JPATH_SITE . DS . 'components' . DS . 'com_api' . DS . 'models');
18 | require_once JPATH_SITE . DS . 'components' . DS . 'com_api' . DS . 'libraries' . DS . 'authentication' . DS . 'login.php';
19 | require_once JPATH_SITE . DS . 'components' . DS . 'com_api' . DS . 'models' . DS . 'key.php';
20 | require_once JPATH_SITE . DS . 'components' . DS . 'com_api' . DS . 'models' . DS . 'keys.php';
21 |
22 | /**
23 | * Class for login API
24 | *
25 | * @package JTicketing
26 | * @subpackage component
27 | * @since 1.0
28 | */
29 | class JticketApiResourceLogin extends ApiResource
30 | {
31 | /**
32 | * Get Event data
33 | *
34 | * @return json user list
35 | *
36 | * @since 1.0
37 | */
38 | public function get()
39 | {
40 | $lang = JFactory::getLanguage();
41 | $extension = 'com_jticketing';
42 | $base_dir = JPATH_SITE;
43 | $lang->load($extension, $base_dir);
44 | $result = $this->keygen();
45 | $success = $result->success;
46 |
47 | if (empty($success))
48 | {
49 | $result = JText::_("COM_JTICKETING_INVALID_USER_PASSWORD");
50 | }
51 |
52 | unset($result->success);
53 |
54 | if ($success)
55 | {
56 | $data1 = array(
57 | "data" => $result,
58 | "success" => $success
59 | );
60 | }
61 | else
62 | {
63 | $data1 = array(
64 | "message" => $result,
65 | "success" => $success
66 | );
67 | }
68 |
69 | $this->plugin->setResponse($data1);
70 | }
71 |
72 | /**
73 | * Post Event data
74 | *
75 | * @return json user list
76 | *
77 | * @since 1.0
78 | */
79 | public function post()
80 | {
81 | $this->plugin->setResponse($this->keygen());
82 | }
83 |
84 | /**
85 | * keygen
86 | *
87 | * @return json user list
88 | *
89 | * @since 1.0
90 | */
91 | public function keygen()
92 | {
93 | $umodel = new JUser;
94 | $user = $umodel->getInstance();
95 | $group = JRequest::getVar('group');
96 |
97 | if (!$user->id)
98 | {
99 | $user = JFactory::getUser($this->getUserId(JRequest::getVar("username")));
100 | }
101 |
102 | $kmodel = new ApiModelKey;
103 | $model = new ApiModelKeys;
104 | $key = null;
105 | $keys_data = $model->getList();
106 |
107 | foreach ($keys_data as $val)
108 | {
109 | if (!empty($user->id) and $val->user_id == $user->id)
110 | {
111 | $key = $val->hash;
112 | }
113 | }
114 |
115 | // Create new key for user
116 | if (!empty($user->id) and $key == null)
117 | {
118 | $data = array(
119 | 'user_id' => $user->id,
120 | 'domain' => '',
121 | 'published' => 1,
122 | 'id' => '',
123 | 'task' => 'save',
124 | 'c' => 'key',
125 | 'ret' => 'index.php?option=com_api&view=keys',
126 | 'option' => 'com_api',
127 | JSession::getFormToken() => 1
128 | );
129 | $result = $kmodel->save($data);
130 | $key = $result->hash;
131 | $userid = $result->user_id;
132 | }
133 |
134 | $obj = new stdclass;
135 |
136 | if (!empty($user->id))
137 | {
138 | $obj->success = 1;
139 | $obj->userid = $user->id;
140 | $obj->key = $key;
141 | $obj->url = JURI::base() . 'index.php';
142 | }
143 | else
144 | {
145 | $obj->success = 0;
146 | $obj->data = JText::_("COM_JTICKETING_INVALID_USER_PASSWORD");
147 | }
148 |
149 | return ($obj);
150 | }
151 |
152 | /**
153 | * function to get user name
154 | *
155 | * @param object $username name of user
156 | *
157 | * @return void
158 | *
159 | * @since 1.0
160 | */
161 | public function getUserId($username)
162 | {
163 | $db = JFactory::getDBO();
164 | $query = "SELECT u.id FROM #__users AS u WHERE u.username = '{$username}'";
165 | $db->setQuery($query);
166 |
167 | return $id = $db->loadResult();
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/jticketing/language/en-GB/en-GB.plg_api_jticket.ini:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/redshop/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techjoomla/com_api-plugins/b1af3fe1f835eafd9d0beeb9c830d2a9640b61e7/redshop/index.html
--------------------------------------------------------------------------------
/redshop/redshop.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 |
13 | class plgApiRedshop extends ApiPlugin
14 | {
15 | public function __construct()
16 | {
17 | parent::__construct();
18 |
19 | ApiResource::addIncludePath(dirname(__FILE__).'/redshop');
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/redshop/redshop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - Redshop
4 | 1.0
5 | 10/11/2014
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | This plugin exposes com_redshop to the Joomla! API
12 |
13 |
14 | redshop.php
15 | redshop
16 |
17 |
18 |
--------------------------------------------------------------------------------
/redshop/redshop/helper.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | class Sale_Data
10 | {
11 | function __construct()
12 | {
13 |
14 | }
15 | public function total($startdate,$enddate)
16 | {
17 | $db = JFactory::getDBO();
18 |
19 | $query = "SELECT SUM(order_total)
20 | FROM #__redshop_orders
21 | WHERE DATE(FROM_UNIXTIME(mdate)) BETWEEN '".$startdate."'AND '".$enddate."'
22 | AND order_status='s' AND order_payment_status='Paid'";
23 |
24 |
25 | $db->setQuery( $query );
26 | $total = $db->loadResult();
27 | if(!$total)
28 | {
29 | $total = 0;
30 | }
31 | //$total = number_format($total, 2, '.', '');
32 |
33 | return $total;
34 |
35 |
36 | }
37 | public function projected_sale($startdate,$enddate,$total)
38 | {
39 | $db = JFactory::getDBO();
40 | $query = "SELECT DATEDIFF('".$enddate."', '".$startdate."')+1";
41 | $db->setQuery( $query );
42 | $tday = $db->loadResult();
43 | $tday = $tday;
44 | $query = "SELECT DATEDIFF(CURDATE(),'".$startdate."')+1";
45 | $db->setQuery( $query );
46 | $day = $db->loadResult();
47 | if($tday==0)
48 | {
49 | $tday=1;
50 | }
51 | if($day==0)
52 | {
53 | $day=1;
54 | }
55 | //calculation of projected_sale
56 |
57 | $projected_sale = $total/$day*$tday;
58 |
59 | return $projected_sale;
60 |
61 |
62 | }
63 | public function compress($value)
64 | {
65 | if($value>9999)
66 | {
67 | $value = $value/1000;
68 | $value = number_format($value, 2, '.', '');
69 | $value .='K';
70 | return $value;
71 | }
72 | else if($value>=99999)
73 | {
74 | $value = $value/100000;
75 | $value .='Lc';
76 | return $value;
77 | }
78 | $value = number_format($value, 2, '.', '');
79 | return $value;
80 | }
81 |
82 |
83 | }
84 |
85 |
86 |
87 | ?>
88 |
--------------------------------------------------------------------------------
/redshop/redshop/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techjoomla/com_api-plugins/b1af3fe1f835eafd9d0beeb9c830d2a9640b61e7/redshop/redshop/index.html
--------------------------------------------------------------------------------
/socialads/socialads.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 |
13 | class plgAPISocialads extends ApiPlugin
14 | {
15 | public function __construct()
16 | {
17 | parent::__construct();
18 |
19 | ApiResource::addIncludePath(dirname(__FILE__).'/socialads');
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/socialads/socialads.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Api - Socialads
4 | 1.0
5 | November 2011
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | This plugin exposes com_socialads to the Joomla! API
12 |
13 |
14 | socialads.php
15 | socialads/summary.php
16 | socialads/details.php
17 | socialads/helper.php
18 | socialads
19 |
20 |
21 |
--------------------------------------------------------------------------------
/socialads/socialads/details.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | defined('_JEXEC') or die( 'Restricted access' );
9 |
10 | //include(JURI::base());
11 | jimport('joomla.plugin.plugin');
12 |
13 | class SocialadsApiResourceDetails extends ApiResource
14 | {
15 | public function get()
16 | {
17 |
18 | }
19 |
20 | public function post()
21 | {
22 | $db = JFactory::getDBO();
23 |
24 | require_once(dirname(__FILE__).DS.'helper.php');
25 |
26 | //get date from app
27 | $startdate = JRequest::getVar('startdate');
28 | $enddate = JRequest::getVar('enddate');
29 |
30 | $startdate .= ' 00:00:00';
31 | $enddate .= ' 23:59:59';
32 |
33 | $sdate = $startdate;
34 | $edate = $enddate;
35 |
36 | //get offset value
37 | $config =& JFactory::getConfig();
38 | $offset = $config->getValue('config.offset');
39 |
40 | $startdate= & JFactory::getDate($startdate,$offset);
41 | $enddate= & JFactory::getDate($enddate,$offset);
42 | $startdate = $startdate->toFormat('%F %T');
43 | $enddate = $enddate->toFormat('%F %T');
44 |
45 | //query for product details
46 |
47 |
48 | $query = "SELECT a.ad_id,a.ad_title AS product_name,SUM(b.ad_amount)AS product_sales
49 | FROM #__ad_data AS a,#__ad_payment_info AS b WHERE a.ad_id
50 | IN (SELECT c.ad_id FROM #__ad_payment_info AS c
51 | WHERE status='1' AND b.mdate
52 | BETWEEN '".$startdate."'AND '".$enddate."')
53 | AND a.ad_id = b.ad_id
54 | GROUP BY a.ad_title ORDER BY product_sales DESC";
55 |
56 | $db->setQuery( $query );
57 | $details['data'] =array($db->loadObjectList());
58 |
59 | $i = 0;
60 | while(count($details['data'][0])>=$i)
61 | {
62 | $value = $details['data'][0][$i]->product_sales;
63 | $value = number_format($value, 2, '.', '');
64 |
65 | if($details['data'][0][$i]->product_sales > 9999)
66 | {
67 | $value = $details['data'][0][$i]->product_sales/1000;
68 | $value = number_format($value, 2, '.', '');
69 | $value .='K';
70 | $details['data'][0][$i]->product_sales = $value;
71 |
72 | }
73 |
74 | $i++;
75 | }
76 |
77 | $total = Sale_Data::total($startdate,$enddate);
78 | $projected_sale = Sale_Data::projected_sale($sdate,$edate,$total);
79 | $total = Sale_Data::compress($total);
80 | $projected_sale = Sale_Data::compress($projected_sale);
81 |
82 | $details['total'] =array("total"=>$total);
83 | $details['projected_sale'] =array("projected_sale"=>$projected_sale);
84 |
85 | $this->plugin->setResponse( $details );
86 |
87 | //$this->plugin->setResponse( 'This is a post request.' );
88 | }
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/socialads/socialads/helper.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 | class Sale_Data
9 | {
10 | function __construct()
11 | {
12 |
13 | }
14 | public function total($startdate,$enddate)
15 | {
16 | $db = JFactory::getDBO();
17 |
18 | $query = "SELECT SUM(ad_amount) FROM #__ad_payment_info
19 | WHERE status = 1 AND mdate
20 | BETWEEN '".$startdate."'AND '".$enddate."'";
21 |
22 |
23 | $db->setQuery( $query );
24 | $total = $db->loadResult();
25 | if(!$total)
26 | {
27 | $total = 0;
28 | }
29 | //$total = number_format($total, 2, '.', '');
30 |
31 | return $total;
32 |
33 |
34 | }
35 | public function projected_sale($startdate,$enddate,$total)
36 | {
37 | $db = JFactory::getDBO();
38 | $query = "SELECT DATEDIFF('".$enddate."', '".$startdate."')+1";
39 | $db->setQuery( $query );
40 | $tday = $db->loadResult();
41 | $tday = $tday;
42 | $query = "SELECT DATEDIFF(CURDATE(),'".$startdate."')+1";
43 | $db->setQuery( $query );
44 | $day = $db->loadResult();
45 | if($tday==0)
46 | {
47 | $tday=1;
48 | }
49 | if($day==0)
50 | {
51 | $day=1;
52 | }
53 | //calculation of projected_sale
54 |
55 | $projected_sale = $total/$day*$tday;
56 |
57 | return $projected_sale;
58 |
59 |
60 | }
61 | public function compress($value)
62 | {
63 | if($value>9999)
64 | {
65 | $value = $value/1000;
66 | $value = number_format($value, 2, '.', '');
67 | $value .='K';
68 | return $value;
69 | }
70 | else if($value>=99999)
71 | {
72 | $value = $value/100000;
73 | $value .='Lc';
74 | return $value;
75 | }
76 | $value = number_format($value, 2, '.', '');
77 | return $value;
78 | }
79 |
80 |
81 | }
82 |
83 |
84 |
85 | ?>
86 |
--------------------------------------------------------------------------------
/socialads/socialads/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/users/language/en-GB/en-GB.plg_api_users.ini:
--------------------------------------------------------------------------------
1 | PLG_API_USERS="API - Users"
2 | PLG_API_USERS_DESCRIPTION="This plugin exposes users to the Joomla! API. Supports creation, listing and login for users."
3 | PLG_API_USERS_BAD_REQUEST_MESSAGE="Bad request"
4 | PLG_API_USERS_REQUIRED_DATA_EMPTY_MESSAGE="Required data is empty"
5 | PLG_API_USERS_ACCOUNT_CREATED_SUCCESSFULLY_MESSAGE="Congratulations! Your account has been created successfully"
6 | PLG_API_USERS_PROFILE_CREATED_SUCCESSFULLY_MESSAGE="profile created successfully"
7 | PLG_API_USERS_UNABLE_CREATE_PROFILE_MESSAGE="Unable to create profile"
8 | PLG_API_USERS_EASYSOCIAL_NOT_INSTALL_MESSAGE="Easysocial is not installed properly"
9 | PLG_API_USERS_GET_METHOD_NOT_ALLOWED_MESSAGE="Get method not allowed, Use post method"
10 | PLG_API_USERS_USER_NOT_FOUND_MESSAGE="User not found"
11 | PLG_API_USERS_IN_DELETE_FUNCTION_MESSAGE="in delete function"
12 |
13 | PLG_API_USERS_UNSUPPORTED_METHOD="unsupported method,please use post method"
14 | PLG_API_USERS_UNSUPPORTED_METHOD_POST="unsupported method,please use get method"
15 | PLG_API_USERS_USERS="users/"
16 | PLG_API_USERS_IN_DELETE="in delete"
17 | PLG_API_USERS_IN_POST="in post"
18 |
--------------------------------------------------------------------------------
/users/language/en-GB/en-GB.plg_api_users.sys.ini:
--------------------------------------------------------------------------------
1 | ; Joomla! Project
2 | ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved.
3 | ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
4 | ; Note : All ini files need to be saved as UTF-8
5 |
6 | PLG_API_USERS="API - Users"
7 | PLG_API_USERS_DESCRIPTION="This plugin exposes users to the Joomla! API. Supports creation, listing and login for users."
8 |
9 |
--------------------------------------------------------------------------------
/users/users.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 |
13 | class plgAPIUsers extends ApiPlugin
14 | {
15 | public function __construct(&$subject, $config = array())
16 | {
17 | parent::__construct($subject, $config = array());
18 |
19 | ApiResource::addIncludePath(dirname(__FILE__).'/users');
20 |
21 | /*load language file for plugin frontend*/
22 | $lang = JFactory::getLanguage();
23 | $lang->load('plg_api_users', JPATH_ADMINISTRATOR,'',true);
24 |
25 | // Set the login resource to be public
26 | $this->setResourceAccess('login', 'public','get');
27 | $this->setResourceAccess('users', 'public', 'post');
28 | $this->setResourceAccess('config', 'public', 'get');
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/users/users.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | PLG_API_USERS
4 | 1.8.7
5 | 10/11/2014
6 | Techjoomla
7 | extensions@techjoomla.com
8 | www.techjoomla.com
9 | Techjoomla. All rights reserved.
10 | http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
11 | PLG_API_USERS_DESCRIPTION
12 |
13 | users.php
14 | users
15 |
16 |
17 | en-GB/en-GB.plg_api_users.ini
18 | en-GB/en-GB.plg_api_users.sys.ini
19 |
20 |
21 |
22 |
23 |
24 | No
25 | Yes
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/users/users/login.php:
--------------------------------------------------------------------------------
1 |
6 | * @link http://www.techjoomla.com
7 | */
8 |
9 | defined('_JEXEC') or die( 'Restricted access' );
10 |
11 | jimport('joomla.plugin.plugin');
12 | jimport('joomla.html.html');
13 | jimport('joomla.application.component.controller');
14 | jimport('joomla.application.component.model');
15 | jimport('joomla.user.helper');
16 | jimport('joomla.user.user');
17 | jimport('joomla.application.component.helper');
18 |
19 | JModelLegacy::addIncludePath(JPATH_SITE . 'components/com_api/models');
20 | require_once JPATH_SITE . '/components/com_api/libraries/authentication/user.php';
21 | require_once JPATH_SITE . '/components/com_api/libraries/authentication/login.php';
22 | require_once JPATH_SITE . '/components/com_api/models/key.php';
23 | require_once JPATH_SITE . '/components/com_api/models/keys.php';
24 |
25 | class UsersApiResourceLogin extends ApiResource
26 | {
27 | public function get()
28 | {
29 | $this->plugin->setResponse( JText::_('PLG_API_USERS_GET_METHOD_NOT_ALLOWED_MESSAGE'));
30 | }
31 |
32 | public function post()
33 | {
34 | $this->plugin->setResponse($this->keygen());
35 | }
36 |
37 | public function keygen()
38 | {
39 | //init variable
40 | $obj = new stdclass;
41 | $umodel = new JUser;
42 | $user = $umodel->getInstance();
43 |
44 | $app = JFactory::getApplication();
45 | $username = $app->input->get('username', 0, 'STRING');
46 |
47 | $user = JFactory::getUser();
48 | $id = JUserHelper::getUserId($username);
49 |
50 | if($id == null)
51 | {
52 | $model = FD::model('Users');
53 | $id = $model->getUserId('email', $username);
54 | }
55 |
56 | $kmodel = new ApiModelKey;
57 | $model = new ApiModelKeys;
58 | $key = null;
59 | // Get login user hash
60 | //$kmodel->setState('user_id', $user->id);
61 | $kmodel->setState('user_id', $id);
62 | $log_hash = $kmodel->getList();
63 | $log_hash = (!empty($log_hash))?$log_hash[count($log_hash) - count($log_hash)]:$log_hash;
64 |
65 | if( !empty($log_hash) )
66 | {
67 | $key = $log_hash->hash;
68 | }
69 | elseif( $key == null || empty($key) )
70 | {
71 | // Create new key for user
72 | $data = array(
73 | 'userid' => $user->id,
74 | 'domain' => '' ,
75 | 'state' => 1,
76 | 'id' => '',
77 | 'task' => 'save',
78 | 'c' => 'key',
79 | 'ret' => 'index.php?option=com_api&view=keys',
80 | 'option' => 'com_api',
81 | JSession::getFormToken() => 1
82 | );
83 |
84 | $result = $kmodel->save($data);
85 | $key = $result->hash;
86 |
87 | //add new key in easysocial table
88 | $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
89 | if (JFile::exists($easyblog) && JComponentHelper::isEnabled('com_easysocial', true))
90 | {
91 | $this->updateEauth( $user , $key );
92 | }
93 | }
94 |
95 | if( !empty($key) )
96 | {
97 | $obj->auth = $key;
98 | $obj->code = '200';
99 | //$obj->id = $user->id;
100 | $obj->id = $id;
101 | }
102 | else
103 | {
104 | $obj->code = 403;
105 | $obj->message = JText::_('PLG_API_USERS_BAD_REQUEST_MESSAGE');
106 | }
107 | return( $obj );
108 |
109 | }
110 |
111 | /*
112 | * function to update Easyblog auth keys
113 | */
114 | public function updateEauth($user=null,$key=null)
115 | {
116 | require_once JPATH_ADMINISTRATOR.'/components/com_easysocial/includes/foundry.php';
117 | $model = FD::model('Users');
118 | $id = $model->getUserId('username', $user->username);
119 | $user = FD::user($id);
120 | $user->alias = $user->username;
121 | $user->auth = $key;
122 | $user->store();
123 |
124 | return $id;
125 | }
126 | }
127 |
--------------------------------------------------------------------------------