function replaceTemplateValues($string, $siteid, $page_title) { $db = Database::obtain(); $sql = "SELECT * FROM " . TABLE_WEBSITES . "\n\t\t\t\t\tWHERE `id` =" . $siteid . ""; $websitedata = $db->query_first($sql); $website_template = $websitedata['website_template']; $website_protect_value = $websitedata['website_protect']; $website_name = $websitedata['website_name']; $meta_description = $websitedata['website_description']; $meta_keywords = $websitedata['website_keywords']; $creator_name = $websitedata['creator_name']; $creator_website = $websitedata['creator_website']; $website_template = $websitedata['website_template']; $default_file_extension = '.html'; if (isUser($_SESSION['userid']) or isActive($_SESSION['userid']) == false) { $website_footer = MSG00010 . ' <a href ="' . szUrl() . '" >' . szName() . '</a> - ' . MSG00082 . ' ' . szYear() . ' ' . $website_name . '. ' . MSG00057 . ' '; } else { $website_footer = MSG00009 . ' <a href="http://' . $creator_website . '" target="_blank" alt="' . $creator_name . '" title="' . $creator_name . '">' . $creator_name . '</a> - ' . MSG00082 . ' ' . szYear() . ' ' . $website_name . '. ' . MSG00057 . ' '; } $meta_generator_name = szName(); $meta_language = szLanguage(); if ($website_protect_value == '1') { $website_protect = protectSite(); } else { $website_protect = ''; } $website_header = ' <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>' . $page_title . ' - ' . $website_name . '</title> <meta name="description" content="' . $meta_description . '"> <meta name="keywords" content="' . $meta_keywords . '"> <meta http-equiv="Copyright" content="' . $website_name . '" /> <meta name="generator" content="' . $meta_generator_name . '" /> <meta http-equiv="content-language" content="' . $meta_language . '" /> <meta name="robots" content="index, follow" /> <link rel="shortcut icon" href="favicon.ico"/> <link href="sitezilla.css" rel="stylesheet" type="text/css"> <link href="templates/' . $website_template . '/style.css" rel="stylesheet" type="text/css"> ' . ie6Css($website_template) . ie7Css($website_template) . $website_protect . ''; $webauthor = getAuthor($website_template); if ($webauthor == MSG00007) { $author = ''; } else { if (strlen(stristr($webauthor, szCompany())) > 0) { $author = ''; } else { $author = ' ' . MSG00008 . ' ' . $webauthor; } } $placeholders = array('WEBSITE_HEADER', 'WEBSITE_NAME', 'WEBSITE_FOOTER', 'TEMPLATE_AUTHOR'); $new_vals = array($website_header, '<a href="index' . $default_file_extension . '" alt="' . $website_name . '" title="' . $website_name . '">' . $website_name . '</a>', $website_footer, $author); $newString = str_replace($placeholders, $new_vals, $string); return $newString; }
/** * Returns the author of a page * * @param bool $fullname True if you want to get the full name if set, false if you want the login/screenname * * @return string */ function getPageAuthor($fullname = false) { if (is_Pages()) { return getAuthor($fullname); } return false; }
function recurse_pages($id = 0, $level = 0) { $level++; $sql = "SELECT * FROM page_content WHERE parent = " . $id . " ORDER BY page_content_title ASC"; $pageResults = dbQuery($sql); $count = 0; while ($pInfo = dbFetchArray($pageResults)) { $padding = 18 * $level; if ($level != 1) { $style = "style=\"padding-left:" . ($padding + 18) . "px; background-repeat:no-repeat; background-position:" . $padding . "px 0px; background-image:url(images/directory_arrow.gif);\""; } else { $class = ""; } //SECURITY CHECK //ONLY SHOW PAGES THAT THE USER HAS ACCESS TOO $row = $count % 2; echo "<tr>\n"; echo "<td nowrap width=\"1\">\n"; if ($pInfo['page_content_member']) { echo "<a href=\"javascript:void(0);\" title=\"Membership Required\"><img src=\"images/icons/lock_16x16.gif\" border=\"0\"><a>"; } echo "</td>\n"; echo "<td nowrap width\"1\">" . date('m/d/Y', $pInfo['page_content_publish_date']) . "</td>\n"; echo "<td " . $style . "><a href=\"" . PAGE_MANAGE . "?action=edit§ion=webpage&id=" . $pInfo['page_content_id'] . "\">" . output($pInfo['page_content_title']) . "</a></td>\n"; echo "<td nowrap width\"1\">"; if ($pInfo['page_content_status'] == 'pending') { echo "<span class=\"textPending\">Pending</span>"; } else { if ($pInfo['page_content_status'] == 'published') { echo "<span class=\"textActive\">Published</span>"; } else { echo "<span class=\"textInactive\">Unpublished</span>"; } } echo "</td>\n"; echo "<td nowrap width\"1\">\n"; echo "<span class=\"smallText\"><abbr title=\"by " . getAuthor($pInfo['page_content_author']) . "\" style=\"margin:2px;\">Created: " . date('m/d/y g:i a', $pInfo['page_content_added']) . " </abbr></span>\n"; //check to see if this page has been edited //display $modifiedResults = dbQuery('SELECT * FROM page_content_log WHERE page_content_id = ' . $pInfo['page_content_id'] . ' LIMIT 1'); if (dbNumRows($modifiedResults)) { $m = dbFetchArray($modifiedResults); echo "<br>"; echo "<span class=\"smallText\" style=\"font-style:italic;\"><abbr style=\"margin:2px;\" title=\"by " . getAuthor($m['user_id']) . "\">Last Modified: " . date('m/d/y g:i a', $m['page_content_log_timestamp']) . "</abbr></span>"; } echo "</td>\n"; echo "<td align=\"right\" >"; if ($level == 1) { echo "<a class=\"table_addsubpage_link\" href=\"" . PAGE_PUBLISH . "?section=webpage&parent=" . $pInfo['page_content_id'] . "\" title=\"Add Sub Page\">Add Subpage</a>"; echo " "; } if (user_has_permission('banners')) { //echo "<a class=\"table_banner_link\" href=\"".PAGE_MANAGE."?action=banners§ion=webpage&id=".$pInfo['page_content_id']."\" title=\"Add Banner\">Advert</a>\n"; //echo " "; } if (user_has_permission('content') && user_has_page_permissions($pInfo['page_content_id'])) { echo "<a class=\"table_edit_link\" href=\"" . PAGE_MANAGE . "?action=edit§ion=webpage&id=" . $pInfo['page_content_id'] . "\" title=\"Edit " . output($pInfo['page_content_title']) . "\">Edit</a>\n"; echo " "; } if (user_has_permission('admin')) { echo "<a class=\"table_delete_link\" href=\"" . PAGE_MANAGE . "?action=delete§ion=webpage&id=" . $pInfo['page_content_id'] . "\" title=\"Delete " . output($pInfo['page_content_title']) . "\" onclick=\"return confirm('Are you sure you want to delete this page? THIS IS NOT UNDOABLE');\">Delete</a>\n"; } echo "</td>\n"; echo "</tr>\n"; recurse_pages($pInfo['page_content_id'], $level); $count++; } }
<thead> <tr> <th>Uživatel</th> <th>Čas</th> <th>IP</th> <th>Typ operace</th> <th>Typ záznamu</th> <th>Záznam</th> </tr> </thead> <tbody> '; $even = 0; while ($rec = MySQL_Fetch_Assoc($res)) { echo '<tr class="' . ($even % 2 == 0 ? 'even' : 'odd') . '"> <td>' . getAuthor($rec['iduser'], 0) . '</td> <td>' . ($rec['time'] ? Date('d. m. Y (H:i:s)', $rec['time']) : 'nikdy') . '</td> <td>' . $rec['ip'] . '</td> <td>' . operationType($rec['operation_type']) . '</td> <td>' . recordType($rec['record_type']) . '</td> <td>'; if ($rec['idrecord'] > 0) { echo '<a href="' . linkType($rec['record_type'], $rec['idrecord']) . '">' . getRecord($rec['record_type'], $rec['idrecord']) . '</a>'; } else { echo getRecord($rec['record_type'], $rec['idrecord']); } echo '</td></tr>'; $even++; } echo '</tbody> </table>
} if ($i != 0) { ?> </ul> <!-- end of #pripady --><?php } else { ?> <p><em>K případu není přiřazeno žádné hlášení.</em></p><?php } ?> <div class="clear"> </div> <p><strong>Datum poslední změny:</strong> <?php echo Date('d. m. Y', $rec['datum']); ?> <strong>Změnil:</strong> <?php $name = getAuthor($rec['iduser'], 1); echo $name; ?> </p> <div class="clear"> </div> </div> <!-- end of #info --> </fieldset> <fieldset><legend><h2>Popis</h2></legend> <div class="field-text"><?php echo StripSlashes($rec['contents']); ?> </div> </fieldset>
<div class="clear"> </div> <p><strong>Datum vytvoření:</strong> <?php echo $rec['created'] == 0 ? 'asi dávno' : Date('d. m. Y', $rec['created']); ?> <strong>Vytvořil:</strong> <?php $name = getAuthor($rec['created_by'], 1); echo $rec['created_by'] == 0 ? 'asi Krauz' : $name; ?> </p> <div class="clear"> </div> <p><strong>Datum poslední změny:</strong> <?php echo Date('d. m. Y', $rec['modified']); ?> <strong>Změnil:</strong> <?php $name = getAuthor($rec['modified_by'], 1); echo $name; ?> </p> <div class="clear"> </div> </div> <!-- end of #info --> </fieldset> <!-- náseduje popis osoby --> <fieldset> <legend><h2>Informace k symbolu</h2></legend> <div class="field-text"><?php echo StripSlashes($rec['desc']); ?> </div>
outputJSON('File uploaded exceeds maximum upload size.'); } // Check if the file exists if (file_exists($path . $_FILES['SelectedFile']['name'])) { outputJSON('File with that name already exists.'); } // Upload file if (!move_uploaded_file($_FILES['SelectedFile']['tmp_name'], $path . $_FILES['SelectedFile']['name'])) { outputJSON('Error uploading file - check destination is writeable.'); } // Success! //outputJSON('File uploaded successfully', 'success'); $file = "directory/music_dir.json"; $json_dir = json_decode(file_get_contents($file), true); $dirArray = $json_dir['directory']; $fullPath = $_FILES['SelectedFile']['name']; $noExtension = substr($_FILES['SelectedFile']['name'], 0, -4); $count = count($dirArray); // index of new song //$dirArray[$count]['artist'] = $_POST['artist']; //$dirArray[$count]['title'] = $_POST['title']; $dirArray[$count]['artist'] = getAuthor($noExtension); $dirArray[$count]['title'] = getTitle($noExtension); $dirArray[$count]['path'] = $noExtension; $dirArray[$count]['cover'] = createAndGetImageFromFile($noExtension); $newJson = []; $newJson['directory'] = $dirArray; $newFile = file_put_contents($file, json_encode($newJson, TRUE)); $dirArray[$count]['id'] = $count; $dirArray[$count]['status'] = "success"; echo json_encode($dirArray[$count], TRUE);
?> </p> </td> <td> <h3>Nedokončené úkoly: <?php $sql_r = "SELECT * FROM " . DB_PREFIX . "tasks WHERE " . DB_PREFIX . "tasks.iduser="******" AND " . DB_PREFIX . "tasks.status=0 ORDER BY " . DB_PREFIX . "tasks.created ASC"; $res_r = MySQL_Query($sql_r); $rec_count = MySQL_Num_Rows($res_r); echo $rec_count; ?> </h3><p> <?php if (MySQL_Num_Rows($res_r)) { $tasks = array(); while ($rec_r = MySQL_Fetch_Assoc($res_r)) { $tasks[] = StripSlashes($rec_r['task']) . ' (' . getAuthor($rec_r['created_by'], 2) . ') | <a href="procother.php?fnshtask=' . $rec_r['id'] . '">hotovo</a>'; } echo implode($tasks, '<br />'); } else { echo 'Nemáte žádné nedokončené úkoly.'; } ?> </p> </td> </tr></table> <div class="clear"> </div> </fieldset> </div> <?php filter();
<th>Akce</th> </tr> </thead> <tbody> '; $even = 0; while ($rec = MySQL_Fetch_Assoc($res)) { echo '<tr class="' . ($even % 2 == 0 ? 'even' : 'odd') . '"> <td>' . $rec['id'] . '</td> <td>' . StripSlashes($rec['task']) . '</td> <td>' . getAuthor($rec['iduser'], 0) . '</td> <td>' . status($rec['status']) . '</td> <td>' . ($rec['created'] ? Date('d. m. Y (H:i:s)', $rec['created']) : 'nikdy') . '</td> <td>' . getAuthor($rec['created_by'], 0) . '</td> <td>' . ($rec['modified'] ? Date('d. m. Y (H:i:s)', $rec['modified']) : 'nikdy') . '</td> <td>' . ($rec['modified_by'] ? getAuthor($rec['modified_by'], 0) : 'nikdo') . '</td> <td>' . ($rec['status'] != 2 ? '<a href="procother.php?acctask=' . $rec['id'] . '">uzavřít</a> ' : '') . ($rec['status'] != 0 ? '| <a href="procother.php?rtrntask=' . $rec['id'] . '">vrátit</a> ' : '') . ($rec['status'] != 3 ? '| <a href="procother.php?cncltask=' . $rec['id'] . '">zrušit</a>' : '') . '</td> </tr>'; $even++; } echo '</tbody> </table> </div> '; } else { echo '<div id="obsah"><p>Žádné úkoly neodpovídají výběru.</p></div>'; } } else { auditTrail(10, 1, 0); pageStart('Přidán úkol'); mainMenu(3);
<body> <?php //Strings $quote = "Courage is resistance to fear, mastery of fear, not absence of fear"; $replaced = str_replace("fear", "pain", $quote, $count); echo $count; echo $replaced; echo strpos($quote, "fear", 26); //Functions function booksByAuthorYear($tempAuthorName, $tempYear = 1910) { echo "\n"; echo $tempAuthorName; echo "\n"; echo $tempYear; } function getAuthor() { return "Charles Dickens"; } $year = 1920; $authorName = getAuthor(); echo $authorName; echo booksByAuthorYear("Ruben Dario"); ?> </body> </html>
echo implode($cases, '<br />') != "" ? implode($cases, '<br />') : '<em>Uživatel nemá žádný přiřazený neuzavřený případ.</em>'; ?> </p> <div class="clear"> </div> <h3>Nedokončené úkoly: <?php $sql_r = "SELECT * FROM " . DB_PREFIX . "tasks WHERE " . DB_PREFIX . "tasks.iduser="******" AND " . DB_PREFIX . "tasks.status=0 ORDER BY " . DB_PREFIX . "tasks.created ASC"; $res_r = MySQL_Query($sql_r); $rec_count = MySQL_Num_Rows($res_r); echo $rec_count; ?> </h3><p> <?php if (MySQL_Num_Rows($res_r)) { $tasks = array(); while ($rec_r = MySQL_Fetch_Assoc($res_r)) { $tasks[] = StripSlashes($rec_r['task']) . ' (' . getAuthor($rec_r['created_by'], 2) . ')'; } echo implode($tasks, '<br />'); } else { echo 'Uživatel nemá žádné nedokončené úkoly.'; } ?> </p> <div class="clear"> </div> </fieldset> </div> <?php } else { echo '<div id="obsah"><p>Uživatel neexistuje.</p></div>'; }
function translateCommonlabel($template) { global $pagesize, $articleid; $template = str_replace("【#sitename】", getSitename(), $template); $template = str_replace("【#htmltitle】", getHtmltitle(), $template); $template = str_replace("【#copyright】", getCopyright(), $template); $template = str_replace("【#path】", getPath(), $template); $template = str_replace("【#logo】", getLogo(), $template); $template = str_replace("【#chanels】", getChanels(), $template); $template = str_replace("【#childcolumnlist】", getChildcolumnlist(), $template); //网站,栏目,文章关键字 $template = str_replace("【#sitekeywords】", getSitekeywords(), $template); $template = str_replace("【#columnkeywords】", getColumnkeywords(), $template); $template = str_replace("【#articlekeywords】", getArticlekeywords(), $template); $template = str_replace("【#columnname】", getColumnname(), $template); $template = str_replace("【#articleid】", $articleid, $template); $template = str_replace("【#articletitle】", getArticletitle(), $template); $template = str_replace("【#articlecontent】", getArticlecontent(), $template); $template = str_replace("【#date】", getAdddate(), $template); $template = str_replace("【#hits】", getHits(), $template); $template = str_replace("【#author】", getAuthor(), $template); $template = str_replace("【#source】", getSource(), $template); $template = str_replace("【#picurl】", getPicurl(), $template); $template = str_replace("【#pre】", getPre(), $template); $template = str_replace("【#next】", getNext(), $template); $template = str_replace("【#notes】", getNotes(), $template); $template = str_replace("【#commentform】", getCommentform(), $template); //替换自定义字段标签 $template = translateSdefFeildlabel($template); $template = str_replace("【#showpage】", getPage($pagesize), $template); return $template; }
<?php require_once "connect.php"; require_once "functions.php"; //get author data if (!is_numeric($id) || is_numeric($_GET['id'])) { $id = $mysqli->real_escape_string($_GET['id']); } else { echo "Error: No author selected"; exit; } //We now have the relevant author ID, so load them $authors = getAuthor($id); $author = $authors['author'][0]; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title><?php echo $author['forenames'] . " " . $author['surname']; ?> - Shastrix Books</title> <link rel="stylesheet" type="text/css" href="/books/styles.css"> <script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script> <script src="scripts.js" type="text/javascript"></script> <link rel="icon" href="http://s3.shastrix.co.uk/favicon.ico" type="image/x-icon"> </head> <body> <div id="wrapper"> <header>
</tr> <? $count=0; while($aInfo = dbFetchArray($articleResults)) { $row = $count % 2; ?> <tr> <td ><input type="checkbox" name="checkbox" id="checkbox" /></td> <td ><? if($a['article_sticky']) echo "<img src=\"images/star.png\" alt=\"Sticky\">"; ?><a href="<?=PAGE_MANAGE?>?action=edit§ion=article&id=<?=$aInfo['article_id']?>"><?=output($aInfo['article_title'])?></a></td> <td > <? echo date('m/d/Y', $aInfo['article_publish_date']); ?> </td> <td ><?=getAuthor($aInfo['author'])?></td> <td > <? echo date('m/d/Y', $aInfo['article_added']); ?> </td> <td align="right" > <a class="table_edit_link" href="<?=PAGE_MANAGE?>?action=edit§ion=article&id=<?=$aInfo['article_id']?>">Edit</a> <a class="table_delete_link" href="<?=PAGE_MANAGE?>?action=delete&section=article&id=<?=$aInfo['article_id']?>" onclick="return confirm('Are you sure you want to delete this article? this is NOT UNDOABLE');">Delete</a> </td> </tr> <? $count++; } ?>
$sql = "SELECT u.*, ui.* FROM user AS u, user_information AS ui WHERE ui.user_id = u.user_id ORDER BY u.user_created ASC"; $userResults = dbQuery($sql); while($uInfo = dbFetchArray($userResults)) { $row = $count % 2; ?> <tr> <td class="row<?php echo $row; ?> "><input type="checkbox" name="checkbox" id="checkbox" /></td> <td class="row<?php echo $row; ?> "><?php echo getAuthor($uInfo['user_id']); ?> </td> <td class="row<?php echo $row; ?> "><?php echo getDateCreated($uInfo['user_id']); ?> </td> <td class="row<?php echo $row; ?> "><?php echo getLastLogin($uInfo['user_id']); ?>
</p> </td> </tr></table> <div class="clear"> </div> </fieldset> <?php $res_d = MySQL_Query("SELECT * FROM " . DB_PREFIX . "dashboard ORDER BY id DESC LIMIT 1"); if ($rec_d = MySQL_Fetch_Assoc($res_d)) { ?> <fieldset><legend> <h2>Veřejná nástěnka</h2> <strong>Poslední změna:</strong> <?php echo Date('d. m. Y', $rec_d['created']); ?> <strong>Změnil:</strong> <?php $name = getAuthor($rec_d['iduser'], 0); echo $name; ?> </legend> <p> <?php if (isset($rec_d['content'])) { echo StripSlashes($rec_d['content']); } else { echo 'Veřejná nástěnka nemá žádný obsah.'; } ?> </p> <div class="clear"> </div> </fieldset>