function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { global $REX; $this->label = $this->elements[1]; $this->request_field = $this->elements[3]; $field = rex_request($this->request_field, "int", "0"); $this->user_name = "ddd"; if ($field != "0" && rex_com_user::createObject($field)) { $this->value = $REX["COM_CACHE"]["USER"][$field]->getValue("email"); $this->user_name = rex_com_showUser(&$REX["COM_CACHE"]["USER"][$field], "name", "", FALSE); } else { $warning = $this->elements[5]; return; } $form_output[] = ' <p class="formtext"> <input type="hidden" name="' . $this->request_field . '" value="' . htmlspecialchars($field) . '" /> <label class="text" for="el_' . $this->id . '" >' . $this->elements[2] . '</label> <input type="text" class="text inp_disabled" disabled="disabled" id="el_' . $this->id . '" value="' . htmlspecialchars($this->user_name) . '" /> </p>'; $email_elements[$this->elements[1]] = stripslashes($this->value); if (!isset($this->elements[4]) || $this->elements[4] != "no_db") { $sql_elements[$this->elements[1]] = $this->value; } return; }
function execute() { foreach ($this->elements_sql as $key => $value) { if ($this->action["elements"][2] == $key) { $id = $value; break; } } return rex_com_user::exeAction($id, $this->action["elements"][3], $this->elements_email); }
function execute() { $subject_key = $this->action["elements"][2]; $body_key = $this->action["elements"][3]; $user_id_key = $this->action["elements"][4]; foreach ($this->elements_sql as $key => $value) { if ($subject_key == $key) { $subject = $value; } if ($body_key == $key) { $body = $value; } if ($user_id_key == $key) { $from_user_id = $value; } // echo "<br /> $key => $value"; } if ($subject == "" or $body == "" or $from_user_id == "") { return FALSE; } // User auslesen $gu = new rex_sql(); // $gu->debugsql = 1; // $gu->setQuery('select * from rex_com_user where id<>"'.$from_user_id.'" order by id'); $gu->setQuery('select * from rex_com_user order by id'); foreach ($gu->getArray() as $user) { $user_body = $body; $user_subject = $subject; $to_user_id = $user["id"]; // Empfaenger einbauen $in = new rex_sql(); // $in->debugsql = 1; $in->setTable("rex_com_message"); $in->setValue("user_id", $to_user_id); $in->setValue("from_user_id", $from_user_id); $in->setValue("to_user_id", $to_user_id); $in->setValue("subject", $user_subject); $in->setValue("body", $user_body); $in->setValue("create_datetime", time()); $in->insert(); /* $in = new rex_sql; // $in->debugsql = 1; $in->setTable("rex_com_message"); $in->setValue("user_id",$from_user_id); $in->setValue("from_user_id",$from_user_id); $in->setValue("to_user_id",$to_user_id); $in->setValue("subject",$user_subject); $in->setValue("body",$user_body); $in->setValue("create_datetime",time()); $in->insert(); */ rex_com_user::exeAction($to_user_id, "sendemail_newmessage", $user); } }
function getGuestbook($user_id, $aid, $params = array()) { global $REX; $MY = FALSE; if (is_object($REX['COM_USER']) && $REX['COM_USER']->getValue("rex_com_user.id") == $user_id) { $MY = TRUE; } $u = new rex_sql(); $u->setQuery("select * from rex_com_user where id=" . $user_id); if ($u->getRows() != 1) { return ""; } // ***** ADD MESSAGE if (is_object($REX['COM_USER']) && $_REQUEST["add_message"] != "") { $text = $_REQUEST["text"]; if ($text == "") { $errormessage = '<p class="warning" colspan=2>Es wurde keine Nachricht eingetragen !</p>'; } else { $addmsgsql = new rex_sql(); $addmsgsql->setTable("rex_com_guestbook"); $addmsgsql->setValue("user_id", $user_id); $addmsgsql->setValue("from_user_id", $REX['COM_USER']->getValue("id")); $addmsgsql->setValue("text", $text); $addmsgsql->setValue("create_datetime", time()); $addmsgsql->insert(); if ($user_id != $REX['COM_USER']->getValue('rex_com_user.id')) { rex_com_user::exeAction($user_id, "sendemail_guestbook", array("user_id" => $REX['COM_USER']->getValue('rex_com_user.id'), "firstname" => $REX['COM_USER']->getValue('rex_com_user.firstname'), "name" => $REX['COM_USER']->getValue('rex_com_user.name'), "login" => $REX['COM_USER']->getValue('rex_com_user.login'), "to_user_id" => $u->getValue('rex_com_user.id'), "to_firstname" => $u->getValue('rex_com_user.firstname'), "to_name" => $u->getValue('rex_com_user.name'), "to_login" => $u->getValue('rex_com_user.login'))); } } } elseif ($MY && $_REQUEST["delete_message"] != "") { $msg_id = (int) $_REQUEST["msg_id"]; if ($msg_id == 0) { $errormessage = '<p class="warning">Es wurde keine Nachricht ausgewählt!</p>'; } else { $addmsgsql = new rex_sql(); // $addmsgsql->debugsql = 1; $addmsgsql->setQuery('delete from rex_com_guestbook where id=' . $msg_id . ' and user_id="' . $REX['COM_USER']->getValue("id") . '"'); } } // ***** SHOW MESSAGES $guestsql = new rex_sql(); $guestsql->debugsql = 0; $guestsql->setQuery("SELECT * \n\t\t\tFROM rex_com_guestbook \n\t\t\tLEFT JOIN rex_com_user ON rex_com_guestbook.from_user_id=rex_com_user.id \n\t\t\tWHERE rex_com_guestbook.user_id='" . $user_id . "' \n\t\t\tORDER BY rex_com_guestbook.create_datetime desc"); if ($guestsql->getRows() <= 0) { $echo .= '<p class="com-whitebox">Kein Gästebucheintrag vorhanden !</p>'; } else { $cl = ""; for ($i = 0; $i < $guestsql->getRows(); $i++) { // $cl $echo .= ' <div class="com-guestbook"> <div class="com-image"> <p class="image">' . rex_com_showUser($guestsql, "image") . '</p> </div> <div class="com-content"> <div class="com-content-2"> <div class="com-content-name"> <p><span class="color-1">' . rex_com_showUser($guestsql, "name") . ', ' . rex_com_showUser($guestsql, "city", "", FALSE) . '</span> <br />' . rex_com_formatter($guestsql->getValue("rex_com_guestbook.create_datetime"), 'datetime') . ' </p> </div> <p><b>' . nl2br(htmlspecialchars($guestsql->getValue("rex_com_guestbook.text"))) . '</b></p>'; if ($guestsql->getValue("rex_com_user.motto") != '') { $echo .= '<p>Motto: ' . $guestsql->getValue("rex_com_user.motto") . '</p>'; } if ($MY) { $link_params = array_merge($params, array("user_id" => $user_id, "delete_message" => 1, "msg_id" => $guestsql->getValue("rex_com_guestbook.id"))); $echo .= '<br /><p class="link-button"><a href="' . rex_getUrl($aid, '', $link_params) . '"><span>Löschen</span></a></p>'; } $echo .= '</div></div> <div class="clearer"> </div> </div>'; if ($cl == "") { $cl = ' class="alternative"'; } else { $cl = ""; } $guestsql->next(); } } // $echo .= '</tr></table>'; if (is_object($REX['COM_USER'])) { $echo .= '<div id="rex-form" class="com-guestbook-form spcl-bgcolor"> <form action="' . $REX["FRONTEND_FILE"] . '" method="post" id="guestbookform"> <h2>Einen neuen Eintrag schreiben</h2> ' . $errormessage . ' <input type="hidden" name="add_message" value="1" /> <input type="hidden" name="user_id" value="' . $user_id . '" /> <input type="hidden" name="article_id" value="' . $aid . '" /> '; foreach ($params as $k => $v) { $echo .= '<input type="hidden" name="' . $k . '" value="' . htmlspecialchars($v) . '" />'; } $echo .= ' <p class="formtextarea"> <label for="f-message">Nachricht:</label> <textarea id="f-message" name="text" cols="40" rows="4" /></textarea> </p> <p class="link-save"> <a href="javascript:void(0);" onclick="document.getElementById(\'guestbookform\').submit()"><span>Speichern</span></a></p> </p> <div class="clearer"> </div> </form> </div>'; } return $echo; }