// Module Menu $moduleMenu = new Menu('modules', $gL10n->get('SYS_MODULES')); $moduleMenu->addItem('overview', '/adm_program/index.php', $gL10n->get('SYS_OVERVIEW'), '/icons/home.png'); if ($gPreferences['enable_announcements_module'] == 1 || $gPreferences['enable_announcements_module'] == 2 && $gValidLogin) { $moduleMenu->addItem('announcements', '/adm_program/modules/announcements/announcements.php', $gL10n->get('ANN_ANNOUNCEMENTS'), '/icons/announcements.png'); } if ($gPreferences['enable_download_module'] == 1) { $moduleMenu->addItem('download', '/adm_program/modules/downloads/downloads.php', $gL10n->get('DOW_DOWNLOADS'), '/icons/download.png'); } if ($gPreferences['enable_mail_module'] == 1 && !$gValidLogin) { $moduleMenu->addItem('email', '/adm_program/modules/messages/messages_write.php', $gL10n->get('SYS_EMAIL'), '/icons/email.png'); } if (($gPreferences['enable_pm_module'] == 1 || $gPreferences['enable_mail_module'] == 1) && $gValidLogin) { $unreadBadge = ''; // get number of unread messages for user $message = new TableMessage($gDb); $unread = $message->countUnreadMessageRecords($gCurrentUser->getValue('usr_id')); if ($unread > 0) { $unreadBadge = '<span class="badge">' . $unread . '</span>'; } $moduleMenu->addItem('private_message', '/adm_program/modules/messages/messages.php', $gL10n->get('SYS_MESSAGES') . $unreadBadge, '/icons/messages.png'); } if ($gPreferences['enable_photo_module'] == 1 || $gPreferences['enable_photo_module'] == 2 && $gValidLogin) { $moduleMenu->addItem('photo', '/adm_program/modules/photos/photos.php', $gL10n->get('PHO_PHOTOS'), '/icons/photo.png'); } if ($gPreferences['enable_guestbook_module'] == 1 || $gPreferences['enable_guestbook_module'] == 2 && $gValidLogin) { $moduleMenu->addItem('guestbk', '/adm_program/modules/guestbook/guestbook.php', $gL10n->get('GBO_GUESTBOOK'), '/icons/guestbook.png'); } $moduleMenu->addItem('lists', '/adm_program/modules/lists/lists.php', $gL10n->get('LST_LISTS'), '/icons/lists.png'); if ($gValidLogin) { $moduleMenu->addItem('mylist', '/adm_program/modules/lists/mylist.php', $gL10n->get('LST_MY_LIST'), '/icons/mylist.png');
public function addDefaultMenu() { global $gL10n, $gPreferences, $gValidLogin, $gDb, $gCurrentUser; $this->menu->addItem('menu_item_modules', null, $gL10n->get('SYS_MODULES'), 'application_view_list.png', 'right', 'navbar', 'admidio-default-menu-item'); $this->menu->addItem('menu_item_overview', '/adm_program/index.php', $gL10n->get('SYS_OVERVIEW'), 'home.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); if ($gPreferences['enable_announcements_module'] == 1 || $gPreferences['enable_announcements_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_announcements', '/adm_program/modules/announcements/announcements.php', $gL10n->get('ANN_ANNOUNCEMENTS'), 'announcements.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } if ($gPreferences['enable_download_module'] == 1) { $this->menu->addItem('menu_item_download', '/adm_program/modules/downloads/downloads.php', $gL10n->get('DOW_DOWNLOADS'), 'download.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } if ($gPreferences['enable_mail_module'] == 1 && $gValidLogin == false) { $this->menu->addItem('menu_item_email', '/adm_program/modules/messages/messages_write.php', $gL10n->get('SYS_EMAIL'), 'email.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } if (($gPreferences['enable_pm_module'] == 1 || $gPreferences['enable_mail_module'] == 1) && $gValidLogin) { // get number of unread messages for user $message = new TableMessage($gDb); $unread = $message->countUnreadMessageRecords($gCurrentUser->getValue('usr_id')); if ($unread > 0) { $this->menu->addItem('menu_item_private_message', '/adm_program/modules/messages/messages.php', $gL10n->get('SYS_MESSAGES') . '<span class="badge">' . $unread . '</span>', 'messages.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } else { $this->menu->addItem('menu_item_private_message', '/adm_program/modules/messages/messages.php', $gL10n->get('SYS_MESSAGES'), 'messages.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } } if ($gPreferences['enable_photo_module'] == 1 || $gPreferences['enable_photo_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_photo', '/adm_program/modules/photos/photos.php', $gL10n->get('PHO_PHOTOS'), 'photo.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } if ($gPreferences['enable_guestbook_module'] == 1 || $gPreferences['enable_guestbook_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_guestbook', '/adm_program/modules/guestbook/guestbook.php', $gL10n->get('GBO_GUESTBOOK'), 'guestbook.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } $this->menu->addItem('menu_item_lists', '/adm_program/modules/lists/lists.php', $gL10n->get('LST_LISTS'), 'lists.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); if ($gValidLogin) { $this->menu->addItem('menu_item_mylist', '/adm_program/modules/lists/mylist.php', $gL10n->get('LST_MY_LIST'), 'mylist.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } if ($gPreferences['enable_dates_module'] == 1 || $gPreferences['enable_dates_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_dates', '/adm_program/modules/dates/dates.php', $gL10n->get('DAT_DATES'), 'dates.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } if ($gPreferences['enable_weblinks_module'] == 1 || $gPreferences['enable_weblinks_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_links', '/adm_program/modules/links/links.php', $gL10n->get('LNK_WEBLINKS'), 'weblinks.png', 'right', 'menu_item_modules', 'admidio-default-menu-item'); } if ($gCurrentUser->isWebmaster() || $gCurrentUser->manageRoles() || $gCurrentUser->approveUsers() || $gCurrentUser->editUsers()) { $this->menu->addItem('menu_item_administration', null, $gL10n->get('SYS_ADMINISTRATION'), 'application_view_list.png', 'right', 'navbar', 'admidio-default-menu-item'); if ($gCurrentUser->approveUsers() && $gPreferences['registration_mode'] > 0) { $this->menu->addItem('menu_item_registration', '/adm_program/modules/registration/registration.php', $gL10n->get('NWU_NEW_REGISTRATIONS'), 'new_registrations.png', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } if ($gCurrentUser->editUsers()) { $this->menu->addItem('menu_item_members', '/adm_program/modules/members/members.php', $gL10n->get('MEM_USER_MANAGEMENT'), 'user_administration.png', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } if ($gCurrentUser->manageRoles()) { $this->menu->addItem('menu_item_roles', '/adm_program/modules/roles/roles.php', $gL10n->get('ROL_ROLE_ADMINISTRATION'), 'roles.png', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } if ($gCurrentUser->isWebmaster()) { $this->menu->addItem('menu_item_backup', '/adm_program/modules/backup/backup.php', $gL10n->get('BAC_DATABASE_BACKUP'), 'backup.png', 'right', 'menu_item_administration', 'admidio-default-menu-item'); $this->menu->addItem('menu_item_options', '/adm_program/modules/preferences/preferences.php', $gL10n->get('SYS_SETTINGS'), 'options.png', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } } if ($gValidLogin) { // show link to own profile $this->menu->addItem('menu_item_my_profile', '/adm_program/modules/profile/profile.php', $gL10n->get('PRO_MY_PROFILE'), 'profile.png', 'right', 'navbar', 'admidio-default-menu-item'); // show logout link $this->menu->addItem('menu_item_logout', '/adm_program/system/logout.php', $gL10n->get('SYS_LOGOUT'), 'door_in.png', 'right', 'navbar', 'admidio-default-menu-item'); } else { // show registration link $this->menu->addItem('menu_item_registration', '/adm_program/modules/registration/registration.php', $gL10n->get('SYS_REGISTRATION'), 'new_registrations.png', 'right', 'navbar', 'admidio-default-menu-item'); // show login link $this->menu->addItem('menu_item_login', '/adm_program/system/login.php', $gL10n->get('SYS_LOGIN'), 'key.png', 'right', 'navbar', 'admidio-default-menu-item'); } }
$receiverName = $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'); $message = new TableMessage($gDb, $row['msg_id']); ++$key; $messageAdministration = $part1 . $key . '&name=' . urlencode($message->getValue('msg_subject')) . '&database_id=' . $message->getValue('msg_id') . $part2; $table->addRowByArray(array('<a class="admidio-icon-link" ' . $href . $message->getValue('msg_id') . '"> <img class="admidio-icon-info" src="' . THEME_PATH . '/icons/pm.png" alt="' . $gL10n->get('PMS_MESSAGE') . '" title="' . $gL10n->get('PMS_MESSAGE') . '" />', '<a ' . $href . $message->getValue('msg_id') . '">' . $message->getValue('msg_subject') . '</a>', $receiverName, $message->getValue('msg_timestamp'), $messageAdministration), 'row_message_' . $key, array('style' => 'font-weight: bold')); } } // find all read or own PM messages $statement = $modulemessages->msgGetUser($gCurrentUser->getValue('usr_id')); if (isset($statement)) { while ($row = $statement->fetch()) { if ($row['msg_usr_id_sender'] == $gCurrentUser->getValue('usr_id')) { $user = new User($gDb, $gProfileFields, $row['msg_usr_id_receiver']); } else { $user = new User($gDb, $gProfileFields, $row['msg_usr_id_sender']); } $receiverName = $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'); $message = new TableMessage($gDb, $row['msg_id']); ++$key; $messageAdministration = $part1 . $key . '&name=' . urlencode($message->getValue('msg_subject')) . '&database_id=' . $message->getValue('msg_id') . $part2; $table->addRowByArray(array('<a class="admidio-icon-link" ' . $href . $message->getValue('msg_id') . '"> <img class="admidio-icon-info" src="' . THEME_PATH . '/icons/pm.png" alt="' . $gL10n->get('PMS_MESSAGE') . '" title="' . $gL10n->get('PMS_MESSAGE') . '" />', '<a ' . $href . $message->getValue('msg_id') . '">' . $message->getValue('msg_subject') . '</a>', $receiverName, $message->getValue('msg_timestamp'), $messageAdministration), 'row_message_' . $key); } } // special settings for the table $table->setDatatablesOrderColumns(array(array(4, 'desc'))); // add table to the form $page->addHtml($table->show(false)); // add form to html page and show page $page->show();
function saveMessage($option) { global $mainframe; // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); require_once dirname(__FILE__) . DS . 'tables' . DS . 'message.php'; $db =& JFactory::getDBO(); $row = new TableMessage($db); if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); } if (!$row->check()) { JError::raiseError(500, $row->getError()); } if (!$row->send()) { $mainframe->redirect("index.php?option=com_messages", $row->getError()); } $mainframe->redirect("index.php?option=com_messages"); }
public function addDefaultMenu() { global $gL10n, $gPreferences, $gValidLogin, $gDb, $gCurrentUser; // @ptabaden: Deleted "Module" Title, Changed overview to new startpage $this->menu->addItem('menu_item_overview', '/adm_plugins/sts_plugin/sts.php', $gL10n->get('SYS_OVERVIEW'), '', 'right', 'navbar', 'admidio-default-menu-item'); if ($gPreferences['enable_announcements_module'] == 1 || $gPreferences['enable_announcements_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_announcements', '/adm_program/modules/announcements/announcements.php', $gL10n->get('ANN_ANNOUNCEMENTS'), '', 'right', 'navbar', 'admidio-default-menu-item'); } if ($gPreferences['enable_dates_module'] == 1 || $gPreferences['enable_dates_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_dates', '/adm_program/modules/dates/dates.php', $gL10n->get('DAT_DATES'), '', 'right', 'navbar', 'admidio-default-menu-item'); } // @ptabaden: Added History Module $this->menu->addItem('menu_item_history', '/adm_plugins/history_plugin/history.php', 'Porträt', '', 'right', 'navbar', 'admidio-default-menu-item'); $this->menu->addItem('support', '/adm_plugins/support_plugin/support.php', 'Unterstützen', '', 'right', 'navbar', 'admidio-default-menu-item'); if ($gPreferences['enable_photo_module'] == 1 || $gPreferences['enable_photo_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_photo', '/adm_program/modules/photos/photos.php', $gL10n->get('PHO_PHOTOS'), '', 'right', 'navbar', 'admidio-default-menu-item'); } if ($gValidLogin) { $this->menu->addItem('menu_item_lists', '/adm_program/modules/lists/lists.php', $gL10n->get('LST_LISTS'), '', 'right', 'navbar', 'admidio-default-menu-item'); } if ($gPreferences['enable_download_module'] == 1) { $this->menu->addItem('menu_item_download', '/adm_program/modules/downloads/downloads.php', $gL10n->get('DOW_DOWNLOADS'), '', 'right', 'navbar', 'admidio-default-menu-item'); } if ($gPreferences['enable_mail_module'] == 1 && !$gValidLogin) { $this->menu->addItem('menu_item_email', '/adm_program/modules/messages/messages_write.php', $gL10n->get('SYS_EMAIL'), '', 'right', 'navbar', 'admidio-default-menu-item'); } if (($gPreferences['enable_pm_module'] == 1 || $gPreferences['enable_mail_module'] == 1) && $gValidLogin) { // get number of unread messages for user $message = new TableMessage($gDb); $unread = $message->countUnreadMessageRecords($gCurrentUser->getValue('usr_id')); if ($unread > 0) { $this->menu->addItem('menu_item_private_message', '/adm_program/modules/messages/messages.php', $gL10n->get('SYS_MESSAGES') . '<span class="badge">' . $unread . '</span>', '', 'right', 'navbar', 'admidio-default-menu-item'); } else { $this->menu->addItem('menu_item_private_message', '/adm_program/modules/messages/messages.php', $gL10n->get('SYS_MESSAGES'), '', 'right', 'navbar', 'admidio-default-menu-item'); } } if ($gPreferences['enable_guestbook_module'] == 1 || $gPreferences['enable_guestbook_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_guestbook', '/adm_program/modules/guestbook/guestbook.php', $gL10n->get('GBO_GUESTBOOK'), '', 'right', 'navbar', 'admidio-default-menu-item'); } if ($gPreferences['enable_weblinks_module'] == 1 || $gPreferences['enable_weblinks_module'] == 2 && $gValidLogin) { $this->menu->addItem('menu_item_links', '/adm_program/modules/links/links.php', $gL10n->get('LNK_WEBLINKS'), '', 'right', 'navbar', 'admidio-default-menu-item'); } if ($gCurrentUser->isWebmaster() || $gCurrentUser->manageRoles() || $gCurrentUser->approveUsers() || $gCurrentUser->editUsers()) { $this->menu->addItem('menu_item_administration', null, '<h5>' . $gL10n->get('SYS_ADMINISTRATION') . '</h5>', '', 'right', 'navbar', 'admidio-default-menu-item'); if ($gCurrentUser->approveUsers() && $gPreferences['registration_mode'] > 0) { $this->menu->addItem('menu_item_registration', '/adm_program/modules/registration/registration.php', $gL10n->get('NWU_NEW_REGISTRATIONS'), '', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } if ($gCurrentUser->editUsers()) { $this->menu->addItem('menu_item_members', '/adm_program/modules/members/members.php', $gL10n->get('MEM_USER_MANAGEMENT'), '', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } if ($gCurrentUser->manageRoles()) { $this->menu->addItem('menu_item_roles', '/adm_program/modules/roles/roles.php', $gL10n->get('ROL_ROLE_ADMINISTRATION'), '', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } $this->menu->addItem('menu_item_mylist', '/adm_program/modules/lists/mylist.php', $gL10n->get('LST_MY_LIST'), '', 'right', 'menu_item_administration', 'admidio-default-menu-item'); if ($gCurrentUser->isWebmaster()) { $this->menu->addItem('menu_item_backup', '/adm_program/modules/backup/backup.php', $gL10n->get('BAC_DATABASE_BACKUP'), '', 'right', 'menu_item_administration', 'admidio-default-menu-item'); $this->menu->addItem('menu_item_options', '/adm_program/modules/preferences/preferences.php', $gL10n->get('SYS_SETTINGS'), '', 'right', 'menu_item_administration', 'admidio-default-menu-item'); } } if ($gValidLogin) { // show link to own profile $this->menu->addItem('menu_item_my_profile', '/adm_program/modules/profile/profile.php', $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'), '', 'right', 'navbar', 'admidio-default-menu-item'); // show logout link $this->menu->addItem('menu_item_logout', '/adm_program/system/logout.php', $gL10n->get('SYS_LOGOUT'), 'door_in.png', 'right', 'navbar', 'admidio-default-menu-item'); } else { // @ptabaden: No registration link // show login link $this->menu->addItem('menu_item_login', '/adm_program/system/login.php', $gL10n->get('SYS_LOGIN'), 'key.png', 'right', 'navbar', 'admidio-default-menu-item'); } }
/** * Saves the content item an edit form submit * * @todo */ function save() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // Initialize variables $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $task = JRequest::getVar('task', null, 'default', 'cmd'); // Make sure you are logged in and have the necessary access rights if ($user->get('gid') < 19) { JError::raiseError(403, JText::_('ALERTNOTAUTH')); return; } // Create a user access object for the user $access = new stdClass(); $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); if (!($access->canEdit || $access->canEditOwn)) { JError::raiseError(403, JText::_("ALERTNOTAUTH")); } //get data from the request $model = $this->getModel('article'); //get data from request $post = JRequest::get('post'); $post['text'] = JRequest::getVar('text', '', 'post', 'string', JREQUEST_ALLOWRAW); //preform access checks $isNew = (int) $post['id'] < 1; if ($model->store($post)) { $msg = JText::_('Article Saved'); if ($isNew) { $post['id'] = (int) $model->get('id'); } } else { $msg = JText::_('Error Saving Article'); JError::raiseError(500, $model->getError()); } // manage frontpage items //TODO : Move this into a frontpage model require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_frontpage' . DS . 'tables' . DS . 'frontpage.php'; $fp = new TableFrontPage($db); if (JRequest::getVar('frontpage', false, '', 'boolean')) { // toggles go to first place if (!$fp->load($post['id'])) { // new entry $query = 'INSERT INTO #__content_frontpage' . ' VALUES ( ' . (int) $post['id'] . ', 1 )'; $db->setQuery($query); if (!$db->query()) { JError::raiseError(500, $db->stderr()); } $fp->ordering = 1; } } else { // no frontpage mask if (!$fp->delete($post['id'])) { $msg .= $fp->stderr(); } $fp->ordering = 0; } $fp->reorder(); $model->checkin(); // gets section name of item $query = 'SELECT s.title' . ' FROM #__sections AS s' . ' WHERE s.scope = "content"' . ' AND s.id = ' . (int) $post['sectionid']; $db->setQuery($query); // gets category name of item $section = $db->loadResult(); $query = 'SELECT c.title' . ' FROM #__categories AS c' . ' WHERE c.id = ' . (int) $post['catid']; $db->setQuery($query); $category = $db->loadResult(); if ($isNew) { // messaging for new items require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_messages' . DS . 'tables' . DS . 'message.php'; // load language for messaging $lang =& JFactory::getLanguage(); $lang->load('com_messages'); $query = 'SELECT id' . ' FROM #__users' . ' WHERE sendEmail = 1'; $db->setQuery($query); $users = $db->loadResultArray(); foreach ($users as $user_id) { $msg = new TableMessage($db); $msg->send($user->get('id'), $user_id, JText::_('New Item'), JText::sprintf('ON_NEW_CONTENT', $user->get('username'), $post['title'], $section, $category)); } } else { // If the article isn't new, then we need to clean the cache so that our changes appear realtime :) $cache =& JFactory::getCache('com_content'); $cache->clean(); } // if ($access->canPublish) // { // Publishers, admins, etc just get the stock msg $msg = JText::_('Item successfully saved.'); // } // else // { // $msg = $isNew ? JText::_('THANK_SUB') : JText::_('Item successfully saved.'); // } $referer = JRequest::getString('ret', base64_encode(JURI::base()), 'get'); $referer = base64_decode($referer); if (!JURI::isInternal($referer)) { $referer = ''; } $this->setRedirect($referer, $msg); }
$gNavigation->addUrl(CURRENT_URL); if (isset($_POST['msg_to'])) { $postTo = $_POST['msg_to']; } else { // message when no receiver is given $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_TO'))); } if ($postSubjectSQL === '') { // message when no subject is given $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('MAI_SUBJECT'))); } if ($postBodySQL === '') { // message when no subject is given $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_MESSAGE'))); } $message = new TableMessage($gDb, $getMsgId); if ($getMsgId > 0) { $getMsgType = $message->getValue('msg_type'); } // if message not PM it must be Email and then directly check the parameters if ($getMsgType !== 'PM') { $getMsgType = 'EMAIL'; // Stop if mail should be send and mail module is disabled if ($gPreferences['enable_mail_module'] != 1) { $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } // allow option to send a copy to your email address only for registered users because of spam abuse if ($gValidLogin) { $postCarbonCopy = admFuncVariableIsValid($_POST, 'carbon_copy', 'bool'); } else { $postCarbonCopy = 0;
/** * Method to notification to the validators for an item * * @access public * @params object the user object * @params object the item object * @return boolean true on success * @since 1.5 */ function sendNotification($users, $item) { $sender = JFactory::getUser(); // messaging for new items require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_messages' . DS . 'tables' . DS . 'message.php'; // load language for messaging $lang = JFactory::getLanguage(); $lang->load('com_messages'); $ctrl_task = FLEXI_J16GE ? '&task=items.edit' : '&controller=items&task=edit'; $item->url = JURI::base() . 'index.php?option=com_flexicontent' . $ctrl_task . '&cid[]=' . $item->id; foreach ($users as $user) { $msg = new TableMessage($this->_db); $msg->send($sender->get('id'), $user->member_id, JText::_('FLEXI_APPROVAL_REQUEST'), JText::sprintf('FLEXI_APPROVAL_MESSAGE', $user->name, $sender->get('name'), $sender->get('username'), $item->id, $item->title, $item->cattitle, $item->url)); } return true; }
} if (isset($message_result)) { $page->addHtml('<br>'); while ($row = $gDb->fetch_array($message_result)) { if ($row['msc_usr_id'] == $gCurrentUser->getValue('usr_id')) { $sentUser = $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'); } else { $sentUser = $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'); } $ReceiverName = ''; $message_text = htmlspecialchars_decode($row['msc_message']); if ($getMsgType == 'PM') { // list history of this PM $message_text = nl2br($row['msc_message']); } else { $message = new TableMessage($gDb, $getMsgId); $receivers = $message->getValue('msg_usr_id_receiver'); // open some additonal functions for messages $modulemessages = new ModuleMessages(); $ReceiverName = ""; if (strpos($receivers, '|') == true) { $reciversplit = explode('|', $receivers); foreach ($reciversplit as $value) { if (strpos($value, ':') == true) { $ReceiverName .= "; " . $modulemessages->msgGroupNameSplit($value); } else { $user = new User($gDb, $gProfileFields, $value); $ReceiverName .= "; " . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'); } } } else {
/** * Saves the item * * @access public * @since 1.0 */ function save() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // Initialize variables $db =& JFactory::getDBO(); $user =& JFactory::getUser(); //get model $model = $this->getModel('hotel'); //get data from request $post = JRequest::get('post'); $post['service'] = JRequest::getVar('service', '', 'POST', 'string', JREQUEST_ALLOWRAW); $post['roomgeneral'] = JRequest::getVar('roomgeneral', '', 'POST', 'string', JREQUEST_ALLOWRAW); $post['roomdesc1'] = JRequest::getVar('roomdesc1', '', 'POST', 'string', JREQUEST_ALLOWRAW); if (isset($_FILES['upload_file'])) { $imgtype = $_FILES['upload_file']['type']; if (!empty($imgtype)) { if ($imgtype == 'image/jpeg') { $ext = '.jpg'; } else { $ext = '.' . substr($imgtype, strlen($imgtype) - 3); } $mainfilename = 'main_' . $post['id'] . $ext; $post['mainimage'] = $mainfilename; } } if (isset($_FILES['file_upload'])) { $typeimg = $_FILES['file_upload']['type']; if (!empty($typeimg)) { if ($typeimg == 'image/jpeg') { $ext = '.jpg'; } else { $ext = '.' . substr($typeimg, strlen($typeimg) - 3); } $filename = 'logo_' . $post['id'] . $ext; $post['logoimage'] = $filename; } } if (!empty($typeimg)) { $imagefile = array(); $imagefile = $_FILES['file_upload']; $folder = 'hotel_' . $post['id']; $this->uploadFile($imagefile, $folder, $filename, ''); } if (!empty($imgtype)) { $imagefile = array(); $imagefile = $_FILES['upload_file']; $folder = 'hotel_' . $post['id']; $imagesize = $this->uploadFile($imagefile, $folder, $mainfilename, 'main'); $post['imagewidth'] = $imagesize[0]; $post['imageheight'] = $imagesize[1]; } //perform access checks $isNew = (int) $post['id'] < 1; // Must be logged in if ($user->get('id') < 1) { JError::raiseError(403, JText::_('ALERTNOTAUTH')); return; } //access checks if (!($user->authorize('com_hotelguide', 'edit') || $user->authorize('com_content', 'edit', 'content', 'own') || $user->authorize('com_hotelguide', 'add'))) { JError::raiseError(403, JText::_("ALERTNOTAUTH")); } if ($model->store($post)) { if ($isNew) { $post['id'] = (int) $model->get('id'); } } else { $msg = JText::_('ERROR STORING ITEM'); JError::raiseError(500, $model->getError()); } $model->checkin(); if ($isNew) { //get list of admins who receive system mails $query = 'SELECT id, email, name' . ' FROM #__users' . ' WHERE sendEmail = 1'; $db->setQuery($query); if (!$db->query()) { JError::raiseError(500, $db->stderr(true)); return; } $adminRows = $db->loadObjectList(); require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_messages' . DS . 'tables' . DS . 'message.php'; // send email notification to admins foreach ($adminRows as $adminRow) { //Not really needed cause in com_message you can set to be notified about new messages by email //JUtility::sendAdminMail($adminRow->name, $adminRow->email, '', JText::_('NEW FAQ ITEM'), $post['title'], $user->get('username'), JURI::base()); //Send a message to the admins personal message boxes $message = new TableMessage($db); $message->send($user->get('id'), $adminRow->id, JText::_('NEW HOTEL ITEM'), JText::sprintf('ON NEW ITEM', $post['title'], $user->get('username'), $catstring)); } } else { // If the item isn't new, then we need to clean the cache so that our changes appear realtime $cache =& JFactory::getCache('com_hotelguide'); $cache->clean(); } if ($user->authorize('com_hotelguide', 'state')) { $msg = JText::_('ITEM SAVED'); } else { $msg = $isNew ? JText::_('THANKS SUBMISSION') : JText::_('ITEM SAVED'); } $link = JRequest::getString('referer', JURI::base(), 'post'); $this->setRedirect($link, $msg); }
function Joom_CommentPic($id) { $config = Joom_getConfig(); $mainframe =& JFactory::getApplication('site'); $database =& JFactory::getDBO(); $user =& JFactory::getUser(); //Check for hacking attempt $database->setQuery(" SELECT\n COUNT(id)\n FROM \n #__joomgallery AS a\n LEFT JOIN \n #__joomgallery_catg AS c ON c.cid=a.catid\n WHERE \n a.published = '1' \n AND a.approved = '1'\n AND a.id = '" . $id . "' \n AND c.access <= '" . $user->get('aid') . "'\n "); $result = $database->loadResult(); if ($result != 1 || $config->jg_showcomment == 0 || $config->jg_anoncomment == 0 && $user->get('aid') < 1) { die('Hacking attempt, aborted!'); } $codeisright = 1; if ($config->jg_secimages == 2 || $config->jg_secimages == 1 && $user->get('aid') < 1) { if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_easycaptcha' . DS . 'class.easycaptcha.php')) { include_once JPATH_ROOT . DS . 'components' . DS . 'com_easycaptcha' . DS . 'class.easycaptcha.php'; $captcha = new easyCaptcha($this->jg_captcha_id); $codeisright = $captcha->checkEnteredCode($this->jg_code) ? 1 : 0; } } if ($codeisright == 1) { // Save new values $cmtip = $_SERVER['REMOTE_ADDR']; $cmtdate = time(); if ($config->jg_approvecom == 0 || $config->jg_approvecom == 1 && $user->get('aid') > 0) { $approve = 1; } elseif ($config->jg_approvecom == 1 && $user->get('aid') < 1 || $config->jg_approvecom == 2) { $approve = 0; // message about new comment TODO $cmtsenderid = $user->get('aid') < 1 ? "62" : $user->get('id'); require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_messages' . DS . 'tables' . DS . 'message.php'; $database->setQuery(" SELECT \n id \n FROM \n #__users \n WHERE \n sendEmail = '1'\n "); $users = $database->loadResultArray(); foreach ($users as $user_id) { $msg = new TableMessage($database); $msg->send($cmtsenderid, $user_id, JText::_('JGS_ALERT_NEW_COMMENT'), JText::_('JGS_ALERT_NEW_COMMENT_MESSAGE_PARTONE') . $this->cmtname . JText::_('JGS_ALERT_NEW_COMMENT_MESSAGE_PARTTWO')); } } //change \r\n or \n to <br /> $this->cmttext = nl2br(stripslashes($this->cmttext)); $database->setQuery(" INSERT INTO \n #__joomgallery_comments\n VALUES(\n '', \n '{$id}', \n '{$cmtip}',\n '{$this->userid}', \n '{$this->cmtname}', \n '{$this->cmttext}', \n '{$cmtdate}', \n '1', \n '{$approve}'\n )\n "); $database->query(); # Get back to details page if ($config->jg_approvecom == 0 || $config->jg_approvecom == 1 && $user->get('aid') > 0) { $mosmsg = JText::_('JGS_ALERT_COMMENT_SAVED'); } else { $mosmsg = JText::_('JGS_ALERT_COMMENT_SAVED_BUT_NEEDS_ARROVAL'); } $mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&func=detail&id=' . $id . _JOOM_ITEMID, false), $mosmsg); } else { ?> <form id="send_form" name="commentform" action="<?php echo JRoute::_('index.php?option=com_joomgallery&func=detail&id=' . $id . _JOOM_ITEMID . '#joomcommentform'); ?> " method="post" class="jg_displaynone"> <textarea cols="40" rows="8" name="cmttext" class="inputbox" wrap="virtual"> <?php echo $this->cmttext; ?> </textarea> </form> <script type="text/javascript"> alert("<?php echo JText::_('JGS_ALERT_SECURITY_CODE_WRONG', true); ?> "); document.getElementById('send_form').submit(); </script> <?php } }