Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F804574
do_send.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 1:49 PM
Size
8 KB
Mime Type
text/x-php
Expires
Fri, Feb 28, 1:49 PM (21 h, 23 m)
Engine
blob
Format
Raw Data
Handle
577076
Attached To
rINP In-Portal
do_send.php
View Options
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
// new startup: begin
define
(
'REL_PATH'
,
'admin/email'
);
$relation_level
=
count
(
explode
(
'/'
,
REL_PATH
)
);
define
(
'FULL_PATH'
,
realpath
(
dirname
(
__FILE__
)
.
str_repeat
(
'/..'
,
$relation_level
)
)
);
require_once
FULL_PATH
.
'/kernel/startup.php'
;
// new startup: end
$pathtolocal
=
$pathtoroot
.
"kernel/"
;
require_once
(
$pathtoroot
.
$admin
.
"/include/elements.php"
);
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once
(
$pathtolocal
.
"admin/include/navmenu.php"
);
require_once
(
$pathtoroot
.
$admin
.
"/browse/toolbar.php"
);
//Set Section
$section
=
'in-portal:sendmail'
;
//Set Environment Variable
$envar
=
"env="
.
BuildEnv
();
$State
=
$_POST
[
"EmailState"
];
if
(!
strlen
(
$State
))
{
$State
=
$_GET
[
"EmailState"
];
}
$ado
=
&
GetADODBConnection
();
$table
=
"ses_"
.
$objSession
->
GetSessionKey
().
"_sendmail"
;
$MessagesPerPage
=
2
;
$SendQueue
=
new
clsEmailQueue
(
$table
,
$MessagesPerPage
);
$FromUser
=
$objUsers
->
GetItem
(
$objSession
->
Get
(
"PortalUserId"
));
$FromAddr
=
$FromUser
->
Get
(
"Email"
);
$FromName
=
$FromUser
->
Get
(
"FirstName"
).
" "
.
$FromUser
->
Get
(
"LastName"
);
if
(!
strlen
(
trim
(
$FromAddr
)))
{
$FromAddr
=
$objConfig
->
Get
(
"Smtp_AdminMailFrom"
);
}
if
(!
strlen
(
trim
(
$FromName
)))
{
$FromName
=
"System Administrator"
;
}
$TargetURL
=
$_SERVER
[
"PHP_SELF"
].
"?"
.
$envar
.
'&destform=popup'
;
$CancelURL
=
$TargetURL
.
"&EmailState=email_user_cancel"
;
/*Initialize page*/
switch
(
$State
)
{
case
"email_single_send"
:
/*single user send */
$PageTitle
=
admin_language
(
"la_Title_SendInit"
);
$Subject
=
$_POST
[
"subject"
];
$Html
=
$_POST
[
"messageHTML"
];
$Text
=
strip_tags
(
$_POST
[
"messageTEXT"
]);
if
(
is_array
(
$_FILES
))
{
$attatch
=
$_FILES
[
"attatchment"
];
if
(
strlen
(
$attatch
[
"name"
])
>
0
&&
$attatch
[
"size"
]>
0
)
{
$FileName
=
$attatch
[
"name"
];
$FileLoc
=
$attatch
[
"tmp_name"
];
}
else
{
$FileName
=
NULL
;
$FileLoc
=
NULL
;
}
}
else
{
$FileName
=
NULL
;
$FileLoc
=
NULL
;
}
$charset
=
""
;
$TargetURL
.=
"&EmailState=email_send_complete"
;
break
;
case
"email_multi_send"
:
/*Init multiuser send*/
$UserList
=
explode
(
","
,
$_POST
[
"sendaddrs"
]);
//echo $_POST["sendaddrs"]."<br>\n";
$Subject
=
$_POST
[
"subject"
];
$Html
=
$_POST
[
"messageHTML"
];
$Text
=
strip_tags
(
$_POST
[
"messageTEXT"
]);
if
(
is_array
(
$_FILES
))
{
$attatch
=
$_FILES
[
"attatchment"
];
if
(
strlen
(
$attatch
[
"name"
])
>
0
&&
$attatch
[
"size"
]>
0
)
{
$FileName
=
$attatch
[
"name"
];
$FileLoc
=
$attatch
[
"tmp_name"
];
}
else
{
$FileName
=
NULL
;
$FileLoc
=
NULL
;
}
}
else
{
$FileName
=
NULL
;
$FileLoc
=
NULL
;
}
$charset
=
""
;
$PageTitle
=
admin_language
(
"la_Title_SendMailInit"
);
$TargetURL
.=
"&EmailState=email_send_progress&Start=0&Total="
.
count
(
$UserList
);
break
;
case
"email_send_progress"
:
$total
=
$_GET
[
"Total"
];
$start
=
$_GET
[
"Start"
];
if
(
$start
<
$total
)
{
$pct
=
(
int
)((
$start
/
$total
)*
100
);
$NewStart
=
$start
+
$MessagesPerPage
;
$TargetURL
.=
"&EmailState=email_send_progress&Start=$NewStart&Total=$total"
;
$PageTitle
=
admin_language
(
"la_Title_SendMailProgress"
).
" - "
.
$pct
.
"% "
.
admin_language
(
"la_Text_Complete"
);
}
else
{
$PageTitle
=
admin_language
(
"la_Title_SendMailProgress"
);
$TargetURL
.=
"&EmailState=email_send_complete"
;
}
break
;
case
"email_send_complete"
:
$PageTitle
=
admin_language
(
"la_Title_SendMailComplete"
);
$TargetURL
=
""
;
break
;
case
"email_user_cancel"
:
$PageTitle
=
admin_language
(
"la_Title_SendMailCancel"
);
$TargetURL
=
""
;
break
;
}
int_header
(
NULL
,
NULL
,
admin_language
(
"la_Title_PleaseWait"
));
echo
"
\n
"
;
/*do page functions */
// echo "Current State:". $State."<br>\n";
echo
"<TABLE border=0 width=
\"
100%
\"
height=
\"
90%
\"
><TR><TD valign=
\"
top
\"
align=
\"
middle
\"
>"
;
switch
(
$State
)
{
case
"email_single_send"
:
/*single user send */
$PageTitle
=
admin_language
(
$Pagetitle
);
$ToAddr
=
$_POST
[
"sendaddrs"
];
$SendQueue
->
SendMail
(
$FromAddr
,
$FromName
,
$ToAddr
,
""
,
$Subject
,
$Text
,
$Html
,
$charset
,
""
,
$FileName
,
$FileLoc
,
0
,
NULL
);
$o
=
"<TABLE CLASS=
\"
tableborder_full
\"
width=
\"
75%
\"
>"
;
$o
.=
int_subsection_title_ret
(
$PageTitle
);
$o
.=
"<TD COLSPAN=2>"
.
admin_language
(
"la_prompt_EmailInitMessage"
).
"</TD></TR>"
;
$o
.=
"<TD ALIGN=
\"
middle
\"
COLSPAN=2></TD></TR>"
;
$o
.=
"</TABLE><input type=button CLASS=
\"
button
\"
VALUE=
\"
"
.
admin_language
(
"la_Cancel"
).
"
\"
ONCLICK=
\"
document.location='"
.
$CancelURL
.
"';
\"
>"
;
echo
$o
.
"
\n
"
;
break
;
case
"email_multi_send"
:
/*Init multiuser send*/
/*Create storage Table for Queue */
$o
=
"<TABLE CLASS=
\"
tableborder_full
\"
width=
\"
75%
\"
>"
;
$o
.=
int_subsection_title_ret
(
$PageTitle
);
$o
.=
"<tr><TD COLSPAN=2>"
.
admin_language
(
"la_prompt_EmailInitMessage"
).
"</TD></TR>"
;
$o
.=
"<TD ALIGN=
\"
middle
\"
COLSPAN=2></TD></TR>"
;
$o
.=
"</TABLE><input type=button CLASS=
\"
button
\"
VALUE=
\"
"
.
admin_language
(
"la_Cancel"
).
"
\"
ONCLICK=
\"
document.location='"
.
$CancelURL
.
"';
\"
>"
;
echo
$o
.
"
\n
"
;
$sql
=
"CREATE TABLE $table SELECT * FROM "
.
$objEmailQueue
->
SourceTable
.
" WHERE queued=99"
;
$ado
->
Execute
(
$sql
);
//echo $sql."<br>\n";
for
(
$i
=
0
;
$i
<
count
(
$UserList
);
$i
++)
{
$ToAddr
=
$UserList
[
$i
];
//$From,$FromName,$To,$ToName,$Subject,$Text,$Html,$charset,$AttmFiles,$QueueOnly=0
$SendQueue
->
SendMail
(
$FromAddr
,
$FromName
,
$ToAddr
,
""
,
$Subject
,
$Text
,
$Html
,
$charset
,
""
,
$FileName
,
$FileLoc
,
1
,
NULL
);
}
break
;
case
"email_send_progress"
:
$sql
=
"SELECT * FROM $table LIMIT $start,"
.
$MessagesPerPage
;
// echo $sql."<br>\n";
$rs
=
$ado
->
Execute
(
$sql
);
while
(
$rs
&&
!
$rs
->
EOF
)
{
$data
=
$rs
->
fields
;
$SendQueue
->
DeliverMail
(
$data
[
"toaddr"
],
$data
[
"fromaddr"
],
$data
[
"Subject"
],
$data
[
"message"
],
$data
[
"headers"
],
1
);
$rs
->
MoveNext
();
}
$o
=
"<TABLE CLASS=
\"
tableborder_full
\"
width=
\"
75%
\"
>"
;
$o
.=
int_subsection_title_ret
(
$PageTitle
);
$o
.=
"<TR border=1><TD width=
\"
"
.
$pct
.
"%
\"
STYLE=
\"
background:url('"
.
$adminURL
.
"/images/progress_bar_segment.gif');
\"
> </TD>"
;
$comp_pct
=
100
-
$pct
;
$o
.=
"<TD bgcolor=#FFFFFF width=
\"
"
.
$comp_pct
.
"%
\"
></TD></TR>"
;
$o
.=
"</TABLE>"
;
$o
.=
"<input type=button VALUE=
\"
"
.
admin_language
(
"la_Cancel"
).
"
\"
CLASS=
\"
button
\"
ONCLICK=
\"
document.location='"
.
$CancelURL
.
"';
\"
>"
;
echo
$o
.
"
\n
"
;
break
;
case
"email_send_complete"
:
$sql
=
"DROP TABLE IF EXISTS $table"
;
$ado
->
Execute
(
$sql
);
$o
=
"<TABLE CLASS=
\"
tableborder_full
\"
width=
\"
75%
\"
>"
;
$o
.=
int_subsection_title_ret
(
$PageTitle
);
$o
.=
"<TR><TD COLSPAN=2>"
.
admin_language
(
"la_prompt_EmailCompleteMessage"
).
"</TD></TR>"
;
$o
.=
"<TD ALIGN=
\"
middle
\"
COLSPAN=2></TD></TR>"
;
$o
.=
"</TABLE><input type=button VALUE=
\"
"
.
admin_language
(
"la_Close"
).
"
\"
CLASS=
\"
button
\"
ONCLICK=
\"
window.close();
\"
>"
;
echo
$o
.
"
\n
"
;
break
;
case
"email_user_cancel"
:
$o
=
"<TABLE CLASS=
\"
tableborder_full
\"
width=
\"
75%
\"
>"
;
$o
.=
int_subsection_title_ret
(
$PageTitle
);
$o
.=
"<TR><TD COLSPAN=2>"
.
admin_language
(
"la_prompt_EmailCancelMessage"
).
"</TD></TR>"
;
$o
.=
"</TABLE><input type=button VALUE=
\"
"
.
admin_language
(
"la_Close"
).
"
\"
CLASS=
\"
button
\"
ONCLICK=
\"
window.close();
\"
>"
;
echo
$o
.
"
\n
"
;
break
;
}
echo
"</TD></TR></TABLE>"
;
if
(
strlen
(
$TargetURL
))
{
?>
<SCRIPT LANGUAGE="JavaScript">
document.location = '
<?php
echo
$TargetURL
;
?>
';
</SCRIPT>
<?php
}
?>
<?php
int_footer
();
?>
Event Timeline
Log In to Comment