Beispiel #1
0
 public function actionTest()
 {
     /*      $user_id = Yii::app()->user->id;
           var_dump(Yii::app()->user->isAdmin);
           //print_r(User::model()->findByPk($user_id));
           echo 'Places='.Place::model()->countUserPlaces($user_id);
           echo 'Blocks='.Place::model()->countOwnedBlocks($user_id);
           echo 'Estabs='.Place::model()->countOwnedEstablishments($user_id);
           yexit();*/
     $po = new Pushover();
     $po->setToken(Yii::app()->params['pushover']['key']);
     $po->setUser(getUserProfile(Yii::app()->user->id)->getAttribute('pushover_token'));
     $po->setDevice(getUserProfile(Yii::app()->user->id)->getAttribute('pushover_device'));
     $po->setTitle('Hey ' . getFirstName());
     $po->setMessage('Hello world! ' . time());
     $po->setUrl('http://jeffreifman.com/blog/');
     $po->setUrlTitle('cool blog');
     $po->setPriority(1);
     $po->setTimestamp(time());
     $po->setDebug(true);
     $go = $po->send();
     echo '<pre>';
     print_r($go);
     echo '</pre>';
 }
Beispiel #2
0
<?php

require 'core/sessions.php';
require 'core/functions.php';
include 'includes/head.php';
startSession();
getGetVar();
include 'includes/header.php';
checkGetID($id);
getUserToken($id);
$yourID = $_COOKIE['online'];
checkProfileOwner($id, $yourID);
if ($ownerID == $id) {
    getUserProfile($userID);
    echo $firstName;
    echo '<br>Your Profile';
} else {
    getMemberProfile($id);
    echo $fname;
    if ($signed_in === 1) {
        echo '- Online -';
    }
}
<?php

include "MonarchPressDb.php";
//test user insert
function getUserProfile($email, $rowID, $url, $user, $pwd, $db)
{
    $test = new MonarchPressDb($url, $user, $pwd, $db);
    if ($result = $test->search_user_by_email($email)) {
        /* fetch object array */
        while ($row = $result->fetch_assoc()) {
            return $row[$rowID];
        }
        /* free result set */
        $result->close();
    }
}
?>
<html>
<body>
  <?php 
echo "Email: " . getUserProfile('*****@*****.**', 'email', '128.82.11.37', 'root', 'w@t3rg@t3', 'wordpress') . "<br>";
echo "Username: "******"<br>";
echo "Password: "******"<br>";
echo "Secret Quetion: " . getUserProfile('*****@*****.**', 'secret_question', '128.82.11.37', 'root', 'w@t3rg@t3', 'wordpress') . "<br>";
echo "Secret Answer: " . getUserProfile('*****@*****.**', 'secret_answer', '128.82.11.37', 'root', 'w@t3rg@t3', 'wordpress') . "<br>";
echo "Twitter Username: "******"<br>";
?>
</body>
</html>
Beispiel #4
0
							<div class="row" style="margin-bottom: 1em;">
								<div class="col-xs-4">Магазин:</div>
								<div class="col-xs-8"><?php 
        echo getShopNameById($v->shop_id);
        ?>
</div>
							</div>
							<div class="row" style="margin-bottom: 1em;">
								<div class="col-xs-4">Сотрудник:</div>
								<div class="col-xs-8">
									<?php 
        echo getLinkToUserProfile($v->drop_id);
        ?>
									<?php 
        if ($user['rankname'] == 'admin' || $user['rankname'] == 'labler' || $user['rankname'] == 'support' || $user['rankname'] == 'shipper') {
            $dropAddr = getUserProfile($v->drop_id);
            if ($dropAddr !== false) {
                echo ' | <small>' . $dropAddr->address . ', ' . $dropAddr->state . ' ' . $dropAddr->country . ' ' . $dropAddr->city . ' ' . $dropAddr->zip . '</small>';
            }
        }
        ?>

								</div>
							</div>
							<div class="row" style="margin-bottom: 1em;">
								<div class="col-xs-4">Отправитель:</div>
								<div class="col-xs-8"><?php 
        echo getLinkToUserProfile($v->shipper_id);
        ?>
</div>
							</div>
