/** * parse * * @param string $data * * @return void */ function parse($data) { $data = htmlentities($data, ENT_COMPAT, 'UTF-8'); $data = parse_smilies($data); $data = parse_bbcodes($data); $data = nl2br_nospaces($data); return $data; }
/** * getWhatsNewDataTextInfo * * @param array $data * * @return string */ function getWhatsNewDataTextInfo($data) { $text = ''; switch ($data['type']) { case 'ADDRESSADD': $displayname = getUserDisplayName($data['id2']); $for = '<a href="addressbook.php?address=' . (int) $data['id'] . '">' . getUserDisplayName($data['userid'], 2, false) . '</a>'; $text = sprintf(T_('Added address information for %s.'), $for); break; case 'ADDRESSEDIT': $text = $this->getWhatsNewDataAddressEditTextInfo($data); break; case 'AVATAR': $text = $data['id3'] == 'M' ? T_('Changed his profile picture.') : T_('Changed her profile picture.'); break; case 'CALENDAR': $text = T_('Added a new event.'); break; case 'DOCS': $text = T_('Added a new document.'); break; case 'BOARD': case 'GALCATCOM': case 'NEWSCOM': case 'POLLCOM': case 'RECIPECOM': case 'VIDEOCOM': $text = cleanOutput($data['details']); break; case 'GALCOM': $text = T_('Commented on the following photo:'); break; case 'GALLERY': $text = sprintf(T_('Added %d new photos.'), (int) $data['id2']); break; case 'JOINED': $text = T_('Joined the website.'); break; case 'NEWS': $text = T_('Added new Family News.'); break; case 'POLL': $text = T_('Added a new poll.'); break; case 'PRAYERS': $text = T_('Added a new prayer concern.'); break; case 'RECIPES': $text = T_('Added a new recipe.'); break; case 'THREAD': $text = T_('Started a new thread.'); break; case 'VIDEO': $text = T_('Added a new video.'); break; default: $text = cleanOutput($data['title']); $text = nl2br_nospaces($text); break; } return $text; }
/** * showRecipe * * Display a single recipe. Display options for editing/deleting. * * @param int $cat * @param int $id * @return void */ function showRecipe($cat, $id) { $cat = (int) $cat; $id = (int) $id; // Display Menu echo ' <div id="sections_menu"> <ul> <li><a href="recipes.php">' . T_('Recipe Categories') . '</a></li>'; if ($this->fcmsUser->access <= 5) { echo ' </ul> </div> <div id="actions_menu"> <ul> <li><a href="?addrecipe=yes&cat=' . $cat . '">' . T_('Add Recipe') . '</a></li>'; } echo ' </ul> </div>'; // Show Category Side Menu $this->showCategoryMenu(); // Get Recipes for this category $sql = "SELECT r.`id`, r.`name`, r.`category`, \n r.`ingredients`, r.`directions`, r.`thumbnail`, \n c.`name` AS category_name, r.`user`, r.`date`\n FROM `fcms_recipes` AS r, `fcms_category` AS c\n WHERE r.`id` = '{$id}' \n AND r.`category` = '{$cat}'\n AND r.`category` = c.`id`\n LIMIT 1"; $r = $this->fcmsDatabase->getRow($sql, array($id, $cat)); if ($r === false) { $this->fcmsError->displayError(); return; } // Invalid id/category if (empty($r)) { echo ' <div class="error-alert">' . T_('Recipe does not exist.') . '</div>'; return; } $displayname = getUserDisplayName($r['user']); $displayname = '<a href="profile.php?member=' . $r['user'] . '">' . $displayname . '</a>'; $date = fixDate(T_('F j, Y, g:i a'), $this->fcmsUser->tzOffset, $r['date']); $cleanName = cleanOutput($r['name']); $cleanCategory = (int) $r['category']; $cleanThumb = basename($r['thumbnail']); $cleanIngredients = cleanOutput($r['ingredients']); $cleanDirections = cleanOutput($r['directions']); $path = 'uploads/upimages/'; if (defined('UPLOADS')) { $path = 'file.php?u='; } // Display Recipe echo ' <div id="maincolumn"> <div class="recipe-thumbnail"><img src="' . $path . $cleanThumb . '"/></div> <h4 class="recipe-name">' . $cleanName . '</h4> <span class="date"> ' . sprintf(T_('Submitted by %s on %s.'), $displayname, $date); if ($this->fcmsUser->id == $r['user'] || $this->fcmsUser->access < 2) { echo ' <form method="post" action="recipes.php"> <div> <input type="hidden" name="id" value="' . (int) $r['id'] . '"/> <input type="hidden" name="name" value="' . $cleanName . '"/> <input type="hidden" name="thumbnail" value="' . $cleanThumb . '"/> <input type="hidden" name="category" value="' . $cleanCategory . '"/> <input type="hidden" name="ingredients" value="' . $cleanIngredients . '"/> <input type="hidden" name="directions" value="' . $cleanDirections . '"/> <input type="submit" name="editrecipe" value="' . T_('Edit') . '" class="editbtn" title="' . T_('Edit this Recipe') . '"/> </div> </form> <form class="delrec" method="post" action="recipes.php"> <div> <input type="hidden" name="id" value="' . (int) $r['id'] . '"/> <input type="submit" name="delrecipe" value="' . T_('Delete') . '" class="delbtn" title="' . T_('Delete this Recipe') . '"/> </div> </form>'; } echo ' </span> <div class="recipe-container"> <div class="recipe-directions"> <b>' . T_('Directions') . '</b> ' . nl2br_nospaces($cleanDirections) . ' </div> <div class="recipe-ingredients"> <b>' . T_('Ingredients') . '</b> ' . nl2br_nospaces($cleanIngredients) . ' </div> </div>'; $this->showComments($id, $cat); echo ' </div>'; }