Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Straipsnių pateikimas su bb kodais

Parašė Demonas· 2007 Spa. 29 07:10:54
#1

Reikalas toks, kad reikia kad straipsnių pateikime būtų bb kodų mygtukai (Kaip admin panelyje, ne bb kodai, bet html, nu vnz tikiuosi supratote mane). Sukūriau failą pateikti.php ir į jį įrašiau straipsnio pateikimo dalį iš submit.php, įdėjau visą tą bb kodų bloką iš admin panelio, dariau viską, bet neįsivaizduoju kodėl neveikia. Ar failas atlieka pagrindinę pateikimo funkciją netikrinau, pakolkas man bb kodų reikia :/

va pateikti.php failas

<?php

require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
include LOCALE.LOCALESET."submit.php";

if (!iMEMBER) fallback("index.php");

echo "<script type='text/javascript'>advanced();</script>\n";

   if (isset($_POST['submit_article'])) {
      if ($_POST['article_subject'] != "" && $_POST['article_body'] != "") {
         $submit_info['article_cat'] = isNum($_POST['article_cat']) ? $_POST['article_cat'] : "0";
         $submit_info['article_subject'] = stripinput($_POST['article_subject']);
         $submit_info['article_snippet'] = descript($_POST['article_snippet']);
         $submit_info['article_body'] = descript($_POST['article_body']);
         $submit_info['article_breaks'] = (isset($_POST['line_breaks']) ? "y" : "n");
         $result = dbquery("INSERT INTO ".$db_prefix."submissions (submit_type, submit_user, submit_datestamp, submit_criteria) VALUES ('a', '".$userdata['user_id']."', '".time()."', '".addslashes(serialize($submit_info))."')");
         opentable($locale['400']);
         echo "<center><br>\n".$locale['510']."<br><br>
<a href='pateikti.php'>".$locale['511']."</a><br><br>
<a href='index.php'>".$locale['412']."</a><br><br>\n</center>\n";
         closetable();
      }
   } else {
      if (isset($_POST['preview_article'])) {
         $article_cat = $_POST['article_cat'];
         $article_subject = stripinput($_POST['article_subject']);
         $article_snippet = phpentities(descript(stripslash($_POST['article_snippet'])));
         $article_body = phpentities(descript(stripslash($_POST['article_body'])));
         $breaks = (isset($_POST['line_breaks']) ? " checked" : "");
         opentable($article_subject);
         echo (isset($_POST['line_breaks']) ? nl2br($article_body) : $article_body);
         closetable();
         tablebreak();
      }
      if (!isset($_POST['preview_article'])) {
         $article_category = "";
         $article_subject = "";
         $article_snippet = "";
         $article_body = "";
         $breaks = " checked";
      }
      $cat_list = ""; $sel = "";
      opentable($locale['500']);
      $result = dbquery("SELECT * FROM ".$db_prefix."article_cats ORDER BY article_cat_name DESC");
      if (dbrows($result)) {
         while ($data = dbarray($result)) {
            if (isset($_POST['preview_article'])) $sel = ($article_cat == $data['article_cat_id'] ? " selected" : "");
            $cat_list .= "<option value='".$data['article_cat_id']."'$sel>".$data['article_cat_name']."</option>\n";
         }
         echo $locale['520']."<br><br>
<form name='submit_form' method='post' action='".FUSION_SELF."' onSubmit='return validateArticle(this);'>
<table align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='100' class='tbl'>".$locale['521']."</td>
<td class='tbl'><select name='article_cat' class='textbox'>
$cat_list</select></td>
</tr>
<tr>
<td class='tbl'>".$locale['522']."</td>
<td class='tbl'><input type='text' name='article_subject' value='$article_subject' maxlength='64' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>".$locale['523']."</td>
<td class='tbl'><textarea name='article_snippet' class='textbox' rows='3' style='width:300px;'>$article_snippet</textarea></td>
</tr>\n";
      if ($settings['tinymce_enaaš'] != 1) {
echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('article_snippet', '<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('article_snippet', '<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('article_snippet', '<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px;' onClick=\"addText('article_snippet', '<a href=\'', '\' target=\'_blank\'>Link</a>');\">
<input type='button' value='img' class='button' style='width:35px;' onClick=\"addText('article_snippet', '<img src=\'".str_replace("../","",IMAGES_A)."', '\'>');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('article_snippet', '<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('article_snippet', '<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px;' onClick=\"addText('article_snippet', '<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('article_snippet', '<span class=\'alt\'>', '</span>');\"><br>
<select name='setcolor' class='textbox' style='margin-top:5px;' onChange=\"addText('article_snippet', '<span style=\'color:' + this.options[this.selectedIndex].value + ';\'>', '</span>');this.selectedIndex=0;\">
<option value=''>Pasirinkite Spalv&#224;</option>
<option value='maroon' style='color:maroon;'>Maroon</option>
<option value='red' style='color:red;'>Red</option>
<option value='orange' style='color:orange;'>Orange</option>
<option value='brown' style='color:brown;'>Brown</option>
<option value='yellow' style='color:yellow;'>Yellow</option>
<option value='green' style='color:green;'>Green</option>
<option value='lime' style='color:lime;'>Lime</option>
<option value='olive' style='color:olive;'>Olive</option>
<option value='cyan' style='color:cyan;'>Cyan</option>
<option value='blue' style='color:blue;'>Blue</option>
<option value='navy' style='color:navy;'>Navy Blue</option>
<option value='purple' style='color:purple;'>Purple</option>
<option value='violet' style='color:violet;'>Violet</option>
<option value='black' style='color:black;'>Black</option>
<option value='gray' style='color:gray;'>Gray</option>
<option value='silver' style='color:silver;'>Silver</option>
<option value='white' style='color:white;'>White</option>
</select>
</td>
</tr>\n";
}

echo "<tr>
<td valign='top' class='tbl'>".$locale['524']."</td>
<td class='tbl'><textarea name='article_body' cols='0' rows='8' class='textbox' style='width:300px;'>$article_body</textarea></td>
</tr>\n";
      if ($settings['tinymce_enaaš'] != 1) {
echo "<tr><td class='tbl'></td><td class='tbl'>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('article_body', '<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('article_body', '<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('article_body', '<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px;' onClick=\"addText('article_body', '<a href=\'', '\' target=\'_blank\'>Link</a>');\">
<input type='button' value='img' class='button' style='width:35px;' onClick=\"addText('article_body', '<img src=\'".str_replace("../","",IMAGES_A)."', '\'>');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('article_body', '<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('article_body', '<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px;' onClick=\"addText('article_body', '<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('article_body', '<span class=\'alt\'>', '</span>');\"><br>
<select name='setcolor' class='textbox' style='margin-top:5px;' onChange=\"addText('article_body', '<span style=\'color:' + this.options[this.selectedIndex].value + ';\'>', '</span>');this.selectedIndex=0;\">
<option value=''>Pasirinkite Spalv&#224;</option>
<option value='maroon' style='color:maroon;'>Maroon</option>
<option value='red' style='color:red;'>Red</option>
<option value='orange' style='color:orange;'>Orange</option>
<option value='brown' style='color:brown;'>Brown</option>
<option value='yellow' style='color:yellow;'>Yellow</option>
<option value='green' style='color:green;'>Green</option>
<option value='lime' style='color:lime;'>Lime</option>
<option value='olive' style='color:olive;'>Olive</option>
<option value='cyan' style='color:cyan;'>Cyan</option>
<option value='blue' style='color:blue;'>Blue</option>
<option value='navy' style='color:navy;'>Navy Blue</option>
<option value='purple' style='color:purple;'>Purple</option>
<option value='violet' style='color:violet;'>Violet</option>
<option value='black' style='color:black;'>Black</option>
<option value='gray' style='color:gray;'>Gray</option>
<option value='silver' style='color:silver;'>Silver</option>
<option value='white' style='color:white;'>White</option>
</select>
</td>
</tr>\n";
}

echo "<tr>
<td colspan='2' class='tbl'><br><center>
<input type='checkbox' name='line_breaks' value='yes'$breaks>".$locale['525']."<br><br>
<input type='submit' name='preview_article' value='".$locale['526']."' class='button'>
<input type='submit' name='submit_article' value='".$locale['527']."' class='button'></center>
</td>
</tr>
</table>
</form>\n";
      } else {
         echo "<center><br>\n".$locale['551']."<br><br>\n</center>\n";
      }
      closetable();
      }
require_once "side_right.php";
require_once "footer.php";
?>