|
From: <be...@us...> - 2013-10-04 11:17:21
|
Revision: 12124
http://sourceforge.net/p/xoops/svn/12124
Author: beckmi
Date: 2013-10-04 11:17:13 +0000 (Fri, 04 Oct 2013)
Log Message:
-----------
Code reformatting toward PSR-2
Modified Paths:
--------------
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_footer.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_header.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admission.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/batch.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/export.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/groupperm_global.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/import.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/index.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/main.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/mygroupperm.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/mygrouppermform.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/photomanager.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/redothumbs.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/blocks/myalbum_rphoto.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/blocks/myalbum_tophits.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/blocks/myalbum_topnews.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/class/cat.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/class/comments.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/class/myalbum.textsanitizer.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/class/myuploader.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/class/photos.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/class/text.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/class/votedata.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/comment_new.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/docs/changelog.txt
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/docs/index.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/editphoto.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/header.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/imagemanager.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/assign_globals.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/blocksadmin.inc.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/draw_functions.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/functions.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/get_perms.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/gtickets.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/myalbum.forms.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/notification.inc.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/oninstall.inc.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/onupdate.inc.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/photo_orders.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/preferences.inc.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/read_configs.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/search.inc.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/sitemap.plugin.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/updateblock.inc.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/include/waiting.plugin.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/index.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/language/english/help/index.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/photo.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/rss.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/submit.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum0_block_rphoto.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum0_block_tophits.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum0_block_tophits_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum0_block_topnews.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum0_block_topnews_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum1_block_rphoto.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum1_block_tophits.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum1_block_tophits_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum1_block_topnews.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum1_block_topnews_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum2_block_rphoto.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum2_block_tophits.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum2_block_tophits_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum2_block_topnews.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum2_block_topnews_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum_block_rphoto.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum_block_tophits.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum_block_tophits_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum_block_topnews.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/blocks/myalbum_block_topnews_p.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_categories.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_cpanel_admission.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_imagemanager.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_index.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_photo.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_photo_in_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_rss.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_viewcat_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum0_viewcat_table.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_categories.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_cpanel_admission.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_imagemanager.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_index.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_photo.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_photo_in_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_rss.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_viewcat_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum1_viewcat_table.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_categories.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_cpanel_admission.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_imagemanager.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_index.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_photo.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_photo_in_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_rss.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_viewcat_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum2_viewcat_table.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_categories.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_cpanel_admission.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_imagemanager.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_index.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_photo.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_photo_in_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_rss.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_viewcat_list.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/templates/myalbum_viewcat_table.html
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/topten.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/viewcat.php
XoopsModules/myalbum/trunk/htdocs/modules/myalbum/xoops_version.php
Modified: XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_footer.php
===================================================================
--- XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_footer.php 2013-10-04 11:06:51 UTC (rev 12123)
+++ XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_footer.php 2013-10-04 11:17:13 UTC (rev 12124)
@@ -14,17 +14,13 @@
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
- * @author XOOPS Development Team
- * @version $Id $
+ * @author XOOPS Development Team
+ * @version $Id $
*/
global $pathIcon32;
-echo "<div class='adminfooter'>\n"
- ." <div style='text-align: center;'>\n"
- ." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
- ." </div>\n"
- ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
- ."</div>";
+echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
+ . " </div>\n" . " " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . "</div>";
xoops_cp_footer();
Modified: XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_header.php
===================================================================
--- XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_header.php 2013-10-04 11:06:51 UTC (rev 12123)
+++ XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admin_header.php 2013-10-04 11:17:13 UTC (rev 12124)
@@ -1,83 +1,85 @@
<?php
-require_once (dirname(dirname(dirname(dirname(__FILE__)))).'/mainfile.php');
-require_once (dirname(dirname(dirname(dirname(__FILE__)))).'/include/cp_header.php');
- require_once (dirname(dirname(__FILE__))).'/include/functions.php';
- require_once (dirname(dirname(__FILE__))).'/include/read_configs.php';
+require_once (dirname(dirname(dirname(dirname(__FILE__))))) . '/mainfile.php';
+require_once (dirname(dirname(dirname(dirname(__FILE__))))) . '/include/cp_header.php';
+require_once (dirname(dirname(__FILE__))) . '/include/functions.php';
+require_once (dirname(dirname(__FILE__))) . '/include/read_configs.php';
- if (!defined('_CHARSET'))
- define ("_CHARSET","UTF-8");
- if (!defined('_CHARSET_ISO'))
- define ("_CHARSET_ISO","ISO-8859-1");
+if (!defined('_CHARSET')) {
+ define ("_CHARSET", "UTF-8");
+}
+if (!defined('_CHARSET_ISO')) {
+ define ("_CHARSET_ISO", "ISO-8859-1");
+}
- $GLOBALS['myts'] = MyTextSanitizer::getInstance();
+$GLOBALS['myts'] = MyTextSanitizer::getInstance();
- $module_handler = xoops_gethandler('module');
- $config_handler = xoops_gethandler('config');
- $GLOBALS['myalbumModule'] = $module_handler->getByDirname($GLOBALS['mydirname']);
- $GLOBALS['myalbumModuleConfig'] = $config_handler->getConfigList($GLOBALS['myalbumModule']->getVar('mid'));
- $GLOBALS['myalbum_mid'] = $GLOBALS['myalbumModule']->getVar('mid');
- $GLOBALS['photos_dir'] = XOOPS_ROOT_PATH.$GLOBALS['myalbumModuleConfig']['myalbum_photospath'];
- $GLOBALS['thumbs_dir'] = XOOPS_ROOT_PATH.$GLOBALS['myalbumModuleConfig']['myalbum_thumbspath'];
- $GLOBALS['photos_url'] = XOOPS_URL.$GLOBALS['myalbumModuleConfig']['myalbum_photospath'];
- $GLOBALS['thumbs_url'] = XOOPS_URL.$GLOBALS['myalbumModuleConfig']['myalbum_thumbspath'];
+$module_handler = xoops_gethandler('module');
+$config_handler = xoops_gethandler('config');
+$GLOBALS['myalbumModule'] = $module_handler->getByDirname($GLOBALS['mydirname']);
+$GLOBALS['myalbumModuleConfig'] = $config_handler->getConfigList($GLOBALS['myalbumModule']->getVar('mid'));
+$GLOBALS['myalbum_mid'] = $GLOBALS['myalbumModule']->getVar('mid');
+$GLOBALS['photos_dir'] = XOOPS_ROOT_PATH . $GLOBALS['myalbumModuleConfig']['myalbum_photospath'];
+$GLOBALS['thumbs_dir'] = XOOPS_ROOT_PATH . $GLOBALS['myalbumModuleConfig']['myalbum_thumbspath'];
+$GLOBALS['photos_url'] = XOOPS_URL . $GLOBALS['myalbumModuleConfig']['myalbum_photospath'];
+$GLOBALS['thumbs_url'] = XOOPS_URL . $GLOBALS['myalbumModuleConfig']['myalbum_thumbspath'];
- xoops_load('pagenav');
- xoops_load('xoopslists');
- xoops_load('xoopsformloader');
+xoops_load('pagenav');
+xoops_load('xoopslists');
+xoops_load('xoopsformloader');
- include_once $GLOBALS['xoops']->path('class'.DS.'xoopsmailer.php');
- include_once $GLOBALS['xoops']->path('class'.DS.'tree.php');
+include_once $GLOBALS['xoops']->path('class' . DS . 'xoopsmailer.php');
+include_once $GLOBALS['xoops']->path('class' . DS . 'tree.php');
- $cat_handler = xoops_getmodulehandler('cat');
- $cats = $cat_handler->getObjects(NULL, true);
- $GLOBALS['cattree'] = new XoopsObjectTree( $cats , 'cid' , 'pid', 0 ) ;
+$cat_handler = xoops_getmodulehandler('cat');
+$cats = $cat_handler->getObjects(null, true);
+$GLOBALS['cattree'] = new XoopsObjectTree($cats, 'cid', 'pid', 0);
- if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))) {
- include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
- } else {
- echo xoops_error("Error: You don't use the Frameworks \"admin module\". Please install this Frameworks");
- }
+if (file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))) {
+ include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
+} else {
+ echo xoops_error("Error: You don't use the Frameworks \"admin module\". Please install this Frameworks");
+}
- $GLOBALS['myalbumImageIcon'] = XOOPS_URL .'/'. $GLOBALS['myalbumModule']->getInfo('icons16');
- $GLOBALS['myalbumImageAdmin'] = XOOPS_URL .'/'. $GLOBALS['myalbumModule']->getInfo('icons32');
+$GLOBALS['myalbumImageIcon'] = XOOPS_URL . '/' . $GLOBALS['myalbumModule']->getInfo('icons16');
+$GLOBALS['myalbumImageAdmin'] = XOOPS_URL . '/' . $GLOBALS['myalbumModule']->getInfo('icons32');
- if ($GLOBALS['xoopsUser']) {
- $moduleperm_handler =& xoops_gethandler('groupperm');
- if (!$moduleperm_handler->checkRight('module_admin', $GLOBALS['myalbumModule']->getVar( 'mid' ), $GLOBALS['xoopsUser']->getGroups())) {
- redirect_header(XOOPS_URL, 1, _NOPERM);
- exit();
- }
- } else {
- redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM);
+if ($GLOBALS['xoopsUser']) {
+ $moduleperm_handler =& xoops_gethandler('groupperm');
+ if (!$moduleperm_handler->checkRight('module_admin', $GLOBALS['myalbumModule']->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) {
+ redirect_header(XOOPS_URL, 1, _NOPERM);
exit();
}
+} else {
+ redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM);
+ exit();
+}
- xoops_loadLanguage('user');
- xoops_loadLanguage('admin', $mydirname);
- xoops_loadLanguage('main', $mydirname);
+xoops_loadLanguage('user');
+xoops_loadLanguage('admin', $mydirname);
+xoops_loadLanguage('main', $mydirname);
-$pathIcon16 = '../'.$xoopsModule->getInfo('icons16');
-$pathIcon32 = '../'.$xoopsModule->getInfo('icons32');
+$pathIcon16 = '../' . $xoopsModule->getInfo('icons16');
+$pathIcon32 = '../' . $xoopsModule->getInfo('icons32');
$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin');
- if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
- include_once(XOOPS_ROOT_PATH."/class/template.php");
- $GLOBALS['xoopsTpl'] = new XoopsTpl();
- }
+if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
+ include_once(XOOPS_ROOT_PATH . "/class/template.php");
+ $GLOBALS['xoopsTpl'] = new XoopsTpl();
+}
- $GLOBALS['xoopsTpl']->assign('pathImageIcon', $GLOBALS['myalbumImageIcon']);
- $GLOBALS['xoopsTpl']->assign('pathImageAdmin', $GLOBALS['myalbumImageAdmin']);
+$GLOBALS['xoopsTpl']->assign('pathImageIcon', $GLOBALS['myalbumImageIcon']);
+$GLOBALS['xoopsTpl']->assign('pathImageAdmin', $GLOBALS['myalbumImageAdmin']);
- if ( isset( $_GET['lid'] ) ) {
- $lid = intval( $_GET['lid' ] ) ;
- $result = $GLOBALS['xoopsDB']->query("SELECT submitter FROM $table_photos where lid=$lid",0);
- list( $submitter ) = $GLOBALS['xoopsDB']->fetchRow( $result ) ;
- } else {
- $submitter = $GLOBALS['xoopsUser']->getVar('uid') ;
- }
+if (isset($_GET['lid'])) {
+ $lid = intval($_GET['lid']);
+ $result = $GLOBALS['xoopsDB']->query("SELECT submitter FROM $table_photos where lid=$lid", 0);
+ list($submitter) = $GLOBALS['xoopsDB']->fetchRow($result);
+} else {
+ $submitter = $GLOBALS['xoopsUser']->getVar('uid');
+}
- if ($GLOBALS['myalbumModuleConfig']['tag']) {
- include_once $GLOBALS['xoops']->path('modules'.DS.'tag'.DS.'include'.DS.'formtag.php');
- }
+if ($GLOBALS['myalbumModuleConfig']['tag']) {
+ include_once $GLOBALS['xoops']->path('modules' . DS . 'tag' . DS . 'include' . DS . 'formtag.php');
+}
- extract($GLOBALS['myalbumModuleConfig']);
+extract($GLOBALS['myalbumModuleConfig']);
Modified: XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admission.php
===================================================================
--- XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admission.php 2013-10-04 11:06:51 UTC (rev 12123)
+++ XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/admission.php 2013-10-04 11:17:13 UTC (rev 12124)
@@ -4,32 +4,34 @@
// <http://www.peak.ne.jp/> //
// ------------------------------------------------------------------------- //
-include 'admin_header.php' ;
+include 'admin_header.php';
// GET vars
-$pos = empty( $_GET[ 'pos' ] ) ? 0 : intval( $_GET[ 'pos' ] ) ;
-$num = empty( $_GET[ 'num' ] ) ? 10 : intval( $_GET[ 'num' ] ) ;
-$txt = empty( $_GET[ 'txt' ] ) ? '' : $GLOBALS['myts']->stripSlashesGPC( trim( $_GET[ 'txt' ] ) ) ;
+$pos = empty($_GET['pos']) ? 0 : intval($_GET['pos']);
+$num = empty($_GET['num']) ? 10 : intval($_GET['num']);
+$txt = empty($_GET['txt']) ? '' : $GLOBALS['myts']->stripSlashesGPC(trim($_GET['txt']));
-if ( ! empty( $_POST['action'] ) && $_POST['action'] == 'admit' && isset( $_POST['ids'] ) && is_array( $_POST['ids'] ) ) {
+if (!empty($_POST['action']) && $_POST['action'] == 'admit' && isset($_POST['ids']) && is_array($_POST['ids'])) {
$photosHandler = xoops_getmodulehandler('photos');
- @$photosHandler->setStatus($_POST[ 'ids' ], 1);
- redirect_header( 'admission.php' , 2 , _ALBM_AM_ADMITTING ) ;
- exit ;
+ @$photosHandler->setStatus($_POST['ids'], 1);
+ redirect_header('admission.php', 2, _ALBM_AM_ADMITTING);
+ exit;
-} elseif ( ! empty( $_POST['action'] ) && $_POST['action'] == 'delete' && isset( $_POST['ids'] ) && is_array( $_POST['ids'] ) ) {
+} elseif (!empty($_POST['action']) && $_POST['action'] == 'delete' && isset($_POST['ids']) && is_array($_POST['ids'])) {
// remove records
// Double check for anti-CSRF
- if( ! xoops_refcheck() ) die( "XOOPS_URL is not included in your REFERER" ) ;
+ if (!xoops_refcheck()) {
+ die("XOOPS_URL is not included in your REFERER");
+ }
$photosHandler = xoops_getmodulehandler('photos');
- @$photosHandler->deletePhotos($_POST[ 'ids' ]);
+ @$photosHandler->deletePhotos($_POST['ids']);
- redirect_header( "admission.php" , 2 , _ALBM_DELETINGPHOTO ) ;
- exit ;
+ redirect_header("admission.php", 2, _ALBM_DELETINGPHOTO);
+ exit;
}
$photosHandler = xoops_getmodulehandler('photos');
@@ -37,16 +39,16 @@
// extracting by free word
$criteria = new CriteriaCompo(new Criteria('`status`', '0', '<='));
if ($txt != "") {
- $keywords = explode( " " , $txt ) ;
+ $keywords = explode(" ", $txt);
foreach ($keywords as $keyword) {
- $criteria->add(new Criteria('CONCAT( l.title , l.ext )', '%'.$keyword.'%', 'LIKE'), "AND");
+ $criteria->add(new Criteria('CONCAT( l.title , l.ext )', '%' . $keyword . '%', 'LIKE'), "AND");
}
}
xoops_cp_header();
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation('admission.php');
//myalbum_adminMenu(basename(__FILE__), 3);
-$GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_ADMISSION,$xoopsModule->name()));
+$GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_ADMISSION, $xoopsModule->name()));
$GLOBALS['xoopsTpl']->assign('mydirname', $GLOBALS['mydirname']);
$GLOBALS['xoopsTpl']->assign('photos_url', $GLOBALS['photos_url']);
$GLOBALS['xoopsTpl']->assign('thumbs_url', $GLOBALS['thumbs_url']);
@@ -58,19 +60,19 @@
$numrows = $photosHandler->getCount($criteria);
// Page Navigation
-$nav = new XoopsPageNav( $numrows , $num , $pos , 'pos' , "num=$num&txt=" . urlencode($txt) ) ;
-$nav_html = $nav->renderNav( 10 ) ;
+$nav = new XoopsPageNav($numrows, $num, $pos, 'pos', "num=$num&txt=" . urlencode($txt));
+$nav_html = $nav->renderNav(10);
$GLOBALS['xoopsTpl']->assign('nav_html', $nav_html);
$criteria = new Criteria('`status`', '0', '<=');
$criteria->setStart($pos);
$criteria->setLimit($num);
-foreach ( $photosHandler->getObjects($criteria, true) as $lid => $photo) {
+foreach ($photosHandler->getObjects($criteria, true) as $lid => $photo) {
$GLOBALS['xoopsTpl']->append('photos', $photo->toArray());
}
-$GLOBALS['xoopsTpl']->display('db:'.$GLOBALS['mydirname'].'_cpanel_admission.html');
+$GLOBALS['xoopsTpl']->display('db:' . $GLOBALS['mydirname'] . '_cpanel_admission.html');
// check $xoopsModule
// myalbum_footer_adminMenu();
Modified: XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/batch.php
===================================================================
--- XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/batch.php 2013-10-04 11:06:51 UTC (rev 12123)
+++ XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/batch.php 2013-10-04 11:17:13 UTC (rev 12124)
@@ -4,84 +4,98 @@
// <http://www.peak.ne.jp/> //
// ------------------------------------------------------------------------- //
-include 'admin_header.php' ;
+include 'admin_header.php';
// GPCS vars
-$GLOBALS['submitter'] = empty( $_POST['submitter'] ) ? $my_uid : intval( $_POST['submitter'] ) ;
-if( isset( $_POST['cid'] ) ) $cid = intval( $_POST['cid'] ) ;
-else if( isset( $_GET['cid'] ) ) $cid = intval( $_GET['cid'] ) ;
-else $cid = 0 ;
-$GLOBALS['dir4edit'] = isset( $_POST['dir'] ) ? $GLOBALS['myts']->htmlSpecialChars( $_POST['dir'] ) : '' ;
-$GLOBALS['title4edit'] = isset( $_POST['title'] ) ? $GLOBALS['myts']->htmlSpecialChars( $_POST['title'] ) : '' ;
-$GLOBALS['desc4edit'] = isset( $_POST['desc'] ) ? $GLOBALS['myts']->htmlSpecialChars( $_POST['desc'] ) : '' ;
+$GLOBALS['submitter'] = empty($_POST['submitter']) ? $my_uid : intval($_POST['submitter']);
+if (isset($_POST['cid'])) {
+ $cid = intval($_POST['cid']);
+} else {
+ if (isset($_GET['cid'])) {
+ $cid = intval($_GET['cid']);
+ } else {
+ $cid = 0;
+ }
+}
+$GLOBALS['dir4edit'] = isset($_POST['dir']) ? $GLOBALS['myts']->htmlSpecialChars($_POST['dir']) : '';
+$GLOBALS['title4edit'] = isset($_POST['title']) ? $GLOBALS['myts']->htmlSpecialChars($_POST['title']) : '';
+$GLOBALS['desc4edit'] = isset($_POST['desc']) ? $GLOBALS['myts']->htmlSpecialChars($_POST['desc']) : '';
// reject Not Admin
-if (! $isadmin) {
- redirect_header( $mod_url , 2 , _ALBM_MUSTREGFIRST ) ;
- exit ;
+if (!$isadmin) {
+ redirect_header($mod_url, 2, _ALBM_MUSTREGFIRST);
+ exit;
}
$catHandler = xoops_getmodulehandler('cat');
// check Categories exist
$count = $catHandler->getCount();
if ($count < 1) {
- redirect_header(XOOPS_URL."/modules/$mydirname/",2,_ALBM_MUSTADDCATFIRST);
+ redirect_header(XOOPS_URL . "/modules/$mydirname/", 2, _ALBM_MUSTADDCATFIRST);
exit();
}
$photosHandler = xoops_getmodulehandler('photos');
-$textHandler = xoops_getmodulehandler('text');
+$textHandler = xoops_getmodulehandler('text');
-if ( isset( $_POST['submit'] ) && $_POST['submit'] != "" ) {
- ob_start() ;
+if (isset($_POST['submit']) && $_POST['submit'] != "") {
+ ob_start();
// Check Directory
- $dir = $GLOBALS['myts']->stripSlashesGPC( $_POST['dir'] ) ;
- if ( empty( $dir ) || ! is_dir( $dir ) ) {
- if( ord( $dir ) != 0x2f ) $dir = "/$dir" ;
- $prefix = XOOPS_ROOT_PATH ;
- while ( strlen( $prefix ) > 0 ) {
- if ( is_dir( "$prefix$dir" ) ) {
- $dir = "$prefix$dir" ;
- break ;
+ $dir = $GLOBALS['myts']->stripSlashesGPC($_POST['dir']);
+ if (empty($dir) || !is_dir($dir)) {
+ if (ord($dir) != 0x2f) {
+ $dir = "/$dir";
+ }
+ $prefix = XOOPS_ROOT_PATH;
+ while (strlen($prefix) > 0) {
+ if (is_dir("$prefix$dir")) {
+ $dir = "$prefix$dir";
+ break;
}
- $prefix = substr( $prefix , 0 , strrpos( $prefix , '/' ) ) ;
+ $prefix = substr($prefix, 0, strrpos($prefix, '/'));
}
- if ( ! is_dir( $dir ) ) {
- redirect_header( 'batch.php' , 3 , _ALBM_MES_INVALIDDIRECTORY . "<br />$dir4edit" ) ;
- exit ;
+ if (!is_dir($dir)) {
+ redirect_header('batch.php', 3, _ALBM_MES_INVALIDDIRECTORY . "<br />$dir4edit");
+ exit;
}
}
- if( substr( $dir , -1 ) == '/' ) $dir = substr( $dir , 0 , -1 ) ;
+ if (substr($dir, -1) == '/') {
+ $dir = substr($dir, 0, -1);
+ }
- $title4save = $GLOBALS['myts']->htmlSpecialChars( $_POST['title'] ) ;
- $desc4save = $GLOBALS['myts']->makeTareaData4Save( $_POST['desc'] ) ;
+ $title4save = $GLOBALS['myts']->htmlSpecialChars($_POST['title']);
+ $desc4save = $GLOBALS['myts']->makeTareaData4Save($_POST['desc']);
- $date = strtotime( $_POST['post_date'] ) ;
- if( $date == -1 ) $date = time() ;
+ $date = strtotime($_POST['post_date']);
+ if ($date == -1) {
+ $date = time();
+ }
- $dir_h = opendir( $dir ) ;
+ $dir_h = opendir($dir);
if ($dir_h === false) {
- redirect_header( 'batch.php' , 3 , _ALBM_MES_INVALIDDIRECTORY . "<br />$dir4edit" ) ;
- exit ;
+ redirect_header('batch.php', 3, _ALBM_MES_INVALIDDIRECTORY . "<br />$dir4edit");
+ exit;
}
- $filecount = 1 ;
- while ( $file_name = readdir( $dir_h ) ) {
+ $filecount = 1;
+ while ($file_name = readdir($dir_h)) {
// Skip '.' , '..' and hidden file
- if( substr( $file_name , 0 , 1 ) == '.' ) continue ;
+ if (substr($file_name, 0, 1) == '.') {
+ continue;
+ }
- $ext = substr( strrchr( $file_name , '.' ) , 1 ) ;
- $node = substr( $file_name , 0 , - strlen( $ext ) - 1 ) ;
- $file_path = "$dir/$node.$ext" ;
+ $ext = substr(strrchr($file_name, '.'), 1);
+ $node = substr($file_name, 0, -strlen($ext) - 1);
+ $file_path = "$dir/$node.$ext";
- $title = empty( $_POST['title'] ) ? addslashes( $node ) : "$title4save $filecount" ;
+ $title = empty($_POST['title']) ? addslashes($node) : "$title4save $filecount";
- if ( is_readable( $file_path ) && in_array( strtolower( $ext ) , $array_allowed_exts ) ) {
- if ( ! in_array( strtolower( $ext ) , $myalbum_normal_exts ) ) {
- list( $w , $h ) = getimagesize( $file_path ) ;
+ if (is_readable($file_path) && in_array(strtolower($ext), $array_allowed_exts)) {
+ if (!in_array(strtolower($ext), $myalbum_normal_exts)) {
+ list($w, $h) = getimagesize($file_path);
} else {
- list( $w , $h ) = array( 0 , 0 ) ;
+ list($w, $h) = array(0, 0);
}
$photo = $photosHandler->create();
$photo->setVar('cid', $cid);
@@ -92,45 +106,46 @@
$photo->setVar('submitter', $submitter);
$photo->setVar('date', $date);
$photo->setVar('status', 1);
- if ( $lid = $photosHandler->insert($photo) ) {
- print " <a href='../photo.php?lid=$lid' target='_blank'>$file_path</a>\n" ;
- copy( $file_path , $GLOBALS['photos_dir'].DS."$lid.$ext" ) ;
- myalbum_create_thumb( $GLOBALS['photos_dir'].DS."$lid.$ext" , $lid , $ext ) ;
+ if ($lid = $photosHandler->insert($photo)) {
+ print " <a href='../photo.php?lid=$lid' target='_blank'>$file_path</a>\n";
+ copy($file_path, $GLOBALS['photos_dir'] . DS . "$lid.$ext");
+ myalbum_create_thumb($GLOBALS['photos_dir'] . DS . "$lid.$ext", $lid, $ext);
$text = $textHandler->create();
$text->setVar('lid', $lid);
$text->setVar('description', $desc4save);
$textHandler->insert($text);
- echo _AM_MB_FINISHED."<br />\n" ;
+ echo _AM_MB_FINISHED . "<br />\n";
}
- $filecount ++ ;
+ $filecount++;
}
}
- closedir( $dir_h ) ;
+ closedir($dir_h);
if ($filecount <= 1) {
- echo "<p>$dir4edit : "._ALBM_MES_BATCHNONE."</p>" ;
+ echo "<p>$dir4edit : " . _ALBM_MES_BATCHNONE . "</p>";
} else {
- printf( "<p>"._ALBM_MES_BATCHDONE."</p>" , $filecount - 1 ) ;
+ printf("<p>" . _ALBM_MES_BATCHDONE . "</p>", $filecount - 1);
}
- $result_str = ob_get_contents() ;
- ob_end_clean() ;
+ $result_str = ob_get_contents();
+ ob_end_clean();
}
xoops_cp_header();
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation('batch.php');
//myalbum_adminMenu(basename(__FILE__), 4);
-$GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_BATCHREGISTER,$GLOBALS['myalbumModule']->name()));
+$GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_BATCHREGISTER, $GLOBALS['myalbumModule']->name()));
$GLOBALS['xoopsTpl']->assign('mydirname', $GLOBALS['mydirname']);
$GLOBALS['xoopsTpl']->assign('photos_url', $GLOBALS['photos_url']);
$GLOBALS['xoopsTpl']->assign('thumbs_url', $GLOBALS['thumbs_url']);
$GLOBALS['xoopsTpl']->assign('form', myalbum_admin_form_admission());
-if (isset($result_str))
+if (isset($result_str)) {
$GLOBALS['xoopsTpl']->assign('result_str', $result_str);
+}
-$GLOBALS['xoopsTpl']->display('db:'.$GLOBALS['mydirname'].'_cpanel_batch.html');
+$GLOBALS['xoopsTpl']->display('db:' . $GLOBALS['mydirname'] . '_cpanel_batch.html');
// check $GLOBALS['myalbumModule']
// myalbum_footer_adminMenu();
Modified: XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/export.php
===================================================================
--- XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/export.php 2013-10-04 11:06:51 UTC (rev 12123)
+++ XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/export.php 2013-10-04 11:17:13 UTC (rev 12124)
@@ -1,94 +1,105 @@
<?php
- // ------------------------------------------------------------------------- //
- // myAlbum-P - XOOPS photo album //
- // <http://www.peak.ne.jp/> //
- // ------------------------------------------------------------------------- //
- include 'admin_header.php' ;
- include_once( XOOPS_ROOT_PATH . '/modules/system/constants.php' ) ;
+// ------------------------------------------------------------------------- //
+// myAlbum-P - XOOPS photo album //
+// <http://www.peak.ne.jp/> //
+// ------------------------------------------------------------------------- //
+include 'admin_header.php';
+include_once(XOOPS_ROOT_PATH . '/modules/system/constants.php');
- // To imagemanager
- if ( ! empty( $_POST['imagemanager_export'] ) && ! empty( $_POST['imgcat_id'] ) && ! empty( $_POST['cid'] ) ) {
+// To imagemanager
+if (!empty($_POST['imagemanager_export']) && !empty($_POST['imgcat_id']) && !empty($_POST['cid'])) {
- // authority check
- $sysperm_handler =& xoops_gethandler('groupperm');
- if( ! $sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_IMAGE, $xoopsUser->getGroups() ) ) exit ;
+ // authority check
+ $sysperm_handler =& xoops_gethandler('groupperm');
+ if (!$sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_IMAGE, $xoopsUser->getGroups())) {
+ exit;
+ }
- // anti-CSRF
- if( ! xoops_refcheck() ) die( "XOOPS_URL is not included in your REFERER" ) ;
+ // anti-CSRF
+ if (!xoops_refcheck()) {
+ die("XOOPS_URL is not included in your REFERER");
+ }
- // get dst information
- $dst_cid = intval( $_POST['imgcat_id'] ) ;
- $dst_table_photos = $xoopsDB->prefix( "image" ) ;
- $dst_table_cat = $xoopsDB->prefix( "imagecategory" ) ;
+ // get dst information
+ $dst_cid = intval($_POST['imgcat_id']);
+ $dst_table_photos = $xoopsDB->prefix("image");
+ $dst_table_cat = $xoopsDB->prefix("imagecategory");
- // get src information
- $src_cid = intval( $_POST['cid'] ) ;
- $src_table_photos = $xoopsDB->prefix($table_photos) ;
- $src_table_cat = $xoopsDB->prefix($table_cat);
+ // get src information
+ $src_cid = intval($_POST['cid']);
+ $src_table_photos = $xoopsDB->prefix($table_photos);
+ $src_table_cat = $xoopsDB->prefix($table_cat);
- // get storetype of the imgcat
- $crs = $xoopsDB->query( "SELECT imgcat_storetype,imgcat_maxsize FROM $dst_table_cat WHERE imgcat_id='$dst_cid'" ) or die( 'Invalid imgcat_id.' ) ;
- list( $imgcat_storetype,$imgcat_maxsize ) = $xoopsDB->fetchRow( $crs ) ;
+ // get storetype of the imgcat
+ $crs = $xoopsDB->query("SELECT imgcat_storetype,imgcat_maxsize FROM $dst_table_cat WHERE imgcat_id='$dst_cid'") or die('Invalid imgcat_id.');
+ list($imgcat_storetype, $imgcat_maxsize) = $xoopsDB->fetchRow($crs);
- // mime type look up
- $mime_types = array( 'gif' => 'image/gif' , 'png' => 'image/png' , 'jpg' => 'image/jpeg' , 'jpeg' => 'image/jpeg' ) ;
+ // mime type look up
+ $mime_types = array('gif' => 'image/gif', 'png' => 'image/png', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg');
- // INSERT loop
- $srs = $xoopsDB->query( "SELECT lid,ext,title,date,status FROM $src_table_photos WHERE cid='$src_cid'" ) ;
- $export_count = 0 ;
- while ( list( $lid,$ext,$title,$date,$status ) = $xoopsDB->fetchRow( $srs ) ) {
+ // INSERT loop
+ $srs = $xoopsDB->query("SELECT lid,ext,title,date,status FROM $src_table_photos WHERE cid='$src_cid'");
+ $export_count = 0;
+ while (list($lid, $ext, $title, $date, $status) = $xoopsDB->fetchRow($srs)) {
- $dst_node = uniqid( 'img' ) ;
- $dst_file = XOOPS_UPLOAD_PATH . "/{$dst_node}.{$ext}" ;
- $src_file = empty( $_POST['use_thumb'] ) ? "$photos_dir/{$lid}.{$ext}" : "$thumbs_dir/{$lid}.{$ext}" ;
+ $dst_node = uniqid('img');
+ $dst_file = XOOPS_UPLOAD_PATH . "/{$dst_node}.{$ext}";
+ $src_file = empty($_POST['use_thumb']) ? "$photos_dir/{$lid}.{$ext}" : "$thumbs_dir/{$lid}.{$ext}";
- if ($imgcat_storetype == 'db') {
- $fp = fopen( $src_file , "rb" ) ;
- if( $fp == false ) continue ;
- $body = addslashes( fread( $fp , filesize( $src_file ) ) ) ;
- fclose( $fp ) ;
- } else {
- if( ! copy( $src_file , $dst_file ) ) continue ;
- $body = '' ;
+ if ($imgcat_storetype == 'db') {
+ $fp = fopen($src_file, "rb");
+ if ($fp == false) {
+ continue;
}
-
- // insert into image table
- $image_display = $status ? 1 : 0 ;
- $xoopsDB->query( "INSERT INTO $dst_table_photos SET image_name='{$dst_node}.{$ext}',image_nicename='".addslashes($title)."',image_created='$date',image_mimetype='{$mime_types[$ext]}',image_display='$image_display',imgcat_id='$dst_cid'" ) or die( "DB error: INSERT image table" ) ;
- if ($body) {
- $image_id = $xoopsDB->getInsertId() ;
- $xoopsDB->query( "INSERT INTO ".$xoopsDB->prefix("imagebody")." SET image_id='$image_id',image_body='$body'" ) ;
+ $body = addslashes(fread($fp, filesize($src_file)));
+ fclose($fp);
+ } else {
+ if (!copy($src_file, $dst_file)) {
+ continue;
}
+ $body = '';
+ }
- $export_count ++ ;
+ // insert into image table
+ $image_display = $status ? 1 : 0;
+ $xoopsDB->query(
+ "INSERT INTO $dst_table_photos SET image_name='{$dst_node}.{$ext}',image_nicename='" . addslashes($title)
+ . "',image_created='$date',image_mimetype='{$mime_types[$ext]}',image_display='$image_display',imgcat_id='$dst_cid'"
+ ) or die("DB error: INSERT image table");
+ if ($body) {
+ $image_id = $xoopsDB->getInsertId();
+ $xoopsDB->query("INSERT INTO " . $xoopsDB->prefix("imagebody") . " SET image_id='$image_id',image_body='$body'");
}
- redirect_header( 'export.php' , 2 , sprintf( _AM_FMT_EXPORTSUCCESS , $export_count ) ) ;
- exit ;
+ $export_count++;
}
- //
- // Form Part
- //
+ redirect_header('export.php', 2, sprintf(_AM_FMT_EXPORTSUCCESS, $export_count));
+ exit;
+}
- $sysperm_handler =& xoops_gethandler('groupperm');
- if ( $sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_IMAGE, $xoopsUser->getGroups() ) ) {
+//
+// Form Part
+//
+
+$sysperm_handler =& xoops_gethandler('groupperm');
+if ($sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_IMAGE, $xoopsUser->getGroups())) {
xoops_cp_header();
- $indexAdmin = new ModuleAdmin();
- echo $indexAdmin->addNavigation('export.php');
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation('export.php');
// myalbum_adminMenu(basename(__FILE__), 7);
- $GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_EXPORTTO,$GLOBALS['myalbumModule']->name()));
+ $GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_EXPORTTO, $GLOBALS['myalbumModule']->name()));
$GLOBALS['xoopsTpl']->assign('mydirname', $GLOBALS['mydirname']);
$GLOBALS['xoopsTpl']->assign('photos_url', $GLOBALS['photos_url']);
$GLOBALS['xoopsTpl']->assign('thumbs_url', $GLOBALS['thumbs_url']);
$GLOBALS['xoopsTpl']->assign('form', myalbum_admin_form_export());
- $GLOBALS['xoopsTpl']->display('db:'.$GLOBALS['mydirname'].'_cpanel_export.html');
+ $GLOBALS['xoopsTpl']->display('db:' . $GLOBALS['mydirname'] . '_cpanel_export.html');
// check $GLOBALS['myalbumModule']
// myalbum_footer_adminMenu();
-include_once 'admin_footer.php';
+ include_once 'admin_footer.php';
- } else {
- redirect_header('dashboard.php', 5, _NOPERM);
- }
+} else {
+ redirect_header('dashboard.php', 5, _NOPERM);
+}
Modified: XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/groupperm_global.php
===================================================================
--- XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/groupperm_global.php 2013-10-04 11:06:51 UTC (rev 12123)
+++ XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/groupperm_global.php 2013-10-04 11:17:13 UTC (rev 12124)
@@ -1,12 +1,12 @@
<?php
-include_once 'admin_header.php' ;
-include_once 'mygrouppermform.php' ;
+include_once 'admin_header.php';
+include_once 'mygrouppermform.php';
xoops_loadLanguage('admin', 'system');
-if ( ! empty( $_POST['submit'] ) ) {
- include 'mygroupperm.php' ;
- redirect_header( XOOPS_URL."/modules/".$xoopsModule->dirname()."/admin/groupperm_global.php" , 1 , _AM_ALBM_GPERMUPDATED );
+if (!empty($_POST['submit'])) {
+ include 'mygroupperm.php';
+ redirect_header(XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/groupperm_global.php", 1, _AM_ALBM_GPERMUPDATED);
}
xoops_cp_header();
@@ -18,10 +18,11 @@
$GLOBALS['xoopsTpl']->assign('photos_url', $GLOBALS['photos_url']);
$GLOBALS['xoopsTpl']->assign('thumbs_url', $GLOBALS['thumbs_url']);
$GLOBALS['xoopsTpl']->assign('form', myalbum_admin_form_groups());
-if (isset($result_str))
+if (isset($result_str)) {
$GLOBALS['xoopsTpl']->assign('result_str', $result_str);
+}
-$GLOBALS['xoopsTpl']->display('db:'.$GLOBALS['mydirname'].'_cpanel_permissions.html');
+$GLOBALS['xoopsTpl']->display('db:' . $GLOBALS['mydirname'] . '_cpanel_permissions.html');
// myalbum_footer_adminMenu();
include_once 'admin_footer.php';
Modified: XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/import.php
===================================================================
--- XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/import.php 2013-10-04 11:06:51 UTC (rev 12123)
+++ XoopsModules/myalbum/trunk/htdocs/modules/myalbum/admin/import.php 2013-10-04 11:17:13 UTC (rev 12124)
@@ -4,151 +4,208 @@
// <http://www.peak.ne.jp/> //
// ------------------------------------------------------------------------- //
-include 'admin_header.php' ;
+include 'admin_header.php';
// From myalbum*
-if ( ! empty( $_POST['myalbum_import'] ) && ! empty( $_POST['cid'] ) ) {
+if (!empty($_POST['myalbum_import']) && !empty($_POST['cid'])) {
// anti-CSRF
- if( ! xoops_refcheck() ) die( "XOOPS_URL is not included in your REFERER" ) ;
+ if (!xoops_refcheck()) {
+ die("XOOPS_URL is not included in your REFERER");
+ }
// get src module
- $src_cid = intval( $_POST['cid'] ) ;
- $src_dirname = empty( $_POST['src_dirname'] ) ? '' : $_POST['src_dirname'] ;
- if( $mydirname == $src_dirname ) die( "source dirname is same as dest dirname: " . htmlspecialchars( $src_dirname ) ) ;
- if( ! preg_match( '/^myalbum(\d*)$/' , $src_dirname , $regs ) ) die( "invalid dirname of myalbum: " . htmlspecialchars( $src_dirname ) ) ;
- $module =& $module_handler->getByDirname( $src_dirname ) ;
- if( ! is_object( $module ) ) die( "invalid module dirname:" . htmlspecialchars( $src_dirname ) ) ;
- $src_mid = $module->getvar( 'mid' ) ;
+ $src_cid = intval($_POST['cid']);
+ $src_dirname = empty($_POST['src_dirname']) ? '' : $_POST['src_dirname'];
+ if ($mydirname == $src_dirname) {
+ die("source dirname is same as dest dirname: " . htmlspecialchars($src_dirname));
+ }
+ if (!preg_match('/^myalbum(\d*)$/', $src_dirname, $regs)) {
+ die("invalid dirname of myalbum: " . htmlspecialchars($src_dirname));
+ }
+ $module =& $module_handler->getByDirname($src_dirname);
+ if (!is_object($module)) {
+ die("invalid module dirname:" . htmlspecialchars($src_dirname));
+ }
+ $src_mid = $module->getvar('mid');
// authority check
- if( ! $GLOBALS['xoopsUser']->isAdmin( $src_mid ) ) exit ;
+ if (!$GLOBALS['xoopsUser']->isAdmin($src_mid)) {
+ exit;
+ }
// read configs from xoops_config directly
- $rs = $GLOBALS['xoopsDB']->query( "SELECT conf_name,conf_value FROM ".$GLOBALS['xoopsDB']->prefix('config')." WHERE conf_modid='$src_mid'" ) ;
- while ( list( $key , $val ) = $GLOBALS['xoopsDB']->fetchRow( $rs ) ) {
- $src_configs[ $key ] = $val ;
+ $rs = $GLOBALS['xoopsDB']->query("SELECT conf_name,conf_value FROM " . $GLOBALS['xoopsDB']->prefix('config') . " WHERE conf_modid='$src_mid'");
+ while (list($key, $val) = $GLOBALS['xoopsDB']->fetchRow($rs)) {
+ $src_configs[$key] = $val;
}
- $src_photos_dir = XOOPS_ROOT_PATH . $src_configs['myalbum_photospath'] ;
- $src_thumbs_dir = XOOPS_ROOT_PATH . $src_configs['myalbum_thumbspath'] ;
+ $src_photos_dir = XOOPS_ROOT_PATH . $src_configs['myalbum_photospath'];
+ $src_thumbs_dir = XOOPS_ROOT_PATH . $src_configs['myalbum_thumbspath'];
// src table names
- $src_table_photos = $GLOBALS['xoopsDB']->prefix( "{$src_dirname}_photos" ) ;
- $src_table_cat = $GLOBALS['xoopsDB']->prefix( "{$src_dirname}_cat" ) ;
- $src_table_text = $GLOBALS['xoopsDB']->prefix( "{$src_dirname}_text" ) ;
- $src_table_votedata = $GLOBALS['xoopsDB']->prefix( "{$src_dirname}_votedata" ) ;
+ $src_table_photos = $GLOBALS['xoopsDB']->prefix("{$src_dirname}_photos");
+ $src_table_cat = $GLOBALS['xoopsDB']->prefix("{$src_dirname}_cat");
+ $src_table_text = $GLOBALS['xoopsDB']->prefix("{$src_dirname}_text");
+ $src_table_votedata = $GLOBALS['xoopsDB']->prefix("{$src_dirname}_votedata");
- if( isset( $_POST['copyormove'] ) && $_POST['copyormove'] == 'move' ) $move_mode = true ;
- else $move_mode = false ;
+ if (isset($_POST['copyormove']) && $_POST['copyormove'] == 'move') {
+ $move_mode = true;
+ } else {
+ $move_mode = false;
+ }
// create category
- $GLOBALS['xoopsDB']->query( "INSERT INTO ".$GLOBALS['xoopsDB']->prefix( $table_cat )."(pid, title, imgurl) SELECT '0',title,imgurl FROM $src_table_cat WHERE cid='$src_cid'") or die( "DB error: INSERT cat table" ) ;
- $cid = $GLOBALS['xoopsDB']->getInsertId() ;
+ $GLOBALS['xoopsDB']->query(
+ "INSERT INTO " . $GLOBALS['xoopsDB']->prefix($table_cat) . "(pid, title, imgurl) SELECT '0',title,imgurl FROM $src_table_cat WHERE cid='$src_cid'"
+ ) or die("DB error: INSERT cat table");
+ $cid = $GLOBALS['xoopsDB']->getInsertId();
// INSERT loop
- $rs = $GLOBALS['xoopsDB']->query( "SELECT lid,ext FROM $src_table_photos WHERE cid='$src_cid'" ) ;
- $import_count = 0 ;
- while ( list( $src_lid , $ext ) = $GLOBALS['xoopsDB']->fetchRow( $rs ) ) {
+ $rs = $GLOBALS['xoopsDB']->query("SELECT lid,ext FROM $src_table_photos WHERE cid='$src_cid'");
+ $import_count = 0;
+ while (list($src_lid, $ext) = $GLOBALS['xoopsDB']->fetchRow($rs)) {
// photos table
- $set_comments = $move_mode ? 'comments' : "'0'" ;
- $sql = "INSERT INTO ".$GLOBALS['xoopsDB']->prefix( $table_photos )."(cid,title,ext,res_x,res_y,submitter,status,date,hits,rating,votes,comments) SELECT '$cid',title,ext,res_x,res_y,submitter,status,date,hits,rating,votes,$set_comments FROM $src_table_photos WHERE lid='$src_lid'" ;
- $GLOBALS['xoopsDB']->query( $sql ) or die( "DB error: INSERT photo table" ) ;
- $lid = $GLOBALS['xoopsDB']->getInsertId() ;
+ $set_comments = $move_mode ? 'comments' : "'0'";
+ $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix($table_photos)
+ . "(cid,title,ext,res_x,res_y,submitter,status,date,hits,rating,votes,comments) SELECT '$cid',title,ext,res_x,res_y,submitter,status,date,hits,rating,votes,$set_comments FROM $src_table_photos WHERE lid='$src_lid'";
+ $GLOBALS['xoopsDB']->query($sql) or die("DB error: INSERT photo table");
+ $lid = $GLOBALS['xoopsDB']->getInsertId();
// text table
- $sql = "INSERT INTO ".$GLOBALS['xoopsDB']->prefix( $table_text )." (lid,description) SELECT '$lid',description FROM $src_table_text WHERE lid='$src_lid'" ;
- $GLOBALS['xoopsDB']->query( $sql ) ;
+ $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix($table_text)
+ . " (lid,description) SELECT '$lid',description FROM $src_table_text WHERE lid='$src_lid'";
+ $GLOBALS['xoopsDB']->query($sql);
// votedata table
- $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix( $table_votedata ) . " (lid,ratinguser,rating,ratinghostname,ratingtimestamp) SELECT '$lid',ratinguser,rating,ratinghostname,ratingtimestamp FROM $src_table_votedata WHERE lid='$src_lid'" ;
- $GLOBALS['xoopsDB']->query( $sql ) ;
+ $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix($table_votedata)
+ . " (lid,ratinguser,rating,ratinghostname,ratingtimestamp) SELECT '$lid',ratinguser,rating,ratinghostname,ratingtimestamp FROM $src_table_votedata WHERE lid='$src_lid'";
+ $GLOBALS['xoopsDB']->query($sql);
- @copy( "$src_photos_dir/{$src_lid}.{$ext}" , "$photos_dir/{$lid}.{$ext}" ) ;
- if ( in_array( strtolower( $ext ) , $myalbum_normal_exts ) ) {
- @copy( "$src_thumbs_dir/{$src_lid}.{$ext}" , "$thumbs_dir/{$lid}.{$ext}" ) ;
+ @copy("$src_photos_dir/{$src_lid}.{$ext}", "$photos_dir/{$lid}.{$ext}");
+ if (in_array(strtolower($ext), $myalbum_normal_exts)) {
+ @copy("$src_thumbs_dir/{$src_lid}.{$ext}", "$thumbs_dir/{$lid}.{$ext}");
} else {
- @copy( "$src_photos_dir/{$src_lid}.gif" , "$photos_dir/{$lid}.gif" ) ;
- @copy( "$src_thumbs_dir/{$src_lid}.gif" , "$thumbs_dir/{$lid}.gif" ) ; }
+ @copy("$src_photos_dir/{$src_lid}.gif", "$photos_dir/{$lid}.gif");
+ @copy("$src_thumbs_dir/{$src_lid}.gif", "$thumbs_dir/{$lid}.gif");
+ }
// exec only moving mode
if ($move_mode) {
// moving comments
- $sql = "UPDATE ".$GLOBALS['xoopsDB']->prefix('xoopscomments')." SET com_modid='$myalbum_mid',com_itemid='$lid' WHERE com_modid='$src_mid' AND com_itemid='$src_lid'" ;
- $GLOBALS['xoopsDB']->query( $sql ) ;
+ $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix('xoopscomments')
+ . " SET com_modid='$myalbum_mid',com_itemid='$lid' WHERE com_modid='$src_mid' AND com_itemid='$src_lid'";
+ $GLOBALS['xoopsDB']->query($sql);
// delete source photos
- list( $photos_dir , $thumbs_dir , $myalbum_mid , $table_photos , $table_text , $table_votedata , $saved_photos_dir , $saved_thumbs_dir , $saved_myalbum_mid , $saved_table_photos , $saved_table_text , $saved_table_votedata ) = array( $src_photos_dir , $src_thumbs_dir , $src_mid , $src_table_photos , $src_table_text , $src_table_votedata , $photos_dir , $thumbs_dir , $myalbum_mid , $GLOBALS['xoopsDB']->prefix( $table_photos ), $GLOBALS['xoopsDB']->prefix( $table_text ) , $GLOBALS['xoopsDB']->prefix( $table_votedata ) ) ;
- myalbum_delete_photos( "lid='$src_lid'" ) ;
- list( $photos_dir , $thumbs_dir , $myalbum_mid , $table_photos , $table_text ,$table_votedata ) = array( $saved_photos_dir , $saved_thumbs_dir , $saved_myalbum_mid , $saved_table_photos , $saved_table_text , $saved_table_votedata ) ; }
+ list($photos_dir, $thumbs_dir, $myalbum_mid, $table_photos, $table_text, $table_votedata, $saved_photos_dir, $saved_thumbs_dir,
+ $saved_myalbum_mid, $saved_table_photos, $saved_table_text, $saved_table_votedata)
+ = array(
+ $src_photos_dir,
+ $src_thumbs_dir,
+ $src_mid,
+ $src_table_photos,
+ $src_table_text,
+ $src_table_votedata,
+ $photos_dir,
+ $thumbs_dir,
+ $myalbum_mid,
+ $GLOBALS['xoopsDB']->prefix($table_photos),
+ $GLOBALS['xoopsDB']->prefix($table_text),
+ $GLOBALS['xoopsDB']->prefix($table_votedata)
+ );
+ myalbum_delete_photos("lid='$src_lid'");
+ list($photos_dir, $thumbs_dir, $myalbum_mid, $table_photos, $table_text, $table_votedata) = array(
+ $saved_photos_dir,
+ $saved_thumbs_dir,
+ $saved_myalbum_mid,
+ $saved_table_photos,
+ $saved_table_text,
+ $saved_table_votedata
+ );
+ }
- $import_count ++ ;
+ $import_count++;
}
- redirect_header( 'import.php' , 2 , sprintf( _AM_FMT_IMPORTSUCCESS , $import_count ) ) ;
- exit ;
-}
+ redirect_header('import.php', 2, sprintf(_AM_FMT_IMPORTSUCCESS, $import_count));
+ exit;
+} // From imagemanager
+else {
+ if (!empty($_POST['imagemanager_import']) && !empty($_POST['imgcat_id'])) {
-// From imagemanager
-else if ( ! empty( $_POST['imagemanager_import'] ) && ! empty( $_POST['imgcat_id'] ) ) {
+ // authority check
+ $sysperm_handler =& xoops_gethandler('groupperm');
+ if (!$sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_IMAGE, $GLOBALS['xoopsUser']->getGroups())) {
+ exit;
+ }
- // authority check
- $sysperm_handler =& xoops_gethandler('groupperm');
- if( ! $sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_IMAGE, $GLOBALS['xoopsUser']->getGroups() ) ) exit ;
+ // anti-CSRF
+ if (!xoops_refcheck()) {
+ die("XOOPS_URL is not included in your REFERER");
+ }
- // anti-CSRF
- if( ! xoops_refcheck() ) die( "XOOPS_URL is not included in your REFERER" ) ;
+ // get src information
+ $src_cid = intval($_POST['imgcat_id']);
+ $src_table_photos = $GLOBALS['xoopsDB']->prefix("image");
+ $src_table_cat = $GLOBALS['xoopsDB']->prefix("imagecategory");
- // get src information
- $src_cid = intval( $_POST['imgcat_id'] ) ;
- $src_table_photos = $GLOBALS['xoopsDB']->prefix( "image" ) ;
- $src_table_cat = $GLOBALS['xoopsDB']->prefix( "imagecategory" ) ;
+ // create category
+ $crs = $GLOBALS['xoopsDB']->query("SELECT imgcat_name,imgcat_storetype FROM $src_table_cat WHERE imgcat_id='$src_cid'");
+ list($imgcat_name, $imgcat_storetype) = $GLOBALS['xoopsDB']->fetchRow($crs);
- // create category
- $crs = $GLOBALS['xoopsDB']->query( "SELECT imgcat_name,imgcat_storetype FROM $src_table_cat WHERE imgcat_id='$src_cid'" ) ;
- list( $imgcat_name , $imgcat_storetype ) = $GLOBALS['xoopsDB']->fetchRow( $crs ) ;
+ $GLOBALS['xoopsDB']->query("INSERT INTO " . $GLOBALS['xoopsDB']->prefix($table_cat) . "SET pid=0,title='" . addslashes($imgcat_name) . "'")
+ or die("DB error: INSERT cat table");
+ $cid = $GLOBALS['xoopsDB']->getInsertId();
- $GLOBALS['xoopsDB']->query( "INSERT INTO ".$GLOBALS['xoopsDB']->prefix( $table_cat )."SET pid=0,title='".addslashes($imgcat_name)."'" ) or die( "DB error: INSERT cat table" ) ;
- $cid = $GLOBALS['xoopsDB']->getInsertId() ;
+ // INSERT loop
+ $rs = $GLOBALS['xoopsDB']->query(
+ "SELECT image_id,image_name,image_nicename,image_created,image_display FROM $src_table_photos WHERE imgcat_id='$src_cid'"
+ );
+ $import_count = 0;
+ while (list($image_id, $image_name, $image_nicename, $image_created, $image_display) = $GLOBALS['xoopsDB']->fetchRow($rs)) {
- // INSERT loop
- $rs = $GLOBALS['xoopsDB']->query( "SELECT image_id,image_name,image_nicename,image_created,image_display FROM $src_table_photos WHERE imgcat_id='$src_cid'" ) ;
- $import_count = 0 ;
- while ( list( $image_id,$image_name,$image_nicename,$image_created,$image_display ) = $GLOBALS['xoopsDB']->fetchRow( $rs ) ) {
+ $src_file = XOOPS_UPLOAD_PATH . "/$image_name";
+ $ext = substr(strrchr($image_name, '.'), 1);
- $src_file = XOOPS_UPLOAD_PATH . "/$image_name" ;
- $ext = substr( strrchr( $image_name , '.' ) , 1 ) ;
+ // photos table
+ $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix($table_photos) . "SET cid='$cid',title='" . addslashes($image_nicename)
+ . "',ext='$ext',submitter='$my_uid',status='$image_display',date='$image_created'";
+ $GLOBALS['xoopsDB']->query($sql) or die("DB error: INSERT photo table");
+ $lid = $GLOBALS['xoopsDB']->getInsertId();
- // photos table
- $sql = "INSERT INTO ".$GLOBALS['xoopsDB']->prefix( $table_photos )."SET cid='$cid',title='".addslashes($image_nicename)."',ext='$ext',submitter='$my_uid',status='$image_display',date='$image_created'" ;
- $GLOBALS['xoopsDB']->query( $sql ) or die( "DB error: INSERT photo table" ) ;
- $lid = $GLOBALS['xoopsDB']->getInsertId() ;
+ // text table
+ $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix($table_text) . " SET lid='$lid',description=''";
+ $GLOBALS['xoopsDB']->query($sql);
- // text table
- $sql = "INSERT INTO ".$GLOBALS['xoopsDB']->prefix( $table_text )." SET lid='$lid',description=''" ;
- $GLOBALS['xoopsDB']->query( $sql ) ;
+ $dst_file = "$photos_dir/{$lid}.{$ext}";
+ if ($imgcat_storetype == 'db') {
+ $fp = fopen($dst_file, "wb");
+ if ($fp == false) {
+ continue;
+ }
+ $brs = $GLOBALS['xoopsDB']->query(
+ "SELECT image_body FROM " . $GLOBALS['xoopsDB']->prefix("imagebody") . " WHERE image_id='$image_id'"
+ );
+ list($body) = $GLOBALS['xoopsDB']->fetchRow($brs);
+ fwrite($fp, $body);
+ fclose($fp);
+ myalbum_create_thumb($dst_file, $lid, $ext);
+ } else {
+ @copy($src_file, $dst_file);
+ myalbum_create_thumb($src_file, $lid, $ext);
+ }
- $dst_file = "$photos_dir/{$lid}.{$ext}" ;
- if ($imgcat_storetype == 'db') {
- $fp = fopen( $dst_file , "wb" ) ;
- if( $fp == false ) continue ;
- $brs = $GLOBALS['xoopsDB']->query( "SELECT image_body FROM ".$GLOBALS['xoopsDB']->prefix("imagebody")." WHERE image_id='$image_id'" ) ;
- list( $body ) = $GLOBALS['xoopsDB']->fetchRow( $brs ) ;
- fwrite( $fp , $body ) ;
- fclose( $fp ) ;
- myalbum_create_thumb( $dst_file , $lid , $ext ) ;
- } else {
- @copy( $src_file , $dst_file ) ;
- myalbum_create_thumb( $src_file , $lid , $ext ) ;
+ list($width, $height, $type) = getimagesize($dst_file);
+ $GLOBALS['xoopsDB']->query(
+ "UPDATE " . $GLOBALS['xoopsDB']->prefix($table_photos) . "SET res_x='$width',res_y='$height' WHERE lid='$lid'"
+ );
+
+ $import_count++;
}
- list( $width , $height , $type ) = getimagesize( $dst_file ) ;
- $GLOBALS['xoopsDB']->query( "UPDATE ".$GLOBALS['xoopsDB']->prefix( $table_photos )."SET res_x='$width',res_y='$height' WHERE lid='$lid'" ) ;
-
- $import_count ++ ;
+ redirect_header('import.php', 2, sprintf(_AM_FMT_IMPORTSUCCESS, $import_count));
+ exit;
}
-
- redirect_header( 'import.php' , 2 , sprintf( _AM_FMT_IMPORTSUCCESS , $import_count ) ) ;
- exit ;
}
include_once '../include/myalbum.forms.php';
@@ -156,14 +213,14 @@
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation('import.php');
//myalbum_adminMenu(basename(__FILE__), 6);
-$GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_IMPORTTO,$xoopsModule->name()));
+$GLOBALS['xoopsTpl']->assign('admin_title', sprintf(_AM_H3_FMT_IMPORTTO, $xoopsModule->name()));
$GLOBALS['xoopsTpl']->assign('mydirname', $GLOBALS['mydirname']);
$GLOBALS['xoopsTpl']->assign('photos_url', $GLOBALS['photos...
[truncated message content] |