$app->post('/api/user', function ($request, $response, $args) {
    $params = $request->getParsedBody();
    $token = $params["token"];
    $name = $params["name"];
    $major = $params["major"];
    $interests = $params["interests"];
    $this->logger->info("POST /api/user");
    $this->logger->info("token: " . $token);
    $this->logger->info("name: " . $name);
    $email = get_email_from_key($this, $token);
    $this->logger->info("email: " . $email);
    $query = "UPDATE accounts INNER JOIN users ON accounts.id=users.account_id SET name=?, major=?, interests=? WHERE email=?";
    $SQLparams = array($name, $major, $interests, $email);
    $link = mysqli_connect(HOST, USER, PASSWORD, DATABASE);
    $result = mysqli_prepared_query($this, $link, $query, "ssss", $SQLparams);
    mysqli_close($link);
    $data['name'] = $name;
    $data['major'] = $major;
    $data['interests'] = $interests;
    $data['token'] = $token;
    return $response->withHeader('Content-Type', 'application/json')->write(json_encode($data));
});
$app->get('/api/user', function ($request, $response, $args) {
    $params = $request->getQueryParams();
    $token = $params['token'];
    $email = get_email_from_key($this, $token);
    $this->logger->info("GET /api/user");
    $this->logger->info("email: " . $email);
    $data = getUserProfile($this, $email);
    return $response->withJson($data);
});
<?php

include_once "../database.php";
$json = file_get_contents('php://input');
$request = json_decode($json, true);
$userid = isset($request["userid"]) ? $request["userid"] : "";
echo json_encode(getUserProfile($userid));
Beispiel #7
0
<?php

