function programmatically_create_post() { $url = 'http://widgets.pinterest.com/v3/pidgets/boards/bradleyblose/my-stuff/pins/'; $json_O = json_decode(file_get_contents($url), true); $id = $json_O['data']['pins'][0]['id']; $titlelink = 'https://www.pinterest.com/pin/' . $id . '/'; $title = get_title($titlelink); var_dump($title); $original = $json_O['data']['pins'][0]['images']['237x']['url']; $image_url = preg_replace('/237x/', '736x', $original); $description = $json_O['data']['pins'][0]['description']; // Initialize the page ID to -1. This indicates no action has been taken. $post_id = -1; // Setup the author, slug, and title for the post $author_id = 1; $mytitle = get_page_by_title($title, OBJECT, 'post'); var_dump($mytitle); // If the page doesn't already exist, then create it if (NULL == get_page_by_title($title, OBJECT, 'post')) { // Set the post ID so that we know the post was created successfully $post_id = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => $author_id, 'post_name' => $title, 'post_title' => $title, 'post_content' => $description, 'post_status' => 'publish', 'post_type' => 'post')); //upload featured image $upload_dir = wp_upload_dir(); $image_data = file_get_contents($image_url); $filename = basename($image_url); if (wp_mkdir_p($upload_dir['path'])) { $file = $upload_dir['path'] . '/' . $filename; $path = $upload_dir['path'] . '/'; } else { $file = $upload_dir['basedir'] . '/' . $filename; $path = $upload_dir['basedir'] . '/'; } file_put_contents($file, $image_data); //edit featured image to correct specs to fit theme $pngfilename = $filename . '.png'; $targetThumb = $path . '/' . $pngfilename; $img = new Imagick($file); $img->scaleImage(250, 250, true); $img->setImageBackgroundColor('None'); $w = $img->getImageWidth(); $h = $img->getImageHeight(); $img->extentImage(250, 250, ($w - 250) / 2, ($h - 250) / 2); $img->writeImage($targetThumb); unlink($file); //Attach featured image $wp_filetype = wp_check_filetype($pngfilename, null); $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => sanitize_file_name($pngfilename), 'post_content' => '', 'post_status' => 'inherit'); $attach_id = wp_insert_attachment($attachment, $targetThumb, $post_id); require_once ABSPATH . 'wp-admin/includes/image.php'; $attach_data = wp_generate_attachment_metadata($attach_id, $targetThumb); wp_update_attachment_metadata($attach_id, $attach_data); set_post_thumbnail($post_id, $attach_id); // Otherwise, we'll stop } else { // Arbitrarily use -2 to indicate that the page with the title already exists $post_id = -2; } // end if }
function get_head() { global $page; global $key; global $desc; $_TITLE = get_title(); if (isset($_REQUEST['id'])) { $desc = print_article("meta_description"); $key = print_article("meta_key_words"); } elseif ($page == 'static') { $desc = print_static("meta_description"); $key = print_static("meta_key_words"); } if ($page == 'crt_artcl' || $page == 'game_redactor' || $page == 'admin') { $ckeditor = '<script type="text/javascript" src="' . ENGINE_URL . '/lib/ckeditor/ckeditor.js"></script>'; } else { $ckeditor = ''; } $_TITLE = array_reverse($_TITLE); $title = implode(' | ', $_TITLE); $r = ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="' . $desc . '" /> <meta name="keywords" content="' . $key . '" /> <meta name="generator" content="Tractor Engine"> <meta name="htotutunas" content="' . ENGINE_URL . '"> <title>' . $title . '</title> <link href="' . ENGINE_URL . '/lib/geshi/code_style.css" rel="stylesheet" type="text/css" media="all" /> <link title="' . my_lang('feed_desc') . '" href="' . SITE_RSS . '" type=application/rss+xml rel=alternate> <link rel="icon" href="' . SITE_URL . '/favicon.png" type="image/x-icon" /> ' . $ckeditor; return $r; }
function get_crumbs() { global $page; $_TITLE = get_title(); //массив заголовков if ($page == 'main') { $crumbs = ''; } else { foreach ($_TITLE as $k => $v) { switch ($k) { //case 0: $crumbs = $crumbs . '<a href="'.get_link('main').'">'.$v.'</a>'; break; case 1: if ($page == 'static') { $crumbs = $crumbs . ' <span>:: ' . $v . '</span>'; } else { $crumbs = $crumbs . ' <span>:: </span><a href="' . get_link('page') . '">' . $v . '</a>'; } break; case 2: $crumbs = $crumbs . ' <span>:: </span><a href="' . get_link('category') . '">' . $v . '</a>'; break; case 3: $crumbs = $crumbs . ' <span>:: ' . $v . '</span>'; break; } } } return $crumbs; }
function template_history($args) { global $DiffScript; //echo "<p>template_history(".print_r($args,True).")</p>"; template_common_prologue(array('norobots' => 1, 'title' => lang('History of') . ' ' . get_title($args['page']), 'heading' => lang('History of') . ' ', 'headlink' => $args['page'], 'headsufx' => '', 'toolbar' => 1)); ?> <div id="body"> <form method="get" action="<?php print $DiffScript; ?> "> <div class="form"> <input type="hidden" name="action" value="diff" /> <input type="hidden" name="page" value="<?php print $args['page']['name']; ?> " /> <input type="hidden" name="lang" value="<?php print $args['page']['lang']; ?> " /> <table border="0"> <tr><td><strong><?php echo lang('Older'); ?> </strong></td> <td><strong><?php echo lang('Newer'); ?> </strong></td><td></td></tr> <?php print $args['history']; ?> <tr><td colspan="3"> <input type="submit" value="<?php echo lang('Compute Difference'); ?> " /></td></tr> </table> </div> </form> <hr /><br /> <strong><?php echo lang('Changes by last author'); ?> :</strong><br /><br /> <?php print $args['diff']; ?> </div> <?php template_common_epilogue(array('twin' => $args['page'], 'edit' => '', 'editver' => 0, 'history' => '', 'timestamp' => '', 'nosearch' => 0)); }
/** * * Load the apropriate page acording the given parametar * * @param name of the page * * @param page_arguments object * * @return Send the page to browser * * */ public function load_page($page_name, $args) { $page = $this->page_handler->load_page($page_name); $shortcodes = $this->shortcodes; if ($page == FALSE) { show_404(); } else { $page->content = $shortcodes->do_shortcode($page->content); $data['page'] = $page; } if (isset($page->category)) { $this->load->library('post_handler'); if ($page_name == 'home' or $page->category == 1) { $this->load->library('user_agent'); $data['browser'] = $this->agent->is_browser(); $data['pages'] = $this->page_handler->load_pages($page->category, 'temi'); } else { $data['posts'] = $this->post_handler->load_posts($page->category); } } set_active_page($page->name); set_title($page->title); foreach ($args as $key => $value) { $data[$key] = $value; } if ($data['ajax']) { if ($page_name == 'news' && isset($args[0])) { $data['post'] = $this->post_handler->load_post($args[0]); $data_json = array('body' => $this->load->view('templates/single', $data, true), 'title' => $data['post']->title); $this->output->set_output(json_encode($data_json)); } else { if (file_exists(APPPATH . "views/templates/" . $page->template) && isset($page->template) && $page->template != 'default') { $data_json = array('body' => $this->load->view('templates/' . $page->template, $data, true), 'title' => get_title()); $this->output->set_output(json_encode($data_json)); } else { $page->content = $shortcodes->do_shortcode($page->content); $data_json = array('body' => $this->load->view('templates/page', $data, true), 'title' => get_title()); $this->output->set_output(json_encode($data_json)); } } } else { if ($page_name == 'news' && isset($args[0])) { $data['post'] = $this->post_handler->load_post($args[0]); set_title($data['post']->title); $this->load->view('templates/single', $data); } else { if (file_exists(APPPATH . "views/templates/" . $page->template) && isset($page->template) && $page->template != 'default') { $this->load->view('templates/' . $page->template, $data); } else { $this->load->view('templates/page', $data); } } } }
/** Luo HTML alaotsikoille * @param $question_id integer * @return string */ function create_headings($question_id) { $title = get_title($question_id); /* * $title string */ echo "<div id='top_header_main'>"; // To print the header of the question create_question_title($title, $question_id); echo "</div>"; // to end question_title block }
protected function goods_export($goods_list = array()) { //print_r($goods_list);exit; $goods_list = $goods_list; $data = array(); foreach ($goods_list as $k => $goods_info) { $data[$k][id] = $goods_info['id']; $data[$k][title] = $goods_info['title']; $data[$k][PNO] = $goods_info['PNO']; $data[$k][old_PNO] = $goods_info['old_PNO']; $data[$k][price] = $goods_info['price']; $data[$k][brand_id] = get_title('brand', $goods_info['brand_id']); $data[$k][category_id] = get_title('category', $goods_info['category_id']); $data[$k][type_ids] = get_type_title($goods_info['id']); $data[$k][add_time] = $goods_info['add_time']; } //print_r($goods_list); //print_r($data);exit; foreach ($data as $field => $v) { if ($field == 'id') { $headArr[] = '产品ID'; } if ($field == 'title') { $headArr[] = '产品名称'; } if ($field == 'PNO') { $headArr[] = '零件号'; } if ($field == 'old_PNO') { $headArr[] = '原厂参考零件号'; } if ($field == 'price') { $headArr[] = '原厂参考面价'; } if ($field == 'type_ids') { $headArr[] = '品牌'; } if ($field == 'brand_id') { $headArr[] = '类别'; } if ($field == 'category_id') { $headArr[] = '适用机型'; } if ($field == 'add_time') { $headArr[] = '添加时间'; } } $filename = "goods_list"; $this->getExcel($filename, $headArr, $data); }
public function index() { set_active_page('wastemap'); $page = $this->page_handler->load_page('wastemap'); set_title($page->title); $ajax = $this->input->is_ajax_request(); $data['ajax'] = $ajax; if ($ajax) { $data_json = array('body' => $this->load->view('main_pages/wastemap' . $page->template, $data, true), 'title' => get_title()); $this->output->set_output(json_encode($data_json)); } else { $this->load->view('main_pages/wastemap', $data, FALSE); } }
public function index($slug) { $this->load->library('user_agent'); $this->load->helper('meta'); $data = $this->mongo_db->page->findOne(array('slug' => $slug)); if (!isset($data['slug'])) { $this->redirect($slug, NULL, NULL, 'page/index/'); show_404(uri_string(), FALSE); } if (!$this->agent->is_robot()) { $this->mongo_db->page->update(array('_id' => new MongoId($data['_id'])), array('$set' => array('counter' => ++$data['counter']))); } $this->template->set_keyword(get_keyword($data))->set_description(get_description($data))->set_title(get_title($data))->view('index', $data)->render(); }
public function join_am() { set_active_page('join'); set_title(t('title_join_am')); $ajax = $this->input->is_ajax_request(); $data['ajax'] = $ajax; if ($ajax) { $data_json = array('body' => $this->load->view('main_pages/join_am', $data, true), 'title' => get_title()); $this->output->set_output(json_encode($data_json)); } else { // $data['post'] = $this->post_handler->load_post($args[0]); $this->load->view('main_pages/join_am', $data, FALSE); } }
function validate_page($page) { global $FlgChr; $page = get_title($page); $p = parse_wikiname($page, 1); if (preg_match('/^' . $FlgChr . '\\d+' . $FlgChr . '$/', $p)) { return 1; } $p = parse_freelink('((' . $page . '))', 1); if (preg_match('/^' . $FlgChr . '\\d+' . $FlgChr . '$/', $p)) { return 2; } //echo "<p>parse/transforms::validdate_page('$page')==0</p>\n"; return 0; }
function FixURLsData($data) { //echo $data; $MyAllWords = explode(" ", $data); foreach ($MyAllWords as $key => $value) { if (strpos($MyAllWords[$key], 'http') !== false || strpos($MyAllWords[$key], 'www.') !== false) { $FirstLetterIsFound = 0; $IndexOfLastLetter = 0; for ($counter = strlen($MyAllWords[$key]) - 1; $counter > 0; $counter--) { if ($FirstLetterIsFound == 0) { $char = $MyAllWords[$key][$counter]; //echo "<p>"; if (preg_match('/[a-zA-Z1-9]/', $char)) { $IndexOfLastLetter = $counter + 1; $FirstLetterIsFound = 1; //echo $char.' is a letter'; } else { //echo $char.' isn\'t a letter'; } //echo "</p>"; } } //echo "<p>IndexOfLastLetter - ".$IndexOfLastLetter."</p>"; $MyDoneURL = mb_substr($MyAllWords[$key], 0, $IndexOfLastLetter); $TitleOfPage = get_title($MyDoneURL); if (strlen($TitleOfPage) <= 0) { $TitleOfPage = "link"; } $MyTextAfterURL = mb_substr($MyAllWords[$key], $IndexOfLastLetter, strlen($MyAllWords[$key]) - 1); $MyAllWords[$key] = '<a id = "MyDataURL" target = "blank" href = "' . $MyDoneURL . '">' . $TitleOfPage . "</a>" . $MyTextAfterURL; } } unset($value); unset($key); $DoneText = ""; $ForFirstTime = 1; foreach ($MyAllWords as $value) { if ($ForFirstTime == 1) { $ForFirstTime = 0; $Space = ""; } else { $Space = " "; } $DoneText .= $Space . $value; } unset($value); return $DoneText; }
public function index() { $this->load->library('user_agent'); $this->load->helper('meta'); $slug = $this->uri->uri_string(); $data = $this->mongo_db->post->findOne(array('slug' => $slug, 'status' => 'publish')); if (!isset($data['slug'])) { $this->redirect($slug, NULL, NULL, 'post/index/'); $this->show_404(); return; } if (!$this->agent->is_robot()) { $this->mongo_db->post->update(array('_id' => new MongoId($data['_id'])), array('$set' => array('counter' => ++$data['counter']))); } $related = $this->mongo_db->post->find(array('_id' => array('$ne' => $data['_id']), 'tags' => array('$in' => $data['tags'])))->limit(3); $data['related'] = iterator_to_array($related); $this->template->set_keyword(get_keyword($data))->set_description(get_description($data))->set_title(get_title($data))->view('index', $data)->render(); }
function generalshow() { global $gbl, $login, $ghtml; $title = get_title(); $gbl->setSessionV("redirect_to", "/display.php?frm_action=show"); ?> <head> <title> <?php echo $title; ?> </title> <FRAMESET frameborder=0 rows="98,*" border=0> <FRAME name=top src="/header.php" scrolling=no border=0> <FRAME name=mainframe src="/display.php?frm_action=update&frm_subaction=general&frm_ev_list=frm_emailid&frm_emessage=set_emailid"> </FRAMESET> </head> <?php }
function initialize($page, $condition = FALSE, $id = NULL) { $username = $this->get_username(); $this->redirect_for_capability($username); $this->add_pageview($username, uri_string()); $return['username'] = $username; $return['fullname'] = get_fullname($username, FALSE); $return['pageid'] = uri_string(); $return['placeholder'] = 'Quizzes'; $return['fileid'] = $page; $return['status'] = ''; $return['page_type'] = ''; $return['oel'] = FALSE; $return['session'] = $username == '' ? FALSE : TRUE; if ($page == 'About' || $page == 'FAQ' || $page == 'tour' || $page == 'business') { $return['oel'] = TRUE; } if ($page == "people" || $page == "find") { $return['content_type'] = $page; if ($page == "find") { $page = "quizzes"; } $return['title'] = ucfirst($page); } elseif ($condition == FALSE) { $return['content_type'] = $page; $return['title'] = ucfirst($page); $return['userid'] = $username; } else { if (is_numeric($id)) { $return['content_type'] = "quiz"; $return['title'] = get_title($id, FALSE); $return['quizid'] = $id; } else { $return['content_type'] = "user"; $return['title'] = get_fullname($id, FALSE); $return['userid'] = $id; } } $return['sidebar_type'] = $return['content_type']; return $return; }
function render_data_property_list($graph, $onto_file) { foreach ($graph->allOfType('owl:DatatypeProperty') as $me) { if (!$me->isBnode()) { echo '<div class="well-sm" id="' . $me->localName() . '">'; echo "<h3>数值属性: <a href='individual.php?onto_file=" . $onto_file . "&localname=" . $me->localName() . "'>" . get_title($me) . "</a></h3>"; render_literals($graph, $me, 'rdfs:comment'); echo "<table class=\"table table-bordered\"><tbody>"; echo "<tr><td width='10%'>中文标签:</td><td>" . $me->label('zh') . "</td></tr>"; echo "<tr><td>英文标签:</td><td>" . $me->label('en') . "</td></tr>"; echo "<tr><td>父属性:</td><td>"; echo render_property_values($graph, $me, "rdfs:subPropertyOf"); echo "</td></tr>"; echo "<tr><td>子属性:</td><td>"; render_matching_values($graph, $me, "rdfs:subPropertyOf"); echo "</td></tr>"; echo "</tbody></table>"; echo '<p style="float: right; font-size: small;">[<a href="#sec-glance">回到顶部</a>]</p>'; echo '</div>'; } } }
require_once 'inc/simplepie/simplepie.inc'; require_once 'config.php'; require_once 'planetoid.php'; $feeds_list = list_feeds(); ?> <!-- Generated by Planetoid <?php echo PLANETOID_VERSION; ?> .<?php echo PLANETOID_REVISION; ?> --> <opml version="1.0"> <head> <title>Blogs aggregated on <?php echo get_title(); ?> </title> <dateCreated><?php echo last_refresh(); ?> </dateCreated> </head> <body> <?php for ($n = 0; $n < count($feeds_list); $n++) { $feed = $feeds_list[$n]; ?> <outline text="<?php echo $feed['title'];
<!DOCTYPE HTML> <html class="no-js" lang='<?php echo $lang; ?> '> <head> <meta charset='utf-8'/> <title><?php echo get_title($title); ?> </title> <?php if (isset($favicon)) { echo "<link rel='shortcut icon' href='{$favicon}'/>"; } ?> <?php echo $websiteHeadTag; foreach ($stylesheets as $value) { echo "<link href=\"{$value}\" rel=\"stylesheet\">"; } ?> <script src='<?php echo $modernizr; ?> '></script> </head> <body> <div class='content'> <header class='site-header text-center'> <?php
} else { echo "<h3>Top movies this week</h3>"; for ($i = 1; $i <= 9; $i += 1) { //$movies[$i] = preg_replace( "/\s\s+/", "", $movies[$i]); echo "What are people saying about <b>{$movies[$i]}</b>?<br><br>"; //echo "<br>".$movies[$i]; //echo urlencode($movies[$i]); //$temp_twitter_rss = "http://search.twitter.com/search.atom?q=".$search_url; $search_string = urlencode($movies[$i] . " saw"); $search_url = "http://search.twitter.com/search.atom?q=" . $search_string; //echo $search_url; $temp_twitter_rss = $search_url; //echo $temp_twitter_rss."<br>"; $twitter_raw_rss = curl_rss($temp_twitter_rss); //echo $twitter_raw_rss; $temp_title = get_title($twitter_raw_rss); //echo $temp_title; $temp_split = split("<title>", $twitter_raw_rss); for ($k = 1; $k <= 7; $k += 1) { $final_string_array = split("\\<", $temp_split[$k]); $tweets[$i][] = $final_string_array[0]; } for ($h = 1; $h <= 6; $h += 1) { echo "<li>" . $tweets[$i][$h] . "<br>"; //split_words($tweets[$h]); //$array_search_words = split_words($tweets[$h]); //foreach ($array_search_words as $value) { //$stripped_tweet = ereg_replace($value, "", $stripped_tweet); //} $stripped_tweet = $tweets[$i][$h]; $stripped_tweet = ereg_replace(" in |(S|s)aw |I |i |you |and |a |with |to |is | of | for |movie | it |it | not| as| it|it |Just | just|just| was| my ", " ", $stripped_tweet);
function get_deal_name($id) { $name = M("Deal")->where("id=" . $id)->getField("name"); return get_title($name); }
<?php $first_unit = reset($units); $address = $this->address_model->get_formatted_address($order->site_address_id); $is_breakdown = $this->order_model->get_type_id('Breakdown') == $order->order_type_id; $is_maintenance = $this->order_model->get_type_id('Maintenance') == $order->order_type_id; $is_installation = $this->order_model->get_type_id('Installation') == $order->order_type_id; $is_service = $this->order_model->get_type_id('Service') == $order->order_type_id; ?> <div class="panel panel-primary"> <div class="panel-heading"><?php echo get_title($title_options); ?> </div> <div class="panel-body"> <table class="table table-condensed table-striped"> <thead> <tr><th>Booking date</th><th>Start time</th><th>Ref #</th><th>Equipment type</th><th>Contact name</th><th># of units</th><th>Senior Technician</th></tr> </thead> <tbody> <tr> <td><?php echo mdate('%D %d%S %F', $assignment->appointment_date); ?> </td> <td><?php echo mdate('%h:%i %a', $assignment->appointment_date); ?> </td> <td>J<?php echo $assignment->order_id;
<?php } ?> <th class="tcr" scope="col"><?php echo $lang_common['Registered']; ?> </th> </tr> </thead> <tbody> <?php // Grab the users $result = $db->query('SELECT u.id, u.username, u.title, u.num_posts, u.registered, g.g_id, g.g_user_title FROM ' . $db->prefix . 'users AS u LEFT JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id WHERE u.id>1' . (!empty($where_sql) ? ' AND ' . implode(' AND ', $where_sql) : '') . ' ORDER BY ' . $sort_by . ' ' . $sort_dir . ', u.id ASC LIMIT ' . $start_from . ', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) { while ($user_data = $db->fetch_assoc($result)) { $user_title_field = get_title($user_data); ?> <tr> <td class="tcl"><?php echo '<a href="profile.php?id=' . $user_data['id'] . '">' . pun_htmlspecialchars($user_data['username']) . '</a>'; ?> </td> <td class="tc2"><?php echo $user_title_field; ?> </td> <?php if ($show_post_count) { ?> <td class="tc3"><?php echo $user_data['num_posts'];
$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.dst, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, u.date_format, u.time_format, g.g_id, g.g_user_title, g.g_moderator FROM ' . $db->prefix . 'users AS u LEFT JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id WHERE u.id=' . $id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) { message($lang_common['Bad request']); } $user = $db->fetch_assoc($result); $last_post = format_time($user['last_post']); if ($user['signature'] != '') { require PUN_ROOT . 'include/parser.php'; $parsed_signature = parse_signature($user['signature']); } // View or edit? if ($pun_user['id'] != $id && (!$pun_user['is_admmod'] || $pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_mod_edit_users'] == '0' || $user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1'))) { $user_personal = array(); $user_personal[] = '<dt>' . $lang_common['Username'] . '</dt>'; $user_personal[] = '<dd>' . pun_htmlspecialchars($user['username']) . '</dd>'; $user_title_field = get_title($user); $user_personal[] = '<dt>' . $lang_common['Title'] . '</dt>'; $user_personal[] = '<dd>' . ($pun_config['o_censoring'] == '1' ? censor_words($user_title_field) : $user_title_field) . '</dd>'; if ($user['realname'] != '') { $user_personal[] = '<dt>' . $lang_profile['Realname'] . '</dt>'; $user_personal[] = '<dd>' . pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['realname']) : $user['realname']) . '</dd>'; } if ($user['location'] != '') { $user_personal[] = '<dt>' . $lang_profile['Location'] . '</dt>'; $user_personal[] = '<dd>' . pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['location']) : $user['location']) . '</dd>'; } if ($user['url'] != '') { $user['url'] = pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['url']) : $user['url']); $user_personal[] = '<dt>' . $lang_profile['Website'] . '</dt>'; $user_personal[] = '<dd><span class="website"><a href="' . $user['url'] . '">' . $user['url'] . '</a></span></dd>'; }
// What page are we on ? $num_pages = ceil($num_messages / $luna_config['o_message_per_page']); if ($page > $num_pages) { $page = 1; } $start_from = intval($luna_config['o_message_per_page']) * ($page - 1); $limit = $start_from . ',' . $luna_config['o_message_per_page']; // Start building page $page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Private Messages', 'luna'), __('Inbox', 'luna')); $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.facebook, u.msn, u.twitter, u.google, u.location, u.signature, u.disp_threads, u.disp_comments, u.email_setting, u.notify_with_comment, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.php_timezone, u.language, u.style, u.num_comments, u.last_comment, u.registered, u.registration_ip, u.admin_note, u.date_format, u.time_format, u.last_visit, u.color_scheme, u.accent, g.g_id, g.g_user_title, g.g_moderator FROM ' . $db->prefix . 'users AS u LEFT JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id WHERE u.id=' . $id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) { message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found'); } $user = $db->fetch_assoc($result); $user_username = luna_htmlspecialchars($user['username']); $user_usertitle = get_title($user); define('LUNA_ACTIVE_PAGE', 'inbox'); require load_page('header.php'); ?> <script type="text/javascript"> /* <![CDATA[ */ function checkAll(checkWhat,command){ var inputs = document.getElementsByTagName('input'); for(index = 0; index < inputs.length; index++){ if(inputs[index].name == checkWhat){ inputs[index].checked=document.getElementById(command).checked; } } } /* ]]> */
u.signature, o.user_id AS is_online FROM ' . $db->prefix . 'messages AS m, ' . $db->prefix . 'users AS u LEFT JOIN ' . $db->prefix . 'online AS o ON (o.user_id=u.id AND o.idle=0) LEFT JOIN ' . $db->prefix . 'groups AS g ON u.group_id = g.g_id WHERE ' . $where . ' AND m.id=' . $id) or error('Unable to fetch message and user info', __FILE__, __LINE__, $db->error()); $cur_post = $db->fetch_assoc($result); if ($owner != $pun_user['id']) { message($lang_common['No permission']); } if (!$cur_post['showed']) { $db->query('UPDATE ' . $db->prefix . 'messages SET showed=1 WHERE id=' . $id) or error('Unable to update message info', __FILE__, __LINE__, $db->error()); } if ($cur_post['id'] > 0) { $username = '******' . $cur_post['id'] . '">' . pun_htmlspecialchars($cur_post['username']) . '</a>'; $user_title = get_title($cur_post); if ($pun_config['o_censoring'] == 1) { $user_title = censor_words($user_title); } // Format the online indicator $is_online = $cur_post['is_online'] == $cur_post['id'] ? '<strong>' . $lang_topic['Online'] . '</strong>' : $lang_topic['Offline']; $user_avatar = pun_show_avatar(); // We only show location, register date, post count and the contact links if "Show user info" is enabled if ($pun_config['o_show_user_info'] == 1) { if ($cur_post['location']) { if ($pun_config['o_censoring'] == 1) { $cur_post['location'] = censor_words($cur_post['location']); } $user_info[] = '<dd>' . $lang_topic['From'] . ': ' . pun_htmlspecialchars($cur_post['location']); } $user_info[] = '<dd>' . $lang_common['Registered'] . ': ' . date($pun_config['o_date_format'], $cur_post['registered']);
function draw_user_list() { global $db, $where_sql, $sort_query, $start_from; // Retrieve a list of user IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data $result = $db->query('SELECT u.id FROM ' . $db->prefix . 'users AS u WHERE u.id>1 AND u.group_id!=' . LUNA_UNVERIFIED . (!empty($where_sql) ? ' AND ' . implode(' AND ', $where_sql) : '') . ' ORDER BY ' . $sort_query . ', u.id ASC LIMIT ' . $start_from . ', 50') or error('Unable to fetch user IDs', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) { $user_ids = array(); for ($i = 0; $cur_user_id = $db->result($result, $i); $i++) { $user_ids[] = $cur_user_id; } // Grab the users $result = $db->query('SELECT u.id, u.username, u.title, u.num_comments, u.registered, g.g_id, g.g_user_title FROM ' . $db->prefix . 'users AS u LEFT JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id WHERE u.id IN(' . implode(',', $user_ids) . ') ORDER BY ' . $sort_query . ', u.id ASC') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error()); while ($user_data = $db->fetch_assoc($result)) { $user_title_field = get_title($user_data); $user_avatar = draw_user_avatar($user_data['id'], true, 'media-object'); require get_view_path('user.php'); } } else { echo '<p>' . __('Your search returned no hits.', 'luna') . '</p>'; } }
<!-- Content Section --> <div class="wrapper content"> <div class="subwrapper"> <div class="inner detail"> <!-- Sub Navigation --> <?php include dirname(__FILE__) . '/../includes/subnavigation.inc.php'; ?> <!-- Main Content --> <div class="divContentContainer"> <h1><?php get_title(); ?> </h1> <!-- TODO: process template (e.g. kulturhaeuser) --> <div class="clear"></div> </div> <div class="clear"></div> </div> </div> </div>
<th class="tc1" scope="col">Topoguide name</th> <th class="tc3" scope="col">Login</th> <th class="tc2" scope="col">E-mail</th> <th class="tc3" scope="col">Title/Status</th> <th class="tc4" scope="col">Posts</th> <th class="tc5" scope="col">Admin note</th> <th class="tcr" scope="col">Actions</th> </tr> </thead> <tbody> <?php // 03-10-2008 Bubu // Use 'app_users_private_data table' instead of $db->prefix.'users' table, to acccess to topo_name field $result = $db->query('SELECT u.id, u.username, u.topo_name, u.login_name, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM app_users_private_data AS u LEFT JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id WHERE u.id>1 AND ' . implode(' AND ', $conditions) . ' ORDER BY ' . $db->escape($order_by) . ' ' . $db->escape($direction)) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) { while ($user_data = $db->fetch_assoc($result)) { $user_title = get_title($user_data); // This script is a special case in that we want to display "Not verified" for non-verified users if (($user_data['g_id'] == '' || $user_data['g_id'] == PUN_UNVERIFIED) && $user_title != $lang_common['Banned']) { $user_title = '<span class="warntext">Not verified</span>'; } $actions = '<a href="admin_users.php?ip_stats=' . $user_data['id'] . '">View IP stats</a> - <a href="search.php?action=show_user&user_id=' . $user_data['id'] . '">Show posts</a>'; ?> <tr> <td class="tcl"><?php echo '<a href="profile.php?section=personality&id=' . $user_data['id'] . '">' . pun_htmlspecialchars($user_data['username']) . '</a>'; ?> </td> <td class="tc1"><?php echo '<a href="/users/' . $user_data['id'] . '">' . pun_htmlspecialchars($user_data['topo_name']) . '</a>'; ?> </td>
<?php /* Displaying an image below the header - only the frontpage image is different, the rest of pages have the same image */ ?> <section id="intro"> <h2>Intro</h2> <figure> <?php if (!isset($img)) { $img = get_template_directory_uri() . "/assets/jeep-for-title.jpg"; } if (!isset($title)) { $title = get_title(); } $retina = false; include '_responsive-images.php'; ?> <figcaption> <a href="<?php echo $link; ?> "><?php echo $title; ?> </a> </figcaption> </figure> </section>
function macro_TitleIndex($formatter, $value, $options = array()) { global $DBInfo; $pc = !empty($DBInfo->titleindex_pagecount) ? intval($DBInfo->titleindex_pagecount) : 100; if ($pc < 1) { $pc = 100; } $pg = empty($options['p']) ? 1 : intval($options['p']); if ($pg < 1) { $pg = 1; } $group = $formatter->group; $key = -1; $keys = array(); if ($value == '' or $value == 'all') { $sel = ''; } else { $sel = ucfirst($value); } // get all keys $all_keys = get_keys(); if (isset($sel[0])) { if (!isset($all_keys[$sel])) { $sel = key($all_keys); } // default } if (@preg_match('/' . $sel . '/i', '') === false) { $sel = ''; } $titleindex = array(); // cache titleindex $kc = new Cache_text('titleindex'); $delay = !empty($DBInfo->default_delaytime) ? $DBInfo->default_delaytime : 0; $uid = ''; if (function_exists('posix_getuid')) { $uid = '.' . posix_getuid(); } $lock_file = _fake_lock_file($DBInfo->vartmp_dir, 'titleindex' . $uid); $locked = _fake_locked($lock_file, $DBInfo->mtime()); if ($locked or $kc->exists('key') and $DBInfo->checkUpdated($kc->mtime('key'), $delay)) { if (!empty($formatter->use_group) and $formatter->group) { $keys = $kc->fetch('key.' . $formatter->group); $titleindex = $kc->fetch('titleindex.' . $formatter->group); } else { $keys = $kc->fetch('key'); $titleindex = $kc->fetch('titleindex' . $sel); } if (isset($sel[0]) and isset($titleindex[$sel])) { $all_pages = $titleindex[$sel]; } if (empty($titleindex) and $locked) { // no cache found return _("Please wait..."); } } if (empty($all_pages)) { $all_pages = array(); $indexer = $DBInfo->lazyLoad('titleindexer'); if (!empty($formatter->use_group) and $formatter->group) { $group_pages = $indexer->getLikePages('^' . $formatter->group); foreach ($group_pages as $page) { $all_pages[] = str_replace($formatter->group, '', $page); } } else { $all_pages = $indexer->getLikePages('^' . $all_keys[$sel], 0); } #natcasesort($all_pages); #sort($all_pages,SORT_STRING); //usort($all_pages, 'strcasecmp'); $pages = array_flip($all_pages); if (!empty($formatter->use_group)) { array_walk($pages, '_setpagekey'); } else { array_walk($pages, create_function('&$p, $k', '$p = $k;')); } $all_pages = array_flip($pages); uksort($all_pages, 'strcasecmp'); } if (empty($keys) or empty($titleindex)) { _fake_lock($lock_file); foreach ($all_pages as $page => $rpage) { $p = ltrim($page); $pkey = get_key("{$p}"); if ($key != $pkey) { $key = $pkey; //$keys[] = $pkey; if (!isset($titleindex[$pkey])) { $titleindex[$pkey] = array(); } } $titleindex[$pkey][$page] = $rpage; } $keys = array_keys($all_keys); if (!empty($tlink)) { $keys[] = 'all'; } if (!empty($formatter->use_group) and $formatter->group) { $kc->update('key.' . $formatter->group, $keys); $kc->update('titleindex.' . $formatter->group, $titleindex); } else { $kc->update('key', $keys); $kc->update('titleindex' . $sel, $titleindex); } if (isset($sel[0]) and isset($titleindex[$sel])) { $all_pages = $titleindex[$sel]; } _fake_lock($lock_file, LOCK_UN); } $pnut = null; if (isset($sel[0]) and count($all_pages) > $pc) { $pages_number = intval(count($all_pages) / $pc); if (count($all_pages) % $pc) { $pages_number++; } $pages = array_keys($all_pages); $pages = array_splice($pages, ($pg - 1) * $pc, $pc); $selected = array(); foreach ($pages as $p) { $selected[$p] = $all_pages[$p]; } $pages = $selected; $pnut = get_pagelist($formatter, $pages_number, '?action=titleindex&sec=' . $sel . '&p=', !empty($pg) ? $pg : 1); } else { $pages =& $all_pages; } //print count($all_pages); //exit; $out = ''; # if ($DBInfo->use_titlecache) # $cache=new Cache_text('title'); $key = ''; foreach ($pages as $page => $rpage) { $p = ltrim($page); $pkey = get_key("{$p}"); if ($key != $pkey) { $key = $pkey; if (isset($sel[0]) and !preg_match('/^' . $sel . '/i', $pkey)) { continue; } if (!empty($out)) { $out .= "</ul>"; } $out .= "<a name='{$key}'></a><h3><a href='#top'>{$key}</a></h3>\n"; $out .= "<ul>"; } if (isset($sel[0]) and !preg_match('/^' . $sel . '/i', $pkey)) { continue; } # # if ($DBInfo->use_titlecache and $cache->exists($page)) # $title=$cache->fetch($page); # else $title = get_title($rpage, $page); #$out.= '<li>' . $formatter->word_repl('"'.$page.'"',$title,'',0,0); $urlname = _urlencode($group . $rpage); $out .= '<li>' . $formatter->link_tag($urlname, '', _html_escape($title)); $keyname = $DBInfo->pageToKeyname(urldecode($rpage)); if (is_dir($DBInfo->upload_dir . "/{$keyname}") or !empty($DBInfo->use_hashed_upload_dir) and is_dir($DBInfo->upload_dir . '/' . get_hashed_prefix($keyname) . $keyname)) { $out .= ' ' . $formatter->link_tag($urlname, "?action=uploadedfiles", $formatter->icon['attach']); } $out .= "</li>\n"; } if (!empty($pnut)) { $out .= '<li style="list-style:none">' . $pnut . '</li>' . "\n"; } $out .= "</ul>\n"; $index = ''; $tlink = ''; if (isset($sel[0])) { $tlink = $formatter->link_url($formatter->page->urlname, '?action=titleindex&sec='); } $index = array(); foreach ($keys as $key) { $name = strval($key); $tag = '#' . $key; $link = !empty($tlink) ? preg_replace('/sec=/', 'sec=' . _urlencode($key), $tlink) : ''; if ($name == 'Others') { $name = _("Others"); } else { if ($name == 'all') { $name = _("Show all"); } } $index[] = "<a href='{$link}{$tag}'>{$name}</a>"; } $str = implode(' | ', $index); return "<center><a name='top'></a>{$str}</center>\n{$out}"; }