Skip to content

Commit

Permalink
As generated by AppGini 5.93
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Gneady committed Jan 19, 2021
1 parent e23c010 commit c52d1b3
Show file tree
Hide file tree
Showing 120 changed files with 1,922 additions and 1,869 deletions.
2 changes: 1 addition & 1 deletion app/admin/getUsers.php
@@ -1,5 +1,5 @@
<?php
// This script and data application were generated by AppGini 5.92
// This script and data application were generated by AppGini 5.93
// Download AppGini for free from https://bigprof.com/appgini/download/

/*
Expand Down
2 changes: 1 addition & 1 deletion app/admin/incCommon.php
@@ -1,5 +1,5 @@
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
error_reporting(E_ERROR /*| E_WARNING*/ | E_PARSE);

// incCommon.php is included only in the admin area, so if this flag is defined, this indicates we're in admin area
define('ADMIN_AREA', true);
Expand Down
135 changes: 74 additions & 61 deletions app/admin/incFunctions.php
Expand Up @@ -221,109 +221,109 @@ function getThumbnailSpecs($tableName, $fieldName, $view) {
}
########################################################################
function createThumbnail($img, $specs) {
$w=$specs['width'];
$h=$specs['height'];
$id=$specs['identifier'];
$path=dirname($img);
$w = $specs['width'];
$h = $specs['height'];
$id = $specs['identifier'];
$path = dirname($img);

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

// calculate thumbnail size to maintain aspect ratio
$ow=$size[0]; // original image width
$oh=$size[1]; // original image height
$twbh=$h/$oh*$ow; // calculated thumbnail width based on given height
$thbw=$w/$ow*$oh; // calculated thumbnail height based on given width
$ow = $size[0]; // original image width
$oh = $size[1]; // original image height
$twbh = $h / $oh * $ow; // calculated thumbnail width based on given height
$thbw = $w / $ow * $oh; // calculated thumbnail height based on given width
if($w && $h) {
if($twbh>$w) $h=$thbw;
if($thbw>$h) $w=$twbh;
if($twbh > $w) $h = $thbw;
if($thbw > $h) $w = $twbh;
} elseif($w) {
$h=$thbw;
$h = $thbw;
} elseif($h) {
$w=$twbh;
$w = $twbh;
} else {
return FALSE;
return false;
}

// dir not writeable?
if(!is_writable($path)) return FALSE;
if(!is_writable($path)) return false;

// GD lib not loaded?
if(!function_exists('gd_info')) return FALSE;
$gd=gd_info();
if(!function_exists('gd_info')) return false;
$gd = gd_info();

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

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

// check if supplied image is supported and specify actions based on file type
if($ext=='.gif') {
if(!$gd['GIF Create Support']) return FALSE;
$thumbFunc='imagegif';
} elseif($ext=='.png') {
if(!$gd['PNG Support']) return FALSE;
$thumbFunc='imagepng';
} elseif($ext=='.jpg' || $ext=='.jpe' || $ext=='.jpeg') {
if(!$gd['JPG Support'] && !$gd['JPEG Support']) return FALSE;
$thumbFunc='imagejpeg';
if($ext == '.gif') {
if(!$gd['GIF Create Support']) return false;
$thumbFunc = 'imagegif';
} elseif($ext == '.png') {
if(!$gd['PNG Support']) return false;
$thumbFunc = 'imagepng';
} elseif($ext == '.jpg' || $ext == '.jpe' || $ext == '.jpeg') {
if(!$gd['JPG Support'] && !$gd['JPEG Support']) return false;
$thumbFunc = 'imagejpeg';
} else {
return FALSE;
return false;
}

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

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

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

// finally, create thumbnail
$thumbData=imagecreatetruecolor($w, $h);
$thumbData = imagecreatetruecolor($w, $h);

//preserve transparency of png and gif images
if($thumbFunc=='imagepng') {
if(($clr=@imagecolorallocate($thumbData, 0, 0, 0))!=-1) {
if($thumbFunc == 'imagepng') {
if(($clr = @imagecolorallocate($thumbData, 0, 0, 0)) != -1) {
@imagecolortransparent($thumbData, $clr);
@imagealphablending($thumbData, false);
@imagesavealpha($thumbData, true);
}
} elseif($thumbFunc=='imagegif') {
} elseif($thumbFunc == 'imagegif') {
@imagealphablending($thumbData, false);
$transIndex=imagecolortransparent($imgData);
if($transIndex>=0) {
$transClr=imagecolorsforindex($imgData, $transIndex);
$transIndex=imagecolorallocatealpha($thumbData, $transClr['red'], $transClr['green'], $transClr['blue'], 127);
$transIndex = imagecolortransparent($imgData);
if($transIndex >= 0) {
$transClr = imagecolorsforindex($imgData, $transIndex);
$transIndex = imagecolorallocatealpha($thumbData, $transClr['red'], $transClr['green'], $transClr['blue'], 127);
imagefill($thumbData, 0, 0, $transIndex);
}
}

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

// gif transparency
if($thumbFunc=='imagegif' && $transIndex>=0) {
if($thumbFunc == 'imagegif' && $transIndex >= 0) {
imagecolortransparent($thumbData, $transIndex);
for($y=0; $y<$h; ++$y)
for($x=0; $x<$w; ++$x)
if(((imagecolorat($thumbData, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($thumbData, $x, $y, $transIndex);
for($y = 0; $y < $h; ++$y)
for($x = 0; $x < $w; ++$x)
if(((imagecolorat($thumbData, $x, $y) >> 24) & 0x7F) >= 100) imagesetpixel($thumbData, $x, $y, $transIndex);
imagetruecolortopalette($thumbData, true, 255);
imagesavealpha($thumbData, false);
}

if(!$thumbFunc($thumbData, $thumb)) return FALSE;
if(!$thumbFunc($thumbData, $thumb)) return false;
unset($thumbData);

return TRUE;
return true;
}
########################################################################
function makeSafe($string, $is_gpc = true) {
Expand Down Expand Up @@ -377,7 +377,7 @@ function sql($statment, &$o) {
if(!$connected) {
/****** Connect to MySQL ******/
if(!extension_loaded('mysql') && !extension_loaded('mysqli')) {
$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.';
$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.';
if($o['silentErrors']) return false;

@include_once($header);
Expand Down Expand Up @@ -803,11 +803,7 @@ function bootstrapSQLSelect($name, $sql, $selectedValue, $class = '', $selectedC
}
########################################################################
function isEmail($email) {
if(preg_match('/^([*+!.&#$¦\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,45})$/i', $email)) {
return $email;
}

return false;
return filter_var(trim($email), FILTER_VALIDATE_EMAIL);
}
########################################################################
function notifyMemberApproval($memberID) {
Expand Down Expand Up @@ -1294,7 +1290,7 @@ function getUploadedFile($FieldName, $MaxSize=0, $FileTypes='csv|txt', $NoRename
########################################################################
function toBytes($val) {
$val = trim($val);
$last = strtolower($val{strlen($val)-1});
$last = strtolower($val[strlen($val)-1]);
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
Expand All @@ -1311,7 +1307,7 @@ function toBytes($val) {
function convertLegacyOptions($CSVList) {
$CSVList=str_replace(';;;', ';||', $CSVList);
$CSVList=str_replace(';;', '||', $CSVList);
return $CSVList;
return trim($CSVList, '|');
}
########################################################################
function getValueGivenCaption($query, $caption) {
Expand Down Expand Up @@ -1576,7 +1572,7 @@ public static function placeholder() {

/* dismiss after x seconds if requested */
if(options.dismiss_seconds > 0) {
setTimeout(function() { /* */ this_notif.addClass('invisible'); }, options.dismiss_seconds * 1000);
setTimeout(function() { this_notif.addClass('invisible'); }, options.dismiss_seconds * 1000);
}

/* dismiss for x days if requested and user dismisses it */
Expand Down Expand Up @@ -1692,8 +1688,7 @@ function safe_html($str) {
/* if $str has no HTML tags, apply nl2br */
if($str == strip_tags($str)) return nl2br($str);

$hc = new CI_Input();
$hc->charset = datalist_db_encoding;
$hc = new CI_Input(datalist_db_encoding);

return $hc->xss_clean($str);
}
Expand Down Expand Up @@ -2309,7 +2304,6 @@ function guessMySQLDateTime($dt) {

return trim("$date $time");
}

#########################################################
function lookupQuery($tn, $lookupField) {
/*
Expand Down Expand Up @@ -2423,3 +2417,22 @@ function userCanImport() {
return false;
}
#########################################################
function parseTemplate($template) {
if(trim($template) == '') return $template;

global $Translation;
foreach($Translation as $symbol => $trans)
$template = str_replace("<%%TRANSLATION($symbol)%%>", $trans, $template);

// Correct <MaxSize> and <FileTypes> to prevent invalid HTML
$template = str_replace(['<MaxSize>', '<FileTypes>'], ['{MaxSize}', '{FileTypes}'], $template);
$template = str_replace('<%%BASE_UPLOAD_PATH%%>', getUploadDir(''), $template);

return $template;
}
#########################################################
function getUploadDir($dir) {
if($dir == '') $dir = config('adminConfig')['baseUploadPath'];

return rtrim($dir, '\\/') . '/';
}
18 changes: 8 additions & 10 deletions app/admin/incHeader.php
Expand Up @@ -17,7 +17,7 @@
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="<?php echo PREPEND_PATH; ?>resources/initializr/css/bootstrap-theme.css">
<!--<![endif]-->
<link rel="stylesheet" href="<?php echo PREPEND_PATH; ?>dynamic.css.php">
<link rel="stylesheet" href="<?php echo PREPEND_PATH; ?>dynamic.css">

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

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

function jsValidateAdminSettings() {
Expand Down Expand Up @@ -72,38 +72,36 @@ function jsConfirmTransfer() {
var mm=document.getElementById('moveMembers').checked;
}

//confirm('sg='+sg+'\n'+'sm='+sm+'\n'+'dg='+dg+'\n'+'dm='+dm+'\n'+'mm='+mm+'\n'+'dmm='+dmm+'\n');

if(dmm && !dm) {
modal_window({ message: '<div>'+"<?php echo $Translation['complete step 4']; ?>"+'</div>', title: "<?php echo $Translation['info']; ?>", close: function() { /* */ jQuery('#destinationMemberID').focus(); } });
modal_window({ message: '<div>'+"<?php echo $Translation['complete step 4']; ?>"+'</div>', title: "<?php echo $Translation['info']; ?>", close: function() { jQuery('#destinationMemberID').focus(); } });
return false;
}

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

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

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

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

if(mm) {

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

if(dmm) {


confirmMessage = "<?php echo $Translation['sure move data of all members']; ?>";
confirmMessage = '<?php echo addslashes($Translation['sure move data of all members']); ?>';
confirmMessage = confirmMessage.replace(/<OLDGROUP>/, sg).replace(/<MEMBER>/, dm).replace(/<NEWGROUP>/, dg);
return window.confirm(confirmMessage);
}
Expand Down Expand Up @@ -228,7 +226,7 @@ function hideDialogs() {
<?php
$plugin_icon = '';
if($plugin['glyphicon']) $plugin_icon = "<i class=\"glyphicon glyphicon-{$plugin['glyphicon']}\"></i> ";
if($plugin['icon']) $plugin_icon = "<img src=\"{$plugin['admin_path']}/{$plugin['icon']}\"> ";
if($plugin['icon']) $plugin_icon = "<img class=\"rspacer-md\" src=\"{$plugin['admin_path']}/{$plugin['icon']}\"> ";
?>
<li><a target="_blank" href="<?php echo $plugin['admin_path']; ?>"><?php echo $plugin_icon . $plugin['title']; ?></a></li>
<?php } ?>
Expand Down
2 changes: 1 addition & 1 deletion app/admin/index.php
@@ -1,5 +1,5 @@
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
error_reporting(E_ERROR /*| E_WARNING*/ | E_PARSE);
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$http = (strtolower($_SERVER['HTTPS']) == 'on' ? 'https:' : 'http:');
Expand Down
14 changes: 7 additions & 7 deletions app/admin/pageEditGroup.php
Expand Up @@ -35,7 +35,7 @@
if($_POST['groupID'] == '') { // new group
// make sure group name is unique
if(sqlValue("SELECT COUNT(1) FROM `membership_groups` WHERE `name`='{$name}'")) {
echo "<div class=\"alert alert-danger\">{$Translation['group exists error']}</div>";
echo "<div class=\"alert alert-danger text-center\">{$Translation['group exists error']}</div>";
include("{$currDir}/incFooter.php");
}

Expand All @@ -62,7 +62,7 @@

// make sure group name is unique
if(sqlValue("SELECT COUNT(1) FROM `membership_groups` WHERE `name`='{$name}' AND `groupID`!='{$groupID}'")) {
echo "<div class=\"alert alert-danger\">{$Translation['group exists error']}</div>";
echo "<div class=\"alert alert-danger text-center\">{$Translation['group exists error']}</div>";
include("{$currDir}/incFooter.php");
}

Expand Down Expand Up @@ -123,21 +123,21 @@
}
} else {
// no such group exists
echo "<div class=\"alert alert-danger\">{$Translation['group not found error']}</div>";
echo "<div class=\"alert alert-danger text-center\">{$Translation['group not found error']}</div>";
$groupID = 0;
}
}
?>

<?php if($_GET['msg'] == 'added'){ ?>
<div id="added-group-confirmation" class="alert alert-success alert-dismissible">
<div id="added-group-confirmation" class="alert alert-success alert-dismissible text-center">
<?php echo $Translation['group added successfully']; ?>
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
<?php } ?>

<?php if($_GET['msg'] == 'saved'){ ?>
<div id="saved-group-confirmation" class="alert alert-success alert-dismissible">
<div id="saved-group-confirmation" class="alert alert-success alert-dismissible text-center">
<?php echo $Translation['group updated successfully']; ?>
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
Expand Down Expand Up @@ -173,9 +173,9 @@
</div>

<?php if($anonGroupID == $groupID) { ?>
<div class="alert alert-warning"><?php echo $Translation['anonymous group attention']; ?></div>
<div class="alert alert-warning text-center"><?php echo $Translation['anonymous group attention']; ?></div>
<?php } elseif($name == 'Admins') { ?>
<div class="alert alert-warning"><?php echo $Translation['admin group attention']; ?></div>
<div class="alert alert-warning text-center"><?php echo $Translation['admin group attention']; ?></div>
<?php } ?>


Expand Down

0 comments on commit c52d1b3

Please sign in to comment.