include_once "header.php";
include_once "sidebar.php";
$userid = $_GET['uid'];
$data = getUserProfile($userid)[0];
$pos = getUserLatLng($userid)[0];
?>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Map
        </h1>

        <ol class="breadcrumb">
            <li><a href="dashboard.php"><i class="fa fa-dashboard"></i>Home</a></li>
            <li class="active">Here</li>
        </ol>
    </section>
    <script src="https://maps.googleapis.com/maps/api/js"></script>

    <script>
        var map;
        function initMap() {
            
            var latlng =  {lat: <?php 
echo $pos['lat'];
?>
, lng: <?php 
echo $pos['lng'];
Beispiel #8
0
$app->post('/login', function ($request, $response, $args) {
    $params = $request->getParsedBody();
    $email = $params["email"];
    $password = $params["password"];
    $result = login($this, $email, $password);
    $isActive = $result["isActive"];
    $pwdCorrect = $result["pwdCorrect"];
    $name = $result["name"];
    if ($isActive && $pwdCorrect) {
        $role = get_account_type_from_email($this, $email);
        $_SESSION["email"] = $email;
        $_SESSION["name"] = $name;
        $_SESSION["role"] = $role;
        $_SESSION['token'] = get_session_key_from_email($this, $email);
        if ($role == "user") {
            $profile = getUserProfile($this, $email);
            $_SESSION["major"] = $profile["major"];
            return $response->withStatus(303)->withHeader('Location', '/recommendation');
        } elseif ($role == "admin") {
            return $response->withStatus(303)->withHeader('Location', '/admin');
        }
    }
    if (!$isActive && $pwdCorrect) {
        $error = "Account is disabled";
    } else {
        $error = "Username or Password Incorrect";
    }
    $url = buildInterstitialURL("Back to Login", "/", $error);
    return $response->withStatus(303)->withHeader('Location', $url);
});
$app->post('/register', function ($request, $response, $args) {
Beispiel #9
0
}
?>
		</tr>
		<?php 
$usersRanks = getUserRankList(-1, $currentMatchTypeId, -1, -1, 1, 0);
// ARRAY_A | ARRAY_N | OBJECT | OBJECT_K
sort($usersRanks);
foreach ($usersRanks as $user) {
    ?>
		    <tr id="poll-5" class="highlight">
				<td height="24" align="center"><?php 
    echo ++$i;
    ?>
</td>
				<td height="24" align="center"><?php 
    $userprofile = getUserProfile($user->uid);
    echo $userprofile[0]->realname;
    ?>
</td>
		        <?php 
    foreach ($rankTypeList as $rankType) {
        $userRanks = getUserRankList($user->uid, $currentMatchTypeId, $rankType->id);
        echo '<td height="24" align="center">' . $userRanks[0]->value . '</td>';
    }
    ?>
			</tr>
		<?php 
}
?>
	</table>
Beispiel #10
0
function getUserFullName($id = 0)
{
    $fullname = getUserProfile($id)->getAttribute('first_name') . ' ' . substr(getUserProfile($id)->getAttribute('last_name'), 0, 1) . '.';
    $fullname = ucwords($fullname);
    return $fullname;
}
    unset($dataDecoded['limit']);
}
//if the userHash property is set: query the DB to return the user_id and add that as a property to the dataDecoded array.
if (isset($dataDecoded['userHash'])) {
    $userHash = $dataDecoded['userHash'];
    $userID = (array) $db->action('SELECT `user_id`', 'users_session', array('hash', '=', $userHash))->first();
    $dataDecoded['userID'] = $userID['user_id'];
    unset($dataDecoded['userHash']);
}
//This switch statement controls the request's program flow, depending on the defined action property.
switch ($action) {
    case 'get':
        get($db, $table, $where);
        break;
    case 'getUserProfile':
        getUserProfile($db, $table, $where);
        break;
    case 'getVisualisationData':
        getUserData($db, $dataDecoded);
        break;
    case 'getLast':
        getLast($db, $table, $where);
        break;
    case 'getMostFrequent':
        getMostFrequent($db, $table, $where, $colForCount, $groupBy, $orderBy, $ascOrDesc, $limit);
        break;
    case 'save':
        save($db, $table, $dataDecoded);
        break;
    case 'confirmIDPassword':
        confirmIDPassword($db, $dataDecoded);
function getProfile()
{
    session_start();
    $email = $_SESSION['email'];
    $result = getUserProfile($email);
    echo json_encode($result);
}
Beispiel #13
0
} elseif ($id_type == "mobile") {
    $sql = "SELECT id FROM `bluenet_v3`.`users` WHERE mobile = '" . $id_number . "'";
    $userrow = mysqli_query($db_handle, $sql);
    $userrowid = mysqli_fetch_array($userrow);
    $userId = $userrowid['id'];
} else {
    $searchPram = "";
    if ($id_type == "pc") {
        $searchPram = " `pan_card_uid` = '" . $id_number . "'";
    } else {
        if ($id_type == "pv") {
            $searchPram = " `pv_uid` = '" . $id_number . "'";
        } else {
            if ($id_type == "ac") {
                $searchPram = " `adhar_card_uid` = '" . $id_number . "'";
            } else {
                if ($id_type == "vc") {
                    $searchPram = " `voter_id_uid` = '" . $id_number . "'";
                } else {
                    $searchPram = " `driving_license_uid` = '" . $id_number . "'";
                }
            }
        }
    }
    $sql = "SELECT user_id as id FROM `bluenet_v3`.`user_documents_uid` WHERE" . $searchPram;
    $userrow = mysqli_query($db_handle, $sql);
    $userrowid = mysqli_fetch_array($userrow);
    $userId = $userrowid['id'];
}
$profile = getUserProfile($db_handle, $userId);
echo "{\"root\":{\"worker\":" . json_encode($profile) . "}}";
Beispiel #14
0
/** To retreive the vtiger_tab acion permissions of the specifed user from the various vtiger_profiles associated with the user
 * @param $userid -- The User Id:: Type Integer
 * @returns  user global permission  array in the following format:
 *     $actionPerrArray=(tabid1=>permission,
 * 			   tabid2=>permission);
 */
function getCombinedUserActionPermissions($userId)
{
    $log = vglobal('log');
    $log->debug("Entering getCombinedUserActionPermissions(" . $userId . ") method ...");
    $adb = PearDatabase::getInstance();
    $profArr = getUserProfile($userId);
    $no_of_profiles = sizeof($profArr);
    $actionPerrArr = array();
    $actionPerrArr = getProfileAllActionPermission($profArr[0]);
    if ($no_of_profiles != 1) {
        for ($i = 1; $i < $no_of_profiles; $i++) {
            $tempActionPerrArr = getProfileAllActionPermission($profArr[$i]);
            foreach ($actionPerrArr as $tabId => $perArr) {
                foreach ($perArr as $actionid => $per) {
                    if ($per == 1) {
                        $now_permission = $tempActionPerrArr[$tabId][$actionid];
                        if ($now_permission == 0 && $now_permission != "") {
                            $actionPerrArr[$tabId][$actionid] = $now_permission;
                        }
                    }
                }
            }
        }
    }
    $log->debug("Exiting getCombinedUserActionPermissions method ...");
    return $actionPerrArr;
}
Beispiel #15
0
 public function CheckPermissions($actionKey)
 {
     $current_user = Users_Record_Model::getCurrentUserModel();
     $profileid = getUserProfile($current_user->id);
     $result = false;
     if (isset($this->profilesActions[$actionKey])) {
         //$actionid = getActionid($this->profilesActions[$actionKey]);
         if (isPermitted('PDFMaker', $this->profilesActions[$actionKey]) == "yes") {
             $result = true;
         }
     }
     return $result;
 }
/** Creates a file with all the user, user-role,user-profile, user-groups informations 
 * @param $userid -- user id:: Type integer
 * @returns user_privileges_userid file under the user_privileges directory
 */
function createUserPrivilegesfile($userid)
{
    global $root_directory;
    $handle = @fopen($root_directory . 'user_privileges/user_privileges_' . $userid . '.php', "w+");
    if ($handle) {
        $newbuf = '';
        $newbuf .= "<?php\n\n";
        $newbuf .= "\n";
        $newbuf .= "//This is the access privilege file\n";
        $user_focus = new Users();
        $user_focus->retrieve_entity_info($userid, "Users");
        $userInfo = array();
        $user_focus->column_fields["id"] = '';
        $user_focus->id = $userid;
        foreach ($user_focus->column_fields as $field => $value_iter) {
            $userInfo[$field] = $user_focus->{$field};
        }
        if ($user_focus->is_admin == 'on') {
            $newbuf .= "\$is_admin=true;\n";
            $newbuf .= "\n";
            $newbuf .= "\$user_info=" . constructSingleStringKeyValueArray($userInfo) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "?>";
            fputs($handle, $newbuf);
            fclose($handle);
            return;
        } else {
            $newbuf .= "\$is_admin=false;\n";
            $newbuf .= "\n";
            $globalPermissionArr = getCombinedUserGlobalPermissions($userid);
            $tabsPermissionArr = getCombinedUserTabsPermissions($userid);
            //$tabsPermissionArr=getCombinedUserTabsPermissions($userid);
            $actionPermissionArr = getCombinedUserActionPermissions($userid);
            $user_role = fetchUserRole($userid);
            $user_role_info = getRoleInformation($user_role);
            $user_role_parent = $user_role_info[$user_role][1];
            $userGroupFocus = new GetUserGroups();
            $userGroupFocus->getAllUserGroups($userid);
            $subRoles = getRoleSubordinates($user_role);
            $subRoleAndUsers = getSubordinateRoleAndUsers($user_role);
            $def_org_share = getDefaultSharingAction();
            $parentRoles = getParentRole($user_role);
            $newbuf .= "\$current_user_roles='" . $user_role . "';\n";
            $newbuf .= "\n";
            $newbuf .= "\$current_user_parent_role_seq='" . $user_role_parent . "';\n";
            $newbuf .= "\n";
            $newbuf .= "\$current_user_profiles=" . constructSingleArray(getUserProfile($userid)) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$profileGlobalPermission=" . constructArray($globalPermissionArr) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$profileTabsPermission=" . constructArray($tabsPermissionArr) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$profileActionPermission=" . constructTwoDimensionalArray($actionPermissionArr) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$current_user_groups=" . constructSingleArray($userGroupFocus->user_groups) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$subordinate_roles=" . constructSingleCharArray($subRoles) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$parent_roles=" . constructSingleCharArray($parentRoles) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$subordinate_roles_users=" . constructTwoDimensionalCharIntSingleArray($subRoleAndUsers) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$user_info=" . constructSingleStringKeyValueArray($userInfo) . ";\n";
            $newbuf .= "?>";
            fputs($handle, $newbuf);
            fclose($handle);
        }
    }
}
Beispiel #17
0
function updateUserProfile($userid, $username, $oldpassword, $newpassword, $email, $fullname, $phoneNo)
{
    $sql = "";
    if ($oldpassword != "" && $newpassword != "") {
        $sql = "UPDATE mobile_user SET \n\t\t\tusername='******',\n\t\t\tpassword='******',\n\t\t\temail='{$email}',\n\t\t\tfullname='{$fullname}',\n\t\t\tphoneNo='{$phoneNo}'\n\t\t\tWHERE id='{$userid}' AND password='******'";
        $result = conn()->prepare($sql)->execute();
        $profile = getUserProfile($userid);
        if ($newpassword != $profile["password"]) {
            return false;
        }
        return $result;
    } else {
        $sql = "UPDATE mobile_user SET \n\t\t\tusername='******',\n\t\t\temail='{$email}',\n\t\t\tfullname='{$fullname}',\n\t\t\tphoneNo='{$phoneNo}'\n\t\t\tWHERE id='{$userid}'";
        $result = conn()->prepare($sql)->execute();
        return $result;
    }
}