|
From: <luc...@us...> - 2013-08-24 21:29:21
|
Revision: 11974
http://sourceforge.net/p/xoops/svn/11974
Author: luciorota
Date: 2013-08-24 21:29:18 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
improved Formulize support
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/admin.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php
XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -96,11 +96,11 @@
}
}
- //added formulize support (2006/05/04) jpc - start
- if (xoops_isActiveModule('formulize')) {
+ // Added Formulize module support (2006/05/04) jpc - start
+ if (wfdownload_checkModule('formulize') < 300) {
$formulize_fid = (isset($_POST["formulize_fid"])) ? (int)$_POST["formulize_fid"] : 0;
}
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
$category->setVar('title', $_POST["title"]);
$category->setVar('description', $_POST["description"]);
$category->setVar('summary', $_POST["summary"]);
@@ -114,11 +114,11 @@
$category->setVar('spotlighthis', $spotlighthis);
$category->setVar('spotlighttop', $spotlighttop);
$category->setVar('imgurl', $imgurl);
- //added formulize support (2006/05/04) jpc - start
- if (xoops_isActiveModule('formulize')) {
+ // Added Formulize module support (2006/05/04) jpc - start
+ if (wfdownload_checkModule('formulize')) {
$category->setVar('formulize_fid', $formulize_fid);
}
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
$result = $wfdownloads->getHandler('category')->insert($category);
if (!$result) {
echo $category->getHtmlErrors();
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -81,9 +81,9 @@
redirect_header($currentFile, 1, _AM_WFD_VOTE_VOTEDELETED);
break;
- //added formulize support (2006/05/04) jpc - start
+ // Added Formulize module support (2006/05/04) jpc - start
case "patch_formulize":
- if (xoops_isActiveModule('formulize')) {
+ if (wfdownload_checkModule('formulize')) {
if(!isset($_POST['patch_formulize'])) {
print "<form action=\"{$currentFile}?op=patch_formulize\" method=post>";
print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">";
@@ -99,7 +99,7 @@
}
}
break;
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
case "newdownload.approve":
case "approve":
@@ -329,14 +329,13 @@
$title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_DOWNLOADTITLE);
}
- // changed - start - March 4 2006 - jpc
+ // Added Formulize module support (2006/05/04) jpc - start
if ((isset($_POST['submit_category']) && !empty($_POST['submit_category'])) || $lid) {
$fid = $category->getVar('formulize_fid');
$customArray = array();
if($fid) {
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formdisplay.php";
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
-
$customArray['fid'] = $fid;
$customArray['formulize_mgr'] =& xoops_getmodulehandler('elements', 'formulize');
$customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
@@ -344,9 +343,10 @@
$customArray['entry'] = $download->getVar('formulize_idreq');
$customArray['go_back'] = "";
$customArray['parentLinks'] = "";
-
- // $owner = getEntryOwner($entry);
- $owner = getEntryOwner($entry, $fid);
+ if (wfdownload_checkModule('formulize') < 300)
+ $owner = getEntryOwner($entry);
+ else
+ $owner = getEntryOwner($entry, $fid);
$member_handler = xoops_gethandler('member');
$owner_groups = $member_handler->getGroupsByUser($owner, false);
$customArray['owner_groups'] = $owner_groups;
@@ -358,7 +358,7 @@
$sform = $download->getAdminForm($title);
}
$sform->display();
- // changed - end - March 4 2006 - jpc
+ // Added Formulize module support (2006/05/04) jpc - end
} else {
redirect_header('categories.php', 1, _AM_WFD_CCATEGORY_NOEXISTS);
exit();
@@ -647,22 +647,22 @@
$download->setVar('ipaddress', $_SERVER['REMOTE_ADDR']);
}
- //added formulize support (2006/05/04) jpc - start
- if (xoops_isActiveModule('formulize')) {
+ // Added Formulize module support (2006/05/04) jpc - start
+ if (wfdownload_checkModule('formulize')) {
$category = $wfdownloads->getHandler('category')->get($cid);
$fid = $category->getVar('formulize_fid');
if($fid) {
global $xoopsUser;
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formread.php";
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
-
$formulize_mgr =& xoops_getmodulehandler('elements', 'formulize');
-
if ($lid) {
$entries[$fid][0] = $download->getVar('formulize_idreq');
if($entries[$fid][0]) {
- // $owner = getEntryOwner($entries[$fid][0]);
- $owner = getEntryOwner($entries[$fid][0], $fid);
+ if (wfdownload_checkModule('formulize') < 300)
+ $owner = getEntryOwner($entries[$fid][0]);
+ else
+ $owner = getEntryOwner($entries[$fid][0], $fid);
} else {
print "no idreq";
$entries[$fid][0] = "";
@@ -677,14 +677,13 @@
$uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
$groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
$entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that
-
if(!$owner) {
$id_req = $entries[$fid][0];
$download->setVar('formulize_idreq', $id_req);
}
}
}
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
$wfdownloads->getHandler('download')->insert($download);
$newid = intval($download->getVar('lid'));
/**
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -39,9 +39,9 @@
$this->initVar('doimage', XOBJ_DTYPE_INT, true); // boolean
$this->initVar('dobr', XOBJ_DTYPE_INT, true); // boolean
$this->initVar('weight', XOBJ_DTYPE_INT, 0);
- //added formulize support (2006/05/04) jpc - start
+ // Added Formulize module support (2006/05/04) jpc - start
$this->initVar('formulize_fid', XOBJ_DTYPE_INT, 0);
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
}
function getForm($action = false)
@@ -117,8 +117,8 @@
$options_tray -> addElement($breaks_checkbox);
$form -> addElement($options_tray);
- //added formulize support (2006/05/04) jpc - start
- if (xoops_isActiveModule('formulize')) {
+ // Added Formulize module support (2006/05/04) jpc - start
+ if (wfdownload_checkModule('formulize')) {
if(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) {
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
$fids = allowedForms();
@@ -132,7 +132,7 @@
$form -> addElement($formulize_forms);
}
}
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormHidden('op', 'save'));
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -73,9 +73,9 @@
$this->initVar('doimage', XOBJ_DTYPE_INT, 1, false); // boolean
$this->initVar('dobr', XOBJ_DTYPE_INT, 1, false); // boolean
- //added formulize support (2006/05/04) jpc - start
+ // Added Formulize module support (2006/05/04) jpc - start
$this->initVar('formulize_idreq', XOBJ_DTYPE_INT, 0);
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
}
@@ -707,7 +707,7 @@
- //added formulize support (2006/05/04) jpc - start
+ // Added Formulize module support (2006/05/04) jpc - start
function getCategoryForm() {
global $wfdownloads;
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
@@ -727,7 +727,7 @@
$sform->addElement($button_tray);
return $sform;
}
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
@@ -865,8 +865,8 @@
// delete comments
xoops_comment_delete((int)$wfdownloads->getModule()->mid(), (int)$download->getVar('lid'));
- //added formulize support (2006/05/04) jpc - start
- if (xoops_isActiveModule('formulize')) {
+ // Added Formulize module support (2006/05/04) jpc - start
+ if (wfdownload_checkModule('formulize')) {
if(file_exists(XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php') AND $download->getVar('formulize_idreq') > 0) {
include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php';
//deleteFormEntries(array($download->getVar('formulize_idreq')));
@@ -874,7 +874,7 @@
deleteFormEntries(array($download->getVar("formulize_idreq")), $category->getVar('formulize_fid'));
}
}
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
return true;
}
return false;
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -256,6 +256,26 @@
/**
+ * Check if a module exist and return module verision
+ *
+ * @param string $dirname
+* @return boolean, integer false if module not installed or not active, module version if installed
+ *
+ * @access public
+ * @author luciorota
+ */
+function wfdownload_checkModule($dirname) {
+ if (!xoops_isActiveModule($dirname)) {
+ return false;
+ }
+ $module_handler =& xoops_gethandler('module');
+ $module = $module_handler->getByDirname($dirname);
+ return $module->getVar('version');
+}
+
+
+
+/**
* Recursively sort categories by level and weight
*
* @param integer $pid
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -66,8 +66,8 @@
// =========================================================================================
-// This function updates any existing table of a 2.x version to the format used
-// in the release of WF-Downloads 3.00
+// This function updates any existing table of a 3.22 version to the format used
+// in the release of WF-Downloads 3.23
// =========================================================================================
function update_tables_to_323($module) {
$ret = array();
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/language/english/admin.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/language/english/admin.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/language/english/admin.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -543,7 +543,7 @@
define("_AM_WFD_HELP","Help");
-//added formulize support (2006/05/04) jpc - start
+// Added Formulize module support (2006/05/04) jpc - start
define("_AM_WFD_FFS_SUBMITBROKEN","Submit");
define("_AM_WFD_FFS_STANDARD_FORM","No, use the standard form");
define("_AM_WFD_FFS_CUSTOM_FORM","Use a custom form for this category?");
@@ -561,7 +561,7 @@
define("_AM_WFD_DLURL","Download URL: ");
define("_AM_WFD_UPLOAD_FILEC","Upload file: ");
define("_AM_WFD_DESCRIPTION","Description");
-//added formulize support (2006/05/04) jpc - end
+// Added Formulize module support (2006/05/04) jpc - end
define("_AM_WFD_MINDEX_LOG","Logs");
define("_AM_WFD_IP_LOGS","View logs");
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -276,13 +276,13 @@
define("_MD_WFD_DOWNLOAD_MOST_RATED","Best rated downloads");
-//added formulize support (2006/05/04) jpc - start
+// Added Formulize module support (2006/05/04) jpc - start
define("_MD_WFD_FFS_SUBMITCATEGORYHEAD","Which Category of file do you want to submit?");
define("_MD_WFD_FFS_DOWNLOADDETAILS","Download details:");
define("_MD_WFD_FFS_DOWNLOADCUSTOMDETAILS","Custom details:");
define("_MD_WFD_FFS_BACK","Back");
define("_MD_WFD_FFS_DOWNLOADTITLE","Submitting a '{category}' file.");
-//added formulize support (2006/05/04) jpc - end
+// Added Formulize module support (2006/05/04) jpc - end
// 3.23
function wfdownloads_alphabet() {
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/submit.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/submit.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -204,8 +204,8 @@
}
}
- //added formulize support (2006/05/04) jpc - start
- if (xoops_isActiveModule('formulize')) {
+ // Added Formulize module support (2006/05/04) jpc - start
+ if (wfdownload_checkModule('formulize')) {
// Now that the $download object has been instantiated, handle the Formulize part of the submission...
$category = $wfdownloads->getHandler('category')->get($cid);
$fid = $category->getVar('formulize_fid');
@@ -216,8 +216,10 @@
if ($lid) {
$entries[$fid][0] = $download->getVar('formulize_idreq');
if ($entries[$fid][0]) {
- // $owner = getEntryOwner($entries[$fid][0]);
- $owner = getEntryOwner($entries[$fid][0], $fid);
+ if (wfdownload_checkModule('formulize') < 300)
+ $owner = getEntryOwner($entries[$fid][0]);
+ else
+ $owner = getEntryOwner($entries[$fid][0], $fid);
} else {
$entries[$fid][0] = "";
$owner = "";
@@ -237,7 +239,7 @@
}
}
}
- //added formulize support (2006/05/04) jpc - end
+ // Added Formulize module support (2006/05/04) jpc - end
if (!empty($_POST["homepage"]) || $_POST["homepage"] != "http://") {
$download->setVar('homepage', formatURL(trim($_POST["homepage"])));
@@ -442,17 +444,17 @@
if ($fid) {
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formdisplay.php";
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
-
- $customArray['fid'] = $fid;
- $customArray['formulize_mgr'] =& xoops_getmodulehandler('elements', 'formulize');
- $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
- $customArray['prevEntry'] = getEntryValues($download->getVar('formulize_idreq'), $customArray['formulize_mgr'], $customArray['groups'], $fid);
- $customArray['entry'] = $download->getVar('formulize_idreq');
- $customArray['go_back'] = "";
- $customArray['parentLinks'] = "";
-
- // $owner = getEntryOwner($entry);
- $owner = getEntryOwner($entry, $fid);
+ $customArray['fid'] = $fid;
+ $customArray['formulize_mgr'] = xoops_getmodulehandler('elements', 'formulize');
+ $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $customArray['prevEntry'] = getEntryValues($download->getVar('formulize_idreq'), $customArray['formulize_mgr'], $customArray['groups'], $fid);
+ $customArray['entry'] = $download->getVar('formulize_idreq');
+ $customArray['go_back'] = '';
+ $customArray['parentLinks'] = '';
+ if (wfdownload_checkModule('formulize') < 300)
+ $owner = getEntryOwner($entry);
+ else
+ $owner = getEntryOwner($entry, $fid);
$member_handler = xoops_gethandler('member');
$owner_groups = $member_handler->getGroupsByUser($owner, FALSE);
$customArray['owner_groups'] = $owner_groups;
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php 2013-08-24 16:47:04 UTC (rev 11973)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php 2013-08-24 21:29:18 UTC (rev 11974)
@@ -45,12 +45,12 @@
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
-//added formulize support (2006/05/04) jpc - start
+// Added Formulize module support (2006/05/04) jpc - start
// $category instantiation moved from above 'Breadcrumb' comment
$category = $wfdownloads->getHandler('category')->get($cid);
// Retreiving the top parent category
-if (xoops_isActiveModule('formulize')) {
+if (wfdownload_checkModule('formulize')) {
if (!isset($_GET['list']) && !isset($_GET['selectdate'])) {
$allSubcatsTopParentCid = $wfdownloads->getHandler('category')->getAllSubcatsTopParentCid();
$topCategory = $wfdownloads->getHandler('category')->allCategories[$allSubcatsTopParentCid[$cid]];
@@ -58,14 +58,13 @@
$xoopsTpl->assign('topcategory_image', $topCategory->getVar('imgurl'));
$xoopsTpl->assign('topcategory_cid', $topCategory->getVar('cid'));
}
-
$formulize_fid = $category->getVar('formulize_fid');
if($formulize_fid)
$xoopsTpl->assign('custom_form', 1);
else
$xoopsTpl->assign('custom_form', 0);
}
-//added formulize support (2006/05/04) jpc - end
+// Added Formulize module support (2006/05/04) jpc - end
$catArray['imageheader'] = wfd_imageheader();
$catArray['letters'] = wfdownloads_lettersChoice();
|