3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php public function syncSocialWithPin($userinfo, &$status) { //istanzio db SLAVE e recupero l'user ID del nuovo utente sullo SLAVE $db = JFusionFactory::getDatabase($this->getJname()); $query_pin = $db->getQuery(true) ->select('id') ->from('#__users') ->where('username=' ."'$userinfo->username'"); $db->setQuery($query_pin); $user_id_pin = $db->loadResult(); // SLAVE id -> #__users //istanzio db MASTER e recupero id MASTER $database_master = JFactory::getDBO(); $select_user_id = $database_master->getQuery(true) ->select('id') ->from('#__users') ->where('username='."'$userinfo->username'"); $database_master->setQuery($select_user_id); $master_user_id = $database_master->loadResult(); // MASTER id -> #__users //Recupero info Joomsocial // $query_users_fields = $database_master->getQuery(true) // ->select('value') // ->from('#__community_fields_values') // ->where('user_id='.$master_user_id .' AND field_id=8'); // $database_master->setQuery($query_users_fields); // $masterdbresults = $database_master->loadResult(); //Joomsocial infos // controllo che la query abbia un risultato! $pinimport = new stdClass(); // obj da importare $pinimport->user_id = $user_id_pin; $pinimport->first_name = $userinfo->name; $pinimport->username = $userinfo->username; $pinimport->email = $userinfo->email; $pinimport->location = $master_user_id; $pinimport->created_date = date('Y-m-d H:i:s', time()); $pinimport->updated_date = date('Y-m-d H:i:s', time()); $pinimport->activation = ''; //TEST IT!!!! //Controllo se l'utente è già presente su social pinboard $updatedinfo = $db->getQuery(true) ->select('*') ->from('#__pin_user_settings') ->where('email='."'$userinfo->email'"); $db->setQuery($updatedinfo); $datacheck = $db->loadObjectList(); $emptycheck = (array) $datacheck; // typecasto ad array per controllare se è vuoto! // if(empty(get_object_vars($datacheck) // un 1liner per vedere se l'oggetto è vuoto if (empty($emptycheck)) { // se NON è presente INSERT tutto $db->insertObject('#__pin_user_settings', $pinimport); $status['debug']="l'utente è presente su SocialPinboard, emptycheck positivo!"; } // else if controlla ogni campo presente e vedi se è diverso da quelli passati nell'oggetto $userinfo // foreach ($datacheck as $d) { // if ($d->username != $userinfo->username) // { // $usernameupdate = $db->getQuery(true) // ->insert("'$d->username'") // ->in(#__user); // $db->setQuery($usernameupdate); // $db->query() // $db->execute() // $status['debug']= "Usernamer Modificato" .$userinfo->username. "in".$d->username; // } // // if ($d->email != $userinfo->email) // { // $emailupdate = $db->getQuery(true) // ->insert("'$d->email'") // ->in(#__user); // $db->setQuery($emailupdate); // $db->query() // $db->execute() // $status['debug']= "Email Modificato" .$userinfo->email. "in".$d->email; // } // // if ($d->first_name != $userinfo->first_name) // { // $firstnameupdate = $db->getQuery(true) // ->insert("'$d->first_name'") // ->in(#__user); // $db->setQuery($firstnameupdate); // $db->query() // $db->execute() // $status['debug']= "First_name Modificato" .$userinfo->first_name. "in".$d->first_name; // } // // if ($d->location != $userinfo->location) // { // $locationupdate = $db->getQuery(true) // ->insert("'$d->location'") // ->in(#__user); // $db->setQuery($locationupdate); // $db->query() // $db->execute() // $status['debug']= "Location Modificato" .$userinfo->location. "in".$d->location; // } // //} return $status; } /*
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/jdoS9 on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PUBLIC in /in/jdoS9 on line 2
Process exited with code 255.