public static function getListJobCateg() { $select = JblanceHelper::get('helper.select'); // create an instance of the class selectHelper $attribs = "class='form-control'"; $lists = $select->getSelectCategoryTree('id_categ', 0, 'MOD_JBLANCE_SEARCH_ALL', $attribs, '', true); return $lists; }
function getUserGroupField($userid = null) { $app = JFactory::getApplication(); $db = JFactory::getDbo(); $session = JFactory::getSession(); $ugid = $session->get('ugid', 0, 'register'); //user group id during the registration if (empty($ugid)) { if (empty($userid)) { // get the current userid if not passed $user = JFactory::getUser(); $userid = $user->id; } $jbuser = JblanceHelper::get('helper.user'); $ugroup = $jbuser->getUserGroupInfo($userid, null); $ugid = $ugroup->id; } $jbfields = JblanceHelper::get('helper.fields'); // create an instance of the class FieldsHelper $fields = $jbfields->getUserGroupTypeFields($ugid); return $fields; }
" /> <?php echo LinkHelper::getDownloadLink('project', $projfile->id, 'project.download'); ?> </label> <?php } ?> </div> </div> </div> </div> </fieldset> <?php $fields = JblanceHelper::get('helper.fields'); // create an instance of the class fieldsHelper $parents = array(); $children = array(); //isolate parent and childr foreach ($this->fields as $ct) { if ($ct->parent == 0) { $parents[] = $ct; } else { $children[] = $ct; } } if (count($parents)) { foreach ($parents as $pt) { ?> <fieldset>
<?php echo $sealProjectBids || $row->is_sealed ? '-' : $row->bids; ?> </td> <?php } ?> <?php if ($show_avgbid == 1) { ?> <td data-title="<?php echo JText::sprintf('MOD_JBLANCE_AVG_BIDS', $currencycod); ?> " class="text-center"> <?php $projHelper = JblanceHelper::get('helper.project'); // create an instance of the class ProjectHelper $avg = $projHelper->averageBidAmt($row->id); $avg = round($avg, 0); ?> <?php if ($sealProjectBids || $row->is_sealed) { ?> - <?php } else { ?> <?php echo JblanceHelper::formatCurrency($avg, true, false, 0); ?> <span class="font12"><?php
* @contact : www.joombri.in, support@joombri.in * @created on : 27 March 2012 * @file name : views/project/tmpl/rateuser.php * @copyright : Copyright (C) 2012 - 2015 BriTech Solutions. All rights reserved. * @license : GNU General Public License version 2 or later * @author : Faisel * @description : Rate user (jblance) */ defined('_JEXEC') or die('Restricted access'); JHtml::_('jquery.framework'); JHtml::_('behavior.formvalidator'); $doc = JFactory::getDocument(); $doc->addScript("components/com_jblance/js/barrating.js"); $doc->addStyleSheet("components/com_jblance/css/barrating.css"); $project = $this->project; $select = JblanceHelper::get('helper.select'); // create an instance of the class SelectHelper $config = JblanceHelper::getConfig(); $showUsername = $config->showUsername; $nameOrUsername = $showUsername ? 'username' : 'name'; //find the current user is the buyer or freelancer. If the user is buyer, then the target is freelancer and vice versa $user = JFactory::getUser(); if ($user->id == $project->publisher_userid) { $actor = $project->publisher_userid; $target = $project->assigned_userid; $target_rate_type = 'COM_JBLANCE_FREELANCER'; //freelancer is equal to seller } elseif ($user->id == $project->assigned_userid) { $actor = $project->assigned_userid; $target = $project->publisher_userid; $target_rate_type = 'COM_JBLANCE_BUYER';
function updateProgress() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $post = $app->input->post->getArray(); //print_r($post);exit; $now = JFactory::getDate(); $order = JTable::getInstance('serviceorder', 'Table'); $orderId = $app->input->get('id', 0, 'int'); $status = $app->input->get('p_status', '', 'string'); $statusInit = $app->input->get('status_initiated', 0, 'boolean'); if ($statusInit) { $status = 'COM_JBLANCE_INITIATED'; } $order->load($orderId); $order->p_status = $status; $order->p_percent = $post['p_percent']; $order->p_updated = $now->toSql(); //set the started date only for the first time if ($status == 'COM_JBLANCE_INITIATED') { if ($order->p_started == '0000-00-00 00:00:00') { $order->p_started = $now->toSql(); } } elseif ($status == 'COM_JBLANCE_COMPLETED') { if ($order->p_ended == '0000-00-00 00:00:00') { $order->p_ended = $now->toSql(); } } if (!$order->store()) { JError::raiseError(500, $order->getError()); } $order->checkin(); //send service progress notification to buyer $jbmail = JblanceHelper::get('helper.email'); // create an instance of the class EmailHelper if (!empty($status)) { $jbmail->sendServiceProgressNotification($orderId, $order->service_id); } $msg = JText::_('COM_JBLANCE_SERVICE_PROGRESS_UPDATED_SUCCESSFULLY'); $return = JRoute::_('index.php?option=com_jblance&view=service&layout=serviceprogress&id=' . $orderId, false); $this->setRedirect($return, $msg, 'message'); }
* @created on : 11 September 2012 * @file name : views/user/tmpl/notify.php * @copyright : Copyright (C) 2012 - 2015 BriTech Solutions. All rights reserved. * @license : GNU General Public License version 2 or later * @author : Faisel * @description : Email Notification settings (jblance) */ defined('_JEXEC') or die('Restricted access'); JHtml::_('jquery.framework'); $doc = JFactory::getDocument(); $doc->addScript("components/com_jblance/js/btngroup.js"); $user = JFactory::getUser(); $model = $this->getModel(); $select = JblanceHelper::get('helper.select'); // create an instance of the class SelectHelper $jbuser = JblanceHelper::get('helper.user'); $userGroup = $jbuser->getUserGroupInfo($user->id, null); include_once JPATH_COMPONENT . '/views/profilemenu.php'; ?> <div class="jbl_h3title"><?php echo JText::_('COM_JBLANCE_EMAIL_SETTINGS'); ?> </div> <form id="email-notification-form" action="<?php echo JRoute::_('index.php'); ?> " method="post" name="userFormNotify" class="form-validate form-horizontal" enctype="multipart/form-data "> <div id="email-notification" class="panel panel-default"> <div class="panel-heading"><h4><i class="material-icons">notifications</i> <?php echo JText::_('COM_JBLANCE_RECEIVE_INDIVIDUAL_NOTIFICATIONS_WHEN');
function buildPlanInfo($planId) { //initialize variables $jbuser = JblanceHelper::get('helper.user'); // create an instance of the class userHelper $planInfo = $jbuser->getPlanInfo($planId); JHtml::_('bootstrap.tooltip'); //get the plan details for the plan id passed $ugid = $planInfo->ug_id; //get the user group of the plan and thereby, get the usergroup info. $ugInfo = $jbuser->getUserGroupInfo(null, $ugid); $bidPostProjectAllowed = false; if ($ugInfo->allowBidProjects && $ugInfo->allowPostProjects) { $bidPostProjectAllowed = true; } $i = 0; $infos = ''; //get the keys and values for the allowed functions. if ($ugInfo->allowBidProjects) { if ($bidPostProjectAllowed) { $infos[$i] = new stdClass(); $infos[$i]->key = "<span class='lead grey'>" . JText::_('COM_JBLANCE_AS_FREELANCER') . "</span>"; $infos[$i]->value = "<span class='lead grey'> </span>"; $i++; } $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_PROJECT_COMMISSION'); $infos[$i]->value = "<span class=hasTooltip title='" . JText::_('COM_JBLANCE_WHICHEVER_HIGHER') . "'>" . JblanceHelper::formatCurrency($planInfo->flFeeAmtPerProject) . ' ' . JText::_('COM_JBLANCE_OR') . ' ' . $planInfo->flFeePercentPerProject . '%' . "</span>"; //$infos[$i]->value = JblanceHelper::formatCurrency($planInfo->flFeeAmtPerProject).' '.JText::_('COM_JBLANCE_OR').' '.$planInfo->flFeePercentPerProject.'%'; $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_CHARGE_PER_BID'); $infos[$i]->value = $planInfo->flChargePerBid == 0 ? JText::_('COM_JBLANCE_FREE') : JblanceHelper::formatCurrency($planInfo->flChargePerBid); $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_SERVICE_COMMISSION'); $infos[$i]->value = $planInfo->flFeePercentPerService . '%'; $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_CHARGE_PER_SERVICE'); $infos[$i]->value = JblanceHelper::formatCurrency($planInfo->flChargePerService); $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_NUM_PORTFOLIOS_ALLOWED'); $infos[$i]->value = $planInfo->portfolioCount == 0 ? "<img src=" . JURI::root() . "components/com_jblance/images/s0.png width=12 alt=No />" : $planInfo->portfolioCount; $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_NUM_BIDS_ALLOWED'); $infos[$i]->value = $planInfo->flBidCount == 0 ? JText::_('COM_JBLANCE_UNLIMITED') : $planInfo->flBidCount; $i++; } if ($ugInfo->allowPostProjects) { if ($bidPostProjectAllowed) { $infos[$i] = new stdClass(); $infos[$i]->key = "<span class='lead grey'>" . JText::_('COM_JBLANCE_AS_BUYER') . "</span>"; $infos[$i]->value = "<span class='lead grey'> </span>"; $i++; } $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_PROJECT_COMMISSION'); $infos[$i]->value = "<span class=hasTooltip title='" . JText::_('COM_JBLANCE_WHICHEVER_HIGHER') . "'>" . JblanceHelper::formatCurrency($planInfo->buyFeeAmtPerProject) . ' ' . JText::_('COM_JBLANCE_OR') . ' ' . $planInfo->buyFeePercentPerProject . '%' . "</span>"; //$infos[$i]->value = JblanceHelper::formatCurrency($planInfo->buyFeeAmtPerProject).' '.JText::_('COM_JBLANCE_OR').' '.$planInfo->buyFeePercentPerProject.'%'; $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_CHARGE_PER_PROJECT'); $infos[$i]->value = $planInfo->buyChargePerProject == 0 ? JText::_('COM_JBLANCE_FREE') : JblanceHelper::formatCurrency($planInfo->buyChargePerProject); $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_NUM_PROJECTS_ALLOWED'); $infos[$i]->value = $planInfo->buyProjectCount == 0 ? JText::_('COM_JBLANCE_UNLIMITED') : $planInfo->buyProjectCount; $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_FEATURED_PROJECT'); $infos[$i]->value = $planInfo->buyFeePerFeaturedProject == 0 ? JText::_('COM_JBLANCE_FREE') : JblanceHelper::formatCurrency($planInfo->buyFeePerFeaturedProject); $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_URGENT_PROJECT'); $infos[$i]->value = $planInfo->buyFeePerUrgentProject == 0 ? JText::_('COM_JBLANCE_FREE') : JblanceHelper::formatCurrency($planInfo->buyFeePerUrgentProject); $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_PRIVATE_PROJECT'); $infos[$i]->value = $planInfo->buyFeePerPrivateProject == 0 ? JText::_('COM_JBLANCE_FREE') : JblanceHelper::formatCurrency($planInfo->buyFeePerPrivateProject); $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_SEALED_PROJECT'); $infos[$i]->value = $planInfo->buyFeePerSealedProject == 0 ? JText::_('COM_JBLANCE_FREE') : JblanceHelper::formatCurrency($planInfo->buyFeePerSealedProject); $i++; $infos[$i] = new stdClass(); $infos[$i]->key = JText::_('COM_JBLANCE_NDA_PROJECT'); $infos[$i]->value = $planInfo->buyFeePerNDAProject == 0 ? JText::_('COM_JBLANCE_FREE') : JblanceHelper::formatCurrency($planInfo->buyFeePerNDAProject); $i++; } return $infos; }
function saveWithdrawFund() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $user = JFactory::getUser(); $params = $app->input->get('params', null, 'array'); $post = $app->input->post->getArray(); $now = JFactory::getDate(); $row = JTable::getInstance('withdraw', 'Table'); $config = JblanceHelper::getConfig(); $invoiceFormatWithdraw = $config->invoiceFormatWithdraw; //check if the user has enough fund to withdraw $totalFund = JblanceHelper::getTotalFund($user->id); if ($totalFund < $post['amount']) { $msg = JText::_('COM_JBLANCE_BALANCE_INSUFFICIENT_TO_MAKE_PAYMENT'); $link = JRoute::_('index.php?option=com_jblance&view=membership&layout=withdrawfund&step=2&gateway=' . $post['gateway'], false); $this->setRedirect($link, $msg, 'error'); return false; } $row->user_id = $user->id; $row->date_withdraw = $now->toSql(); $row->finalAmount = $post['amount'] - $post['withdrawFee']; $registry = new JRegistry(); $registry->loadArray($params); $row->params = $registry->toString(); unset($post['params']); if (!$row->save($post)) { JError::raiseError(500, $row->getError()); } $year = date("Y"); $time = time(); //replace the tags $tags = array("[ID]", "[USERID]", "[YYYY]", "[TIME]"); $tagsValues = array("{$row->id}", "{$user->id}", "{$year}", "{$time}"); $invoiceNo = str_replace($tags, $tagsValues, $invoiceFormatWithdraw); $row->invoiceNo = $invoiceNo; // save the changes after updating the invoice no if (!$row->store()) { JError::raiseError(500, $row->getError()); } $row->checkin(); //send withdraw request to admin $jbmail = JblanceHelper::get('helper.email'); // create an instance of the class EmailHelper $jbmail->sendWithdrawFundRequest($row->id); $msg = JText::_('COM_JBLANCE_WITHDRAWAL_REQUEST_SENT_SUCCESSFULLY'); $link = JRoute::_('index.php?option=com_jblance&view=membership&layout=managepay', false); $this->setRedirect($link, $msg); return false; }
function getViewProfile() { $app = JFactory::getApplication(); $db = JFactory::getDbo(); $user = JFactory::getUser(); $userid = $app->input->get('id', $user->id, 'int'); //get the user id from 'get' variable; else default is current user id $isUserBlocked = JFactory::getUser($userid)->block; //redirect the user to dashboard if the user is blocked. if ($isUserBlocked == 1) { $msg = JText::_('COM_JBLANCE_USER_ACCOUNT_BANNED_VIEWING_PROFILE_NOT_POSSIBLE'); $link_dash = JRoute::_('index.php?option=com_jblance&view=user&layout=dashboard', false); $app->enqueueMessage($msg, 'error'); $app->redirect($link_dash); } //redirect to the appropriate extension based on integration $profileInteg = JblanceHelper::getProfile(); if (!$profileInteg instanceof JoombriProfileJoombri) { $url = LinkHelper::GetProfileURL($userid, false); if ($url) { $app->redirect($url); } } $jbuser = JblanceHelper::get('helper.user'); // create an instance of the class UserHelper $userInfo = $jbuser->getUser($userid); $jbfields = JblanceHelper::get('helper.fields'); // create an instance of the class FieldsHelper $fields = $jbfields->getUserGroupTypeFields($userInfo->ug_id); //freelancer projects $query = "SELECT p.*,r.comments FROM #__jblance_project p " . "LEFT JOIN #__jblance_rating r ON r.project_id=p.id " . "WHERE p.assigned_userid =" . $db->quote($userid) . " AND p.status='COM_JBLANCE_CLOSED' AND r.target=" . $db->quote($userid) . " " . "ORDER BY p.id DESC LIMIT 10"; $db->setQuery($query); $fprojects = $db->loadObjectList(); //freelancer rating $query = "SELECT AVG(quality_clarity) quality_clarity,AVG(communicate) communicate,AVG(expertise_payment) expertise_payment, " . "AVG(professional) professional,AVG(hire_work_again) hire_work_again FROM #__jblance_rating " . "WHERE target=" . $db->quote($userid) . " AND quality_clarity<>0 AND rate_type='COM_JBLANCE_FREELANCER'"; $db->setQuery($query); $frating = $db->loadObject(); //buyer projects $query = "SELECT p.*,r.comments FROM #__jblance_project p " . "LEFT JOIN #__jblance_rating r ON r.project_id=p.id " . "WHERE p.publisher_userid =" . $db->quote($userid) . " AND r.target=" . $db->quote($userid) . " " . "ORDER BY p.id DESC LIMIT 10"; $db->setQuery($query); $bprojects = $db->loadObjectList(); //buyer rating $query = "SELECT AVG(quality_clarity) quality_clarity,AVG(communicate) communicate,AVG(expertise_payment) expertise_payment, " . "AVG(professional) professional,AVG(hire_work_again) hire_work_again FROM #__jblance_rating " . "WHERE target=" . $db->quote($userid) . " AND quality_clarity <> 0 AND rate_type='COM_JBLANCE_BUYER'"; $db->setQuery($query); $brating = $db->loadObject(); $query = "SELECT * FROM #__jblance_portfolio WHERE user_id =" . $db->quote($userid) . " AND published=1"; $db->setQuery($query); $portfolios = $db->loadObjectList(); $return[0] = $userInfo; $return[1] = $fields; $return[2] = $fprojects; $return[3] = $frating; $return[4] = $bprojects; $return[5] = $brating; $return[6] = $portfolios; return $return; }
function getPlaceBid() { $app = JFactory::getApplication(); $db = JFactory::getDbo(); $user = JFactory::getUser(); $id = $app->input->get('id', 0, 'int'); //id is the "project id" $finance = JblanceHelper::get('helper.finance'); // create an instance of the class FinanceHelper $project = JTable::getInstance('project', 'Table'); $project->load($id); // Project author is allowed to bid on his own project if ($project->publisher_userid == $user->id) { $msg = JText::sprintf('COM_JBLANCE_NOT_ALLOWED_TO_BID_ON_YOUR_OWN_PROJECT'); $link = JRoute::_('index.php?option=com_jblance&view=user&layout=dashboard', false); $app->enqueueMessage($msg, 'error'); $app->redirect($link); return false; } //project in Frozen/Closed should not be allowed to bid if ($project->status != 'COM_JBLANCE_OPEN') { $link = JRoute::_('index.php?option=com_jblance&view=project&layout=listproject', false); $app->redirect($link); return; } //redirect to dashboard if this is private invite project if ($project->is_private_invite) { $invite_ids = explode(',', $project->invite_user_id); if (!in_array($user->id, $invite_ids)) { $msg = JText::_('COM_JBLANCE_THIS_IS_A_PRIVATE_INVITE_PROJECT_VISIBLE_TO_OWNER_INVITEES'); $link_dash = JRoute::_('index.php?option=com_jblance&view=user&layout=dashboard', false); $app->enqueueMessage($msg, 'error'); $app->redirect($link_dash); } } //get the bid id $query = "SELECT id FROM #__jblance_bid WHERE project_id=" . $db->quote($id) . " AND user_id=" . $db->quote($user->id); $db->setQuery($query); $bid_id = $db->loadResult(); $bid = JTable::getInstance('bid', 'Table'); $bid->load($bid_id); //check if the user's plan is expired or not approved. If so, do not allow him to bid new on project $planStatus = JblanceHelper::planStatus($user->id); if (empty($bid_id) && ($planStatus == 1 || $planStatus == 2)) { $msg = JText::sprintf('COM_JBLANCE_NOT_ALLOWED_TO_DO_OPERATION_NO_ACTIVE_SUBSCRIPTION'); $link = JRoute::_('index.php?option=com_jblance&view=user&layout=dashboard', false); $app->enqueueMessage($msg, 'error'); $app->redirect($link); return false; } //check if the user has enough fund to bid new on projects. This should be checked for new bids only $plan = JblanceHelper::whichPlan($user->id); $chargePerBid = $plan->flChargePerBid; if ($chargePerBid > 0 && empty($bid_id)) { // bid_id will be empty for new bids $totalFund = JblanceHelper::getTotalFund($user->id); if ($totalFund < $chargePerBid) { $msg = JText::sprintf('COM_JBLANCE_BALANCE_INSUFFICIENT_TO_BID_PROJECT', JblanceHelper::formatCurrency($chargePerBid)); $link = JRoute::_('index.php?option=com_jblance&view=membership&layout=depositfund', false); $app->enqueueMessage($msg, 'error'); $app->redirect($link); return false; } } //check if the user has any bid limit. If any and exceeds, then disallow him $lastSubscr = $finance->getLastSubscription($user->id); if (empty($bid_id) && ($lastSubscr->bids_allowed > 0 && $lastSubscr->bids_left <= 0)) { $msg = JText::sprintf('COM_JBLANCE_NOT_ALLOWED_TO_BID_PROJECT_LIMIT_EXCEEDED'); $link = JRoute::_('index.php?option=com_jblance&view=membership&layout=planadd', false); $app->enqueueMessage($msg, 'error'); $app->redirect($link); return false; } $return[0] = $project; $return[1] = $bid; return $return; }
function saveReport() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $link = $app->input->get('link', '', 'string'); $reportHelper = JblanceHelper::get('helper.report'); // create an instance of the class ReportHelper $result = $reportHelper->createReport(); $msg = !$result ? JText::_('COM_JBLANCE_ALREADY_REPORTED') : JText::_('COM_JBLANCE_REPORTED_SUCCESSFULLY'); //echo $msg;exit; $return = base64_decode($link); $this->setRedirect($return, $msg); }
function saveUserNew() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $now = JFactory::getDate(); $jbmail = JblanceHelper::get('helper.email'); // create an instance of the class EmailHelper //get the user info from the session $session = JFactory::getSession(); $userInfo = $session->get('userInfo', null, 'register'); $ugid = $session->get('ugid', null, 'register'); $gateway = $session->get('gateway', '', 'register'); $skipPlan = $session->get('skipPlan', 0, 'register'); //$session->clear('id', 'upgsubscr'); $user = JFactory::getUser(); $post = $app->input->post->getArray(); //get the Joombri user group information $usergroup = JTable::getInstance('jbusergroup', 'Table'); $usergroup->load($ugid); $jbrequireApproval = $usergroup->approval; $joomlaUserGroup = $usergroup->joomla_ug_id; $defaultUserGroup = explode(',', $joomlaUserGroup); //if the user is already registered and setting his profile to be JoomBri, then ignore the steps below. if ($user->id == 0) { // Get required system objects $usern = clone JFactory::getUser(); // Registration is disabled - Redirect to login page. $usersConfig = JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { $link_login = JRoute::_('index.php?option=com_users&view=login', false); $msg = JText::_('COM_JBLANCE_REGISTRATION_DISABLED_MESSAGE'); $this->setRedirect($link_login, $msg, 'error'); return; } // Bind the post array to the user object if (!$usern->bind($userInfo, 'usertype')) { JError::raiseError(500, $usern->getError()); } // Set some initial user values $usern->set('id', 0); $usern->set('usertype', 'deprecated'); $usern->set('groups', $defaultUserGroup); $usern->set('registerDate', $now->toSql()); $jAdminApproval = $usersConfig->get('useractivation') == '2' ? 1 : 0; //require Joomla Admin approval $requireApproval = $jbrequireApproval | $jAdminApproval; //approval is required either JoomBri or Joomla require approval if ($requireApproval) { $usern->set('block', '1'); } // If user activation is turned on, we need to set the activation information $useractivation = $usersConfig->get('useractivation'); if (($useractivation == 1 || $useractivation == 2) && !$requireApproval) { jimport('joomla.user.helper'); $usern->set('activation', JApplicationHelper::getHash(JUserHelper::genRandomPassword())); $usern->set('block', '1'); } // If there was an error with registration, set the message and display form if (!$usern->save()) { $msg = JText::_($usern->getError()); $link = JRoute::_('index.php?option=com_jblance&view=guest&layout=register'); $this->setRedirect($link, $msg); return false; } $userid = $usern->id; } else { $userid = $user->id; //get the Joomla usergroup the user was previously assigned to and merge with the new group $oldUG = $user->get('groups'); $merged = array_merge($oldUG, $defaultUserGroup); $user->set('groups', array_unique($merged)); $user->save(); } // Initialize variables $db = JFactory::getDbo(); $row = JTable::getInstance('jbuser', 'Table'); $row->user_id = $userid; $row->ug_id = $ugid; //$row->biz_name = isset($userInfo['biz_name']) ? $userInfo['biz_name'] : ''; $id_category = $app->input->get('id_category', '', 'array'); JArrayHelper::toInteger($id_category); if (count($id_category) > 0 && !(count($id_category) == 1 && empty($id_category[0]))) { $proj_categ = implode(',', $id_category); } elseif ($id_category[0] == 0) { $proj_categ = 0; } $post['id_category'] = $proj_categ; if (!$row->save($post)) { JError::raiseError(500, $row->getError()); } $fields = JblanceHelper::get('helper.fields'); // create an instance of the class fieldsHelper $fields->saveFieldValues('profile', $row->user_id, $post); //insert the user to notify table $obj = new stdClass(); $obj->user_id = $userid; $db->insertObject('#__jblance_notify', $obj); // Send registration confirmation mail only to new registered user if ($user->id == 0) { $password = $userInfo['password2']; $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password); //Disallow control chars in the email $jbmail->sendRegistrationMail($usern, $password); if ($requireApproval) { $msg = JText::_('COM_JBLANCE_ACCOUNT_HAS_BEEN_CREATED_NEED_ADMIN_APPROVAL'); } else { if ($useractivation) { $msg = JText::_('COM_JBLANCE_ACCOUNT_HAS_BEEN_CREATED_NEED_ACTIVATION'); } else { $msg = JText::_('COM_JBLANCE_ACCOUNT_HAS_BEEN_CREATED_PLEASE_LOGIN'); } } } else { $msg = JText::_('COM_JBLANCE_YOUR_PROFILE_HAS_BEEN_SUCCESSFULLY_CREATED'); } $freeMode = JblanceHelper::isFreeMode($ugid); if (!$freeMode) { include_once JPATH_COMPONENT . '/controllers/membership.php'; $subscrRow = JblanceControllerMembership::addSubscription($userid); //add user to the subscription Table $subscrid = $subscrRow->id; //this returnid is the subscr id from plan_subscr table $session->set('id', $subscrid, 'upgsubscr'); if ($gateway == 'banktransfer') { //send alert to admin and user $jbmail->alertAdminSubscr($subscrid, $userid); $jbmail->alertUserSubscr($subscrid, $userid); } // if plan selection is skipped, redirect him to the home page if ($skipPlan || $subscrRow->price == 0) { $link = JRoute::_('index.php?option=com_jblance&view=guest&layout=showfront', false); } else { $app->enqueueMessage(JText::_('COM_JBLANCE_PROCEED_PAYMENT_AFTER_REGISTRATION')); $link = JRoute::_('index.php?option=com_jblance&view=membership&layout=check_out&type=plan', false); } } else { $link = JRoute::_('index.php?option=com_jblance', false); } //clear the session variable of 'register' $session->clear('ugid', 'register'); $session->clear('planid', 'register'); $session->clear('gateway', 'register'); $session->clear('userInfo', 'register'); $session->clear('skipPlan', 'register'); $this->setRedirect($link, $msg); }
/** * @company : BriTech Solutions * @created by : JoomBri Team * @contact : www.joombri.in, support@joombri.in * @created on : 13 November 2014 * @file name : views/service/tmpl/servicebought.php * @copyright : Copyright (C) 2012 - 2015 BriTech Solutions. All rights reserved. * @license : GNU General Public License version 2 or later * @author : Faisel * @description : List of services buyer has bought (jblance) */ defined('_JEXEC') or die('Restricted access'); JHtml::_('behavior.modal', 'a.jb-modal'); $model = $this->getModel(); $user = JFactory::getUser(); $financeHelp = JblanceHelper::get('helper.finance'); // create an instance of the class FinanceHelper ?> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo JRoute::_('index.php'); ?> " method="post" name="userForm"> <div class="jbl_h3title"><?php echo JText::_('COM_JBLANCE_SERVICES_BOUGHT'); ?> </div> <?php if (empty($this->rows)) {
// get the current userid if not passed $userid = $user->id; } $hasJBProfile = JblanceHelper::hasJBProfile($user->id); $link_edit_profile = JRoute::_('index.php?option=com_jblance&view=user&layout=editprofile'); $link_messages = JRoute::_('index.php?option=com_jblance&view=message&layout=inbox'); $link_home = JRoute::_('index.php'); $link_logout = JRoute::_('index.php?option=com_users&task=user.logout&' . JSession::getFormToken() . '=1&return=' . base64_encode($link_home)); ?> <!--Hide the menu for guest layout not print--> <?php if ($hasJBProfile && $tmpl == '') { ?> <?php $jbmenu = JblanceHelper::get('helper.menu'); $activeLink = $jbmenu->getActiveLink(); $active = $jbmenu->getActiveId($activeLink); $menus = $jbmenu->getJBMenuItems(); $processedMenus = $jbmenu->processJBMenuItems($menus); $notifys = JblanceHelper::getFeeds($limit, 'notify'); //get the notificataion feeds $newMsgs = JblanceHelper::countUnreadMsg(); if ($processedMenus) { ?> <script type="text/javascript"> <!-- function showElement(layer) { var myLayer = document.getElementById(layer); if (myLayer.style.display === "none") {
function submitForum() { // Check for request forgeries JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $now = JFactory::getDate(); $row = JTable::getInstance('forum', 'Table'); $message = $app->input->get('message', '', 'string'); $userid = $app->input->get('user_id', 0, 'int'); $projectid = $app->input->get('project_id', 0, 'int'); $post = array(); $jbmail = JblanceHelper::get('helper.email'); // create an instance of the class EmailHelper $projHelper = JblanceHelper::get('helper.project'); // create an instance of the class ProjectHelper //show whether name/username $config = JblanceHelper::getConfig(); $showUsername = $config->showUsername; $nameOrUsername = $showUsername ? 'username' : 'name'; //get user details $user = JFactory::getUser($userid); //get project details $jbproject = $projHelper->getProjectDetails($projectid); $post['date_post'] = $now->toSql(); $post['message'] = $message; $post['user_id'] = $userid; $post['project_id'] = $projectid; $post['project_title'] = $jbproject->project_title; $post['publisher_userid'] = $jbproject->publisher_userid; if ($message) { $result = $row->save($post); if ($result) { $username = '******' . $user->{$nameOrUsername} . '<span class="pull-right">' . JText::_('COM_JBLANCE_RECENTLY') . '</span></span>'; $message = '<p>' . strip_tags($post['message']) . '</p>'; echo "<li>{$username}" . "{$message}</li>"; //send notification to the users who are in the forum $jbmail->sendForumMessageNotification($post); } else { JError::raiseError(500, $row->getError()); } } exit; }