| Server IP : 192.169.170.185 / Your IP : 216.73.216.97 Web Server : Apache System : Linux p3plmcpnl495852.prod.phx3.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64 User : akhilnew ( 1712764) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/akhilnew/public_html/psychiatrypaper/admin/ |
Upload File : |
<?php
if($opt1):
if($opt1 === 'list' OR $opt1 === 'search'):
function countgraphics($id)
{
global $mysqli, $firstcol;
$stmt = $mysqli->prepare("SELECT * FROM graphics WHERE $firstcol = ?") or die($mysqli->error);
$stmt->bind_param('i', $id);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->close();
return $count_rows;
}
$params = explode('|', $opt2);
$urlyear = $fn->element(0, $params);
$urlvolume= $fn->element(1, $params);
$urlissue = $fn->element(2, $params);
$urlpart = $fn->element(3, $params);
if($opt1 === 'search'):
$indexbutton = '';
$url = 'add';
$issuebutton = '';
else:
$indexbutton = '<button type="submit" class="waves-effect btn-flat h" onclick="sOPT(\'generateindexpage\')"><i class="material-icons left">file_download</i>index page</button>';
$url = 'add/'.$opt2;
$issuebutton = '<button type="button" class="waves-effect btn-flat right" style="margin:0">'.$urlyear.', vol. - '.$urlvolume.', '.(ctype_digit($urlissue) ? 'issue' : 'special issue').' - '.preg_replace('/[A-Z]/', '', $urlissue).', part - '.$urlpart.'</button>';
endif;
$equal = $keyword;
$keyword = "%$keyword%";
echo <<<EOJ
<div class="head white">
<button type="button" class="waves-effect btn-flat" onclick="history.back()"><i class="material-icons">keyboard_return</i></button>
<button type="button" class="waves-effect btn-flat green" onclick="cURL('{$url}')">add new</button>
<button type="submit" class="waves-effect btn-flat" onclick="sOPT('downloademails', '')"><i class="material-icons left">file_download</i>emails</button>
<button type="submit" class="waves-effect btn-flat" onclick="sOPT('downloadfiles', '')"><i class="material-icons left">file_download</i>files</button>
<button type="submit" class="waves-effect btn-flat" onclick="sOPT('checkdoi')">Check DOI</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('downloadcertificate', '')"><i class="material-icons left">file_download</i>certificate</button>
{$indexbutton}
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('downloaddoixml', '')"><i class="material-icons left">file_download</i>DOI XML</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('enabled', '')">enable</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('disabled', '')">disable</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('delete', 'Do you really want to delete?')"><i class="material-icons">delete</i></button>
{$issuebutton}
<input type="hidden" name="params" value="{$opt2}" readonly />
</div>
<table class="table">
<thead>
<tr>
<th class="xs center-align"><input type="checkbox" name="checkall" id="checkall" value="" /></th>
<th class="xs center-align">s. no.</th>
<th style="width:80px">ref. num.</th>
<th class="center-align" style="width:75px" nowrap>doi active</th>
<th>title</th>
<th class="center-align" style="width:80px">pages</th>
<th class="center-align" style="width:70px">mail</th>
<th class="center-align" style="width:70px">cert.</th>
<th class="center-align" style="width:70px">message</th>
<th class="center-align" style="width:100px">advertisement</th>
<th class="lg right-align">modification</th>
<th class="lg right-align">creation</th>
<th class="md center-align">action</th>
</tr>
</thead>
<tbody>
EOJ;
if($opt1 === 'search'):
$stmt = $mysqli->prepare("SELECT archive.archivesid, archive.doi, archive.doiactive, archive.year, archive.refnumber, archive.volume, archive.issue, archive.part, archive.title, archive.titlefont, archive.file, archive.pagenumber, archive.status, archive.mailstatus, archive.certificatemailstatus, archive.wa_message_send, archive.wa_advertisement_send, archive.modification, archive.creation, archive.countdoixmldownload FROM $table as archive LEFT JOIN archiveauthors as archiveauthor ON archive.archivesid = archiveauthor.archiveid WHERE (archive.doi LIKE ? OR archive.refnumber = ? OR STRIP_TAGS(archive.title) LIKE ? OR archive.authorname LIKE ? OR archive.abstract LIKE ? OR archive.keywords LIKE ? OR archive.description LIKE ? OR archive.country LIKE ? OR archive.mobile LIKE ? OR archive.email LIKE ? OR archiveauthor.name LIKE ? OR archiveauthor.email LIKE ? OR archiveauthor.phone LIKE ?) GROUP BY archive.archivesid ORDER BY LENGTH(archive.pagenumber),archive.pagenumber ASC") or die($mysqli->error);
$stmt->bind_param('sssssssssssss', $keyword, $equal, $keyword, $keyword, $keyword, $keyword, $keyword, $keyword, $keyword, $keyword, $keyword, $keyword, $keyword);
else:
$stmt = $mysqli->prepare("SELECT $firstcol, doi, doiactive, year, refnumber, volume, issue, part, title, titlefont, file, pagenumber, status, mailstatus, certificatemailstatus, wa_message_send, wa_advertisement_send, modification, creation, countdoixmldownload FROM $table WHERE (year = ? AND volume = ? AND issue = ? AND part = ?) ORDER BY LENGTH(pagenumber),pagenumber ASC") or die($mysqli->error);
$stmt->bind_param('siss', $urlyear, $urlvolume, $urlissue, $urlpart);
endif;
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($id, $doi, $doiactive, $year, $refnumber, $volume, $issue, $part, $title, $titlefont, $file, $pagenumber, $status, $mailstatus, $certificatemailstatus, $wa_message_send, $wa_advertisement_send, $modification, $creation, $countdoixmldownload);
while($stmt->fetch()):
$snum = $snum + 1;
$refnocolor = $file && file_exists($uploadpath.$page.'/'.$file) ? '333' : 'ea4335';
$titlecolor = $status === 'disabled' ? 'ea4335' : '333';
$title = strip_tags($title, '<i><em><sup><sub><img>');
$title = $equal ? $title.'<span class="right" style="margin-top:2px;font-size:11px">'.$year.', VOL. '.$volume.', ISSUE '.$issue.', PART '.$part.'</span>' : $title;
$title = $titlefont ? '<span style="font-family:'.$titlefont.' !important;font-size:16px;">'.$title.'</span>' : $title;
$title = html_entity_decode($title);
$countdoixmldownload = $countdoixmldownload ?: 0;
$countgraphics = countgraphics($id);
$doibg = $doi ? '2d8024' : 'f00';
$countdoixmldownload = $countdoixmldownload ?: '0';
$doiactive = $doiactive === 'Y' ? '<i class="material-icons green-text" style="font-size:18px;">check</i>' : '<i class="material-icons red-text" style="font-size:18px;">clear</i>';
echo <<<EOJ
<tr>
<td class="center-align"><input type="checkbox" name="dataid[]" value="{$id}" class="checkbox" /></td>
<td class="center-align">{$snum}</td>
<td><span style="color:#{$refnocolor}">{$refnumber}</span><a href="https://doi.org/{$doi}" target="_blank" class="counting" style="background-color:#{$doibg};">DOI: {$countdoixmldownload}</a></td>
<td class="center-align" nowrap>{$doiactive}</td>
<td><span style="color:#{$titlecolor}">{$title}</span></td>
<td class="center-align">{$pagenumber}</td>
<td class="center-align">{$mailstatus}</td>
<td class="center-align">{$certificatemailstatus}</td>
<td class="center-align">{$wa_message_send}</td>
<td class="center-align">{$wa_advertisement_send}</td>
<td class="right-align">{$fn->nice_date($modification)}</td>
<td class="right-align">{$fn->nice_date($creation)}</td>
<td class="center-align">
<button type="button" onclick="cURL('addgraphics/{$id}')">graphics ({$countgraphics})</button><br clear="all">
<button type="button" class="blue-text text-accent-3" onclick="cURL('edit/{$id}')">edit</button>
</td>
</tr>
EOJ;
endwhile;
else:
echo '<tr><td colspan="13" class="center-align">MySQL returned an empty result set (i.e. zero rows).</td></tr>';
endif;
$stmt->close();
echo '</tbody>';
echo '</table>';
elseif($opt1 === 'add' OR $opt1 === 'edit'):
function months($emonth)
{
$months = '';$html = '';
for($m = 1; $m <= 12; $m++) : $months[] = date('M', mktime(0,0,0,$m,1)); endfor;
foreach($months as $month):
$selected = $emonth === $month ? 'selected' : '';
$html .= '<option value="'.$month.'" '.$selected.'>'.$month.'</option>';
endforeach;
return $html;
}
function years()
{
global $mysqli, $table;$html = '';
$stmt = $mysqli->prepare("SELECT year FROM $table GROUP BY year ORDER BY year DESC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($year);
while($stmt->fetch()):
$html .= $year ? '<option value="'.trim($year).'">'.trim($year).'</option>' : '';
endwhile;
$stmt->close();
return $html;
}
function subjects()
{
global $mysqli, $table;$html = '';
$stmt = $mysqli->prepare("SELECT subject FROM $table GROUP BY TRIM(subject) ORDER BY subject ASC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($subject);
while($stmt->fetch()):
$html .= $subject ? '<option value="'.trim($subject).'">'.trim($subject).'</option>' : '';
endwhile;
$stmt->close();
return $html;
}
function countries()
{
global $mysqli, $table;$html = '';
$stmt = $mysqli->prepare("SELECT nicename FROM country GROUP BY nicename ORDER BY nicename ASC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($country);
while($stmt->fetch()):
$html .= $country ? '<option value="'.trim($country).'">'.trim($country).'</option>' : '';
endwhile;
$stmt->close();
return $html;
}
function font($font)
{
global $mysqli;$html = '';
$stmt = $mysqli->prepare("SELECT name FROM fonts ORDER BY name ASC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($name);
while($stmt->fetch()):
$selected = $name === $font ? 'selected' : '';
$html .= '<option value="'.$name.'" '.$selected.'>'.$name.'</option>';
endwhile;
$stmt->close();
return $html;
}
$years = years();
$subjects = subjects();
$countries = countries();
if($opt1 === 'edit'):
$stmt = $mysqli->prepare("SELECT $firstcol, doi, doistatus, month, year, refnumber, volume, issue, part, title, titlefont, authorname, authornamefont, abstract, abstractfont, keywords, description, file, supplementaryfile, subject, country, pagenumber, status, comment, mobile, email, retractcontent, retractstatus, modification, creation, views, downloads, specialissue, conference, shortnotes FROM $table WHERE $firstcol = ? LIMIT 1") or die($mysqli->error);
$stmt->bind_param('i', $opt2);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->bind_result($id, $doi, $doistatus, $emonth, $year, $refnumber, $volume, $issue, $part, $title, $titlefont, $authorname, $authornamefont, $abstract, $abstractfont, $keywords, $description, $file, $supplementaryfile, $subject, $country, $pagenumber, $status, $comment, $mobile, $email, $retractcontent, $retractstatus, $modification, $creation, $views, $downloads, $specialissue, $conference, $shortnotes);
$stmt->fetch();
$stmt->close();
if($count_rows !== 1):
die('Invalid data selection.');
endif;
$emonth = trim(preg_replace('/[0-9]/', '', $emonth));
$title = html_entity_decode($title);
$authorname = html_entity_decode($authorname);
$abstract = html_entity_decode($abstract);
$keywords = html_entity_decode($keywords);
$description= html_entity_decode($description);
$retractcontent = html_entity_decode($retractcontent);
$conference = html_entity_decode($conference);
$shortnotes = html_entity_decode($shortnotes);
$mobileEmailField = '';
else:
$id = '';$doi = '';$emonth = '';$refnumber = '';$title = '';$titlefont = '';$authorname = '';$authornamefont = '';$abstract = '';$abstractfont = '';$keywords = '';$description = '';$subject = '';$country = '';$pagenumber = '';$comment = '';$mobile = '';$email = '';$retractcontent = '';$conference = '';$shortnotes = '';
$doistatus = 'enabled';$retractstatus = 'disabled';$specialissue = 'N';$status = 'enabled';
$mobileEmailField = 'hidden';
$params = explode('|', $opt2);
$year = $fn->element(0, $params);
$volume = $fn->element(1, $params);
$issue = $fn->element(2, $params);
$part = $fn->element(3, $params);
$stmt = $mysqli->prepare("SELECT month, specialissue, conference FROM $table WHERE (year = ? AND volume = ? AND issue = ? AND part = ?) ORDER BY $firstcol DESC LIMIT 1") or die($mysqli->error);
$stmt->bind_param('siss', $year, $volume, $issue, $part);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($emonth, $specialissue, $econference);
$stmt->fetch();
$stmt->close();
$conference = html_entity_decode($econference);
endif;
$issue = preg_replace('/[^0-9]/', '', $issue);
$doistatus = $doistatus === 'enabled' ? 'checked' : '';
$retractstatus = $retractstatus === 'enabled' ? 'checked' : '';
$specialissue = $specialissue === 'Y' ? 'checked' : '';
$status = $status === 'enabled' ? 'checked' : '';
$emonth = explode('-', $emonth);
$month1 = $fn->element(0, $emonth);
$month2 = $fn->element(1, $emonth);
$fmonth = months($month1);
$smonth = months($month2);
$titlefont = font($titlefont);
$authornamefont = font($authornamefont);
$abstractfont = font($abstractfont);
$mainfilebutton = $file && file_exists($uploadpath.$page.'/'.$file) ? '<button type="submit" class="waves-effect btn-flat right" onclick="sOPT(\'removemainfile\', \'Do you really want to remove mail file?\')">remove main file</button>' : '';
$suppfilebutton = $supplementaryfile && file_exists($uploadpath.$page.'/'.$supplementaryfile) ? '<button type="submit" class="waves-effect btn-flat right" style="margin-left:10px" onclick="sOPT(\'removesuppfile\', \'Do you really want to remove supplementary file?\')">remove supplementary file</button>' : '';
if($opt1 === 'add'):
$stmt = $mysqli->prepare("SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?") or die($mysqli->error);
$stmt->bind_param('ss', $dbname, $table);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($nextarchivesid);
$stmt->fetch();
$stmt->close();
else:
$nextarchivesid = $opt2;
endif;
$nextdoi = '10.22271/27891623.'.$year.'.v'.$volume.'.i'.$issue.strtolower($part).'.'.$nextarchivesid;
echo <<<EOJ
<input type="hidden" name="dataid" value="{$opt2}" readonly />
<div class="head white">
<button type="button" class="waves-effect btn-flat" onclick="history.back()"><i class="material-icons">keyboard_return</i></button>
<button type="submit" class="waves-effect btn-flat blue accent-3" onclick="sOPT('{$opt1}', '')">submit</button>
<div class="fieldbox right" style="display:none">
<input type="text" name="uploadedfileurl" placeholder="Uploaded file URL" class="grey lighten-3" onkeypress="return (event.keyCode!=13)" />
</div>
{$suppfilebutton}{$mainfilebutton}
</div>
<div class="body white">
<div class="row">
<div class="col s12 m6 l6" style="margin-top:19px">
<div class="chklab left">
<label for="doistatus"><input type="checkbox" name="doistatus" value="enabled" id="doistatus" {$doistatus} />doi status</label>
</div>
<div class="chklab left">
<label for="status"><input type="checkbox" name="status" value="enabled" id="status" {$status} />status</label>
</div>
<div class="chklab left">
<label for="renamepdf"><input type="checkbox" name="renamepdf" value="enabled" id="renamepdf" checked />rename pdf</label>
</div>
</div>
<div class="col s12 m2 l2">
<label for="fmonth">first month<b class="red-text right">*</b></label>
<select name="fmonth" id="fmonth" class="browser-default">
<option value="" selected="selected">Select first month</option>
{$fmonth}
</select>
</div>
<div class="col s12 m2 l2">
<label for="smonth">second month</label>
<select name="smonth" id="smonth" class="browser-default">
<option value="" selected="selected">Select second month</option>
{$smonth}
</select>
</div>
<div class="col s12 m2 l2">
<label for="year">year<b class="red-text right">*</b></label>
<input type="text" name="year" value="{$year}" maxlength="4" id="year" class="int" list="yearlist" onpaste="return false" />
<datalist id="yearlist">{$years}</datalist>
</div>
</div>
<div class="row">
<div class="col s12 m3 l3">
<label for="refnumber">reference number<b class="red-text right">*</b></label>
<input type="text" name="refnumber" value="{$refnumber}" id="refnumber" onpaste="return false" />
</div>
<div class="col s12 m3 l3">
<label for="doi">doi number</label>
<div class="flex">
<input type="text" name="doi" value="{$doi}" id="doi" />
<div class="chklab left" style="width:110px">
<label for="allotdoi"><input type="checkbox" name="allotdoi" value="Y" id="allotdoi" onchange="if(this.checked){ $('#doi').val('{$nextdoi}'); } else { $('#doi').val(''); }" />allot</label>
</div>
</div>
</div>
<div class="col s12 m2 l2">
<label for="volume">volume number<b class="red-text right">*</b></label>
<input type="text" name="volume" value="{$volume}" maxlength="3" id="volume" class="int" onpaste="return false" />
</div>
<div class="col s12 m2 l2">
<label for="issue">issue number<b class="red-text right">*</b></label>
<input type="text" name="issue" value="{$issue}" maxlength="3" id="issue" onpaste="return false" />
</div>
<div class="col s12 m2 l2">
<label for="part">part<b class="red-text right">*</b></label>
<input type="text" name="part" value="{$part}" maxlength="4" id="part" onpaste="return false" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="title">title<b class="red-text right">*</b></label><br clear="all">
<textarea rows="25" cols="25" name="title" id="htmleditor">{$title}</textarea>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="authorname">author name<b class="red-text right">*</b></label>
<input type="text" name="authorname" value="{$authorname}" id="authorname" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12 md">
<label for="abstract">abstract</label><br clear="all">
<textarea rows="25" cols="25" name="abstract" id="htmleditor">{$abstract}</textarea>
</div>
</div>
<div class="row">
<div class="col s12 m6 l6">
<label for="description">meta description</label>
<input type="text" name="description" value="{$description}" id="description" />
</div>
<div class="col s12 m6 l6">
<label for="keywords">meta keywords</label>
<input type="text" name="keywords" value="{$keywords}" id="keywords" />
</div>
</div>
<div class="row">
<div class="col s12 m3 l3" style="margin-bottom:0">
<label for="mainfile">main file</label>
<input type="file" name="mainfile" id="mainfile" style="height:164px" />
</div>
<div class="col s12 m3 l3" style="margin-bottom:0">
<label for="mainfile">supplementary file</label>
<input type="file" name="suppfile" id="suppfile" style="height:164px" />
</div>
<div class="col s12 m6 l6">
<div class="row">
<div class="col s12 m6 l6">
<label for="subject">subject</label>
<input type="text" name="subject" value="{$subject}" id="subject" list="subjectlist" />
</div>
<div class="col s12 m6 l6">
<label for="subjectlist">subject list</label>
<select name="subjectlist" id="subjectlist" class="browser-default" onchange="this.form.subject.value=this.value;">
<option value="" selected>Select subject</potion>
{$subjects}
</select>
</div>
</div>
<div class="row">
<div class="col s12 m6 l6">
<label for="country">country<b class="red-text right">*</b></label>
<input type="text" name="country" value="{$country}" id="country" list="countrylist" />
</div>
<div class="col s12 m6 l6">
<label for="countrylist">country list</label>
<select name="countrylist" id="countrylist" class="browser-default" onchange="this.form.country.value=this.value;">
<option value="" selected>Select country</potion>
{$countries}
</select>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12" style="margin-bottom:0">
<label for="pagenumber">page number<b class="red-text right">*</b></label>
<input type="text" name="pagenumber" value="{$pagenumber}" id="pagenumber" onpaste="return false" />
</div>
</div>
</div>
</div>
<div class="row" {$mobileEmailField}>
<div class="col s12 m6 l6">
<label for="mobile">mobile</label>
<input type="text" name="mobile" value="{$mobile}" id="mobile" />
</div>
<div class="col s12 m6 l6">
<label for="email">email</label>
<input type="text" name="email" value="{$email}" id="email" />
</div>
</div>
<div class="row">
<div class="col s12 m4 l4">
<label for="titlefont">title font</label>
<select name="titlefont" class="browser-default">
<option value="" selected="selected">Select title font</option>
{$titlefont}
</select>
</div>
<div class="col s12 m4 l4">
<label for="authornamefont">author name font</label>
<select name="authornamefont" class="browser-default">
<option value="" selected="selected">Select author name font</option>
{$authornamefont}
</select>
</div>
<div class="col s12 m4 l4">
<label for="abstractfont">abstract font</label>
<select name="abstractfont" class="browser-default">
<option value="" selected="selected">Select abstract font</option>
{$abstractfont}
</select>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="comment">comment</label>
<input type="text" name="comment" value="{$comment}" id="comment" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="retractcontent">retract content</label>
<div class="flex">
<input type="text" name="retractcontent" value="{$retractcontent}" id="retractcontent" />
<div class="chklab right" style="width:150px">
<label for="retractstatus"><input type="checkbox" name="retractstatus" value="enabled" id="retractstatus" {$retractstatus} />retract status</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="conference">conference name</label>
<div class="flex">
<input type="text" name="conference" value="{$conference}" id="conference" />
<div class="chklab right" style="width:130px">
<label for="specialissue"><input type="checkbox" name="specialissue" value="Y" id="specialissue" {$specialissue} />special issue</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="shortnotes">short notes</label>
<input type="text" name="shortnotes" value="{$shortnotes}" id="shortnotes" />
</div>
</div>
</div>
<div class="fixed-action-btn">
<button type="button" class="btn-floating blue accent-3" onclick="compose('.upf')"><i class="large material-icons">file_upload</i></button>
</div>
<br clear="all">
<br clear="all">
EOJ;
if($opt1 === 'edit' && $opt2):
echo <<<EOJ
<div id="authormodal" style="width:700px;height:360px;background:#fff;border-radius:8px;position:fixed;top:50px;left:0;right:0;z-index:9999;margin:auto;box-shadow:0 10px 25px #333;overflow-y:scroll;" hidden>
<div style="padding:12px 8px;display:flex;align-items:center">
<h6>Add Author</h6>
<div style="margin-left:auto;">
<button type="button" class="waves-effect btn-flat grey lighten-1 left" style="height:auto;line-height:normal;padding:8px 12px;" onclick="addauthorsinmodal()">Add Author</button>
<button type="button" class="waves-effect btn-flat grey lighten-1 left" style="height:auto;line-height:normal;padding:8px 12px;margin-left:10px !important;" onclick="fetchauthors('fetchauthorsforedit')">Fetch</button>
<button type="button" class="waves-effect btn-flat grey lighten-1 left" style="height:auto;line-height:normal;padding:8px 12px;margin-left:10px !important;" onclick="authormodal.hidden = true;">Close</button>
<button type="submit" class="waves-effect btn-flat blue accent-3 white-text right" style="height:auto;line-height:normal;padding:8px 12px;margin-left:10px !important;" onclick="sOPT('addauthors')">Submit</button>
</div>
</div>
<table class="table">
<thead id="fetchedauthors">
<tr>
<th>name</th>
<th>email</th>
<th>phone</th>
<th style="with:60px;" nowrap></th>
</tr>
<tr>
<td><input type="text" name="new_aa_authorname[]" class="form-control" /></td>
<td><input type="text" name="new_aa_authoremail[]" class="form-control" /></td>
<td><input type="text" name="new_aa_authorphone[]" class="form-control" /></td>
<td nowrap style="width:70px;">
<button class="btn-control" style="width:60px;padding:.375rem 0!important;" type="button" onclick="$(this).closest('tr').remove()">Remove</button>
</td>
</tr>
</thead>
<tbody id="multiauthors"></tbody>
</table>
</div>
<button type="button" class="btn-control" onclick="authormodal.hidden = false" style="margin:0 5px 0 10px !important;">Add New</button>
<button type="submit" class="btn-control h" style="display:none" onclick="sOPT('deleteauthors', 'Do you really want to delete?')">Delete</button>
<br clear="all">
<br clear="all">
<table class="table">
<thead>
<tr>
<th class="xs center-align"><input type="checkbox" name="checkall" id="checkall" value="" /></th>
<th>name</th>
<th>email</th>
<th>phone</th>
<th colspan="3" nowrap style="background-color:#d5d5d5;">
<div style="display:flex;align-items:center;justify-content:center;">
<div class="switch">
<label>
<input type="checkbox" onchange="if(this.checked){ $('.mailCheckbox').val(1) }else{ $('.mailCheckbox').val('') }" />
<span class="lever"></span>
</label>
</div>
send email
</div>
</th>
<th colspan="2" nowrap style="background-color:#d5d5d5;">
<div style="display:flex;align-items:center;justify-content:center;">
<div class="switch">
<label>
<input type="checkbox" onchange="if(this.checked){ $('.waCheckbox').val(1) }else{ $('.waCheckbox').val('') }" />
<span class="lever"></span>
</label>
</div>
send whatsapp
</div>
</th>
</tr>
EOJ;
$stmt = $mysqli->prepare("SELECT id, name, email, phone FROM archiveauthors WHERE archiveid = ?") or die($mysqli->error);
$stmt->bind_param('i', $opt2);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($aa_id, $aa_name, $aa_email, $aa_phone);
while($stmt->fetch()):
echo <<<EOJ
<tr>
<td class="center-align" style="position:relative">
<input type="checkbox" name="archiveauthorid[]" value="{$aa_id}" class="checkbox" />
</td>
<td><input value="{$aa_name}" type="text" name="aa_authorname[{$aa_id}]" class="form-control" /></td>
<td><input value="{$aa_email}" type="text" name="aa_authoremail[{$aa_id}]" class="form-control" /></td>
<td><input value="{$aa_phone}" type="text" name="aa_authorphone[{$aa_id}]" class="form-control" /></td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#d5d5d5;">
<input style="width:36px;padding:0;text-align:center;" class="mailCheckbox form-control" type="text" name="sendmail[{$aa_id}]" maxlength="1" /><br clear="all">Mail
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;width:80px;background-color:#d5d5d5;">
<input style="width:36px;padding:0;text-align:center;" class="mailCheckbox form-control" type="text" name="sendcertificate[{$aa_id}]" maxlength="1" /><br clear="all">Certificate
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#d5d5d5;">
<input style="width:36px;padding:0;text-align:center;" class="mailCheckbox form-control" type="text" name="sendcopyrightform[{$aa_id}]" maxlength="1" /><br clear="all">Copyright
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#c5c5c5;">
<input style="width:36px;padding:0;text-align:center;" class="waCheckbox form-control" type="text" name="sendwamessage[{$aa_id}]" maxlength="1" /><br clear="all">Message
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#c5c5c5;">
<input style="width:36px;padding:0;text-align:center;" class="waCheckbox form-control" type="text" name="sendwaadvertisement[{$aa_id}]" maxlength="1" /><br clear="all">Advertisement
</td>
</tr>
EOJ;
endwhile;
$stmt->close();
echo <<<EOJ
</thead>
</table>
<br clear="all">
<br clear="all">
<br clear="all">
EOJ;
else:
echo <<<EOJ
<button type="button" class="btn-control" onclick="fetchauthors('fetchauthorsforadd')" style="margin:0 5px 0 10px !important;">Fetch</button>
<button type="button" class="btn-control" onclick="addauthors()">Add Author</button>
<br clear="all">
<br clear="all">
<table class="table">
<thead id="fetchedauthors">
<tr>
<th>name</th>
<th>email</th>
<th>phone</th>
<th colspan="3" nowrap style="background-color:#d5d5d5;">
<div style="display:flex;align-items:center;justify-content:center;">
<div class="switch">
<label>
<input type="checkbox" onchange="if(this.checked){ $('.mailCheckbox').val(1) }else{ $('.mailCheckbox').val('') }" />
<span class="lever"></span>
</label>
</div>
send email
</div>
</th>
<th colspan="2" nowrap style="background-color:#d5d5d5;">
<div style="display:flex;align-items:center;justify-content:center;">
<div class="switch">
<label>
<input type="checkbox" onchange="if(this.checked){ $('.waCheckbox').val(1) }else{ $('.waCheckbox').val('') }" />
<span class="lever"></span>
</label>
</div>
send whatsapp
</div>
</th>
<th class="center-align" style="with:60px;" nowrap></th>
</tr>
<tr>
<td><input type="text" name="aa_authorname[]" class="form-control" /></td>
<td><input type="text" name="aa_authoremail[]" class="form-control" /></td>
<td><input type="text" name="aa_authorphone[]" class="form-control" /></td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#d5d5d5;">
<input style="width:36px;padding:0;text-align:center;" class="mailCheckbox form-control" type="text" name="sendmail[]" maxlength="1" /><br clear="all">Mail
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;width:80px;background-color:#d5d5d5;">
<input style="width:36px;padding:0;text-align:center;" class="mailCheckbox form-control" type="text" name="sendcertificate[]" maxlength="1" /><br clear="all">Certificate
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#d5d5d5;">
<input style="width:36px;padding:0;text-align:center;" class="mailCheckbox form-control" type="text" name="sendcopyrightform[]" maxlength="1" /><br clear="all">Copyright
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#c5c5c5;">
<input style="width:36px;padding:0;text-align:center;" class="waCheckbox form-control" type="text" name="sendwamessage[]" maxlength="1" /><br clear="all">Message
</td>
<td nowrap style="width:50px;text-align:center;text-transform:uppercase;font-size:10px;font-weight:500;background-color:#c5c5c5;">
<input style="width:36px;padding:0;text-align:center;" class="waCheckbox form-control" type="text" name="sendwaadvertisement[]" maxlength="1" /><br clear="all">Advertisement
</td>
<td nowrap style="width:70px;">
<button class="btn-control" style="width:60px;padding:.375rem 0!important;" type="button" onclick="$(this).closest('tr').remove()">Remove</button>
</td>
</tr>
</thead>
<tbody id="multiauthors"></tbody>
</table>
<br clear="all">
<br clear="all">
<br clear="all">
EOJ;
endif;
elseif($opt1 === 'addgraphics' && $opt2):
echo <<<EOJ
<input type="hidden" name="dataid" value="{$opt2}" readonly />
<div class="head white">
<button type="button" class="waves-effect btn-flat" onclick="history.back()"><i class="material-icons">keyboard_return</i></button>
<button type="submit" class="waves-effect btn-flat blue accent-3" onclick="sOPT('{$opt1}', '')">submit</button>
<button type="button" class="waves-effect btn-flat right addgraphics">add more graphics</button>
</div>
<div class="body white">
<div class="row">
<div class="col s12 m12 l12">
<div class="file-field">
<div class="btn btn-flat grey lighten-1 white-text">
<span>graphics</span>
<input type="file" name="graphics[]" multiple />
</div>
<div class="file-path-wrapper">
<input type="text" placeholder="Only JPG, JPEG, PNG and GIF allowed." class="file-path" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="alternative_text">alternative text</label><br clear="all">
<textarea rows="25" cols="25" name="alt[]" id="htmleditor" multiple></textarea>
</div>
</div>
<div class="morefield"></div>
</div>
<div class="row graphics">
EOJ;
$stmt = $mysqli->prepare("SELECT graphicsid, file, graphicsalt FROM graphics WHERE archivesid = ?") or die($mysqli->error);
$stmt->bind_param('i', $opt2);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($graphicsid, $file, $graphicsalt);
while($stmt->fetch()):
$graphics = $file && file_exists($uploadpath.'graphics/'.$opt2.'/'.$file) ? $uploadurl.'graphics/'.$opt2.'/'.$file : $imageurl.'avatar_2x.png';
echo <<<EOJ
<div class="col s12 m3 l2">
<div class="card">
<div class="card-image"><img src="{$graphics}" alt="{$graphicsalt}" /></div>
<div class="card-action left">
<input type="hidden" name="graphicsid" value="{$graphicsid}" readonly />
<button type="button" class="waves-effect btn-flat" onclick="cURL('editgraphics/{$opt2}|{$graphicsid}')">edit</button>
<button type="submit" class="waves-effect btn-flat right" onclick="sOPT('deletegraphics', 'Do you really want to delete?')">delete</button>
</div>
</div>
</div>
EOJ;
endwhile;
endif;
$stmt->close();
echo '</div>';
elseif($opt1 === 'editgraphics' && $opt2):
$params = explode('|', $opt2);
$fid = $fn->element(0, $params);
$sid = $fn->element(1, $params);
$stmt = $mysqli->prepare("SELECT file, graphicsalt FROM graphics WHERE graphicsid = ? LIMIT 1") or die($mysqli->error);
$stmt->bind_param('i', $sid);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->bind_result($file, $graphicsalt);
$stmt->fetch();
$stmt->close();
if($count_rows == 1):
$graphics = $file && file_exists($uploadpath.'graphics/'.$fid.'/'.$file) ? $uploadurl.'graphics/'.$fid.'/'.$file : $imageurl.'avatar_2x.png';
echo <<<EOJ
<input type="hidden" name="archivesid" value="{$fid}" readonly />
<input type="hidden" name="dataid" value="{$sid}" readonly />
<div class="head">
<button type="button" class="waves-effect btn-flat" onclick="history.back()"><i class="material-icons">keyboard_return</i></button>
<button type="submit" class="waves-effect btn-flat blue accent-3">submit</button>
</div>
<div class="body">
<div class="row">
<div class="col s12 m12 l12">
<div class="file-field">
<div class="btn btn-flat grey lighten-1 white-text">
<span>graphics</span>
<input type="file" name="graphics" />
</div>
<div class="file-path-wrapper">
<input type="text" placeholder="Only JPG, JPEG, PNG and GIF allowed." class="file-path" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="alternative_text">alternative text</label><br clear="all">
<textarea rows="25" cols="25" name="alt" id="htmleditor">{$graphicsalt}</textarea>
</div>
</div>
</div>
<div class="row graphics">
<div class="col s12 m3 l2">
<div class="card">
<div class="card-image"><img src="{$graphics}" alt="{$graphicsalt}" /></div>
</div>
</div>
</div>
EOJ;
else:
echo 'Invalid data selection.';
endif;
elseif($opt1 === 'import'):
echo <<<EOJ
<div class="head">
<button type="button" class="waves-effect btn-flat" onclick="history.back()"><i class="material-icons">keyboard_return</i></button>
<button type="submit" class="waves-effect btn-flat blue accent-3">submit & download</button>
</div>
<div class="body">
<div class="row">
<div class="col s12 m12 l12">
<div class="file-field">
<div class="btn btn-flat grey lighten-1 white-text">
<span>file</span>
<input type="file" name="file" />
</div>
<div class="file-path-wrapper">
<input type="text" placeholder="Only excel file allowed." class="file-path" />
</div>
</div>
</div>
</div>
</div>
EOJ;
else:
echo 'Invalid option selection.';
endif;
else:
function countpaper($year, $volume = '', $issue = '', $part = '')
{
global $mysqli, $table;
$stmt = $mysqli->prepare("SELECT (SELECT COUNT(*) AS totalyearpaper FROM $table WHERE year = ?), (SELECT COUNT(*) AS totalissuepaper FROM $table WHERE (year = ? AND volume = ? AND issue = ?)), (SELECT COUNT(*) AS totalpartpaper FROM $table WHERE (year = ? AND volume = ? AND issue = ? AND part = ?))") or die($mysqli->error);
$stmt->bind_param('ssississ', $year, $year, $volume, $issue, $year, $volume, $issue, $part);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($totalyearpaper, $totalissuepaper, $totalpartpaper);
$stmt->fetch();
$stmt->close();
return array(str_pad($totalyearpaper, 4, 0, STR_PAD_LEFT), str_pad($totalissuepaper, 4, 0, STR_PAD_LEFT), str_pad($totalpartpaper, 4, 0, STR_PAD_LEFT));
}
function issues($year)
{
global $mysqli, $table;$html = '';
$stmt = $mysqli->prepare("SELECT volume, issue FROM $table WHERE year = ? GROUP BY volume, issue ORDER BY volume DESC, issue DESC") or die($mysqli->error);
$stmt->bind_param('s', $year);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($volume, $issue);
while($stmt->fetch()):
$countpaper = countpaper($year, $volume, $issue);
$html .= '<div class="issue">volume '.$volume.', '.(ctype_digit($issue) ? 'issue' : 'special issue').' '.preg_replace('/[^0-9]/', '', $issue).' - <span class="red-text">['.$countpaper[1].']</span></div>';
$html .= parts($year, $volume, $issue);
endwhile;
endif;
$stmt->close();
return $html;
}
function parts($year, $volume, $issue){
global $mysqli, $table, $pageurl;$html = '';
$stmt = $mysqli->prepare("SELECT part FROM $table WHERE (year = ? AND volume = ? AND issue = ?) GROUP BY part ORDER BY LENGTH(part), part ASC") or die($mysqli->error);
$stmt->bind_param('sis', $year, $volume, $issue);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($part);
while($stmt->fetch()):
$countpaper = countpaper($year, $volume, $issue, $part);
$html .= '<div class="issue" style="display:inline-block"><a href="'.$pageurl.'/list/'.$year.'|'.$volume.'|'.$issue.'|'.$part.'" class="teal-text">part '.$part.' - <span class="red-text">['.$countpaper[2].']</span></a></div>';
endwhile;
endif;
$stmt->close();
return $html;
}
echo <<<EOJ
<div class="head white">
<button type="button" class="waves-effect btn-flat green" onclick="cURL('add')">add new</button>
<button type="button" class="waves-effect btn-flat" onclick="cURL('import')"><i class="material-icons left">file_upload</i>import</button>
<button type="submit" class="waves-effect btn-flat" onclick="sOPT('downloademails', '')"><i class="material-icons left">file_download</i>emails</button>
</div>
<div class="body white">
<ul class="collapsible z-depth-0">
EOJ;
$stmt = $mysqli->prepare("SELECT year FROM $table GROUP BY year ORDER BY year DESC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($year);
while($stmt->fetch()):
$countpaper = countpaper($year);
echo '<li>';
echo '<div class="collapsible-header">'.$year.' ['.$countpaper[0].']</div>';
echo '<div class="collapsible-body">'.issues($year).'</div>';
echo '</li>';
endwhile;
else:
echo '<li class="center-align" style="padding:5px;border-bottom:1px solid #ddd;text-transform:none">MySQL returned an empty result set (i.e. zero rows).</li>';
endif;
$stmt->close();
echo <<<EOJ
</ul>
</div>
EOJ;
endif;
?>
<style>
.btn-control {
margin-left: 10px;
display: inline-block;
font-weight: 400;
line-height: 1.5;
color: #212529 !important;
font-weight: 500;
text-align: center;
text-transform: uppercase;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
background-color: #bbb !important;
border: 1px solid transparent;
padding: 0.375rem 0.75rem !important;
font-size: 12px !important;
border-radius: 0.25rem;
text-decoration: none !important;
}
.table td input.form-control,.table td input.form-control:focus {
display: inline-block;
width: 100%;
padding: 0.375rem 0.5rem !important;
font-size: 12px !important;
font-weight: 400;
line-height: 1.5;
color: #212529;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da !important;
border-radius: 0.25rem;
box-sizing: border-box;
}
</style>