Пример #1
0
function add_post($userid, $title, $content, $tags)
{
    validate_user_id($userid);
    $con = db_connect();
    $title = mysql_real_escape_string($title);
    $content = mysql_real_escape_string($content);
    $tags = format_tags($tags);
    $sql = "INSERT INTO posts (user, title, content, tags, posttime) VALUES ({$userid}, '{$title}', '{$content}', '{$tags}', NOW())";
    $success = mysql_query($sql);
    db_close($con);
    return $success;
}
Пример #2
0
    echo $link['url'];
    ?>
</a></span>&nbsp;<em title="Last accessed <?php 
    echo date('j M Y \\a\\t g:ia', (int) $link['last_access']);
    ?>
"><?php 
    echo $link['count'];
    ?>
</em></td>
					<td class="tags">
						<div id="tags-<?php 
    echo $link['id'];
    ?>
">
							<?php 
    echo format_tags($link['tags']);
    if ($is_admin) {
        ?>
							<a href="#" class="edit-tags" title="Edit tags" onclick="toggleTagForm('<?php 
        echo $link['id'];
        ?>
', true); return false;">+</a>
						</div>
						<form action="/" method="get" id="edit-tags-<?php 
        echo $link['id'];
        ?>
" class="edit-tags-form">
							<input type="hidden" name="id" value="<?php 
        echo $link['id'];
        ?>
">
Пример #3
0
function save_writeup($filename, $palette_name, $palette, $palette_tags, $flickr_photo)
{
    global $flickr_api;
    global $current_id;
    $flickr_photo_user = photo_user_name($flickr_photo);
    $flickr_photo_name = photo_name($flickr_photo);
    $flickr_photo_url = photo_page_url($flickr_photo);
    $flickr_photo_tags = photo_tags($flickr_photo);
    $writeup = "<b>How I made this image.</b><br />" . "I found a palette at colr called " . $palette_name . " with the following " . tag_or_tags($palette_tags) . ": " . format_tags($palette_tags) . " and searched for those tags on flickr.<br />" . "I found an image at flickr called " . "<a href='" . $flickr_photo_url . "'>" . $flickr_photo_name . "</a>" . " by " . $flickr_photo_user . " which had the " . tag_or_tags($flickr_photo_tags) . " " . format_tags($flickr_photo_tags) . " and I traced that using autotrace.<br />" . "I then applied the colr palette to the autotraced flickr picture " . "in my own unique way to make this finished image.<br />" . "This image is licensed under a " . "<a href='http://creativecommons.org/licenses/by-sa/2.5/'>" . "Creative Commons License</a><br />";
    $result = file_put_contents($filename, $writeup);
    if (!$result) {
        die("Couldn't save writeup html.");
    }
}