Example #1
0
/**
 * @param $value
 * @param int $limit
 * @return string
 */
function excerpt($value, $limit = 64)
{
    $value = str_replace(["\n", "\t", "\r"], ' ', plain($value));
    $value = trim(preg_replace('/ {2,}/', ' ', $value));
    $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8', false);
    return html_limit(plain($value), $limit);
}
Example #2
0
function healOutput($x = null)
{
    if (!isset($x)) {
        return null;
    } else {
        if (is_string($x)) {
            return plain($x);
        } else {
            if (is_array($x)) {
                foreach ($x as $k => $v) {
                    $x[$k] = healOutput($v);
                }
                return $x;
            }
        }
    }
    return $x;
}
Example #3
0
		<div class="">
			<div class="span-3" style="text-align: right;">
				<label>Name:</label>
			</div>
			<span><?php 
echo empty($db_object->array['name']) ? '&nbsp;' : plain($db_object->array['name']);
?>
</span>
		</div>
		<div class="">
			<div class="span-3" style="text-align: right;">
				<label>Value:</label>
			</div>
			<span><?php 
echo empty($db_object->array['value']) ? '&nbsp;' : plain($db_object->array['value']);
?>
</span>
		</div>
		<div class="">
			<div class="span-3" style="text-align: right;">
				<label>Modified:</label>
			</div>
			<span><?php 
echo empty($db_object->array['modified']) ? '&nbsp;' : plain($db_object->array['modified']);
?>
</span>
		</div>
Example #4
0
        ?>
</a></h2>

            <div class="post-info">
                Napísané dňa <?php 
        echo $post["created_at"];
        ?>
.
            </div>

            <div class="post-teaser">
                <?php 
        echo $post["teaser"];
        ?>
            </div>

        </div>
    <?php 
    }
} else {
    ?>
        <div class="message">Žiaľ v databáze autor <strong><?php 
    echo plain($user["name"]);
    ?>
</strong> nemá žiadne príspevky.</div>
    <?php 
}
?>

<?php 
include_footer();
Example #5
0
 function html_display($content)
 {
     if ($content instanceof DBObject) {
         Backend::add('Sub Title', $content->array['title']);
         if ($content->array['from_file']) {
             //Move this to the object ??
             $filename = 'content/static/' . $content->array['name'] . '.html';
             $template = 'content/' . $content->array['name'] . '.tpl.php';
             if (Render::checkTemplateFile($template)) {
                 $content->object->body = Render::file($template);
             } else {
                 if (file_exists(SITE_FOLDER . '/' . $filename)) {
                     $content->object->body = file_get_contents(APP_FOLDER . '/' . $filename);
                 } else {
                     if (file_exists(APP_FOLDER . '/' . $filename)) {
                         $content->object->body = file_get_contents(APP_FOLDER . '/' . $filename);
                     } else {
                         if (file_exists(BACKEND_FOLDER . '/' . $filename)) {
                             $content->object->body = file_get_contents(BACKEND_FOLDER . '/' . $filename);
                             //SITE FOLDER too?
                         }
                     }
                 }
             }
         }
         $meta_desc = Backend::get('meta_description');
         if (empty($meta_desc)) {
             Backend::add('meta_description', plain(self::createPreview($content->object->body, false)));
         }
         $http_equiv = Backend::get('meta_http_equiv', array());
         $http_equiv['Last-Modified'] = $content->object->modified;
         Backend::add('meta_http_equiv', $http_equiv);
         if (!headers_sent()) {
             $max_age = ConfigValue::get('content.MaxAge', 86400);
             header('Last-Modified: ' . $content->object->modified);
             header('Expires: ' . gmdate('r', strtotime('+1 day')));
             header('Cache-Control: max-age=' . $max_age . ', must-revalidate');
             header('Pragma: cache');
         }
     }
     if (Backend::getDB('default')) {
         //TODO Make some of the content values (such as added and lastmodified) available
         //So you can add Last Modified on #lastmodified# to the content.
         $content = parent::html_display($content);
     }
     return $content;
 }
