[go: up one dir, main page]

0% found this document useful (0 votes)
6 views3 pages

Index PHP

The document is a web page for managing Gmail accounts, featuring a top bar for account selection and an option to add accounts via OAuth. It displays a navigation menu for mail folders and lists messages with options to open, reply, delete, or report as spam. Additionally, it includes a script for polling new mail every 10 seconds and a footer with links to privacy and terms of service.

Uploaded by

nweke1035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Index PHP

The document is a web page for managing Gmail accounts, featuring a top bar for account selection and an option to add accounts via OAuth. It displays a navigation menu for mail folders and lists messages with options to open, reply, delete, or report as spam. Additionally, it includes a script for polling new mail every 10 seconds and a footer with links to privacy and terms of service.

Uploaded by

nweke1035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

.

folder-menu a {
padding: 8px 12px;
background: #e8f0fe;
border: 1px solid #c2d2ff;
border-radius: 8px;
color: #0b57d0;
text-decoration: none;
font-weight: 600;
}
.folder-menu a.active {
background: #0b57d0;
color: #fff;
}
</style>
</head>
<body>
<div class="topbar">
<div><strong>CallSync Gmail</strong></div>
<div>
<form method="get" style="display:inline">
<select name="switch" class="sel" onchange="this.form.submit()">
<?php foreach($accounts as $em): ?>
<option value="<?=htmlspecialchars($em)?>"
<?=$em===$active?'selected':''?>><?=htmlspecialchars($em)?></option>
<?php endforeach; ?>
</select>
</form>
<?php
$loginUrl =
"https://accounts.google.com/o/oauth2/auth?client_id=".urlencode($CLIENT_ID)
."&redirect_uri=".urlencode($REDIRECT_URI)
."&response_type=code&scope=".urlencode("https://mail.google.com/ openid
email profile")
."&access_type=offline&prompt=consent";
?>
<a class="btn" href="<?=$loginUrl?>">Add Account</a>
</div>
</div>

<div class="container">

<nav class="folder-menu" aria-label="Mail folders">


<?php foreach($allowed_labels as $key => $name): ?>
<a href="?label=<?=$key?>" class="<?=($key === $label) ? "active" :
""?>"><?=htmlspecialchars($name)?></a>
<?php endforeach; ?>
</nav>

<?php if(empty($rows)): ?>


<div class="card">No messages found in
<?=htmlspecialchars($allowed_labels[$label])?>.</div>
<?php else: ?>
<?php foreach($rows as $r): ?>
<div class="card">
<div class="from"><?=htmlspecialchars($r["from"])?></div>
<div class="subj"><?=htmlspecialchars($r["subject"])?></div>
<div class="meta"><?=htmlspecialchars($r["date"])?></div>
<div class="small"><?=htmlspecialchars($r["snippet"])?></div>
<div class="actions" style="margin-top:8px">
<a class="btn"
href="message.php?id=<?=urlencode($r['id'])?>">Open</a>
<form action="reply.php" method="post" style="display:inline">
<input type="hidden" name="id"
value="<?=htmlspecialchars($r['id'])?>"/>
<input type="hidden" name="account"
value="<?=htmlspecialchars($active)?>"/>
<button class="btn" type="submit" name="quick" value="1">Quick
Reply</button>
</form>
<form action="delete.php" method="post" style="display:inline"
onsubmit="return confirm('Delete this message?')">
<input type="hidden" name="id"
value="<?=htmlspecialchars($r['id'])?>"/>
<button class="btn btn-danger" type="submit">Delete</button>
</form>
<form action="spam.php" method="post" style="display:inline"
onsubmit="return confirm('Report spam?')">
<input type="hidden" name="id"
value="<?=htmlspecialchars($r['id'])?>"/>
<button class="btn btn-danger" type="submit">Spam</button>
</form>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>

<div class="pager">
<?php if($nextPage): ?>
<a class="btn"
href="?label=<?=urlencode($label)?>&pageToken=<?=urlencode($nextPage)?>">Next
&raquo;</a>
<?php endif; ?>
</div>
</div>

🔔 New mail received</div>


<div class="notice" id="ntf">

<script>
// 10s poll for new mail
let lastIds = [];
async function checkNew(){
try{
const r = await fetch('?ajax=latest');
const j = await r.json();
if(!j.ok || !j.ids) return;
if(lastIds.length && j.ids[0] && lastIds[0] && j.ids[0] !== lastIds[0]){
const n = document.getElementById('ntf'); n.style.display='block';
setTimeout(()=>location.reload(), 1200);
}
lastIds = j.ids;
}catch(e){}
}
checkNew();
setInterval(checkNew, 10000);
</script>

<!--✅ Added footer with policy links -->


<footer style="margin-top:40px;text-align:center;font-size:.9em;color:#666;">
<a href="privacy.html">Privacy Policy</a> | <a href="terms.html">Terms of
Service</a>
</footer>

</body>
</html>

You might also like