query($sql); if ($cmd->num_rows) // Existe deja. { $res = $cmd->fetch_array(MYSQLI_BOTH); $idMember = $res['IdMember']; } else { $sql = "insert into members(Email,IP_ADDRESS) values('" . addslashes($email) . "','" . $_SERVER["REMOTE_ADDR"] . "')"; $cmd = $connect->query($sql); $idMember = $connect->insert_id; } if ($_FILES['c_pic']['name']) { $tmp = explode('.', $_FILES['c_pic']['name']); for ($i = 0; $i < sizeof($tmp) - 1; $i++) { if ($i) $imageName .= "."; $imageName = $tmp[$i]; } $extension = $tmp[sizeof($tmp) - 1]; $uploadfile = $PATH . '/' . $GLOBAL_TEMPORARY_UPLOADS_FOLDER . '/' . $idMember . '_avatar.' . $extension; if (move_uploaded_file($_FILES['c_pic']['tmp_name'], $uploadfile)) { $imageFile = file_get_contents($uploadfile); $imgInfos = getimagesize($uploadfile); $size = filesize($uploadfile); $imgSQL = "AvatarName='" . addslashes($_POST['c_name']) . '.' . $extension . "',ImgBin='" . addslashes($imageFile) . "',ImgWidth='" . $imgInfos[0] . "',ImgHeight='" . $imgInfos[1] . "',ImgSize='$size'"; } } $sql = "update members set UrlWebsite='" . addslashes(str_replace('http://', '', $_POST['c_site'])) . "',Name='" . $_POST['c_name'] . "'"; if ($imgSQL) $sql .= ",$imgSQL"; $sql .= " where IdMember='" . $idMember . "'"; $connect->query($sql); unlink($uploadfile); } /* GESTION DES AVATARS */ $sql = "insert into comments(IP_ADDRESS,IdPost,idMember,Date,Name,UrlWebsite,Comment) values('" . $_SERVER["REMOTE_ADDR"] . "','" . $_POST['idP'] . "','"; if ($idMember) $sql .= "$idMember"; $sql .= "','" . time() . "','" . addslashes($_POST['c_name']) . "','" . addslashes(str_replace('http://', '', $_POST['c_site'])) . "','" . addslashes($_POST['c_content']) . "')"; $cmd = $connect->query($sql); $sql = "update posts set NbComments = NbComments + 1 where IdPost='" . $_POST['idP'] . "'"; $connect->query($sql); if ($GLOBAL_NOTIFICATIONS_ENABLED == TRUE) { $notif = new ObsNotifications($PATH); $notif->informAllCommentMakers($_POST['idP'], $email); } /* les 2 lignes suivantes permettent de gérer les onglets */ $commentArticleOK = TRUE; $_POST = null; } else { $errorCodeComment = TRUE; } } elseif ($_POST['act'] == "follow") { if ($_POST['code'] && ($_POST['code'] == $_SESSION['SecurityKey2'])) { $sql = "select * from members where Email='" . addslashes(strtolower(trim($_POST['c_mail']))) . "'"; $cmd = $connect->query($sql); if ($cmd->num_rows) // Existe deja. { $res = $cmd->fetch_array(MYSQLI_BOTH); $idMember = $res['IdMember']; $_SESSION['member']['Email'] = $res['Email']; } else { $email = strtolower(trim($_POST['c_mail'])); $sql = "insert into members(Email,IP_ADDRESS) values('" . addslashes($email) . "','" . $_SERVER["REMOTE_ADDR"] . "')"; $cmd = $connect->query($sql); $idMember = $connect->insert_id; $_SESSION['member']['Email'] = $email; } if ($GLOBAL_NOTIFICATIONS_ENABLED == TRUE) { $notif = new ObsNotifications($PATH); $notif->changeFollowerStatus($_POST['idP'], $idMember, $_POST['c_follow']); } $followArticleOK = TRUE; } else { $errorCodeFollow = TRUE; } } elseif ($_POST['act'] == "share") { if ($_POST['code'] && ($_POST['code'] == $_SESSION['SecurityKey3'])) { for ($i = 1; $i <= 5; $i++) { if ($_POST['c_mail_' . $i]) { $notif->shareArticleToUser($_POST['c_mail_' . $i], $_POST['c_mail_from'], 'Un ami souhaite partager avec vous un lien sur www.remote-signals.com', $_POST['c_message']); $sql = "insert into members(Email,EmailInviter) values('" . addslashes($_POST['c_mail_' . $i]) . "','" . addslashes($_POST['c_mail_from']) . "')"; $connect->query($sql); $listeMails .= "
" . $_POST['c_mail_' . $i]; } } $message = "Bonjour,
Un membre (" . $_POST['c_mail_from'] . ") vient de partager un article de Remote-signals.com avec ses amis :
" . $listeMails . "

Message:
--------------

" . $_POST['c_message']; $message .= "

Bonne journee :)"; if ($GLOBAL_NOTIFICATIONS_ENABLED == TRUE) { $notif = new ObsNotifications($PATH); $notif->sendEmailToAdmin('share', $message); } $shareArticleOK = TRUE; } else { $errorCodeShare = TRUE; } } $idArticle = "26"; $obsRequests = new ObsRequests($PATH); $postInfos = $obsRequests->getRecentPosts($idArticle, '', '', 10, ''); $obsNav->ObsHeader('article', $postInfos[0]['Title'] . ', un article du blog de ' . $COPYRIGHT_BLOG_AUTHOR, ''); $obsNav->ObsBodyHeader('dc-post'); $obsNav->setFullPage(); $obsNav->ObsReadArticle($idArticle, $errorCodeComment, $errorCodeFollow, $errorCodeShare, $commentArticleOK, $followArticleOK, $shareArticleOK); $obsNav->ObsFooter(); ?>