Example #6
0
    exit(0);
}
$file = $_GET["file"];
$word = $_GET["word"];
$around = 100;
if (isset($_GET["around"])) {
    $around = $_GET["around"];
}
$class = Auth::curClass();
if (strpos($file, $class) === FALSE) {
    echo "Research more! {$file} {$class}";
    exit(0);
}
$fs = new NativeFS("./log/");
if ($fs->exists("{$file}-data.txt")) {
    plain($file);
} else {
    if ($fs->exists("{$file}-data.log")) {
        json($file);
    }
}
function plain($file)
{
    global $fs, $word;
    $lines = explode("\n", $fs->getContent("{$file}-data.txt"));
    $a = array();
    $found = FALSE;
    foreach ($lines as $line) {
        array_push($a, "<code>" . mkTimeLink(preg_replace("/ /", "&nbsp;", htmlspecialchars($line))) . "\n</code><BR>");
        if ($found) {
            if (count($a) > $around * 2) {
Example #7
0
				<label id="obj_active_label" for="obj_active">Active</label><br>
				<select id="obj_active" name="active" class="">
					<option value="0"<?php 
if (empty($values['active'])) {
    ?>
 selected="selected"<?php 
}
?>
>No</option>
					<option value="1"<?php 
if ($values['active']) {
    ?>
 selected="selected"<?php 
}
?>
>Yes</option>
				</select>
			</div>
			<div id="obj_weight_container">
				<label id="obj_weight_label" for="obj_weight">Weight</label><br>
				<input id="obj_weight" name="weight" type="text" class="text" value="<?php 
echo plain($values['weight']);
?>
">
			</div>
			<input type="submit" value="<?php 
echo $action_name;
?>
 Tag" class=""/>
		</form>
?>
</span>
		</div>
		<div class="">
			<div class="span-3" style="text-align: right;">
				<label>Active:</label>
			</div>
			<span><?php 
echo empty($db_object->array['active']) ? '&nbsp;' : plain($db_object->array['active']);
?>
</span>
		</div>
		<div class="">
			<div class="span-3" style="text-align: right;">
				<label>Modified:</label>
			</div>
			<span><?php 
echo empty($db_object->array['modified']) ? '&nbsp;' : plain($db_object->array['modified']);
?>
</span>
		</div>
		<div class="">
			<div class="span-3" style="text-align: right;">
				<label>Added:</label>
			</div>
			<span><?php 
echo empty($db_object->array['added']) ? '&nbsp;' : plain($db_object->array['added']);
?>
</span>
		</div>
Example #9
0
<hr>
<form method="post" action="?q=<?php 
echo $action_url;
?>
" enctype="multipart/form-data">
	<input id="obj_foreign_table" name="foreign_table" type="hidden" value="<?php 
echo plain($values['foreign_table']);
?>
">
	<input id="obj_foreign_id"    name="foreign_id"    type="hidden" value="<?php 
echo plain($values['foreign_id']);
?>
">
	<div id="obj_title_container">
		<input id="obj_title" name="title" type="text" class="text title" value="<?php 
echo plain($values['title']);
?>
">
	</div>
	<div id="obj_content_container">
		<textarea id="obj_content" name="content" class="textarea"><?php 
echo $values['content'];
?>
</textarea>
	</div>
	<input type="submit" value="<?php 
echo $action_name;
?>
 Comment" class=""/>
</form>
Example #10
0
include_header(array("title" => "Úprava článku"));
?>

    <h1 class="text-center">Úprava článku</h1>

    <form method="post" enctype="multipart/form-data">

        <label for="title"><strong>Názov článku:</strong></label>
        <input type="text" name="title" id="title" value="<?php 
echo isset($_POST["title"]) ? $_POST["title"] : plain($post["title"]);
?>
">

        <label for="text"><strong>Text článku:</strong></label>
        <textarea name="text" id="text"><?php 
echo isset($_POST["text"]) ? $_POST["text"] : plain($post["text"]);
?>
</textarea>

        <?php 
if (!empty($tags)) {
    ?>
            <div><strong>Tagy:</strong>
                <?php 
    foreach ($tags as $tag) {
        ?>
                    <label><input type="checkbox" name="tags[]" value="<?php 
        echo $tag["id"];
        ?>
" <?php 
        echo isset($tag["checked"]) ? "checked" : "";
Example #11
0
        ?>
"><strong><?php 
        echo $post["user_name"];
        ?>
</strong></a> dňa <?php 
        echo $post["created_at"];
        ?>
.
            </div>

            <div class="post-teaser">
                <?php 
        echo $post["teaser"];
        ?>
            </div>

        </div>
    <?php 
    }
} else {
    ?>
        <div class="message">Žiaľ v databáze k tagu <strong><?php 
    echo plain($tag);
    ?>
</strong> nemáme žiadne príspevky.</div>
    <?php 
}
?>

<?php 
include_footer();
					<th>
						Name:
					</th>
					<td>
						<?php 
echo plain(trim($db_object->array['name'] . ' ' . $db_object->array['surname']));
?>
					</td>
				</tr>
				<tr>
					<th>
						Website:
					</th>
					<td>
						<?php 
echo empty($db_object->array['website']) ? 'None' : plain($db_object->array['website']);
?>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: center;">
						<?php 
echo empty($db_object->array['bio']) ? '&nbsp;' : simple($db_object->array['bio']);
?>
					</tr>
				</tr>
			</table>
		</div>
		<div id="gravatar_div" class="span-4 last">
			<a href="http://en.gravatar.com/site/check/<?php 
echo $db_object->array['email'];
?>
">
		</label>
	</div>
	<div id="value_mobile_container">
		<label id="value_mobile_label">Mobile<br>
			<input id="value_mobile" name="mobile" type="text" class="text" value="<?php 
echo plain($values['mobile']);
?>
">
		</label>
	</div>
	<div id="value_username_container">
		<label id="value_username_label">Username<br>
			<input id="value_username" name="username" type="text" class="text" value="<?php 
echo plain($values['username']);
?>
">
		</label>
	</div>
	<?php 
if (Permission::check('manage', 'BackendUser')) {
    ?>
		<div id="value_confirmed_container">
			<label id="value_confirmed_label">Confirmed<br>
				<select id="value_confirmed" name="confirmed" class="">
				<option value="0"<?php 
    if (!is_null($values['confirmed']) && empty($values['confirmed'])) {
        ?>
 selected="selected"<?php 
    }
?>
		<form method="post" action="?q=<?php 
echo $action_url;
?>
" enctype="multipart/form-data">
			<div id="obj_alias_container">
				<label id="obj_alias_label" for="obj_alias">Alias</label><br>
				<input id="obj_alias" name="alias" type="text" class="text" value="<?php 
echo plain($values['alias']);
?>
">
			</div>
			<div id="obj_query_container">
				<label id="obj_query_label" for="obj_query">Query</label><br>
				<input id="obj_query" name="query" type="text" class="text" value="<?php 
echo plain($values['query']);
?>
">
			</div>
			<div id="obj_active_container">
				<label id="obj_active_label" for="obj_active">Active</label><br>
				<select id="obj_active" name="active" class="">
					<option value="0"<?php 
if (empty($values['active'])) {
    ?>
 selected="selected"<?php 
}
?>
>No</option>
					<option value="1"<?php 
if ($values['active']) {
Example #15
0
$task = get_task(get_user_id(), segment(2));
if (!$task) {
    show_404();
}
include_header(array("title" => "delete", "show_logout" => true));
?>
    <div class="row">
        <div class="col-md-12">
            <form id="js-form-delete" method="post">
                <div class="form-group">
                    <textarea disabled class="form-control" id="js-text" rows="4" title=""><?php 
echo plain($task["task_text"]);
?>
</textarea>
                </div>
                <div class="form-group">
                    <input name="id" type="hidden" value="<?php 
echo plain($task["task_id"]);
?>
">
                    <button class="btn btn-sm btn-danger" type="submit">delete task</button>
                    <a href="<?php 
echo url();
?>
" class="btn btn-sm btn-default">back</a>
                </div>
            </form>
        </div>
    </div>
<?php 
include_footer();
Example #16
0
if (!empty($_GET["search"])) {
    $posts = get_posts_like($_GET["search"]);
} else {
    $posts = array();
}
include_header(array("title" => "Vyhľadávanie"));
?>

<h1 class="text-center">Vyhľadávanie</h1>

<form method="get">

    <label for="search"><strong>Čo hľadáte?</strong></label>
    <input type="text" name="search" id="search" value="<?php 
echo isset($_GET["search"]) ? $_GET["search"] : plain($post["search"]);
?>
" autofocus>

    <input type="submit" value="Hľadať">
</form>

<?php 
if (!empty($_GET["search"])) {
    if (count($posts)) {
        foreach ($posts as $post) {
            ?>
    <div class="post extra-padding">

        <h2><a href="<?php 
            echo $post["link"];
Example #17
0
function slugify($text)
{
    return join('/', array_map('parameterize', explode('/', plain($text))));
}
Example #18
0
		<form method="post" action="?q=<?php 
echo Controller::$area . '/' . Controller::$action . (empty(Controller::$parameters[0]) ? '' : '/' . Controller::$parameters[0]);
?>
" enctype="multipart/form-data">
			<div id="obj_name_container">
				<label id="obj_name_label" for="obj_name">Name</label><br>
				<input id="obj_name" name="name" type="text" class="text title" value="<?php 
echo plain($values['name']);
?>
">
			</div>
			<div id="obj_description_container">
				<label id="obj_description_label" for="obj_description">Description</label><br>
				<textarea id="obj_description" name="description" class="textarea"><?php 
echo $values['description'];
?>
</textarea>
			</div>
			<div id="obj_active_container">
				<label id="obj_active_label" for="obj_active">Active</label><br>
				<select id="obj_active" name="active" class="">
					<option value="1"<?php 
if ($values['active']) {
    ?>
 selected="selected"<?php 
}
?>
>Yes</option>
					<option value="0"<?php 
if (empty($values['active'])) {
    ?>
function format_post(array $post)
{
    // odstráni všetky biele znaky
    $post = array_map("trim", $post);
    // escapuje názov a obsah článku pre výpis, ochrana proti XSS útoku
    $post["title"] = plain($post["title"]);
    $post["text"] = plain($post["text"]);
    // vytvorí užitočné linky
    $post["link"] = filter_var(url() . "/clanok/" . $post["id"], FILTER_SANITIZE_URL);
    $post["link_edit"] = filter_var(url() . "/upravit-clanok/" . $post["id"], FILTER_SANITIZE_URL);
    $post["link_delete"] = filter_var(url() . "/vymazat-clanok/" . $post["id"], FILTER_SANITIZE_URL);
    // vytvorí linky na užívateľa
    $post["user_email"] = filter_var($post["user_email"], FILTER_SANITIZE_EMAIL);
    $post["user_link"] = filter_var(url() . "/autor/" . $post["user_id"], FILTER_SANITIZE_URL);
    // vytvorí náhľad článku pre úvodnú stránku so 40 slovami
    $post["teaser"] = word_limiter($post["text"], 40);
    // upraví text pre zobranenie článku
    $post['text'] = add_paragraphs($post['text']);
    // spracujeme dátum vytvorenia článku do krajšieho tvaru
    $post["created_at"] = str_replace(' ', '&nbsp;', date('j.n.Y \\o G:i', strtotime($post['created_at'])));
    // získame tagy
    $tags = $post['tags'] ? explode('|', $post['tags']) : array();
    $post["tags"] = array();
    foreach ($tags as $tag) {
        $post["tags"][$tag] = filter_var(url() . "/tag/" . urlencode($tag), FILTER_SANITIZE_URL);
    }
    return $post;
}
Example #20
0
                    <button class="btn btn-sm btn-danger" type="submit">add new task</button>
                </div>
            </form>
        </div>

        <div class="col-md-12">
            <ul id="js-list" class="list-group">
                <?php 
foreach ($tasks as $task) {
    ?>
                    <li id="item-<?php 
    echo $task["task_id"];
    ?>
" class="list-group-item item-in-the-list">
                        <?php 
    echo plain($task["task_text"]);
    ?>
                        <div class="controls pull-right">
                            <a href="<?php 
    echo url();
    ?>
/edit/<?php 
    echo $task["task_id"];
    ?>
" class="text-muted edit-link">edit</a>
                            <a href="<?php 
    echo url();
    ?>
/delete/<?php 
    echo $task["task_id"];
    ?>
<div class="row">
    <div class="col-md-4 col-md-offset-4">
        <form id="login-form" method="post">
            <div class="form-group">
                <label for="inputName" class="sr-only">name</label>
                <input type="text" name="name" id="inputName" class="form-control" placeholder="name"
                       value="<?php 
echo isset($_POST["name"]) ? plain($_POST["name"]) : "";
?>
" required autofocus>
            </div>
            <div class="form-group">
                <label for="inputEmail" class="sr-only">email address</label>
                <input type="email" name="email" id="inputEmail" class="form-control" placeholder="email address"
                       value="<?php 
echo isset($_POST["email"]) ? plain($_POST["email"]) : "";
?>
" required>
            </div>
            <div class="form-group">
                <label for="inputPassword" class="sr-only">password</label>
                <input type="password" name="password" id="inputPassword" class="form-control"
                       placeholder="password"
                       required>
            </div>
            <div class="form-group">
                <label for="inputPasswordConfirm" class="sr-only">password again</label>
                <input type="password" name="passwordConfirm" id="inputPasswordConfirm" class="form-control"
                       placeholder="password again"
                       required>
            </div>
    $list_length = empty($list_length) ? Controller::$parameters[2] : $list_length;
    $pages = ceil($list_count / $list_length);
    $current_page = floor($list_start / $list_length) + 1;
    //var_dump(count($list), $list_count, $area, $action, $list_start, $list_length, $pages, $current_page);
}
if (!empty($db_object->array['list']) && is_array($db_object->array['list'])) {
    foreach ($db_object->array['list'] as $item) {
        $tags = Tag::getTags('contents', $item['id']);
        $link = '?q=content/' . $item['name'];
        ?>
		<h3>
			<a href="<?php 
        echo $link;
        ?>
"><?php 
        echo plain($item['title']);
        ?>
</a>
		</h3>
		<p>
			<?php 
        echo Content::createPreview($item['body'], false);
        ?>
		</p>
		<div class="clear">
			<div class="span-3">
				<a href="<?php 
        echo $link;
        ?>
">Read more</a>
			</div>