function get_category_id($con, $image, $category) { // Function to get the category id corresponding to the category name //$sql = "SELECT GroupID from WordGroup WHERE GroupName = '" . $category . "'"; $sql = "SELECT GroupID from WordGroup WHERE GroupName=:groupname"; // Run query and fetch category id if category exists $query = $con->prepare($sql); $query->execute(array(":groupname" => $category)); $results = $query->fetchAll(); if ($results != False && $query->rowCount() > 0) { $category_id = $results[0][0]; return $category_id; } else { create_new_category($con, $image, $category); $category_id = get_category_id($con, $image, $category); return $category_id; } }
echo $style_url; ?> /images/icons/settings_white.png" alt="Settings image" /> Edit Settings</a></li><?php } ?> </ul> <div class="tab-content"> <div class="tab-pane tab-pane-author-content active" id="tab1"> <div class="author-posts"> <?php $guide_cat = get_category_id('guides'); $stories_cat = get_category_id('stories'); $resources_cat = get_category_id('resources'); $blog_cat = get_category_id('blog'); $ideas_cat = get_category_id('ideas'); // VIEWER IS AUTHOR if ($curauth->ID == $current_user->ID) { $count = nh_get_user_posts_count($curauth->ID, array('post_type' => 'post', 'post_status' => array('draft', 'pending', 'publish'), 'posts_per_page' => -1)); // Viewer author has posts if ($count > 0) { // Guides $guideargs = array('author' => $curauth->ID, 'post_status' => array('pending', 'publish', 'draft'), 'cat' => $guide_cat, 'posts_per_page' => -1); $guidequery = new WP_Query($guideargs); if ($guidequery->have_posts()) { echo '<h5>CityHow Guides</h5>'; echo '<ul class="author-links">'; while ($guidequery->have_posts()) { $guidequery->the_post(); // echo $guidequery->ID; $post_key = nh_get_frm_entry_key($post->ID);
<ul class="breadcrumb"> <li><a href="index.php">Home</a></li> <li class="active">Search</li> </ul> <?php require_once "../resources/modules/auctions.php"; require_once "../resources/modules/categories.php"; $category = $_REQUEST['categoryQuery']; $searchQuery = $_REQUEST['searchQuery']; if ($category == 'All') { $results = get_auctions_searchTermOnly($searchQuery); echo "<h4>Search results for '{$searchQuery}' in All Categories</h4>"; } else { $results = get_auctions_searchTerm_category($category, $searchQuery); $name = get_category_id($category)["name"]; echo "<h4>Search results for '{$searchQuery}' in '{$name}'</h4>"; //Get } ?> <form name="sortForm" method="post"> <h4 id="sortButton">Sort</h4> <div class="input-group" id="sortDropdown"> <select id="sortQuery" class="form-control"> <option disabled selected>-</option> <option value="priceHiLo">Price High-Low</option> <option value="priceLoHi">Price Low-High</option> </select> </div> </form>
function doSearch() { global $db, $current_user, $main_smarty; $search_clause = $this->get_search_clause(); // set smarty variables if (isset($this->searchTerm)) { $main_smarty->assign('search', $this->searchTerm); $main_smarty->assign('searchtext', htmlspecialchars($this->searchTerm)); } else { $main_smarty->assign('searchtext', ''); } $from_where = "FROM " . $this->searchTable . " WHERE "; if ($this->filterToStatus == 'all') { $from_where .= " link_status!='discard' "; } if ($this->filterToStatus == 'queued') { $from_where .= " link_status='queued' "; } if ($this->filterToStatus == 'discard') { $from_where .= " link_status='discard' "; } if ($this->filterToStatus == 'published') { $from_where .= " link_status='published' "; } if ($this->filterToStatus == 'popular') { $from_where .= " link_status='published' "; } if ($this->url != '') { if ($this->filterToStatus != '') { $from_where .= ' AND '; } $from_where .= " link_url='{$this->url}' "; } if ($this->filterToTimeFrame == 'today') { $tsdt = date('Ymd000000', strtotime("now")); $fsdt = date('Ymd235959', strtotime("now")); $from_where .= " AND (link_published_date >= {$tsdt} AND link_published_date <= {$fsdt}) "; } if ($this->filterToTimeFrame == 'yesterday') { $tsdt = date('Ymd000000', strtotime("-1 day")); $fsdt = date('Ymd235959', strtotime("-1 day")); $from_where .= " AND (link_published_date >= {$tsdt} AND link_published_date <= {$fsdt}) "; } if ($this->filterToTimeFrame == 'week') { $wknum = date('w', strtotime("now")); if ($wknum > 0) { $tsdt = date('Ymd000000', strtotime("-{$wknum} day")); $fsdt = date('Ymd235959', strtotime("now")); } else { $tsdt = date('Ymd000000', strtotime("now")); $fsdt = date('Ymd235959', strtotime("now")); } $from_where .= " AND (link_published_date >= {$tsdt} AND link_published_date <= {$fsdt}) "; } if ($this->filterToTimeFrame == 'month') { $tsdt = date('Ym01000000', strtotime("now")); $fsdt = date('Ym' . date('t', strtotime("now")) . '235959', strtotime("now")); $from_where .= " AND (link_published_date >= {$tsdt} AND link_published_date <= {$fsdt}) "; } if ($this->filterToTimeFrame == 'year') { $tsdt = date('Y0101000000', strtotime("now")); $fsdt = date('Y1231235959', strtotime("now")); $from_where .= " AND (link_published_date >= {$tsdt} AND link_published_date <= {$fsdt}) "; } /////sorojit: for user selected category display if ($_COOKIE['mnm_user']) { $user_login = $db->escape(sanitize($_COOKIE['mnm_user'], 3)); $sqlGeticategory = $db->get_var("SELECT user_categories from " . table_users . " where user_login = '******';"); $from_where .= " AND link_category in ({$sqlGeticategory})"; } //should we filter to just this category? if (isset($this->category)) { //$catId = $db->get_var("SELECT category_id from " . table_categories . " where category_name = '" . $this->category . "';"); $catId = get_category_id($this->category); if (isset($catId)) { $child_cats = ''; // do we also search the subcategories? if ($this->search_subcats == true) { $child_array = ''; // get a list of all children and put them in $child_array. children_id_to_array($child_array, table_categories, $catId); if ($child_array != '') { // build the sql foreach ($child_array as $child_cat_id) { $child_cat_sql .= ' OR `link_category` = ' . $child_cat_id . ' '; } } } $from_where .= " AND (link_category={$catId} " . $child_cat_sql . ")"; } } if (isset($this->orderBy)) { if (strpos($this->orderBy, "ORDER BY") != 1) { $this->orderBy = "ORDER BY " . $this->orderBy; } } // always check groups (to hide private groups) $from_where = str_replace("WHERE", " LEFT JOIN " . table_groups . " ON " . table_links . ".link_group_id = " . table_groups . ".group_id WHERE", $from_where); $groups = $db->get_results("SELECT * FROM " . table_group_member . " WHERE member_user_id = {$current_user->user_id} and member_status = 'active'"); if ($groups) { $group_ids = array(); foreach ($groups as $group) { $group_ids[] = $group->member_group_id; } $group_list = join(",", $group_ids); $from_where .= " AND (" . table_groups . ".group_privacy!='private' OR ISNULL(" . table_groups . ".group_privacy) OR " . table_groups . ".group_id IN({$group_list})) "; } else { $group_list = ''; $from_where .= " AND (" . table_groups . ".group_privacy!='private' OR ISNULL(" . table_groups . ".group_privacy))"; } if ($this->searchTerm == "") { // like when on the index or upcoming pages. $this->sql = "SELECT link_id {$from_where} {$search_clause} {$this->orderBy} LIMIT {$this->offset},{$this->pagesize}"; } else { $this->sql = "SELECT link_id, link_date, link_published_date {$from_where} {$search_clause} "; } ############################################################################################################# START CUSTOM CODE advsearch 1.0 if ($this->adv && $this->searchTerm != "") { $from_where = table_links; $search_clause = 'WHERE '; $search_params = array(); $search_AND_params = array(); $query = "SELECT " . table_links . ".link_id AS link_id, " . table_links . ".link_date AS link_date, " . table_links . ".link_published_date AS link_published_date FROM "; // always check groups (to hide private groups) $from_where .= " LEFT JOIN " . table_groups . " ON " . table_links . ".link_group_id = " . table_groups . ".group_id "; if ($group_list) { $search_AND_params[] = " (" . table_groups . ".group_privacy!='private' OR ISNULL(" . table_groups . ".group_privacy) OR " . table_groups . ".group_id IN({$group_list})) "; } else { $search_AND_params[] = " (" . table_groups . ".group_privacy!='private' OR ISNULL(" . table_groups . ".group_privacy))"; } //check if it is a literal search $buffKeyword = $this->searchTerm; $keywords = array(); if (substr($this->searchTerm, 1, 1) == '"' && substr($this->searchTerm, strlen($this->searchTerm) - 1, 1) == '"') { $literal = true; $addparam = ' COLLATE latin1_general_cs '; $this->searchTerm = str_replace('\\"', '', $this->searchTerm); $keywords[] = $this->searchTerm; } else { $keywords = explode(' ', $this->searchTerm); } $bufferOrig = $this->searchTerm; //search category if ($this->s_cat != 0) { $search_AND_params[] = " " . table_links . ".link_category = " . $this->s_cat . " "; } //search tags if ($this->s_tags != 0) { foreach ($keywords as $key) { $this->searchTerm = $key; $search_params[] = " " . table_links . ".link_tags {$addparam} LIKE '%" . $this->searchTerm . "%' "; } $this->searchTerm = $bufferOrig; } //search links if ($this->s_story != 0) { foreach ($keywords as $key) { $this->searchTerm = $key; if ($this->s_story == 1) { $search_params[] = " " . table_links . ".link_title {$addparam} LIKE '%" . $this->searchTerm . "%' "; } if ($this->s_story == 2) { $search_params[] = " " . table_links . ".link_content {$addparam} LIKE '%" . $this->searchTerm . "%' "; } if ($this->s_story == 3) { $search_params[] = " " . table_links . ".link_title {$addparam} LIKE '%" . $this->searchTerm . "%' "; $search_params[] = " " . table_links . ".link_content {$addparam} LIKE '%" . $this->searchTerm . "%' "; } } $this->searchTerm = $bufferOrig; } //search author if ($this->s_user != 0) { $from_where .= " INNER JOIN " . table_users . " ON " . table_links . ".link_author = " . table_users . ".user_id "; foreach ($keywords as $key) { $this->searchTerm = $key; $search_params[] = " " . table_users . ".user_login {$addparam} LIKE '%" . $this->searchTerm . "%' "; } $this->searchTerm = $bufferOrig; } //search group if ($this->s_group != 0) { foreach ($keywords as $key) { $this->searchTerm = $key; if ($this->s_group == 1) { $search_params[] = " " . table_groups . ".group_name {$addparam} LIKE '%" . $this->searchTerm . "%' "; } if ($this->s_group == 2) { $search_params[] = " " . table_groups . ".group_description {$addparam} LIKE '%" . $this->searchTerm . "%' "; } if ($this->s_group == 3) { $search_params[] = " " . table_groups . ".group_name {$addparam} LIKE '%" . $this->searchTerm . "%' "; $search_params[] = " " . table_groups . ".group_description {$addparam} LIKE '%" . $this->searchTerm . "%' "; } } $this->searchTerm = $bufferOrig; } //search comments if ($this->s_comments != 0) { $from_where .= " LEFT JOIN " . table_comments . " ON " . table_links . ".link_id = " . table_comments . ".comment_link_id "; foreach ($keywords as $key) { $this->searchTerm = $key; $search_params[] = " " . table_comments . ".comment_content {$addparam} LIKE '%" . $this->searchTerm . "%' "; } $this->searchTerm = $bufferOrig; } $search_clause = ' WHERE (' . implode(' OR ', $search_params) . ' ) '; if (sizeof($search_AND_params) > 0) { $search_clause .= ' AND (' . implode(' AND ', $search_AND_params) . ' ) '; } $this->sql = $query . ' ' . $from_where . ' ' . $search_clause . " AND " . table_links . ".link_status <> 'discard' "; $this->searchTerm = $buffKeyword; } // echo $this->sql; ############################################################################################################# END CUSTOM CODE advsearch 1.0 // if this query changes be sure to make sure to update link_summary // just look for $linksum_count near the top $this->countsql = "SELECT count(*) {$from_where} {$search_clause}"; return; }
wp_enqueue_script('sc-js-noticies', get_template_directory_uri() . '/static/js/noticies.js', array('sc-js-main'), WP_SOFTCATALA_VERSION, true); wp_enqueue_script('sc-js-novetats', get_template_directory_uri() . '/static/js/novetats.js', array('sc-js-main'), WP_SOFTCATALA_VERSION, true); wp_localize_script('sc-js-novetats', 'scajax', array('ajax_url' => admin_url('admin-ajax.php'))); //Template initialization $templates = array('index.twig'); is_home() ? array_unshift($templates, 'home.twig') : ''; $post = Timber::query_post(get_option('page_for_posts')); $context_holder['post'] = $post; $context_holder['content_title'] = 'Notícies'; $context_holder['links'] = $post->get_field('link'); $context_holder['sidebar_top'] = Timber::get_widgets('sidebar_top'); $context_holder['sidebar_elements'] = array('baixades.twig', 'links.twig'); $context_holder['sidebar_bottom'] = Timber::get_widgets('sidebar_bottom'); //Filters population $context_holder['categories']['temes'] = Timber::get_terms('category', array('parent' => get_category_id('temes'))); $context_holder['categories']['tipus'] = Timber::get_terms('category', array('parent' => get_category_id('tipus'))); //Search and filters $search = stripslashes(get_query_var('cerca')); $tipus = get_query_var('tipus'); $tema = get_query_var('tema'); if (!empty($search) || !empty($tipus) || !empty($tema)) { $context_holder['cerca'] = $search; $context_holder['selected_tipus'] = $tipus; $context_holder['selected_tema'] = $tema; $context_holder['title'] = $search; $query['s'] = $search; $query['categoria'] = array(); if ($tema) { $tema_cat = get_category_by_slug($tema); $query['categoria'][] = $tema_cat->term_id; }
} } else { display_error("Sorry, file-type <strong>{$file_extension}</strong> is not permitted", array('<a href="">Add File</a>', 'Error'), $LSP_URL . '?content=add'); echo '<div class="col-md-9">'; $extensions = get_extensions(); echo "<strong>Valid Types:</strong><pre><ul>{$extensions}</ul></pre>"; echo '</div>'; } } elseif (POST('addfinalok') == 'Add File') { $tmp_path = POST("tmpname"); $file_name = POST("fn"); $file_extension = '.' . pathinfo($file_name, PATHINFO_EXTENSION); if (file_exists($tmp_path)) { $category = explode(' - ', POST('category'))[0]; $subcategory = explode(' - ', POST('category'))[1]; $category_id = get_category_id($category); $subcategory_id = get_subcategory_id($category_id, $subcategory); $license_id = get_license_id(POST('license')); $user_id = get_user_id(SESSION()); $file_id = insert_file($file_name, $user_id, $category_id, $subcategory_id, $license_id, POST('description'), POST('fsize'), sha1_file($tmp_path)); if ($file_id > 0) { //echo "<code>rename " . $tmp_path . " to " . $DATA_DIR . $file_id . '</code>'; rename($tmp_path, $DATA_DIR . $file_id); show_file($file_id, SESSION(), "File added successfully"); } else { display_error("Failed to commit file <strong>{$file_extension}</strong>", array('<a href="">Add File</a>', 'Error'), $LSP_URL . '?content=add'); } } else { display_error("Sorry, the uploaded file is no longer available.", array('<a href="">Add File</a>', 'Error'), $LSP_URL . '?content=add'); } } else {
function get_import_status() { global $wpdb; $status = ""; if (get_option("useSemDomainNumbers") == 0) { $sql = "SELECT COUNT(taxonomy) AS sdCount FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE 'sil_semantic_domains'"; $sdCount = $wpdb->get_var($sql); if ($sdCount > 0) { $status .= "<br>"; $status .= "<span style=\"color:red;\">It appears you imported semantic domains without the domain numbers. Please go to Tools -> Configure -> Dictionary.. in FLEx and check \"Abbrevation\" under Senses/Semantic Domains.</span><br>"; $status .= "Tip: You can hide the domain numbers from displaying, <a href=\" http://www.webonary.org/help/tips-tricks/\" target=_\"blank\">see here</a>."; $status .= "<hr>"; } } $countLinksConverted = 0; $catid = get_category_id(); if ($catid == NULL) { $catid = 0; } $sql = "SELECT COUNT(pinged) AS entryCount, post_date, TIMESTAMPDIFF(SECOND, MAX(post_date),NOW()) AS timediff, pinged FROM " . $wpdb->prefix . "posts " . " WHERE post_type IN ('post', 'revision') AND " . " ID IN (SELECT object_id FROM " . $wpdb->prefix . "term_relationships WHERE " . $wpdb->prefix . "term_relationships.term_taxonomy_id = " . $catid . ") " . " GROUP BY pinged " . " ORDER BY post_date DESC"; $arrPosts = $wpdb->get_results($sql); $sql = " SELECT * " . " FROM " . $this->reversal_table_name; $arrReversalsImported = $wpdb->get_results($sql); $sql = " SELECT language_code, COUNT(post_id) AS totalIndexed " . " FROM " . $this->search_table_name . " WHERE relevance >= 95 " . " GROUP BY language_code "; $arrIndexed = $wpdb->get_results($sql); if (count($arrPosts) > 0) { $countIndexed = 0; $totalImportedPosts = count($this->get_posts()); foreach ($arrPosts as $posts) { if ($posts->pinged == "indexed") { $countIndexed = $posts->entryCount; } elseif ($posts->pinged == "linksconverted") { $countLinksConverted = $posts->entryCount; } else { $countImported = $posts->entryCount; } } $countIndexed = $countIndexed + $countLinksConverted; /* $importFinished = false; if($countIndexed == $totalImportedPosts || $countLinksConverted == $totalImportedPosts) { $importFinished = true; } */ $status .= "<form method=\"post\" action=\"" . $_SERVER['REQUEST_URI'] . "\">"; if (get_option("importStatus") == "importFinished") { if ($posts->post_date != NULL) { $status .= "Last import of configured xhtml was at " . $posts->post_date . " (server time)"; $status .= "<br>"; if ($_GET['convertlinks'] == 1) { $status .= "<input type=hidden name=chkConvertFLExLinks value=1>"; $status .= "<input type=hidden name=pinged value=linksconverted>"; $status .= "<br><input type=\"submit\" name=\"btnConvertFLExLinks\" value=\"Retry converting FLEx links\"> "; } } } else { if (!get_option("importStatus")) { echo "The import status will display here.<br>"; } else { $status .= "Importing... <a href=\"" . $_SERVER['REQUEST_URI'] . "\">refresh page</a><br>"; $status .= " You will receive an email when the import has completed."; $status .= "<br>"; if (get_option("importStatus") == "indexing") { $status .= "Indexing " . $countIndexed . " of " . $totalImportedPosts . " entries"; $status .= "<br>If you believe indexing has timed out, click here: <input type=\"submit\" name=\"btnReindex\" value=\"Index Search Strings\"/>"; } elseif (get_option("importStatus") == "convertlinks") { $status .= "Converting Links " . $countLinksConverted . " of " . get_option("totalConfiguredEntries") . " entries"; $status .= "<input type=hidden name=chkConvertToLinks value=1>"; $status .= "<br>If you believe indexing has timed out, click here: <input type=\"submit\" name=\"btnMakeLinks\" value=\"Turn headwords into links\"/>"; } elseif (get_option("importStatus") == "configured") { $status .= $countImported . " of " . get_option("totalConfiguredEntries") . " entries imported"; if ($arrPosts[0]->timediff > 5) { $status .= "<br>It appears the import has timed out, click here: <input type=\"submit\" name=\"btnRestartImport\" value=\"Restart Import\">"; } } elseif (get_option("importStatus") == "importingReversals") { $status .= "<strong>Importing reversals. So far imported: " . count($arrReversalsImported) . " entries.</strong>"; $status .= "<br>If you believe the import has timed out, click here: <input type=\"submit\" name=\"btnRestartReversalImport\" value=\"Restart Reversal Import\">"; } elseif (get_option("importStatus") == "indexingReversals" && count($arrReversalsImported) > 0) { $status .= "<strong>Indexing reversal entries.</strong>"; $status .= "<br>If you believe indexing has timed out, click here: <input type=\"submit\" name=\"btnIndexReversals\" value=\"Index reversal entries (" . count($arrReversalsImported) . " left)\"/>"; } } } if (count($arrIndexed) > 0 && ($countIndexed == $totalImportedPosts || $countLinksConverted == $totalImportedPosts)) { $status .= "<br>"; $status .= "<div style=\"float: left;\">"; $status .= "<strong>Number of indexed entries (by language code):</strong><br>"; $status .= "</div>"; $status .= "<div style=\"min-width:50px; float: left; margin-left: 5px;\">"; $x = 0; foreach ($arrIndexed as $indexed) { $status .= "<div style=\"clear:both;\"><div style=\"text-align:right; float:left;\"><nobr>" . $indexed->language_code . ":</nobr></div><div style=\"float:left;\"> " . $indexed->totalIndexed; $status .= "</div></div>"; } $status .= "</div>"; $status .= "<br style=\"clear:both;\">"; $status .= "After importing, go to <strong><a href=\"../wp-admin/admin.php?page=webonary\">Webonary</a></strong> to configure more settings."; $status .= "</form>"; } return $status; } else { return "No entries have been imported yet. <a href=\"" . $_SERVER['REQUEST_URI'] . "\">refresh page</a>"; } $sql = "SELECT post_date, pinged FROM " . $wpdb->prefix . "posts " . " WHERE post_type IN ('post', 'revision') AND " . " ID IN (SELECT object_id FROM " . $wpdb->prefix . "term_relationships WHERE " . $wpdb->prefix . "term_relationships.term_taxonomy_id = " . $catid . ") " . " AND pinged = 'indexed' " . " ORDER BY post_date DESC"; $arrIndexed = $wpdb->get_results($sql); if (count($arrPosts) > 0 || count($arrIndexed) > 0) { if ($arrPosts[0]->pinged != "indexed") { $entries = count($arrPosts); if (count($arrIndexed) > 0) { $entries = get_option("totalConfiguredEntries") - count($arrIndexed); } $status .= $entries . " of " . get_option("totalConfiguredEntries") . " entries imported (not yet indexed)<br>"; } else { $status .= "Indexing " . count($arrIndexed) . " of " . get_option("totalConfiguredEntries") . " entries<br>"; } return $status; } else { return "No entries have been imported yet."; } }
function apweb_romdom_sidebar() { $get_blog_id = get_category_id('blog'); $args = array('post_type' => 'post', 'cat' => $get_blog_id, 'posts_per_page' => 2, 'orderby' => 'rand'); query_posts($args); $x = 0; while (have_posts()) { the_post(); if ($x == 2) { ?> <p class="last"> <?php } else { ?> <!-- <li>--> <?php } ?> <footer class="entry-footer"><h3><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3></footer> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail('min-page'); ?> </a> <p><?php $temp_arr_content = explode(" ", substr(strip_tags(get_the_content()), 0, 90)); $temp_arr_content[count($temp_arr_content) - 1] = ""; $display_arr_content = implode(" ", $temp_arr_content); echo $display_arr_content; if (strlen(strip_tags(get_the_content())) > 180) { echo "..."; ?> </p></li> <?php } else { ?> <img src="<?php echo get_template_directory_uri(); ?> /images/img_404.png" /> <?php } ?> <?php $x++; ?> <?php } ?> <?php wp_reset_query(); }
/** * process request * * this function is called at the top of the main index page * it processes the GET parameters created by process_url() * and determines which data should be retrieved, creating additional * parameters if necessary for specific datasets */ function process_request() { // search request - redirect to keep tidy url if (isset($_POST['search'])) { $search_redirect = WW_WEB_ROOT . '/search/' . $_POST['search'] . '/'; header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . $search_redirect); } // redirect jump links from select boxes if (isset($_POST['select_link'])) { $select_redirect = $_POST['select_link']; header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . $select_redirect); } // now get urldata $urldata = process_url(); // author url if (isset($_GET['author_url']) && !empty($_GET['author_url'])) { $author_id = get_author_id($_GET['author_url']); if (!empty($author_id)) { $_GET['author_id'] = $author_id; } else { $_GET['page_name'] = '404'; } } // category url if (isset($_GET['category_url']) && !empty($_GET['category_url'])) { $category_id = get_category_id($_GET['category_url']); if (!empty($category_id)) { $_GET['category_id'] = $category_id; } else { $_GET['page_name'] = '404'; } } // tag url if (isset($_GET['tag_url']) && !empty($_GET['tag_url'])) { $tag_id = get_tag_id($_GET['tag_url']); if (!empty($tag_id)) { $_GET['tag_id'] = $tag_id; } else { $_GET['page_name'] = '404'; } } // have we already 404ed? if (isset($_GET['page_name']) && $_GET['page_name'] == '404') { show_404($urldata); return false; } // start getting data // was a single article requested? if (isset($_GET['article_id']) && !empty($_GET['article_id']) || isset($_GET['article_url']) && !empty($_GET['article_url'])) { $article_id = get_article_id(); if (!empty($article_id)) { // n.b. page_name could be 'feed' if looking for article comments rss $_GET['page_name'] = isset($_GET['page_name']) ? $_GET['page_name'] : 'article'; $_GET['article_id'] = $article_id; return true; } else { show_404($urldata); return false; } // or a search term or feed request } elseif (isset($_GET['feed']) || isset($_GET['feed_listing'])) { return true; // or did we get a valid author, category, or tag id - or a search, or date request? } elseif (!empty($author_id) || !empty($category_id) || !empty($tag_id) || isset($_GET['year']) || isset($_GET['search'])) { $_GET['page_name'] = 'listing'; return true; // if anything else has been requested we sure can't find it } elseif (!empty($urldata)) { show_404($urldata); return false; } // default $_GET['page_name'] = 'front'; return false; }
if (!empty($_GET["graph_start"])) { $graph_data_array["graph_start"] = get_request_var_request("graph_start"); } /* override: graph end time (unix time) */ if (!empty($_GET["graph_end"])) { $graph_data_array["graph_end"] = get_request_var_request("graph_end"); } /* modify for multi user start */ if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) { $permission = check_graph($_GET["local_graph_id"]); if (isset($_SESSION["sess_user_id"]) && $using_guest_account == false) { // add public if ($permission == GRAPH_PRIVATE) { print " <a href=\"./graph.php?action=properties&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $_GET["rra_id"] . "&tree=public\"><img src=\"images/public_enable_icon.png\" style=\"border:none;vertical-align:text-bottom;\">Add to public</a>"; if (isset($_GET["tree"]) && $_GET["tree"] === "public") { $tree_item_id = get_category_id($_SESSION["public_tree_id"], $_GET["local_graph_id"]); exec("php ./cli/add_tree.php --type=node --node-type=graph --tree-id=" . $_SESSION["public_tree_id"] . " --parent-node=" . $tree_item_id . " --graph-id=" . $_GET["local_graph_id"]); exec("php ./cli/add_perms.php --user-id=" . $_SESSION["sess_user_id"] . " --item-type=graph --item-id=" . $_GET["local_graph_id"]); if (isset($_SESSION['dhtml_tree'])) { unset($_SESSION['dhtml_tree']); } header("Location: graph.php?action=properties&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $_GET["rra_id"]); exit; } // remove public } elseif ($permission == GRAPH_PRIVATE + GRAPH_PUBLIC) { $tree_item_id = db_fetch_cell("SELECT graph_tree_items.id FROM graph_tree_items WHERE graph_tree_id = '" . $_SESSION["public_tree_id"] . "' AND local_graph_id = '" . $_GET["local_graph_id"] . "'"); print " <a href=\"./tree.php?action=item_remove&id=" . $tree_item_id . "&tree_id=" . $_SESSION["public_tree_id"] . "\"><img src=\"images/public_disable_icon.png\" style=\"border:none;vertical-align:text-bottom;\">Remove from Public</a>"; // add favorite } elseif ($permission == GRAPH_PUBLIC) { print " <a href=\"./graph.php?action=properties&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $_GET["rra_id"] . "&tree=favorites\"><img src=\"images/fav_enable_icon.png\" style=\"border:none;vertical-align:text-bottom;\">Add to favorites</a>";
<?php /** * This page allows for the upload and maitnence of sets of program objectives. */ global $PAGE, $CFG, $DB, $USER; require_once '../../config.php'; require_once 'lib.php'; // Check that they can access require_login(); // TODO: Get permissions working //require_capability('local/metadata:ins_view', $context); require_once $CFG->dirroot . '/local/metadata/knowledge_form.php'; // Set up page information $categoryId = get_category_id(); $PAGE->set_category_by_id($categoryId); $PAGE->set_context(context_coursecat::instance($categoryId)); $PAGE->set_pagelayout('standard'); $PAGE->set_title(get_string('admview_pluginname', 'local_metadata')); $heading = "Learning Objectives Management"; $PAGE->set_heading($heading); // Create url $knowledge_url = create_manage_url('knowledge', $categoryId); $policy_url = create_manage_url('policy', $categoryId); $course_url = create_manage_url('course', $categoryId); $exclude_url = create_manage_url('exclude', $categoryId); $reporting_url = create_manage_url('reporting', $categoryId); $categories_url = create_manage_url('categories', $categoryId); $PAGE->set_url($knowledge_url); $PAGE->requires->css('/local/metadata/insview_style.css'); // Create forms
function get_filetype_id($extension, $category) { $filetype_id = -1; $category_id = get_category_id($category); $dbh =& get_db(); $stmt = $dbh->prepare('SELECT id FROM filetypes ' . 'WHERE category = :category_id and LOWER(extension) = LOWER(:extension)'); $fixed_extension = fix_extension($extension); $stmt->bindParam(':category_id', $category_id); $stmt->bindParam(':extension', $fixed_extension); if ($stmt->execute()) { while ($object = $stmt->fetch(PDO::FETCH_ASSOC)) { $filetype_id = $object['id']; break; } } $stmt = null; $dbh = null; return $filetype_id; }
</div><!--/ widget copy--> </div><!--/ widget--> <?php } ?> </div><!--/ sidebar--> </div><!--/ row-fluid--> <div id="content-full" class="row-fluid"> <div class="span12" id="list-guides"> <ul class="list-guides"> <?php $paged = get_query_var('paged') ? get_query_var('paged') : 1; $guide_cat = get_category_id('guides'); $list_args = array('post_status' => 'publish', 'posts_per_page' => 12, 'paged' => $paged, 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'category', 'field' => 'slug', 'terms' => array('guides')), array('taxonomy' => 'nh_cities', 'field' => 'slug', 'terms' => array($user_city_slug, 'any-city')))); $list_query = new WP_Query($list_args); if ($list_query->have_posts()) { while ($list_query->have_posts()) { $list_query->the_post(); $imgSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $post_cities = wp_get_post_terms($post->ID, 'nh_cities'); // flatten array $post_terms = array_pop($post_cities); ?> <li class="guides-list" id="post-<?php echo $post->ID; ?> "><a rel="bookmark" title="See <?php
} ?> </div> <div id="list-fdbk"> <?php if (is_user_logged_in()) { echo '<div class="intro-block-button"><a id="addfdbk" title="Add your Idea" class="nh-btn-blue" href="' . $app_url . '/add-idea">Add Your Idea</a></div>'; } ?> <ul class="list-fdbk"> <?php $fdbk_sub_cat = get_category_id($cat[0]->name); $paged = get_query_var('paged') ? get_query_var('paged') : 1; $vote_sub_args = array('post_status' => 'publish', 'orderby' => 'title', 'order' => ASC, 'meta_key' => '_nh_vote_count', 'posts_per_page' => '20', 'paged' => $paged, 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'category', 'field' => 'id', 'terms' => array($fdbk_sub_cat)), array('taxonomy' => 'nh_cities', 'field' => 'slug', 'terms' => array($user_city_slug, 'any-city')))); $fdbk_sub_query = new WP_Query($vote_sub_args); if (!$fdbk_sub_query->have_posts()) { ?> <li>Sorry ... there aren't any Ideas in this Topic yet. <?php if ($user_city != 'Any City' and is_user_logged_in()) { echo ' Add your ideas or questions!'; } ?> </li> <?php } else { while ($fdbk_sub_query->have_posts()) {
?> <span class="ct-headline-line ct-headline-line--right"></span> </span> </h3> </section> <section> <div class="container paddingLR-0"> <div class="ct-blog-container ct-blog-masonry ct-blog-masonry--col3 ct-gallery"> <?php if (have_posts()) { ?> <?php $category_ID = get_category_id($catego); $args = array('cat' => $category_ID, 'posts_per_page' => 6, 'orderby' => 'post_date', 'order' => 'DESC'); query_posts($args); ?> <?php while (have_posts()) { the_post(); ?> <div class="col-sm-4 text-center ct-u-marginBottom20 ct-u-paddingBoth20 entrada"> <div class="ct-u-borderAll"> <div class="img-entrada"> <?php the_post_thumbnail(); ?> <span class="fecha"><span class="dia"><?php the_time('d');
<?php $equal_search = array('type_price'); $null_search = array('promo_value'); $default_sort_by = 'product_name'; // CATEGORY if ($_REQUEST["cat"] == "" || $_REQUEST["cat"] == "top") { $cat = 'top'; } else { $cat = get_category_id($_REQUEST["cat"]); $cat_name = $_REQUEST["cat"]; } $pgdata = page_init($equal_search, $default_sort_by, $null_search); // static/general.php $page = $pgdata['page']; $query_per_page = $pgdata['query_per_page']; $sort_by = $pgdata['sort_by']; $first_record = $pgdata['first_record']; $search_parameter = $pgdata['search_parameter']; $search_value = $pgdata['search_value']; $search_query = $pgdata['search_query']; $search = $pgdata['search']; /* echo "<br>SEARCH: ".$search_query; echo "<br>CATEGORY: ".$cat; echo "<br>SORT BY: ".$sort_by; echo "<br>FIRST RECORD: ".$first_record; echo "<br>QUERY PER PAGE: ".$query_per_page; */ // CALL FUNCTION $full_product = get_product($search_query, $cat, $sort_by, $first_record, $query_per_page);
/** * Remove all posts and revisions, leaving other post types * @global $wpdb * @return <type> */ function remove_entries($pinged = null) { global $wpdb; $catid = get_category_id(); //just posts in category "webonary" $sql = "DELETE FROM " . $wpdb->prefix . "posts " . " WHERE post_type IN ('post', 'revision') AND " . " ID IN (SELECT object_id FROM " . $wpdb->prefix . "term_relationships WHERE " . $wpdb->prefix . "term_relationships.term_taxonomy_id = " . $catid . ")"; if (isset($pinged)) { $sql .= " AND pinged = '" . $pinged . "'"; } $wpdb->query($sql); $sql = "DELETE FROM " . $wpdb->prefix . "term_relationships WHERE term_taxonomy_id = " . $catid; if (isset($pinged)) { $sql .= " AND object_id NOT IN (SELECT ID FROM {$wpdb->posts} WHERE post_type = 'post')"; } $return_value = $wpdb->get_var($sql); }
//取得product_id function get_product_id(array $category_id) { $query = 'select `product_id` from product where product_category_id IN (' . implode(',', $category_id) . ') ;'; $query = query_despace($query); $result = mysql_query($query); $product_id_list = array(); while ($row = mysql_fetch_assoc($result)) { $product_id_list[] = $row['product_id']; } return !empty($product_id_list) ? $product_id_list : null; } if ($type == 'categoryarea') { $categoryarea_id[] = $id; //取得類別下的項目ID $category_id = get_category_id($categoryarea_id); if ($category_id != null) { //取得項目下的產品ID及刪除產品 $product_id = get_product_id($category_id); if ($product_id != null) { if (!del_product($product_id)) { php_call_jbox('error', '刪除產品時發生錯誤,請重新操作。', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } if (!del_product_meta($product_id)) { php_call_jbox('error', '刪除產品描述時發生錯誤,請重新操作。', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } } //刪除項目 if (!del_category($category_id)) { php_call_jbox('error', '刪除項目時發生錯誤,請重新操作。', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); }
<?php get_header(); ?> <div id="main_content"> <div id="main_content_inside"> <?php $category_ID = get_category_id('blog'); if (ereg('iPhone', $_SERVER['HTTP_USER_AGENT'])) { $args = array('post_type' => 'post', 'posts_per_page' => -1, 'cat' => '-' . $category_ID, 'paged' => get_query_var('paged') ? get_query_var('paged') : 1); } else { $args = array('post_type' => 'post', 'posts_per_page' => 32, 'cat' => '-' . $category_ID, 'paged' => get_query_var('paged') ? get_query_var('paged') : 1); } query_posts($args); $x = 0; while (have_posts()) { the_post(); ?> <?php if ($x == 3) { ?> <div class="home_post_cont home_post_cont_last post_box"> <?php
?> </div> </div> <div class="row-fluid row-content"> <div class="wrapper"> <div id="main"> <div id="content"> <h3 class="page-title">Edit Your Content</h3> <?php // Get guide cat id $guide_cat = get_category_id('guides'); $stories_cat = get_category_id('stories'); $resources_cat = get_category_id('resources'); $blog_cat = get_category_id('blog'); // Get current user global $current_user; get_currentuserinfo(); // Get the entry info $item_key = esc_attr($_GET['entry']); $item_id = nh_get_frm_key_id($item_key); $item_post_id = nh_get_frm_id_post_id($item_id); $entry_info = get_post($item_post_id); $btn_preview = '<li style="float:right;margin-left:1em;"><a href="' . $app_url . '/?post_type=post&p=' . esc_attr($item_post_id) . '&preview=true" title="See what your Guide will look like" target="_blank"><button class="nh-btn-blue-med">Preview Guide</button></a></li>'; ?> <?php $mypost = get_post($item_post_id); //var_dump($mypost); //var_dump($current_user->ID);