diff --git a/mail/convo.php b/mail/convo.php new file mode 100644 index 0000000..9b9ecfe --- /dev/null +++ b/mail/convo.php @@ -0,0 +1,134 @@ + + + + + Mail - Misdew + + + + + + + "; + } + if($css_type == "raw") { + echo ""; + } + ?> + + + + + + + + + +
+ +
+ + + + + + +
+ Messages + + Members + + Settings +
+

+ +
+ +
+ +
+ + + diff --git a/mail/convo_create.php b/mail/convo_create.php new file mode 100644 index 0000000..6cf98b0 --- /dev/null +++ b/mail/convo_create.php @@ -0,0 +1,59 @@ + diff --git a/mail/convo_members.php b/mail/convo_members.php new file mode 100644 index 0000000..273fddb --- /dev/null +++ b/mail/convo_members.php @@ -0,0 +1,159 @@ +
You do not belong to this conversation.

"; + exit(); +} +$cvo_rw = mysqli_fetch_array($cvo_slc); +$cvo_rank = $cvo_rw['rank']; +$cva_s = mysqli_query($conx, "SELECT can_add FROM mail_convo WHERE uqid='$cv_uqid'"); +$cva_r = mysqli_fetch_array($cva_s); +$cvo_cadd = $cva_r['can_add']; + +if($cvo_cadd == 'yes') { + echo "
+ +
+
+
+

"; +} +?> +"; + } + else { + $verif_check = ""; + } + // + // DATA SAVER + if($u_datasaver == 'on' && $mmb_uid != $u_uid) { + $mmb_picture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAACklEQVR4AWNoAAAAggCBTBfX3wAAAABJRU5ErkJggg=="; + } + // DATA SAVER + // + } + $usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$mmb_uid' && theme_id='$g_themeid'"); + while($usri_r = mysqli_fetch_assoc($usri_q)) { + $username_color = $usri_r['username_color']; + $chat_tcolor = $usri_r['text_color']; + } + $HUAHHH = time() - $chat_time; + $mens = round($HUAHHH / 60); + if($mens <= 1) { + $cv_activeness = "#00FF00"; + } + elseif($mens <= 2) { + $cv_activeness = "#FFA500"; + } + elseif($mens < 5) { + $cv_activeness = "#FF0000"; + } + else { + $cv_activeness = "#FF0000"; + } + echo "
+ + + + + + +
+
+
+
+ +
+ $mmb_username $verif_check + "; + if($cvo_rank == 'admin') { + echo ""; + } + elseif($mmb_username == $u_username) { + echo ""; + } + else { + echo ""; + } + echo "
+
"; + + /* + echo "
+ + + + + + +
+ \"\" + + $mmb_username + +   "; + if($cvo_rank == 'admin') { + echo ""; + } + elseif($mmb_username == $u_username) { + echo ""; + } + else { + echo ""; + } + echo "
+
";*/ +} +?> + diff --git a/mail/convo_messages.php b/mail/convo_messages.php new file mode 100644 index 0000000..18eae26 --- /dev/null +++ b/mail/convo_messages.php @@ -0,0 +1,105 @@ +
You do not belong to this conversation.

"; + exit(); +} +?> +
+
+ + + + +
+
+ +
+ +
+ + diff --git a/mail/convo_msgs.php b/mail/convo_msgs.php new file mode 100644 index 0000000..10285aa --- /dev/null +++ b/mail/convo_msgs.php @@ -0,0 +1,115 @@ +
You do not belong to this conversation.

