public static function getAllAds($input = FALSE) { $myaddress = User::getAddress(); if ($myaddress) { $user = User::checkLoginStatus(false); $earthRadius = 6371000; $sqlReturnDistance = " ROUND(\n\t\t\t\t" . $earthRadius . " * ACOS( \n\t\t\t\t\tSIN( " . $user->latitude . "*PI()/180 ) * SIN( ads.latitude*PI()/180 )\n\t\t\t\t\t+ COS( " . $user->latitude . "*PI()/180 ) * COS( ads.latitude*PI()/180 ) * COS( (ads.longitude*PI()/180) - (" . $user->longitude . "*PI()/180) ) \n\t\t\t\t) \n\t\t\t, 0) AS distance, "; } else { $sqlReturnDistance = ""; } //Gör det möjligt att söka på Ads med fritext if (isset($input['search'])) { $searchString = DB::clean($input['search']); $searchString = strtolower($searchString); $sqlSearch = " AND (LOWER(ads.title) LIKE '%" . $searchString . "%' \n\t\t\t\t\t\tOR LOWER(ads.content) LIKE '%" . $searchString . "%') "; } else { $searchString = FALSE; $sqlSearch = ""; } //Gör det möjligt att söka på Ads med taggar if (isset($input['tags'])) { $searchTags = DB::clean($input['tags']); $sqlTags = " AND ads.id IN ( \n\t\t\t\t\t\tSELECT DISTINCT(ad_id)\n\t\t\t\t\t\tFROM ad_has_tag\n\t\t\t\t\t\tWHERE "; foreach ($searchTags as $searchTag) { $sqlTags .= "tag_id = {$searchTag} OR "; } $sqlTags = trim($sqlTags, "OR "); $sqlTags .= ")"; } else { $searchTags = FALSE; $sqlTags = ""; } //Gör det möjligt att söka på Adtype if (isset($input['adtype']) && $input['adtype'] != "") { $searchAdType = DB::clean($input['adtype']); $sqlAdType = " AND ad_type = {$searchAdType} "; } else { $searchAdType = FALSE; $sqlAdType = ""; } if (isset($input['distance']) && $input['distance'] != '') { $searchDistance = DB::clean($input['distance']); $sqlSearchDistance = " HAVING distance <= {$searchDistance} "; } else { $searchDistance = FALSE; $sqlSearchDistance = ""; } $sql = "SELECT " . $sqlReturnDistance . "\n\t\t\t\tads.id \t\t\t\tas id,\n\t\t\t\tads.title \t\t\tas title, \n\t\t\t\tads.content \t\tas content, \n\t\t\t\tads.date_created \tas date_created, \n\t\t\t\tads.date_expire \tas date_expire, \n\t\t\t\tads.user_id \t\tas user_id, \n\t\t\t\tuser.firstname \t\tas user_firstname,\n\t\t\t\tads.address \t \tas address, \n\t\t\t\tads.latitude \t\tas latitude, \n\t\t\t\tads.longitude \t \tas longitude, \n\t\t\t\tads.ad_type \t\tas ad_type,\n\t\t\t\tads.payment \t\tas payment,\n\t\t\t\tads.active \t\t\tas active,\n\t\t\t\tads.image \t\t\tas image\n\t\t\tFROM ads, user \n\t\t\tWHERE user.id = ads.user_id " . $sqlSearch . $sqlTags . $sqlAdType . $sqlSearchDistance . " AND date_expire >= " . time() . "\n\t\t\tORDER BY date_updated DESC"; $dataArray = DB::query($sql); $ads = []; foreach ($dataArray as $data) { $ads[] = new Ads($data); } $output = ['ads' => $ads, 'page' => 'ads.getallads.twig', 'browserTitle' => 'Alla annonser', 'search' => $searchString, 'tags' => self::getAllTags(), 'searchTags' => $searchTags, 'adTypes' => self::getAllAdTypes(), 'user' => User::checkLoginStatus(FALSE), 'distance' => $searchDistance, 'newInterests' => User::getNewInterests()]; return $output; }
function getBiographicalFeature(User $user, $feature) { switch ($feature) { case "name": $feat_str = $user->getName("%f %l"); break; case "group": $feat_str = $user->getGroup(); break; case "role": $feat_str = $user->getRole(); break; case "photo": $official_photo = UserPhoto::get($user->getID(), UserPhoto::OFFICIAL); $feat_str = $official_photo->getFilename(); break; case "organisation": $organisation = $user->getOrganisation(); $feat_str = $organisation->getTitle(); break; case "email": $feat_str = $user->getEmail(); break; case "email_alt": $feat_str = $user->getEmailAlternate(); break; case "address": $address = $user->getAddress(); $postcode = $user->getPostalCode(); $city = $user->getCity(); $province = $user->getProvince(); $prov_name = $province->getName(); $country = $user->getCountry(); $country_name = $country->getName(); $feat_str = html_encode($address) . "<br />" . html_encode($city); if ($prov_name) { $feat_str .= ", " . html_encode($prov_name); } $feat_str .= "<br />"; $feat_str .= html_encode($country_name); if ($postcode) { $feat_str .= ", " . html_encode($postcode); } break; case "phone": $feat_str = $user->getTelephone(); break; case "fax": $feat_str = $user->getFax(); break; default: Zend_Debug::dump($feature); return; } return $feat_str; }
private function bindAddress(User $user) { $isCurrent = $this->user == $user; $a = $user->getAddress(); if (!$a) { return []; } if ($isCurrent) { return ['formatted' => $a->getFormatted(), 'streetNo' => $a->getStreetNo(), 'route' => $a->getRoute(), 'city' => $a->getCity(), 'state' => $a->getState(), 'country' => $a->getCountry(), 'gId' => $a->getGId(), 'lat' => $a->getLat(), 'lng' => $a->getLng(), 'supported' => $a->getCountry() == 'AU']; } else { return ['city' => $a->getCity(), 'state' => $a->getState(), 'country' => $a->getCountry()]; } }
<a href="#" class="number" title="4">4</a> <a href="#" title="Next Page">Next »</a><a href="#" title="Last Page">Last »</a> </div> --><!-- End .pagination --> <div class="clear"></div> </td> </tr> </tfoot> <tbody> <?php for ($i = 0; $i < sizeof($mEmployeeList); $i++) { $mEmployee = new User($mEmployeeList[$i]); echo "<tr>"; echo "<td><img height='15' width='15' src='../../res/driver_icon.png'> <b>" . $mEmployee->getFullName() . "</b></td>"; echo "<td>" . $mEmployee->getPhoneMobile() . "</td>"; echo "<td>" . $mEmployee->getAddress() . "</td>"; if ($mUser->isCompanyAdmin() && $mUser->getId() != $mEmployee->getId()) { echo "<td>\n\t\t\t\t\t\t\t\t\t\t\t<!-- Icons -->\n\t\t\t\t\t\t\t\t\t\t\t <a href='#' title='Edit'><img src='../../res/pencil.png' alt='Edit'></a>\n\t\t\t\t\t\t\t\t\t\t\t <a href='#' title='Delete' onClick='onDelete(" . $mEmployee->getId() . ")'><img src='../../res/cross.png' alt='Delete'></a>\n\t\t\t\t\t\t\t\t\t\t</td>"; } else { echo "<td></td>"; } echo "</tr>"; } ?> </tbody> </table> <?php } ?> </div> <!-- End #staff -->
/** * * @param User $user * @return int id of the User inserted in base. False if it didn't work. */ public static function flush($user) { $userId = $user->getId(); $login = $user->getLogin(); $password = $user->getPassword(); $mail = $user->getMail(); $inscriptionDate = $user->getInscriptionDate(); $firstName = $user->getFirstName(); $lastName = $user->getLastName(); $birthDate = $user->getBirthDate(); $address = $user->getAddress(); $phoneNumber = $user->getPhoneNumber(); $avatar = $user->getAvatar(); $role = $user->getRole()->getId(); if ($userId > 0) { $sql = 'UPDATE user u SET ' . 'u.login = ?, ' . 'u.passwd = ?, ' . 'u.mail = ?, ' . 'u.inscription_date = ?, ' . 'u.first_name = ?, ' . 'u.last_name = ?, ' . 'u.birth_date = ?, ' . 'u.address = ?, ' . 'u.phone_number = ?, ' . 'u.avatar = ?, ' . 'u.ROLE_id_role = ? ' . 'WHERE u.id_user = ?'; $params = array('ssssssssssii', &$login, &$password, &$mail, &$inscriptionDate, &$firstName, &$lastName, &$birthDate, &$address, &$phoneNumber, &$avatar, &$role, &$userId); } else { $sql = 'INSERT INTO user ' . '(login, passwd, mail, inscription_date, first_name, ' . 'last_name, birth_date, address, phone_number, avatar, ROLE_id_role) ' . 'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; $params = array('ssssssssssi', &$login, &$password, &$mail, &$inscriptionDate, &$firstName, &$lastName, &$birthDate, &$address, &$phoneNumber, &$avatar, &$role); } $idInsert = BaseSingleton::insertOrEdit($sql, $params); if ($idInsert !== false && $userId > 0) { $idInsert = $userId; } return $idInsert; }
$app->response->redirect(Settings::baseRef . '/tenant-user', 303); return; } // redirects target users that are not in the selected radio group $rid = $user->getRadioId(); if ($rid != $targetUser->getRadioId()) { $app->response->redirect(Settings::baseRef . '/tenant-user', 303); return; } // $model = $utils->getModel($app); $model['temail'] = $targetUser->getEmail(); $screenUtils->getConfig($targetUser->getRadioId()); $model['radio'] = $screenUtils->getName(); $model['pname'] = $targetUser->getName(); $model['address'] = $targetUser->getAddress(); $model['mobile'] = $targetUser->getMobile(); $model['uid'] = $targetUser->getId(); // $app->render('tenant-user.php', $model); }); $app->get('/tenant/:method/:id/', function ($method, $id) use($app) { $session = Session::getInstance(); $user = User::getInstance(); $screenUtils = ScreenUtils::getInstance(); $utils = Utils::getInstance(); // checks session if (false == $session->isUserAuth()) { $session->addError(L::__('User is not authed.')); $app->response->redirect(Settings::baseRef . '/login', 303); return;
public function testGetSetAddress() { $user = new User(); $user->setAddress('9 rue de la pochette'); $this->assertEquals('9 rue de la pochette', $user->getAddress()); }
/** * This displays a person's name, picture etc. including basic biographical information and assistant info if relevant * @param User $user */ function display_person(User $user) { global $ENTRADA_ACL; $photos = $user->getPhotos(); $user_id = $user->getID(); $is_administrator = $ENTRADA_ACL->amIallowed('user', 'update'); $prefix = $user->getPrefix(); $firstname = $user->getFirstname(); $lastname = $user->getLastname(); $fullname = $user->getName("%f %l"); $departments = $user->getDepartments(); if (0 < count($departments)) { $dep_titles = array(); foreach ($departments as $department) { $dep_titles[] = ucwords($department->getTitle()); } $group_line = implode("<br />", $dep_titles); } else { $group = $user->getGroup(); $role = $user->getRole(); $group_line = ucwords($group . " > " . ($group == "student" ? "Class of " : "") . $role); } $privacy_level = $user->getPrivacyLevel(); $organisation = $user->getOrganisation(); $org_name = $organisation ? $organisation->getTitle() : ""; $email = 1 < $privacy_level || $is_administrator ? $user->getEmail() : ""; $email_alt = $user->getAlternateEmail(); if (2 < $privacy_level || $is_administrator) { $show_address = true; $city = $user->getCity(); $province = $user->getProvince(); $prov_name = $province->getName(); $country = $user->getCountry(); $country_name = $country->getName(); $phone = $user->getTelephone(); $fax = $user->getFax(); $address = $user->getAddress(); $postcode = $user->getPostalCode(); $office_hours = $user->getOfficeHours(); } $assistants = $user->getAssistants(); //there are 4 photo cases (at time of writing): no photos, official only, uploaded only, or both. //privacy options also need to be considered here. ob_start(); ?> <div id="result-<?php echo $user_id; ?> " class="person-result"> <div id="img-holder-<?php echo $user_id; ?> " class="img-holder"> <?php $num_photos = count($photos); if (0 === $num_photos) { echo display_photo_placeholder(); } else { foreach ($photos as $photo) { echo display_photo($photo); } if (2 <= $num_photos) { $label = 0; foreach ($photos as $photo) { echo display_photo_link($photo, ++$label); } } echo display_zoom_controls($user_id); } ?> </div> <div class="person-data"> <div class="basic"> <span class="person-name"><?php echo html_encode($fullname); ?> </span> <span class="person-group"><?php echo html_encode($group_line); ?> </span> <span class="person-organisation"><?php echo html_encode($org_name); ?> </span> <div class="email-container"> <?php if ($email) { echo display_person_email($email); if ($email_alt) { echo display_person_email($email_alt); } } ?> </div> </div> <div class="address"> <?php if ($show_address) { if ($phone) { ?> <div> <span class="address-label">Telephone:</span> <span class="address-value"><?php echo html_encode($phone); ?> </span> </div> <?php } if ($fax) { ?> <div> <span class="address-label">Fax:</span> <span class="address-value"><?php echo html_encode($fax); ?> </span> </div> <?php } if ($address && $city) { ?> <div> <span class="address-label">Address:</span><br /> <span class="address-value"> <?php echo html_encode($address) . "<br />" . html_encode($city); if ($prov_name) { echo ", " . html_encode($prov_name); } echo "<br />"; echo html_encode($country_name); if ($postcode) { echo ", " . html_encode($postcode); } ?> </span> </div> <?php } if ($office_hours) { ?> <div> <span class="address-label">Office Hours:</span> <span class="address-value"><?php echo html_encode($office_hours); ?> </span> </div> <?php } } ?> </div> <div class="assistant"><?php if (count($assistants) > 0) { ?> <span class="content-small">Administrative Assistants:</span> <ul class="assistant-list"> <?php foreach ($assistants as $assistant) { echo "<li>" . display_person_email($assistant->getEmail(), $assistant->getName("%f %l")) . "</li>"; } ?> </ul><?php } ?> </div> </div> <div></div> <div class="clearfix"> </div> </div> <?php return ob_get_clean(); }
if ($user->isAdmin()) { ?> <tr><th>Member?</th><td><?php echo $this_user->isMember() ? "Yes" : "No"; ?> </td></tr> <tr><th>Admin?</th><td><?php echo $this_user->isAdmin() ? "Yes" : "No"; ?> </td></tr> <tr><th>Email</th><td><?php echo $this_user->getEmail(); ?> </td></tr> <tr><th>Address</th><td><?php echo nl2br($this_user->getAddress()); ?> </td></tr> <tr><th>Emergency Contact</th><td><?php echo htmlspecialchars($this_user->getEmergencyName()); ?> <br/><?php echo htmlspecialchars($this_user->getEmergencyPhone()); ?> </td></tr> <?php } ?> </table> <?php
function ShowURL($params) { $tempUser = new User($params['CustomerID']); //Customer Information from CE $params['userID'] = "CE" . $tempUser->getId(); $params['userEmail'] = $tempUser->getEmail(); $params['userFirstName'] = $tempUser->getFirstName(); $params['userLastName'] = $tempUser->getLastName(); $params['userOrganization'] = $tempUser->getOrganization(); $params['userAddress'] = $tempUser->getAddress(); $params['userCity'] = $tempUser->getCity(); $params['userState'] = $tempUser->getState(); $params['userZipcode'] = $tempUser->getZipCode(); $params['userCountry'] = $tempUser->getCountry(); $params['userPhone'] = $tempUser->getPhone(); // Get customer Authnet CIM profile $customerProfile = $this->getCustomerProfile($params); if ($customerProfile['error']) { return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body>' . $customerProfile['detail'] . '</body> </html>'; } //Authorize.net CIM Credentials from CE plugin $myapilogin = $this->settings->get('plugin_authnetcim_Authorize.Net CIM API Login ID'); $mYtRaNsaCTiOnKEy = $this->settings->get('plugin_authnetcim_Authorize.Net CIM Transaction Key'); $sandbox = $this->settings->get('plugin_authnetcim_Authorize.Net CIM Test Mode'); $USE_DEVELOPMENT_SERVER = $sandbox ? AuthnetCIM::USE_DEVELOPMENT_SERVER : AuthnetCIM::USE_PRODUCTION_SERVER; //Need to check to see if user is coming from signup if ($params['isSignup']) { // Actually handle the signup URL setting if ($this->settings->get('Signup Completion URL') != '') { $returnURL = $this->settings->get('Signup Completion URL') . '?success=1'; } else { $returnURL = $params["clientExecURL"] . "/order.php?step=complete&pass=1"; } $hosted_Profile_Page_Border_Visible = 'true'; } else { $hosted_Profile_Page_Border_Visible = 'false'; $returnURL = $params['returnURL']; } // Get the Hosted Profile Page $hosted_Profile_Return_Url_Text = 'Continue to confirmation page.'; $hosted_Profile_Card_Code_Required = 'true'; $hosted_Profile_Billing_Address_Required = 'true'; try { $cim = new AuthnetCIM($myapilogin, $mYtRaNsaCTiOnKEy, $USE_DEVELOPMENT_SERVER); $cim->setParameter('customerProfileId', $customerProfile['profile_id']); if ($params['isSignup']) { $cim->setParameter('hostedProfileReturnUrl', $returnURL); } else { $cim->setParameter('hostedProfileIFrameCommunicatorUrl', $returnURL); } $cim->setParameter('hostedProfileReturnUrlText', $hosted_Profile_Return_Url_Text); $cim->setParameter('hostedProfilePageBorderVisible', $hosted_Profile_Page_Border_Visible); $cim->setParameter('hostedProfileCardCodeRequired', $hosted_Profile_Card_Code_Required); $cim->setParameter('hostedProfileBillingAddressRequired', $hosted_Profile_Billing_Address_Required); $cim->getHostedProfilePage(); // Get the token for the profile if ($cim->isSuccessful()) { $profile_token = $cim->getProfileToken(); return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <form id="formAuthorizeNetPage" method="post" action="https://' . ($sandbox ? 'test' : 'secure') . '.authorize.net/profile/manage"> <input type="hidden" name="token" value="' . $profile_token . '"/> </form> <script type="text/javascript"> document.getElementById("formAuthorizeNetPage").submit(); </script> </body> </html>'; } else { return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body>' . $cim->getResponseSummary() . '</body> </html>'; } } catch (AuthnetCIMException $e) { return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body>' . $e . '</body> </html>'; } }
echo json_encode($print); break; case "gacc": $print = $u->getAcct(); echo json_encode($print); break; case "macc": $print = $u->makeAcct($_POST["email"], $_POST["pass"], $_POST["fName"], $_POST["lName"]); echo json_encode($print); break; case "upass": $print = $u->updatePassword($_POST["pass"]); echo json_encode($print); break; case "gaddr": $print = $u->getAddress($_POST["addrNick"]); echo json_encode($print); break; case "uaddr": $a = new Address($_POST["addr"], $_POST["city"], $_POST["zip"], $_POST["addr2"], $_POST["state"], $_POST["phone"], $_POST["addrNick"]); $print = $u->addAddress($a); echo json_encode($print); break; case "daddr": $print = $u->deleteAddress($_POST["addrNick"]); echo json_encode($print); break; case "gcar": $print = $u->getCard($_POST["cardNick"]); echo json_encode($print); break;