diff --git a/aec/aec.php b/aec/aec.php index caebfd7..7b59d07 100755 --- a/aec/aec.php +++ b/aec/aec.php @@ -1,12 +1,10 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); diff --git a/aec/aec.xml b/aec/aec.xml index 6f9eaf7..d383848 100755 --- a/aec/aec.xml +++ b/aec/aec.xml @@ -2,12 +2,12 @@ Api - aec 1.0 - Jan 2013 - Tekdi - support@tekdi.com - http://www.tekdi.com - 2012 users - GNU General Public License v2 + 10/11/2014 + Techjoomla + extensions@techjoomla.com + www.techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL API plugins of AEC components of the Joomla! diff --git a/aec/aec/createuser.php b/aec/aec/createuser.php index 9e4579b..2adbb61 100755 --- a/aec/aec/createuser.php +++ b/aec/aec/createuser.php @@ -1,11 +1,9 @@ + * @link http://www.techjoomla.com */ defined('_JEXEC') or die( 'Restricted access' ); diff --git a/aec/aec/planslist.php b/aec/aec/planslist.php index 7b845df..d10ce8b 100755 --- a/aec/aec/planslist.php +++ b/aec/aec/planslist.php @@ -1,12 +1,10 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die; diff --git a/aec/aec/setexpiration.php b/aec/aec/setexpiration.php index e0101f7..1be4040 100755 --- a/aec/aec/setexpiration.php +++ b/aec/aec/setexpiration.php @@ -1,12 +1,10 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die; diff --git a/aec/aec/setusertoplan.php b/aec/aec/setusertoplan.php index 8938f50..74c7b47 100755 --- a/aec/aec/setusertoplan.php +++ b/aec/aec/setusertoplan.php @@ -1,12 +1,10 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die; diff --git a/aec/aec/userlist.php b/aec/aec/userlist.php index 6b5c8e2..c6dda3b 100755 --- a/aec/aec/userlist.php +++ b/aec/aec/userlist.php @@ -1,17 +1,14 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die; jimport('joomla.plugin.plugin'); -//function in file - /var/www/mppronline/administrator/components/com_acctexp/admin.acctexp.php class AecApiResourceUserlist extends ApiResource diff --git a/easyblog/easyblog.php b/easyblog/easyblog.php index d59f852..b4da237 100644 --- a/easyblog/easyblog.php +++ b/easyblog/easyblog.php @@ -1,12 +1,10 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); diff --git a/easyblog/easyblog.xml b/easyblog/easyblog.xml index 5a521ef..06d6dde 100644 --- a/easyblog/easyblog.xml +++ b/easyblog/easyblog.xml @@ -2,12 +2,12 @@ Api - Easyblog 1.2 - July 2014 - techjoomla - contact@techjoomla.com - http://techjoomla.com - Techjoomla - GNU General Public License v2 + 10/11/2014 + Techjoomla + extensions@techjoomla.com + www.techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL Easyblog APIs script.php diff --git a/easyblog/easyblog/blog.php b/easyblog/easyblog/blog.php index 9d69105..045ff08 100644 --- a/easyblog/easyblog/blog.php +++ b/easyblog/easyblog/blog.php @@ -1,7 +1,12 @@ + * @link http://www.techjoomla.com +*/ + defined('_JEXEC') or die( 'Restricted access' ); -//error_reporting(E_ALL); -//ini_set('display_errors', 1); jimport('joomla.user.user'); jimport( 'simpleschema.category' ); diff --git a/easyblog/easyblog/category.php b/easyblog/easyblog/category.php index ff02e93..e5ab76e 100644 --- a/easyblog/easyblog/category.php +++ b/easyblog/easyblog/category.php @@ -1,7 +1,11 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); -//error_reporting(E_ALL); -//ini_set('display_errors', 1); jimport('joomla.user.user'); jimport( 'simpleschema.category' ); diff --git a/easyblog/easyblog/comments.php b/easyblog/easyblog/comments.php index 19f8409..eb8d2bd 100644 --- a/easyblog/easyblog/comments.php +++ b/easyblog/easyblog/comments.php @@ -1,7 +1,11 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); -//error_reporting(E_ALL); -//ini_set('display_errors', 1); jimport('joomla.user.user'); jimport( 'simpleschema.person' ); diff --git a/easyblog/easyblog/image.php b/easyblog/easyblog/image.php index cf8a911..f02178a 100644 --- a/easyblog/easyblog/image.php +++ b/easyblog/easyblog/image.php @@ -1,7 +1,11 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); -//error_reporting(E_ALL); -//ini_set('display_errors', 1); jimport('joomla.user.user'); require_once( EBLOG_CONTROLLERS . '/media.php' ); diff --git a/easyblog/easyblog/latest.php b/easyblog/easyblog/latest.php index f8c57c8..efac3fa 100644 --- a/easyblog/easyblog/latest.php +++ b/easyblog/easyblog/latest.php @@ -1,7 +1,11 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); -//error_reporting(E_ALL); -//ini_set('display_errors', 1); jimport('joomla.user.user'); jimport( 'simpleschema.category' ); diff --git a/easyblog/libraries/simpleschema/blog/comment.php b/easyblog/libraries/simpleschema/blog/comment.php index 9d76219..028a66b 100644 --- a/easyblog/libraries/simpleschema/blog/comment.php +++ b/easyblog/libraries/simpleschema/blog/comment.php @@ -1,5 +1,10 @@ + * @link http://www.techjoomla.com +*/ class CommentSimpleSchema { public $commentid; diff --git a/easyblog/libraries/simpleschema/blog/post.php b/easyblog/libraries/simpleschema/blog/post.php index 3dab57c..9455145 100644 --- a/easyblog/libraries/simpleschema/blog/post.php +++ b/easyblog/libraries/simpleschema/blog/post.php @@ -1,4 +1,10 @@ + * @link http://www.techjoomla.com +*/ jimport('simpleschema.person'); jimport('simpleschema.category'); diff --git a/easyblog/libraries/simpleschema/category.php b/easyblog/libraries/simpleschema/category.php index fa437a6..2b4357a 100644 --- a/easyblog/libraries/simpleschema/category.php +++ b/easyblog/libraries/simpleschema/category.php @@ -1,4 +1,10 @@ + * @link http://www.techjoomla.com +*/ class CategorySimpleSchema { diff --git a/easyblog/libraries/simpleschema/person.php b/easyblog/libraries/simpleschema/person.php index e0eacb3..ad559a4 100644 --- a/easyblog/libraries/simpleschema/person.php +++ b/easyblog/libraries/simpleschema/person.php @@ -1,4 +1,10 @@ + * @link http://www.techjoomla.com +*/ class PersonSimpleSchema { diff --git a/easyblog/script.php b/easyblog/script.php index c6955db..2014a8a 100644 --- a/easyblog/script.php +++ b/easyblog/script.php @@ -1,4 +1,10 @@ + * @link http://www.techjoomla.com +*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); diff --git a/easysocial/easysocial.php b/easysocial/easysocial.php new file mode 100644 index 0000000..b1b1c79 --- /dev/null +++ b/easysocial/easysocial.php @@ -0,0 +1,21 @@ + + * @link http://www.techjoomla.com +*/ +defined('_JEXEC') or die( 'Restricted access' ); + +jimport('joomla.plugin.plugin'); + +class plgAPIEasysocial extends ApiPlugin +{ + public function __construct() + { + + parent::__construct(); + + ApiResource::addIncludePath(dirname(__FILE__).'/easysocial'); + } +} diff --git a/easysocial/easysocial.xml b/easysocial/easysocial.xml new file mode 100644 index 0000000..078a15c --- /dev/null +++ b/easysocial/easysocial.xml @@ -0,0 +1,18 @@ + + + Api - easysocial + 1.2 + 10/11/2014 + Techjoomla + extensions@techjoomla.com + www.techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + This plugin use for get data from easysocial. + + + easysocial.php + easysocial/friends.php + easysocial + + diff --git a/easysocial/easysocial/friends.php b/easysocial/easysocial/friends.php new file mode 100644 index 0000000..0d8ab58 --- /dev/null +++ b/easysocial/easysocial/friends.php @@ -0,0 +1,108 @@ + + * @link http://www.techjoomla.com +*/ + +defined('_JEXEC') or die( 'Restricted access' ); + +jimport('joomla.plugin.plugin'); +jimport('joomla.html.html'); + +require_once JPATH_ADMINISTRATOR.'/components/com_easysocial/models/friends.php'; +require_once JPATH_ADMINISTRATOR.'/components/com_easysocial/models/avatars.php'; + +class EasysocialApiResourceFriends extends ApiResource +{ + public function get() + { + $this->plugin->setResponse($this->getFriends()); + } + + public function post() + { + $this->plugin->setResponse($this->getFriends()); + } + //function use for get friends data + function getFriends() + { + //init variable + $app = JFactory::getApplication(); + $user = JFactory::getUser($this->plugin->get('user')->id); + $userid = ($app->input->get('userid',0,'INT'))?$app->input->get('userid',0,'INT'):$app->input->post->get('userid',0,'INT'); + + //$search = (isset($app->input->get('search','','STRING')))?$app->input->get('search','','STRING'):$app->input->post->get('search','','STRING'); + $search = $app->input->get('search','','STRING'); + + if($userid == 0) + $userid = $user->id; + + $frnd_mod = new EasySocialModelFriends(); + + //if search word present then search user as per term and given id + if(empty($search)) + { + $ttl_list = $frnd_mod->getFriends($userid); + } + else + { + $ttl_list = $frnd_mod->search($userid,$search,'username'); + } + + $frnd_list = $this->basefrndObj($ttl_list); + + //get other data + foreach($frnd_list as $ky=>$lval) + { + //get mutual friends of given user + if($userid != $user->id) + { + $lval->mutual = $frnd_mod->getMutualFriendCount($userid,$lval->id); + $lval->isFriend = $frnd_mod->isFriends($userid,$lval->id); + //$lval->mutual_frnds = $frnd_mod->getMutualFriends($userid,$lval->id); + } + else + { + $lval->mutual = $frnd_mod->getMutualFriendCount($userid,$lval->id); + $lval->isFriend = true; + } + } + + return( $frnd_list ); + } + + //format friends object into required object + function basefrndObj($data=null) + { + if($data==null) + return 0; + + + $list = array(); + foreach($data as $k=>$node) + { + $obj = new stdclass; + $obj->id = $node->id; + $obj->name = $node->name; + $obj->username = $node->username; + $obj->email = $node->email; + + //$obj->avatar = EasySocialModelAvatars::getPhoto($node->id); + foreach($node->avatars As $ky=>$avt) + { + $avt_key = 'avtar_'.$ky; + $obj->$avt_key = JURI::root().'media/com_easysocial/avatars/users/'.$node->id.'/'.$avt; + } + + $list[] = $obj; + } + + return $list; + + } + + + +} diff --git a/easysocial/easysocial/search.php b/easysocial/easysocial/search.php new file mode 100644 index 0000000..c7bff23 --- /dev/null +++ b/easysocial/easysocial/search.php @@ -0,0 +1,113 @@ + + * @link http://www.techjoomla.com +*/ + +defined('_JEXEC') or die( 'Restricted access' ); + +jimport('joomla.plugin.plugin'); +jimport('joomla.html.html'); + +require_once JPATH_ADMINISTRATOR.'/components/com_easysocial/models/search.php'; +require_once JPATH_ADMINISTRATOR.'/components/com_easysocial/models/avatars.php'; +require_once JPATH_ADMINISTRATOR.'/components/com_easysocial/models/friends.php'; +require_once JPATH_ROOT . '/components/com_finder/models/search.php'; + +class EasysocialApiResourceSearch extends ApiResource +{ + public function get() + { + $this->plugin->setResponse($this->getSearch()); + } + + public function post() + { + $this->plugin->setResponse($this->getSearch()); + } + //function use for get friends data + function getSearch() + { + //init variable + $app = JFactory::getApplication(); + $log_user = JFactory::getUser($this->plugin->get('user')->id); + + $nxt_lim = 20; + + $search = $app->input->post->get('search','','STRING'); + $nxt_lim = $app->input->get('next_limit',0,'INT'); + + $userid = $log_user->id; + + $serch_obj = new EasySocialModelSearch(); + + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $frnd_obj = new EasySocialModelFriends(); + + $query->select($db->quoteName(array('su.user_id'))); + $query->from($db->quoteName('#__social_users','su')); + $query->join('LEFT', $db->quoteName('#__users', 'u') . ' ON (' . $db->quoteName('su.user_id') . ' = ' . $db->quoteName('u.id') . ')'); + //->where(($db->quoteName('u.username') . ' LIKE '. $db->quote('\'% '.$search.'%\'') ).'OR' .( $db->quoteName('u.name') . ' LIKE '. $db->quote('\'%'.$search.'%\'') ).'OR'.( $db->quoteName('u.email') . ' LIKE '. $db->quote('\'%'.$search.'%\''))) + + if(!empty($search)) + { + $query->where("(u.username LIKE '%".$search."%' ) OR ( u.name LIKE '%".$search."%') OR ( u.email LIKE '%".$search."%')"); + } + + $query->order($db->quoteName('u.id') .'ASC'); + + $db->setQuery($query); + $tdata = $db->loadObjectList(); + + $susers = array(); + foreach($tdata as $ky=>$val) + { + $susers[] = FD::user($val->user_id); + } + + $frnd_list = $this->basefrndObj($susers); + + return( $frnd_list ); + + } + + //format friends object into required object + function basefrndObj($data=null) + { + if($data==null) + return 0; + + $user = JFactory::getUser($this->plugin->get('user')->id); + $frnd_mod = new EasySocialModelFriends(); + $list = array(); + foreach($data as $k=>$node) + { + $obj = new stdclass; + $obj->id = $node->id; + $obj->name = $node->name; + $obj->username = $node->username; + $obj->email = $node->email; + + //$obj->avatar = EasySocialModelAvatars::getPhoto($node->id); + foreach($node->avatars As $ky=>$avt) + { + $avt_key = 'avtar_'.$ky; + $obj->$avt_key = JURI::root().'media/com_easysocial/avatars/users/'.$node->id.'/'.$avt; + } + + $obj->mutual = $frnd_mod->getMutualFriendCount($user->id,$node->id); + $obj->isFriend = $frnd_mod->isFriends($user->id,$node->id); + + $list[] = $obj; + } + + return $list; + + } + + + +} diff --git a/redshop/redshop.php b/redshop/redshop.php index 2304e8b..22e3d14 100755 --- a/redshop/redshop.php +++ b/redshop/redshop.php @@ -1,12 +1,10 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); diff --git a/redshop/redshop.xml b/redshop/redshop.xml index ed4e3fd..7fd544e 100755 --- a/redshop/redshop.xml +++ b/redshop/redshop.xml @@ -1,13 +1,13 @@ - Api_Redshop + Api - Redshop 1.0 - November 2011 - Reportoise - support@reportoise.com - http://www.reportoise.com - 2011 Reportoise - GNU General Public License v2 + 10/11/2014 + Techjoomla + extensions@techjoomla.com + www.techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL This plugin exposes com_redshop to the Joomla! API diff --git a/redshop/redshop/details.php b/redshop/redshop/details.php index e72d352..91bb539 100755 --- a/redshop/redshop/details.php +++ b/redshop/redshop/details.php @@ -1,11 +1,9 @@ + * @link http://www.techjoomla.com */ defined('_JEXEC') or die( 'Restricted access' ); diff --git a/redshop/redshop/helper.php b/redshop/redshop/helper.php index b24a475..37bd3dd 100755 --- a/redshop/redshop/helper.php +++ b/redshop/redshop/helper.php @@ -1,4 +1,11 @@ - + * @link http://www.techjoomla.com +*/ + class Sale_Data { function __construct() diff --git a/redshop/redshop/summary.php b/redshop/redshop/summary.php index eb3cc4d..f33cd64 100755 --- a/redshop/redshop/summary.php +++ b/redshop/redshop/summary.php @@ -1,13 +1,10 @@ + * @link http://www.techjoomla.com */ - defined('_JEXEC') or die( 'Restricted access' ); jimport('joomla.plugin.plugin'); diff --git a/socialads/socialads.php b/socialads/socialads.php index cfcc93f..24f08f0 100755 --- a/socialads/socialads.php +++ b/socialads/socialads.php @@ -1,12 +1,10 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); diff --git a/socialads/socialads.xml b/socialads/socialads.xml index 725fcfe..8a57df0 100755 --- a/socialads/socialads.xml +++ b/socialads/socialads.xml @@ -3,11 +3,11 @@ Api - Socialads 1.0 November 2011 - Reportoise - support@reportoise.com - http://www.reportoise.com - 2011 Reportoise - GNU General Public License v2 + Techjoomla + extensions@techjoomla.com + www.techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL This plugin exposes com_socialads to the Joomla! API diff --git a/socialads/socialads/details.php b/socialads/socialads/details.php index 719864d..24b2875 100755 --- a/socialads/socialads/details.php +++ b/socialads/socialads/details.php @@ -1,13 +1,10 @@ + * @link http://www.techjoomla.com */ - defined('_JEXEC') or die( 'Restricted access' ); //include(JURI::base()); diff --git a/socialads/socialads/helper.php b/socialads/socialads/helper.php index 1a0dfa1..4d715dd 100644 --- a/socialads/socialads/helper.php +++ b/socialads/socialads/helper.php @@ -1,4 +1,10 @@ - + * @link http://www.techjoomla.com +*/ class Sale_Data { function __construct() diff --git a/socialads/socialads/summary.php b/socialads/socialads/summary.php index 49902cf..5a4919f 100755 --- a/socialads/socialads/summary.php +++ b/socialads/socialads/summary.php @@ -1,13 +1,10 @@ + * @link http://www.techjoomla.com */ - defined('_JEXEC') or die( 'Restricted access' ); jimport('joomla.plugin.plugin'); diff --git a/users/users.php b/users/users.php index 68615c7..24af4da 100755 --- a/users/users.php +++ b/users/users.php @@ -1,24 +1,22 @@ + * @link http://www.techjoomla.com +*/ defined('_JEXEC') or die( 'Restricted access' ); jimport('joomla.plugin.plugin'); -class plgAPIUsers extends ApiPlugin +class plgAPIPlg_api_users extends ApiPlugin { public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config = array()); - ApiResource::addIncludePath(dirname(__FILE__).'/users'); + ApiResource::addIncludePath(dirname(__FILE__).'/plg_api_users'); // Set the login resource to be public $this->setResourceAccess('login', 'public'); diff --git a/users/users.xml b/users/users.xml index 1a4c974..bb55da5 100755 --- a/users/users.xml +++ b/users/users.xml @@ -1,17 +1,17 @@ - Api - users - 1.0 - July 2014 - techjoomla - contact@techjoomla.com - http://techjoomla.com - Techjoomla - GNU General Public License v2 - This plugin exposes users to the Joomla! API + Api - Users + 1.2 + 10/11/2014 + Techjoomla + extensions@techjoomla.com + www.techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + This plugin exposes users to the Joomla! API. Supports creation, listing and login for users. - users.php - users + plg_api_users.php + plg_api_users diff --git a/users/users/login.php b/users/users/login.php new file mode 100644 index 0000000..7c4eaa8 --- /dev/null +++ b/users/users/login.php @@ -0,0 +1,112 @@ + + * @link http://www.techjoomla.com +*/ + +defined('_JEXEC') or die( 'Restricted access' ); + +jimport('joomla.plugin.plugin'); +jimport('joomla.html.html'); +jimport('joomla.application.component.controller'); +jimport('joomla.application.component.model'); +jimport('joomla.user.helper'); +jimport('joomla.user.user'); +jimport('joomla.application.component.helper'); + +JModelLegacy::addIncludePath(JPATH_SITE.'components/com_api/models'); +require_once JPATH_SITE.'/components/com_api/libraries/authentication/user.php'; +require_once JPATH_SITE.'/components/com_api/libraries/authentication/login.php'; +require_once JPATH_SITE.'/components/com_api/models/key.php'; +require_once JPATH_SITE.'/components/com_api/models/keys.php'; + +class UsersApiResourceLogin extends ApiResource +{ + public function get() + { + $this->plugin->setResponse("unsupported method,please use post method"); + } + + public function post() + { + $this->plugin->setResponse($this->keygen()); + } + + function keygen() + { + //init variable + $obj = new stdclass; + $umodel = new JUser; + $user = $umodel->getInstance(); + + if( !$user->id ) + { + $user = JFactory::getUser($this->plugin->get('user')->id); + } + + $kmodel = new ApiModelKey; + $model = new ApiModelKeys; + $key = null; + // Get login user hash + $kmodel->setState('user_id', $user->id); + $log_hash = $kmodel->getList(); + $log_hash = $log_hash[count($log_hash) - count($log_hash)]; + + if( $log_hash->hash ) + { + $key = $log_hash->hash; + } + elseif( $key == null || empty($key) ) + { + // Create new key for user + $data = array( + 'userid' => $user->id, + 'domain' => '' , + 'state' => 1, + 'id' => '', + 'task' => 'save', + 'c' => 'key', + 'ret' => 'index.php?option=com_api&view=keys', + 'option' => 'com_api', + JSession::getFormToken() => 1 + ); + + $result = $kmodel->save($data); + $key = $result->hash; + //add new key in easysocial table + if(JComponentHelper::isEnabled('com_easysocial', true)) + { + $this->updateEauth( $user , $key ); + } + } + + if( !empty($key) ) + { + $obj->auth = $key; + $obj->code = '200'; + $obj->id = $user->id; + } + else + { + $obj->code = 403; + $obj->message = 'Bad request'; + } + return( $obj ); + } + /* + * function for update easyblog keys + * / + public function updateEauth($user=null,$key=null) + { + require_once JPATH_ADMINISTRATOR.'/components/com_easysocial/includes/foundry.php'; + $model = FD::model('Users'); + $id = $model->getUserId('username', $user->username); + $user = FD::user($id); + $user->alias = $user->username; + $user->auth = $key; + $user->store(); + return $id; + } +} diff --git a/users/users/users.php b/users/users/users.php index ef42bb1..fe52934 100755 --- a/users/users/users.php +++ b/users/users/users.php @@ -1,5 +1,11 @@ + * @link http://www.techjoomla.com +*/ + defined('_JEXEC') or die( 'Restricted access' ); jimport('joomla.user.user');