function getVotedUsersBirthYear() { $votedUsersBirthYear = array(); $votedUsers = $this->getVotedUsers(); foreach ($votedUsers as $votedUserId) { $user = new UserFunctions(); $user->get_from_db($votedUserId); array_push($votedUsersBirthYear, $user->getBirthYear()); } $votedUsersBirthYear = array_unique($votedUsersBirthYear); asort($votedUsersBirthYear); return $votedUsersBirthYear; }
public static function instance() { if (empty(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
public static function getCommentDate($dt) { $date = new DateTime($dt); $day = $date->format('d'); $months = UserFunctions::months(); $month = $months[intval($date->format('m'))]; $year = $date->format('Y'); $time = $date->format('H:i:s'); $new_dt = $day . " " . $month . " " . $year . " " . Yii::t('trans', 'at') . " " . $time; return $new_dt; }
public function check($attribute, $params) { if (!$this->hasErrors()) { $user = self::model()->findByAttributes(['username' => $this->username]); if (empty($user)) { $this->addError('username', 'Пользователь не найден.'); } else { if ($user->password !== UserFunctions::encode($this->old_password)) { $this->addError('old_password', 'Неверный пароль'); } } } }
public function getBugsDateClosed($no_year = null) { return UserFunctions::GetBugsDate($this->dt_closed, $no_year); }
function searchUsers($get) { /*** * ***/ global $udb, $login_status; $q = $udb->sanitize($get['q']); $response = array('search' => $q); $search = array('username' => $q, 'name' => $q, 'dblink' => $q); $cols = array('username', 'name', 'dblink', "email_verified", "alternate_email_verified", "admin_flag", "alternate_email"); if (!empty($get['cols'])) { if (checkUserColumnExists($get['cols'], false)) { # Replace the defaults $colList = explode(',', $get['cols']); $search = array(); foreach ($colList as $col) { $col = trim($col); # If the column exists, we don't have to sanitize it # $col = $db->sanitize($col); $search[$col] = $q; $cols[] = $col; } } else { $response['notice'] = 'Invalid columns; defaults used'; $response["detail"] = checkUserColumnExists($get["cols"], false, true); } } $response['status'] = true; $result = $udb->getQueryResults($search, $cols, 'OR', true, true); $suFlag = $login_status['detail']['userdata']['su_flag']; $isSu = boolstr($suFlag); $adminFlag = $login_status['detail']['userdata']['admin_flag']; $isAdmin = boolstr($adminFlag); foreach ($result as $k => $entry) { $clean = array('email' => $entry['username'], 'uid' => $entry['dblink'], "has_verified_email" => boolstr($entry["email_verified"]) || boolstr($entry["alternate_email_verified"])); if ($isAdmin) { $clean["is_admin"] = boolstr($entry["admin_flag"]); $clean["alternate_email"] = $entry["alternate_email"]; $tmpUser = new UserFunctions($clean["email"]); $clean["unrestricted"] = $tmpUser->meetsRestrictionCriteria(); } $nameXml = $entry['name']; $xml = new Xml(); $xml->setXml($nameXml); $clean['first_name'] = htmlspecialchars_decode($xml->getTagContents('fname')); $clean['last_name'] = htmlspecialchars_decode($xml->getTagContents('lname')); $clean['full_name'] = htmlspecialchars_decode($xml->getTagContents('name')); $clean['handle'] = $xml->getTagContents('dname'); $result[$k] = $clean; } $response['result'] = $result; $response['count'] = sizeof($result); returnAjax($response); }
function changePassword($get) { /*** * Note that this function assumes that the preprocessor took care * of verifying the new password was as intended. It does NOT * check for a matched password. ***/ try { $u = new UserFunctions($get['username']); $passwordBlob = array('old' => $get['old_password'], 'new' => $get['new_password']); $ret = $u->doUpdatePassword($passwordBlob); } catch (Exception $e) { $ret = array('status' => false, 'error' => $e->getMessage(), 'human_error' => 'There was a problem updating your password (' . $e->getMessage() . '). Please try again.'); } $ret['action'] = 'changepassword'; return $ret; }
echo $class; ?> "><span id="pr_<?php echo $row['id']; ?> " class="text"><?php echo UserFunctions::getPriorityName($row['priority']); ?> </span><select size="1" class="editbox" id="pr_input_<?php echo $row['id']; ?> " ><option value="<?php echo $row['priority']; ?> " selected="selected"><?php echo UserFunctions::getPriorityName($row['priority']); ?> </option> <option value="1">Free</option><option value="2">Normal</option><option value="3">Priority</option><option value="4">Preferred</option> </select></td> <td class="<?php echo $class; ?> "><a href="#" id="<?php echo $row['id']; ?> " class="edit_link">Edit</a></td> </tr>
<?php require_once "administrator/includes/UserFunctions.php"; $cat_id = 1004; $banner = UserFunctions::getBannerName($cat_id); ?> <!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=iso-8859-1" /> <title>Social Search Book</title> <link href="css/style.css" type="text/css" rel="stylesheet" media="screen"/> <style type="text/css"> <!-- body { background-image: url(images/pgbg.jpg); background-color: #EFEFEF; background-repeat: repeat-x; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } .style7 { font-family: Arial, Helvetica, sans-serif; color: #0A63A5; font-size: 24px; font-weight: bold; } .style19 {color: #0A63A5; font-size: 14px; font-family: Arial, Helvetica, sans-serif;} .style22 {color: #0A63A5; font-size: 16px; font-family: Arial, Helvetica, sans-serif; }
} else { $durl = $redirect_url; } } if (strtolower($_REQUEST["action"]) == "verifyemail") { if (!isset($_REQUEST["alternate"])) { $alternate = false; } else { $alternate = toBool($_REQUEST["alternate"]); } $skip = false; if (empty($_REQUEST["username"]) && $logged_in) { $uTemp = $user; } else { if (!empty($_REQUEST["username"])) { $uTemp = new UserFunctions($_REQUEST["username"]); } else { $skip = true; } } if (!$skip) { try { $result = $uTemp->verifyEmail($_REQUEST["token"], $alternate); } catch (Exception $e) { $result = array("status" => false, "error" => $e->getMessage(), "human_error" => "Unable to send verification email"); } if ($result["is_good"] === true || $result["status"] === true) { if ($result["status"] === true) { $class = "alert-success"; $message = "<strong>Success!</strong> You've verified <strong>" . $result["email"] . "</strong>"; # TODO: Add flag to JS remove the verify and
public function actionBarcode() { if (!empty($_POST)) { $barcode = UserFunctions::randomString(10, true); echo $barcode; } }
/** * Do Submit Confirm */ public function doSubmitConfirm($h, $funcs = array()) { $post_id = $h->cage->post->testInt('submit_post_id'); $h->readPost($post_id); // be careful! The results are cached and returned on next readPost $h->changePostStatus('new'); $h->post->status = 'new'; // this fixes a caching-related problem by forcing the new status on the post property $return = 0; // will return false later if set to 1. $h->pluginHook('submit_step_3_pre_trackback'); // Akismet uses this to change the status // set to pending? $set_pending = $h->vars['submit_settings']['set_pending']; if ($set_pending == 'some_pending') { $posts_approved = $h->postsApproved(); $x_posts_needed = $h->vars['submit_settings']['x_posts']; } // Set to pending is the user's permissions for "can_submit" are "mod" OR // if "Put all new posts in moderation" has been checked in Admin->Submit if ($h->currentUser->getPermission('can_submit') == 'mod' || $set_pending == 'all_pending' || $set_pending == 'some_pending' && $posts_approved <= $x_posts_needed) { // Submitted posts given 'pending' for this user $h->changePostStatus('pending'); $h->messages[$h->lang['submit_moderation']] = 'green'; $return = 1; // will return false just after we notify admins of the post (see about 10 lines down) } $h->pluginHook('submit_confirm_pre_trackback'); // Vote uses this to change post status and redirection // notify chosen mods of new post by email if enabled and UserFunctions file exists if ($h->vars['submit_settings']['email_notify'] && file_exists(PLUGINS . 'users/libs/UserFunctions.php')) { require_once PLUGINS . 'users/libs/UserFunctions.php'; $uf = new UserFunctions(); $uf->notifyMods($h, 'post', $h->post->status, $h->post->id); } if ($return == 1) { return false; } // post is pending so we don't want to send a trackback. Return now. $h->sendTrackback(); if (isset($h->vars['submit_redirect'])) { header("Location: " . $h->vars['submit_redirect']); } else { header("Location: " . $h->url(array('page' => 'latest'))); // Go to the Latest page } }
$alphabetIteration = 0; foreach ($question_answers as $question_answer_id) { $answer = new Answer(); $answer->get_from_db($question_answer_id); $cell = divideBy26($columnId) . "2"; $cell_value = $answer->getValue(); // Add some data $objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value); $objPHPExcel->getActiveSheet()->getColumnDimension(divideBy26($columnId))->setWidth(15); $objPHPExcel->getActiveSheet()->getStyle($cell)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); $columnId++; } // list users by survey and group $row_id = 3; foreach ($voted_users as $voted_user_id) { $user = new UserFunctions(); $user->get_from_db($voted_user_id); if (in_array($surveyGroupId, $user->getAllGroupsArray())) { $cell = 'A' . $row_id; $user_number = $row_id - 2; $cell_value = 'User' . $user_number; // Add some data $objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value); // list votes by user $columnId = 2; foreach ($question_answers as $question_answer_id) { $vote = new Vote(); $vote_id_array = $vote->get_by_user_and_answer($voted_user_id, $question_answer_id); $cell_value = ""; $answer = new Answer(); $answer->get_from_db($question_answer_id);
public function actionRestore() { $model = new User('restore'); if (!empty($_POST)) { if (isset($_POST['yt0'])) { $model->attributes = $_POST['User']; $model->confirm = $_POST['User']['confirm']; $model->old_password = $_POST['User']['old_password']; if ($model->validate(['old_password', 'confirm'])) { $user = User::model()->findByAttributes(['username' => $model->username]); $user->password = UserFunctions::encode($model->password); $user->save(false); Yii::app()->user->logout(); $this->redirect(Yii::app()->homeUrl); } } } $this->render('restore', ['model' => $model]); }
public function afterSave() { parent::afterSave(); if (empty($this->url)) { $this->url = new Seo(); $this->url->controller = "bookInfo"; $this->url->action = "about"; $this->url->item_id = $this->id; $url = UserFunctions::translit($this->author->name . "_" . $this->name); if (!is_null(Seo::model()->findByAttributes(array('url' => $url)))) { $url .= time(); } $this->url->url = $url; if ($this->url->save()) { $this->seo_id = $this->url->id; } $this->save(); } }
echo $form->error($profile, "city_id"); ?> </div> <div class="row"> <?php echo $form->labelEx($profile, "birthday"); ?> <?php echo $form->dropDownList($profile, "b_day", UserFunctions::days(), array('class' => 'day', 'empty' => Yii::t('trans', 'Day'))); ?> <?php echo $form->dropDownList($profile, "b_month", UserFunctions::month(), array('class' => 'month', 'empty' => Yii::t('trans', 'Month'))); ?> <?php echo $form->dropDownList($profile, "b_year", UserFunctions::years(1950), array('class' => 'year', 'empty' => Yii::t('trans', 'Year'))); ?> <div class="clear"></div> <?php echo $form->error($profile, "b_day"); ?> <?php echo $form->error($profile, "b_month"); ?> <?php echo $form->error($profile, "b_year"); ?> </div> <input class="button-style" type="submit" name="submit" value="Зареєструватися"> <div class="clear"></div> <!-- <div class="captcha">-->
/* @var BooksCommentToComment $comment */ $class = $comment->rate < 0 ? 'commentFalse' : 'commentTrue'; ?> <div class="<?php echo $class; ?> commentToComment"> <div class="avatar"> </div> <div class="commentInfo"> <p class="user_name"><?php echo $comment->user->name; ?> </p><p class="comment_date"><time datetime="2014-12-09T13:55:16+02:00"><?php echo UserFunctions::getCommentDate($comment->date); ?> </time></p> </div> <div class="commentText containerShort"> <div class="comment_text"><?php echo $comment->comment; ?> </div> <div class="clear"></div> <div class="showHide description_change" other="<?php echo Yii::t('trans', 'Show less'); ?> "><?php echo Yii::t('trans', 'Show more'); ?>
public function actionAddHalfYear() { $start = null; $interval = null; $end = null; if (!empty($_POST['start_dt'])) { $start = $_POST['start_dt']; } if (!empty($_POST['interval'])) { $interval = $_POST['interval']; } if (!empty($_POST['end_dt'])) { $end = $_POST['end_dt']; } echo UserFunctions::addFalfYear($start, $interval, $end); }
</th> <td> <?php echo $data->genre; ?> </td> </tr> <tr> <th> <?php echo Yii::t("trans", "Description"); ?> </th> <td> <?php echo UserFunctions::shorten($data->description, 260); ?> </td> </tr> </table> </div> </a> <?php } ?> <?php $url; ?> </div> <!-- #slideshow ends -->
function authorizeApp($authenticationInformation) { /*** * Primary wrapper function for everything not directly login / auth * related. * * @param array $authenticationInformation * * $authenticationInformation should be an array containing the * following keys: * * @key "auth" - the SHA1 hash of "entropy", server secret key, "action", "app_version" * @key "key" - The encryption key to decrypt the server secret key * @key "app_version" - the application version number * @key "entropy" - A randomly generated string of 16 characters * @key "action" - The action to be executed * @key "data" - A base64-encoded JSON object with structured data for * the action * @key "user_id" - the dblink for the user. This will always be * appended to the values in the "data" key. ***/ if (is_array($authenticationInformation)) { $auth = $authenticationInformation['auth']; $auth_key = $authenticationInformation['key']; $version = $authenticationInformation['app_version']; $entropy = $authenticationInformation['entropy']; $action = $authenticationInformation['action']; $user = $authenticationInformation['user_id']; $device = $authenticationInformation['device_identifier']; $action_data = smart_decode64($authenticationInformation['data']); if (!is_array($action_data)) { returnAjax(array('status' => false, 'human_error' => 'The application and server could not communicate. Please contact support.', 'error' => 'Invalid data object', 'app_error_code' => 101)); } else { # Check structure of variables try { # Reserved for specific data-type checking } catch (Exception $e) { returnAjax(array('status' => false, 'human_error' => 'The application and server could not communicate. Please contact support.', 'error' => $e->getMessage(), 'app_error_code' => 108)); } # Save variables to be used later $action_data['dblink'] = $user; $app_verify = array('device' => $device, 'authorization_token' => $auth, 'auth_prepend' => $entropy, 'auth_postpend' => $action . $version, 'appsecret_key' => $auth_key, 'dblink' => $user); $action_data['application_verification'] = $app_verify; $u = new UserFunctions($user); } } else { returnAjax(array('status' => false, 'human_error' => 'The application and server could not communicate. Please contact support.', 'error' => 'Invalid request', 'app_error_code' => 102)); } /*** * See if the action is a valid action. * Most of these are just going to be wrappers for the * async_login_handler functions. ***/ if (empty($action)) { $action = 'sync'; } $action_function_map = array('save' => 'saveToUser', 'read' => 'getFromUser', 'sync' => 'syncUserData'); if (!array_key_exists($action, $action_function_map)) { returnAjax(array('status' => false, 'human_error' => 'The application and server could not communicate. Please contact support.', 'error' => 'Invalid action', 'app_error_code' => 103)); } # See if the user exists # get the key for $user from the server /*** * Now, we want to authenticate the app against this information. * $auth should be the SHA1 hash of: * * $auth = sha1($entropy.$SERVER_KEY.$action.$version) * * If it isn't, the request is bad. ***/ $r = $u->verifyApp($app_verify); if (!$r['status']) { returnAjax(array('status' => false, 'human_error' => "This app isn't authorized. Please log out and log back in.", 'error' => 'Invalid app credentials', 'app_error_code' => 106)); } # Call the $action $action_data['user_data'] = $r['data']; $action_result = $action_function_map[$action]($action_data); $action_result['elapsed'] = elapsed(); returnAjax($action_result); }
<?php session_start(); require_once "administrator/includes/ADAO.php"; require_once "administrator/includes/UserFunctions.php"; $auth = UserFunctions::isUserAuthenticated(); $item_name = $_POST['item_name']; $item_id = $_POST['item_id']; $cat = $_POST['cat']; $cost = $_POST['cost']; $quantity = $_POST['quantity']; $subtotal = $_POST['subtotal']; $shipping_option = $_POST['shipping_option']; ?> <!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>Sustain Brand</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <link href="css/colorbox.css" rel="stylesheet" type="text/css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/jquery.colorbox.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $(".ajax").colorbox(); }); function ValidateInputs(frm){
</tr> <tr> <td height="35"> </td> <td height="35"> </td> <td height="35"> </td> </tr> </table></td> <td width="1" background="images/searchbarrt.jpg"><img src="images/searchbarrt.jpg" width="2" height="2" /></td> </tr> <tr> <td height="5" colspan="3"><img src="images/searchbarbot_small.jpg" width="400" height="6" /></td> </tr> </table> </form></td> </tr> </table></td> <td> <?php if (UserFunctions::isUserAuthenticated()) { include "common/user_menu.php"; } ?> </tr> </table></td> </tr> <tr> <td><img src="images/bodybot.jpg" width="1000" height="8" /></td> </tr> </table>
/** * Define table name, include language file and creat global Comments object */ public function theme_index_top($h) { // Create a new global object called "comment". require_once LIBS . 'Comment.php'; $h->comment = new Comment(); // Get settings from database if they exist... $comments_settings = $h->getSerializedSettings(); // Assign settings to class member $h->comment->avatars = $comments_settings['comment_avatars']; $h->comment->avatarSize = $comments_settings['comment_avatar_size']; $h->comment->voting = $comments_settings['comment_voting']; $h->comment->email = $comments_settings['comment_email']; $h->comment->allowableTags = $comments_settings['comment_allowable_tags']; $h->comment->levels = $comments_settings['comment_levels']; $h->comment->setPending = $comments_settings['comment_set_pending']; $h->comment->allForms = $comments_settings['comment_all_forms']; $h->vars['comment_hide'] = $comments_settings['comment_hide']; if ($h->pageName == 'rss_comments') { $this->rssFeed($h); return true; } if ($h->pageName == 'comments') { // set current comment and responses to pending: if ($h->cage->get->getAlpha('action') == 'setpending') { // before setting pending, we need to be certain this user has permission: if ($h->currentUser->loggedIn && $h->currentUser->getPermission('can_set_comments_pending') == 'yes') { $cid = $h->cage->get->testInt('cid'); // comment id $comment = $h->comment->getComment($h, $cid); $h->comment->readComment($h, $comment); // read comment $h->comment->status = 'pending'; // set to pending $h->comment->editComment($h); // update this comment $h->comment->postId = $h->cage->get->testInt('pid'); // post id $h->comment->setPendingCommentTree($h, $cid); // set all responses to 'pending', too. // redirect back to thread: $h->post = new Post(); $h->readPost($h->comment->postId); header("Location: " . $h->url(array('page' => $h->post->id))); // Go to the post die; } } // delete current comment and responses: if ($h->cage->get->getAlpha('action') == 'delete') { // before deleting a comment, we need to be certain this user has permission: if ($h->currentUser->loggedIn && $h->currentUser->getPermission('can_delete_comments') == 'yes') { $cid = $h->cage->get->testInt('cid'); // comment id $comment = $h->comment->getComment($h, $cid); $h->comment->readComment($h, $comment); // read comment $h->pluginHook('comments_delete_comment'); $h->comment->deleteComment($h, $cid); // delete this comment $h->comment->deleteCommentTree($h, $cid); // delete all responses, too. $h->clearCache('html_cache', false); // clear HTML cache to refresh Comments and Activity widgets $h->comment->postId = $h->cage->get->testInt('pid'); // post id // redirect back to thread: $h->readPost($h->comment->postId); header("Location: " . $h->url(array('page' => $h->comment->postId))); // Go to the post die; } } // FOR THE COMMENTS PAGE: $h->pageTitle = $h->lang['comments']; if ($h->cage->get->keyExists('user')) { $h->pageTitle .= '[delimiter]' . $h->cage->get->testUsername('user'); } } // Is the comment form open on this thread? $h->comment->thisForm = $h->comment->formStatus($h, 'select'); // returns 'open' or 'closed' if ($h->pageType == 'post' && $h->comment->thisForm == 'open' && $h->comment->allForms == 'checked') { if ($h->currentUser->loggedIn) { if ($h->cage->post->getAlpha('comment_process') == 'newcomment' || $h->cage->post->getAlpha('comment_process') == 'editcomment') { if ($h->cage->post->keyExists('comment_content')) { $h->comment->content = sanitize($h->cage->post->getHtmLawed('comment_content'), 'tags', $h->comment->allowableTags); $h->comment->content = make_urls_clickable($h->comment->content); } if ($h->cage->post->keyExists('comment_post_id')) { $h->comment->postId = $h->cage->post->testInt('comment_post_id'); } if ($h->cage->post->keyExists('comment_user_id')) { $h->comment->author = $h->cage->post->testInt('comment_user_id'); } if ($h->cage->post->keyExists('comment_parent')) { $h->comment->parent = $h->cage->post->testInt('comment_parent'); if ($h->cage->post->getAlpha('comment_process') == 'editcomment') { $h->comment->id = $h->cage->post->testInt('comment_parent'); } } if ($h->cage->post->keyExists('comment_subscribe')) { $h->comment->subscribe = 1; } else { $h->comment->subscribe = 0; $h->comment->unsubscribe($h, $h->comment->postId); } if ($h->cage->post->getAlpha('comment_process') == 'newcomment') { // before posting, we need to be certain this user has permission: $safe = false; $can_comment = $h->currentUser->getPermission('can_comment'); if ($can_comment == 'yes') { $safe = true; } if ($can_comment == 'mod') { $safe = true; $h->comment->status = 'pending'; } $result = array(); // holds results from addComment function // Okay, safe to add the comment... if ($safe) { // A user can unsubscribe by submitting an empty comment, so... if ($h->comment->content != '') { $result = $h->comment->addComment($h); // notify chosen mods of new comment by email if enabled and UserFunctions file exists if ($comments_settings['comment_email_notify'] && file_exists(PLUGINS . 'users/libs/UserFunctions.php')) { require_once PLUGINS . 'users/libs/UserFunctions.php'; $uf = new UserFunctions(); $uf->notifyMods($h, 'comment', $h->comment->status, $h->comment->postId, $h->comment->id); } // email comment subscribers if this comment has 'approved' status: if ($h->comment->status == 'approved') { $this->emailCommentSubscribers($h, $h->comment->postId); } } else { //comment empty so just check subscribe box: $h->comment->updateSubscribe($h, $h->comment->postId); $h->messages[$h->lang['comment_moderation_unsubscribed']] = 'green'; } } if ($result['exceeded_daily_limit']) { $h->messages[$h->lang['comment_moderation_exceeded_daily_limit']] = 'green'; } elseif ($result['exceeded_url_limit']) { $h->messages[$h->lang['comment_moderation_exceeded_url_limit']] = 'green'; } elseif ($result['not_enough_comments']) { $h->messages[$h->lang['comment_moderation_not_enough_comments']] = 'green'; } } elseif ($h->cage->post->getAlpha('comment_process') == 'editcomment') { // before editing, we need to be certain this user has permission: $safe = false; $can_edit = $h->currentUser->getPermission('can_edit_comments'); if ($can_edit == 'yes') { $safe = true; } if ($can_edit == 'own' && $h->currentUser->id == $h->comment->author) { $safe = true; } if ($safe) { $h->comment->editComment($h); } } if ($h->comment->status == 'pending') { return false; } header("Location: " . $h->url(array('page' => $h->comment->postId))); // Go to the post die; } } } return false; }
require_once 'functions.php'; //Различные функции require_once 'class/content.class.php'; //Класс для работы с постами на сайте require_once 'class/info.class.php'; //Класс для получения различной информации require_once 'class/pagination.class.php'; //Пагинация Twig_Autoloader::register(); $loader = new Twig_Loader_Filesystem('templates/default/'); //Путь к шаблону $twig = new Twig_Environment($loader); //Инициализируем шаблонизатор //$info = new info(); $site = new siteFunctions(); $user = new UserFunctions(); //Функции юзеров $projectContent = new ProjectContent(); //Объявления $userContent = new UserContent(); //Пользователи $paginationManager = new paginations(); //Пагинация //Получаем все объявления и юзеров $projectContent->getAllAnnouncement(); //Объялвения $projectContent->getAllProjects(); //Проекты $userContent->getAllUser(); //пользователи //Получаем список всех стран мира
/** * Check email confirmation code * * @return true; */ public function checkEmailConfirmation($h) { $user_id = $h->cage->get->getInt('id'); $conf = $h->cage->get->getAlnum('conf'); $user = new UserAuth(); $user->getUserBasic($h, $user_id); if (!$user_id || !$conf) { $h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red'; } $sql = "SELECT user_email_conf FROM " . TABLE_USERS . " WHERE user_id = %d"; $user_email_conf = $h->db->get_var($h->db->prepare($sql, $user_id)); if ($conf === $user_email_conf) { // update role: $user->role = $h->vars['regStatus']; $h->pluginHook('user_signin_email_conf_post_role'); // update user with new permissions: $new_perms = $user->getDefaultPermissions($h, $user->role); unset($new_perms['options']); // don't need this for individual users $user->setAllPermissions($new_perms); $user->updatePermissions($h); $user->updateUserBasic($h); // set email valid to 1: $sql = "UPDATE " . TABLE_USERS . " SET user_email_valid = %d WHERE user_id = %d"; $h->db->query($h->db->prepare($sql, 1, $user->id)); // notify chosen mods of new user by email: if ($h->vars['useEmailNotify'] == 'checked' && file_exists(PLUGINS . 'users/libs/UserFunctions.php')) { require_once PLUGINS . 'users/libs/UserFunctions.php'; $uf = new UserFunctions(); $uf->notifyMods($h, 'user', $user->role, $user->id); } $success_message = $h->lang['user_signin_register_emailconf_success'] . " <br /><b><a href='" . $h->url(array('page' => 'login')) . "'>" . $h->lang['user_signin_register_emailconf_success_login'] . "</a></b>"; $h->messages[$success_message] = 'green'; } else { $h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red'; } return true; }
<?php session_start(); require_once "administrator/includes/ADAO.php"; require_once "administrator/includes/UserFunctions.php"; $item_id = $_POST['item_id']; $case = $_POST['case']; $product = array(); $product['id'] = $item_id; $product['cat'] = $case; $auth = UserFunctions::isUserAuthenticated(); if (!$auth) { $message = UserFunctions::addtoCartNotLogged($product, $case); } else { $message = UserFunctions::addtoCartLogged($product, $case); } echo $message;
echo $class; ?> "><span id="status_<?php echo $row['id']; ?> " class="text"><?php echo UserFunctions::getStatus($row['status']); ?> </span><select size="1" class="editbox" id="status_input_<?php echo $row['id']; ?> " ><option value="<?php echo $row['status']; ?> " selected="selected"><?php echo UserFunctions::getStatus($row['status']); ?> </option> <option value="1">Active</option><option value="0">Deactive</option> </select></td> <td class="<?php echo $class; ?> "><a href="#" id="<?php echo $row['id']; ?> " class="edit_link">Edit</a></td> </tr>
?> <div> <h3>Test Hash</h3> <p>You can check to ensure the proper functioning of the hashing here. Please note these passwords in the next field are plaintext.</p> <form action='?t=hash' method='post'> <input type='email' name='user' placeholder='username'/><br/> <input type='text' name='pw_base' placeholder='pass'/><br/> <input type='submit'/> </form> </div> <div> <h3>Test Safe Write</h3> <p>You can check to ensure the proper functioning of the writing to the user database here..</p> <?php try { $u = new UserFunctions(); if ($u->validateUser()) { $select = "<select name='col'>"; foreach ($db_cols as $col => $type) { if ($col != 'username' && $col != 'password' && $col != 'auth_key') { $select .= "<option value='{$col}'>{$col}</option>"; } } $select .= "</select>"; ?> <form action='?t=write' method='post'> <input type='text' name='data' placeholder='Data to save'/><br/> <?php echo $select; ?> <br/>
$as_include = true; # The next include includes core, and DB_CONFIG, and sets up $db # require_once(dirname(__FILE__)."/admin-api.php"); $loginStatus = getLoginState(); $viewUserId = $db->sanitize($_GET['id']); if(empty($viewUserId) && $loginStatus["status"]) { $viewUserId = $loginStatus["detail"]["userdata"]["dblink"]; # echo "<!-- ".print_r($loginStatus, true)."\n\n Using $viewUserId -->"; } $setUser = array("dblink" => $viewUserId); # echo "<!-- Setting user \n ".print_r($setUser, true) . "\n -->"; $selfUser = new UserFunctions(); $selfUserId = $selfUser->getHardlink(); $viewUser = new UserFunctions($viewUserId, "dblink"); $validUser = true; $userdata = array(); $realProfileImagePath = "users/profiles/default.png"; $realProfileImagePathXS = "users/profiles/default.png"; $realProfileImagePathSM = "users/profiles/default.png"; try { $userdata = $viewUser->getUser($setUser); if(!is_array($userdata)) $userdata = array(); if(empty($userdata["dblink"])) throw(new Exception("Bad User")); $profileImagePath = "users/profiles/" . $viewUserId; $extensions = array("bmp", "jpg", "jpeg", "png", "gif"); foreach($extensions as $ext) { $testPath = realpath($profileImagePath . "." . $ext); echo "\n\n<!-- Testing path '" . $testPath . "' --> "; if(file_exists($testPath)) {
<table width="600" cellspacing="0" class="basket-table"> <tr> <td colspan="7" align="center"><strong>There are 0 items in your Basket.<br />Click <a href="index.php">here</a> to continue Shopping</strong></td> </tr> </table> <?php } else { $shipping_method = ADAO::getAllShippingMethods(); $cart = ADAO::getUserCartItemIdDetails($_SESSION['id']); $content_Array = ""; foreach ($cart as $index => $cartItems) { $content_Array .= $cartItems['data'] . ","; } $cart1 = substr($content_Array, 0, strlen($content_Array) - 1); $contents1 = UserFunctions::ExplodeItems($cart1); ?> <form method="post" action="shipping.php" name="cart_form" onsubmit="return checkValidation(cart_form)"> <table width="600" cellspacing="0" class="basket-table"> <tr> <td width="151"><strong>Item</strong></td> <td width="99"><strong>Type</strong></td> <td width="115"><strong>Item Description</strong></td> <td width="46"><strong>Price</strong></td> <td width="79"><strong>Quantity</strong></td> <td width="66"><strong>Sub Total</strong></td> <td width="28"> </td> </tr> <tr> <td colspan="7"><img src="images/orange-divider.jpg" width="600" height="2" /></td> </tr>