function handle_reset() { $device = @$_GET['device']; if (empty($device)) { $device = get_device(); } if (empty($device)) { return 'no device'; } //删除保存了的在线列表 mmc_array_del(NS_DEVICE_LIST, $device); //删除保存了的账户信息 $mem = api_open_mmc(); $mem->ns_delete(NS_BINDED_LIST, $device); $mem->ns_delete(NS_BINDED_CAPTION, $device); foreach (mmc_array_keys(NS_BINDING_LIST) as $platform) { $ns_bind_list = NS_BINDING_LIST . $platform; mmc_array_del($ns_bind_list, $device); } //删除保存了的计划任务消息记录 $mem->ns_delete(NS_SCHED_DEVICE, $device); $mem->ns_delete(NS_PLANS_DEVICE, $device); new_user($device, time() + COOKIE_TIMEOUT_NEW); //清空cookie unset($_COOKIE[COOKIE_DEVICE_SAVED]); setcookie(COOKIE_DEVICE_SAVED, '', time() - 3600, '/', COOKIE_DOMAIN); return 'succeed'; }
/** * return true if mobile theme should be loaded * * @return bool */ function mobile_theme() { global $conf; if (empty($conf['mobile_theme'])) { return false; } if (isset($_GET['mobile'])) { $is_mobile_theme = get_boolean($_GET['mobile']); pwg_set_session_var('mobile_theme', $is_mobile_theme); } else { $is_mobile_theme = pwg_get_session_var('mobile_theme'); } if (is_null($is_mobile_theme)) { $is_mobile_theme = get_device() == 'mobile'; pwg_set_session_var('mobile_theme', $is_mobile_theme); } return $is_mobile_theme; }
/** * 取得用户未读信息 * * * @param string token , 必填 * @return array ('notice'=>'未读计数' , 'nid' => '最后一条Notice ID' , 'text' => '最后一条未读Notice内容') * @author EasyChen */ public function user_unread() { // 处理掉全部的未读计数 // 私信和系统通知 $sql = "SELECT COUNT(*) FROM `notice` WHERE `to_uid` = '" . intval(uid()) . "' AND `is_read` = 0 "; $notice_count = intval(get_var($sql)); $sql = "SELECT COUNT(*) FROM `message` WHERE `to_uid` = '" . intval(uid()) . "' AND `is_read` = 0 "; $message_count = intval(get_var($sql)); $sql = "SELECT COUNT( * ) AS `from_cnt` , `from_uid` FROM `message` WHERE `to_uid` = '" . intval(uid()) . "' AND `is_read` = 0 GROUP BY `from_uid` "; $muids = array(); $muidstring = ''; if ($mdata = get_data($sql)) { foreach ($mdata as $mitem) { $muids[] = $mitem['from_uid']; } $muidstring = join('|', $muids); } $last_notice = get_line("SELECT * FROM `notice` WHERE `to_uid` = '" . intval(uid()) . "' AND `is_read` = 0 ORDER BY `id` DESC LIMIT 1"); $last_message = get_line("SELECT * FROM `message` WHERE `to_uid` = '" . intval(uid()) . "' AND `is_read` = 0 ORDER BY `id` DESC LIMIT 1"); // update user online $sql = "REPLACE `online` ( `uid` , `session` , `last_active` , `device` ) VALUES ( '" . intval(uid()) . "' , '" . s(session_id()) . "' , NOW() , '" . get_device() . "' ) "; run_sql($sql); return self::send_result(array('all' => $message_count + $notice_count, 'message' => $message_count, 'uids' => $muidstring, 'notice' => $notice_count, 'nid' => $last_notice['id'], 'mid' => $last_message['id'], 'text' => $last_notice['content'])); }
function mobile_link() { global $template, $conf; $config = unserialize($conf['smartpocket']); $template->assign('smartpocket', $config); if (!empty($conf['mobile_theme']) && (get_device() != 'desktop' || mobile_theme())) { $template->assign(array('TOGGLE_MOBILE_THEME_URL' => add_url_params(htmlspecialchars($_SERVER['REQUEST_URI']), array('mobile' => mobile_theme() ? 'false' : 'true')))); } }
$template->set_filenames(array('tail' => 'footer.tpl')); trigger_notify('loc_begin_page_tail'); $template->assign(array('VERSION' => $conf['show_version'] ? PHPWG_VERSION : '', 'PHPWG_URL' => defined('PHPWG_URL') ? PHPWG_URL : '')); //--------------------------------------------------------------------- contact if (!is_a_guest()) { $template->assign('CONTACT_MAIL', get_webmaster_mail_address()); } //------------------------------------------------------------- generation time $debug_vars = array(); if ($conf['show_queries']) { $debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug)); } if ($conf['show_gt']) { if (!isset($page['count_queries'])) { $page['count_queries'] = 0; $page['queries_time'] = 0; } $time = get_elapsed_time($t2, get_moment()); $debug_vars = array_merge($debug_vars, array('TIME' => $time, 'NB_QUERIES' => $page['count_queries'], 'SQL_TIME' => number_format($page['queries_time'], 3, '.', ' ') . ' s')); } $template->assign('debug', $debug_vars); //------------------------------------------------------------- mobile version if (!empty($conf['mobile_theme']) && (get_device() != 'desktop' || mobile_theme())) { $template->assign('TOGGLE_MOBILE_THEME_URL', add_url_params(htmlspecialchars($_SERVER['REQUEST_URI']), array('mobile' => mobile_theme() ? 'false' : 'true'))); } trigger_notify('loc_end_page_tail'); // // Generate the page // $template->parse('tail'); $template->p();
function auth_session() { $network = get_network(); $device = get_device(); $user = get_user(); $ap = get_ap(); if (!$user) { $code = get_code(); } $s = date("Y-m-d H:i:s", time()); $sql = 'INSERT INTO ' . db_table('sessions') . ' (ap_id, network_id, device_id, user_id, code_id, auth_time, session_key) ' . 'VALUES (' . ($ap ? $ap['id'] : 'null') . ',' . ($network ? $network['id'] : 'null') . ',' . ($device ? $device['id'] : 'null') . ',' . ($user ? $user['id'] : 'null') . ',' . ($code ? $code['id'] : 'null') . ',' . '\'' . $s . '\',\'' . session_key() . '\')'; db_query($sql, false); }
function Fotorama_end_picture() { global $template, $conf, $user, $page; if (Fotorama_is_replace_picture()) { $url_up = duplicate_index_url(array('start' => floor($page['current_rank'] / $page['nb_image_page']) * $page['nb_image_page']), array('start')); //slideshow end $template->assign(array('U_SLIDESHOW_STOP' => $url_up)); $template->assign('replace_picture', true); } if (!$page['slideshow']) { return; } load_language('plugin.lang', FOTORAMA_PATH); $split_limit = 400; if ('mobile' == get_device()) { $split_limit /= 2; } $view_offset = null; if (count($page['items']) >= 1.2 * $split_limit) { $first = $split_limit * 0.2; $last = $split_limit - $first; $first = $page['current_rank'] - $first; if ($first < 0) { $first += count($page['items']); } $last = $page['current_rank'] + $last; if ($last >= count($page['items'])) { $last -= count($page['items']); } if ($first < $last) { $selection = array_slice($page['items'], $first, $last - $first); $view_borders = array(0, count($selection) - 1); $view_offset = array('from' => 0, 'offset' => $first); } else { $selection = array_slice($page['items'], 0, $last); $view_borders = array(count($selection), count($selection) - 1); $view_offset = array('from' => count($selection), 'offset' => $first - count($selection)); $selection = array_merge($selection, array_slice($page['items'], $first)); } } else { $selection = $page['items']; $view_borders = null; } $query = ' SELECT * FROM ' . IMAGES_TABLE . ' WHERE id IN (' . implode(',', $selection) . ') ORDER BY FIELD(id, ' . implode(',', $selection) . ') ;'; $result = pwg_query($query); $current = $template->get_template_vars('current'); if (isset($current['selected_derivative'])) { $type = $current['selected_derivative']->get_type(); } $defined = ImageStdParams::get_defined_type_map(); if (!isset($type) or !isset($defined[$type])) { $type = pwg_get_session_var('picture_deriv', $conf['derivative_default_size']); } $skip = -1; $big_type = $type; $next_type = $type; foreach (ImageStdParams::get_defined_type_map() as $def_type => $params) { if ($def_type == $type) { $skip = 2; } if ($skip >= 0) { $big_type = $def_type; } if ($skip >= 1 and $conf['Fotorama']['resize']) { $next_type = $def_type; } if ($skip == 0) { break; } $skip = $skip - 1; } $type = $next_type; // +1 size for inpage slideshow if ($conf['Fotorama']['only_fullscreen']) { $type = $big_type; } $type_params = ImageStdParams::get_by_type($type); $big_type_params = ImageStdParams::get_by_type($big_type); if ($conf['Fotorama']['nav'] == 'thumbs' or $conf['Fotorama']['fullscreen_nav'] == 'thumbs') { $has_thumbs = true; } else { $has_thumbs = false; } if ($has_thumbs) { if ($conf['Fotorama']['square_thumb']) { $thumb_params = ImageStdParams::get_custom($conf['Fotorama']['thumbheight'], $conf['Fotorama']['thumbheight'], 1, $conf['Fotorama']['thumbheight'], $conf['Fotorama']['thumbheight']); } else { $thumb_params = ImageStdParams::get_custom(9999, $conf['Fotorama']['thumbheight']); } } $picture = array(); while ($row = pwg_db_fetch_assoc($result)) { $row['src_image'] = new SrcImage($row); $row['derivative'] = new DerivativeImage($type_params, $row['src_image']); $row['derivative_big'] = new DerivativeImage($big_type_params, $row['src_image']); if ($has_thumbs) { $row['derivative_thumb'] = new DerivativeImage($thumb_params, $row['src_image']); } $row['url'] = duplicate_picture_url(array('image_id' => $row['id'], 'image_file' => $row['file']), array('start')); $row['TITLE'] = render_element_name($row); $picture[] = $row; } $picture = trigger_change('fotorama_items', $picture, $selection); $template->assign(array('TOTAL_ITEMS' => count($page['items']), 'view_borders' => $view_borders, 'view_offset' => $view_offset, 'current_rank' => array_search($page['image_id'], $selection))); $template->assign('item_height', ImageStdParams::get_by_type($type)->max_height()); $template->assign('items', $picture); $template->assign(array('Fotorama' => $conf['Fotorama'])); $template->assign('Fotorama_has_thumbs', $has_thumbs); if (is_file('./themes/' . $user['theme'] . '/template/fotorama.tpl')) { $template->set_filenames(array('slideshow' => realpath('./themes/' . $user['theme'] . '/template/fotorama.tpl'))); } else { $template->set_filenames(array('slideshow' => realpath(FOTORAMA_PATH . 'template/fotorama.tpl'))); } $template->assign('FOTORAMA_CONTENT_PATH', realpath(FOTORAMA_PATH . 'template/fotorama-content.tpl')); }
function modus_thumbs($x, $smarty) { global $template, $page, $conf; $default_params = $smarty->getTemplateVars('derivative_params'); $row_height = $default_params->max_height(); $device = get_device(); $container_margin = 5; if ('mobile' == $device) { $horizontal_margin = floor(0.01 * $row_height); $container_margin = 0; } elseif ('tablet' == $device) { $horizontal_margin = floor(0.015 * $row_height); } else { $horizontal_margin = floor(0.02 * $row_height); } $vertical_margin = $horizontal_margin + 1; $candidates = array($default_params); foreach (ImageStdParams::get_defined_type_map() as $params) { if ($params->max_height() > $row_height && $params->sizing->max_crop == $default_params->sizing->max_crop) { $candidates[] = $params; if (count($candidates) == 3) { break; } } } $do_over = 'desktop' == $device; $new_icon = " <span class=albSymbol title=\"" . l10n('posted on %s') . "\">" . MODUS_STR_RECENT . '</span>'; foreach ($smarty->getTemplateVars('thumbnails') as $item) { $src_image = $item['src_image']; $new = !empty($item['icon_ts']) ? sprintf($new_icon, format_date($item['date_available'])) : ''; $idx = 0; do { $cparams = $candidates[$idx]; $c = new DerivativeImage($cparams, $src_image); $csize = $c->get_size(); $idx++; } while ($csize[1] < $row_height - 2 && $idx < count($candidates)); $a_style = ''; if ($csize[1] < $row_height) { $a_style = ' style="top:' . floor(($row_height - $csize[1]) / 2) . 'px"'; } elseif ($csize[1] > $row_height) { $csize = $c->get_scaled_size(9999, $row_height); } if ($do_over) { ?> <li style=width:<?php echo $csize[0]; ?> px;height:<?php echo $row_height; ?> px><a href="<?php echo $item['URL']; ?> "<?php echo $a_style; ?> ><img src="<?php echo $c->get_url(); ?> " width=<?php echo $csize[0]; ?> height=<?php echo $csize[1]; ?> alt="<?php echo $item['TN_ALT']; ?> "></a><div class=overDesc><?php echo $item['NAME']; echo $new; ?> </div></li> <?php } else { ?> <li style=width:<?php echo $csize[0]; ?> px;height:<?php echo $row_height; ?> px><a href="<?php echo $item['URL']; ?> "<?php echo $a_style; ?> ><img src="<?php echo $c->get_url(); ?> " width=<?php echo $csize[0]; ?> height=<?php echo $csize[1]; ?> alt="<?php echo $item['TN_ALT']; ?> "></a></li> <?php } } $template->block_html_style(null, '#thumbnails{text-align:justify;overflow:hidden;margin-left:' . ($container_margin - $horizontal_margin) . 'px;margin-right:' . $container_margin . 'px} #thumbnails>li{float:left;overflow:hidden;position:relative;margin-bottom:' . $vertical_margin . 'px;margin-left:' . $horizontal_margin . 'px}#thumbnails>li>a{position:absolute;border:0}'); $template->block_footer_script(null, 'rvgtProcessor=new RVGThumbs({hMargin:' . $horizontal_margin . ',rowHeight:' . $row_height . '});'); $my_base_name = basename(dirname(__FILE__)); // not async to avoid visible flickering reflow $template->scriptLoader->add('modus.arange', 1, array('jquery'), 'themes/' . $my_base_name . "/js/thumb.arrange.min.js", 0); }
function get_device_saved($create = false) { if ($create) { $device = null; } else { $device = get_device(); } if (empty($device)) { $device = gen_uuid(); setcookie(COOKIE_DEVICE_ID, $device, time() + COOKIE_TIMEOUT, '/', COOKIE_DOMAIN); $_COOKIE[COOKIE_DEVICE_ID] = $device; $UA_infos = get_ua_infos(); $device_saved = ['device' => $device, 'need_save' => true, 'first_pageview' => time(), 'last_pageview' => time(), 'pageview_count' => 0, 'is_first_pageview' => true, 'first_session' => time(), 'start_session' => time(), 'session_pv' => 0, 'session_count' => 0, 'is_first_session' => true, 'is_first_day' => true, 'is_first_session_pv' => true, 'staytime' => 0, 'popup_private' => [], 'popup_tasks' => [], 'popup_times' => 0, 'popup_lasttime' => 0, 'replace_private' => [], 'replace_tasks' => [], 'replace_times' => 0, 'replace_lasttime' => 0, 'UserAgent' => $UA_infos['UserAgent'], 'ismobiledevice' => $UA_infos['ismobiledevice'], 'browser' => $UA_infos['browser'], 'platform' => $UA_infos['platform'], 'device_name' => $UA_infos['device_name'], 'is_registed' => false, 'kword_title' => [], 'kword_account' => [], 'kword_interest' => [], 'kword_submit' => [], 'kword_cart' => [], 'kword_favorite' => []]; put_device_saved($device_saved); return $device_saved; } else { $device_file = device_file($device); if (!file_exists($device_file)) { return get_device_saved(true); } $device_saved = unserialize(file_get_contents($device_file)); $device_saved['need_save'] = true; return $device_saved; } }
<?php // Genius Room: WYWO // Script: Main index page // Revision: 3.0.6 # ----- Load functions common to all GR Server apps. # Then kick out front of house and mobile devices. require '../genius.php'; if (get_domain() == 'foh' || get_device() != 'Macintosh') { die(header('Location:../')); } # ----- Load basic WYWO functions. require './php/basic.php'; # ----- Load the requested area or redirect if it is fake. if (!file_exists('./php/' . $_GET['area'] . '.php')) { die(header('Location:./?area=view')); } require './php/' . $_GET['area'] . '.php'; // Copyright: 2010 by Michael V. Colianna ?> <!DOCTYPE html PUBLIC "-//W3C//TD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="./css/wywo.css" rel="stylesheet" type="text/css" /> <link href="./css/<?php echo $_GET['area']; ?> .css" rel="stylesheet" type="text/css" /> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script src="./js/jquery.js" type="text/javascript"></script> <script src="./js/aux.js" type="text/javascript"></script>