[Vtigercrm-commits] [vtiger-commits] r6608 - in /vtigercrm/trunk: index.php modules/Webmails/WebmailsAjax.php modules/Webmails/webmails.js
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Sun May 28 06:35:03 EDT 2006
Author: mmbrich
Date: Sun May 28 04:35:02 2006
New Revision: 6608
Log:
with these changes to index.php you are able to pass real JSON and AJAX objects and still use the security infrastructure. Since AJAX/JSON calls are not displayed directly to the user (and the user is already seeing the copyright notice from the displayed page) this should not present a problem
Modified:
vtigercrm/trunk/index.php
vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
vtigercrm/trunk/modules/Webmails/webmails.js
Modified: vtigercrm/trunk/index.php
==============================================================================
--- vtigercrm/trunk/index.php (original)
+++ vtigercrm/trunk/index.php Sun May 28 04:35:02 2006
@@ -550,7 +550,7 @@
</script>
";
- if($action != "about_us" && $action != "vtchat" && $action != "ChangePassword" && $action != "body")
+ if($action != "about_us" && $action != "vtchat" && $action != "ChangePassword" && $action != "body" && $action != "WebmailsAjax")
{
echo $copyrightstatement;
echo "<script language = 'JavaScript' type='text/javascript' src = 'include/js/popup.js'></script>";
Modified: vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/WebmailsAjax.php (original)
+++ vtigercrm/trunk/modules/Webmails/WebmailsAjax.php Sun May 28 04:35:02 2006
@@ -8,37 +8,30 @@
* All Rights Reserved.
*
********************************************************************************/
+require_once('include/database/PearDatabase.php');
+require_once('include/logging.php');
+require_once('include/utils/utils.php');
+require_once('include/utils/UserInfoUtil.php');
+require_once('modules/Webmails/MailParse.php');
-session_start();
-if(!isset($_SESSION["authenticated_user_id"]) || $_SESSION["authenticated_user_id"] == "") {exit();}
+global $adb,$mbox,$current_user;
-if($_POST["command"] == "check_mbox") {
+$sql = "select * from mail_accounts where status=1 and user_id='".$_SESSION["authenticated_user_id"]."'";
+$mailInfo = $adb->query($sql);
- ini_set("include_path","../../");
- require_once('config.php');
- require_once('include/database/PearDatabase.php');
- require_once('include/logging.php');
- require_once('include/utils/utils.php');
- require_once('include/utils/UserInfoUtil.php');
- require_once('modules/Webmails/MailParse.php');
+if($adb->num_rows($mailInfo) < 1) {
+ echo "<center><font color='red'><h3>Please configure your mail settings</h3></font></center>";
+ exit();
+}
- global $adb,$mbox,$current_user;
+$temprow = $adb->fetch_array($mailInfo);
+$imapServerAddress=$temprow["mail_servername"];
+$box_refresh=$temprow["box_refresh"];
+$mails_per_page=$temprow["mails_per_page"];
+$account_name=$temprow["account_name"];
+$show_hidden=$_REQUEST["show_hidden"];
- $sql = "select * from mail_accounts where status=1 and user_id='".$_SESSION["authenticated_user_id"]."'";
- $mailInfo = $adb->query($sql);
-
- if($adb->num_rows($mailInfo) < 1) {
- echo "<center><font color='red'><h3>Please configure your mail settings</h3></font></center>";
- exit();
- }
-
- $temprow = $adb->fetch_array($mailInfo);
- $imapServerAddress=$temprow["mail_servername"];
- $box_refresh=$temprow["box_refresh"];
- $mails_per_page=$temprow["mails_per_page"];
- $account_name=$temprow["account_name"];
- $show_hidden=$_REQUEST["show_hidden"];
-
+if($_REQUEST["command"] == "check_mbox") {
$mbox = getImapMbox($mailbox,$temprow);
$search = imap_search($mbox, "NEW ALL");
@@ -74,28 +67,7 @@
flush();
imap_close($mbox);
}
-if($_POST["command"] == "check_mbox_all") {
- ini_set("include_path","../../");
- require_once('config.php');
- require_once('include/database/PearDatabase.php');
- require_once('include/logging.php');
- require_once('include/utils/utils.php');
- require_once('include/utils/UserInfoUtil.php');
- require_once('modules/Webmails/MailParse.php');
-
- global $adb,$mbox,$current_user;
-
- $sql = "select * from mail_accounts where status=1 and user_id='".$_SESSION["authenticated_user_id"]."'";
- $mailInfo = $adb->query($sql);
-
- if($adb->num_rows($mailInfo) < 1) {
- echo "<center><font color='red'><h3>Please configure your mail settings</h3></font></center>";
- exit();
- }
-
- $temprow = $adb->fetch_array($mailInfo);
- $imapServerAddress=$temprow["mail_servername"];
-
+if($_REQUEST["command"] == "check_mbox_all") {
$boxes = array();
$i=0;
foreach ($_SESSION["mailboxes"] as $key => $val) {
Modified: vtigercrm/trunk/modules/Webmails/webmails.js
==============================================================================
--- vtigercrm/trunk/modules/Webmails/webmails.js (original)
+++ vtigercrm/trunk/modules/Webmails/webmails.js Sun May 28 04:35:02 2006
@@ -85,10 +85,10 @@
}
$("status").style.display="block";
new Ajax.Request(
- 'modules/Webmails/WebmailsAjax.php',
+ 'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
- postBody: '&command=check_mbox_all&ajax=true',
+ postBody: 'module=Webmails&action=WebmailsAjax&command=check_mbox_all&ajax=true',
onComplete: function(t) {
//alert(t.responseText);
try {
@@ -117,10 +117,10 @@
}
$("status").style.display="block";
new Ajax.Request(
- 'modules/Webmails/WebmailsAjax.php',
+ 'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
- postBody: 'mailbox='+mbox+'&command=check_mbox&ajax=true',
+ postBody: 'module=Webmails&action=WebmailsAjax&mailbox='+mbox+'&command=check_mbox&ajax=true',
onComplete: function(t) {
try {
var data = eval('(' + t.responseText + ')');
More information about the vtigercrm-commits
mailing list