We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26709
    • 4 Posts
    Óâàæàåìîå ñîîáùåñòâî. Ïåðåäî ìíîé ñòàë âîïðîñ, êàê ìîæíî ïîëüçîâàòåëþ íà ñàéòå îòñûëàòü ìíå êàê àäìèíó ñîîáùåíèå íî íå íà ìîå ìûëî, à êî ìíå â àäìèíêó ïî âíóòðåííåé ïî÷òå. ? Êàê ìîæíî ýòî îñóùåñòâèòü?

    Åñëè íå ñîâñåì ïîíÿòíî îáúÿñíèë, òî âîò: ïîëüçîâàòåëü õî÷åò íàïèñàòü ìíå ñîîáùåíèå ÷åðåç ôîðìó äëÿ îáðàòíîé ñâÿçè, çàïîëíÿåò ïîëÿ, íàæèìàåò ÎÒÏÐÀÂÈÒÜ è ïèñüìî èäåò êî ìíå â àäìèíêó. Ïî íåêîòîðûì ïðè÷èíàì åìåèë ìíå íå ïîäõîäèò.

    Çàðàíåå ñïàñèáî çà îòâåò smiley
      • 30354
      • 227 Posts
      На сколько я знаю - только ручками. Смотрите, где лежат функции для отправки сообщения в админке, в какие таблицы это складывается и пишите то же самое. Там кода то получится строк 20...
        http://www.avizion.ru/ — строим стартап!
        http://tonatos.ru/ — Заходите в гости...
        • 26709
        • 4 Posts
        Ñïàñèáî - áóäó ïðîáîâàòü. Íàéäó ðåøåíèå, ïîäåëþñü smiley
          • 21610
          • 360 Posts
          Вот эта штука работала в Этомайте! Думаю поможет!

          [!GuestBook!]

          /*
          Snippet:        GuestBook3 (based on GuestBook2) - Etomite v0.6.3 - Modified 2005-09-05
          
          Created By:     Ralph A. Dahlgren - [email protected]
          Modified By:    Mikko K. Lammi - [email protected] - www.parea.fi
          Modified By:    Rain R. Visser
          
          Demo URL GB2:   http://www.parea.fi/raaputuksia/guestbook.html
          
          Usage:          Create an Etomite user or admin as GuestBook owner in Etomite Manager
                          Change $defaultadmin variable to match GuestBook owner
                          OR
                          Messages will be deposited into that mailbox, but only GuestBook
                          messages will be displayed within the GuestBook listing.
                          Place the .gifs in assets\images
                          Place the .JS in assets\site
          
          Variables:      $gbtype - Referenced in GuestBook admin User Messages Subject
                          $gbadmin - Etomite User/Admin who will receive this message
          
          Examples:       Use the [!SnippetName!] syntax instead of regular [[SnippetName]]:
                          [!GuestBook!] - Will use snippet defaults for $gbtype and $gbadmin
                          [!GuestBook?gbtype=GuestBook&gbadmin=guestbook!] - Self Explanatory
                          [!GuestBook?gbadmin=someuser!] - Uses $etomite->documentObject['pagetitle'] for $gbtype
                          [!GuestBook?bgtype=SomeTopic!] - Uses $defaultadmin for $gbadmin
          
          Note:           $etomite->documentObject['createdby'] was not used for $gbadmin intentionally
                          To implement this capability would entail and additonal DB Query before Inserts
          */
          
          // BEGIN SETTINGS -------------------------------------------------------------
          
          // Variables you may want to change
          
          $defaultadmin = "admin"; // Default GuestBook admin to use if $gbadmin not passed
          $gap = " :: "; // Separator between $type and $subject in User Messages Subject field
          $messages = 3; // Number of messages on one page
          $header_style = "style='font-size: medium;'"; // Css style for header
          $message_box_style = "style='padding: 1px;'"; // Css style for message box
          $dateformat = "%H:%M  %d.%m.%Y"; // Preferred Date & Time display format, European dateformat is "%d.%m.%Y %H:%M:%S"
          $order = "DESC"; // Order of messages by postdate: DESC = descending, ASC = ascending
          $server_offset_time = 21600; // number of seconds for timezone difference
          
          // Russia language for guestbook
          
          $_lang_guestbook["write_new_message"] = "Новое сообщение";
          $_lang_guestbook["messages"] = "Сообщения";
          $_lang_guestbook["name_or_alias"] = "Ваше имя:";
          $_lang_guestbook["send"] = "Отправить";
          $_lang_guestbook["reset"] = "Обновить";
          $_lang_guestbook["next_page"] = "След. страница";
          $_lang_guestbook["previous_page"] = "Пред. страница";
          $_lang_guestbook["message"] = "Сообщение:";
          $_lang_guestbook["date_and_time"] = "Дата сообщения";
          $_lang_guestbook["sender"] = "Отправитель";
          $_lang_guestbook["cancel"] = "Отменить";
          $_lang_guestbook["error"] = "GuestBook User/Manager not found... Check your settings...";
          
          // END SETTINGS ---------------------------------------------------------------
          
          // Variables you should not need to change
          $type = isset($gbtype) ? $gbtype : $etomite->documentObject['pagetitle']; // Set $type field for new entry
          $trimtype=substr($type,0,15); // Truncate $type to 15 character limit for field
          $guestbookadmin = isset($gbadmin) ? $gbadmin : $defaultadmin; // Set GuestBook admin
          $pageid=$etomite->documentIdentifier; // ID of the calling document
          $pageurl=$etomite->makeURL($pageid); // URL if you don't have friendly uri
          $tbl = $etomite->dbConfig['dbase'].".".$etomite->dbConfig['table_prefix'];
          $msgdb = $tbl."user_messages"; // DB.Prefix_user_messages variable
          
          // Function to show smileys
          function smile($text) {
              $text = str_replace(":)", "<img src=\"assets/images/smile.gif\">", $text);
              $text = str_replace(":D", "<img src=\"assets/images/biggrin.gif\">", $text);
              $text = str_replace(":haha:","<img src=\"assets/images/laugh.gif\">", $text);
              $text = str_replace(";)","<img src=\"assets/images/wink.gif\">", $text);
              $text = str_replace(":cool:","<img src=\"assets/images/cool.gif\">", $text);
              $text = str_replace(":o","<img src=\"assets/images/blush.gif\">", $text);
              $text = str_replace(":(","<img src=\"assets/images/frown.gif\">", $text);
              $text = str_replace(":foei:","<img src=\"assets/images/nono.gif\">", $text);
              $text = str_replace(":schrik:","<img src=\"assets/images/eek.gif\">", $text);
              $text = str_replace(":boos:","<img src=\"assets/images/mad.gif\">", $text);
              $text = str_replace(":dood:","<img src=\"assets/images/dead.gif\">", $text);
              $text = str_replace(":huil:","<img src=\"assets/images/cry.gif\">", $text);
              $text = str_replace(":kus:", "<img src=\"assets/images/kiss.gif\">", $text);
              $text = str_replace(":love:","<img src=\"assets/images/rose.gif\">", $text);
              $text = str_replace(":stil:", "<img src=\"assets/images/quiet.gif\">", $text);
              $text = str_replace(":kijk:","<img src=\"assets/images/look.gif\">", $text);
              $text = str_replace(":poets:", "<img src=\"assets/images/brushteeth.gif\">", $text);
              $text = str_replace(":proost:","<img src=\"assets/images/cheers.gif\">", $text);
              $text = str_replace(":clown:","<img src=\"assets/images/clown.gif\">", $text);
              $text = str_replace(":td:","<img src=\"assets/images/notgood.gif\">", $text);
              $text = str_replace(":tu:",  "<img src=\"assets/images/perfect.gif\">", $text);
              $text = str_replace(":buig:","<img src=\"assets/images/hail.gif\">", $text);
              $text = str_replace(":spring:","<img src=\"assets/images/bouncey.gif\">", $text);
              $text = str_replace(":nerd:","<img src=\"assets/images/nerd.gif\">", $text);
              $text = str_replace(":idee:","<img src=\"assets/images/idea.gif\">", $text);
              $text = str_replace(":zzz:","<img src=\"assets/images/sleep.gif\">", $text);
              $text = str_replace(":P","<img src=\"assets/images/tongue.gif\">", $text);
              $text = str_replace(":zwaai:","<img src=\"assets/images/wave.gif\">", $text);
              $text = str_replace(":fluit:", "<img src=\"assets/images/whissle.gif\">", $text);
              $text = str_replace(":verbaasd:","<img src=\"assets/images/confused.gif\">", $text);
             return $text;
          }
          
          
          // Function to make hyperlinks
          function hyperlink($text) {
              $search = array ("/([\w\.\/\&\=\?\-]+)@([\w\.\/\&\=\?\-]+)/","/((ftp(7?):\/\/)|(ftp\.))([\w\.\/\&\=\?\-]+)/","/((http(s?):\/\/)|(www\.))([\w\.\/\&\=\?\-]+)/");
              $replace = array ("<a href='mailto:$1@$2'>$1@$2</a>","<a href='ftp$3://$4$5' target='_blank'>$4$5</a>","<a href='http$3://$4$5' target='_blank'>$4$5</a>");
              return preg_replace ($search, $replace, $text);
          }
          
          // Don't allow unwanted re-posts of messages
          if($_POST['submitted'] == "TRUE") header( "Location: index.php?id=$etomite->documentIdentifier" );
          
          // Query for the user ID (id) for the GuestBook owner
          $sql = "SELECT id FROM ".$tbl."manager_users WHERE ".$tbl."manager_users.username='$guestbookadmin';";
          $rs = $etomite->dbQuery($sql);
          $limit = $etomite->recordCount($rs);
          
          // Check to make sure $guestbookadmin has been created and assigned
          if($limit == 1) {
          
              $userrec = $etomite->fetchRow($rs);
              $userid = $userrec['id'];
          
              // Check to see if a valid message has been submitted
              if(isset($_POST['submit']) && ($_POST['subject'] > "")  && ($_POST['message'] > "")){
                  $postdate = time();
          
                  $recipient = $userid;
                  $subject = $type . $gap . strip_tags($_POST['subject']);
                  $message = strip_tags($_POST['message']);
          
                  // Query to INSERT a new GuestBook message into user_messages
                  $sql = "INSERT INTO $msgdb ( id , type , subject , message , sender , recipient , private , postdate , messageread ) VALUES ( '', '$type', '$subject', '$message', '0', '$recipient', '0', '$postdate', '0' );";
          
                  $rs = $etomite->dbQuery($sql);  // Execute the Query
                  $submitted="TRUE";
              }
              else $submitted = "TRUE";
          
              // Display write new message form
              if ($_GET['new_message'] == "TRUE") {
                  // Display a Form for submitting a new message
                  $output .= "<script language=\"javascript\" type=\"text/javascript\" src=\"assets/site/gb.js\"></script>";
                  $output .= "<table width='95%'><tr><td>";
                  $output .= "<form name=\"form\" method='post' action='index.php'>";
                  $output .= "<input type='hidden' name='id' value='$pageid' />";
                  $output .= "<input type='hidden' name='submitted' value='$submitted' />";
                  $output .= $_lang_guestbook["name_or_alias"]."<br /><input name='subject' size='40' class='input'/>";
                  $output .= "<br />".$_lang_guestbook["message"]."<br /><text"."area rows='6' cols='50' name='message' class='input'></textarea><br>";
                  $output .= "<input type='submit' name='submit' class='button' value='".$_lang_guestbook["send"]."'>";
          $output .= "  <input type='button' value='".$_lang_guestbook["cancel"]."' class='button' onClick=\"window.location.href='$pageurl&new_message=FALSE'\">";
                  $output .= "</form>";
                  $output .= "</td></tr></table>";
              }
            
              // Display write new message link
              else { 
                  // $output .= "<div style=\"text-align:right;margin-right:7px;margin-top:7px;\"><a href='index.php?id=35&new_message=TRUE'\">".$_lang_guestbook["write_new_message"]."</a></div>"; 
              }
            
              // Query to COUNT existing messages
              $sql = "SELECT * FROM ".$tbl."user_messages
              WHERE ".$tbl."user_messages.recipient=$userid
              AND ".$tbl."user_messages.type='".$trimtype."'
              ORDER BY ".$tbl."user_messages.postdate $order;";
          
              $rs = $etomite->dbQuery($sql);  // Execute the Query
              $total = $etomite->recordCount($rs);  // Number of messages found
          
              // Message page number from GET
              if (isset($_GET["page"])) { $page = $_GET["page"]; }
              else { $page = 1; }
          
              // Index where to start in result set
              $from = 0 + ($page-1)*$messages;
          
              // Query to SELECT existing messages
              $sql = "SELECT * FROM ".$tbl."user_messages
              WHERE ".$tbl."user_messages.recipient=$userid
              AND ".$tbl."user_messages.type='".$trimtype."'
              ORDER BY ".$tbl."user_messages.postdate $order LIMIT $from, $messages;";
          
              $rs = $etomite->dbQuery($sql);  // Execute the Query
              $limit = $etomite->recordCount($rs);  // Number of messages found
          
              // Number of pages
              $pages = ceil($total/$messages);
          
              // Previous page link
              $previouspage = $page-1;
              $previouspage_text = "<a href='index.php?id=35&page=$previouspage'>« ".$_lang_guestbook["previous_page"]." [$previouspage/$pages]</a>   ";
          
              // Next page link
              $nextpage = $page+1;
              $nextpage_text = "<a href='index.php?id=35&page=$nextpage'>".$_lang_guestbook["next_page"]." [$nextpage/$pages] »</a>";
          
              // Previous and next page links at top of the page
              if ($previouspage > 0) { $output .= $previouspage_text; }
              if ($nextpage <= $pages) { $output .= $nextpage_text; }
          
              // Empty lines
              if ($total > $messages) {
                  $output .= "<br /><br />";
              }
          
              // Loop through each of the messages and format for display
              for ($y = 0; $y < $limit; $y++) {
                  if ($order == "DESC") { $number = $total - $from - $y; }
                  if ($order == "ASC") { $number = $from + $y + 1; }
                  $guestbookrec = $etomite->fetchRow($rs);
                  $poster = str_replace($type.$gap,"",$guestbookrec['subject']);
                  $message = nl2br($guestbookrec['message']);
                  $postdate = strftime($dateformat, $guestbookrec['postdate']+$server_offset_time);
                  $output .= "<table $message_box_style width='100%'>";
                  $output .= "<tr><td nowrap width='80%' class='gb_name'>$poster</td>";
                  $output .= "<td nowrap width='20%' align=right class='gb_date'>$postdate</td>";
                  $output .= "<tr><td colspan=\"2\"> </td>";
                  $output .= "<tr><td colspan=\"2\" class='gb_text'>".hyperlink(smile($message))."</td>";
                  $output .= "<tr><td width='80%'> </td>";
                  $output .= "<td width='20%' nowrap align=right class='gb_nmessage'>".$_lang_guestbook["message"].": $number/$total</td>";
                  $output .= "</table><br />";
              }
          
              // Previous and next page links at bottom of the page
              if ($previouspage > 0) { $output .= $previouspage_text; }
              if ($nextpage <= $pages) { $output .= $nextpage_text; }
          }
          
          // If no valid GuestBook owner is found display error message...
          else  $output = $_lang_guestbook["error"];
          
          // Output
          return $output;
          


            Разработка сайтов на MODx
            • 26709
            • 4 Posts
            Âîò, ïîëàçèë ïî ôàéëàì àäìèíêè, íàêîïàë êîäà è íàïèñàë ñâîé ñíèïïåò äëÿ îòïðàâêè ñîîáùåíèÿ â àäìèíêó. Âñå âðîäå íîðìàëüíî, íî âûäàåò îøèáêó ñèíòàêñèñà ìóñêóëà. Ïðåäïîëàãàþ, ÷òî ïðîáëåìà â çàïðîñå èëè æå ÿ ÷òî-òî ïðîïóñòèë. Âîò ñíà÷àëà ñàì êîä ñíèïïåòà:
            /* Author: Serg24 
             * [email protected]
             * [[SentToAdmin]] - Snippet for creation of form of feed-back. An administrator receives message  * in  the mailbox in the manager interface.
             *
             * Parameters:
             * - userid : id of manager which will receive message.
             *
             * Example: [[SentToAdmin? &userid=1]]
             */
            
            global $dbase;
            
            // id of manager which will receive message. (default '1')
            //if(!isset($userid)) {$userid='1'};
            
            $tbl = $etomite->dbConfig['dbase'].".".$etomite->dbConfig['table_prefix'];
            
            $output = '';
            $userid='1';
            if (isset ($_POST['action'])) {
            $action=$_POST['action'];
            if ($action=="add") {
            
            $sendto = 'u';
            $email = $_POST['email'];
            $name = $_POST['name'];
            $subject = addslashes($_POST['messagesubject']);
            if($subject=="") $subject="(áåç òåìû)";
            $message = addslashes($_POST['messagebody']);
            if($message=="") $message="Ïðèñëàíî: ".$name." (".$email.")<br>(íåò ñîîáùåíèÿ)";
            $postdate = time();
            
            if($sendto=='u') {
            	if($userid==0) {
            		$e->setError(13);
            		$e->dumpError();
            	}
            
            	$sql = "INSERT INTO ".$tbl."user_messages(recipient, sender, subject, message, postdate, type, private)
            			values($userid, ".$modx->getLoginUserID().", '$subject', '$message', $postdate, 'Message', 1);";
            	$rs = $modx->db->query($sql);
            }
            
            //$header = "Location: index.php?a=10";
            //Òóò ìîæíî ñäåëàòü ðåäèðåêò
            }
            }
            
            //exit;
            
            
            $output .= '<form name="addcat" method="post">
            <table width=100%>
            <tr>
            <td>Òåìà ñîîáùåíèÿ</td><td><select name=messagesubject>
            <option value="Ïðåäëîæåíèå ñîòðóäíè÷åñòâà">Ïðåäëîæåíèå ñîòðóäíè÷åñòâà</option>
            <option value="Ïðåäëîæåíèå">Ïîæàëîâàòüñÿ</option>
            <option value="Ïðåäëîæåíèå">Ïðèñëàòü ìàòåðèàë</option>
            <option value="Çàäàòü âîïðîñ">Çàäàòü âîïðîñ</option>
            <option value="Îøèáêà â ðàáîòå ñàéòà">Îøèáêà â ðàáîòå ñàéòà</option>
            <option value="Äðóãàÿ òåìà">Äðóãàÿ òåìà</option>
            </select>
            </td>
            </tr>
            
            <tr>
            <td>Âàøå èìÿ:</td><td><textarea name="name" cols="50" rows="5"></textarea></td>
            </tr>
            
            <tr>
            <td>Âàø e-mail:</td><td><input name="email" type="text" size="40" value="" /></td>
            </tr>
            
            <tr>
            <td>Òåêñò ñîîáùåíèÿ:</td><td><textarea name="messagebody" cols="50" rows="8"></textarea></td>
            </tr>
            
            <tr>
            <td><input type=hidden name=action value=add></td><td><input type=submit value=Îòïðàâèòü!></td>
            </tr>
            
            </table>
            </form>';
            
            return $output;
            


            à âîò îøèáêà, êîòîðàÿ âûäàåòñÿ:
            « MODx Parse Error »
            MODx encountered the following error while attempting to parse the requested resource: 
            « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'Ïðåäëîæåíèå ñîòðóäíè÷åñòâà', 'asdfasdf', 1170601007, 'Message', 1)' at line 2 » 
                  SQL: INSERT INTO `konmodx`.modx1_user_messages(recipient, sender, subject, message, postdate, type, private) values(1, , 'Ïðåäëîæåíèå ñîòðóäíè÷åñòâà', 'asdfasdf', 1170601007, 'Message', 1); 
                  [Copy SQL to ClipBoard] 
              
            Parser timing 
              MySQL:  0.0097 s s (0 Requests) 
              PHP:  0.1712 s s   
              Total:  0.1809 s s   
            



             ÷åì òóò ïðîáëåìà? Ïîäñêàæèòå, ïîæàëóéñòà

              • 897
              • 1,620 Posts
              ...[b]values(1, ,[/b]...


              две запятых. проверяйте вставляемые данные на существование
                "Und wenn du lange in einen Abgrund blickst, blickt der Abgrund auch in dich hinein."

                Не используйте Revo для "просто сайтов". Используйте Evo

                Who can defeat the Russian bear?
                • 26709
                • 4 Posts
                Âñå îòëè÷íî, ñïàñèáî çà ïîäñêàçêó - âñå ðàáîòàåò smiley Ïðèëàãàþ êîä ñíèïïåòà èñïðàâëåííîãî. Ìîæåò êîìó ïîíàäîáèòñÿ. Òîëüêî õî÷ó ñêàçàòü, ÷òî îí ïîêà íåäîðàáîòàí â ïëàíå ïðîâåðêè ââîäíûõ äàííûõ è òàê äàëåå. Íî â îáùåì ðàáîòàòå õîðîøî

                /* Author: Serg24
                 * [[SentToAdmin]] - Snippet for creation of form of feed-back. An administrator receives message  * in  the mailbox in the manager interface.
                 *
                 * Parameters:
                 * - userid : id of manager which will receive message.
                 *
                 * Example: [[SentToAdmin? &userid=1]]
                 */
                
                // id of manager which will receive message. (default '1')
                $userid = isset($userid)? $userid : 1;
                
                // main variables
                $tbl = $etomite->dbConfig['dbase'].".".$etomite->dbConfig['table_prefix'];
                $fromuser="1";
                $output = '';
                
                // begin
                if (isset ($_POST['action'])) {
                $action=$_POST['action'];
                if ($action=="add") {
                
                $sendto = 'u';
                $email = $_POST['email'];
                $name = $_POST['name'];
                $subject = addslashes($_POST['messagesubject']);
                if($subject=="") $subject="(áåç òåìû)";
                $message = addslashes($_POST['messagebody']);
                $message = "Ïðèñëàíî: ".$name." (".$email.")<br><br><b>Òåêñò ñîîáùåíèÿ:</b><br>".$message;
                if($message=="") $message="Ïðèñëàíî: ".$name." (".$email.")<br>(íåò ñîîáùåíèÿ)";
                $postdate = time();
                
                if($sendto=='u') {
                	if($userid==0) {
                		$e->setError(13);
                		$e->dumpError();
                	}
                
                	$sql = "INSERT INTO ".$tbl."user_messages(recipient, sender, subject, message, postdate, type, private)
                			values($userid, ".$fromuser.", '$subject', '$message', $postdate, 'Message', 1);";
                	$rs = $modx->db->query($sql);
                echo "Ñîîáùåíèå óñïåøíî îòïðàâëåíî.<br><br>";
                }
                //$header = "Location: index.php?a=10";
                //Òóò ìîæíî ñäåëàòü ðåäèðåêò
                }
                }
                
                //exit;
                
                
                $output .= '<form name="addcat" method="post">
                <table width=100%>
                <tr>
                <td>Òåìà ñîîáùåíèÿ</td><td><select name=messagesubject>
                <option value="Ïðåäëîæåíèå ñîòðóäíè÷åñòâà">Ïðåäëîæåíèå ñîòðóäíè÷åñòâà</option>
                <option value="Ïðåäëîæåíèå">Ïîæàëîâàòüñÿ</option>
                <option value="Ïðåäëîæåíèå">Ïðèñëàòü ìàòåðèàë</option>
                <option value="Çàäàòü âîïðîñ">Çàäàòü âîïðîñ</option>
                <option value="Îøèáêà â ðàáîòå ñàéòà">Îøèáêà â ðàáîòå ñàéòà</option>
                <option value="Äðóãàÿ òåìà">Äðóãàÿ òåìà</option>
                </select>
                </td>
                </tr>
                
                <tr>
                <td>Âàøå èìÿ:</td><td><input name="name" type="text" size="40" value="" /></td>
                </tr>
                
                <tr>
                <td>Âàø e-mail:</td><td><input name="email" type="text" size="40" value="" /></td>
                </tr>
                
                <tr>
                <td>Òåêñò ñîîáùåíèÿ:</td><td><textarea name="messagebody" cols="50" rows="8"></textarea></td>
                </tr>
                
                <tr>
                <td><input type=hidden name=action value=add></td><td><input type=submit value=Îòïðàâèòü!></td>
                </tr>
                
                </table>
                </form>';
                
                return $output;
                
                
                  • 897
                  • 1,620 Posts
                  нужная в хозяйстве вещь... мне так кажется smiley
                    "Und wenn du lange in einen Abgrund blickst, blickt der Abgrund auch in dich hinein."

                    Не используйте Revo для "просто сайтов". Используйте Evo

                    Who can defeat the Russian bear?