"); + exit(); +} +mysqli_query($conx, "UPDATE mail_memb SET latest_read='yes' WHERE uqid='$cv_uqid' && uid='$u_uid'"); +mysqli_query($conx, "UPDATE mail_memb SET sent='no' WHERE uqid='$cv_uqid' && uid='$u_uid'"); +$chat_q = mysqli_query($conx, "SELECT id,uid_from,message,timestamp,display_name,mtype,imgurl FROM mail WHERE uqid='$cv_uqid' ORDER BY id DESC LIMIT 75"); +while($chat_r = mysqli_fetch_assoc($chat_q)) { + $chat_id = $chat_r['id']; + $chat_uid = $chat_r['uid_from']; + $string = $chat_r['message']; + $chat_tstamp = $chat_r['timestamp']; + $msg_type = $chat_r['msgtype']; + $displayname = $chat_r['display_name']; + $mtype = $chat_r['mtype']; + $c_imgurl = $chat_r['imgurl']; + include("../inc/replace.php"); + $usr_q = mysqli_query($conx, "SELECT username,md_verf FROM accounts WHERE uid='$chat_uid'"); + while($usr_r = mysqli_fetch_assoc($usr_q)) { + $chat_username = $usr_r['username']; + $chat_verif = $usr_r['md_verf']; + if($chat_verif == 'yes') { + $verif_check = " "; + } + else { + $verif_check = ""; + } + $usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$chat_uid' && theme_id='$g_themeid'"); + while($usri_r = mysqli_fetch_assoc($usri_q)) { + $username_color = $usri_r['username_color']; + $chat_tcolor = $usri_r['text_color']; + } + } + if($chat_username == $u_username) { + if($displayname == 'no') { + $chat_username = ""; + $verif_check = ""; + } + echo "
$chat_username$verif_check
"; + // if message is an image + if($mtype == 'img') { + // + // Data Saver + if($u_datasaver == 'on') { + echo "
[view image]
"; + } + else { + echo "
\"\"
"; + } + // Data Saver + // + } + // if message is normal + else { + echo "
" . $string . "
"; + } + echo ""; + if($mtype == 'img') { + echo "
view image
"; + echo "sent "; echo timeago($chat_tstamp); echo " ago
"; + } + else { + echo "sent "; echo timeago($chat_tstamp); echo " ago"; + } + } + else { + if($displayname == 'no') { + $chat_username = ""; + $verif_check = ""; + } + echo "
$chat_username$verif_check
"; + // if message is an image + if($mtype == 'img') { + // + // Data Saver + if($u_datasaver == 'on') { + echo "
[view image]
"; + } + else { + echo "
\"\"
"; + } + // Data Saver + // + } + // if message is normal + else { + echo "
" . $string . "
"; + } + echo ""; + if($mtype == 'img') { + echo "
view image
"; + echo "sent "; echo timeago($chat_tstamp); echo " ago
"; + } + else { + echo "sent "; echo timeago($chat_tstamp); echo " ago"; + } + } +} +?> + diff --git a/mail/convo_settings.php b/mail/convo_settings.php new file mode 100644 index 0000000..e206705 --- /dev/null +++ b/mail/convo_settings.php @@ -0,0 +1,137 @@ +
You do not belong to this conversation.

"; + exit(); +} +$cvo_rw = mysqli_fetch_array($cvo_slc); +$cvo_rank = $cvo_rw['rank']; +$cv_sel = mysqli_query($conx, "SELECT name,picture,main_color,main_color,can_add FROM mail_convo WHERE uqid='$cv_uqid'"); +$cv_row = mysqli_fetch_assoc($cv_sel); +$string = $cv_row['name']; +$cv_name = $cv_row['name']; +$cv_pic = $cv_row['picture']; +$cv_color = $cv_row['main_color']; +$can_add = $cv_row['can_add']; +include("../inc/replace.php"); +if($can_add == 'yes') { + $yes_add = " selected"; +} +else { + $no_add = " selected"; +} +echo "
no changes detected
"; +echo "
$string
\"\"
"; +if($cvo_rank == 'admin') { + echo "
+
Admin
+ + +
+ +
+
"; +} +echo "
+
Preferences
+Name
+ +Picture
Select a Photo
+
+ +
+Color
+ +
"; +echo "
hit enter to ensure save
all fields required to function
emoji in name → tap settings to see
"; +?> + diff --git a/mail/convo_settings_save.php b/mail/convo_settings_save.php new file mode 100644 index 0000000..6fe8789 --- /dev/null +++ b/mail/convo_settings_save.php @@ -0,0 +1,26 @@ +
You do not belong to this conversation.

"; + exit(); +} +$cvo_rw = mysqli_fetch_array($cvo_slc); +$cvo_rank = $cvo_rw['rank']; +if($cvo_rank == 'admin') { + if($memb_add) { + if($memb_add == 'yes' OR $memb_add == 'no') { + mysqli_query($conx, "UPDATE mail_convo SET can_add='$memb_add' WHERE uqid='$cv_uqid'"); + } + } +} +if($cv_name) { + mysqli_query($conx, "UPDATE mail_convo SET name='$cv_name' WHERE uqid='$cv_uqid'"); +} +if($cv_color) { + mysqli_query($conx, "UPDATE mail_convo SET main_color='$cv_color' WHERE uqid='$cv_uqid'"); +} +?> diff --git a/mail/enc-test.php b/mail/enc-test.php new file mode 100644 index 0000000..a4ff81e --- /dev/null +++ b/mail/enc-test.php @@ -0,0 +1,64 @@ +
"; + } + if($enc_txt != '') { + echo "string: "; + echo encrypt_decrypt("encrypt","$enc_txt","$gensecret_key","$gensecret_iv"); + echo "
"; + echo "key #1: $gensecret_key"; + + echo "
"; + echo "key #2: $gensecret_iv"; + echo "

"; + + } +?> +
+ decrypt a message:
+
+
+
+ +
+
+
+ encrypt a message:
+
+ +
diff --git a/mail/exit.php b/mail/exit.php new file mode 100644 index 0000000..f1f8ee8 --- /dev/null +++ b/mail/exit.php @@ -0,0 +1,53 @@ + diff --git a/mail/friends.php b/mail/friends.php new file mode 100644 index 0000000..7508d33 --- /dev/null +++ b/mail/friends.php @@ -0,0 +1,140 @@ +
+ +
+
+ + + + + +
+
No friends.

+
+ "; +} +while($f_r = mysqli_fetch_assoc($f_q)) { + $fuid_rec = $f_r['uid_rec']; + $fusr_q = mysqli_query($conx, "SELECT username,picture,online_time,md_verf FROM accounts WHERE uid='$fuid_rec'"); + while($fusr_r = mysqli_fetch_assoc($fusr_q)) { + $f_username = $fusr_r['username']; + $f_picture = $fusr_r['picture']; + $fonline_time = $fusr_r['online_time']; + $f_verf = $fusr_r['md_verf']; + if($f_verf == 'yes') { + $verif_check = ""; + } + else { + $verif_check = ""; + } + // + // DATA SAVER + if($u_datasaver == 'on') { + $f_picture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAACklEQVR4AWNoAAAAggCBTBfX3wAAAABJRU5ErkJggg=="; + } + // DATA SAVER + // + } + $usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$fuid_rec' && theme_id='$g_themeid'"); + while($usri_r = mysqli_fetch_assoc($usri_q)) { + $username_color = $usri_r['username_color']; + $chat_tcolor = $usri_r['text_color']; + } + $HUAHHH = time() - $fonline_time; + $mens = round($HUAHHH / 60); + if($mens <= 1) { + $cv_activeness = "#00FF00"; + } + elseif($mens <= 2) { + $cv_activeness = "#FFA500"; + } + elseif($mens < 5) { + $cv_activeness = "#FF0000"; + } + else { + $cv_activeness = "#FF0000"; + } + if($fr_ct > 0) { + echo "
+ + + + + + +
+
+
+
+ +
+ $f_username $verif_check + + +
+
"; + /*echo "
+ + + + + + +
+ \"\" + + $f_username + +    + +
+
";*/ + } +} +?> + diff --git a/mail/friends_search_results.php b/mail/friends_search_results.php new file mode 100644 index 0000000..77ae509 --- /dev/null +++ b/mail/friends_search_results.php @@ -0,0 +1,80 @@ +no results"; + } + while($search_r = mysqli_fetch_assoc($search_q)) { + $s_uid = $search_r['uid']; + $s_username = $search_r['username']; + $s_whocan = $search_r['who_can_mail']; + $s_verf = $search_r['md_verf']; + if($s_verf == 'yes') { + $verif_check = " "; + } + else { + $verif_check = ""; + } + $usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$s_uid' && theme_id='$g_themeid'"); + while($usri_r = mysqli_fetch_assoc($usri_q)) { + $username_color = $usri_r['username_color']; + $chat_tcolor = $usri_r['text_color']; + } + if($s_uid == $u_uid) { + echo "$s_username$verif_check "; + echo "• you"; + } + else { + if($s_whocan == 'nobody') { + echo "$s_username$verif_check "; + echo "• unavailable"; + } + if($s_whocan == 'friends') { + $f_q = mysqli_query($conx, "SELECT uid_rec FROM friends WHERE uid_req='$u_uid' AND uid_rec='$s_uid' AND accepted='yes' ORDER BY id DESC"); + $fr_ct = mysqli_num_rows($f_q); + if($fr_ct != '0') { + echo "$s_username$verif_check "; + echo "• available"; + } + else { + echo "$s_username$verif_check "; + echo "• unavailable"; + } + } + if($s_whocan == 'anyone') { + echo "$s_username$verif_check "; + echo "• available"; + } + } + echo "
"; + } +} +?> + diff --git a/mail/img_upload.php b/mail/img_upload.php new file mode 100644 index 0000000..919b10b --- /dev/null +++ b/mail/img_upload.php @@ -0,0 +1,54 @@ + base64_encode($data), + 'key' => urlencode($required_key), + 'user' => urlencode($u_uid), + 'imagetype' => urlencode($u_uid), + 'imaeg' => urlencode($u_cloudterms), + 'fieltyp' => urlencode($u_cloudterms), + 'usernaem' => urlencode($u_username), + 'filextension' => urlencode($u_username), + 'uvia' => urlencode($uploc) + ); + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, 'https://upl.justa.us/image.php'); + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA); + $url = curl_exec($curl); + if($url!=""){ + $disq = mysqli_query($conx, "SELECT id,uid_from FROM mail ORDER BY id DESC LIMIT 1"); + $disr = mysqli_fetch_assoc($disq); + $dis_id = $disr['id']; + $dis_uid = $disr['uid_from']; + if($dis_uid == $u_uid) { + if($msgtype != 'pm') { + mysqli_query($conx, "UPDATE mail SET display_name='no' WHERE id='$dis_id'"); + } + } + mysqli_query($conx, "INSERT INTO mail (uqid, uid_from, message, timestamp, mtype, imgurl) VALUES ('$cv_uqid','$u_uid', '$url', '$tstamp','img','$url')"); + mysqli_query($conx, "UPDATE mail_memb SET last_active='$tstamp' WHERE uqid='$cv_uqid'"); + } + else { + // there was an error uploading the image + } + curl_close ($curl); +} +?> diff --git a/mail/index.php b/mail/index.php index 8b13789..5c6f1ef 100644 --- a/mail/index.php +++ b/mail/index.php @@ -1 +1,119 @@ - + + + + + Mail - Misdew + + + + + + + "; + } + if($css_type == "raw") { + echo ""; + } + ?> + + + + + +
+ +
+ + + + + + +
+ Messages + + Friends + + Settings +
+

