Exemple #1
0
function produceTagIds($string)
{
    $tagids = array();
    //Tags aus String auslesen
    $tags = explode(',', $string);
    $tags = array_map('trim', $tags);
    //Tags produzieren
    foreach ($tags as $tag) {
        if (!$tag) {
            continue;
        }
        $id = getTagId($tag);
        if (!$id) {
            $id = createTag($tag);
        }
        $tagids[] = $id;
    }
    return $tagids;
}
Exemple #2
0
function createContainer($tag, $value = '')
{
    return createTag($tag, $value, false);
}
Exemple #3
0
if (mysqli_connect_errno()) {
    die('n/a');
}
mysqli_set_charset($con, "utf8");
// // increase hits
foreach ($fabrics as $folder => $images) {
    echo "<h3>Category {$folder}</h3>";
    $prefix = $cg->dbprefix;
    $query = "SELECT * FROM " . $cg->dbprefix . "k2_categories WHERE alias='" . $folder . "'";
    //   var_dump($query);
    $category = mysqli_fetch_assoc(mysqli_query($con, $query));
    $id = $category["id"];
    $name = $category["name"];
    var_dump($id);
    $date = date("Y-m-d H:i");
    $createTagQuery = createTag($prefix, $folder);
    var_dump(mysqli_query($con, $createTagQuery));
    $src = $imgDir . $folder;
    foreach ($images as $key => $value) {
        $img = $src . '/' . $value;
        echo "{$img}";
        echo "<p>";
        $image = getImg($img);
        $rgbs = rgb($image);
        $avgRgbs = averageRgb($image, $rgbs);
        $hue = getHSL($avgRgbs);
        var_dump($hue);
        $color = markColor($hue);
        echo "{$color}";
        echo '<div style="width:300px; height:300px; background-color: ' . $color . ';"></div>';
        echo '<img src="../../images/fabrics/' . $folder . '/' . $value . '">';
Exemple #4
0
/**
 * Update RSS File
 *
 * @author  Mike Clark    <*****@*****.**>
 */
function rssexport($WHERE)
{
    global $config, $rss_timestamp_format, $filter;
    // make sure server doesn't specify something else
    header('Content-type: text/xml; charset=utf-8');
    if ($filter) {
        $result = exportData($WHERE);
    } else {
        // get the latest items from the DB according to config setting
        $SQL = 'SELECT id, title, plot, created 
                     FROM ' . TBL_DATA . ' 
                 ORDER BY created DESC LIMIT ' . $config['shownew'];
        $result = runSQL($SQL);
    }
    // script root
    $base = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
    // setup the RSS Feed
    $rssfeed = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
    $rssfeed .= '<rss version="2.0"  xmlns:atom="http://www.w3.org/2005/Atom">';
    $rssfeed .= '<channel>';
    $rssfeed .= '<atom:link href="' . $base . '/index.php?export=rss" rel="self" type="application/rss+xml" />';
    $rssfeed .= createTag('title', 'VideoDB');
    $rssfeed .= createTag('link', $base . '/index.php?export=rss');
    $rssfeed .= createTag('description', 'New items posted on VideoDB');
    $rssfeed .= createTag('language', 'en-us');
    $rssfeed .= createTag('lastBuildDate', date($rss_timestamp_format));
    // build the <item></item> section of the Feed
    foreach ($result as $item) {
        $xml_item = createTag('title', $item['title']);
        $xml_item .= createTag('link', $base . '/show.php?id=' . $item['id']);
        $xml_item .= createTag('description', $item['plot']);
        $xml_item .= createTag('guid', $base . '/show.php?id=' . $item['id']);
        $xml_item .= createTag('pubDate', rss_timestamp($item['created']));
        $rssfeed .= createTag('item', $xml_item, false);
    }
    $rssfeed .= '</channel>';
    $rssfeed .= '</rss>';
    header('Content-type: text/xml');
    #   header('Content-length: '.rssfeed($xml));
    #   header('Content-disposition: filename=rss.xml');
    echo $rssfeed;
}
	/**
	* Accepts a CSV string of tags for a content and adds it to tha database.
	* TODO: Optimize the function to execute one SQL query.
	* @param string $tags CSV tags for a content.
	*/
	public function addTags($tags)
	{
		$tagarray = csv2array(pg_escape_string($tags));
		for($i=0;$i<count($tagarray);$i++)
		{
			$sql= "Insert into content_tags(ct_contentid, ct_tagid) values('".$this->cid."','".createTag($tagarray[$i])."')";
			dbquery($sql);
		}
	}