Skip to content

Commit 4c54b8c

Browse files
author
Stefek
committed
increase version number of the module
1 parent 79fe946 commit 4c54b8c

12 files changed

Lines changed: 188 additions & 192 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/nbproject/private/
1+
/nbproject/private/
2+
/nbproject/

functions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
$aPossibleStringTypes = array('textarea', 'shorttext', 'wysiwyg');
1414

1515
$sDirname = basename(dirname(__FILE__));
16-
if(!defined('STRINGS_CFG_TBL')) define('STRINGS_CFG_TBL', TABLE_PREFIX ."mod_".$sDirname."_cfg");
17-
if(!defined('STRINGS_FIELDS_TBL')) define('STRINGS_FIELDS_TBL', TABLE_PREFIX ."mod_".$sDirname."_fields");
18-
if(!defined('STRINGS_CONTENTS_TBL')) define('STRINGS_CONTENTS_TBL', TABLE_PREFIX ."mod_".$sDirname."_contents");
16+
defined('STRINGS_CFG_TBL') or define('STRINGS_CFG_TBL', TABLE_PREFIX ."mod_".$sDirname."_cfg");
17+
defined('STRINGS_FIELDS_TBL') or define('STRINGS_FIELDS_TBL', TABLE_PREFIX ."mod_".$sDirname."_fields");
18+
defined('STRINGS_CONTENTS_TBL') or define('STRINGS_CONTENTS_TBL', TABLE_PREFIX ."mod_".$sDirname."_contents");
1919

2020
if(!isset($toolUrl)) $toolUrl = ADMIN_URL.'/admintools/tool.php?tool='.$sDirname;
2121
if(!isset($modulePath)) $modulePath = WB_PATH.'/modules/'.$sDirname;

functions/common.functions.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function getActiveLanguages(){
2626
// Loop through addons
2727
while($rec = $oAddons->fetchRow(MYSQL_ASSOC)){
2828
if($rec['active'] == true){
29-
$aLangs[$rec['directory']] = $rec['name'];
29+
$aLangs[$rec['directory']] = $rec['name'];
3030
}
3131
}
3232
}
@@ -101,17 +101,17 @@ function updateRecordFromArray($aInsertArray = array(), $sTableName = '', $sWher
101101
global $database;
102102
$aCollect = array();
103103
foreach ($aInsertArray as $k => $v) {
104-
$aCollect[] = "`".$k."` = '".$v."', ";
104+
$aCollect[] = "`".$k."` = '".$v."', ";
105105
}
106106
$sValues = implode("", $aCollect);
107107
$sValues = substr($sValues, 0, -2);
108108
$sQuery = "UPDATE `%s` SET %s WHERE `%s` = '%d'";
109109
// execute the UPDATE query
110-
if($database->query(sprintf($sQuery, $sTableName, $sValues, $sWhereField, $iWhereId))){
111-
return true;
112-
}else{
113-
return false; //$database->get_error();
114-
}
110+
if($database->query(sprintf($sQuery, $sTableName, $sValues, $sWhereField, $iWhereId))){
111+
return true;
112+
}else{
113+
return false; //$database->get_error();
114+
}
115115
}
116116
}
117117
}
@@ -156,30 +156,30 @@ function db_table_exists($sTable){
156156
}
157157