+ +
+ +
+ "; + echo "Mail is not private or secure. Your messages can/may be read at any time.
They are stored in plaintext on our server.
"; + require_once("../inc/footer.php"); + ?> +
+ + + + diff --git a/mail/members_add.php b/mail/members_add.php new file mode 100644 index 0000000..c171456 --- /dev/null +++ b/mail/members_add.php @@ -0,0 +1,42 @@ +$u_username added you to a conversation.','/mail/convo.php?i=$cv_uqid','$tstamp')"); + } +} +// The member does not meet any of the above checks. +else { + echo "You do not belong to this conversation."; + exit(); +} +?> diff --git a/mail/members_search_results.php b/mail/members_search_results.php new file mode 100644 index 0000000..b6d6bc2 --- /dev/null +++ b/mail/members_search_results.php @@ -0,0 +1,81 @@ +no results"; + } + while($search_r = mysqli_fetch_assoc($search_q)) { + $s_uid = $search_r['uid']; + $s_username = $search_r['username']; + $s_whocan = $search_r['who_can_mail']; + $s_verf = $search_r['md_verf']; + if($s_verf == 'yes') { + $verif_check = " "; + } + else { + $verif_check = ""; + } + $usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$s_uid' && theme_id='$g_themeid'"); + while($usri_r = mysqli_fetch_assoc($usri_q)) { + $username_color = $usri_r['username_color']; + $chat_tcolor = $usri_r['text_color']; + } + if($s_uid == $u_uid) { + echo "$s_username$verif_check "; + echo "• you"; + } + else { + if($s_whocan == 'nobody') { + echo "$s_username$verif_check "; + echo "• unavailable"; + } + if($s_whocan == 'friends') { + $f_q = mysqli_query($conx, "SELECT uid_rec FROM friends WHERE uid_req='$u_uid' AND uid_rec='$s_uid' AND accepted='yes' ORDER BY id DESC"); + $fr_ct = mysqli_num_rows($f_q); + if($fr_ct != '0') { + echo "$s_username$verif_check "; + echo "• available"; + } + else { + echo "$s_username$verif_check "; + echo "• unavailable"; + } + } + if($s_whocan == 'anyone') { + echo "$s_username $verif_check "; + echo "• available"; + } + } + echo "
"; + } +} +?> + diff --git a/mail/messages.php b/mail/messages.php new file mode 100644 index 0000000..5f27a10 --- /dev/null +++ b/mail/messages.php @@ -0,0 +1,97 @@ +
No conversations.
Create


