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 enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { $this->label = $this->elements[1]; // name="FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']" global $REX; $this->value = -1; $this->user_name = ""; if (isset($REX["COM_USER"]) && is_object($REX["COM_USER"])) { $user_field = $REX["COM_USER"]->getValue($this->elements[2]); $this->value = $user_field; $user_name = rex_com_showUser(&$REX["COM_USER"], "name", "", FALSE); $this->user_name = $user_name; // echo '<p>Wert wurde neu gesetzt auf: '.$this->value.'</p>'; } $wc = ""; if (isset($warning["el_" . $this->getId()])) { $wc = $warning["el_" . $this->getId()]; } if (!isset($this->elements[4]) || trim($this->elements[4]) != "hidden") { $form_output[] = ' <p class="formtext"> <label class="text ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[3] . '</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[5]) || $this->elements[5] != "no_db") { $sql_elements[$this->elements[1]] = $this->value; } }
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; }
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { global $REX; $SEL = new rex_select(); $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']'); $SEL->setId("el_" . $this->id); $SEL->setSize(1); if (isset($REX["COM_USER"]) && is_object($REX["COM_USER"])) { $user_id = $REX["COM_USER"]->getValue("id"); } $sql = ' select rex_com_user.* from rex_com_contact,rex_com_user where rex_com_contact.to_user_id=rex_com_user.id and rex_com_contact.user_id="' . $user_id . '" and rex_com_contact.accepted=1'; $teams = new rex_sql(); // $teams->debugsql = 1; $teams->setQuery($sql); $sqlnames = array(); $user_id = -1; if (isset($_REQUEST["user_id"])) { $user_id = (int) $_REQUEST["user_id"]; } $no_user = true; for ($t = 0; $t < $teams->getRows(); $t++) { $SEL->addOption(rex_com_showUser(&$teams, "name", '', FALSE), $teams->getValue("id")); $sqlnames[$teams->getValue("id")] = rex_com_showUser(&$teams, "name", '', FALSE); if ($teams->getValue("id") == $user_id) { $this->value = $user_id; $user_id = -1; } $teams->next(); $no_user = false; } if ($user_id > 0) { $sql = 'select * from rex_com_user where id="' . $user_id . '" and status=1'; $gu = new rex_sql(); // $gu->debugsql = 1; $gu->setQuery($sql); if ($gu->getRows() == 1) { $SEL->addOption(rex_com_showUser(&$gu, "name", '', FALSE), $gu->getValue("id")); $sqlnames[$gu->getValue("id")] = rex_com_showUser(&$gu, "name", '', FALSE); $this->value = $user_id; $form_output[] .= '<input type="hidden" name="user_id" value="' . $user_id . '" />'; $no_user = false; } } $SEL->setSelected($this->value); $out = $SEL->get(); $wc = ""; if (isset($warning["el_" . $this->getId()])) { $wc = $warning["el_" . $this->getId()]; } if ($no_user) { $warning["el_" . $this->getId()] = $this->params["error_class"]; $out = "Kein User ausgewählt. Kein Versand möglich."; } $SEL->setStyle(' class="select ' . $wc . '"'); $form_output[] = ' <p class="formselect"> <label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label> ' . $out . ' </p>'; $email_elements[$this->elements[1]] = stripslashes($this->value); if (isset($sqlnames[$this->value])) { $email_elements[$this->elements[1] . '_SQLNAME'] = stripslashes($sqlnames[$this->value]); } if (!isset($this->elements[8]) || $this->elements[8] != "no_db") { $sql_elements[$this->elements[1]] = $this->value; } }
function showMessage() { global $REX; $msql = new rex_sql(); if ($this->debug) { $msql->debugsql = 1; } $msql->setQuery("select * from rex_com_board {$this->userjoin_query} where rex_com_board.re_message_id='0' and rex_com_board.board_id='" . $this->boardname . "' and rex_com_board.message_id='" . $this->msg["bb_msg_id"] . "' and rex_com_board.status='1'"); if ($msql->getRows() == 1) { $mout = ' <div class="com-tab com-tab-no-navi com-board"> <div class="com-tab-cntnt"> <div class="com-tab-cntnt-2"> <div class="com-tab-cntnt-3"> <div class="com-board-info"> <p>' . $this->text[10] . ' <a href="' . $this->getLink() . '">' . $this->realboardname . '</a></p> <h2>' . $msql->getValue("rex_com_board.subject") . '</h2> </div> <div class="com-comment-topic com-comment"> <div class="com-image"> <p class="image">' . rex_com_showUser(&$msql, "image", "", TRUE, FALSE) . '</p> </div> <div class="com-content"> <div class="com-content-2"> <p class="user-name"><span>' . rex_com_showUser(&$msql, "name", "", TRUE) . '</span> ' . $this->text[501] . ' ' . date($this->text[150], $msql->getValue("rex_com_board.stamp")) . ':</p> <p class="message">' . nl2br(htmlspecialchars($msql->getValue("rex_com_board.message"))) . '</p>'; if ($this->admin) { $mout .= ' <p class="link-button"><a href="' . $this->getLink(array("bb_func" => "deleteMessage", "bb_msg_id" => $msql->getValue("rex_com_board.message_id"))) . '"><span>' . $this->text[270] . '</span></a></p>'; } $mout .= ' </div></div> <div class="clearer"> </div> </div>'; $mrsql = new rex_sql(); if ($this->debug) { $mrsql->debugsql = 1; } $mrsql->setQuery("select * from rex_com_board {$this->userjoin_query} where rex_com_board.re_message_id='" . $this->msg["bb_msg_id"] . "' and rex_com_board.status=1"); if ($mrsql->getRows() > 0) { $mout .= ' <div class="com-board-info"> <h3>' . $this->text[60] . '</h3> </div>'; for ($i = 0; $i < $mrsql->getRows(); $i++) { $mout .= ' <div class="com-comment"> <div class="com-image"> <p class="image">' . rex_com_showUser(&$mrsql, "image", "", TRUE, FALSE) . '</p> </div> <div class="com-content"> <div class="com-content-2"> <p class="user-name"><span>' . rex_com_showUser(&$mrsql, "name", "", TRUE) . '</span> ' . $this->text[501] . ' ' . date($this->text[150], $mrsql->getValue("rex_com_board.stamp")) . ':</p> <p class="message">' . nl2br(htmlspecialchars($mrsql->getValue("rex_com_board.message"))) . '</p>'; if ($this->admin) { $mout .= '<p class="link-button"><a href="' . $this->getLink(array("bb_func" => "deleteMessage", "bb_msg_id" => $mrsql->getValue("rex_com_board.message_id"))) . '"><span>' . $this->text[280] . '</span></a></p>'; } $mout .= ' </div></div> <div class="clearer"> </div> </div>'; $mrsql->next(); } } else { $mout .= ' <div class="com-board-info"> <h3>' . $this->text[170] . '</h3> </div>'; } if ($this->checkVars()) { $mout .= '<div class="com-answer"> <div class="com-board-info"> <h3>' . $this->text[180] . '</h3> </div>'; $mout .= $this->warning(2); $form = $this->getFormDetails(array("bb_func" => "reply", "bb_msg_id" => $this->msg["bb_msg_id"])); $mout .= '<div id="rex-form">'; $mout .= $form["form"] . $form["hidden"]; if (!$this->anonymous) { $mout .= ' <div class="com-image"> <p class="image">' . rex_com_showUser(&$REX["COM_USER"]->USER, "image", "", FALSE) . '</p> </div>'; } $mout .= '<div class="com-content"> <div class="com-content-2">'; if ($this->anonymous) { $mout .= ' <p class="formtext"> <label class="text" for="f-bb-msg-anouser" >' . $this->text[290] . '</label> <input type="text" class="text" id="f-bb-msg-anouser" name="bb_msg_anouser" maxlength="30" value="' . stripslashes(htmlspecialchars($this->msg["bb_msg_anouser"])) . '" /> </p>'; } else { $mout .= ' <p class="formtext"> <label class="text" for="f-bb-msg-user" >' . $this->text[290] . '</label> <input type="text" class="inp_disabled" id="f-bb-msg-user" name="bb_msg_user" disabled="disabled" value="' . rex_com_showUser(&$REX["COM_USER"]->USER, "name", "", FALSE) . '" /> </p>'; } $mout .= ' <p class="formtextarea"> <label class="textarea" for="f-bb-msg-message" >' . $this->text[200] . '</label> <textarea class="textarea " name="bb_msg_message" id="f-bb-msg-message" cols="80" rows="10">' . stripslashes(htmlspecialchars($this->msg["bb_msg_message"])) . '</textarea> </p> <div class="clearer"> </div> ' . $form["submit"]; $mout .= '</div></div> <div class="clearer"> </div> </form></div>'; $mout .= '</div>'; } $mout .= ' </div> </div> </div> </div>'; } return $mout; }