158158
if (!function_exists('insertRow')) {
159-
/**
160-
* updateRecordFromArray
161-
*/
162-
function insertRow($table, array $data){
163-
global $database;
164-
$retVal = false;
165-
$parameters = array();
166-
foreach ($data as $column => $value) {
167-
$parameters[] = "`".trim($column)."` = '".$value."', ";
159+
/**
160+
* updateRecordFromArray
161+
*/
162+
function insertRow($table, array $data){
163+
global $database;
164+
$retVal = false;
165+
$parameters = array();
166+
foreach ($data as $column => $value) {
167+
$parameters[] = "`".trim($column)."` = '".$value."', ";
168+
}
169+
$sValues = implode("", $parameters);
170+
$sValues = substr($sValues, 0, -2);
171+
#echo '<br>(1)';
172+
$strQuery = sprintf("INSERT INTO `%s` SET %s", $table, $sValues);
173+
#echo '<br>'.$strQuery;
174+
if($database->query($strQuery)){
175+
#echo '<br>(2)';
176+
$retVal = true;
177+
}else{
178+
#echo '<br>(3)';
179+
$retVal = $database->get_error();
180+
}
181+
return $retVal;
168182
}
169-
$sValues = implode("", $parameters);
170-
$sValues = substr($sValues, 0, -2);
171-
echo '<br>(1)';
172-
$strQuery = sprintf("INSERT INTO `%s` SET %s", $table, $sValues);
173-
echo '<br>'.$strQuery;
174-
if($database->query($strQuery)){
175-
echo '<br>(2)';
176-
$retVal = true;
177-
}else{
178-
echo '<br>(3)';
179-
$retVal = $database->get_error();
180-
}
181-
return $retVal;
182-
}
183183
}
184184

185185
if (!function_exists('updateRow')) {

functions/droplets.functions.php

Lines changed: 128 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -11,135 +11,138 @@
1111
*/
1212

1313
if (!function_exists('importDropletFromZip')) {
14-
/**
15-
* importDropletFromZip
16-
* @param string $sZipPath - full path to your droplets zip-file e.g. __DIR__.'/droplets/droplets.zip'
17-
* @param string $sTempDir - optional; full path to temporary unzip folder e.g. !must be writeable
18-
*/
19-
function importDropletFromZip($sZipPath, $sTempDir = '', $bDeleteTemp = true)
20-
{
21-
$errors = array();
22-
$count = 0;
23-
$aReturn = array();
24-
25-
$sTempDir = $sTempDir != '' ? $sTempDir : WB_PATH.'/temp/droplets/';
26-
if (!file_exists($sTempDir)) mkdir($sTempDir, 0777, true);
27-
28-
$oZip = new ZipArchive;
29-
if ($oZip->open($sZipPath) === TRUE) {
30-
$oZip->extractTo($sTempDir);
31-
$oZip->close();
32-
}
33-
34-
// now, open the temp directory
35-
if (false !== ($dh = opendir($sTempDir))) {
36-
while (false !== ($sFile = readdir($dh)))
37-
{
38-
// read trough all the files in temp directory
39-
if ($sFile != "." && $sFile != "..") {
40-
$feedback = importDropletFromFile($sFile, $sTempDir); // use import droplet function
41-
$imports[$feedback['imported']] = $feedback['imported'];
42-
if(isset($feedback['error'])){
43-
$errors[$feedback['imported']] = $feedback['error'];
44-
}else{
45-
$count++;
46-
}
14+
/**
15+
* importDropletFromZip
16+
* @param string $sZipPath - full path to your droplets zip-file e.g. __DIR__.'/droplets/droplets.zip'
17+
* @param string $sTempDir - optional; full path to temporary unzip folder e.g. !must be writeable
18+
*/
19+
function importDropletFromZip($sZipPath, $sTempDir = '', $bDeleteTemp = true)
20+
{
21+
$errors = array();
22+
$count = 0;
23+
$aReturn = array();
24+
25+
$sTempDir = $sTempDir != '' ? $sTempDir : WB_PATH . '/temp/droplets/';
26+
if (!file_exists($sTempDir))
27+
mkdir($sTempDir, 0777, true);
28+
29+
$oZip = new ZipArchive;
30+
if ($oZip->open($sZipPath) === TRUE) {
31+
$oZip->extractTo($sTempDir);
32+
$oZip->close();
4733
}
48-
}
49-
closedir($dh);
34+
35+
// now, open the temp directory
36+
if (false !== ($dh = opendir($sTempDir))) {
37+
while (false !== ($sFile = readdir($dh))) {
38+
// read trough all the files in temp directory
39+
if ($sFile != "." && $sFile != "..") {
40+
$feedback = importDropletFromFile($sFile, $sTempDir); // use import droplet function
41+
$imports[$feedback['imported']] = $feedback['imported'];
42+
if (isset($feedback['error'])) {
43+
$errors[$feedback['imported']] = $feedback['error'];
44+
} else {
45+
$count++;
46+
}
47+
}
48+
}
49+
closedir($dh);
50+
}
51+
if (!isset($imports)) {
52+
$imports = array();
53+
}
54+
if ($bDeleteTemp == true) {
55+
rm_full_dir($sTempDir); // wb internal function
56+
}
57+
return array(
58+
'count' => $count,
59+
'errors' => $errors,
60+
'imported' => $imports
61+
);
5062
}
51-
if (!isset($imports)){
52-
$imports = array();
53-
}
54-
if($bDeleteTemp == true){
55-
rm_full_dir($sTempDir); // wb internal function
56-
}
57-
return array(
58-
'count' => $count,
59-
'errors' => $errors,
60-
'imported' => $imports
61-
);
62-
}
6363
}
6464

65-
if (!function_exists('importDropletFromFile')) {
66-
/**
67-
* importDropletFromFile
68-
* @param string $sZipPath - full path to your droplets zip-file e.g. __DIR__.'/droplets/droplets.zip'
69-
* @param string $sTempDir - optional; full path to temporary unzip folder e.g. !must be writeable
70-
*/
71-
function importDropletFromFile($sFilename = '', $sDirPath = '')
72-
{
73-
global $database, $admin;
74-
$description = '';
75-
$usage = '';
76-
$code = '';
77-
if($sDirPath == '' && is_readable($sFilename)){
78-
$sDirPath = dirname($sFilename);
79-
$sFilename = basename($sFilename);
80-
}
81-
$aReturn = array();
82-
if (preg_match('/^(.*)\.php$/i', $sFilename, $name_match)) {
83-
// Name of the Droplet = Filename
84-
$name = $name_match[1];
85-
// Slurp file contents
86-
87-
$aLines = file($sDirPath . '/' . $sFilename);
88-
if(strpos($aLines[0], '<?php') !== false){
89-
array_shift($aLines);
90-
}
91-
// First line: Description
92-
if (preg_match('#^//\:(.*)$#', $aLines[0], $match)) {
93-
$description = $match[1];
94-
}
95-
// Second line: Usage instructions
96-
if (preg_match('#^//\:(.*)$#', $aLines[1], $match)) {
97-
$aBreaks = array("<br />", "<br/>", "<br>");
98-
$match[1] = str_ireplace($aBreaks, "\r\n", $match[1]);
99-
$usage = addslashes($match[1]);
100-
}
101-
// Remaining: Droplet code
102-
$code = implode('', array_slice($aLines, 2));
103-
// replace 'evil' chars in code
104-
$tags = array(
105-
'<?php',
106-
'?>',
107-
'<?'
108-
);
109-
$code = addslashes(str_replace($tags, '', $code));
110-
// Already in the DB?
111-
$stmt = 'INSERT';
112-
$id = NULL;
113-
$found = $database->get_one("SELECT * FROM `".TABLE_PREFIX."mod_droplets` WHERE name='$name'");
114-
if ($found && $found > 0) {
115-
$stmt = 'REPLACE';
116-
$id = $found;
117-
}
118-
// execute
119-
$result = $database->query("$stmt INTO `".TABLE_PREFIX."mod_droplets` VALUES(
120-
'$id', '$name', '$code', '$description', '".time()."', '" . $admin->get_user_id() . "', 1, 0, 0, 0, '$usage'
65+
if (!function_exists('importDropletFromFile')) {
66+
/**
67+
* importDropletFromFile
68+
* @param string $sZipPath - full path to your droplets zip-file e.g. __DIR__.'/droplets/droplets.zip'
69+
* @param string $sTempDir - optional; full path to temporary unzip folder e.g. !must be writeable
70+
*/
71+
function importDropletFromFile($sFilename = '', $sDirPath = '')
72+
{
73+
global $database, $admin;
74+
$description = '';
75+
$usage = '';
76+
$code = '';
77+
if ($sDirPath == '' && is_readable($sFilename)) {
78+
$sDirPath = dirname($sFilename);
79+
$sFilename = basename($sFilename);
80+
}
81+
$aReturn = array();
82+
if (preg_match('/^(.*)\.php$/i', $sFilename, $name_match)) {
83+
// Name of the Droplet = Filename
84+
$name = $name_match[1];
85+
// Slurp file contents
86+
87+
$aLines = file($sDirPath . '/' . $sFilename);
88+
if (strpos($aLines[0], '<?php') !== false) {
89+
array_shift($aLines);
90+
}
91+
// First line: Description
92+
if (preg_match('#^//\:(.*)$#', $aLines[0], $match)) {
93+
$description = $match[1];
94+
}
95+
// Second line: Usage instructions
96+
if (preg_match('#^//\:(.*)$#', $aLines[1], $match)) {
97+
$aBreaks = array(
98+
"<br />",
99+
"<br/>",
100+
"<br>"
101+
);
102+
$match[1] = str_ireplace($aBreaks, "\r\n", $match[1]);
103+
$usage = addslashes($match[1]);
104+
}
105+
// Remaining: Droplet code
106+
$code = implode('', array_slice($aLines, 2));
107+
// replace 'evil' chars in code
108+
$tags = array(
109+
'<?php',
110+
'?>',
111+
'<?'
112+
);
113+
$code = addslashes(str_replace($tags, '', $code));
114+
// Already in the DB?
115+
$stmt = 'INSERT';
116+
$id = NULL;
117+
$found = $database->get_one("SELECT * FROM `" . TABLE_PREFIX . "mod_droplets` WHERE name='$name'");
118+
if ($found && $found > 0) {
119+
$stmt = 'REPLACE';
120+
$id = $found;
121+
}
122+
// execute
123+
$result = $database->query("$stmt INTO `" . TABLE_PREFIX . "mod_droplets` VALUES(
124+
'$id', '$name', '$code', '$description', '" . time() . "', '" . $admin->get_user_id() . "', 1, 0, 0, 0, '$usage'
121125
)");
122-
$aReturn['imported'] = $name;
123-
if ($database->is_error()) {
124-
$aReturn['error'] = $database->get_error();
125-
}
126-
}
127-
return $aReturn;
128-
}
126+
$aReturn['imported'] = $name;
127+
if ($database->is_error()) {
128+
$aReturn['error'] = $database->get_error();
129+
}
130+
}
131+
return $aReturn;
132+
}
129133
}
130-
131-
132-
if(!function_exists('isDroplet')){
133-
/**
134-
* simple check if Droplet is already installed
135-
* isDroplet
136-
* @param string Droplet Name
137-
*/
138-
function isDroplet($sDropletName){
139-
$tmp = $GLOBALS['database']->get_one(
140-
"SELECT `id` FROM `".TABLE_PREFIX."mod_droplets`
141-
WHERE `name` = '".$sDropletName."'"
142-
);
143-
return (is_numeric($tmp)) ? intval($tmp) : false;
144-
}
134+
135+
136+
if (!function_exists('isDroplet')) {
137+
/**
138+
* simple check if Droplet is already installed
139+
* isDroplet
140+
* @param string Droplet Name
141+
*/
142+
function isDroplet($sDropletName)
143+
{
144+
$tmp = $GLOBALS['database']->get_one("SELECT `id` FROM `" . TABLE_PREFIX . "mod_droplets`
145+
WHERE `name` = '" . $sDropletName . "'");
146+
return (is_numeric($tmp)) ? intval($tmp) : false;
147+
}
145148
}

functions/expimp_droplet_xml.functions.php

Whitespace-only changes.

functions/global_strings.functions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ function updateStringContents($aContents, $iID){
7474
global $database, $admin;
7575
$aMsg = array();
7676
$aData = array(
77-
'edit_when' => time(),
78-
'edit_by' => $admin->get_user_id(),
79-
'restricted' => $aContents['restricted']
77+
'edit_when' => time(),
78+
'edit_by' => $admin->get_user_id(),
79+
'restricted' => $aContents['restricted']
8080
);
8181
updateRecordFromArray($aData, STRINGS_FIELDS_TBL, 'id', intval($iID));
8282
$sSql = "UPDATE `".STRINGS_CONTENTS_TBL."`
83-
SET `content` = '%s' WHERE `unique_id` = '%d'";
83+
SET `content` = '%s' WHERE `unique_id` = '%d'";
8484
foreach($aContents as $unique_id=>$content){
8585
$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
8686
if(ini_get('magic_quotes_gpc')==true){
@@ -133,7 +133,7 @@ function addNewStringEntity($field_name, $field_type){
133133
}
134134
} else {
135135
// hier noch distinction, ob der einfach in verwendung ist,
136-
// ob er gelöscht ist oder reserviert vom system (wenn z.B. use_restrictions ON ist)
136+
// ob er gel�scht ist oder reserviert vom system (wenn z.B. use_restrictions ON ist)
137137
$aMsg['error'] = '{TOOL_TEXT:FIELD_NAME_IN_USE}';
138138
}
139139
return $aMsg;

0 commit comments

Comments
 (0)