function edit_profile() { global $db, $err, $log, $website, $userid; try { $sql = "SELECT * FROM `members` WHERE `id` = :userid"; $sql_do = $db->prepare($sql); $sql_do->bindParam(':userid', $userid, PDO::PARAM_INT); $sql_do->execute(); $number = $db->query("SELECT FOUND_ROWS()")->fetchColumn(); } catch (PDOException $e) { $log->logError($e . " - " . basename(__FILE__)); } if (!empty($number)) { $f = $sql_do->fetch(PDO::FETCH_ASSOC); $email_user = cleanInput($f['email']); $first_name = cleanInput($f['first_name']); $last_name = cleanInput($f['last_name']); $joined_on = cleanInput($f['join']); $last_access = cleanInput($f['access']); $user_bio = cleanInput($f['bio']); /* displaying gravatar photo over here if email is associated with a gravatar account. */ $default = $website . "/images/anonuser_50px.gif"; $gravatar = new Gravatar($email_user, $default); $gravatar->size = 50; ?> <div class="page-header no-border"> <h1><img class="profilephoto thumbnail" src="<?php echo $gravatar->getSrc(); ?> " /> <?php echo $first_name . " " . $last_name; ?> </h1> </div> <div class="tabs-left"> <ul class="nav nav-tabs" id="usermanage"> <li class="active"><a href="#general" data-toggle="tab"><i class="icon-cog"></i> <?php echo _("General"); ?> </a></li> <li><a href="#profile" data-toggle="tab"><i class="icon-user"></i> <?php echo _("Profile"); ?> </a></li> </ul> <form class="form-horizontal" method="POST" action="<?php echo $website . "/" . USER_DIRECTORY; ?> /editprofile"> <div class="tab-content"> <div class="tab-pane active" id="general"> <fieldset> <legend><?php echo _("General"); ?> </legend> <?php echo $err; ?> <div class="control-group"> <label class="control-label" for="first_name"><?php echo _("First Name"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge" id="first_name" name="first_name" value="<?php echo $first_name; ?> "> </div> </div> <div class="control-group"> <label class="control-label" for="last_name"><?php echo _("Last Name"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge" id="last_name" name="last_name" value="<?php echo $last_name; ?> "> </div> </div> <div class="control-group"> <label class="control-label" for="email"><?php echo _("Email"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="email" name="email" value="<?php echo $email_user; ?> " disabled> </div> </div> <div class="control-group"> <label class="control-label" for="pass"><?php echo _("Password"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="pass" name="pass" value="<?php echo $f['password']; ?> " disabled> </div> </div> <div class="control-group"> <label class="control-label" for="join"><?php echo _("Joined On"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="join" name="join" value="<?php echo $joined_on; ?> " disabled> </div> </div> <div class="control-group"> <label class="control-label" for="access"><?php echo _("Last Access"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="access" name="access" value="<?php echo $last_access; ?> " disabled> </div> </div> </fieldset> </div> <div class="tab-pane" id="profile"> <fieldset> <legend><?php echo _("Profile"); ?> </legend> <?php echo $err; ?> <div class="control-group"> <label class="control-label" for="bio"><?php echo _("Bio"); ?> </label> <div class="controls"> <textarea class="input-xxlarge" id="bio" name="bio" rows="8"><?php echo $user_bio; ?> </textarea> </div> </div> </fieldset> </div> <div class="form-actions"> <input type="submit" class="btn btn-primary" name="editprofile" value="<?php echo _("Update Profile"); ?> "> </div> </form> </div> <?php } else { echo "<div class=\"alert alert-error\"><strong>" . _("Oops!") . "</strong><br/>" . _("We are unable to find the user in our system. You can still try again later.") . "</div>"; } }
/** * FUNCTION USED TO GE USER THUMBNAIL * @param : thumb file * @param : size (NULL,small) */ function getUserThumb($udetails, $size = '', $uid = NULL, $just_file = false) { $remote = false; if (empty($udetails['userid']) && $uid) { $udetails = $this->get_user_details($uid); } //$thumbnail = $udetails['avatar'] ? $udetails['avatar'] : NO_AVATAR; $thumbnail = $udetails['avatar']; $thumb_file = USER_THUMBS_DIR . '/' . $thumbnail; if (file_exists($thumb_file) && $thumbnail) { $thumb = USER_THUMBS_URL . '/' . $thumbnail; } elseif (!empty($udetails['avatar_url'])) { $thumb = $udetails['avatar_url']; $remote = true; } else { if (!USE_GAVATAR) { $thumb_file = $this->get_default_thumb(); } else { switch ($size) { case "small": $thesize = AVATAR_SMALL_SIZE; $default = $this->get_default_thumb('small'); break; default: $thesize = AVATAR_SIZE; $default = $this->get_default_thumb(); } $email = $udetails['email']; $email = $email ? $email : $udetails['anonym_email']; $gravatar = new Gravatar($email, $default); $gravatar->size = $thesize; $gravatar->rating = "G"; $gravatar->border = "FF0000"; $thumb = $gravatar->getSrc(); //echo $gravatar->toHTML(); } } $ext = GetExt($thumb_file); $file = getName($thumb_file); if (!$remote) { if (!empty($size) && !$thumb) { $thumb = $this->get_default_thumb('small'); } elseif (!$thumb) { $thumb = $this->get_default_thumb(); } } if ($just_file) { return $file . '.' . $ext; } return $thumb; }
$gravatar->size = 25; ?> <tr id="td<?php echo $id; ?> "> <td><input type="checkbox" name="users[]" value="<?php echo $id; ?> " onclick="highlight(this);"></td> <td><?php echo $id; ?> </td> <td><img class="adminusers thumbnail" src="<?php echo $gravatar->getSrc(); ?> " /><a href="<?php echo $website . "/" . ADMIN_DIRECTORY . "/manageuser/" . $id; ?> "><?php echo $fn . " " . $ln; ?> </a> <?php echo $class; ?> </td> <td><?php echo $is_verified; ?> </td>
function admin_edit_user($id) { global $db, $err, $log, $website; $current_url = current_url(); try { $sql = "SELECT * FROM `members` WHERE `id` = :id"; $sql_do = $db->prepare($sql); $sql_do->bindParam(':id', $id, PDO::PARAM_INT); $sql_do->execute(); $number = $db->query("SELECT FOUND_ROWS()")->fetchColumn(); } catch (PDOException $e) { $log->logError($e . " - " . basename(__FILE__)); } if (!empty($number)) { $f = $sql_do->fetch(PDO::FETCH_ASSOC); $verified = intval($f['verified']); $email_user = cleanInput($f['email']); $first_name = cleanInput($f['first_name']); $last_name = cleanInput($f['last_name']); $banned = intval($f['banned']); $joined_on = cleanInput($f['join']); $last_access = cleanInput($f['access']); $user_bio = cleanInput($f['bio']); /* displaying gravatar photo over here if email is associated with a gravatar account. */ $default = $website . "/images/anonuser_50px.gif"; $gravatar = new Gravatar($email_user, $default); $gravatar->size = 50; ?> <div class="page-header no-border"> <h1><img class="profilephoto thumbnail" src="<?php echo $gravatar->getSrc(); ?> " /> <?php echo $first_name . " " . $last_name; ?> </h1> </div> <?php echo "<ul class=\"breadcrumb\">\n<li><a href=\"{$website}/" . ADMIN_DIRECTORY . "/settings\">" . _("Home") . "</a> <span class=\"divider\">/</span></li>\n<li><a href=\"{$website}/" . ADMIN_DIRECTORY . "/users\">" . _("Users") . "</a> <span class=\"divider\">/</span></li>\n<li class=\"active\">{$first_name} {$last_name}</li>\n</ul>"; ?> <div class="tabs-left"> <ul class="nav nav-tabs" id="usermanage"> <li class="active"><a href="#general" data-toggle="tab"><i class="icon-cog"></i> <?php echo _("General"); ?> </a></li> <li><a href="#profile" data-toggle="tab"><i class="icon-user"></i> <?php echo _("Profile"); ?> </a></li> <li><a href="#logs" data-toggle="tab"><i class="icon-list-alt"></i> <?php echo _("Access Logs"); ?> </a></li> </ul> <form class="form-horizontal" method="POST" action="<?php echo $current_url; ?> "> <div class="tab-content"> <div class="tab-pane active" id="general"> <fieldset> <legend><?php echo _("General"); ?> </legend> <?php echo $err; ?> <div class="control-group"> <label class="control-label" for="first_name"><?php echo _("First Name"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge" id="first_name" name="first_name" value="<?php echo $first_name; ?> "> </div> </div> <div class="control-group"> <label class="control-label" for="last_name"><?php echo _("Last Name"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge" id="last_name" name="last_name" value="<?php echo $last_name; ?> "> </div> </div> <div class="control-group"> <label class="control-label" for="email"><?php echo _("Email"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="email" name="email" value="<?php echo $email_user; ?> " disabled> </div> </div> <div class="control-group"> <label class="control-label" for="pass"><?php echo _("Password"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="pass" name="pass" value="<?php echo $f['password']; ?> " disabled> </div> </div> <div class="control-group"> <label class="control-label" for="verified"><?php echo _("Verified"); ?> </label> <div class="controls"> <select name="verified" id="verified"> <option value="1"<?php if ($verified == 1) { echo " selected=\"selected\""; } ?> ><?php echo _("Yes"); ?> </option> <option value="0"<?php if ($verified == 0) { echo " selected=\"selected\""; } ?> ><?php echo _("No"); ?> </option> </select> </div> </div> <div class="control-group"> <label class="control-label" for="join"><?php echo _("Joined On"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="join" name="join" value="<?php echo $joined_on; ?> " disabled> </div> </div> <div class="control-group"> <label class="control-label" for="access"><?php echo _("Last Access"); ?> </label> <div class="controls"> <input type="text" class="input-xlarge disabled" id="access" name="access" value="<?php echo $last_access; ?> " disabled> </div> </div> <div class="control-group"> <label class="control-label" for="ban"><?php echo _("Banned"); ?> </label> <div class="controls"> <select name="ban" id="ban"> <option value="1"<?php if ($banned == 1) { echo " selected=\"selected\""; } ?> ><?php echo _("Yes"); ?> </option> <option value="0"<?php if ($banned == 0) { echo " selected=\"selected\""; } ?> ><?php echo _("No"); ?> </option> </select> </div> </div> </fieldset> </div> <div class="tab-pane" id="profile"> <fieldset> <legend><?php echo _("Profile"); ?> </legend> <?php echo $err; ?> <div class="control-group"> <label class="control-label" for="bio"><?php echo _("Bio"); ?> </label> <div class="controls"> <textarea class="input-xxlarge" id="bio" name="bio" rows="8"><?php echo $user_bio; ?> </textarea> </div> </div> </fieldset> </div> <div class="tab-pane" id="logs"> <fieldset> <legend><?php echo _("Access Logs"); ?> </legend> <?php try { $q = "SELECT * FROM `access` WHERE `userid` = :userid ORDER BY `id` DESC"; $q_do = $db->prepare($q); $q_do->bindParam(':userid', $id, PDO::PARAM_INT); $q_do->execute(); $number = $db->query("SELECT FOUND_ROWS()")->fetchColumn(); } catch (PDOException $e) { $log->logError($e . " - " . basename(__FILE__)); } if (!empty($number)) { echo "<table class=\"table table-condensed\">\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>" . _("IP Address") . "</th>\n\t\t\t<th>" . _("Country") . "</th>\n\t\t\t<th>" . _("Access") . "</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>"; /* initializing the ip2country class for converting ip address to country. */ $ip2country = new ip2country($db); /* displaying the information in a while loop. */ while ($row = $q_do->fetch(PDO::FETCH_ASSOC)) { $ip = cleanInput($row['ip_address']); $date = cleanInput($row['datetime']); /* fetching country name for the specific ip address */ $country = $ip2country->get_country_name($ip); echo "<tr>"; echo "<td>{$ip}</td>"; echo "<td>{$country}</td>"; echo "<td><abbr class=\"micro\" title=\"{$date}\"></abbr></td>"; echo "</tr>"; } echo "</tbody>\n\t\t\t</table>"; } else { echo "<div class=\"alert\"><strong>" . _("No Access Records.") . "</strong><br/>" . _("There are no access records for this user in the database.") . "</div>"; } ?> </fieldset> </div> <div class="form-actions"> <input type="submit" class="btn btn-primary" name="edituser" value="<?php echo _("Update User"); ?> "> </div> </div> </form> </div> <?php } else { echo "<div class=\"alert alert-error\"><strong>" . _("Not Found.") . "</strong><br/>" . _("User does not exist in the database. There are no records matching the user ID specified.") . "</div>"; } }
/** * FUNCTION USED TO GE USER THUMBNAIL * @param : thumb file * @param : size (NULL,small) */ function getUserThumb($udetails, $size = '', $uid = NULL, $just_file = false) { global $Cbucket; $remote = false; if (empty($udetails['userid']) && $uid) { $udetails = $this->get_user_details($uid); } //$thumbnail = $udetails['avatar'] ? $udetails['avatar'] : NO_AVATAR; $thumbnail = $udetails['avatar']; $thumb_file = USER_THUMBS_DIR . '/' . $thumbnail; if (file_exists($thumb_file) && $thumbnail) { $thumb = USER_THUMBS_URL . '/' . $thumbnail; } elseif (!empty($udetails['avatar_url'])) { $thumb = $udetails['avatar_url']; $remote = true; } else { if (!USE_GAVATAR) { $thumb_file = $this->get_default_thumb(); } else { switch ($size) { case "small": $thesize = AVATAR_SMALL_SIZE; $default = $this->get_default_thumb('small'); break; default: $thesize = AVATAR_SIZE; $default = $this->get_default_thumb(); } $email = $udetails['email']; $email = $email ? $email : $udetails['anonym_email']; $gravatar = new Gravatar($email, $default); $gravatar->size = $thesize; $gravatar->rating = "G"; $gravatar->border = "FF0000"; $thumb = $gravatar->getSrc(); //echo $gravatar->toHTML(); } } $ext = GetExt($thumb_file); $file = getName($thumb_file); if (!$remote) { if (!empty($size) && !$thumb) { $thumb = USER_THUMBS_URL . '/' . $file . '-' . $size . '.' . $ext; $thumb_path = $file . '.' . $ext; } elseif (!$thumb) { $thumb = USER_THUMBS_URL . '/' . $file . '.' . $ext; $thumb_path = ""; } } $thumb_name = $file . '.' . $ext; if ($just_file) { return $file . '.' . $ext; } if ($size) { $params = array('size' => $size, 'thumb_path' => "images/avatars/", 'thumb_name' => $thumb_name, 'just_file' => $just_file, 'is_remote' => $remote); if (count($Cbucket->custom_user_thumb) > 0) { $functions = $Cbucket->custom_user_thumb; foreach ($functions as $func) { if (function_exists($func)) { $func_data = $func($params); if ($func_data) { return $func_data; } } } } return $thumb = USER_THUMBS_URL . '/' . $file . '.' . $ext; //return $this->resizer($size,$thumb); } return $thumb; }
function subheader($title = null, $css = null, $js = null) { global $webtitle, $website, $sesslife, $userid, $_setting, $first_name, $last_name, $username, $is_admin; ?> <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title><?php if (!empty($title)) { echo $title . " - "; } echo $webtitle; ?> </title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="Description" content="<?php echo $_setting['description']; ?> " /> <meta name="Keywords" content="<?php echo $_setting['keywords']; ?> " /> <meta name="Author" content="StitchApps" /> <link href="<?php echo $website; ?> /css/bootstrap.css" media="screen" rel="stylesheet" type="text/css" /> <link href="<?php echo $website; ?> /css/bootstrap-responsive.css" media="screen" rel="stylesheet" type="text/css" /> <link href="<?php echo $website; ?> /css/style.css" media="screen" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="<?php echo $website; ?> /images/favicon.ico"> <?php /* additional css files for specific pages */ echo $css; ?> <script type="text/javascript" src="<?php echo $website . "/" . JS_DIRECTORY; ?> /jquery.min.js"></script> <script type="text/javascript" src="<?php echo $website . "/" . JS_DIRECTORY; ?> /bootstrap.min.js"></script> <?php /* additional js files for specific pages */ echo $js; ?> </head> <body> <?php if ($_setting['enable_facebook'] == 1) { ?> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId : '<?php echo $_setting['facebook_api']; ?> ', channelUrl : '//<?php echo $website; ?> /channel.html', status : true, cookie : true, xfbml : true }); }; (function(d) { var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); </script> <?php } ?> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="brand" href="<?php echo $website; ?> "><img src="<?php echo $website; ?> /images/am_logo.png" /></a> <?php if ($is_admin == 1) { ?> <div class="btn-group pull-left"> <button class="btn btn-danger"><?php echo _("Admin"); ?> </button> <button class="btn btn-danger dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a href="<?php echo $website . "/" . ADMIN_DIRECTORY; ?> /statistics"><i class="icon-signal"></i> <?php echo _("Statistics"); ?> </a></li> <li><a href="<?php echo $website . "/" . ADMIN_DIRECTORY; ?> /users"><i class="icon-user"></i> <?php echo _("Users"); ?> </a></li> <li><a href="<?php echo $website . "/" . ADMIN_DIRECTORY; ?> /settings"><i class="icon-wrench"></i> <?php echo _("Settings"); ?> </a></li> <li><a href="<?php echo $website . "/" . ADMIN_DIRECTORY; ?> /access"><i class="icon-list-alt"></i> <?php echo _("Access"); ?> </a></li> <li><a href="<?php echo $website . "/" . ADMIN_DIRECTORY; ?> /sql-logs"><i class="icon-warning-sign"></i> <?php echo _("Logs"); ?> </a></li> </ul> </div> <?php } ?> <div class="nav-collapse collapse"> <ul class="nav pull-right"> <?php if ($sesslife == false) { ?> <li><a href="<?php echo $website . "/" . USER_DIRECTORY; ?> /login"><?php echo _("Login"); ?> </a></li> <li><a href="<?php echo $website . "/" . USER_DIRECTORY; ?> /register"><?php echo _("Register"); ?> </a></li> <?php } else { /* displaying gravatar photo over here if email is associated with a gravatar account. */ $default = $website . "/images/anonuser_50px.gif"; $gravatar = new Gravatar($username, $default); $gravatar->size = 50; ?> <img src="<?php echo $gravatar->getSrc(); ?> " class="profile-photo"> <li><a href="<?php echo $website; ?> /profile/<?php echo $userid; ?> "><?php echo $first_name . " " . $last_name; ?> </a></li> <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Account"); ?> <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="<?php echo $website . "/" . USER_DIRECTORY; ?> /account"><?php echo _("Info"); ?> </a></li> <li><a href="<?php echo $website . "/" . USER_DIRECTORY; ?> /changepassword"><?php echo _("Change Password"); ?> </a></li> <li><a href="<?php echo $website . "/" . USER_DIRECTORY; ?> /editprofile"><?php echo _("Edit Profile"); ?> </a></li> <li class="divider"></li> <li> <?php if (!empty($_SESSION["code"])) { ?> <a href="https://www.facebook.com/logout.php?next=<?php echo urlencode($website . "/" . USER_DIRECTORY . "/logout"); ?> &access_token=<?php echo $_SESSION["access_token"]; ?> "><?php echo _("Logout"); ?> </a> <?php } else { ?> <a href="<?php echo $website . "/" . USER_DIRECTORY; ?> /logout"><?php echo _("Logout"); ?> </a> <?php } ?> </li> </ul> </li> <?php } ?> </ul> </div> </div> </div> </div> <div class="container"> <?php }