// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
// INCLUDE CB API
global $_CB_framework, $mainframe;
if (defined('JPATH_ADMINISTRATOR')) {
if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
echo 'CB not installed!';
return;
}
include_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php');
} else {
if (!file_exists($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php')) {
echo 'CB not installed!';
return;
}
include_once($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php');
}
cbimport('cb.database');
cbimport('cb.html');
cbimport('cb.plugins');
/**
* Member Manager Component Controller
*/
class membermanagerController extends JControllerLegacy
{
// REGISTERATION USER
public function registerUser()
{
global $_CB_framework, $_CB_database, $ueConfig, $_PLUGINS;
// GET VALUES
$jinput = JFactory::getApplication()->input;
$name = $jinput->get('name');
$email = $jinput->get('email');
$password = $jinput->get('password');
$address = $jinput->get('address');
$address2 = $jinput->get('address2');
$city = $jinput->get('city');
$state = $jinput->get('state');
$zip = $jinput->get('zip');
$phone = $jinput->get('phone');
$website = $jinput->get('website');
$facebook = $jinput->get('facebook');
$hours = $jinput->get('hours');
$category = $jinput->get('category');
$approve = 0;
$confirm = 0;
$approval = ($approve == 2 ? $ueConfig['reg_admin_approval'] : $approve);
$confirmation = ($confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm);
$usertype = $_CB_framework->getCfg('new_usertype');
$user = new moscomprofilerUser($_CB_database);
$user->usertype = ($usertype ? $usertype : 'Registered');
$user->gid = $_CB_framework->acl->get_group_id($user->usertype, 'ARO');
$user->gids = array($user->gid);
$user->sendEmail = 0;
$user->registerDate = date('Y-m-d H:i:s', $_CB_framework->now());
$user->name = $name;
$user->username = $email;
$user->email = $email;
$user->password = $user->hashAndSaltPassword($password);
$user->cb_address = $address;
$user->cb_address2 = $address2;
$user->cb_city = $city;
$user->cb_state = $state;
$user->cb_zip = $zip;
$user->cb_phone = $phone;
$user->cb_website = $website;
$user->cb_facebook = $facebook;
$user->cb_hours = $hours;
$user->cb_category = $category;
$user->registeripaddr = cbGetIPlist();
if ($approval == 0) {
$user->approved = 1;
} else {
$user->approved = 0;
}
if ($confirmation == 0) {
$user->confirmed = 1;
} else {
$user->confirmed = 0;
}
if (($user->confirmed == 1) && ($user->approved == 1)) {
$user->block = 0;
} else {
$user->block = 1;
}
$_PLUGINS->trigger('onBeforeUserRegistration', array(&$user, &$user));
if ($user->store()) {
if (($user->confirmed == 0) && ($confirmation != 0)) {
$user->_setActivationCode();
if (!$user->store()) {
return false;
}
}
$_PLUGINS->trigger('onAfterUserRegistration', array(&$user, &$user, true));
echo $name . ' successfully added!';
return true;
}
return false;
}
// UPDATE USER
public function editUser($user, $name)
{
global $_CB_database, $_PLUGINS;
$oldUserComplete = new moscomprofilerUser($_CB_database);
foreach (array_keys(get_object_vars($user)) as $k) {
$oldUserComplete->$k = $user->$k;
}
$user->name = $name;
$_PLUGINS->trigger('onBeforeUserUpdate', array(&$user, &$user, &$oldUserComplete, &$oldUserComplete));
if ($user->store()) {
return true;
}
$_PLUGINS->trigger('onAfterUserUpdate', array(&$user, &$user, $oldUserComplete));
return false;
}
}
Please Log in to join the conversation.
$user = new moscomprofilerUser($_CB_database);
if($user->store()) {
echo 'Stored';
} else {
echo 'Not Stored';
}
Please Log in to join the conversation.
Please Log in to join the conversation.
class membermanagerController extends JControllerLegacy
{
// REGISTERATION USER
public function registerUser($name, $email, $password, $address, $address2, $city, $state, $zip, $phone, $website, $facebook, $hours, $category, $approve = 0, $confirm = 0)
{
global $_CB_framework, $mainframe, $_CB_database, $ueConfig, $_PLUGINS;
if (defined('JPATH_ADMINISTRATOR')) {
if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
echo 'CB not installed!';
return;
}
include_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php');
} else {
if (!file_exists($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php')) {
echo 'CB not installed!';
return;
}
include_once($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php');
}
cbimport('cb.database');
cbimport('cb.html');
cbimport('cb.plugins');
$approval = ($approve == 2 ? $ueConfig['reg_admin_approval'] : $approve);
$confirmation = ($confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm);
$usertype = $_CB_framework->getCfg('new_usertype');
$user = new moscomprofilerUser($_CB_database);
$user->usertype = ($usertype ? $usertype : 'Registered');
$user->gid = $_CB_framework->acl->get_group_id($user->usertype, 'ARO');
$user->gids = array($user->gid);
$user->sendEmail = 0;
$user->registerDate = date('Y-m-d H:i:s', $_CB_framework->now());
$user->name = $name;
$user->username = $email;
$user->email = $email;
$user->password = $user->hashAndSaltPassword($password);
$user->cb_address = $address;
$user->cb_address2 = $address2;
$user->cb_city = $city;
$user->cb_state = $state;
$user->cb_zip = $zip;
$user->cb_phone = $phone;
$user->cb_website = $website;
$user->cb_facebook = $facebook;
$user->cb_hours = $hours;
$user->cb_category = $category;
$user->registeripaddr = cbGetIPlist();
if ($approval == 0) {
$user->approved = 1;
} else {
$user->approved = 0;
}
if ($confirmation == 0) {
$user->confirmed = 1;
} else {
$user->confirmed = 0;
}
if (($user->confirmed == 1) && ($user->approved == 1)) {
$user->block = 0;
} else {
$user->block = 1;
}
$_PLUGINS->trigger('onBeforeUserRegistration', array(&$user, &$user));
if ($user->store()) {
if (($user->confirmed == 0) && ($confirmation !== 0)) {
$user->_setActivationCode();
if (!$user->store()) {
echo '<div class="error_notice">Registration Failed!</div>';
return false;
}
}
$_PLUGINS->trigger('onAfterUserRegistration', array(&$user, &$user, true));
echo $name . ' successfully added!';
return true;
} else {
echo '<div class="error_notice">Registration Failed!</div>';
return false;
}
return false;
}
public function addMember() {
// GET VALUES
$jinput = JFactory::getApplication()->input;
$name = $jinput->get('name');
$email = $jinput->get('email');
$password = $jinput->get('password');
$address = $jinput->get('address');
$address2 = $jinput->get('address2');
$city = $jinput->get('city');
$state = $jinput->get('state');
$zip = $jinput->get('zip');
$phone = $jinput->get('phone');
$website = $jinput->get('website');
$facebook = $jinput->get('facebook');
$hours = $jinput->get('hours');
$category = $jinput->get('category');
self::registerUser($name, $email, $password, $address, $address2, $city, $state, $zip, $phone, $website, $facebook, $hours, $category);
}
}
Please Log in to join the conversation.
object(moscomprofilerUser)#141 (59) { ["name"]=> string(14) "CodeMonkeysLLC" ["username"]=> string(25) "spencercodemonkeysllc.com" ["email"]=> string(25) "spencercodemonkeysllc.com" ["password"]=> string(34) "$P$DUyTw4/p80LMSvRCLdABhwEPZ398Zf." ["usertype"]=> string(10) "Registered" ["block"]=> int(0) ["sendEmail"]=> int(0) ["gid"]=> string(1) "2" ["gids"]=> array(1) { [0]=> string(1) "2" } ["registerDate"]=> string(19) "2014-04-24 11:43:22" ["lastvisitDate"]=> NULL ["activation"]=> NULL ["params"]=> NULL ["_cmsUserTable"]=> string(8) "#__users" ["_cmsUserTableKey"]=> string(2) "id" ["_cmsUserTableUsername"]=> string(8) "username" ["_cmsUserTableEmail"]=> string(5) "email" ["_cmsUserTableGid"]=> NULL ["_cmsUser"]=> NULL ["_comprofilerUser"]=> NULL ["_cbTabs"]=> NULL ["_nonComprofilerVars"]=> array(17) { [0]=> string(2) "id" [1]=> string(4) "name" [2]=> string(8) "username" [3]=> string(5) "email" [4]=> string(8) "password" [5]=> string(5) "block" [6]=> string(9) "sendEmail" [7]=> string(12) "registerDate" [8]=> string(13) "lastvisitDate" [9]=> string(10) "activation" [10]=> string(6) "params" [11]=> string(13) "lastResetTime" [12]=> string(10) "resetCount" [13]=> string(6) "otpKey" [14]=> string(4) "otep" [15]=> string(3) "gid" [16]=> string(4) "gids" } ["_frontendNonComprofilerVars"]=> array(5) { [0]=> string(4) "name" [1]=> string(8) "username" [2]=> string(5) "email" [3]=> string(8) "password" [4]=> string(6) "params" } ["id"]=> NULL ["user_id"]=> NULL ["firstname"]=> NULL ["middlename"]=> NULL ["lastname"]=> NULL ["hits"]=> NULL ["message_last_sent"]=> NULL ["message_number_sent"]=> NULL ["avatar"]=> NULL ["avatarapproved"]=> NULL ["approved"]=> int(1) ["confirmed"]=> int(1) ["lastupdate"]=> NULL ["registeripaddr"]=> string(3) "::1" ["cbactivation"]=> NULL ["banned"]=> NULL ["banneddate"]=> NULL ["unbanneddate"]=> NULL ["bannedby"]=> NULL ["unbannedby"]=> NULL ["bannedreason"]=> NULL ["acceptedterms"]=> NULL ["_tbl"]=> string(14) "#__comprofiler" ["_tbl_key"]=> string(2) "id" ["_db"]=> &object(CBdatabase)#144 (2) { ["_db"]=> &object(JDatabaseDriverMysqli)#24 (21) { ["name"]=> string(6) "mysqli" ["nameQuote":protected]=> string(1) "`" ["nullDate":protected]=> string(19) "0000-00-00 00:00:00" ["_database":"JDatabaseDriver":private]=> string(16) "codemon3_chamber" ["connection":protected]=> object(mysqli)#28 (19) { ["affected_rows"]=> int(1) ["client_info"]=> string(79) "mysqlnd 5.0.11-dev - 20120503 - $Id: 1514feb3700aa52d513182fcdc87f2c66f06d152 $" ["client_version"]=> int(50011) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(1) ["host_info"]=> string(23) "198.1.66.206 via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(10) "5.5.36-cll" ["server_version"]=> int(50536) ["stat"]=> string(143) "Uptime: 4291293 Threads: 3 Questions: 6927504 Slow queries: 5 Opens: 9389 Flush tables: 1 Open tables: 386 Queries per second avg: 1.614" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(241708) ["warning_count"]=> int(0) } ["count":protected]=> int(10) ["cursor":protected]=> NULL ["debug":protected]=> bool(false) ["limit":protected]=> int(0) ["log":protected]=> array(0) { } ["timings":protected]=> array(0) { } ["callStacks":protected]=> array(0) { } ["offset":protected]=> int(0) ["options":protected]=> array(9) { ["driver"]=> string(6) "mysqli" ["host"]=> string(12) "198.1.66.206" ["user"]=> string(13) "codemon3_joey" ["password"]=> string(8) "London10" ["database"]=> string(16) "codemon3_chamber" ["prefix"]=> string(6) "tqnck_" ["select"]=> bool(true) ["port"]=> int(3306) ["socket"]=> NULL } ["sql":protected]=> string(63) "SELECT `id` FROM `#__usergroups` WHERE `title` = 'Registered'" ["tablePrefix":protected]=> string(6) "tqnck_" ["utf":protected]=> bool(true) ["errorNum":protected]=> int(0) ["errorMsg":protected]=> string(0) "" ["transactionDepth":protected]=> int(0) ["disconnectHandlers":protected]=> array(0) { } } ["_table_prefix"]=> string(6) "tqnck_" } ["_error"]=> string(0) "" ["cb_address"]=> string(12) "2071117thAve" ["cb_address2"]=> string(0) "" ["cb_city"]=> string(7) "Baldwin" ["cb_state"]=> string(9) "Wisconsin" ["cb_zip"]=> string(5) "54002" ["cb_phone"]=> string(12) "715-441-2919" ["cb_website"]=> string(23) "www.codeomonkeysllc.com" ["cb_facebook"]=> string(0) "" ["cb_hours"]=> string(14) "Mon-Fri9am-5pm" ["cb_category"]=> string(11) "ComputerWeb" }
Please Log in to join the conversation.
Please Log in to join the conversation.