本文整理汇总了PHP中CKunenaLink::GetMyProfileURL方法的典型用法代码示例。如果您正苦于以下问题:PHP CKunenaLink::GetMyProfileURL方法的具体用法?PHP CKunenaLink::GetMyProfileURL怎么用?PHP CKunenaLink::GetMyProfileURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKunenaLink
的用法示例。
在下文中一共展示了CKunenaLink::GetMyProfileURL方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveUser
protected function saveUser()
{
$app = JFactory::getApplication();
$user = $this->user; //new JUser ( $this->user->get('id') );
// we don't want users to edit certain fields so we will ignore them
$ignore = array('id', 'gid', 'block', 'usertype', 'registerDate', 'activation');
//clean request
$post = JRequest::get( 'post' );
$post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
$post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW);
if (empty($post['password']) || empty($post['password2'])) {
unset($post['password'], $post['password2']);
}
if ($this->config->usernamechange) $post['username'] = JRequest::getVar('username', '', 'post', 'username');
else $ignore[] = 'username';
foreach ($ignore as $field) {
if (isset($post[$field]))
unset($post[$field]);
}
jimport ( 'joomla.version' );
$jversion = new JVersion ();
if ( $jversion->RELEASE == '1.6' ) {
jimport('joomla.user.helper');
$result = JUserHelper::getUserGroups($user->id);
$groups = array();
foreach ( $result as $key => $value ) {
$groups[]= $key;
}
$post['groups'] = $groups;
}
// get the redirect
$return = CKunenaLink::GetMyProfileURL($user->id, '', false);
$err_return = CKunenaLink::GetMyProfileURL($user->id, 'edit', false);
// do a password safety check
if ( !empty($post['password']) && !empty($post['password2']) ) {
if(strlen($post['password']) < 5 && strlen($post['password2']) < 5 ) {
if($post['password'] != $post['password2']) {
$msg = JText::_('COM_KUNENA_PROFILE_PASSWORD_MISMATCH');
$app->redirect ( $err_return, $msg, 'error' );
}
$msg = JText::_('COM_KUNENA_PROFILE_PASSWORD_NOT_MINIMUM');
$app->redirect ( $err_return, $msg, 'error' );
}
}
$username = $this->user->username;
// Bind the form fields to the user table
if (!$user->bind($post)) {
$app->enqueueMessage ( $user->getError(), 'error' );
return false;
}
// Store user to the database
if (!$user->save(true)) {
$app->enqueueMessage ( $user->getError(), 'error' );
return false;
}
$session = JFactory::getSession();
$session->set('user', $user);
// update session if username has been changed
if ( $username && $username != $user->username )
{
$table = JTable::getInstance('session', 'JTable' );
$table->load($session->getId());
$table->username = $user->username;
$table->store();
}
}
示例2: while
if ($do == "decrease") {
$kunena_db->setQuery("UPDATE #__kunena_users SET karma_time={$kunena_db->Quote($time)} WHERE userid={$kunena_db->Quote($kunena_my->id)}");
$kunena_db->query();
if (KunenaError::checkDatabaseError()) {
return;
}
if ($pid) {
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_DECREASE'));
while (@ob_end_clean()) {
}
$kunena_app->redirect(CKunenaLink::GetMessageURL($pid, $catid, 0, false));
} else {
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_DECREASE'));
while (@ob_end_clean()) {
}
$kunena_app->redirect(CKunenaLink::GetMyProfileURL($userid));
}
}
}
}
} else {
//get outa here, you fraud!
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_USER_ERROR_KARMA'));
while (@ob_end_clean()) {
}
$kunena_app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($pid, $kunena_config->messages_per_page));
}
?>
</center>
</td>
</tr>
示例3: cancel
function cancel()
{
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMyProfileURL($this->profile->userid, '', false));
}
示例4: getKRoute
/**
* Method to link to a Kunena user profile page
*
* @param integer $id The user id
*
* @return string The profile url
*/
protected static function getKRoute($id)
{
static $router = null;
// Include the route helper once
if (is_null($router)) {
$file = JPATH_SITE . '/components/com_kunena/lib/kunena.link.class.php';
if (!file_exists($file)) {
$router = false;
} else {
require_once $file;
$router = true;
}
}
// Return null if router was not found
if (!$router) {
return null;
}
// Return link
return CKunenaLink::GetMyProfileURL((int) $id);
}
示例5: saveUser
protected function saveUser()
{
// we only allow users to edit few fields
$allow = array('name', 'email', 'password', 'password2', 'params');
if ($this->config->usernamechange) {
$allow[] = 'username';
}
//clean request
$post = JRequest::get('post');
$post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
$post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW);
if (empty($post['password']) || empty($post['password2'])) {
unset($post['password'], $post['password2']);
}
$post = array_intersect_key($post, array_flip($allow));
// get the redirect
$return = CKunenaLink::GetMyProfileURL($this->user->id, '', false);
$err_return = CKunenaLink::GetMyProfileURL($this->user->id, 'edit', false);
// do a password safety check
if (!empty($post['password']) && !empty($post['password2'])) {
if (strlen($post['password']) < 5 && strlen($post['password2']) < 5) {
if ($post['password'] != $post['password2']) {
$msg = JText::_('COM_KUNENA_PROFILE_PASSWORD_MISMATCH');
$this->app->redirect($err_return, $msg, 'error');
}
$msg = JText::_('COM_KUNENA_PROFILE_PASSWORD_NOT_MINIMUM');
$this->app->redirect($err_return, $msg, 'error');
}
}
$username = $this->user->get('username');
// Bind the form fields to the user table
if (!$this->user->bind($post)) {
return false;
}
// Store user to the database
if (!$this->user->save(true)) {
return false;
}
$session = JFactory::getSession();
$session->set('user', $this->user);
// update session if username has been changed
if ($username && $username != $this->user->username) {
$table = JTable::getInstance('session', 'JTable');
$table->load($session->getId());
$table->username = $this->user->username;
$table->store();
}
return true;
}
示例6: GetMyProfileLink
function GetMyProfileLink($userid, $name = null, $rel = 'nofollow', $task = '')
{
if (!$name) {
$profile = KunenaFactory::getUser($userid);
$name = htmlspecialchars($profile->getName(), ENT_COMPAT, 'UTF-8');
}
return CKunenaLink::GetHrefLink(CKunenaLink::GetMyProfileURL($userid, $task), $name, '', $rel);
}