Skip to content

Commit c5c02b0

Browse files
author
Ahmad Gneady
committed
As generated by AppGini 5.93
1 parent 20c1fcc commit c5c02b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1515
-1465
lines changed

app/admin/getUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
// This script and data application were generated by AppGini 5.92
2+
// This script and data application were generated by AppGini 5.93
33
// Download AppGini for free from https://bigprof.com/appgini/download/
44

55
/*

app/admin/incCommon.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
error_reporting(E_ERROR | E_WARNING | E_PARSE);
2+
error_reporting(E_ERROR /*| E_WARNING*/ | E_PARSE);
33

44
// incCommon.php is included only in the admin area, so if this flag is defined, this indicates we're in admin area
55
define('ADMIN_AREA', true);

app/admin/incFunctions.php

Lines changed: 74 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -148,109 +148,109 @@ function getThumbnailSpecs($tableName, $fieldName, $view) {
148148
}
149149
########################################################################
150150
function createThumbnail($img, $specs) {
151-
$w=$specs['width'];
152-
$h=$specs['height'];
153-
$id=$specs['identifier'];
154-
$path=dirname($img);
151+
$w = $specs['width'];
152+
$h = $specs['height'];
153+
$id = $specs['identifier'];
154+
$path = dirname($img);
155155

156156
// image doesn't exist or inaccessible?
157-
if(!$size=@getimagesize($img)) return FALSE;
157+
if(!$size = @getimagesize($img)) return false;
158158

159159
// calculate thumbnail size to maintain aspect ratio
160-
$ow=$size[0]; // original image width
161-
$oh=$size[1]; // original image height
162-
$twbh=$h/$oh*$ow; // calculated thumbnail width based on given height
163-
$thbw=$w/$ow*$oh; // calculated thumbnail height based on given width
160+
$ow = $size[0]; // original image width
161+
$oh = $size[1]; // original image height
162+
$twbh = $h / $oh * $ow; // calculated thumbnail width based on given height
163+
$thbw = $w / $ow * $oh; // calculated thumbnail height based on given width
164164
if($w && $h) {
165-
if($twbh>$w) $h=$thbw;
166-
if($thbw>$h) $w=$twbh;
165+
if($twbh > $w) $h = $thbw;
166+
if($thbw > $h) $w = $twbh;
167167
} elseif($w) {
168-
$h=$thbw;
168+
$h = $thbw;
169169
} elseif($h) {
170-
$w=$twbh;
170+
$w = $twbh;
171171
} else {
172-
return FALSE;
172+
return false;
173173
}
174174

175175
// dir not writeable?
176-
if(!is_writable($path)) return FALSE;
176+
if(!is_writable($path)) return false;
177177

178178
// GD lib not loaded?
179-
if(!function_exists('gd_info')) return FALSE;
180-
$gd=gd_info();
179+
if(!function_exists('gd_info')) return false;
180+
$gd = gd_info();
181181

182182
// GD lib older than 2.0?
183183
preg_match('/\d/', $gd['GD Version'], $gdm);
184-
if($gdm[0]<2) return FALSE;
184+
if($gdm[0] < 2) return false;
185185

186186
// get file extension
187187
preg_match('/\.[a-zA-Z]{3,4}$/U', $img, $matches);
188-
$ext=strtolower($matches[0]);
188+
$ext = strtolower($matches[0]);
189189

190190
// check if supplied image is supported and specify actions based on file type
191-
if($ext=='.gif') {
192-
if(!$gd['GIF Create Support']) return FALSE;
193-
$thumbFunc='imagegif';
194-
} elseif($ext=='.png') {
195-
if(!$gd['PNG Support']) return FALSE;
196-
$thumbFunc='imagepng';
197-
} elseif($ext=='.jpg' || $ext=='.jpe' || $ext=='.jpeg') {
198-
if(!$gd['JPG Support'] && !$gd['JPEG Support']) return FALSE;
199-
$thumbFunc='imagejpeg';
191+
if($ext == '.gif') {
192+
if(!$gd['GIF Create Support']) return false;
193+
$thumbFunc = 'imagegif';
194+
} elseif($ext == '.png') {
195+
if(!$gd['PNG Support']) return false;
196+
$thumbFunc = 'imagepng';
197+
} elseif($ext == '.jpg' || $ext == '.jpe' || $ext == '.jpeg') {
198+
if(!$gd['JPG Support'] && !$gd['JPEG Support']) return false;
199+
$thumbFunc = 'imagejpeg';
200200
} else {
201-
return FALSE;
201+
return false;
202202
}
203203

204204
// determine thumbnail file name
205-
$ext=$matches[0];
206-
$thumb=substr($img, 0, -5).str_replace($ext, $id.$ext, substr($img, -5));
205+
$ext = $matches[0];
206+
$thumb = substr($img, 0, -5) . str_replace($ext, $id . $ext, substr($img, -5));
207207

208208
// if the original image smaller than thumb, then just copy it to thumb
209-
if($h>$oh && $w>$ow) {
210-
return (@copy($img, $thumb) ? TRUE : FALSE);
209+
if($h > $oh && $w > $ow) {
210+
return (@copy($img, $thumb) ? true : false);
211211
}
212212

213213
// get image data
214-
if(!$imgData=imagecreatefromstring(implode('', file($img)))) return FALSE;
214+
if(!$imgData = imagecreatefromstring(implode('', file($img)))) return false;
215215

216216
// finally, create thumbnail
217-
$thumbData=imagecreatetruecolor($w, $h);
217+
$thumbData = imagecreatetruecolor($w, $h);
218218

219219
//preserve transparency of png and gif images
220-
if($thumbFunc=='imagepng') {
221-
if(($clr=@imagecolorallocate($thumbData, 0, 0, 0))!=-1) {
220+
if($thumbFunc == 'imagepng') {
221+
if(($clr = @imagecolorallocate($thumbData, 0, 0, 0)) != -1) {
222222
@imagecolortransparent($thumbData, $clr);
223223
@imagealphablending($thumbData, false);
224224
@imagesavealpha($thumbData, true);
225225
}
226-
} elseif($thumbFunc=='imagegif') {
226+
} elseif($thumbFunc == 'imagegif') {
227227
@imagealphablending($thumbData, false);
228-
$transIndex=imagecolortransparent($imgData);
229-
if($transIndex>=0) {
230-
$transClr=imagecolorsforindex($imgData, $transIndex);
231-
$transIndex=imagecolorallocatealpha($thumbData, $transClr['red'], $transClr['green'], $transClr['blue'], 127);
228+
$transIndex = imagecolortransparent($imgData);
229+
if($transIndex >= 0) {
230+
$transClr = imagecolorsforindex($imgData, $transIndex);
231+
$transIndex = imagecolorallocatealpha($thumbData, $transClr['red'], $transClr['green'], $transClr['blue'], 127);
232232
imagefill($thumbData, 0, 0, $transIndex);
233233
}
234234
}
235235

236236
// resize original image into thumbnail
237-
if(!imagecopyresampled($thumbData, $imgData, 0, 0 , 0, 0, $w, $h, $ow, $oh)) return FALSE;
237+
if(!imagecopyresampled($thumbData, $imgData, 0, 0 , 0, 0, $w, $h, $ow, $oh)) return false;
238238
unset($imgData);
239239

240240
// gif transparency
241-
if($thumbFunc=='imagegif' && $transIndex>=0) {
241+
if($thumbFunc == 'imagegif' && $transIndex >= 0) {
242242
imagecolortransparent($thumbData, $transIndex);
243-
for($y=0; $y<$h; ++$y)
244-
for($x=0; $x<$w; ++$x)
245-
if(((imagecolorat($thumbData, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($thumbData, $x, $y, $transIndex);
243+
for($y = 0; $y < $h; ++$y)
244+
for($x = 0; $x < $w; ++$x)
245+
if(((imagecolorat($thumbData, $x, $y) >> 24) & 0x7F) >= 100) imagesetpixel($thumbData, $x, $y, $transIndex);
246246
imagetruecolortopalette($thumbData, true, 255);
247247
imagesavealpha($thumbData, false);
248248
}
249249

250-
if(!$thumbFunc($thumbData, $thumb)) return FALSE;
250+
if(!$thumbFunc($thumbData, $thumb)) return false;
251251
unset($thumbData);
252252

253-
return TRUE;
253+
return true;
254254
}
255255
########################################################################
256256
function makeSafe($string, $is_gpc = true) {
@@ -304,7 +304,7 @@ function sql($statment, &$o) {
304304
if(!$connected) {
305305
/****** Connect to MySQL ******/
306306
if(!extension_loaded('mysql') && !extension_loaded('mysqli')) {
307-
$o['error'] = 'PHP is not configured to connect to MySQL on this machine. Please see <a href="http://www.php.net/manual/en/ref.mysql.php">this page</a> for help on how to configure MySQL.';
307+
$o['error'] = 'PHP is not configured to connect to MySQL on this machine. Please see <a href="https://www.php.net/manual/en/ref.mysql.php">this page</a> for help on how to configure MySQL.';
308308
if($o['silentErrors']) return false;
309309

310310
@include_once($header);
@@ -730,11 +730,7 @@ function bootstrapSQLSelect($name, $sql, $selectedValue, $class = '', $selectedC
730730
}
731731
########################################################################
732732
function isEmail($email) {
733-
if(preg_match('/^([*+!.&#$¦\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,45})$/i', $email)) {
734-
return $email;
735-
}
736-
737-
return false;
733+
return filter_var(trim($email), FILTER_VALIDATE_EMAIL);
738734
}
739735
########################################################################
740736
function notifyMemberApproval($memberID) {
@@ -1112,7 +1108,7 @@ function getUploadedFile($FieldName, $MaxSize=0, $FileTypes='csv|txt', $NoRename
11121108
########################################################################
11131109
function toBytes($val) {
11141110
$val = trim($val);
1115-
$last = strtolower($val{strlen($val)-1});
1111+
$last = strtolower($val[strlen($val)-1]);
11161112
switch($last) {
11171113
// The 'G' modifier is available since PHP 5.1.0
11181114
case 'g':
@@ -1129,7 +1125,7 @@ function toBytes($val) {
11291125
function convertLegacyOptions($CSVList) {
11301126
$CSVList=str_replace(';;;', ';||', $CSVList);
11311127
$CSVList=str_replace(';;', '||', $CSVList);
1132-
return $CSVList;
1128+
return trim($CSVList, '|');
11331129
}
11341130
########################################################################
11351131
function getValueGivenCaption($query, $caption) {
@@ -1394,7 +1390,7 @@ public static function placeholder() {
13941390

13951391
/* dismiss after x seconds if requested */
13961392
if(options.dismiss_seconds > 0) {
1397-
setTimeout(function() { /* */ this_notif.addClass('invisible'); }, options.dismiss_seconds * 1000);
1393+
setTimeout(function() { this_notif.addClass('invisible'); }, options.dismiss_seconds * 1000);
13981394
}
13991395

14001396
/* dismiss for x days if requested and user dismisses it */
@@ -1510,8 +1506,7 @@ function safe_html($str) {
15101506
/* if $str has no HTML tags, apply nl2br */
15111507
if($str == strip_tags($str)) return nl2br($str);
15121508

1513-
$hc = new CI_Input();
1514-
$hc->charset = datalist_db_encoding;
1509+
$hc = new CI_Input(datalist_db_encoding);
15151510

15161511
return $hc->xss_clean($str);
15171512
}
@@ -2091,7 +2086,6 @@ function guessMySQLDateTime($dt) {
20912086

20922087
return trim("$date $time");
20932088
}
2094-
20952089
#########################################################
20962090
function lookupQuery($tn, $lookupField) {
20972091
/*
@@ -2179,3 +2173,22 @@ function userCanImport() {
21792173
return false;
21802174
}
21812175
#########################################################
2176+
function parseTemplate($template) {
2177+
if(trim($template) == '') return $template;
2178+
2179+
global $Translation;
2180+
foreach($Translation as $symbol => $trans)
2181+
$template = str_replace("<%%TRANSLATION($symbol)%%>", $trans, $template);
2182+
2183+
// Correct <MaxSize> and <FileTypes> to prevent invalid HTML
2184+
$template = str_replace(['<MaxSize>', '<FileTypes>'], ['{MaxSize}', '{FileTypes}'], $template);
2185+
$template = str_replace('<%%BASE_UPLOAD_PATH%%>', getUploadDir(''), $template);
2186+
2187+
return $template;
2188+
}
2189+
#########################################################
2190+
function getUploadDir($dir) {
2191+
if($dir == '') $dir = config('adminConfig')['baseUploadPath'];
2192+
2193+
return rtrim($dir, '\\/') . '/';
2194+
}

app/admin/incHeader.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<link id="browser_favicon" rel="shortcut icon" href="<?php echo PREPEND_PATH; ?>resources/table_icons/administrator.png">
1515

1616
<link rel="stylesheet" href="<?php echo PREPEND_PATH; ?>resources/initializr/css/cosmo.css">
17-
<link rel="stylesheet" href="<?php echo PREPEND_PATH; ?>dynamic.css.php">
17+
<link rel="stylesheet" href="<?php echo PREPEND_PATH; ?>dynamic.css">
1818

1919
<!--[if lt IE 9]>
2020
<script src="<?php echo PREPEND_PATH; ?>resources/initializr/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
@@ -40,7 +40,7 @@ function jsValidateEmail(address) {
4040
}
4141

4242
function jsShowWait() {
43-
return window.confirm("<?php echo $Translation['sending mails']; ?>");
43+
return window.confirm('<?php echo addslashes($Translation['sending mails']); ?>');
4444
}
4545

4646
function jsValidateAdminSettings() {
@@ -69,38 +69,36 @@ function jsConfirmTransfer() {
6969
var mm=document.getElementById('moveMembers').checked;
7070
}
7171

72-
//confirm('sg='+sg+'\n'+'sm='+sm+'\n'+'dg='+dg+'\n'+'dm='+dm+'\n'+'mm='+mm+'\n'+'dmm='+dmm+'\n');
73-
7472
if(dmm && !dm) {
75-
modal_window({ message: '<div>'+"<?php echo $Translation['complete step 4']; ?>"+'</div>', title: "<?php echo $Translation['info']; ?>", close: function() { /* */ jQuery('#destinationMemberID').focus(); } });
73+
modal_window({ message: '<div>'+"<?php echo $Translation['complete step 4']; ?>"+'</div>', title: "<?php echo $Translation['info']; ?>", close: function() { jQuery('#destinationMemberID').focus(); } });
7674
return false;
7775
}
7876

7977
if(mm && sm!='-1') {
8078

81-
confirmMessage = "<?php echo $Translation['sure move member']; ?>";
79+
confirmMessage = '<?php echo addslashes($Translation['sure move member']); ?>';
8280
confirmMessage = confirmMessage.replace(/<MEMBER>/, sm).replace(/<OLDGROUP>/, sg).replace(/<NEWGROUP>/, dg);
8381
return window.confirm(confirmMessage);
8482

8583
}
8684
if((dmm || dm) && sm!='-1') {
8785

88-
confirmMessage = "<?php echo $Translation['sure move data of member']; ?>";
86+
confirmMessage = '<?php echo addslashes($Translation['sure move data of member']); ?>';
8987
confirmMessage = confirmMessage.replace(/<OLDMEMBER>/, sm).replace(/<OLDGROUP>/, sg).replace(/<NEWMEMBER>/, dm).replace(/<NEWGROUP>/, dg);
9088
return window.confirm(confirmMessage);
9189
}
9290

9391
if(mm) {
9492

95-
confirmMessage = "<?php echo $Translation['sure move all members']; ?>";
93+
confirmMessage = '<?php echo addslashes($Translation['sure move all members']); ?>';
9694
confirmMessage = confirmMessage.replace(/<OLDGROUP>/, sg).replace(/<NEWGROUP>/, dg);
9795
return window.confirm(confirmMessage);
9896
}
9997

10098
if(dmm) {
10199

102100

103-
confirmMessage = "<?php echo $Translation['sure move data of all members']; ?>";
101+
confirmMessage = '<?php echo addslashes($Translation['sure move data of all members']); ?>';
104102
confirmMessage = confirmMessage.replace(/<OLDGROUP>/, sg).replace(/<MEMBER>/, dm).replace(/<NEWGROUP>/, dg);
105103
return window.confirm(confirmMessage);
106104
}
@@ -202,7 +200,6 @@ function hideDialogs() {
202200
<ul class="dropdown-menu">
203201
<li><a href="pageSettings.php"><i class="glyphicon menu-item-icon text-info glyphicon-cog"></i> <?php echo $Translation['admin settings']; ?></a></li>
204202
<li class="divider"></li>
205-
<li><a href="pageRebuildThumbnails.php"><i class="glyphicon menu-item-icon text-info glyphicon-picture"></i> <?php echo $Translation['rebuild thumbnails']; ?></a></li>
206203
<li><a href="pageRebuildFields.php"><i class="glyphicon menu-item-icon text-info glyphicon-refresh"></i> <?php echo $Translation['view or rebuild fields']; ?></a></li>
207204
<li><a href="pageUploadCSV.php"><i class="glyphicon menu-item-icon text-info glyphicon-upload"></i> <?php echo $Translation['import CSV']; ?></a></li>
208205
<li><a href="pageTransferOwnership.php"><i class="glyphicon menu-item-icon text-info glyphicon-random"></i> <?php echo $Translation['batch transfer']; ?></a></li>
@@ -225,7 +222,7 @@ function hideDialogs() {
225222
<?php
226223
$plugin_icon = '';
227224
if($plugin['glyphicon']) $plugin_icon = "<i class=\"glyphicon glyphicon-{$plugin['glyphicon']}\"></i> ";
228-
if($plugin['icon']) $plugin_icon = "<img src=\"{$plugin['admin_path']}/{$plugin['icon']}\"> ";
225+
if($plugin['icon']) $plugin_icon = "<img class=\"rspacer-md\" src=\"{$plugin['admin_path']}/{$plugin['icon']}\"> ";
229226
?>
230227
<li><a target="_blank" href="<?php echo $plugin['admin_path']; ?>"><?php echo $plugin_icon . $plugin['title']; ?></a></li>
231228
<?php } ?>

app/admin/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
error_reporting(E_ERROR | E_WARNING | E_PARSE);
2+
error_reporting(E_ERROR /*| E_WARNING*/ | E_PARSE);
33
$host = $_SERVER['HTTP_HOST'];
44
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
55
$http = (strtolower($_SERVER['HTTPS']) == 'on' ? 'https:' : 'http:');

0 commit comments

Comments
 (0)