protected function _view(&$iaView, $invoiceId) { iaBreadcrumb::add(iaLanguage::get('view'), IA_SELF); $invoice = $this->getHelper()->getById($invoiceId); if (!$invoice) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $iaView->assign('invoice', $invoice); $iaView->assign('items', $this->getHelper()->getItemsByInvoiceId($invoiceId)); $iaView->display('invoice-view'); }
private function _viewPage(&$iaView, $id) { $item = $this->getById($id); if (!$item) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $iaUsers = $this->_iaCore->factory('users'); $iaView->assign('item', $item); $iaView->assign('initiator', $iaUsers->getInfo($item['member_id'])); iaBreadcrumb::toEnd(iaLanguage::get('claim_details')); $iaView->title(iaLanguage::get('claim_details')); $iaView->display('view'); }
//##copyright## $iaDb->setTable('blog_entries'); if (iaView::REQUEST_HTML == $iaView->getRequestType()) { if (isset($iaCore->requestPath[0])) { $id = (int) $iaCore->requestPath[0]; if (!$id) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $sql = 'SELECT b.`id`, b.`title`, b.`date_added`, b.`body`, b.`alias`, b.`image`, m.`fullname` ' . 'FROM `:prefix:table_blog_entries` b ' . 'LEFT JOIN `:prefix:table_members` m ON (b.`member_id` = m.`id`) ' . 'WHERE b.`id` = :id AND b.`status` = \':status\' '; $sql = iaDb::printf($sql, array('prefix' => $iaDb->prefix, 'table_blog_entries' => 'blog_entries', 'table_members' => iaUsers::getTable(), 'id' => iaSanitize::sql($id), 'status' => iaCore::STATUS_ACTIVE)); $blogEntry = $iaDb->getRow($sql); $sql = 'SELECT DISTINCT bt.`title`, bt.`alias` ' . 'FROM `:prefix:table_blog_tags` bt ' . 'LEFT JOIN `:prefix:table_blog_entries_tags` bet ON (bt.`id` = bet.`tag_id`) ' . 'WHERE bet.`blog_id` = :id'; $sql = iaDb::printf($sql, array('prefix' => $iaDb->prefix, 'table_blog_entries_tags' => 'blog_entries_tags', 'table_blog_tags' => 'blog_tags', 'id' => iaSanitize::sql($id))); $blogTags = $iaDb->getAll($sql); if (empty($blogEntry)) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $title = iaSanitize::tags($blogEntry['title']); iaBreadcrumb::toEnd($title); $iaView->title($title); // add open graph data $openGraph = array('title' => $title, 'url' => IA_SELF, 'description' => $blogEntry['body']); if ($blogEntry['image']) { $openGraph['image'] = IA_CLEAR_URL . 'uploads/' . $blogEntry['image']; } $iaView->set('og', $openGraph); $iaView->assign('tags', $blogTags); $iaView->assign('blog_entry', $blogEntry); } else { $page = empty($_GET['page']) ? 0 : (int) $_GET['page']; $page = $page < 1 ? 1 : $page;
private function _setGroup(&$iaView, array $groupData) { $iaItem = $this->_iaCore->factory('item'); if ($this->_type) { $entity = 'user' == $this->_type ? $this->_iaCore->factory('users')->getInfo($this->_typeId) : $this->_iaDb->row(array('name'), iaDb::convertIds($this->_typeId), iaUsers::getUsergroupsTable()); if (!$entity) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $title = 'user' == $this->_type ? $entity['fullname'] : iaLanguage::get('usergroup_' . $entity['name']); $title = iaLanguage::getf('custom_configuration_title', array('settings' => $groupData['title'], 'title' => $title, 'type' => strtolower(iaLanguage::get('user' == $this->_type ? 'member' : 'usergroup')))); } else { $title = $groupData['title']; } $iaView->title($title); if ($groupData['extras']) { $iaPage = $this->_iaCore->factory('page', iaCore::ADMIN); $activeMenu = $groupData['name']; if ($groupData['extras'] == $this->_iaCore->get('tmpl')) { // template configuration options $page = $iaPage->getByName('templates'); $iaView->set('group', $page['group']); $iaView->set('active_config', $groupData['name']); iaBreadcrumb::add($page['title'], IA_ADMIN_URL . $page['alias']); } elseif ($pluginPage = $this->_iaDb->row(array('alias', 'group'), iaDb::printf("`name` = ':name' OR `name` = ':name_stats'", array('name' => $groupData['extras'])), iaPage::getAdminTable())) { // it is a package $iaView->set('group', $pluginPage['group']); $iaView->set('active_config', $groupData['name']); $activeMenu = null; iaBreadcrumb::insert($groupData['title'], IA_ADMIN_URL . $pluginPage['alias'], iaBreadcrumb::POSITION_FIRST); } elseif ($iaItem->isExtrasExist($groupData['extras'], iaItem::TYPE_PLUGIN)) { // plugin with no admin pages $iaView->set('group', 5); $iaView->set('active_config', $groupData['extras']); } } else { $activeMenu = 'configuration_' . $groupData['name']; iaBreadcrumb::toEnd($groupData['title'], IA_SELF); } $iaView->set('active_menu', $activeMenu); }
protected function _executeModule() { $module = $this->iaView->get('filename'); if (empty($module)) { return; } if (!file_exists($module)) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } // this set of variables should be defined since there is a PHP file inclusion below $iaCore =& $this; $iaView =& $this->iaView; $iaDb =& $this->iaDb; $iaAcl = $this->factory('acl'); // $pageName = $this->iaView->name(); $permission = (self::ACCESS_ADMIN == $this->getAccessType() ? 'admin_' : '') . 'pages-' . $pageName . iaAcl::SEPARATOR; $pageAction = $this->iaView->get('action'); $this->startHook('phpCoreCodeBeforeStart'); require $module; // temporary stub if (self::ACCESS_ADMIN == $this->getAccessType()) { if (class_exists('iaBackendController')) { $iaModule = new iaBackendController(); $iaModule->process(); } } // $this->startHook('phpCoreCodeAfterAll'); }
protected function _htmlAction(&$iaView) { iaView::errorPage(iaView::ERROR_NOT_FOUND); }
<?php //##copyright## if (iaView::REQUEST_HTML == $iaView->getRequestType()) { if (!iaUsers::hasIdentity()) { return iaView::errorPage(iaView::ERROR_UNAUTHORIZED); } $iaField = $iaCore->factory('field'); $iaUsers = $iaCore->factory('users'); $itemName = $tableName = iaUsers::getTable(); $messages = array(); $assignableGroups = $iaDb->keyvalue(array('id', 'name'), '`assignable` = 1', iaUsers::getUsergroupsTable()); $iaPlan = $iaCore->factory('plan'); $plans = $iaPlan->getPlans($iaUsers->getItemName()); $iaDb->setTable($tableName); if (isset($_POST['change_pass'])) { $error = false; $newPassword = empty($_POST['new']) ? false : $_POST['new']; // checks for current password if (iaUsers::getIdentity()->password != $iaUsers->encodePassword($_POST['current'])) { $error = true; $messages[] = iaLanguage::get('password_incorrect'); } if (!$newPassword) { $error = true; $messages[] = iaLanguage::get('password_empty'); } if ($newPassword != $_POST['confirm']) { $error = true; $messages[] = iaLanguage::get('error_password_match'); }
protected function _indexPage(&$iaView) { $type = null; $customEntryId = false; if (isset($_GET['group'])) { $type = 'group'; $customEntryId = (int) $_GET['group']; iaBreadcrumb::preEnd(iaLanguage::get('usergroups'), IA_ADMIN_URL . 'usergroups/'); } elseif (isset($_GET['user'])) { $type = 'user'; $customEntryId = (int) $_GET['user']; iaBreadcrumb::preEnd(iaLanguage::get('members'), IA_ADMIN_URL . 'members/'); } if (isset($_POST['save'])) { $this->_save($iaView, $type, $customEntryId); } $iaItem = $this->_iaCore->factory('item'); $groupName = isset($this->_iaCore->requestPath[0]) ? $this->_iaCore->requestPath[0] : 'general'; $groupData = $this->_iaDb->row_bind(iaDb::ALL_COLUMNS_SELECTION, '`name` = :name', array('name' => $groupName), iaCore::getConfigGroupsTable()); if (empty($groupData)) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $this->_setGroup($iaView, $iaItem, $groupData); $where = "`config_group` = '{$groupName}' AND `type` != 'hidden' " . ($type ? 'AND `custom` = 1' : '') . ' ORDER BY `order`'; $params = $this->_iaDb->all(iaDb::ALL_COLUMNS_SELECTION, $where, null, null, iaCore::getConfigTable()); if ($type) { $custom = 'user' == $type ? $this->_iaCore->getCustomConfig($customEntryId) : $this->_iaCore->getCustomConfig(false, $customEntryId); $custom2 = array(); if ('user' == $type) { $custom2 = $this->_iaDb->getKeyValue('SELECT d.`name`, d.`value` ' . "FROM `{$this->_iaCore->iaDb->prefix}config_custom` d, `{$this->_iaCore->iaDb->prefix}members` a " . "WHERE d.`type` = 'group' AND d.`type_id` = a.`usergroup_id` AND a.`id` = '{$customEntryId}'"); } } $itemsList = $iaItem->getItems(); foreach ($params as $index => $item) { $className = 'default'; if ($type) { $className = 'custom'; if (self::TYPE_DIVIDER != $item['type']) { if (isset($custom2[$item['name']])) { $params[$index]['dtype'] = 'usergroup'; $params[$index]['default'] = $custom2[$item['name']]; $params[$index]['value'] = $custom2[$item['name']]; } else { $params[$index]['dtype'] = 'core'; $params[$index]['default'] = $this->_iaCore->get($item['name']); } if (isset($custom[$item['name']])) { $className = 'common'; $params[$index]['value'] = $custom[$item['name']]; } } } if ('itemscheckbox' == $item['type']) { $array = $this->_iaCore->get($item['extras'] . '_items_implemented'); $array = $array ? explode(',', $array) : array(); $array = array_values(array_intersect($array, $itemsList)); if ($array) { $enabledItems = $iaItem->getEnabledItemsForPlugin($item['extras']); for ($i = 0; $i < count($array); $i++) { $array[$i] = trim($array[$i]); $params[$index]['items'][] = array('name' => $array[$i], 'title' => iaLanguage::get($array[$i]), 'checked' => (int) in_array($array[$i], $enabledItems)); } } } if ('select' == $item['type']) { switch ($item['name']) { case 'timezone': $params[$index]['values'] = iaUtil::getFormattedTimezones(); break; case 'lang': $params[$index]['values'] = $this->_iaCore->languages; break; default: $params[$index]['values'] = explode(',', $item['multiple_values']); } } $params[$index]['classname'] = $className; } $customUrl = ''; if ($type) { $customUrl = isset($_GET['user']) ? '?user='******'user'] : '******' . $_GET['group']; $customUrl = iaSanitize::html($customUrl); } $iaView->assign('group', $groupData); $iaView->assign('params', $params); $iaView->assign('tooltips', iaLanguage::getTooltips()); $iaView->assign('url_custom', $customUrl); }
protected function _indexPage(&$iaView) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); }
$artist = $iaArtist->getArtistByTitle($_GET['artist']); // get artist albums $out['data'] = $iaAlbum->getAlbumsByArtist($artist['id']); $iaView->assign($out); } } if (iaView::REQUEST_HTML == $iaView->getRequestType()) { iaCore::fields(); $iaUtil = $iaCore->factory('util'); $errorFields = array(); $id = isset($iaCore->requestPath[0]) ? (int) $iaCore->requestPath[0] : false; $lyric = $id ? $iaDb->row('*, \'lyrics\' as `item`', "`id`={$id}", 0, 1, iaLyric::getTable()) : array(); if (!empty($id) && empty($lyric)) { iaView::errorPage(iaView::ERROR_NOT_FOUND); } elseif (!empty($id) && $_SESSION['user']['id'] != $lyric['member_id']) { iaView::errorPage(iaView::ERROR_FORBIDDEN); } if (!empty($lyric)) { // get lyric artist $lartist = $iaArtist->getArtist($lyric['id_artist']); $lyric['artist'] = $lartist['title']; // get lyric album $lalbum = $iaAlbum->getAlbum($lyric['id_album']); $lyric['album'] = $lalbum['title']; // get artist albums $albums = $iaAlbum->getAlbumsByArtist($lartist['id']); $iaView->assign('albums', $albums); if ($lyric['body']) { $lyric['body'] = preg_replace('/<br>/i', "", $lyric['body']); } }