Unify code regarding single and double quotes

This commit is contained in:
Ulrich Block 2013-09-03 08:16:17 +02:00
parent 97484b9f7f
commit 9a64e841ec
8 changed files with 43 additions and 84 deletions

View File

@ -49,7 +49,7 @@ if (isset($what_to_be_included_array[$w]) and is_file((EASYWIDIR.'/stuff/'.$what
unset($dbConnect);
} else {
unset($dbConnect);
$template_file="admin_home.tpl";
$template_file='admin_home.tpl';
}
include(IncludeTemplate($template_to_use,'admin_header.tpl'));
include(IncludeTemplate($template_to_use,(isset($template_file) and preg_match('/^(.*)\.[\w]{1,}$/',$template_file)) ? $template_file : 'general.tpl'));

View File

@ -677,9 +677,9 @@ XML;
$page_data->setCanonicalUrl($s);
$template_file='page_lenddata.tpl';
} else {
if (is_file(EASYWIDIR."/template/$template_to_use/lenddata.tpl")) {
include(EASYWIDIR."/template/$template_to_use/lenddata.tpl");
} else if (is_file(EASYWIDIR."/template/default/lenddata.tpl")) {
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lenddata.tpl')) {
include(EASYWIDIR.'/template/'.$template_to_use.'/lenddata.tpl');
} else if (is_file(EASYWIDIR.'/template/default/lenddata.tpl')) {
include(EASYWIDIR.'/template/default/lenddata.tpl');
} else {
include(EASYWIDIR.'/template/lenddata.tpl');
@ -707,9 +707,9 @@ XML;
$page_data->setCanonicalUrl($s);
$template_file='page_lend.tpl';
} else {
if (is_file(EASYWIDIR."/template/$template_to_use/lend.tpl")) {
include(EASYWIDIR."/template/$template_to_use/lend.tpl");
} else if (is_file(EASYWIDIR."/template/default/lend.tpl")) {
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lend.tpl')) {
include(EASYWIDIR.'/template/'.$template_to_use.'/lend.tpl');
} else if (is_file(EASYWIDIR.'/template/default/lend.tpl')) {
include(EASYWIDIR.'/template/default/lend.tpl');
} else {
include(EASYWIDIR.'/template/lend.tpl');
@ -921,9 +921,9 @@ XML;
$page_data->setCanonicalUrl($s);
$template_file='page_lenddata.tpl';
} else {
if (is_file(EASYWIDIR."/template/$template_to_use/lenddata.tpl")) {
include(EASYWIDIR."/template/$template_to_use/lenddata.tpl");
} else if (is_file(EASYWIDIR."/template/default/lenddata.tpl")) {
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lenddata.tpl')) {
include(EASYWIDIR.'/template/'.$template_to_use.'/lenddata.tpl');
} else if (is_file(EASYWIDIR.'/template/default/lenddata.tpl')) {
include(EASYWIDIR.'/template/default/lenddata.tpl');
} else {
include(EASYWIDIR.'/template/lenddata.tpl');
@ -946,9 +946,9 @@ XML;
$page_data->setCanonicalUrl($s);
$template_file='page_lend.tpl';
} else {
if (is_file(EASYWIDIR."/template/$template_to_use/lend.tpl")) {
include(EASYWIDIR."/template/$template_to_use/lend.tpl");
} else if (is_file(EASYWIDIR."/template/default/lend.tpl")) {
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lend.tpl')) {
include(EASYWIDIR.'/template/'.$template_to_use.'/lend.tpl');
} else if (is_file(EASYWIDIR.'/template/default/lend.tpl')) {
include(EASYWIDIR.'/template/default/lend.tpl');
} else {
include(EASYWIDIR.'/template/lend.tpl');

View File

@ -208,13 +208,12 @@ if ($w=='lo') {
} else {
$vosprache=simplexml_load_file(EASYWIDIR."/languages/$default_language/voice.xml");
}
$include="passwordrecovery_vo.tpl";
$include='passwordrecovery_vo.tpl';
} else {
$include="passwordrecovery.tpl";
$include='passwordrecovery.tpl';
}
} else {
$aesfilecvar=getconfigcvars(EASYWIDIR.'/stuff/keyphrasefile.php');
$aeskey=$aesfilecvar['aeskey'];
$aeskey=include(EASYWIDIR.'/stuff/keyphrasefile.php');
if (!$ui->username('username',255,'post') and !$ui->ismail('username',255,'post') and !$ui->password('password',255,'post') and !isset($_SESSION['sessionid'])) {
$include='login.tpl';
} else if (($ui->username('username',255,'post') or $ui->ismail('username','post')) and $ui->password('password',255,'post') and !isset($_SESSION['sessionid'])) {

View File

@ -145,9 +145,9 @@ if ($ui->ipport('serveraddress','post')) {
if (isset($page_include)) {
$template_file='page_protectioncheck.tpl';
} else {
if (file_exists(EASYWIDIR."/template/$template_to_use/protectioncheck.tpl")) {
include(EASYWIDIR."/template/$template_to_use/protectioncheck.tpl");
} else if (file_exists(EASYWIDIR."/template/default/protectioncheck.tpl")) {
if (file_exists(EASYWIDIR.'/template/'.$template_to_use.'/protectioncheck.tpl')) {
include(EASYWIDIR.'/template/'.$template_to_use.'/protectioncheck.tpl');
} else if (file_exists(EASYWIDIR.'/template/default/protectioncheck.tpl')) {
include(EASYWIDIR.'/template/default/protectioncheck.tpl');
} else {
include(EASYWIDIR.'/template/protectioncheck.tpl');
@ -212,9 +212,9 @@ XML;
} else if (isset($page_include)) {
$template_file='page_protectioncheck.tpl';
} else {
if (file_exists(EASYWIDIR."/template/$template_to_use/protectioncheck.tpl")) {
include(EASYWIDIR."/template/$template_to_use/protectioncheck.tpl");
} else if (file_exists(EASYWIDIR."/template/default/protectioncheck.tpl")) {
if (file_exists(EASYWIDIR.'/template/'.$template_to_use.'/protectioncheck.tpl')) {
include(EASYWIDIR.'/template/'.$template_to_use.'/protectioncheck.tpl');
} else if (file_exists(EASYWIDIR.'/template/default/protectioncheck.tpl')) {
include(EASYWIDIR.'/template/default/protectioncheck.tpl');
} else {
include(EASYWIDIR.'/template/protectioncheck.tpl');

View File

@ -341,7 +341,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
foreach($query1->fetchAll(PDO::FETCH_ASSOC) as $row1) {
$rootID=$row1['id'];
$cmds=array();
$query2=$sql->prepare("SELECT *,AES_DECRYPT(`ftppassword`,?) AS `decryptedftppass`,AES_DECRYPT(`ppassword`,?) AS `decryptedppassword` FROM `gsswitch` WHERE `rootID`=? AND `resellerid`=? ORDER BY `userid`,`serverid`");
$query2=$sql->prepare("SELECT *,AES_DECRYPT(`ftppassword`,?) AS `decryptedftppass`,AES_DECRYPT(`ppassword`,?) AS `decryptedppassword` FROM `gsswitch` WHERE `rootID`=? AND `resellerid`=? AND `active`='Y' AND `lendserver`='N' ORDER BY `userid`,`serverid`");
$query2->execute(array($aeskey,$aeskey,$rootID,$resellerid));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
unset($restart);

View File

@ -55,54 +55,26 @@ if (isset($admin_id)) {
}
if ($ui->st('d','get')=='ud' and $ui->id('id',19,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'),$substituteAccess['gs']))) {
$serverid=$ui->id('id',19,'get');
$aesfilecvar=getconfigcvars(EASYWIDIR."/stuff/keyphrasefile.php");
$aeskey=$aesfilecvar['aeskey'];
$query=$sql->prepare("SELECT g.`rootID`,g.`protected`,g.`masterfdl`,g.`mfdldata`,g.`serverip`,g.`port`,g.`newlayout`,AES_DECRYPT(g.`ftppassword`,?) AS `dftppassword`,AES_DECRYPT(g.`ppassword`,?) AS `dppassword`,s.`servertemplate`,t.`modfolder`,t.`shorten`,u.`fdlpath`,u.`cname` FROM `gsswitch` g LEFT JOIN `serverlist` s ON g.`serverid`=s.`id` LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` LEFT JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`active`='Y' AND g.`id`=? AND g.`resellerid`=? LIMIT 1");
$query->execute(array($aeskey,$aeskey,$serverid,$reseller_id));
$serverid=(int)$ui->id('id',19,'get');
require_once(EASYWIDIR.'/stuff/keyphrasefile.php');
$query=$sql->prepare("SELECT g.`rootID`,g.`masterfdl`,g.`mfdldata`,g.`serverip`,g.`port`,g.`newlayout`,s.`servertemplate`,t.`modfolder`,t.`shorten`,u.`fdlpath`,u.`cname` FROM `gsswitch` g LEFT JOIN `serverlist` s ON g.`serverid`=s.`id` LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` LEFT JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`active`='Y' AND g.`id`=? AND g.`resellerid`=? LIMIT 1");
$query->execute(array($serverid,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$rootid=$row['rootID'];
$serverip=$row['serverip'];
$port=$row['port'];
$masterfdl=$row['masterfdl'];
$mfdldata=$row['mfdldata'];
$shorten=$row['shorten'];
$modfolder=$row['modfolder'];
$servertemplate=$row['servertemplate'];
$customer=$row['cname'];
$ftppass=$row['dftppassword'];
if ($row['protected']=='Y') {
$customer=$customer.'-p';
$ftppass=$row['dppassword'];
}
if ($servertemplate==1) {
$servertemplate="";
} else {
$servertemplate="-".$servertemplate;
}
if ($masterfdl=='Y') {
$fdlpath=$row['fdlpath'];
$ftpupload=$fdlpath;
} else {
$ftpupload=$mfdldata;
}
if ($ftpupload!="") {
$shorten=$row['shorten'] . ($row['servertemplate']==1) ? '' : '-'.$row['servertemplate'];
$customer=($row['newlayout']=='Y') ? $row['cname'].'-'.$serverid : $row['cname'];
if ($row['protected']=='Y') $customer=$customer.'-p';
$ftpupload=($row['masterfdl']=='Y') ? $row['fdlpath'] : $row['mfdldata'];
if ($ftpupload!='') {
include(EASYWIDIR."/stuff/ssh_exec.php");
$rdata=serverdata('root',$rootid,$aeskey);
$sship=$rdata['ip'];
$sshport=$rdata['port'];
$sshuser=$rdata['user'];
$sshpass=$rdata['pass'];
if ($row['newlayout']=='Y') $customer=$customer.'-'.$serverid;
$serverfolder=$serverip."_"."$port/$shorten$servertemplate";
if(ssh2_execute('gs',$rootid,"sudo -u ${customer} ./control.sh fastdl ${customer} ${serverfolder} \"${ftpupload}\" ${modfolder}")===false) {
$serverfolder="${row['serverip']}_${row['port']}/${shorten}";
if(ssh2_execute('gs',$row['rootID'],"sudo -u ${customer} ./control.sh fastdl ${customer} ${serverfolder} \"${ftpupload}\" ${row['modfolder']}")===false) {
$template_file=$spracheResponse->error_server;
$actionstatus="fail";
} else {
$template_file=$sprache->fdlstarted;
$actionstatus="ok";
}
$loguseraction="%start% %fastdl% $serverip:$port %$actionstatus%";
$loguseraction="%start% %fastdl% ${row['serverip']}:${row['port']} %${actionstatus}%";
$insertlog->execute();
} else {
$template_file=$sprache->fdlfailed;
@ -120,14 +92,8 @@ if ($ui->st('d','get')=='ud' and $ui->id('id',19,'get') and (!isset($_SESSION['s
$masterfdl=$row['masterfdl'];
$mfdldata=$row['mfdldata'];
}
if (!isset($mfdldata)){
$mfdldata="";
}
if (isset($serverip)) {
$template_file="userpanel_gserver_fdl_es.tpl";
} else {
$template_file='userpanel_404.tpl';
}
if (!isset($mfdldata)) $mfdldata='';
$template_file=(isset($serverip)) ? 'userpanel_gserver_fdl_es.tpl' : 'userpanel_404.tpl';
} else if ($ui->smallletters('action',2,'post')=='md'){
if ($ui->active('masterfdl','post')) {
$query=$sql->prepare("SELECT `serverip`,`port` FROM `gsswitch` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
@ -155,14 +121,8 @@ if ($ui->st('d','get')=='ud' and $ui->id('id',19,'get') and (!isset($_SESSION['s
if (!$ui->smallletters('action',2,'post')) {
$query=$sql->prepare("SELECT `fdlpath` FROM `userdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($user_id,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$fdlpath=$row['fdlpath'];
}
if ($query->rowCount()>0) {
$template_file='userpanel_gserver_fdl_eu.tpl';
} else {
$template_file='userpanel_404.tpl';
}
$fdlpath=$query->fetchColumn();
$template_file=($query->rowCount()>0) ? 'userpanel_gserver_fdl_eu.tpl' : 'userpanel_404.tpl';
} else if ($ui->smallletters('action',2,'post')=='md'){
if ($ui->url('fdlpath','post')) {
$query=$sql->prepare("UPDATE `userdata` SET `fdlpath`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
@ -181,7 +141,7 @@ if ($ui->st('d','get')=='ud' and $ui->id('id',19,'get') and (!isset($_SESSION['s
$fdlpath=explode('@',$row['fdlpath']);
$username=$row['cname'];
}
if (!isset($fdlpath['1'])) $fdlpath['1']=$sprache->noset;
if (!isset($fdlpath[1])) $fdlpath[1]=$sprache->noset;
$table=array();
$query=$sql->prepare("SELECT `id`,`serverip`,`port` FROM `gsswitch` WHERE `active`='Y' AND `userid`=? AND `resellerid`=?");
$query->execute(array($user_id,$reseller_id));

View File

@ -196,7 +196,7 @@ function names($value,$laeng) {
return $value;
}
}
function phone($value,$laeng=null) {
function phone($value) {
if (preg_match('/^[0-9\+\(\)\/\-\s]+$/', $value)) {
return $value;
}

View File

@ -54,11 +54,11 @@
</select>
</div>
</div>
<div class="N <?php if ($publickey=='Y') echo 'display_none';?> switch control-group">
<div class="N switch control-group">
<label class="control-label" for="inputSSH2Pass"><?php echo $sprache->ssh_pass;?>:</label>
<div class="controls"><input class="span12" id="inputSSH2Pass" type="password" name="pass" value="" maxlength="50"></div>
</div>
<div class="Y <?php if ($publickey=='N') echo 'display_none';?> switch control-group">
<div class="Y switch control-group">
<label class="control-label" for="inputSSH2Key"><?php echo $sprache->keyname;?></label>
<div class="controls"><input class="span12" id="inputSSH2Key" type="text" name="keyname" maxlength="20" value=""></div>
</div>