function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); $userId = $user->get('id'); $dispatcher = JDispatcher::getInstance(); $this->print = JRequest::getBool('print'); $this->state = $this->get('State'); $this->user = $user; $this->user = ideary::getUserInfoById($this->user->id); $userextra = Ideary::getExtraUserData($_GET["id"]); $this->assignRef('userextra', $userextra); $this->userDatafinal = Ideary::getuserData($this->user->id); $this->userDatafinal = $this->userDatafinal[0]; $this->userExtraData = Ideary::getExtraUserData($this->user->id); $this->period = isset($_POST['period']) ? $_POST['period'] : 'LAST-WEEK'; $this->messages = Ideary::getUserMessages($this->user->id); $user_followers = Ideary::getUserFollowers($this->user->id); $followers = array(); foreach ($user_followers as $follower) { $followers[] = $follower->follower_id; } $this->user_followers = $followers; $this->messages_sent = Ideary::getUserMessagesSent($this->user->id); $this->inbox_messages = Ideary::getMessagesOfFollowedUsersByUserId($this->user->id); $this->unknown_users_messages = Ideary::getMessagesOfNoFollowedUsersByUserId($this->user->id); $this->sent_messages = Ideary::getMessagesSentByUserId($this->user->id); Ideary::setAllMailsAsReaded($this->user->id); //$this->_prepareDocument(); parent::display($tpl); }
function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); $userId = $user->get('id'); $dispatcher = JDispatcher::getInstance(); $this->print = JRequest::getBool('print'); $this->state = $this->get('State'); $this->user = $user; $this->period = isset($_POST['period']) ? $_POST['period'] : 'LAST-WEEK'; $this->authors = ideary::getAllAuthorsOrderByRanking(); //$this->_prepareDocument(); parent::display($tpl); }
/** * Method to log in a user. * * @since 1.6 */ public function login() { //JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); // Populate the data array: $data = array(); $data['return'] = base64_decode(JRequest::getVar('return', '', 'POST', 'BASE64')); $data['return2'] = JRequest::getVar('return2', '', 'POST'); $data['username'] = JRequest::getVar('username', '', 'method', 'username'); $data['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW); // Set the return URL if empty. if (empty($data['return'])) { $data['return'] = 'index.php?option=com_users&view=profile'; } // Set the return URL in the user state to allow modification by plugins $app->setUserState('users.login.form.return', $data['return']); // Get the log in options. $options = array(); $options['remember'] = JRequest::getBool('remember', false); $options['return'] = $data['return']; // Get the log in credentials. $credentials = array(); $credentials['username'] = $data['username']; $credentials['password'] = $data['password']; ideary::setLoginErrorCodeInSession($credentials['username'], $credentials['password']); $app->setUserState('users.login.form.errorlogin', true); $app->setUserState('users.login.errorlogincount', 0); // Perform the log in. if (true === $app->login($credentials, $options)) { // Success $app->setUserState('users.login.form.data', array()); $app->setUserState('users.login.form.errorlogin', false); $app->setUserState('users.login.errorlogincount', 5); $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false)); } else { // Login failed ! $data['remember'] = (int) $options['remember']; $app->setUserState('users.login.form.data', $data); //$app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); $app->redirect(JRoute::_('index.php')); } }
function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $dispatcher = JDispatcher::getInstance(); $user_id = $this->get('id'); $loggedUser = JFactory::getUser(); $loggedUserId = $loggedUser->get('id'); if (isset($_GET["id"])) { $user = ideary::getUserById($_GET["id"], $loggedUserId); $userextra = Ideary::getExtraUserData($_GET["id"]); $this->assignRef('userextra', $userextra); } $texts = ideary::getTextsByUserId($_GET["id"], $loggedUserId); $yes_clapped_texts = ideary::getUserPermission('clap_texts_visib', $_GET["id"], $loggedUserId); $this->assignRef('texts', $texts); $this->assignRef('yes_clapped_texts', $yes_clapped_texts); $this->assignRef('return', $return); $this->assignRef('user', $user); $this->assignRef('loggedUser', $loggedUser); $this->assignRef('lgid', $loggedUserId); $this->document->setTitle($user->name); parent::display($tpl); }
/** * Method to save a user's profile data. * * @return void * @since 1.6 */ public function save() { // Check for request forgeries. //JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $app = JFactory::getApplication(); $app->setUserState('users.editinterest', 0); $model = $this->getModel('Profile', 'UsersModel'); $user = JFactory::getUser(); $userId = (int) $user->get('id'); $useridd = $userId; $error = false; $profileImageErrors = array(); if (isset($_POST["fromwhere"]) && $_POST["fromwhere"] == "editprofile") { $editProfileVersion = 2 - $userId % 2; ideary::logUserExperience(UserExperience::EditProfile, $userId, $editProfileVersion); $jform['name'] = $_POST['jform']['name']; $jform['profile']['dob'] = $_POST['jform']['profile']['dob']; $jform['profile']['country'] = $_POST['jform']['profile']['country']; $jform['profile']['region'] = $_POST['jform']['profile']['region']; $jform['profile']['city'] = $_POST['jform']['profile']['city']; $jform['profile']['phone'] = $_POST['jform']['profile']['phone']; $jform['profile']['address1'] = $_POST['jform']['profile']['address1']; $jform['profile']['address2'] = $_POST['jform']['profile']['address2']; $jform['profile']['website'] = $_POST['jform']['profile']['website']; $jform['profile']['aboutme'] = $_POST['jform']['profile']['aboutme']; $app->setUserState('jform', $jform); $app->setUserState('juser_interests', $_POST['juser_interests']); $file['error'] = $_FILES['jform']['error']['profilepicture']['file']; $file['size'] = $_FILES['jform']['size']['profilepicture']['file']; $file['type'] = $_FILES['jform']['type']['profilepicture']['file']; $file['name'] = $_FILES['jform']['name']['profilepicture']['file']; $file['tmp_name'] = $_FILES['jform']['tmp_name']['profilepicture']['file']; $profileImageErrors = Ideary::validateUploadedImage($file, 200, 200); $app->setUserState('profile-image-errors', $profileImageErrors); if (count($profileImageErrors)) { $error = true; } if ($error) { $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id=' . $userId, false)); return false; } else { //subo imagen de perfil $profileImg = $_FILES['jform']; if ($profileImg['error']['profilepicture']['file'] == 0) { $profileImg['error']['profilepicture']['file']; $folder = "templates/beez_20/images/user_profile/" . $userId . "/"; ideary::rrmdir($folder); if (!file_exists($folder)) { mkdir($folder, 0777, true); } $original_folder = $folder . 'original/'; if (!file_exists($original_folder)) { mkdir($original_folder, 0777, true); } $cincuenta_folder = $folder . '50/'; if (!file_exists($cincuenta_folder)) { mkdir($cincuenta_folder, 0777, true); } $doscientos_folder = $folder . '200/'; if (!file_exists($doscientos_folder)) { mkdir($doscientos_folder, 0777, true); } $ext = "." . pathinfo($profileImg['name']['profilepicture']['file'], PATHINFO_EXTENSION); $randName = rand(1, getrandmax()); $fullRandName = $original_folder . $randName . $ext; while (file_exists($fullRandName)) { $randName = rand(1, getrandmax()); $fullRandName = $original_folder . $randName . $ext; } $ok = move_uploaded_file($profileImg['tmp_name']['profilepicture']['file'], $fullRandName); if ($ok) { Ideary::image_resize($fullRandName, $cincuenta_folder . $randName . $ext, 50, 50, true); Ideary::image_resize($fullRandName, $doscientos_folder . $randName . $ext, 200, 200, true); Ideary::saveProfileImage($userId, $randName . $ext); } } $result = Ideary::saveInterests($userId, $_POST["juser_interests"]); // aca guardo los intereses //subo imagen de fondo $backgroundImg = $_FILES['background-img']; if ($backgroundImg['error'] == 0) { $folder = "templates/beez_20/images/user_backgrounds/" . $userId . "/"; if (!file_exists($folder)) { mkdir($folder, 0777, true); } $ext = "." . pathinfo($backgroundImg['name'], PATHINFO_EXTENSION); $randName = rand(1, getrandmax()); $fullRandName = $folder . $randName . $ext; while (file_exists($fullRandName)) { $randName = rand(1, getrandmax()); $fullRandName = $folder . $randName . $ext; } $ok = move_uploaded_file($backgroundImg["tmp_name"], $fullRandName); if ($ok) { ideary::saveBgImage($userId, $randName . $ext); } } } } elseif (isset($_POST["fromwhere"]) && $_POST["fromwhere"] == "editconfiguration") { $data_notif = JRequest::getVar('privacidad_notificaciones', array(), 'post', 'array'); $result = Ideary::saveUserNotif($userId, $data_notif); // aca guardo los intereses } // Get the user data. $data = JRequest::getVar('jform', array(), 'post', 'array'); //var_dump($data); // Force the ID to this user. $data['id'] = $userId; // Validate the posted data. $form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; } // Validate the posted data. //$data = $model->validate($form, $data); //var_dump($data);die; // Check for errors. if ($data === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState('com_users.edit.profile.data', $data); // Redirect back to the edit screen. $userId = (int) $app->getUserState('com_users.edit.profile.id'); // $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id='.$userId, false)); $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&user_id=' . $userId, false)); return false; } mysql_set_charset("utf8"); // Attempt to save the data. $return = $model->save($data); if (isset($data["params"]["language"])) { $currentuserlang = $data["params"]["language"]; $currentuserlang = substr($currentuserlang, 0, 2); } else { $currentuserlang = "es"; } // Check for errors. if ($return === false) { // Save the data in the session. $app->setUserState('com_users.edit.profile.data', $data); // Redirect back to the edit screen. $userId = (int) $app->getUserState('com_users.edit.profile.id'); $this->setMessage(JText::sprintf('COM_USERS_PROFILE_SAVE_FAILED', $model->getError()), 'warning'); // $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id='.$userId, false)); $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&user_id=' . $useridd . '&lang=' . $currentuserlang)); return false; } // Redirect the user and adjust session state based on the chosen task. switch ($this->getTask()) { case 'apply': // Check out the profile. $app->setUserState('com_users.edit.profile.id', $return); $model->checkout($return); // Redirect back to the edit screen. $this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS')); $this->setRedirect(JRoute::_(($redirect = $app->getUserState('com_users.edit.profile.redirect')) ? $redirect : 'index.php?option=com_users&view=profile&layout=edit&hidemainmenu=1', false)); break; default: // Check in the profile. $userId = (int) $app->getUserState('com_users.edit.profile.id'); if ($userId) { $model->checkin($userId); } // Clear the profile id from the session. $app->setUserState('com_users.edit.profile.id', null); // Redirect to the list screen. $this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS')); $this->setRedirect(JRoute::_(($redirect = $app->getUserState('com_users.edit.profile.redirect')) ? $redirect : 'index.php?option=com_users&view=profile&user_id=' . $return, false)); break; } // Flush the data from the session. $app->setUserState('com_users.edit.profile.data', null); }
public function get_texts_applauded_by_author() { // Get the application object. $app = JFactory::getApplication(); $author_id = JRequest::getInt('author_id'); $user_id = JRequest::getInt('user_id'); $authorsection = JRequest::getInt('authorsection'); $texts = ideary::getTextsApplaudedByUser($author_id); $countAllTexts = ideary::getCountTextsApplaudedByUser($author_id); $textHtmlArray = array(); if (!empty($texts)) { foreach ($texts as $index => $text) { $textHtmlArray[] = ideary::removeNewLinesFromString(ideary::generateTextContent($text, $author_id, $index, true, $authorsection)); } } /*else{ $textHtmlArray[] = '<div class="text"><div class="text-data" style="margin-left: 0px !important;">Aun no has aplaudido ningun texto</div></div>'; }*/ echo json_encode(array('texts' => $textHtmlArray, 'countAllTexts' => $countAllTexts)); $app->close(); }
public function denounceEmailBodyTable($accuser, $denouncedText) { $hello = 'Hola Admin'; $html = '<table style="background:#fff; margin: 0; padding: 0;" width="100%" border="0" cellpadding="0" cellspacing="0" align="center"> <tbody> <tr> <td align="center"> <table width="600" border="0" cellpadding="0" cellspacing="0" align="center"> <tbody> <tr> <td align="center" style="padding-top: 25px;"> <img src="' . JURI::base() . 'images/mailing/logo.png"> </td> </tr> <tr> <td style="padding-top: 25px;"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td style="padding: 0; width: 239px; height: 47px; background-repeat: no-repeat;" background="' . JURI::base() . 'images/mailing/recorte1.png"></td> <td style="max-width: 126px !important; width: 126px !important; height: 21px; background-repeat: repeat-x; padding: 11px 0 15px 0; width: 126px; font-family: georgia; font-size: 13px; line-height: 21px; color: #ffffff; text-align: center;" background="' . JURI::base() . 'images/mailing/recorte3.png" title="' . $hello . '">' . ideary::truncateText($hello, 11) . ',</td> <td style="padding: 0; width: 235px; height: 47px; background-repeat: no-repeat;" background="' . JURI::base() . 'images/mailing/recorte2.png"></td> </tr> </table> </td> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td style="min-width: 20px; width: 20px; background-repeat: repeat-y;" background="' . JURI::base() . 'images/mailing/recorte4.png"></td> <td> <p style="min-width: 500px; max-width: 500px; width: 500px; word-break: break-all; padding: 21px 30px; font-family: georgia; font-size: 14px; line-height: 28px; text-align: left; color: #898989;"><a href="' . JRoute::_(JURI::base() . 'index.php?option=com_contact&view=public&id=' . $accuser->id) . '" target="_blank" style="font-weight: bold;text-decoration: none;color: #898989;">' . $accuser->name . '</a> ha denunciado el texto <a href="' . JRoute::_(JURI::base() . 'index.php?option=com_content&view=article&id=' . $denouncedText->text_id) . '" target="_blank" style="font-weight: bold;text-decoration: none;color: #898989;">"' . $denouncedText->title . '"</a> escrito por <a href="' . JRoute::_(JURI::base() . 'index.php?option=com_contact&view=public&id=' . $denouncedText->user_id) . '" target="_blank" style="font-weight: bold;text-decoration: none;color: #898989;">' . $denouncedText->name . '</a></p> </td> <td style="min-width: 20px; width: 20px; background-repeat: repeat-y;" background="' . JURI::base() . 'images/mailing/recorte5.png"></td> </tr> </table> </td> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td style="min-width: 20px; width: 20px; background-repeat: repeat-y;" background="' . JURI::base() . 'images/mailing/recorte4.png"></td> <td style="width: 185px;"></td> <td> <a href="' . JRoute::_(JURI::base() . 'index.php?option=com_content&view=article&id=' . $denouncedText->text_id) . '" style="text-decoration: none; cursor: pointer;" target="_blank"> <span style="display: block; behavior: url(border-radius.htc); border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; width: 190px; background: #bc5b5e; text-align: center; font-family: georgia; font-size: 16px; line-height: 16px; color: #ffffff; padding: 15px 0 14px 0;"> Ver texto </span> </a> </td> <td style="width: 185px;"></td> <td style="min-width: 20px; width: 20px; background-repeat: repeat-y;" background="' . JURI::base() . 'images/mailing/recorte5.png"></td> </tr> </table> </td> </tr> <tr style="height: 50px;"> <td style="background-repeat: no-repeat; min-height: 50px; height: 50px !important; width: 600px; padding-top: 50px;" background="' . JURI::base() . 'images/mailing/recorte8.png"></td> </tr> <tr> <td align="center"> <p style="word-break: break-word; margin: 0; font-family: georgia; font-size: 11px; line-height: 14px; color: #bfbebe;">Si deseas no seguir recibiendo estos mensajes, podés <a href="#" style="text-decoration: none;"><span style="color: #7a877b;">desuscribirte.</span></a></p> <p style="word-break: break-word; margin: 0; font-family: georgia; font-size: 11px; line-height: 14px; color: #bfbebe;">Para más información, podés leer nuestros <a href="#" style="text-decoration: none;"><span style="color: #7a877b;">Términos y condiciones.</span></a></p> <img src="' . JURI::base() . 'images/mailing/b.png" style="margin-top: 13px;"> <p style="word-break: break-word; margin: 3px 0 0 0; font-family: georgia; font-size: 11px; line-height: 14px; color: #bfbebe;">© 2013 | <a style="text-decoration: none; color: #7a877b;" href="http://www.ideary.com.ar" target="_blank">www.ideary.com.ar</a></p> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table>'; return $html; }
} ?> aplaudieron </span> </div> <?php $applauseGroupper = array(); } else { $applause = $this->applauses[$applausesAndComment[1]]; $applauseAuthorLink = $applause->userId != $user->id ? JRoute::_('index.php?option=com_contact&view=public&id=' . $applause->userId) : JRoute::_('index.php?option=com_users&view=profile&user_id=' . $applause->userId); ?> <div class="comment-applauses"> <a href="<?php echo $applauseAuthorLink; ?> "><?php echo ideary::getUserImage($applause->userId, "50", $applause->name); ?> </a> <span><?php echo $applause->name; ?> aplaudió </span> </div> <?php } } } } ?> </div> </div>
function get_new_notifications() { $app = JFactory::getApplication(); $user = JFactory::getUser(); $lastNotificationId = JRequest::getString("lastNotificationId"); $notifications = ideary::getNoSawNotificationsByUser($user->id, $lastNotificationId); echo json_encode($notifications); $app->close(); }
</div> <div class="text-bottom"> <div class="text-bottom-content"> <div class="text-author"> <?php $author = $text->author; $author = $text->created_by_alias ? $text->created_by_alias : $author; echo JText::_('BY') . ' ' . JHtml::_('link', JRoute::_('index.php?option=com_contact&view=public&id=' . $text->contactid), $author); ?> </div> <div class="text-actions"> <?php $countApplauses = ideary::getCountApplausesByTextId($text->id); ?> <div class="applauses" title="<?php echo str_replace('{x}', $countApplauses, JText::_('X-APPLAUSES')); ?> "> <div class="count_applauses"><?php echo $countApplauses; ?> </div> </div> </div> </div> </div> </div>
} ?> <?php $followers = ideary::getUsersWhoIAmFollowingId($userId); ?> <?php foreach ($texts as $index => $text) { ?> <?php $isFollower = in_array($text->created_by, $followers); ?> texts.push('<?php echo addslashes(ideary::removeNewLinesFromString(ideary::generateTextContent($text, $user->get('id'), $index, false, false, true, "default", $isFollower))); ?> '); //texts.push('<?php //echo addslashes(ideary::removeNewLinesFromString(require JModuleHelper::getLayoutPath('mod_list_text', 'item'))) ?> '); <?php } ?> </script>
echo JText::_('BY'); ?> <a href="<?php echo $userProfileUrl; ?> "><?php echo $this->writer->name; ?> </a> <?php if ($this->item->created != '0000-00-00 00:00:00') { ?> <div id="text-view-text-date" style="text-transform: lowercase;" ><?php echo ideary::textDate($this->item->created); ?> </div> <?php } ?> </div> </div> <div id="text-view-text-adjustments"> <div id="text-view-text-a-plus"></div> <div id="text-view-text-a-minus"></div> <div id="text-view-text-contrast"></div> </div> <div id="text-view-text-content"><?php
/** * Method to start the password reset process. * * @since 1.6 */ public function processResetRequest($data) { $config = JFactory::getConfig(); // Get the form. $form = $this->getForm(); // Check for an error. if ($form instanceof Exception) { return $form; } // Filter and validate the form data. $data = $form->filter($data); $return = $form->validate($data); // Check for an error. if ($return instanceof Exception) { return $return; } // Check the validation results. if ($return === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $message) { $this->setError($message); } return false; } // Find the user id for the given email address. $db = $this->getDbo(); $query = $db->getQuery(true); $query->select('id'); $query->from($db->quoteName('#__users')); $query->where($db->quoteName('email') . ' = ' . $db->Quote($data['email'])); // Get the user object. $db->setQuery((string) $query); $userId = $db->loadResult(); // Check for an error. if ($db->getErrorNum()) { $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $db->getErrorMsg()), 500); return false; } // Check for a user. if (empty($userId)) { $this->setError(JText::_('COM_USERS_INVALID_EMAIL')); return false; } // Get the user object. $user = JUser::getInstance($userId); // Make sure the user isn't blocked. if ($user->block) { $this->setError(JText::_('COM_USERS_USER_BLOCKED')); return false; } // Make sure the user isn't a Super Admin. if ($user->authorise('core.admin')) { $this->setError(JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR')); return false; } // Make sure the user has not exceeded the reset limit if (!$this->checkResetLimit($user)) { $resetLimit = (int) JFactory::getApplication()->getParams()->get('reset_time'); $this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit)); return false; } // Set the confirmation token. $token = JApplication::getHash(JUserHelper::genRandomPassword()); $salt = JUserHelper::getSalt('crypt-md5'); $hashedToken = md5($token . $salt) . ':' . $salt; $user->activation = $hashedToken; $db = JFactory::getDbo(); $query = 'UPDATE #__users SET activation = "' . $hashedToken . '" WHERE id=' . (int) $userId; $db->setQuery($query); $success1 = $db->query(); // Save the user to the database. //if (!$user->save()) { if (!$success1) { return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500); } // Assemble the password reset confirmation link. $mode = $config->get('force_ssl', 0) == 2 ? 1 : -1; $itemid = UsersHelperRoute::getLoginRoute(); $itemid = $itemid !== null ? '&Itemid=' . $itemid : ''; $link = 'index.php?option=com_users&view=reset&layout=confirm' . $itemid; $link = 'http://www.ideary.co/index.php?forgot=confirm'; // Put together the email template data. $data = $user->getProperties(); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['link_text'] = $link; $data['link_html'] = $link; $data['token'] = $token; $subject = JText::sprintf('COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', $data['sitename']); $body = JText::sprintf('COM_USERS_EMAIL_PASSWORD_RESET_BODY', $data['sitename'], $data['token'], $data['link_text']); $body = ideary::emailBodyTableForgotPass($token, $data['link_text']); // Send the password reset request email. //$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $data['fromname'] . ' <' . $data['mailfrom'] . '>' . "\r\n"; $return = mail($user->email, $subject, $body, $headers); //var_dump($return); // Check for an error. if ($return !== true) { return new JException(JText::_('COM_USERS_MAIL_FAILED'), 500); } return true; }
/** * Method to register a user. * * @return boolean True on success, false on failure. * @since 1.6 */ public function register() { // Check for request forgeries. //JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // If registration is disabled - Redirect to login page. if (JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0) { $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); return false; } // Initialise variables. $app = JFactory::getApplication(); $model = $this->getModel('Registration', 'UsersModel'); // Get the user data. $requestData = JRequest::getVar('jform', array(), 'post', 'array'); // Validate the posted data. $form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; } $data = $model->validate($form, $requestData); // Check for validation errors. if ($data === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState('com_users.registration.data', $requestData); foreach ($errors as $error) { if (strstr($error, 'The email address you entered is already in use') !== false) { $app->setUserState('users.registration.errorregis_email', 1); } else { $app->setUserState('users.registration.errorregis_email', 0); } } // Redirect back to the registration screen. //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false)); //REA CHANGE REDIRECT TO URL 03062013 $app->setUserState('users.registration.errorregis', true); $app->setUserState('users.registration.errorregiscount', 0); header("Location: http://" . $_POST["return"]); //$this->setRedirect($_POST["return"]); return false; } // Attempt to save the data. $return = $model->register($data); // Check for errors. if ($return === false) { // Save the data in the session. $app->setUserState('com_users.registration.data', $data); // Redirect back to the edit screen. $this->setMessage(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError()), 'warning'); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false)); $return = ideary::registerDoppler($data); //register doppler //REA CHANGE REDIRECT TO URL 03062013 $this->setRedirect('index.php?codesuccess=110'); return false; } // Flush the data from the session. $app->setUserState('com_users.registration.data', null); $app->setUserState('users.registration.errorregis', false); $app->setUserState('users.registration.errorregiscount', 5); // Redirect to the profile screen. if ($return === 'adminactivate') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY')); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); } elseif ($return === 'useractivate') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE')); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); } elseif ($return === 'register') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE')); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); } else { $this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS')); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); // $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); } return true; }
/** * Method to save a record. * * @param string $key The name of the primary key of the URL variable. * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). * * @return Boolean True if successful, false otherwise. * @since 1.6 */ public function save($key = null, $urlVar = 'a_id') { // Load the backend helper for filtering. require_once JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php'; //var_dump($_POST['jform']);die; $app = JFactory::getApplication(); $error = false; $userId = JFactory::getUser()->get('id'); $isFirstIdeari = false; $jform['title'] = $_POST['jform']['title']; $jform['new'] = $_POST['jform']['new']; $jform['articletext'] = $_POST['jform']['articletext']; $jform['catid'] = 33; $app->setUserState('jformulario', $jform); if ($error) { session_start(); $_SESSION['flash']['msg'] = "Hubo un error al guardar tu Ideary ):"; $_SESSION['flash']['class'] = "error"; $idQueryString = $_POST['jform']['id'] != -1 ? '&a_id=' . $_POST['jform']['id'] : ''; $this->setRedirect(JRoute::_('index.php?option=com_content&view=form&layout=edit' . $idQueryString, false)); } else { $idearyCount = ideary::getCountTextsByUserId($userId); $hasFirst = ideary::getHasFirstByUserId($userId); $isFirstIdeari = !$hasFirst && $idearyCount < 1; $result = parent::save($key, $urlVar); $db =& JFactory::getDBO(); $model = $this->getModel(); if ($_POST['jform']['id'] == -1) { $textId = $model->getLastInsertedTextId(); } else { $textId = $_POST['jform']['id']; $isFirstIdeari = null; } $save_author_write_not = false; $actual_date = ''; if ($_POST['jform']['id'] == -1) { //...si el texto es nuevo. if ($_POST['jform']['state']) { //...si lo estamos publicando. $save_author_write_not = true; } $actual_date = 'created=NOW(), '; } else { $sql = 'SELECT COUNT(*) FROM text_notifications n ' . 'JOIN text_notification_types nt ON (nt.id=n.notification_type_id) ' . 'WHERE text_id=' . $textId . ' AND nt.type="followed_write"'; $db->setQuery($sql); $save_author_write_not = $db->loadResult() ? false : true; } // text was published, notify followers if ($save_author_write_not && $_POST['jform']['state']) { $sql = "SELECT DISTINCT follower_id FROM text_follows WHERE followed_id=" . $userId; $db->setQuery($sql); $authorFollowers = $db->loadObjectList(); foreach ($authorFollowers as $authorFollower) { $query = 'INSERT INTO text_notifications (user_id, notified_id, text_id, notification_type_id, created_at, saw) ' . 'VALUES ' . '(' . $userId . ', ' . $authorFollower->follower_id . ', ' . $textId . ', (SELECT id FROM text_notification_types WHERE TYPE="followed_write"), NOW(), FALSE)'; $db->setQuery($query); $db->query(); } } if (!$_POST['jform']['state']) { // text was unpublished, delete all notifications of it's publication $query = "\n \t \tDELETE FROM text_notifications \n \t \tWHERE text_id={$textId}\n\t\t\t\t\tAND notification_type_id in (\n\t\t\t\t\t\tselect id from text_notification_types\n\t\t\t\t\t\twhere type='followed_write'\n\t\t\t\t\t)"; $db->setQuery($query); $db->query(); } // Strip slashes added by magic quotes by dummy servers if (get_magic_quotes_gpc()) { $_POST['jform']['articletext'] = stripslashes($_POST['jform']['articletext']); } $query = 'UPDATE #__content SET ' . 'introtext="' . mysql_real_escape_string($_POST['jform']['articletext']) . '", ' . 'allow_comments=' . $_POST['jform']['comments'] . ', ' . 'state=' . $_POST['jform']['state'] . ', ' . 'catid=33, ' . 'modified_by=created_by, ' . 'checked_out=created_by, ' . $actual_date . 'editor_font_scale=' . $_POST['jform']['editor-font-scale'] . ', ' . 'editor_font_size="' . $_POST['jform']['editor-font-size'] . '" ' . ($isFirstIdeari === null ? '' : ', first=' . ($isFirstIdeari ? 1 : 0)) . ' ' . 'WHERE id=' . $textId; $db->setQuery($query); $db->query(); $app->setUserState('jformulario', null); ideary::clearCache(); switch ($_POST["accionpost"]) { case 'home': $this->setRedirect(JRoute::_('index.php?option=com_users&view=login')); break; case 'mytexts': $this->setRedirect(JRoute::_('index.php?option=com_users&mytexts=1&view=profile&user_id=' . $userId)); break; case 'draft': $this->setRedirect(JRoute::_('index.php?option=com_users&draft=1&view=profile&user_id=' . $userId)); break; case 'same': session_start(); $_SESSION['flash']['msg'] = "Tu Ideary fue guardado exitosamente!"; $_SESSION['flash']['class'] = "success"; $this->setRedirect(JRoute::_("index.php?option=com_content&Itemid=101&a_id=" . $textId . "&task=article.edit")); break; case 'view': session_start(); $this->setRedirect(JRoute::_("index.php?option=com_content&view=article&id=" . $textId)); break; } return $result; } }
<div id="filters"> <div id="filter-icon"></div> <div id="filter-text"><?php echo JText::_("JGLOBAL_FILTER_LABEL"); ?> </div> <div id="filter-arrow" class="<?php echo $filter_arrow_class; ?> "></div> </div> <div id="combos"> <div id="category-combo"> <?php $categories = ideary::getCategoriesForCombo(); ?> <select name="category" id="category" class="combo"> <option value=""><?php echo JText::_("SELECT"); ?> </option> <option value="-1" <?php echo $category_post == -1 ? 'selected="selected"' : ''; ?> ><?php echo JText::_("JALL"); ?> </option> <?php foreach ($categories as $category) {
<div id="h-scroll-ranking"> <ul id="ul-ranking" style="width: <?php echo count($this->texts) * 320 + 150; ?> px"> <?php $i = 1; ?> <?php foreach ($this->texts as $text) { ?> <?php echo ideary::generateTextRankingHTML($text, $i); ?> <?php $i++; ?> <?php } ?> </ul> </div> <?php } else { ?> <div id="h-scroll-ranking"> <ul id="ul-ranking">
}*/ if ($_GET["option"] != "com_contact" && ($_GET["option"] == "com_content" && $_GET["view"] != "article" && $_GET["view"] != "edit" && $_GET["view"] != "ranking") && $_GET["option"] != "com_users") { //si es home $user = JFactory::getUser(); $category_post = $_POST["category"]; $period_post = $_POST["period"]; $text_search_post = $_POST["text-search"]; $userId = $user->get('id'); /*if((($category_post=="") || (is_null($category_post))) && ($userId!=0)){ // $texts = ideary::getTextsAccordingToUser($userId); //if(count($texts) == 0){ $texts = ideary::getTexts($category_post, $period_post, $text_search_post, $userId); //} } else{ $texts = ideary::getTexts($category_post, $period_post, $text_search_post, $userId); }*/ if (!$text_search_post) { $text_search_post = $_GET['search']; } $limit = isset($_GET['offset']) ? $_GET['offset'] : 20; $texts = ideary::getTexts($category_post, $period_post, $text_search_post, $userId, 0, $limit); $offset = count($texts); $countAlltexts = ideary::getTextsCount($category_post, $period_post, $text_search_post, $userId); $users = array(); if ($text_search_post) { $users = ideary::getWriterSearch($text_search_post, $userId); } $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx')); require JModuleHelper::getLayoutPath('mod_list_text', $params->get('layout', 'default')); }
</span> </div> <div class="applausses" style="background-position: left 2px; margin-top: 8px;"><span class="user-ranking-info-text"><?php echo JText::_('APPLAUSE_GREETED'); ?> </span> <span class="user-ranking-info-count"><?php echo $this->user->applausses_received; ?> </span></div> </div> </div> <?php $interests = ideary::getInterestsByUserId($this->user->id); ?> <?php if (count($interests) > 0) { ?> <div id="public-profile-interests-container"> <div id="public-profile-interests-title-container"> <div id="public-profile-interests-title"><?php echo JTEXT::_('FEATURED_INTERESTS'); ?> </div> <div id="edit-interests" class="public-profile-edit2" title="<?php echo JTEXT::_('EDIT_INTEREST'); ?>
/** * Method to display the view. * * @param string $tpl The template file to include * @since 1.6 */ public function display($tpl = null) { // Get the view data. $this->data = $this->get('Data'); $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->params = $this->state->get('params'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Check if a user was found. if (!$this->data->id) { JError::raiseError(404, JText::_('JERROR_USERS_PROFILE_NOT_FOUND')); return false; } $app = JFactory::getApplication(); $this->user2 = JFactory::getUser(); $getUserId = $_GET['user_id'] ? $_GET['user_id'] : $this->user2->id; if ($getUserId != $this->user2->id) { $app->redirect(JRoute::_('index.php')); } // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } $this->user = ideary::getUserInfoById($this->user2->id); $this->userData = ideary::getUserById($this->user2->id); $resultEN = strpos($this->user->params, 'en-GB'); $resultES = strpos($this->user->params, 'es-ES'); $resultPT = strpos($this->user->params, 'pt-BR'); $userextra = Ideary::getExtraUserData($_GET["id"]); if ($resultEN != false && $resultEN != null) { $currentlang = 'en-GB'; } elseif ($resultES != false && $resultES != null) { $currentlang = 'es-ES'; } elseif ($resultPT != false && $resultPT != null) { $currentlang = 'pt-BR'; } $this->assignRef('userextra', $userextra); $this->assignRef('currentlang', $currentlang); $this->userDatafinal = Ideary::getuserData($this->user->id); $this->userDatafinal = $this->userDatafinal[0]; $this->userExtraData = Ideary::getExtraUserData($this->user->id); $this->cant_pub = Ideary::getUserCantTexts($this->user->id, 1); $this->cant_draft = Ideary::getUserCantTexts($this->user->id, 0); if ($_GET["layout"] == "edit") { $this->categories = Ideary::getCategories(); $this->user_interests = Ideary::getUserInterests($this->user->id); } if ($_GET["layout"] == "userconfiguration") { $this->UserNotifSettings = Ideary::getUserNotifSettings($this->user->id); if (count($this->UserNotifSettings) > 0) { $this->UserNotifSettings = $this->UserNotifSettings[0]; } } $pub = $_GET['draft'] == 1 ? 0 : 1; $text_type = $pub ? 'published' : 'draft'; $texts = ideary::getTextsOfUser($this->user->id, $pub, 0, 10); $countAlltexts = ideary::getCountTextsByUserId($this->user->id, $pub); $this->assignRef('texts', $texts); $this->assignRef('countAlltexts', $countAlltexts); $this->assignRef('text_type', $text_type); //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx')); $this->prepareDocument(); parent::display($tpl); }
<div class="message-container"> <div class="message-header"> <div class="message-title"><?php echo str_replace('{USER}', '<span class="msg-user-link"><a href="index.php?option=com_contact&view=public&id=' . $inbox_message->id . '">' . $inbox_message->name . '</a></span>', JTEXT::_('MESSAGE_SENT_TO')); ?> </div> <div class="message-delete" title="<?php echo JTEXT::_('DELETE_MESSAGE'); ?> " data-message-id="<?php echo $inbox_message->message_id; ?> "></div> <div class="message-date"><?php echo ideary::textDate($inbox_message->date_time); ?> </div> <div style="clear: both;"></div> </div> <div class="message-content"><?php echo $inbox_message->message; ?> </div> <div class="block-user" title="<?php echo JTEXT::_('BLOCK_USER'); ?> "></div> </div>
public function get_recommendations() { $app = JFactory::getApplication(); $userId = JFactory::getUser()->get('id'); $articleId = JRequest::getInt('article_id'); $recommendations = ideary::getRecommendations($articleId, $userId); $result = null; if (count($recommendations) > 0) { $recommendation = $recommendations[0]; $url = ContentHelperRoute::getArticleRoute($recommendation->id, $recommendation->catid); $result = array("recommendation" => $recommendation, "url" => $url); } echo json_encode($result); $app->close(); }
/** * Method to save a record. * * @param string $key The name of the primary key of the URL variable. * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). * * @return boolean True if successful, false otherwise. * * @since 11.1 */ public function save($key = null, $urlVar = null) { // Check for request forgeries. //JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); $model = $this->getModel(); $table = $model->getTable(); $data = JRequest::getVar('jform', array(), 'post', 'array'); $checkin = property_exists($table, 'checked_out'); $context = "{$this->option}.edit.{$this->context}"; $task = $this->getTask(); // Determine the name of the primary key for the data. if (empty($key)) { $key = $table->getKeyName(); } // To avoid data collisions the urlVar may be different from the primary key. if (empty($urlVar)) { $urlVar = $key; } $recordId = JRequest::getInt($urlVar); if (!$this->checkEditId($context, $recordId)) { // Somehow the person just went to the form and tried to save it. We don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return false; } // Populate the row id from the session. $data[$key] = $recordId; // The save2copy task needs to be handled slightly differently. if ($task == 'save2copy') { // Check-in the original row. if ($checkin && $model->checkin($data[$key]) === false) { // Check-in failed. Go back to the item and display a notice. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, $urlVar), false)); return false; } // Reset the ID and then treat the request as for Apply. $data[$key] = 0; $task = 'apply'; } // Access check. if (!$this->allowSave($data, $key)) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return false; } // Validate the posted data. // Sometimes the form needs some posted data, such as for plugins and modules. $form = $model->getForm($data, false); // var_dump($form); if (!$form) { $app->enqueueMessage($model->getError(), 'error'); return false; } // Test whether the data is valid. $validData = $model->validate($form, $data); /* cambio rodrigo para que cambie el alias por un random + el nombre*/ $db =& JFactory::getDBO(); //Si estamos editando un texto... if ($validData['id']) { $textId = $validData['id']; } else { $query = "SELECT MAX(id) FROM text_content"; $db->setQuery($query); $textId = $db->loadResult(); $textId++; } //$alias = ideary::slugify($validData['title']); $alias = ideary::createSlug($validData['title']); $query = "SELECT COUNT(*) FROM text_content WHERE alias='" . $alias . "' AND id!=" . $textId; $db->setQuery($query); $countTexts = $db->loadResult(); //si hay un texto que no sea el actual que posea el mismo alias... if ($countTexts > 0) { $aliasPrefix = $textId . "-"; } else { $aliasPrefix = ''; } $validData['alias'] = $aliasPrefix . $alias; // Check for validation errors. if ($validData === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState($context . '.data', $data); // Redirect back to the edit screen. $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, $urlVar), false)); return false; } // Attempt to save the data. if (!$model->save($validData)) { // Save the data in the session. $app->setUserState($context . '.data', $validData); // Redirect back to the edit screen. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, $urlVar), false)); return false; } // Save succeeded, so check-in the record. if ($checkin && $model->checkin($validData[$key]) === false) { // Save the data in the session. $app->setUserState($context . '.data', $validData); // Check-in failed, so go back to the record and display a notice. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, $urlVar), false)); return false; } $this->setMessage(JText::_(($lang->hasKey($this->text_prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS') ? $this->text_prefix : 'JLIB_APPLICATION') . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS')); // Redirect the user and adjust session state based on the chosen task. switch ($task) { case 'apply': // Set the record data in the session. $recordId = $model->getState($this->context . '.id'); $this->holdEditId($context, $recordId); $app->setUserState($context . '.data', null); $model->checkout($recordId); // Redirect back to the edit screen. $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, $urlVar), false)); break; case 'save2new': // Clear the record id and data from the session. $this->releaseEditId($context, $recordId); $app->setUserState($context . '.data', null); // Redirect back to the edit screen. $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(null, $urlVar), false)); break; default: // Clear the record id and data from the session. $this->releaseEditId($context, $recordId); $app->setUserState($context . '.data', null); // Redirect to the list screen. $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); break; } // Invoke the postSave method to allow for the child class to access the model. $this->postSaveHook($model, $validData); return true; }
}); }); </script> <div id="write-text-form" style="overflow:inherit !important;" class="edit item-page<?php echo $this->pageclass_sfx; ?> "> <?php $userId = JFactory::getUser()->get('id'); $idearyCount = ideary::getCountTextsByUserId($userId); $hasFirst = ideary::getHasFirstByUserId($userId); if (!$hasFirst && $idearyCount < 1) { ?> <div id="first-ideari" >Hola! Veo que estás redactando tu primer Ideari. Quería contarte que Ideari es una comunidad, y nos gustaría conocerte. Por eso, nos encantaría que en esta ocasión nos cuentes un poco sobre vos.</div> <?php } ?> <div id="close-icon" class="cancel-button" title="<?php echo JText::_('JCANCEL'); ?> "></div> <form enctype= "multipart/form-data" action="<?php echo JRoute::_('index.php?option=com_content&a_id=' . (int) $this->item->id);
if (!empty($this->texts)) { ?> <?php if ($_GET['draft'] == 1) { $textContentType = 'draft'; } else { $textContentType = 'mine'; } ?> <script type="text/javascript"> <?php foreach ($this->texts as $index => $text) { ?> texts.push('<?php echo addslashes(ideary::removeNewLinesFromString(ideary::generateTextContent($text, $this->user->id, $index, true, false, false, $textContentType))); ?> '); <?php } ?> </script> <?php } ?> </div> <div style="clear: both;"></div> </div>
</div> <div id="public-profile-right-container"> <div id="h-scroll-container"></div> <?php if (!empty($this->texts)) { ?> <script type="text/javascript"> <?php foreach ($this->texts as $index => $text) { ?> texts.push('<?php echo addslashes(ideary::removeNewLinesFromString(ideary::generateTextContent($text, $this->loggedUser->get('id'), $index))); ?> '); <?php } ?> </script> <?php } ?> </div> <div style="clear: both;"></div> </div>
function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); $userId = $user->get('id'); $dispatcher = JDispatcher::getInstance(); $this->item = $this->get('Item'); /* if ($this->item->state == 0) { //echo 42; print_r($this->item);die(42); $this->setRedirect('..'); $this->redirect(); die(); }*/ $this->category = ideary::getCategoryById($this->item->catid); $this->writer = ideary::getWriterById($this->item->created_by); // $this->writerFiveRecentTexts = ideary::getFiveRecentTextsByAuthor($this->writer->id,$this->item->id); // if($this->item->allow_comments){ $this->comments = ideary::getCommentsByTextId($this->item->id); $comment_text_of_string = JText::_('COMMENT_TEXT_OF'); $comment_text_of_string = str_replace('{AUTHOR}', $this->writer->name, $comment_text_of_string); //$comment_text_of_string = str_replace('{X}', count($this->comments), $comment_text_of_string); $this->comment_text_of = $comment_text_of_string; // } $this->applauses = ideary::getApplausesByTextId($this->item->id); $this->applausesAndCommentsIndex = array(); $datesForSort = array(); for ($i = 0; $i < count($this->applauses); $i++) { $this->applausesAndCommentsIndex[] = array(0, $i, $this->applauses[$i]->ctime); } for ($i = 0; $i < count($this->comments); $i++) { $this->applausesAndCommentsIndex[] = array(1, $i, $this->comments[$i]->ctime); } foreach ($this->applausesAndCommentsIndex as $key => $row) { $datesForSort[$key] = $row[2]; } array_multisort($datesForSort, SORT_DESC, $this->applausesAndCommentsIndex); $this->print = JRequest::getBool('print'); $this->state = $this->get('State'); $this->user = $user; $this->is_applauded = ideary::isApplauded($this->item->id, $userId); $this->is_favorite = ideary::isFavorite($this->item->id, $userId); $this->is_saved = ideary::isSaved($this->item->id, $userId); $this->is_reported = ideary::isReported($this->item->id, $userId); $this->is_writer_followed = ideary::isFollowed($this->item->created_by, $userId); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } // Create a shortcut for $item. $item =& $this->item; // Add router helpers. $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid; $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id; // TODO: Change based on shownoauth $item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)); // Merge article params. If this is single-article view, menu params override article params // Otherwise, article params override menu item params $this->params = $this->state->get('params'); $active = $app->getMenu()->getActive(); $temp = clone $this->params; // Check to see which parameters should take priority if ($active) { $currentLink = $active->link; // If the current view is the active item and an article view for this article, then the menu item params take priority if (strpos($currentLink, 'view=article') && strpos($currentLink, '&id=' . (string) $item->id)) { // $item->params are the article params, $temp are the menu item params // Merge so that the menu item params take priority $item->params->merge($temp); // Load layout from active query (in case it is an alternative menu item) if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } } else { // Current view is not a single article, so the article params take priority here // Merge the menu item params with the article params so that the article params take priority $temp->merge($item->params); $item->params = $temp; // Check for alternative layouts (since we are not in a single-article menu item) // Single-article menu item layout takes priority over alt layout for an article if ($layout = $item->params->get('article_layout')) { $this->setLayout($layout); } } } else { // Merge so that article params take priority $temp->merge($item->params); $item->params = $temp; // Check for alternative layouts (since we are not in a single-article menu item) // Single-article menu item layout takes priority over alt layout for an article if ($layout = $item->params->get('article_layout')) { $this->setLayout($layout); } } $offset = $this->state->get('list.offset'); // Check the view access to the article (the model has already computed the values). /* if ($item->params->get('access-view') != true && (($item->params->get('show_noauth') != true && $user->get('guest') ))) { JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); return; } //Se Saco porque estaba entrando aca ya que no estaba asignado a ningun item de menu. 270513 */ if ($item->params->get('show_intro', '1') == '1') { $item->text = $item->introtext . ' ' . $item->fulltext; } elseif ($item->fulltext) { $item->text = $item->fulltext; } else { $item->text = $item->introtext; } // // Process the content plugins. // JPluginHelper::importPlugin('content'); $results = $dispatcher->trigger('onContentPrepare', array('com_content.article', &$item, &$this->params, $offset)); $item->event = new stdClass(); $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$this->params, $offset)); $item->event->afterDisplayTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$this->params, $offset)); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$this->params, $offset)); $item->event->afterDisplayContent = trim(implode("\n", $results)); // Increment the hit counter of the article. if (!$this->params->get('intro_only') && $offset == 0) { $model = $this->getModel(); $model->hit(); } //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx')); $this->_prepareDocument(); parent::display($tpl); }
<div style="clear: both;"></div> </div> <?php $app->setUserState('jform', null); ?> <div class="edit-profile-input-text-container" style="height: auto;"> <div class="edit-profile-input-text-label"><?php echo JTEXT::_('WALLPAPER'); ?> </div> <div id="background-container"> <?php $filename = ideary::getUserBackgroundFilename($this->user->id); $userBg = "templates/beez_20/images/user_backgrounds/" . $this->user->id . "/" . $filename; ?> <?php if ($filename && file_exists($userBg)) { ?> <div id="background-with-image"> <div id="background-info"> <div id="background-filename">Cambiar Imagen</div> <div id="background-delete" data-has-img="true" title="<?php echo JText::_('DELETE_IMAGE'); ?> "></div> </div> <img src="<?php