"; +} +while($m_crow = mysqli_fetch_assoc($m_csel)) { + $m_id = $m_crow['id']; + $m_cuqid = $m_crow['uqid']; + $m_last_active = $m_crow['last_active']; + // What exactly are these conversations? + $cv_sel = mysqli_query($conx, "SELECT name,picture,main_color,main_color FROM mail_convo WHERE uqid='$m_cuqid'"); + while($cv_row = mysqli_fetch_assoc($cv_sel)) { + $string = $cv_row['name']; + $cv_pic = $cv_row['picture']; + $cv_color = $cv_row['main_color']; + // + // DATA SAVER + if($u_datasaver == 'on') { + $cv_pic = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAACklEQVR4AWNoAAAAggCBTBfX3wAAAABJRU5ErkJggg=="; + } + // DATA SAVER + // + include("../inc/replace.php"); + echo "
+ + + + + + +
+ \"\" + + $string + + "; + echo timeago($m_last_active); + echo "   +
+ + + + +
"; + // Latest message in this conversation? + $msg_sel = mysqli_query($conx, "SELECT uid_from,message FROM mail WHERE uqid='$m_cuqid' ORDER BY id DESC LIMIT 1"); + while($msg_row = mysqli_fetch_assoc($msg_sel)) { + $msg_from = $msg_row['uid_from']; + $string = trim(substr($msg_row['message'],0,30)); + include("../inc/replace.php"); + // Latest message is from...? + $u_sel = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$msg_from'"); + while($u_row = mysqli_fetch_assoc($u_sel)) { + $msg_from = $u_row['username']; + if($msg_from == $u_username) { + $msg_from = "You"; + } + } + echo "$msg_from: $string"; + if(strlen($msg_row['message']) > 30) { + echo ".."; + } + } + echo "
+
"; + } +} +?> + diff --git a/mail/online.php b/mail/online.php new file mode 100644 index 0000000..d837b0b --- /dev/null +++ b/mail/online.php @@ -0,0 +1,65 @@ += $new ORDER BY uid"); +$l_cnt = mysqli_num_rows($sc_onl); +$onlci = mysqli_query($conx, "SELECT timestamp FROM mail WHERE uqid='$cv_uqid' ORDER BY id DESC LIMIT 1"); +$cironl = mysqli_fetch_assoc($onlci); +$chatac = $cironl['timestamp']; + +$HUAHHH = time() - $chatac; +$mens = round($HUAHHH / 60); +if($mens <= 1) { +echo " $l_cnt online.
"; +} +elseif($mens <= 2) { + echo " $l_cnt online.
"; +} +elseif($mens < 5) { + echo " $l_cnt online.
"; +} +else { + echo " $l_cnt online.
"; +} +?> + + "; + } + else { + $verif_check = ""; + } + } + // math stuff for time ago function + $differ = time() - $online_time; + $mins = round($differ / 60); + + // if active, display them + if ($mins < .30) { + echo $separator; + echo "$online_username $verif_check"; + if (!$separator) $separator = ', '; + } +} +?> diff --git a/mail/online_upd.php b/mail/online_upd.php new file mode 100644 index 0000000..d12589a --- /dev/null +++ b/mail/online_upd.php @@ -0,0 +1,16 @@ + diff --git a/mail/picture_upl.php b/mail/picture_upl.php new file mode 100644 index 0000000..bf761e2 --- /dev/null +++ b/mail/picture_upl.php @@ -0,0 +1,35 @@ + base64_encode($data), + 'key' => urlencode($required_key), + 'user' => urlencode($u_uid), + 'imagetype' => urlencode($u_uid), + 'imaeg' => urlencode($u_cloudterms), + 'fieltyp' => urlencode($u_cloudterms), + 'usernaem' => urlencode($u_username), + 'filextension' => urlencode($u_username), + 'uvia' => urlencode($uploc) + ); + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, 'https://upl.justa.us/image.php'); + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA); + $url = curl_exec($curl); + mysqli_query($conx, "UPDATE mail_convo SET picture='$url' WHERE uqid='$cv_uqid'"); + echo trim($url); + curl_close ($curl); +} +?> diff --git a/mail/send.php b/mail/send.php new file mode 100644 index 0000000..3648c7b --- /dev/null +++ b/mail/send.php @@ -0,0 +1,44 @@ + diff --git a/mail/settings.php b/mail/settings.php new file mode 100644 index 0000000..d45e3c2 --- /dev/null +++ b/mail/settings.php @@ -0,0 +1,96 @@ + +
no changes detected
+
+ + + + +
+ Preferences +
+ + + + +
+ Availability
+ +
+ + + + +
+ New Conversations
+ +
+
+ + diff --git a/mail/settings_save.php b/mail/settings_save.php new file mode 100644 index 0000000..53b3f24 --- /dev/null +++ b/mail/settings_save.php @@ -0,0 +1,13 @@ +