From: <ma...@us...> - 2012-11-25 20:56:36
|
Revision: 10273 http://sourceforge.net/p/xoops/svn/10273 Author: mageg Date: 2012-11-25 20:56:32 +0000 (Sun, 25 Nov 2012) Log Message: ----------- first version of the module content (page) Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/about.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_related.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page_content.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page_rating.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page_related.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/rating.css XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/styles.css XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/changelog.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/credits.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/install.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/lang_diff.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/licence.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/readme.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/logo_large.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/logo_small.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/blank.gif XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/comments.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/logo.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/next.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/previous.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/rating/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/rating/delete.gif XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/rating/star.gif XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/install.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/js/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/js/MetaData.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/js/jquery.rating.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/js/rating.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/js/rating.pack.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/admin.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/blocks.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/help/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/help/help.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/help/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/main.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/modinfo.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/preloads/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/preloads/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/rating.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/sql/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/sql/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/sql/mysql.sql XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_content.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_permissions.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_related.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_hits.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_random.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_rating.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_recent.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_navigation.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page ___________________________________________________________________ Added: tsvn:autoprops + *.php = svn:executable=*;svn:keywords=Author Date Id Rev URL; Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin ___________________________________________________________________ Added: tsvn:autoprops + *.php = svn:executable=*;svn:keywords=Author Date Id Rev URL; Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/about.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/about.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/about.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,27 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ +include dirname(__FILE__) . '/header.php'; +$xoops->header(); +$aboutAdmin = new XoopsModuleAdmin(); +$aboutAdmin->renderNavigation('about.php'); +$aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', true); +$xoops->footer(); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/about.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,355 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ +include dirname(__FILE__) . '/header.php'; +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} +// Parameters +$nb_content = $xoops->getModuleConfig('page_adminpager'); +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'default', 'string'); +// Get handler +$content_Handler = $xoops->getModuleHandler('page_content'); +$related_Handler = $xoops->getModuleHandler('page_related'); +$gperm_handler = $xoops->getHandler('groupperm'); +// Call header +$xoops->header('page_admin_content.html'); +// Get start pager +$start = $system->cleanVars($_REQUEST, 'start', 0, 'int'); + +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('content.php'); + +switch ($op) { + + case 'list': + default: + // Add Scripts + $xoops->theme->addScript('media/xoops/xoops.js'); + $admin_page->addTips(_AM_PAGE_CONTENT_TIPS); + $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'content.php?op=new', 'add'); + $admin_page->renderTips(); + $admin_page->renderButton(); + + // Criteria + $criteria = new CriteriaCompo(); + $criteria->setSort('content_weight ASC, content_title'); + $criteria->setOrder('ASC'); + $criteria->setStart($start); + $criteria->setLimit($nb_content); + $content_count = $content_Handler->getCount($criteria); + $content_arr = $content_Handler->getAll($criteria); + // Assign Template variables + $xoops->tpl->assign('content_count', $content_count); + if ($content_count > 0) { + foreach (array_keys($content_arr) as $i) { + $content_id = $content_arr[$i]->getVar('content_id'); + $content['id'] = $content_id; + $content['title'] = $content_arr[$i]->getVar('content_title'); + $content['maindisplay'] = $content_arr[$i]->getVar('content_maindisplay'); + $content['weight'] = $content_arr[$i]->getVar('content_weight'); + $content['status'] = $content_arr[$i]->getVar('content_status'); + $content['hits'] = $content_arr[$i]->getVar('content_hits'); + $content['rating'] = number_format($content_arr[$i]->getVar('content_rating'), 1); + $xoops->tpl->append_by_ref('content', $content); + unset($content); + } + // Display Page Navigation + if ($content_count > $nb_content) { + $nav = new XoopsPageNav($content_count, $nb_content, $start, 'start'); + $xoops->tpl->assign('nav_menu', $nav->renderNav(4)); + } + } else { + $xoops->tpl->assign('error_message', _AM_PAGE_CONTENT_ERROR_NOCONTENT); + } + break; + + case 'new': + $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'content.php', 'application-view-detail'); + $admin_page->renderButton(); + $obj = $content_Handler->create(); + $form = $xoops->getModuleForm($obj, 'page_content'); + $form->render(); + $xoops->tpl->assign('form', true); + break; + + case 'edit': + $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'content.php', 'application-view-detail'); + $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'content.php?op=new', 'add'); + $admin_page->renderButton(); + // Create form + $obj = $content_Handler->get($system->cleanVars($_REQUEST, 'id', 0, 'int')); + $form = $xoops->getModuleForm($obj, 'page_content'); + $form->render(); + $xoops->tpl->assign('form', true); + break; + + case 'save': + if (!$xoops->security->check()) { + $xoops->redirect("content.php", 3, implode(",", $xoops->security->getErrors())); + } + $content_id = $system->cleanVars($_REQUEST, 'content_id', 0, 'int'); + if ($content_id > 0) { + $obj = $content_Handler->get($content_id); + if ($_POST["date_update"] == 'Y'){ + $obj->setVar("content_create", strtotime($_POST["content_create"])); + } + } else { + $obj = $content_Handler->create(); + $obj->setVar("content_create", time()); + } + $error_message = ''; + $error = false; + + $obj->setVar("content_title", $_POST["content_title"]); + $obj->setVar("content_shorttext", $_POST["content_shorttext"]); + $obj->setVar("content_text", $_POST["content_text"]); + $obj->setVar("content_mkeyword", $_POST["content_mkeyword"]); + $obj->setVar("content_mdescription", $_POST["content_mdescription"]); + $obj->setVar("content_author", $_POST["content_author"]); + $obj->setVar("content_status", $_POST["content_status"]); + $obj->setVar("content_maindisplay", $_POST["content_maindisplay"]); + $obj->setVar("content_dopdf", 0); + $obj->setVar("content_doprint", 0); + $obj->setVar("content_domail", 0); + $obj->setVar("content_doauthor", 0); + $obj->setVar("content_dodate", 0); + $obj->setVar("content_dohits", 0); + $obj->setVar("content_dorating", 0); + $obj->setVar("content_doncoms", 0); + $obj->setVar("content_docoms", 0); + $obj->setVar("content_dosocial", 0); + $obj->setVar("content_dotitle", 0); + $obj->setVar("content_donotifications", 0); + if (isset($_POST["content_option"])) { + $content_option = $_POST["content_option"]; + foreach (array_keys($content_option) as $i) { + switch ($content_option[$i]) { + case 'pdf': + $obj->setVar("content_dopdf", 1); + break; + case 'print': + $obj->setVar("content_doprint", 1); + break; + case 'mail': + $obj->setVar("content_domail", 1); + break; + case 'author': + $obj->setVar("content_doauthor", 1); + break; + case 'date': + $obj->setVar("content_dodate", 1); + break; + case 'hits': + $obj->setVar("content_dohits", 1); + break; + case 'rating': + $obj->setVar("content_dorating", 1); + break; + case 'coms': + $obj->setVar("content_docoms", 1); + break; + case 'ncoms': + $obj->setVar("content_doncoms", 1); + break; + case 'social': + $obj->setVar("content_dosocial", 1); + break; + case 'title': + $obj->setVar("content_dotitle", 1); + break; + case 'notifications': + $obj->setVar("content_donotifications", 1); + break; + } + } + } + if (preg_match('/^\d+$/', $_POST["content_weight"]) == false){ + $error = true; + $error_message .= _AM_PAGE_CATEGORY_ERROR_WEIGHT . '<br />'; + $obj->setVar("content_weight", ''); + } else { + $obj->setVar("content_weight", $_POST["content_weight"]); + } + if ($error == true){ + $xoops->tpl->assign('error_message', $error_message); + } else { + if ($content_Handler->insert($obj)) { + $newcontent_id = $obj->get_new_id(); + $perm_id = isset($_REQUEST['content_id']) ? $content_id : $newcontent_id; + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('gperm_itemid', $perm_id, '=')); + $criteria->add(new Criteria('gperm_modid', $xoopsModule->getVar('mid'),'=')); + $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); + $gperm_handler->deleteAll($criteria); + //permissions view + if(isset($_POST['groups_view_item'])) { + foreach($_POST['groups_view_item'] as $onegroup_id) { + $gperm_handler->addRight('page_view_item', $perm_id, $onegroup_id, $xoopsModule->getVar('mid')); + } + } + $xoops->redirect("content.php", 2, _AM_PAGE_DBUPDATED); + } + $xoops->error($obj->getHtmlErrors()); + } + $form = $xoops->getModuleForm($obj, 'page_content'); + $form->render(); + $xoops->tpl->assign('form', true); + break; + + case 'delete': + $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'content.php', 'application-view-detail'); + $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'content.php?op=new', 'add'); + $admin_page->renderButton(); + // Define Stylesheet + $xoops->theme->addStylesheet('modules/system/css/admin.css'); + $content_id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + $obj = $content_Handler->get($content_id); + if (isset($_POST["ok"]) && $_POST["ok"] == 1) { + if (!$xoops->security->check()) { + $xoops->redirect("content.php", 3, implode(",", $xoops->security->getErrors())); + } + // Deleting the content + if ($content_Handler->delete($obj)) { + // deleting permissions + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('gperm_itemid', $content_id, '=')); + $criteria->add(new Criteria('gperm_modid', $xoopsModule->getVar('mid'),'=')); + $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); + $gperm_handler->deleteAll($criteria); + // deleting secondary + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('related_group', 0, '!=')); + $criteria->add(new Criteria('related_contentid', $content_id)); + $related_Handler->deleteAll($criteria); + // deleting main and secondary + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('related_group', 0)); + $criteria->add(new Criteria('related_contentid', $content_id)); + $related_arr = $related_Handler->getAll($criteria); + if (count($related_arr) > 0) { + foreach (array_keys($related_arr) as $i) { + $obj_related = $related_Handler->get($related_arr[$i]->getVar("related_id")); + $related_Handler->delete($obj_related); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('related_group', $related_arr[$i]->getVar("related_id"))); + $related_Handler->deleteAll($criteria); + } + } + $xoops->redirect("content.php", 2, _AM_PAGE_DBUPDATED); + } else { + $xoops->error($obj->getHtmlErrors()); + } + } else { + // deleting main and secondary + $related_name = ''; + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('related_group', 0)); + $criteria->add(new Criteria('related_contentid', $content_id)); + $related_arr = $related_Handler->getAll($criteria); + if (count($related_arr) > 0) { + $related_name .= '<br />' . _AM_PAGE_RELATED_DELMAIN . '<br />'; + foreach (array_keys($related_arr) as $i) { + $related_name .= '<span style="color : Red">'; + $related_name .= $related_arr[$i]->getVar("related_name"); + $related_name .= '</span>'; + $related_name .= '<br />'; + } + } + $xoops->confirm(array("ok" => 1, "id" => $content_id, "op" => "delete"), 'content.php', sprintf(_AM_PAGE_SUREDEL, $obj->getvar('content_title')) . '<br />' . $related_name); + } + break; + + case 'update_status': + $content_id = $system->cleanVars($_POST, 'content_id', 0, 'int'); + if ($content_id > 0) { + $obj = $content_Handler->get($content_id); + $old = $obj->getVar('content_status'); + $obj->setVar('content_status', !$old); + if ($content_Handler->insert($obj)) { + exit; + } + echo $obj->getHtmlErrors(); + } + break; + + case 'update_display': + $content_id = $system->cleanVars($_POST, 'content_id', 0, 'int'); + if ($content_id > 0) { + $obj = $content_Handler->get($content_id); + $old = $obj->getVar('content_maindisplay'); + $obj->setVar('content_maindisplay', !$old); + if ($content_Handler->insert($obj)) { + exit; + } + echo $obj->getHtmlErrors(); + } + break; + + case 'clone': + $content_id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + $content = $content_Handler->get($content_id); + $obj = $content_Handler->create(); + $obj->setVar("content_title", _AM_PAGE_CONTENT_COPY . $content->getVar("content_title")); + $obj->setVar("content_weight", 0); + $obj->setVar("content_create", time()); + $obj->setVar("content_shorttext", $content->getVar("content_shorttext")); + $obj->setVar("content_text", $content->getVar("content_text")); + $obj->setVar("content_mkeyword", $content->getVar("content_mkeyword")); + $obj->setVar("content_mdescription", $content->getVar("content_mdescription")); + $obj->setVar("content_author", $content->getVar("content_author")); + $obj->setVar("content_status", $content->getVar("content_status")); + $obj->setVar("content_maindisplay", $content->getVar("content_maindisplay")); + $obj->setVar("content_dopdf", $content->getVar("content_dopdf")); + $obj->setVar("content_doprint", $content->getVar("content_doprint")); + $obj->setVar("content_domail", $content->getVar("content_domail")); + $obj->setVar("content_doauthor", $content->getVar("content_doauthor")); + $obj->setVar("content_dodate", $content->getVar("content_dodate")); + $obj->setVar("content_dohits", $content->getVar("content_dohits")); + $obj->setVar("content_dorating", $content->getVar("content_dorating")); + $obj->setVar("content_docoms", $content->getVar("content_docoms")); + $obj->setVar("content_doncoms", $content->getVar("content_doncoms")); + $obj->setVar("content_dosocial", $content->getVar("content_dosocial")); + $obj->setVar("content_dotitle", $content->getVar("content_dotitle")); + $obj->setVar("content_donotifications", $content->getVar("content_donotifications")); + if ($content_Handler->insert($obj)) { + $newcontent_id = $obj->get_new_id(); + $gperm_handler = $xoops->getHandler('groupperm'); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('gperm_itemid', $content_id, '=')); + $criteria->add(new Criteria('gperm_modid', $xoopsModule->getVar('mid'),'=')); + $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); + $gperm_arr = $gperm_handler->getall($criteria); + //permissions view + foreach (array_keys($gperm_arr) as $i) { + $gperm_handler->addRight('page_view_item', $newcontent_id, $gperm_arr[$i]->getVar("gperm_groupid"), $xoopsModule->getVar('mid')); + } + $xoops->redirect("content.php", 2, _AM_PAGE_DBUPDATED); + } + $xoops->error($obj->getHtmlErrors()); + + break; +} +$xoops->footer(); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,25 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ +require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; + +$xoops = Xoops::getInstance(); +XoopsLoad::load('system', 'system'); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.html 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,58 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ +include dirname(__FILE__) . '/header.php'; +// heaser +$xoops->header(); +// Get page handler +$content_Handler = $xoops->getModuleHandler('page_content'); + +// content not display +$criteria = new CriteriaCompo(); +$criteria->add(new Criteria('content_status', 0)); +$content_notdisplay = $content_Handler->getCount($criteria); +// content display +$criteria = new CriteriaCompo(); +$criteria->add(new Criteria('content_status', 0, '!=')); +$content_display = $content_Handler->getCount($criteria); + +// folder path +//$folder_path = XOOPS_ROOT_PATH . '/uploads/page'; + +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('index.php'); + +// content +$admin_page->addInfoBox(_MI_PAGE_CONTENT, 'content'); +$admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALCONTENT, $content_notdisplay + $content_display), 'content'); +$admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALDISPLAY, '<span class="green">' . $content_display . '</span>'), 'content'); +$admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALNOTDISPLAY, '<span class="red">' . $content_notdisplay . '</span>'), 'content'); + +// configs +/*$admin_page->addConfigBoxLine($folder_path, 'folder'); +$admin_page->addConfigBoxLine(array($folder_path, '777'), 'chmod'); +$admin_page->addConfigBoxLine($folder_path . '/images', 'folder'); +$admin_page->addConfigBoxLine(array($folder_path . '/images', '777'), 'chmod'); +$admin_page->addConfigBoxLine($folder_path . '/images/category', 'folder'); +$admin_page->addConfigBoxLine(array($folder_path . '/images/category', '777'), 'chmod');*/ + +$admin_page->renderIndex(); +$xoops->footer(); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,43 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ + +$adminmenu = array(); +$i = 1; +$adminmenu[$i]['title'] = _MI_PAGE_INDEX; +$adminmenu[$i]['link'] = 'admin/index.php'; +$adminmenu[$i]['icon'] = 'home.png'; +$i++; +$adminmenu[$i]['title'] = _MI_PAGE_CONTENT; +$adminmenu[$i]['link'] = 'admin/content.php'; +$adminmenu[$i]['icon'] = 'content.png'; +$i++; +$adminmenu[$i]['title'] = _MI_PAGE_RELATED; +$adminmenu[$i]['link'] = 'admin/related.php'; +$adminmenu[$i]['icon'] = 'groupmod.png'; +$i++; +$adminmenu[$i]['title'] = _MI_PAGE_PERMISSIONS; +$adminmenu[$i]['link'] = 'admin/permissions.php'; +$adminmenu[$i]['icon'] = 'permissions.png'; +$i++; +$adminmenu[$i]['title'] = _MI_PAGE_ABOUT; +$adminmenu[$i]['link'] = 'admin/about.php'; +$adminmenu[$i]['icon'] = 'about.png'; \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,141 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ +include dirname(__FILE__) . '/header.php'; +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} +// Parameters +$nb_content = $xoops->getModuleConfig('page_adminpager'); +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'global', 'string'); +// Get handler +$content_Handler = $xoops->getModuleHandler('page_content'); +$gperm_handler = $xoops->getHandler('groupperm'); +// Call header +$xoops->header('page_admin_permissions.html'); + +// Get start pager +$start = $system->cleanVars($_REQUEST, 'start', 0, 'int'); + +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('permissions.php'); + +$opform = new XoopsSimpleForm('', 'opform', 'permissions.php', 'get'); +$op_select = new XoopsFormSelect("", 'op', $op); +$op_select->setExtra('onchange="document.forms.opform.submit()"'); +$op_select->addOption('global', _AM_PAGE_PERMISSIONS_GLOBAL); +$op_select->addOption('view', _AM_PAGE_PERMISSIONS_VIEW); +$opform->addElement($op_select); +$xoops->tpl->assign('form', $opform->render()); + +$module_id = $xoops->module->getVar('mid'); + +switch ($op) { + + case 'global': + default: + $global_perm_array = array('4' => _AM_PAGE_PERMISSIONS_GLOBAL_RATE); + $form = new XoopsGroupPermForm(_AM_PAGE_PERMISSIONS_GLOBAL, $module_id, "page_global", _AM_PAGE_PERMISSIONS_GLOBAL_DSC, 'admin/permissions.php', true); + foreach( $global_perm_array as $perm_id => $perm_name ) { + $form->addItem($perm_id , $perm_name) ; + } + echo $form->render(); + break; + + case 'view': + // View permission + + // Add Scripts + $xoops->theme->addScript('media/xoops/xoops.js'); + // Criteria + $criteria = new CriteriaCompo(); + $criteria->setSort('content_weight ASC, content_title'); + $criteria->setOrder('ASC'); + $criteria->setStart($start); + $criteria->setLimit($nb_content); + $content_count = $content_Handler->getCount($criteria); + $content_arr = $content_Handler->getAll($criteria); + // Assign Template variables + $xoops->tpl->assign('content_count', $content_count); + if ($content_count > 0) { + $member_handler = $xoops->getHandler('member'); + $group_list = $member_handler->getGroupList(); + + $module_id = $xoops->isModule() ? $xoops->module->getVar('mid', 'n') : 1; + + $xoops->tpl->assign('groups', $group_list); + foreach (array_keys($content_arr) as $i) { + $content_id = $content_arr[$i]->getVar("content_id"); + $perms = ''; + $groups_ids_view = $gperm_handler->getGroupIds('page_view_item', $content_id, $module_id); + $groups_ids_view = array_values($groups_ids_view); + foreach (array_keys($group_list) as $j) { + $perms .= '<img id="loading_display' . $content_id . '_' . $j .'" src="' . $xoops->url('media/xoops/images/spinner.gif') . '" style="display:none;" alt="' . _AM_SYSTEM_LOADING . '" />'; + if (in_array($j, $groups_ids_view)) { + $perms .= "<img class=\"cursorpointer\" id=\"display" . $content_id . "_" . $j . "\" onclick=\"Xoops.changeStatus( 'permissions.php', { op: 'update_view', content_id: " . $content_id . ", group: " . $j . ", status: 'no' }, 'display" . $content_id . "_" . $j ."', 'permissions.php' )\" src=\"" . $xoops->url('modules/system/images/icons/default/success.png') . "\" alt=\"" . _AM_PAGE_OFF . "\" title=\"" . _AM_PAGE_OFF . "\" />"; + } else { + $perms .= "<img class=\"cursorpointer\" id=\"display" . $content_id . "_" . $j . "\" onclick=\"Xoops.changeStatus( 'permissions.php', { op: 'update_view', content_id: " . $content_id . ", group: " . $j . ", status: 'yes' }, 'display" . $content_id . "_" . $j ."', 'permissions.php' )\" src=\"" . $xoops->url('modules/system/images/icons/default/cancel.png') . "\" alt=\"" . _AM_PAGE_ON . "\" title=\"" . _AM_PAGE_ON . "\" />"; + + } + $perms .= $group_list[$j] . '<br />'; + } + $content['id'] = $content_id; + $content['title'] = $content_arr[$i]->getVar("content_title"); + $content['permissions'] = $perms; + $xoops->tpl->append_by_ref('content', $content); + unset($content); + } + // Display Page Navigation + if ($content_count > $nb_content) { + $nav = new XoopsPageNav($content_count, $nb_content, $start, 'start', 'op=view'); + $xoops->tpl->assign('nav_menu', $nav->renderNav(4)); + } + } else { + $xoops->tpl->assign('error_message', _AM_PAGE_CONTENT_ERROR_NOCONTENT); + } + break; + + case 'update_view': + $content_id = $system->cleanVars($_REQUEST, 'content_id', 0, 'int'); + $group = $system->cleanVars($_REQUEST, 'group', 0, 'int'); + $status = $system->cleanVars($_REQUEST, 'status', '', 'string'); + if ($content_id > 0 && $group > 0 && $status != '') { + if ($status == 'no') { + // deleting permissions + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('gperm_groupid', $group, '=')); + $criteria->add(new Criteria('gperm_itemid', $content_id, '=')); + $criteria->add(new Criteria('gperm_modid', $xoopsModule->getVar('mid'),'=')); + $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); + $gperm_handler->deleteAll($criteria); + } else { + // add permissions + $gperm_handler->addRight('page_view_item', $content_id, $group, $xoopsModule->getVar('mid')); + } + } + break; +} + +$xoops->footer(); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,255 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ +include dirname(__FILE__) . '/header.php'; +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} +// Parameters +$nb_related = $xoops->getModuleConfig('page_adminpager'); +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'default', 'string'); +// Get handler +$related_Handler = $xoops->getModuleHandler('page_related'); +$content_Handler = $xoops->getModuleHandler('page_content'); +// Call header +$xoops->header('page_admin_related.html'); +// Get start pager +$start = $system->cleanVars($_REQUEST, 'start', 0, 'int'); + +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('related.php'); + +switch ($op) { + + case 'list': + default: + // Define Stylesheet + $xoops->theme->addStylesheet('media/jquery/ui/' . $xoops->getModuleConfig('jquery_theme', 'system') . '/ui.all.css'); + // Define scripts + $xoops->theme->addScript('media/xoops/xoops.js'); + $xoops->theme->addScript($xoops->url('/media/jquery/ui/jquery.ui.js')); + $xoops->theme->addScript('modules/system/js/admin.js'); + + $admin_page->addTips(_AM_PAGE_RELATED_TIPS); + $admin_page->addItemButton(_AM_PAGE_RELATED_ADD, 'related.php?op=new', 'add'); + $admin_page->renderTips(); + $admin_page->renderButton(); + + //joint + $criteria = new CriteriaCompo(); + $criteria->setSort('related_name'); + $criteria->setOrder('ASC'); + $criteria->setStart($start); + $criteria->setLimit($nb_related); + $criteria->add(new Criteria('related_name', '/', '!=')); + $related_Handler->table_link = $related_Handler->db->prefix('page_content'); + $related_Handler->field_link = 'content_id'; // champ de la table en jointure + $related_Handler->field_object = 'related_contentid'; // champ de la table courante + $related_arr = $related_Handler->getByLink($criteria); + $related_count = $related_Handler->getCount($criteria); + // Assign Template variables + $xoops->tpl->assign('related_count', $related_count); + if ($related_count > 0) { + foreach (array_keys($related_arr) as $i) { + $related_id = $related_arr[$i]->getVar("related_id"); + $related['id'] = $related_id; + $related['name'] = $related_arr[$i]->getVar("related_name"); + $related['main_name'] = $related_arr[$i]->getVar("content_title"); + $related['main_contentid'] = $related_arr[$i]->getVar("related_contentid"); + $related['domenu'] = $related_arr[$i]->getVar("related_domenu"); + switch ($related_arr[$i]->getVar("related_navigation")) { + case 1: + default: + $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION1; + break; + case 2: + $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION2; + break; + case 3: + $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION3; + break; + case 4: + $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION4; + break; + case 5: + $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION5; + break; + } + //joint + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('related_group', $related_arr[$i]->getVar("related_contentid"))); + $criteria->setSort('related_weight'); + $criteria->setOrder('ASC'); + $related_Handler->table_link = $related_Handler->db->prefix('page_content'); + $related_Handler->field_link = 'content_id'; // champ de la table en jointure + $related_Handler->field_object = 'related_contentid'; // champ de la table courante + $secondary_arr = $related_Handler->getByLink($criteria); + $related['secondary'] = ''; + if (count($secondary_arr) != 0) { + + $related['secondary'] .= '<ul>'; + foreach (array_keys($secondary_arr) as $j) { + if ($secondary_arr[$j]->getVar("related_name") == '/') { + $related['secondary'] .= '<li><a href="content.php?op=edit&id=' . $secondary_arr[$j]->getVar("related_contentid") . '" title="' . _AM_PAGE_EDIT . '">' . $secondary_arr[$j]->getVar("content_title") . '</a></li>'; + } + } + $related['secondary'] .= '</ul>'; + } + $xoops->tpl->append_by_ref('related', $related); + $xoops->tpl->append_by_ref('popup_related', $related); + unset($related); + } + // Display Page Navigation + if ($related_count > $nb_related) { + $nav = new XoopsPageNav($related_count, $nb_related, $start, 'start'); + $xoops->tpl->assign('nav_menu', $nav->renderNav(4)); + } + } else { + $xoops->tpl->assign('error_message', _AM_PAGE_RELATED_ERROR_NORELATED); + } + break; + + case 'new': + if ($related_Handler->getCount() == $content_Handler->getCount()) { + $xoops->tpl->assign('error_message', _AM_PAGE_RELATED_ERROR_NOFREECONTENT); + } else { + $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'related.php', 'application-view-detail'); + $admin_page->renderButton(); + $obj = $related_Handler->create(); + $form = $xoops->getModuleForm($obj, 'page_related'); + $form->render(); + $xoops->tpl->assign('form', true); + } + break; + + case 'edit': + $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'related.php', 'application-view-detail'); + $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'related.php?op=new', 'add'); + $admin_page->renderButton(); + // Create form + $obj = $related_Handler->get($system->cleanVars($_REQUEST, 'id', 0, 'int')); + $form = $xoops->getModuleForm($obj, 'page_related'); + $form->render(); + $xoops->tpl->assign('form', true); + break; + + case 'save': + if (!$xoops->security->check()) { + $xoops->redirect("related.php", 3, implode(",", $xoops->security->getErrors())); + } + $related_id = $system->cleanVars($_REQUEST, 'related_id', 0, 'int'); + if ($related_id > 0) { + $obj = $related_Handler->get($related_id); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('related_group', $obj->getVar('related_group'))); + $criteria->add(new Criteria('related_name', '/')); + $related_Handler->deleteAll($criteria); + } else { + $obj = $related_Handler->create(); + } + //main + $obj->setVar("related_name", $_POST["related_name"]); + $obj->setVar("related_group", $_POST["related_main"]); + $obj->setVar("related_contentid", $_POST["related_main"]); + $obj->setVar("related_domenu", $_POST["related_domenu"]); + $obj->setVar("related_navigation", $_POST["related_navigation"]); + if ($related_Handler->insert($obj)) { + //secondary + $secondary_max = 10; + for ($i = 1; $i <= $secondary_max; $i++) { + if ($_POST["related_secondary" . $i] != 0 && $_POST["related_secondary" . $i] != $_POST["related_main"]) { + $obj = $related_Handler->create(); + $obj->setVar("related_name", "/"); + $obj->setVar("related_group", $_POST["related_main"]); + $obj->setVar("related_contentid", $_POST["related_secondary" . $i]); + $obj->setVar("related_domenu", $_POST["related_domenu"]); + $obj->setVar("related_navigation", $_POST["related_navigation"]); + $obj->setVar("related_weight", $i); + $related_Handler->insert($obj); + unset($obj); + } + } + $xoops->redirect("related.php", 2, _AM_PAGE_DBUPDATED); + } else { + $xoops->error($obj->getHtmlErrors()); + } + $form = $xoops->getModuleForm($obj, 'page_related'); + $form->render(); + $xoops->tpl->assign('form', true); + break; + + case 'delete': + $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'related.php', 'application-view-detail'); + $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'related.php?op=new', 'add'); + $admin_page->renderButton(); + // Define Stylesheet + $xoops->theme->addStylesheet('modules/system/css/admin.css'); + $related_id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + $obj = $related_Handler->get($related_id); + if (isset($_POST["ok"]) && $_POST["ok"] == 1) { + if (!$xoops->security->check()) { + $xoops->redirect("related.php", 3, implode(",", $xoops->security->getErrors())); + } + // Deleting the related + if ($related_Handler->delete($obj)) { + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('related_group', $related_id)); + $related_Handler->deleteAll($criteria); + $xoops->redirect("related.php", 2, _AM_PAGE_DBUPDATED); + } else { + $xoops->error($obj->getHtmlErrors()); + } + } else { + $xoops->confirm(array("ok" => 1, "id" => $related_id, "op" => "delete"), 'related.php', sprintf(_AM_PAGE_SUREDEL, $obj->getvar('related_name') . '<br />')); + } + break; + + case 'update_status': + $related_id = $system->cleanVars($_POST, 'related_id', 0, 'int'); + if ($related_id > 0) { + $obj = $related_Handler->get($related_id); + $old = $obj->getVar('related_domenu'); + $obj->setVar('related_domenu', !$old); + if ($related_Handler->insert($obj)) { + exit; + } + echo $obj->getHtmlErrors(); + } + break; + + case 'view': + $related_id = $system->cleanVars($_POST, 'related_id', 0, 'int'); + if ($related_id > 0) { + $obj = $related_Handler->get($related_id); + $old = $obj->getVar('related_domenu'); + $obj->setVar('related_domenu', !$old); + if ($related_Handler->insert($obj)) { + exit; + } + echo $obj->getHtmlErrors(); + } + break; +} +$xoops->footer(); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks ___________________________________________________________________ Added: tsvn:autoprops + *.php = svn:executable=*;svn:keywords=Author Date Id Rev URL; Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/index.html 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php 2012-11-25 20:56:32 UTC (rev 10273) @@ -0,0 +1,92 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ +function page_blocks_show($options) { + $xoops = Xoops::getInstance(); + // Get handler + $content_Handler = $xoops->getModuleHandler('page_content', 'page'); + $xoops->loadLanguage('main', 'page'); + $content = array(); + $xoops->theme->addStylesheet( $xoops->url('/modules/page/css/styles.css'), null ); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('content_status', 0, '!=')); + + switch ($options[0]) { + case 'random': + $criteria->setSort('RAND()'); + break; + case 'id': + $criteria->setSort('RAND()'); + break; + case 'rating': + $criteria->setSort('content_rating'); + $criteria->setOrder('DESC'); + break; + case 'hits': + $criteria->setSort('content_hits'); + $criteria->setOrder('DESC'); + break; + case 'recent': + $criteria->setSort('content_create'); + $criteria->setOrder('DESC'); + break; + } + + if ($options[0] != 'id') { + $criteria->setLimit($options[1]); + $content_arr = $content_Handler->getAll($criteria); + foreach (array_keys($content_arr) as $i) { + $content_id = $content_arr[$i]->getVar('content_id'); + $content[$i]['id'] = $content_id; + $content[$i]['title'] = strlen($content_arr[$i]->getVar('content_title')) > $options[2] ? substr($content_arr[$i]->getVar('content_title'), 0, ($options[2])) . '...' : $content_arr[$i]->getVar('content_title'); + $content[$i]['shorttext'] = $content_arr[$i]->getVar('content_shorttext'); + if ($options[3] == true){ + $content[$i]['text'] = $content_arr[$i]->getVar('content_text'); + } + $content[$i]['authorid'] = $content_arr[$i]->getVar('content_author'); + $content[$i]['author'] = XoopsUser::getUnameFromId($content_arr[$i]->getVar('content_author')); + $content[$i]['date'] = XoopsLocal::formatTimestamp($content_arr[$i]->getVar('content_create'), $xoops->getModuleConfig('page_dateformat', 'page')); + $content[$i]['time'] = XoopsLocal::formatTimestamp($content_arr[$i]->getVar('content_create'), $xoops->getModuleConfig('page_timeformat', 'page')); + $content[$i]['hits'] = sprintf(_MD_PAGE_VIEWPAGE_HITS, $content_arr[$i]->getVar('content_hits')); + $content[$i]['rating'] = number_format($content_arr[$i]->getVar('content_rating'), 1); + $content[$i]['votes'] = $content_arr[$i]->getVar('content_votes'); + } + } + return $content; +} + +function page_blocks_edit($options) { + $form = ''; + $form .= _MB_PAGE_DISPLAY . " \n"; + $form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n"; + $form .= "<input class=\"span1\" name=\"options[1]\" size=\"5\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" pattern=\"^\d+$\" /> " . _MB_PAGE_CONTENTS . "<br />\n"; + $form .= _MB_PAGE_TLENGTH . " <input class=\"span1\" name=\"options[2]\" size=\"5\" maxlength=\"255\" value=\"" . $options[2] . "\" type=\"text\" pattern=\"^\d+$\" /><br />\n"; + if ($options[3] == false){ + $checked_yes = ''; + $checked_no = 'checked="checked"'; + }else{ + $checked_yes = 'checked="checked"'; + $checked_no = ''; + } + $form .= _MB_PAGE_ALLCONTENT . ": <input name=\"options[3]\" value=\"1\" type=\"radio\" " . $checked_yes . "/>" . _YES . " \n"; + $form .= "<input name=\"options[3]\" value=\"0\" type=\"radio\" " . $checked_no . "/>" . _NO . "<br />\n"; + return $form; +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class ___________________________________________________________________ Added: tsvn:autoprops + *.php = svn:executable=*;svn:keywords=Author Date Id Rev URL; Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form ___________________________________________________________________ Added: tsvn:autoprops + *.php = svn:executable=*;svn:keywords=Author Date Id Rev URL; Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/fo... [truncated message content] |