private function processData($users) { if (!empty($users)) { $csrf_token_url = osc_csrf_token_url(); foreach ($users as $aRow) { $row = array(); $options = array(); $options_more = array(); // first column $options[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=edit&id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>'; $options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=users&action=delete&id[]=' . $aRow['pk_i_id'] . '">' . __('Delete') . '</a>'; $options[] = '<a href="' . osc_user_public_profile_url($aRow['pk_i_id']) . '" targe="_blank">' . __('Public profile') . '</a>'; if ($aRow['b_active'] == 1) { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=deactivate&id[]=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '">' . __('Deactivate') . '</a>'; } else { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=activate&id[]=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '">' . __('Activate') . '</a>'; } if ($aRow['b_enabled'] == 1) { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=disable&id[]=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '">' . __('Block') . '</a>'; } else { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=enable&id[]=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '">' . __('Unblock') . '</a>'; } if (osc_user_validation_enabled() && $aRow['b_active'] == 0) { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=resend_activation&id[]=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '">' . __('Re-send activation email') . '</a>'; } $options_more = osc_apply_filter('more_actions_manage_users', $options_more, $aRow); // more actions $moreOptions = '<li class="show-more">' . PHP_EOL . '<a href="#" class="show-more-trigger">' . __('Show more') . '...</a>' . PHP_EOL . '<ul>' . PHP_EOL; foreach ($options_more as $actual) { $moreOptions .= '<li>' . $actual . "</li>" . PHP_EOL; } $moreOptions .= '</ul>' . PHP_EOL . '</li>' . PHP_EOL; $options = osc_apply_filter('actions_manage_users', $options, $aRow); // create list of actions $auxOptions = '<ul>' . PHP_EOL; foreach ($options as $actual) { $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL; } $auxOptions .= $moreOptions; $auxOptions .= '</ul>' . PHP_EOL; $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL; $status = $this->get_row_status($aRow); $row['status-border'] = ''; $row['status'] = $status['text']; $row['bulkactions'] = '<input type="checkbox" name="id[]" value="' . $aRow['pk_i_id'] . '" /></div>'; $row['email'] = '<a href="' . osc_admin_base_url(true) . '?page=items&userId=' . $aRow['pk_i_id'] . '&user='******'s_name'] . '">' . $aRow['s_email'] . '</a>' . $actions; $row['username'] = $aRow['s_username']; $row['name'] = $aRow['s_name']; $row['date'] = osc_format_date($aRow['dt_reg_date']); $row['items'] = $aRow['i_items']; $row['update_date'] = osc_format_date($aRow['dt_mod_date']); $row = osc_apply_filter('users_processing_row', $row, $aRow); $this->addRow($row); $this->rawRows[] = $aRow; } } }
function osc_pagination_items($extraParams = array(), $field = false) { if (osc_is_public_profile()) { $url = osc_user_list_items_pub_profile_url('{PAGE}', $field); $first_url = osc_user_public_profile_url(); } elseif (osc_is_list_items()) { $url = osc_user_list_items_url('{PAGE}', $field); $first_url = osc_user_list_items_url(); } $params = array('total' => osc_search_total_pages(), 'selected' => osc_search_page(), 'url' => $url, 'first_url' => $first_url); if (is_array($extraParams) && !empty($extraParams)) { foreach ($extraParams as $key => $value) { $params[$key] = $value; } } $pagination = new Pagination($params); return $pagination->doPagination(); }
<div class="caption"> <h3><a href="<?php echo osc_item_url(); ?> "><?php echo osc_item_title(); ?> </a></h3> <p class="user"><?php _e('by', 'flatter'); ?> <?php if (osc_item_user_id() != null) { ?> <a href="<?php echo osc_user_public_profile_url(osc_item_user_id()); ?> " ><?php echo osc_item_contact_name(); ?> </a><?php } else { echo osc_item_contact_name(); } ?> </p> <p class="description"><?php echo osc_highlight(strip_tags(osc_item_description()), 110); ?> </p> <div class="row">
View::newInstance()->_exportVariableToView('user', $user); ?> <li> <?php if ($count + 1 < count($results)) { ?> <div style="border-bottom:1px black dashed;"> <?php } else { ?> <div> <?php } ?> <p style="text-align: center;"><a href="<?php echo osc_user_public_profile_url(); ?> "><?php echo osc_user_name(); ?> </a></p> <p style="text-align: center;"> <img title="<?php echo $tooltip; ?> " src="<?php voting_star(1, $avg_vote); ?> "> <img title="<?php echo $tooltip;
/** * Gets current items page from public profile * * @param int $page * @return string */ function osc_user_list_items_pub_profile_url($page = '', $itemsPerPage = false) { $path = osc_user_public_profile_url(); if ($itemsPerPage) { $path .= "?itemsPerPage=" . $itemsPerPage; } if ($page) { if (!$itemsPerPage) { $path .= "?iPage=" . $page; } else { $path .= "&iPage=" . $page; } } return $path; }
/** * Prints the user's account menu * * @param array $options array with options of the form array('name' => 'display name', 'url' => 'url of link') * @return void */ function osc_private_user_menu($options = null) { if ($options == null) { $options = array(); $options[] = array('name' => __('Public Profile'), 'url' => osc_user_public_profile_url(), 'class' => 'opt_publicprofile'); $options[] = array('name' => __('Dashboard'), 'url' => osc_user_dashboard_url(), 'class' => 'opt_dashboard'); $options[] = array('name' => __('Manage your listings'), 'url' => osc_user_list_items_url(), 'class' => 'opt_items'); $options[] = array('name' => __('Manage your alerts'), 'url' => osc_user_alerts_url(), 'class' => 'opt_alerts'); $options[] = array('name' => __('My profile'), 'url' => osc_user_profile_url(), 'class' => 'opt_account'); $options[] = array('name' => __('Logout'), 'url' => osc_user_logout_url(), 'class' => 'opt_logout'); } $options = osc_apply_filter('user_menu_filter', $options); echo '<script type="text/javascript">'; echo '$(".user_menu > :first-child").addClass("first");'; echo '$(".user_menu > :last-child").addClass("last");'; echo '</script>'; echo '<ul class="user_menu">'; $var_l = count($options); for ($var_o = 0; $var_o < $var_l - 1; $var_o++) { echo '<li class="' . $options[$var_o]['class'] . '" ><a href="' . $options[$var_o]['url'] . '" >' . $options[$var_o]['name'] . '</a></li>'; } osc_run_hook('user_menu'); echo '<li class="' . $options[$var_l - 1]['class'] . '" ><a href="' . $options[$var_l - 1]['url'] . '" >' . $options[$var_l - 1]['name'] . '</a></li>'; echo '</ul>'; }
$user_picture_url = osc_current_web_theme_url('images/user_default.gif'); } ?> <div class="user-avatar"> <img src="<?php echo $user_picture_url; ?> " width="50" height="50" /> </div> <div > <span class="name"><?php echo osc_logged_user_name(); ?> </span> <a href="<?php echo osc_user_public_profile_url(osc_logged_user_id()); ?> "><?php _e('Public profile', 'pop'); ?> </a> </div> </div> <div class="user-menu box"> <?php echo osc_private_user_menu(get_user_menu()); ?> </div> </div> </div> <div id="dialog-delete-account" title="<?php
function pop_email_share_url() { if (osc_is_public_profile()) { $subject = sprintf(__("Check out this profile with interesting products at %s.", 'pop'), osc_page_title()); $body = sprintf(__('Take a look at %1$s\'s profile on %2$s', 'pop'), osc_user_public_profile_url(), osc_page_title()); } if (osc_is_ad_page()) { $subject = sprintf(__("Check out what I just found < %s >", 'pop'), osc_item_title()); $body = sprintf(__('Take a look at %s', 'pop'), osc_item_url()); } return 'mailto:?body=' . $body . '&subject=' . $subject; }
function doModel() { switch ($this->action) { case 'change_email_confirm': //change email confirm if (Params::getParam('userId') && Params::getParam('code')) { $userManager = new User(); $user = $userManager->findByPrimaryKey(Params::getParam('userId')); if ($user['s_pass_code'] == Params::getParam('code') && $user['b_enabled'] == 1) { $userEmailTmp = UserEmailTmp::newInstance()->findByPk(Params::getParam('userId')); $code = osc_genRandomPassword(50); $userManager->update(array('s_email' => $userEmailTmp['s_new_email']), array('pk_i_id' => $userEmailTmp['fk_i_user_id'])); Item::newInstance()->update(array('s_contact_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); ItemComment::newInstance()->update(array('s_author_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); Alerts::newInstance()->update(array('s_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); Session::newInstance()->_set('userEmail', $userEmailTmp['s_new_email']); UserEmailTmp::newInstance()->delete(array('s_new_email' => $userEmailTmp['s_new_email'])); osc_add_flash_ok_message(_m('Your email has been changed successfully')); $this->redirectTo(osc_user_profile_url()); } else { osc_add_flash_error_message(_m('Sorry, the link is not valid')); $this->redirectTo(osc_base_url()); } } else { osc_add_flash_error_message(_m('Sorry, the link is not valid')); $this->redirectTo(osc_base_url()); } break; case 'activate_alert': $email = Params::getParam('email'); $secret = Params::getParam('secret'); $result = 0; if ($email != '' && $secret != '') { $result = Alerts::newInstance()->activate($email, $secret); } if ($result == 1) { osc_add_flash_ok_message(_m('Alert activated')); } else { osc_add_flash_error_message(_m('Ops! There was a problem trying to activate alert. Please contact the administrator')); } $this->redirectTo(osc_base_url(true)); break; case 'unsub_alert': $email = Params::getParam('email'); $secret = Params::getParam('secret'); if ($email != '' && $secret != '') { Alerts::newInstance()->delete(array('s_email' => $email, 'S_secret' => $secret)); osc_add_flash_ok_message(_m('Unsubscribed correctly')); } else { osc_add_flash_error_message(_m('Ops! There was a problem trying to unsubscribe you. Please contact the administrator')); } $this->redirectTo(osc_base_url()); break; case 'pub_profile': $userID = Params::getParam('id'); $user = User::newInstance()->findByPrimaryKey($userID); // user doesn't exist if (!$user) { $this->redirectTo(osc_base_url()); } View::newInstance()->_exportVariableToView('user', $user); $items = Item::newInstance()->findByUserIDEnabled($user['pk_i_id'], 0, 3); View::newInstance()->_exportVariableToView('items', $items); $this->doView('user-public-profile.php'); break; case 'contact_post': $user = User::newInstance()->findByPrimaryKey(Params::getParam('id')); View::newInstance()->_exportVariableToView('user', $user); if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) { if (!osc_check_recaptcha()) { osc_add_flash_error_message(_m('The Recaptcha code is wrong')); Session::newInstance()->_setForm("yourEmail", Params::getParam('yourEmail')); Session::newInstance()->_setForm("yourName", Params::getParam('yourName')); Session::newInstance()->_setForm("phoneNumber", Params::getParam('phoneNumber')); Session::newInstance()->_setForm("message_body", Params::getParam('message')); $this->redirectTo(osc_user_public_profile_url()); return false; // BREAK THE PROCESS, THE RECAPTCHA IS WRONG } } osc_run_hook('hook_email_contact_user', Params::getParam('id'), Params::getParam('yourEmail'), Params::getParam('yourName'), Params::getParam('phoneNumber'), Params::getParam('message')); $this->redirectTo(osc_user_public_profile_url()); break; default: $this->redirectTo(osc_user_login_url()); break; } }
function get_user_menu() { $options = array(); $options[] = array('name' => __('Public Profile'), 'url' => osc_user_public_profile_url(), 'class' => 'opt_publicprofile'); $options[] = array('name' => __('Listings', OSCLASSWIZARDS_THEME_FOLDER), 'url' => osc_user_list_items_url(), 'class' => 'opt_items'); $options[] = array('name' => __('Alerts', OSCLASSWIZARDS_THEME_FOLDER), 'url' => osc_user_alerts_url(), 'class' => 'opt_alerts'); $options[] = array('name' => __('Account', OSCLASSWIZARDS_THEME_FOLDER), 'url' => osc_user_profile_url(), 'class' => 'opt_account'); $options[] = array('name' => __('Change email', OSCLASSWIZARDS_THEME_FOLDER), 'url' => osc_change_user_email_url(), 'class' => 'opt_change_email'); $options[] = array('name' => __('Change username', OSCLASSWIZARDS_THEME_FOLDER), 'url' => osc_change_user_username_url(), 'class' => 'opt_change_username'); $options[] = array('name' => __('Change password', OSCLASSWIZARDS_THEME_FOLDER), 'url' => osc_change_user_password_url(), 'class' => 'opt_change_password'); $options[] = array('name' => __('Delete account', OSCLASSWIZARDS_THEME_FOLDER), 'url' => '#', 'class' => 'opt_delete_account'); return $options; }
function doModel() { switch ($this->action) { case 'change_email_confirm': //change email confirm if (Params::getParam('userId') && Params::getParam('code')) { $userManager = new User(); $user = $userManager->findByPrimaryKey(Params::getParam('userId')); if ($user['s_pass_code'] == Params::getParam('code') && $user['b_enabled'] == 1) { $userEmailTmp = UserEmailTmp::newInstance()->findByPrimaryKey(Params::getParam('userId')); $code = osc_genRandomPassword(50); $userManager->update(array('s_email' => $userEmailTmp['s_new_email']), array('pk_i_id' => $userEmailTmp['fk_i_user_id'])); Item::newInstance()->update(array('s_contact_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); ItemComment::newInstance()->update(array('s_author_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); Alerts::newInstance()->update(array('s_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); Session::newInstance()->_set('userEmail', $userEmailTmp['s_new_email']); UserEmailTmp::newInstance()->delete(array('s_new_email' => $userEmailTmp['s_new_email'])); osc_add_flash_ok_message(_m('Your email has been changed successfully')); $this->redirectTo(osc_user_profile_url()); } else { osc_add_flash_error_message(_m('Sorry, the link is not valid')); $this->redirectTo(osc_base_url()); } } else { osc_add_flash_error_message(_m('Sorry, the link is not valid')); $this->redirectTo(osc_base_url()); } break; case 'activate_alert': $email = Params::getParam('email'); $secret = Params::getParam('secret'); $id = Params::getParam('id'); $alert = Alerts::newInstance()->findByPrimaryKey($id); $result = 0; if (!empty($alert)) { if ($email == $alert['s_email'] && $secret == $alert['s_secret']) { $user = User::newInstance()->findByEmail($alert['s_email']); if (isset($user['pk_i_id'])) { Alerts::newInstance()->update(array('fk_i_user_id' => $user['pk_i_id']), array('pk_i_id' => $id)); } $result = Alerts::newInstance()->activate($id); } } if ($result == 1) { osc_add_flash_ok_message(_m('Alert activated')); } else { osc_add_flash_error_message(_m('Oops! There was a problem trying to activate your alert. Please contact an administrator')); } $this->redirectTo(osc_base_url()); break; case 'unsub_alert': $email = Params::getParam('email'); $secret = Params::getParam('secret'); $id = Params::getParam('id'); $alert = Alerts::newInstance()->findByPrimaryKey($id); $result = 0; if (!empty($alert)) { if ($email == $alert['s_email'] && $secret == $alert['s_secret']) { $result = Alerts::newInstance()->unsub($id); } } if ($result == 1) { osc_add_flash_ok_message(_m('Unsubscribed correctly')); } else { osc_add_flash_error_message(_m('Oops! There was a problem trying to unsubscribe you. Please contact an administrator')); } $this->redirectTo(osc_base_url()); break; case 'pub_profile': if (Params::getParam('username') != '') { $user = User::newInstance()->findByUsername(Params::getParam('username')); } else { $user = User::newInstance()->findByPrimaryKey(Params::getParam('id')); } // user doesn't exist, show 404 error if (!$user) { $this->do404(); return; } $itemsPerPage = Params::getParam('itemsPerPage') != '' ? Params::getParam('itemsPerPage') : 10; $page = Params::getParam('iPage') > 0 ? Params::getParam('iPage') - 1 : 0; $total_items = Item::newInstance()->countItemTypesByUserID($user['pk_i_id'], 'active'); if ($itemsPerPage == 'all') { $total_pages = 1; $items = Item::newInstance()->findItemTypesByUserID($user['pk_i_id'], 0, null, 'active'); } else { $total_pages = ceil($total_items / $itemsPerPage); $items = Item::newInstance()->findItemTypesByUserID($user['pk_i_id'], $page * $itemsPerPage, $itemsPerPage, 'active'); } View::newInstance()->_exportVariableToView('user', $user); $this->_exportVariableToView('items', $items); $this->_exportVariableToView('search_total_pages', $total_pages); $this->_exportVariableToView('search_total_items', $total_items); $this->_exportVariableToView('items_per_page', $itemsPerPage); $this->_exportVariableToView('search_page', $page); $this->_exportVariableToView('canonical', osc_user_public_profile_url()); $this->doView('user-public-profile.php'); break; case 'contact_post': $user = User::newInstance()->findByPrimaryKey(Params::getParam('id')); View::newInstance()->_exportVariableToView('user', $user); if (osc_recaptcha_private_key() != '') { if (!osc_check_recaptcha()) { osc_add_flash_error_message(_m('The Recaptcha code is wrong')); Session::newInstance()->_setForm("yourEmail", Params::getParam('yourEmail')); Session::newInstance()->_setForm("yourName", Params::getParam('yourName')); Session::newInstance()->_setForm("phoneNumber", Params::getParam('phoneNumber')); Session::newInstance()->_setForm("message_body", Params::getParam('message')); $this->redirectTo(osc_user_public_profile_url()); return false; // BREAK THE PROCESS, THE RECAPTCHA IS WRONG } } $banned = osc_is_banned(Params::getParam('yourEmail')); if ($banned == 1) { osc_add_flash_error_message(_m('Your current email is not allowed')); $this->redirectTo(osc_user_public_profile_url()); } else { if ($banned == 2) { osc_add_flash_error_message(_m('Your current IP is not allowed')); $this->redirectTo(osc_user_public_profile_url()); } } osc_run_hook('hook_email_contact_user', Params::getParam('id'), Params::getParam('yourEmail'), Params::getParam('yourName'), Params::getParam('phoneNumber'), Params::getParam('message')); osc_add_flash_ok_message(_m('Your email has been sent properly.')); $this->redirectTo(osc_user_public_profile_url()); break; default: $this->redirectTo(osc_user_login_url()); break; } }
?> <div class="comment clearfix"> <div class="pull-left avatar"> <?php dd_commentpic(); ?> </div> <div class="pull-left message"> <?php /*?><h5><a href="<?php echo osc_user_public_profile_url(osc_comment_user_id()); ?>"><?php echo osc_comment_author_name(); ?></a> <small><?php echo osc_format_date( osc_comment_pub_date() ); ?></small></h5><?php */ ?> <?php if (osc_comment_user_id() != null) { ?> <h5><a href="<?php echo osc_user_public_profile_url(osc_comment_user_id()); ?> "><?php echo osc_comment_author_name(); ?> </a> <small><?php echo osc_format_date(osc_comment_pub_date()); ?> </small></h5> <?php } else { ?> <h5><?php echo osc_comment_author_name(); ?> <small><?php
function dd_commentpic() { if (function_exists("profile_picture_show")) { comment_picture_show(); } else { ?> <a href="<?php echo osc_user_public_profile_url(osc_comment_user_id()); ?> "><img class="img-responsive" src="http://www.gravatar.com/avatar/<?php echo md5(strtolower(trim(osc_comment_author_email()))); ?> ?s=60&d=<?php echo osc_current_web_theme_url('images/user-default.jpg'); ?> " /></a> <?php } }
if (View::newInstance()->_exists('listType')) { $type = View::newInstance()->_get('listType'); } $cols = 4; ?> <div class="toolbars toolbar"><span class="sorting"> <a href="<?php echo osc_user_public_profile_url(Params::getParam('id')); ?> ?sShowAs=list" class="list-button <?php if (osclasswizards_show_as() == 'list') { echo "active"; } ?> " data-class-toggle="listing-grid" data-destination="#listing-card-list"><span> <i class="fa fa-th-list"></i> </span></a> <a href="<?php echo osc_user_public_profile_url(Params::getParam('id')); ?> ?sShowAs=gallery" class="grid-button <?php if (osclasswizards_show_as() == 'gallery') { echo "active"; } ?> " data-class-toggle="listing-grid" data-destination="#listing-card-list"><span> <i class="fa fa-th-large"></i></span></a> </span> </div> <div id="listing-card-list" class="listing-card-list listings_grid listings_grids"> <?php $i = 0; //latest items if ($type == 'latestItems') { $listcount = 0; echo '<ul class="row">'; $listcount = 1;
function get_menu_options() { $options = array(); $options[] = array('name' => __('Public Profile'), 'url' => osc_user_public_profile_url(osc_logged_user_id()), 'class' => 'opt_publicprofile'); $options[] = array('name' => __('Dashboard'), 'url' => osc_user_dashboard_url(), 'class' => 'opt_dashboard'); $options[] = array('name' => __('Manage your listings'), 'url' => osc_user_list_items_url(), 'class' => 'opt_items'); $options[] = array('name' => __('Manage your alerts'), 'url' => osc_user_alerts_url(), 'class' => 'opt_alerts'); $options[] = array('name' => __('My profile'), 'url' => osc_user_profile_url(), 'class' => 'opt_account'); $options[] = array('name' => __('Logout'), 'url' => osc_user_logout_url(), 'class' => 'opt_logout'); return $options; }
function get_user_menu() { $options = array(); $options[] = array('name' => __('Public Profile'), 'url' => osc_user_public_profile_url(), 'class' => 'opt_publicprofile'); $options[] = array('name' => __('Listings', 'osclasswizards'), 'url' => osc_user_list_items_url(), 'class' => 'opt_items'); $options[] = array('name' => __('Alerts', 'osclasswizards'), 'url' => osc_user_alerts_url(), 'class' => 'opt_alerts'); $options[] = array('name' => __('Account', 'osclasswizards'), 'url' => osc_user_profile_url(), 'class' => 'opt_account'); //$options[] = array( // 'name' => __('Change email', 'osclasswizards'), // 'url' => osc_change_user_email_url(), // 'class' => 'opt_change_email' //); //$options[] = array( // 'name' => __('Change username', 'osclasswizards'), // 'url' => osc_change_user_username_url(), // 'class' => 'opt_change_username' //); $options[] = array('name' => __('Change password', 'osclasswizards'), 'url' => osc_change_user_password_url(), 'class' => 'opt_change_password'); $options[] = array('name' => __('Delete account', 'osclasswizards'), 'url' => '#', 'class' => 'opt_delete_account'); return $options; }