function dirtag_search_link ($attr) { global $vdir_alias; @$template = $attr['template']; # XXX Pfusch! $args = array ('template' => $vdir_alias['SEARCH'] . $template); return tag_link (array_merge ($attr, $args)); }
function tag_ids_checkbox_ul($tags, $tag_defaults = array()) { if (count($tags) > 0) { $content = ''; foreach ($tags as $tag) { $default = count($tag_defaults) > 0 ? in_array($tag['tag_id'], $tag_defaults) : false; $content .= li(checkbox_array('tag_ids', $tag['tag_id'], $default) . ' --- ' . tag_link($tag['name'])); } $content = ul($content); return $content; } else { return false; } }
function forum_menu($parent_id = -1, $step = 0, $name, $parent_name = '') { global $db, $fullsite; $lang = "_" . get_language(); if ($parent_id == -1) { $sql = "select * from ntk_forum_categories where parent_id = -1"; } else { $sql = "select * from ntk_forum_categories where parent_id = " . $parent_id; } if ($name != '') { $id = ' class="' . $name . '" '; } $step++; $result = $db->query($sql, true, "Query failed"); $org = str_repeat(' ', $step * 10) . '<ul ' . $id . '>' . chr(13); while ($aR = $db->fetchByAssoc($result)) { $special = ''; if ($aR['status_id'] == 0) { $special = ' '; } $href = ""; if ($aR['link'] != '') { if (substr($aR['link'], 0, 7) == 'http://') { $href = ' href="' . $aR['link'] . '" '; } else { $href = ' href="' . forum_path . '/' . $aR['group'] . '/0/' . $aR['link'] . '" '; } } else { if ($parent_name != '') { $href = ' href="' . forum_path . '/' . $aR['category_id'] . '/0/' . tag_link($aR['category_name' . $lang]) . '.html" '; } } $org .= str_repeat(' ', $step * 10) . '<li><a data-actor="' . $aR['id'] . '" title="' . $aR['note'] . '" id="' . $aR['id'] . '" token="' . $md5sum . '" name="' . $aR['category_name'] . '" note="' . $aR['note'] . '" status="' . $aR['status_id'] . '" uid="' . $aR['detail_id'] . '" uidtoken="' . $uidtoken . '" order="' . $aR['order'] . '" ' . $special . ' style="cursor:pointer" ' . $href . '><span>' . $aR['category_name' . $lang] . '</span></a>' . chr(13); $parent_name_vl = tag_link($aR['category_name' . $lang]); $org .= forum_menu($aR['category_id'], $step, '', $parent_name_vl); $org .= str_repeat(' ', $step * 10) . '</li>' . chr(13); } $org .= str_repeat(' ', $step * 10) . '</ul>' . chr(13); return $org; }
$edit_article = $db->getone($sql); $smarty->assign('edit_article', $edit_article); $smarty->assign('upfiles_dir', $upfiles_dir); $smarty->assign('thumb_dir', $thumb_dir); $smarty->assign('article_category', get_article_category()); $smarty->assign('subsite', get_subsite_list(intval($_CFG['subsite_id']))); $smarty->assign('pageheader', "新闻资讯"); get_token(); $smarty->display('article/admin_article_edit.htm'); } elseif ($act == 'editsave') { check_permissions($_SESSION['admin_purview'], "article_edit"); check_token(); $id = intval($_POST['id']); $setsqlarr['title'] = trim($_POST['title']) ? trim($_POST['title']) : adminmsg('您没有填写标题!', 1); $setsqlarr['type_id'] = trim($_POST['type_id']) ? intval($_POST['type_id']) : 0; $setsqlarr['content'] = !empty($_POST['content']) ? tag_link($_POST['content']) : adminmsg('您没有内容!', 1); $setsqlarr['tit_color'] = trim($_POST['tit_color']); $setsqlarr['tit_b'] = intval($_POST['tit_b']); $setsqlarr['author'] = trim($_POST['author']); $setsqlarr['source'] = trim($_POST['source']); $setsqlarr['focos'] = intval($_POST['focos']); $setsqlarr['is_display'] = intval($_POST['is_display']); $setsqlarr['is_url'] = trim($_POST['is_url']); $setsqlarr['seo_keywords'] = $_POST['seo_keywords']; $setsqlarr['seo_description'] = $_POST['seo_description']; $setsqlarr['article_order'] = intval($_POST['article_order']); if ($_FILES['Small_img']['name']) { $upfiles_dir .= date("Y/m/d/"); make_dir($upfiles_dir); $Small_img = _asUpFiles($upfiles_dir, "Small_img", 1024 * 2, 'jpg/gif/png', true); $makefile = $upfiles_dir . $Small_img;
begin_debug(); // By default, localhost root/root MySQL user is used. Set $q_server, $q_user, $q_password to override $q_database = 'imdb_sample'; q("CREATE TABLE IF NOT EXISTS films (title VARCHAR(250), year SMALLINT, cover VARCHAR(250))"); $http_cache = true; http_get('http://www.imdb.com/chart/top/'); foreach (tags_html('.titleColumn') as $film) { set_source($film); $year = inside('(', ')', tag_text('.secondaryInfo')); if ($year < 2015) { continue; } http_get(tag_link('a')); // Open film link $title = q_escape(replace('(*)', '', tag_text('h1'))); // Take title and remove year like (2015) from it if (q("SELECT * FROM films WHERE title={$title}")) { continue; } // If film already in DB, skip http_get(tag_link('.poster')); // Open poster link $cover = q_escape(http_get_file(tag_image('#primary-img'), 'covers/')); // Download primary image from slideshow q("INSERT INTO films SET title={$title}, year={$year}, cover={$cover}"); } // Lets output the films from our DB foreach (qq("SELECT * FROM films") as $film) { echo "<h1><img src='{$film['cover']}' /> {$film['title']} <i>({$film['year']})</i></h1>"; } // THE END
function html_tag_pair($dbh, $tagpair) { $tagname1 = $tagpair['tagname1']; $tagname2 = $tagpair['tagname2']; $occurence = $tagpair['occurence']; echo ' <div class="row tag" id="tag-pair"> <div class="col-md-4">' . tag_link($tagname1) . '</div> <div class="col-md-4">' . tag_link($tagname2) . '</div> <span style="font-size:12px; color: #888; padding:5px; padding-left: 10px;">occurs ' . $occurence . ' times.</span>'; echo '</div>'; }
foreach ($categories as $category) { $html .= category_link($category, true); } echo $html; $html = ''; ?> </ul> </div> <div class="listing"> <h4>Top Tags</h4> <ul class="links"> <?php $args = array('type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'count', 'order' => 'desc', 'hide_empty' => 1, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => 12, 'taxonomy' => 'tag', 'pad_counts' => false); $tags = get_tags($args); foreach ($tags as $tag) { $html .= tag_link($tag, true); } echo $html; $html = ''; ?> </ul> </div> </section> <section id="powered-by"> <div class="min-max"> <h3>GeebArt.com is Powered By:</h3> <ul> <li><a href="http://www.html5rocks.com/en/" target="_blank" title="html5 logo"><img src="<?php echo get_bloginfo('template_directory'); ?> /images/html5-logo.png" alt="html5 logo"></a></li>