Ejemplo n.º 1
0
function smarty_function_cookie_jar($params, $smarty)
{
    if (empty($params['name'])) {
        return;
    }
    return getCookie($params['name']);
}
Ejemplo n.º 2
0
function adminDisplayPage()
{
    $hashUsername = getCookie('ID');
    $check = mysql_query("SELECT * FROM users WHERE sha256_user = '******'") or die(mysql_error());
    $info = mysql_fetch_array($check);
    $username = $info['username'];
    if ($info['admin'] != 1) {
        header("Location: logout.php");
    }
    echo file_get_contents("admin_header.html");
    //  $online = "online";
    //  $systemCheck = mysql_query("SELECT * FROM system WHERE option = '$online'") or die(mysql_error());
    //  $systemInfo = mysql_fetch_array( $systemCheck );
    //  echo "<form action=\"admin.php\" method=\"POST\">\n";
    //  echo "<input type=\"text\" name=\"offlineData\" value=\"".$systemInfo['data1']."\">\n";
    //  if ($systemInfo['data0'] == "yes")
    //  {
    //    echo "<input type=\"submit\" name=\"offlineDataSubmit\" value=\"Set Offline\">\n";
    //  }
    //  else
    //  {
    //    echo "<input type=\"submit\" name=\"offlineDataSubmit\" value=\"Set Online\">\n";
    //  }
    //  echo "</form>\n";
}
Ejemplo n.º 3
0
function smarty_function_debugger($params, $smarty)
{
    global $prefs;
    if ($prefs['feature_debug_console'] == 'y') {
        global $debugger;
        require_once 'lib/debug/debugger.php';
        //global $smarty;
        // Get current URL
        $smarty->assign('console_father', $_SERVER["REQUEST_URI"]);
        // Set default value
        $smarty->assign('result_type', NO_RESULT);
        // Exec user command in internal debugger
        if (isset($_REQUEST["command"])) {
            // Exec command in debugger
            $command_result = $debugger->execute($_REQUEST["command"]);
            $smarty->assign('command', $_REQUEST["command"]);
            $smarty->assign('result_type', $debugger->result_type());
            // If result need temlate then we have $command_result array...
            if ($debugger->result_type() == TPL_RESULT) {
                $smarty->assign('result_tpl', $debugger->result_tpl());
                $smarty->assignByRef('command_result', $command_result);
            } else {
                $smarty->assign('command_result', $command_result);
            }
        } else {
            $smarty->assign('command', "");
        }
        // Draw tabs to array. Note that it MUST be AFTER exec command.
        // Bcouse 'exec' can change state of smth so tabs content should be changed...
        $tabs_list = $debugger->background_tabs_draw();
        // Add results tab which is always exists...
        $tabs_list["console"] = $smarty->fetch("debug/tiki-debug_console_tab.tpl");
        ksort($tabs_list);
        $tabs = array();
        // TODO: Use stupid dbl loop to generate links code and divs,
        //       but it is quite suitable for
        foreach ($tabs_list as $tname => $tcode) {
            // Generate href code for current button
            $href = '';
            foreach ($tabs_list as $tn => $t) {
                $href .= ($tn == $tname ? 'show' : 'hide') . "('" . md5($tn) . "');";
            }
            //
            $tabs[] = array("button_caption" => $tname, "tab_id" => md5($tname), "button_href" => $href . 'return false;', "tab_code" => $tcode);
        }
        // Debug console open/close
        //require_once('lib/setup/cookies.php');
        $c = getCookie('debugconsole', 'menu');
        $smarty->assign('debugconsole_style', $c == 'o' ? 'display:block;' : 'display:none;');
        $smarty->assignByRef('tabs', $tabs);
        $js = '';
        if ($prefs['feature_jquery_ui'] == 'y') {
            global $headerlib;
            require_once 'lib/headerlib.php';
            $headerlib->add_jq_onready("\n\$('#debugconsole').draggable({\n\tstop: function(event, ui) {\n\t\tvar off = \$('#debugconsole').offset();\n   \t\tsetCookie('debugconsole_position', off.left + ',' + off.top);\n\t}\n});\ndebugconsole_pos = getCookie('debugconsole_position')\nif (debugconsole_pos) {debugconsole_pos = debugconsole_pos.split(',');}\nif (debugconsole_pos) {\n\t\$('#debugconsole').css({'left': debugconsole_pos[0] + 'px', 'top': debugconsole_pos[1] + 'px'});\n}\n");
        }
        $ret = $smarty->fetch('debug/function.debugger.tpl');
        return $ret;
    }
}
Ejemplo n.º 4
0
function setCookieSection($name, $value, $section = '', $expire = null, $path = '', $domain = '', $secure = '')
{
    global $feature_no_cookie;
    if ($section) {
        $valSection = getCookie($section);
        $name2 = '@' . $name . ':';
        if ($valSection) {
            if (preg_match('/' . preg_quote($name2) . '/', $valSection)) {
                $valSection = preg_replace('/' . preg_quote($name2) . '[^@;]*/', $name2 . $value, $valSection);
            } else {
                $valSection = $valSection . $name2 . $value;
            }
            setCookieSection($section, $valSection, '', $expire, $path, $domain, $secure);
        } else {
            $valSection = $name2 . $value;
            setCookieSection($section, $valSection, '', $expire, $path, $domain, $secure);
        }
    } else {
        if ($feature_no_cookie) {
            $_SESSION['tiki_cookie_jar'][$name] = $value;
        } else {
            setcookie($name, $value, $expire, $path, $domain, $secure);
        }
    }
}
Ejemplo n.º 5
0
 public function testServices()
 {
     $ins = getAuth();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Auth\IAuth::class, $ins);
     $ins = getView();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\IView::class, $ins);
     $ins = getLog();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Log\ILog::class, $ins);
     //        $ins = getDB();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\MedooDB::class, $ins);
     //        $ins = getRedis();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\PRedis::class, $ins);
     //        $ins = getDataPool();
     //        $this->assertInstanceOf(\Wwtg99\DataPool\Common\IDataPool::class, $ins);
     $ins = getCache();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\Cache::class, $ins);
     $ins = getSession();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\SessionUtil::class, $ins);
     $ins = getCookie();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\CookieUtil::class, $ins);
     $ins = getOValue();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\OldValue::class, $ins);
     $ins = getAssets();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\AssetsManager::class, $ins);
     $ins = getMailer();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Mail::class, $ins);
     $ins = Flight::Express();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Express::class, $ins);
     $ins = getPlugin('php');
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Plugin\IPlugin::class, $ins);
 }
Ejemplo n.º 6
0
function chkLogin2()
{
    global $db;
    $m_id = getCookie('adminid');
    ckSql($m_id);
    $m_name = getCookie('adminname');
    ckSql($m_name);
    $m_check = getCookie('admincheck');
    ckSql($m_check);
    $index = 'index.php';
    if (strpos($_SERVER['PHP_SELF'], 'editor') > -1) {
        $index = "../" . $index;
    }
    if (!isN($m_name) && !isNum($m_id)) {
        $row = $db->getRow('SELECT * FROM {pre}manager WHERE m_name=\'' . mysql_real_escape_string($m_name) . '\' AND m_id= \'' . $m_id . '\' AND m_status=1');
        if ($row) {
            $loginValidate = md5($row['m_random'] . $row['m_name'] . $row['m_id']);
            if ($m_check != $loginValidate) {
                sCookie('admincheck', '');
                redirect($index . '?m=admin-login', 'top.');
            }
        } else {
            sCookie('admincheck', '');
            redirect($index . '?m=admin-login', 'top.');
        }
    } else {
        redirect($index . '?m=admin-login', 'top.');
    }
}
Ejemplo n.º 7
0
function chkLogin()
{
    global $db;
    $m_id = getCookie("adminid");
    $m_id = chkSql($m_id, true);
    $m_name = getCookie("adminname");
    //	writetofile("operate.log", "loginame:{".$m_name ."};action:{".be("all","action")."};referce:{".getReferer()."}.request:{".$_SERVER["REQUEST_URI"]."};parameters GET:{".json_encode($_GET)."}" );
    writetofile("operate.log", "loginame:{" . $m_name . "};action:{" . be("all", "action") . "};referce:{" . getReferer() . "}.request:{" . $_SERVER["REQUEST_URI"] . "};parameters POST:{" . json_encode($_POST) . "}");
    $m_name = chkSql($m_name, true);
    if (!isN($m_name) && !isN($m_id)) {
        $row = $db->getRow("SELECT * FROM {pre}manager WHERE m_name='" . $m_name . "' AND m_id= '" . $m_id . "' AND m_status ='1'");
        if ($row) {
            $loginValidate = md5($row["m_random"] . $row["m_name"] . $row["m_id"]);
            if (getCookie("admincheck") != $loginValidate) {
                sCookie("admincheck", "");
                die("<script>top.location.href='index.php?action=login';</script>");
            }
        } else {
            sCookie("admincheck", "");
            die("<script>top.location.href='index.php?action=login';</script>");
        }
    } else {
        die("<script>top.location.href='index.php?action=login';</script>");
    }
}
Ejemplo n.º 8
0
 public function dispatch($action)
 {
     if (!empty($_GET['wid']) and !empty($_GET['hash'])) {
         if (isset($_GET['hash']) && !$this->validateUser($_GET['wid'], $_GET['hash'])) {
             $result = new ResultObj(false, '', 'Invalid User Hash:' . $_GET['hash']);
             echo $result->toJson();
             exit;
         }
         //get hash and compare with $_GET['hahs']
         //if(OK)
         setMyCookie('ugg_wid1', $_GET['wid'], time() + 86400);
     } else {
         if (!empty($_GET['wid'])) {
             $wid = getCookie('ugg_wid1');
             if (!empty($wid) and $wid != $_GET['wid']) {
                 //echo $wid;exit;
                 //return $this->authAction();
             }
         }
     }
     /*//check login status
     		$user = $this->getCurrentUser();
     		if(!$user->isLoggedIn()) {
     			$data['success'] = false;
     			$data['error_code'] = 101;
     			$data['message'] = "请登入";
     			echo json_encode($data);
     			return false;
     		}*/
     return $this->{$action}();
 }
Ejemplo n.º 9
0
function getColor($name, $default)
{
    if (getCookie($name)) {
        return getCookie($name);
    } else {
        return $default;
    }
}
 /**
  * Redefined in order to register cache busters
  *
  * @param class_module_pages_pageelement $objElementData
  */
 public function __construct($objElementData)
 {
     parent::__construct($objElementData);
     //we support ratings, so add cache-busters
     if (class_module_system_module::getModuleByName("rating") !== null) {
         $this->setStrCacheAddon(getCookie(class_module_rating_rate::RATING_COOKIE));
     }
 }
Ejemplo n.º 11
0
function validateUser()
{
    if (!isValidSessionId(getCookie(COOKIE_SESSION_ID))) {
        setStatus("401", "Unauthorized");
        die;
    } else {
        debug("Validated user");
    }
}
Ejemplo n.º 12
0
/**
 * @param $name
 */
function setDisplayMenu($name)
{
    global $smarty;
    if (getCookie($name, 'menu', isset($_COOKIE['menu']) ? null : 'o') == 'o') {
        $smarty->assign('mnu_' . $name, 'display:block;');
        $smarty->assign('icn_' . $name, 'o');
    } else {
        $smarty->assign('mnu_' . $name, 'display:none;');
    }
}
Ejemplo n.º 13
0
 public static function isNeedCaptha()
 {
     if (cmsController::getInstance()->getModule('users')->is_auth()) {
         return false;
     }
     if (getCookie('umi_captcha') == md5(getCookie('user_captcha'))) {
         $_SESSION['is_human'] = 1;
     }
     return getSession('is_human') != 1;
 }
Ejemplo n.º 14
0
function syncronizeCookie($ve3cb9741ffde596f46710a5d7e3ec587, $ve8424b162bf308d1f8a635e40a7ca481)
{
    $v95742520793f25cf843c4ea860507463 = getCookie($ve3cb9741ffde596f46710a5d7e3ec587);
    if ($v95742520793f25cf843c4ea860507463 && !$ve8424b162bf308d1f8a635e40a7ca481) {
        echo "setCookie('{$ve3cb9741ffde596f46710a5d7e3ec587}', '{$v95742520793f25cf843c4ea860507463}');\n";
    }
    if (!$v95742520793f25cf843c4ea860507463 && $ve8424b162bf308d1f8a635e40a7ca481) {
        setcookie($ve3cb9741ffde596f46710a5d7e3ec587, $ve8424b162bf308d1f8a635e40a7ca481, 0, "/");
    }
}
Ejemplo n.º 15
0
 public final function check_login()
 {
     if (M == 'admin' && C == 'index' && A == 'login') {
         return true;
     } else {
         $userid = getCookie('userid');
         if (!isset($_SESSION['userid']) || !isset($_SESSION['roleid']) || !$_SESSION['userid'] || !$_SESSION['roleid'] || $userid != $_SESSION['userid']) {
             jump('登陆', '?m=admin&c=index&a=login');
         }
     }
 }
Ejemplo n.º 16
0
/**
 * 获取登陆后的转向
 */
function getUserRefer()
{
    global $_FANWE;
    $refer = $_FANWE['request']['refer'];
    $redir_url = getCookie('redir_url');
    if ($redir_url) {
        $refer = $redir_url;
    }
    if (empty($refer)) {
        $refer = FU('u/index');
    }
    return $refer;
}
Ejemplo n.º 17
0
function displayFeedbackPage()
{
    $browser = $_SERVER['HTTP_USER_AGENT'];
    $user_hash = getCookie('ID');
    $check = mysql_query("SELECT * FROM users WHERE sha256_user = '******'") or die(mysql_error());
    while ($info = mysql_fetch_array($check)) {
        echo "<h2>Feedback form:</h2><br />\n";
        echo "I do appreciate all feedback, please just make sure it's constructive. Thank you.<br /><hr /><br />\n";
        echo "<form action=\"feedback.php\" method=\"post\">\n";
        echo "<input type=\"hidden\" name=\"Name\" value=\"" . $info['fname'] . " " . $info['lname'] . "\">\n";
        echo "<input type=\"hidden\" name=\"Username\" value=\"" . $info['username'] . "\">\n";
        echo "<input type=\"hidden\" name=\"Email\" value=\"" . $info['email'] . "\">\n";
        echo "<input type=\"hidden\" name=\"BrowserData\" value=\"{$browser}\">\n";
        echo "<table class=\"transparent\">\n";
        echo "<tr><td>Username:</td><td>" . $info['username'] . "</td></tr>\n";
        echo "<tr><td>Email:</td><td>" . $info['email'] . "</td></tr>\n";
        echo "<tr><td>Operating System:</td><td>\n";
        echo "<select name=\"OperatingSystem\">\n";
        echo "<option value=\"NotSelected\">SELECT</option>\n";
        echo "<option value=\"MacOS\">Mac OS</option>\n";
        echo "<option value=\"Linux\">Linux Variant</option>\n";
        echo "<option value=\"BSD\">BSD Variant</option>\n";
        echo "<option value=\"Windows\">MS Windows</option>\n";
        echo "<option value=\"OtherOS\">Other (Specify)</option>\n";
        echo "</select>\n";
        echo "<input type=\"text\" name=\"OtherOS:\" />\n";
        echo "</td></tr>\n";
        echo "<tr><td>Web Browser:</td><td>\n";
        echo "<select name=\"Browser\">\n";
        echo "<option value=\"NotSelected\">SELECT</option>\n";
        echo "<option value=\"Firefox\">Firefox</option>\n";
        echo "<option value=\"Chrome\">Chrome</option>\n";
        echo "<option value=\"IE\">Internet Explorer</option>\n";
        echo "<option value=\"Safari\">Safari</option>\n";
        echo "<option value=\"Opera\">Opera</option>\n";
        echo "</select>\n";
        echo "</td></tr>\n";
        echo "<tr><td>Feedback Type:</td><td>\n";
        echo "<select name=\"FeedbackType\">\n";
        echo "<option value=\"NotSelected\">SELECT</option>\n";
        echo "<option value=\"BugReport\">Bug Report</option>\n";
        echo "<option value=\"FeatureRequest\">Feature Request</option>\n";
        echo "<option value=\"GeneralComment\">General Comments</option>\n";
        echo "</select>\n";
        echo "</td></tr>\n";
        echo "<tr><td>Feedback:</td><td><textarea name=\"feedback\" rows=\"3\" cols=\"50\"></textarea></td></tr>\n";
        echo "<tr><td></td><td><input type=\"submit\" name=\"submit\" value=\"Submit Feedback\"></td></tr>\n";
        echo "</table>\n";
        echo "</form>\n";
    }
}
Ejemplo n.º 18
0
function chgpwd()
{
    global $db;
    $oldP = be('all', 'old_pwds');
    $newP = be('all', 'new_pwd');
    $m_name = getCookie("adminname");
    $row = $db->getRow("select m_id from {pre}manager where m_password='******' and m_name='" . $m_name . "'");
    if (!isN($row['m_id'])) {
        $db->Update("{pre}manager", array('m_password'), array(md5($newP)), "m_name='" . $m_name . "'");
        echo '更新密码成功';
    } else {
        echo '输入的旧密码不对';
    }
}
Ejemplo n.º 19
0
function logoutUser()
{
    header("Content-Type: text/html; charset=utf-8");
    logLogout(getCookie('ID'));
    if (getCookie('ID')) {
        connectDatabase();
        slashArray($_COOKIE);
        // reset session id
        $sessionId = rand_string(32);
        $update = "UPDATE users SET session_id='{$sessionId}' WHERE sha256_user='******'ID') . "'";
        $result = mysql_query($update);
        $sessionId = rand_string(32);
    }
    //this deletes the cookies
    clearCookies();
    header("Location: index.php");
}
Ejemplo n.º 20
0
function displayMainPage()
{
    $query = "SELECT username, admin FROM users WHERE sha256_user = '******'ID') . "'";
    $check = mysql_query($query) or die(mysql_error());
    $info = mysql_fetch_array($check);
    echoMainHeader();
    echo "<div>\n";
    echo "Welcome <b>'" . $info['username'] . "'</b> ";
    if ($info['admin'] == 1) {
        echo " | <a href=\"#\" onClick=\"main_setBodyFrame('body.php')\">Home Page</a>\n";
        echo " | <a href=\"#\" onClick=\"main_setBodyFrame('admin.php')\">Admin Page</a>\n";
    }
    echo "</div>\n";
    echo "<div class=\"class_body\" id=\"div_body\">\n";
    echo "<script language=\"javascript\" type=\"text/javascript\">main_showLoader();</script>\n";
    echo "<iframe class=\"class_iframe_body\" id=\"iframe_body\" src=\"body.php\"></iframe>\n";
    echo "</div>\n";
    echoMainFooter();
}
Ejemplo n.º 21
0
function displayVehicles()
{
    require 'include/configGlobals.php';
    echo "<script type=\"text/javascript\">\n";
    echo "parent.main_disablePopupBackButton();\n";
    echo "</script>\n";
    $query = "SELECT username FROM users WHERE sha256_user = '******'ID') . "'";
    $check = mysql_query($query) or die(mysql_error());
    $info = mysql_fetch_array($check);
    $username = $info['username'];
    // Display vehicles
    $vehcheck = mysql_query("SELECT * FROM vehicles WHERE userOwner = '{$username}'") or die(mysql_error());
    echo "<table class=\"default\" width=\"100%\">\n";
    echo "<th colspan=\"9\">Your Vehicles</th>\n";
    echo "<tr>\n";
    echo "<td>";
    echo "<form action=\"vehicle.php\" method=\"POST\">\n";
    echo "<input type=\"hidden\" name=\"vehID\" value=\"\">\n";
    echo "<input type=\"image\" src=\"images/classy-icons-set/png/32x32/process_add.png\" name=\"addVehicle\" value=\"Add\" alt=\"Add Vehicle\" title=\"Add Vehicle\"> Add\n";
    echo "</form>\n";
    echo "</td>\n";
    echo "<td>Car #</td><td>Year</td><td>Make</td><td>Model</td><td>Color</td><td>Treadware</td>";
    echo "<td>SCCA Class</td><td>" . $club_Abbr . " Class</td>\n";
    echo "</tr>\n";
    while ($vehinfo = mysql_fetch_assoc($vehcheck)) {
        echo "<tr>";
        echo "<td><form action=\"vehicle.php\" method=\"POST\">";
        echo "<input type=\"hidden\" name=\"vehID\" value=\"" . $vehinfo['vehicleID'] . "\">\n";
        echo "<input type=\"image\" src=\"images/classy-icons-set/png/32x32/process_info.png\" name=\"submit\" value=\"Edit\" alt=\"Edit Vehicle\" title=\"Edit Vehicle\"> Edit\n";
        echo "</td></form>";
        echo "<td>" . $vehinfo['number'] . "</td>";
        echo "<td>" . $vehinfo['year'] . "</td>";
        echo "<td>" . $vehinfo['make'] . "</td>";
        echo "<td>" . $vehinfo['model'] . "</td>";
        echo "<td>" . $vehinfo['color'] . "</td>";
        echo "<td>" . $vehinfo['treadware'] . "</td>";
        echo "<td>" . $vehinfo['scca_class'] . "</td>";
        echo "<td>" . $vehinfo['sccnh_class'] . "</td>";
        echo "</tr>";
    }
    echo "</table>\n";
}
Ejemplo n.º 22
0
function setCookieSection($name, $value, $section = '', $expire = null, $path = '', $domain = '', $secure = '')
{
    if ($section) {
        $valSection = getCookie($section);
        $name2 = '@' . $name . ':';
        if ($valSection) {
            if (preg_match('/' . preg_quote($name2) . '/', $valSection)) {
                $valSection = preg_replace('/' . preg_quote($name2) . '[^@;]*/', $name2 + $value, $valSection);
            } else {
                $valSection = $valSection + $name2 + $value;
            }
            setCookieSection($section, $valSection, '', $expire, $path, $domain, $secure);
        } else {
            $valSection = $name2 . $value;
            setCookieSection($section, $valSection, '', $expire, $path, $domain, $secure);
        }
    } else {
        setcookie($name, $value, $expire, $path, $domain, $secure);
    }
}
Ejemplo n.º 23
0
<div class="box">
    <?php 
if (getCookie('error')) {
    echo getCookie('error');
}
?>
    
    <?php 
if ($this->msg) {
    echo $this->msg;
}
if (!$this->success) {
    ?>

    <form action="<?php 
    echo url('page', 'passwordReset', $this->hash);
    ?>
" method="POST">
        <div class="formRow">
            <div class="formRowTitle">
                {L:PASSWORD_RESET_EMAIL}
            </div>
            <div class="formRowField">
                <input type="email" name="email" value="<?php 
    echo post('email') ? post('email') : '';
    ?>
" required="required" />
            </div>
        </div>
        <div class="formRow">
            <div class="formRowTitle">
Ejemplo n.º 24
0
<?php

// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: mobile.php 52907 2014-10-16 16:05:30Z jonnybradley $
//this script may only be included - so its better to die if called directly.
$access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__));
if (!isset($_REQUEST['mobile_mode']) || $_REQUEST['mobile_mode'] === 'y') {
    require_once 'vendor_extra/mobileesp/mdetect.php';
    $uagent_info = new uagent_info();
    $supported_device = $uagent_info->DetectIphoneOrIpod() || $uagent_info->DetectIpad() || $uagent_info->DetectAndroid() || $uagent_info->DetectBlackBerry() || $uagent_info->DetectOperaMobile() || $uagent_info->DetectPalmWebOS();
    if (!getCookie('mobile_mode') && $supported_device || getCookie('mobile_mode') === 'y') {
        // supported by jquery.mobile
        if (!is_array($prefs['mobile_perspectives'])) {
            $prefs['mobile_perspectives'] = unserialize($prefs['mobile_perspectives']);
        }
        if (count($prefs['mobile_perspectives']) > 0) {
            $persp = $prefs['mobile_perspectives'][0];
            if (Perms::get(array('type' => 'perspective', 'object' => $persp))->perspective_view) {
                $prefs['mobile_mode'] = 'y';
                // hard-wire a few incompatible prefs shut to speed development
                $prefs['feature_jquery_ui'] = 'n';
                $prefs['feature_jquery_reflection'] = 'n';
                $prefs['feature_fullscreen'] = 'n';
                $prefs['feature_syntax_highlighter'] = 'n';
                $prefs['feature_layoutshadows'] = 'n';
                $prefs['feature_wysiwyg'] = 'n';
                $prefs['themegenerator_feature'] = 'n';
                $prefs['ajax_autosave'] = 'n';
function main()
{
    global $db, $template, $cache;
    $loginname = getCookie("adminname");
    $keyword = be("all", "keyword");
    $stype = be("all", "stype");
    $area = be("all", "area");
    $topic = be("all", "topic");
    $level = be("all", "level");
    $from = be("all", "from");
    $sserver = be("all", "sserver");
    $sstate = be("all", "sstate");
    $repeat = be("all", "repeat");
    $repeatlen = be("all", "repeatlen");
    $order = be("all", "order");
    $pagenum = be("all", "page");
    $sort = be("all", "sort");
    $spic = be("all", "spic");
    $hide = be("all", "hide");
    $d_status = be("all", "d_status");
    $douban_score = be("all", "douban_score");
    $ipadpic = be("all", "ipadpic");
    $d_douban_id = be("all", "d_douban_id");
    $can_search_device = be("all", "can_search_device");
    if (!isNum($level)) {
        $level = 0;
    } else {
        $level = intval($level);
    }
    if (!isNum($sstate)) {
        $sstate = 0;
    } else {
        $sstate = intval($sstate);
    }
    if (!isNum($stype)) {
        $stype = 0;
    } else {
        $stype = intval($stype);
    }
    if (!isNum($area)) {
        $area = 0;
    } else {
        $area = intval($area);
    }
    if (!isNum($topic)) {
        $topic = 0;
    } else {
        $topic = intval($topic);
    }
    if (!isNum($spic)) {
        $spic = 0;
    } else {
        $spic = intval($spic);
    }
    if (!isNum($ipadpic)) {
        $ipadpic = 0;
    } else {
        $ipadpic = intval($ipadpic);
    }
    if (!isNum($hide)) {
        $hide = -1;
    } else {
        $hide = intval($hide);
    }
    if (!isNum($douban_score)) {
        $douban_score = 0;
    } else {
        $douban_score = intval($douban_score);
    }
    if (!isNum($repeatlen)) {
        $repeatlen = 0;
    }
    if (!isNum($d_status)) {
        $d_status = -1;
    } else {
        $d_status = intval($d_status);
    }
    if (isNum($d_douban_id)) {
        $d_douban_id = intval($d_douban_id);
    }
    if (!isNum($pagenum)) {
        $pagenum = 1;
    } else {
        $pagenum = intval($pagenum);
    }
    if ($pagenum < 1) {
        $pagenum = 1;
    }
    $where = " d_type in (1,2,3,131) ";
    $keyword_col = be("all", "keyword_col");
    if (!isN($keyword)) {
        $keyword = trim($keyword);
        if (isN($keyword_col)) {
            $where .= " AND ( d_directed like '%" . $keyword . "%' or d_starring like '%" . $keyword . "%' or d_name like '%" . $keyword . "%' or d_enname like '%" . $keyword . "%'   ) ";
        } else {
            $where .= " AND " . $keyword_col . " like '%" . $keyword . "%' ";
        }
    }
    if ($stype > 0) {
        $typearr = getValueByArray($cache[0], "t_id", $stype);
        if (is_array($typearr)) {
            $where = $where . " and d_type in (" . $typearr["childids"] . ")";
        } else {
            $where .= " AND d_type=" . $stype . " ";
        }
    }
    if ($stype == -1) {
        $where .= " AND d_type=0 ";
    }
    if ($area > 0) {
        $where .= " AND d_area = " . $area . " ";
    }
    if ($topic > 0) {
        $where .= " AND d_topic = " . $topic . " ";
    }
    if ($level > 0) {
        $where .= " AND d_level = " . $level . " ";
    }
    if ($sstate == 1) {
        $where .= " AND d_state>0 ";
    } else {
        if ($sstate == 2) {
            $where .= " AND d_state=0 ";
        }
    }
    if ($hide != -1) {
        $where .= " AND d_hide=" . $hide . " ";
    }
    if ($d_douban_id == -1) {
        $where .= " AND d_douban_id=" . $d_douban_id . " ";
    } else {
        if ($d_douban_id == 1) {
            $where .= " AND d_douban_id >0 ";
        } else {
            if ($d_douban_id == 2) {
                $where .= " AND d_douban_id =0 ";
            }
        }
    }
    if ($d_status != -1) {
        $where .= " AND d_status=" . $d_status . " ";
    }
    if ($douban_score == 1) {
        $where .= " AND d_score >0 ";
    }
    if ($douban_score == 2) {
        $where .= " AND d_score <=0 ";
    }
    if ($stype == 1 || $stype == 2) {
        $douban_scoreT = "block";
    } else {
        $douban_scoreT = "none";
    }
    if (!isN($can_search_device)) {
        //    	if($can_search_device ==='TV'){
        //    		$where .= " AND can_search_device like '%TV%' ";
        //    	}else {
        //    		$where .= " AND (can_search_device like '".$can_search_device."' or can_search_device is null or can_search_device ='' ) ";
        //    	}
        $where .= " AND (can_search_device like '" . $can_search_device . "' or can_search_device is null or can_search_device ='' ) ";
    }
    if ($repeat == "ok") {
        $repeatSearch = " d_name ";
        if ($repeatlen > 0) {
            $repeatSearch = " substring(d_name,1," . $repeatlen . ") ";
        }
        $repeatsql = " , (SELECT " . $repeatSearch . " as d_name1 FROM {pre}vod GROUP BY d_name1 HAVING COUNT(*)>1) as `t2` ";
        $where .= " AND `{pre}vod`.`d_name`=`t2`.`d_name1` ";
        if (isN($order)) {
            $order = "d_name,d_addtime";
        }
    }
    $douban_comment = be("all", "douban_comment");
    if (!isNum($douban_comment)) {
        $douban_comment = 0;
    } else {
        $douban_comment = intval($douban_comment);
    }
    if ($douban_comment == 1) {
        $where .= " and d_id in (SELECT DISTINCT content_id FROM tbl_comments WHERE author_id IS NULL AND thread_id IS NULL) ";
    }
    if ($douban_comment == 2) {
        $where .= " and d_id not in (SELECT DISTINCT content_id FROM tbl_comments WHERE author_id IS NULL AND thread_id IS NULL) ";
    }
    if (isN($order)) {
        $orders = "d_time desc ";
    } else {
        if (!isN($sort)) {
            $orders = $order . ' ' . $sort;
        }
    }
    if (!isN($sserver)) {
        $where .= " AND d_playserver like '%" . $sserver . "%' ";
    }
    if (!isN($from)) {
        $where .= " and d_playfrom like  '%" . $from . "%' ";
    }
    if ($spic == 1) {
        $where .= " AND d_pic = '' ";
    } else {
        if ($spic == 2) {
            $where .= " and  d_pic not like '%joyplus%' and d_pic!=''  ";
        }
    }
    if ($ipadpic == 1) {
        $where .= " AND (d_pic_ipad = ''  or d_pic_ipad is null )";
    } else {
        if ($ipadpic == 2) {
            $where .= " AND d_pic_ipad not like '%joyplus%' and d_pic_ipad != '' ";
        }
    }
    $select_weburl = be("all", "select_weburl");
    $select_videourl = be("all", "select_videourl");
    $select_videourl_play = be("all", "select_videourl_play");
    if (!isNum($select_videourl_play)) {
        $select_videourl_play = -1;
    } else {
        $select_videourl_play = intval($select_videourl_play);
    }
    if ($select_videourl_play == 0) {
        $where .= " AND d_play_check = 0 ";
    }
    if ($select_videourl_play == 2) {
        $where .= " AND d_play_check = 2 ";
    }
    if ($select_videourl_play == 1) {
        $where .= " AND d_play_check = 1 ";
    }
    if ($select_weburl == 1) {
        $where .= " AND webUrls is not null and webUrls !='' ";
    }
    if ($select_weburl == 2) {
        $where .= " AND (webUrls is null or  webUrls ='') ";
    }
    if ($select_videourl == 1) {
        $where .= " AND d_downurl is not null and d_downurl !='' ";
    }
    if ($select_videourl == 2) {
        $where .= " AND (d_downurl is null or d_downurl ='') ";
    }
    $sql = "SELECT count(*) FROM {pre}vod " . $repeatsql . " where " . $where;
    $nums = $db->getOne($sql);
    $pagecount = ceil($nums / app_pagenum);
    //$sql = "SELECT d_year,d_id, d_name, d_enname, d_play_num,d_type,d_state,d_topic, d_level, d_hits, d_time,d_remarks,d_playfrom,d_hide,p.id as popular_id FROM {pre}vod ".$repeatsql." left join {pre}vod_popular as p on p.vod_id=d_id  WHERE" . $where . " ORDER BY " . $orders . "  limit ".(app_pagenum * ($pagenum-1)) .",".app_pagenum;
    $sql = "SELECT d_year,d_id, d_name, d_enname, d_play_num,d_type,d_state,d_topic, d_level, d_hits, d_time,d_remarks,d_playfrom,d_hide FROM {pre}vod " . $repeatsql . "  WHERE" . $where . " ORDER BY " . $orders . "  limit " . app_pagenum * ($pagenum - 1) . "," . app_pagenum;
    // var_dump($sql);
    $rs = $db->query($sql);
    ?>


<script type="text/javascript" src="./resource/thickbox-compressed.js"></script>
<script type="text/javascript" src="./resource/thickbox.js"></script>
<link href="./resource/thickbox.css" rel="stylesheet" type="text/css" />
<script language="javascript">
$(document).ready(function(){
	$("#form1").validate({
		rules:{
			repeatlen:{
				number:true,
				max:10
			}
		}
	});
	
	$("#btnrepeat").click(function(){
		var repeatlen = $("#repeatlen").val();
		var reg = /^\d+$/;
		var re = repeatlen.match(reg);
		if (!re){ repeatlen=0; }
		if (repeatlen >20){ alert("长度最大20");$("#repeatlen").focus();return;}
		var url = "admin_vod.php?repeat=ok&repeatlen=" + repeatlen;
		window.location.href=url;
	});
	$("#btnDel").click(function(){
			if(confirm('确定要删除吗')){
				$("#form1").attr("action","admin_vod.php?action=del");
				$("#form1").submit();
			}
			else{return false}
	});
	$("#plsc").click(function(){
		var ids="",rc=false;
		$("input[name='d_id']").each(function() {
			if(this.checked){
				if(rc)ids+=",";
				ids =  ids + this.value;
				rc=true;
			}
        });
		$("#form1").attr("action","admin_makehtml.php?acton=viewpl&flag=vod&d_id="+ids);
		$("#form1").submit();
	});
});
function filter(){
	var stype=$("#stype").val();
	var order=$("#order").val();
	var from=$("#from").val();
	var sort=$("#sort").val();
	var keyword=$("#keyword").val();
	var keyword_col=$("#keyword_col").val();
	var can_search_device=$("#can_search_device").val();
	var url = "admin_online_subscribe.php?can_search_device="+can_search_device+"&keyword_col="+keyword_col+"&sort="+sort+"&keyword="+encodeURI(keyword)+"&stype="+stype+"&order="+order+"&from="+from; //ipadpic
	window.location.href=url;
}


function prepareWeiboText(type,id,name){
	   document.getElementById( "weiboText").value= name; 
	   document.getElementById( "notify_msg_prod_id").value= id; 
	   document.getElementById( "notify_msg_prod_type").value= type; 
	   $('#SendWeiboMsg').empty();
}


function sendWeiboText(){

	
	var weibotxt= document.getElementById( "weiboText").value;
	var notify_msg_prod_id= document.getElementById( "notify_msg_prod_id").value;
	var notify_msg_prod_type= document.getElementById( "notify_msg_prod_type").value;
	var urlT='admin_vod.php?action=notifyMsg&prod_type='+notify_msg_prod_type+'&prod_id='+notify_msg_prod_id+'&content=' +encodeURIComponent(weibotxt) ;
	var channels= document.getElementById( "channel[]");
	alert(channels);
	for(var i = 0; i < channels.length; i++){
		 if (channels[i].checked == true) {
			  urlT = urlT +'&channels='+channels[i].value;				 		 
		  }
	}
		 $.post(urlT, {Action:"post"}, function (data, textStatus){     
			  if(textStatus == "success"){   
	          //alert(data);
				  $('#SendWeiboMsg').empty().append(data);
	           }else{
	        	   $('#SendWeiboMsg').empty().append('发送失败。');
	           }
	       });
	
    // alert(urlT);
	 
}

</script>
<table class="admin_online_subscribe tb">
	<tr>
	<td>
	<table width="96%" border="0" align="center" cellpadding="3" cellspacing="1">
	<tr>
	<td colspan="2">
	过滤条件:<select id="stype" name="stype" onchange="javascript:{var typeid= this.options[this.selectedIndex].value; if(typeid=='1' ||  typeid=='2'){document.getElementById('btnsearchs').style.display='block';  document.getElementById('btnsearchsThumbs').style.display='block';document.getElementById('btnsearchsComment').style.display='block';}else {document.getElementById('btnsearchs').style.display='none'; document.getElementById('btnsearchsThumbs').style.display='none';document.getElementById('btnsearchsComment').style.display='none';}}">
	<option value="0">视频栏目</option>
	<option value="-1" <?php 
    if ($stype == -1) {
        echo "selected";
    }
    ?>
>没有栏目</option>
	<?php 
    echo makeSelectAll("{pre}vod_type", "t_id", "t_name", "t_pid", "t_sort", 0, "", "&nbsp;|&nbsp;&nbsp;", $stype);
    ?>
	</select>
	&nbsp;
	
	<select id="order" name="order">
	<option value="d_time">视频排序</option>
	<option value="d_id" <?php 
    if ($order == "d_id") {
        echo "selected";
    }
    ?>
>视频编号</option>
	<option value="d_name" <?php 
    if ($order == "d_name") {
        echo "selected";
    }
    ?>
>视频名称</option>
	<option value="d_play_num" <?php 
    if ($order == "d_play_num") {
        echo "selected";
    }
    ?>
>播放次数</option>
	<option value="d_year" <?php 
    if ($order == "d_year") {
        echo "selected";
    }
    ?>
>上映日期</option>
	</select>
	&nbsp;<select id="sort" name="sort">
	<option value="desc" <?php 
    if ($sort == "desc") {
        echo "selected";
    }
    ?>
>视频排序 降序序</option>
	<option value="asc" <?php 
    if ($sort == "asc") {
        echo "selected";
    }
    ?>
>视频排序  升序</option>
	</select>
	
	
	&nbsp;
	<select id="from" name="from">
	<option value="">视频播放器</option>
	<?php 
    echo makeSelectPlayer($from);
    ?>
	</select>
	
	 <select   id="can_search_device" name="can_search_device">
	    <option value="" >投放设备</option>
		<option value="TV" <?php 
    if ($can_search_device === 'TV') {
        echo "selected";
    }
    ?>
>TV版</option>
		<option value="iPad" <?php 
    if ($can_search_device === 'iPad') {
        echo "selected";
    }
    ?>
>iPad版</option>
		<option value="iphone" <?php 
    if ($can_search_device === 'iphone') {
        echo "selected";
    }
    ?>
>iphone版</option>
		<option value="apad" <?php 
    if ($can_search_device === 'apad') {
        echo "selected";
    }
    ?>
>Android-Pad版</option>
		<option value="aphone" <?php 
    if ($can_search_device === 'aphone') {
        echo "selected";
    }
    ?>
>Android-Phone版</option>
		<option value="web" <?php 
    if ($can_search_device === 'web') {
        echo "selected";
    }
    ?>
>网站版</option>
	</select> 
	
	</td>
	</tr>
	<tr>
	<td colspan="4">
	关键字:<input id="keyword" size="40" name="keyword" value="<?php 
    echo $keyword;
    ?>
">&nbsp;
	<select id="keyword_col" name="keyword_col">
	<option value="">关键字的匹配列</option>
	<option value="d_name" <?php 
    if ($keyword_col == "d_name") {
        echo "selected";
    }
    ?>
>视频名称</option>
	<option value="d_starring" <?php 
    if ($keyword_col == "d_starring") {
        echo "selected";
    }
    ?>
>演员</option>
	<option value="d_directed" <?php 
    if ($keyword_col == "d_directed") {
        echo "selected";
    }
    ?>
>导演</option>
	</select>
	<input class="input" type="button" value="搜索" id="btnsearch" onClick="filter();">
	
	</td>
	
	</tr>
	</table>
	</td>
	</tr>
</table>

<form id="form1" name="form1" method="post">
<table class="tb">
	<tr>
	<td width="10%">编号</td>
	<td width="25%">名称</td>
	<td width="10%">播放次数</td>
	<td width="10%">上映日期</td>
	<td width="5%">分类</td>
	<td width="20%">时间</td>
	<td width="20%">操作</td>
	</tr>
	<?php 
    if ($nums == 0) {
        ?>
	<tr><td align="center" colspan="12">没有任何记录!</td></tr>
	<?php 
    } else {
        while ($row = $db->fetch_array($rs)) {
            $d_id = $row["d_id"];
            $tname = "未知";
            $tenname = "";
            $typearr = getValueByArray($cache[0], "t_id", $row["d_type"]);
            if (is_array($typearr)) {
                $tname = $typearr["t_name"];
                $tenname = $typearr["t_enname"];
            }
            ?>
    <tr>
	<td><?php 
            echo $d_id;
            ?>
</td>
	<td><?php 
            echo substring($row["d_name"], 20);
            ?>
	<?php 
            if ($row["d_state"] > 0) {
                echo "<font color=\"red\">[" . $row["d_state"] . "]</font>";
            }
            ?>
	<?php 
            if (!isN($row["d_remarks"])) {
                echo "<font color=\"red\">[" . $row["d_remarks"] . "]</font>";
            }
            ?>
	<?php 
            if ($row["d_hide"] == 1) {
                echo "<font color=\"red\">[隐藏]</font>";
            }
            ?>
	</td>
	<td><?php 
            echo $row["d_play_num"];
            ?>
</td>
	<td><?php 
            echo $row["d_year"];
            ?>
</td>
	<td><?php 
            echo $tname;
            ?>
</td>
	<td><?php 
            echo isToday($row["d_time"]);
            ?>
</td>
	<td><a href="admin_vod_topic.php?action=info&id=<?php 
            echo $d_id;
            ?>
">所在榜单</a> |
	<a class="thickbox" href="#TB_inline?height=400&width=600&inlineId=myOnPageContent" onclick="javascript:{prepareWeiboText('<?php 
            echo $row["d_type"];
            ?>
','<?php 
            echo $d_id;
            ?>
','<?php 
            echo substring($row["d_name"], 20);
            ?>
');}" > 消息推送</a>	 </td>
    </tr>
	<?php 
        }
    }
    ?>
<!--	<tr>-->
<!--	<td colspan="12">-->
<!--	全选<input name="chkall" type="checkbox" id="chkall" value="1" onClick="checkAll(this.checked,'d_id[]');"/>&nbsp;-->
<!--    批量操作:<input type="button" id="btnDel" value="删除" class="input">-->
<!--	<input type="button" id="pltj" value="推荐" onClick="plset('pltj','vod')" class="input">-->
<!--	<input type="button" id="plfl" value="分类" onClick="plset('plfl','vod')" class="input">-->
<!--	<input type="button" id="plzt" value="专题" onClick="plset('plzt','vod')" class="input">-->
<!--	<input type="button" id="plluobo" value="轮播图" onClick="plsetLuobo()" class="input">-->
<!--	<input type="button" id="plbd" value="视频悦单" onClick="plsetBD('plbd','vod','1')" class="input">-->
<!--	<input type="button" id="plbd" value="视频悦榜" onClick="plsetBD('plbd','vod','2')" class="input">-->
<!--	<input type="button" id="plrq" value="人气" onClick="plset('plrq','vod')" class="input">-->
<!--	<input type="button" id="plsc" value="生成" class="input">-->
<!--	<input type="button" id="plyc" value="显隐" onClick="plset('plyc','vod')" class="input">-->
<!--	<span id="plmsg" name="plmsg"></span>-->
<!--	</td>-->
<!--	</tr>-->
	<tr class="formlast">
	<td align="center" colspan="12">
	<?php 
    echo pagelist_manage($pagecount, $pagenum, $nums, app_pagenum, "admin_online_subscribe.php?page={p}&can_search_device=" . $can_search_device . "&keyword=" . urlencode($keyword) . "&keyword_col=" . $keyword_col . "&sort=" . $sort . "&order=" . $order . "&stype=" . $stype . "&from=" . $from);
    ?>
	</td>
	</tr>
</table>

</form>
<div id="myOnPageContent" style="display:none">
<script language="javascript">

$('#form2').form({
	success:function(data){
		$('#SendWeiboMsg').empty().append(data);
		$("#btnEdit").attr("disabled",false); 		
    }
});

$("#btnEdit").click(function(){
	if(confirm('确定要推送消息吗')){
		$("#form2").attr("action","?action=notifyMsg");
		var weibotxt= $("#weiboText").val();
		$("#btnEdit").attr("disabled",true); 
		if(weibotxt ==''){
          alert("发送内容不能为空。");
          $("#btnEdit").attr("disabled",false); 
          return;
		}

		if(weibotxt.length>=110){
	          alert("你发送的内容太长,不能超过110个字符。");
	          $("#btnEdit").attr("disabled",false); 
	          return;
		}
		var prod_id= $("#notify_msg_prod_id").val();
		
		var prod_type= $("#notify_msg_prod_type").val();
		 $('#SendWeiboMsg').empty().append('正在推送消息.....<br/>');
		var urlT='admin_online_subscribe.php?action=notifyMsg&notify_msg_prod_type='+prod_type+'&notify_msg_prod_id='+prod_id+'&content=' +encodeURIComponent(weibotxt) ;
		var channels=document.getElementsByName("channel[]");
		var channelFlag=true;
		var index=0;
		var indexSelect=0;
		for(var i = 0; i < channels.length; i++){
			 if (channels[i].checked == true) {
				  channelFlag=false;
				  indexSelect++;
				  urlTs = urlT +'&channel='+channels[i].value;	
				 // alert(channels[i].value);	
				  $.post(urlTs, {Action:"post"}, function (data, textStatus){     
					  if(textStatus == "success"){ 
						  index++;  
			          //alert(data);
						  $('#SendWeiboMsg').append(data).append('<br/>');
			           }else{
			        	   index++;  
			        	   $('#SendWeiboMsg').append('发送失败。').append('<br/>');
			           }
					  if( index==indexSelect){			  
						     $("#btnEdit").attr("disabled",false); 
						     $('#SendWeiboMsg').append('推送消息完成。').append('<br/>');
				      }
			       });	 		 
			  }
		}
		if(channelFlag){
			alert('你必须要选择一个频道发送');
	    }
	   
	    
		//$("#form2").submit();
		
	}
});
</script>
<form id="form2"  name="form1" method="post">
<table class="table" cellpadding="0" cellspacing="0" width="100%" border="0">

                <thead class="tb-tit-bg">
<!--                   <tr>-->
<!--                        <td > <h3 class="title">    发送设备:<select name="device_type" id="device_type" >                       -->
<!--                             <option value="" >所有设备</option>-->
<!--                             <option value="ios" >IOS</option>-->
<!--                             <option value="android" >Android</option>                          -->
<!--                        </select> -->
<!--                        </h3></td>    -->
<!--                      -->
<!--                    </tr>-->
                    <tr>
                        <td colspan="2"><span><h3>发送信息</h3></span></td>    
                       
                    </tr>
                    <input type="hidden" name="notify_msg_prod_id" id="notify_msg_prod_id" value="">
                    <input type="hidden" name="notify_msg_prod_type" id="notify_msg_prod_type" value="">
                      
                      <tr>
                        <td colspan="2" align="center"><textarea name="wbText" id="weiboText" rows="10" cols="90"></textarea></td>
                    </tr>
                     <tr>
                        <td align="left"> <br/>
                            Parse 云推送<br/>
	                        &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_ANDROID"   />悦视频 Android版<br/>
<!--						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_TV"  />悦视频 TV版<br/>-->
						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_IOS"  />悦视频 IOS版<br/>
						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_IPHONE"  />今晚剧场iphone版<br/>
						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_IPAD"  />今晚剧场IPAD版<br/>
                        </td>
                         <td align="left"> <br/>
                                                                         百度云推送<br/>
	                        &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_ANDROID_BAIDU"   />悦视频 Android版<br/>
<!--						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_TV_BAIDU"  />悦视频 TV版<br/>-->
						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_IOS_BAIDU"  />悦视频 IOS版<br/>
						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_IPHONE_BAIDU"  />今晚剧场iphone版<br/>
						    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id='channel[]' name="channel[]" value="CHANNEL_IPAD_BAIDU"  />今晚剧场IPAD版<br/>
                        </td>
                    </tr>
                      <tr>
                         <td align="center" colspan="2"><input type="button" value="发送消息" id="btnEdit"  class="input"  /></td>
                      </tr>
                        <tr>
                        <td align="left" colspan="2">  <font color=red><span id="SendWeiboMsg"></span></font></td>    
                       
                    </tr> 
                    
                </thead>
            </table>
</form>
</div>
<?php 
    if ($pagenum == 1 && $where == " 1=1 ") {
        echo "<script>showpic();</script>";
    }
    unset($rs);
}
Ejemplo n.º 26
0
    function action_preview($input)
    {
        Services_Exception_Disabled::check('feature_warn_on_edit');
        global $user, $prefs, $page;
        $tikilib = TikiLib::lib('tiki');
        $autoSaveIdParts = explode(':', $input->autoSaveId->text());
        // user, section, object id
        foreach ($autoSaveIdParts as &$part) {
            $part = urldecode($part);
        }
        $page = $autoSaveIdParts[2];
        // plugins use global $page for approval
        if (!Perms::get('wiki page', $page)->edit || $user != $tikilib->get_semaphore_user($page)) {
            return '';
        }
        $info = $tikilib->get_page_info($page, false);
        if (empty($info)) {
            $info = array('data' => '');
        }
        $info['is_html'] = $input->allowHtml->int();
        if (!isset($info['wysiwyg']) && isset($_SESSION['wysiwyg'])) {
            $info['wysiwyg'] = $_SESSION['wysiwyg'];
        }
        $options = array('is_html' => $info['is_html'], 'preview_mode' => true, 'process_wiki_paragraphs' => $prefs['wysiwyg_htmltowiki'] === 'y' || $info['wysiwyg'] == 'n', 'page' => $page);
        if (count($autoSaveIdParts) === 3 && !empty($user) && $user === $autoSaveIdParts[0] && $autoSaveIdParts[1] === 'wiki_page') {
            $editlib = TikiLib::lib('edit');
            $smarty = TikiLib::lib('smarty');
            $wikilib = TikiLib::lib('wiki');
            $smarty->assign('inPage', $input->inPage->int() ? true : false);
            if ($input->inPage->int()) {
                $diffstyle = $input->diff_style->text();
                if (!$diffstyle) {
                    // use previously set diff_style
                    $diffstyle = getCookie('preview_diff_style', 'preview', '');
                }
                $data = $editlib->partialParseWysiwygToWiki(TikiLib::lib('autosave')->get_autosave($input->editor_id->text(), $input->autoSaveId->text()));
                TikiLib::lib('smarty')->assign('diff_style', $diffstyle);
                if ($diffstyle) {
                    if (!empty($info['created'])) {
                        $info = $tikilib->get_page_info($page);
                        // get page with data this time
                    }
                    if ($input->hdr->int()) {
                        // TODO refactor with code in editpage
                        if ($input->hdr->int() === 0) {
                            list($real_start, $real_len) = $tikilib->get_wiki_section($info['data'], 1);
                            $real_len = $real_start;
                            $real_start = 0;
                        } else {
                            list($real_start, $real_len) = $tikilib->get_wiki_section($info['data'], $input->hdr->int());
                        }
                        $info['data'] = substr($info['data'], $real_start, $real_len);
                    }
                    require_once 'lib/diff/difflib.php';
                    if ($info['is_html'] == 1) {
                        $diffold = $tikilib->htmldecode($info['data']);
                    } else {
                        $diffold = $info['data'];
                    }
                    if ($info['is_html']) {
                        $diffnew = $tikilib->htmldecode($data);
                    } else {
                        $diffnew = $data;
                    }
                    if ($diffstyle === 'htmldiff') {
                        $diffnew = $tikilib->parse_data($diffnew, $options);
                        $diffold = $tikilib->parse_data($diffold, $options);
                    }
                    $data = diff2($diffold, $diffnew, $diffstyle);
                    $smarty->assign_by_ref('diffdata', $data);
                    $smarty->assign('translation_mode', 'y');
                    $data = $smarty->fetch('pagehistory.tpl');
                } else {
                    $data = $tikilib->parse_data($data, $options);
                }
                $parsed = $data;
            } else {
                // popup window
                TikiLib::lib('header')->add_js('
function get_new_preview() {
	$("body").css("opacity", 0.6);
	location.reload(true);
}
$(window).on("load", function(){
	if (typeof opener != "undefined") {
		opener.ajaxPreviewWindow = this;
	}
}).on("unload", function(){
	if (typeof opener.ajaxPreviewWindow != "undefined") {
		opener.ajaxPreviewWindow = null;
	}
});
');
                $smarty->assign('headtitle', tra('Preview'));
                $data = '<div id="c1c2"><div id="wrapper"><div id="col1"><div id="tiki-center" class="wikitext">';
                if (TikiLib::lib('autosave')->has_autosave($input->editor_id->text(), $input->autoSaveId->text())) {
                    $parserlib = TikiLib::lib('parser');
                    $data .= $parserlib->parse_data($editlib->partialParseWysiwygToWiki(TikiLib::lib('autosave')->get_autosave($input->editor_id->text(), $input->autoSaveId->text())), $options);
                } else {
                    if ($autoSaveIdParts[1] == 'wiki_page') {
                        $canBeRefreshed = false;
                        $data .= $wikilib->get_parse($autoSaveIdParts[2], $canBeRefreshed);
                    }
                }
                $data .= '</div></div></div></div>';
                $smarty->assign_by_ref('mid_data', $data);
                $smarty->assign('mid', '');
                $parsed = $smarty->fetch("tiki_full.tpl");
                $_SERVER['HTTP_X_REQUESTED_WITH'] = 'xmlhttprequest';
                // to fool Services_Broker into putputting full page
            }
            if ($prefs['feature_wiki_footnotes']) {
                $footnote = $input->footnote->text();
                if ($footnote) {
                    $footnote = $tikilib->parse_data($footnote);
                } else {
                    $footnote = $wikilib->get_footnote($user, $page);
                }
            }
            return array('parsed' => $parsed, 'parsed_footnote' => $footnote);
        }
    }
Ejemplo n.º 27
0
require_once "functions.php";
require_once "dio.php";
if (KEEP_SESSION) {
    //利用非阻塞的flock实现单例运行
    $pid = fopen(DATA_PATH . '/check.pid', "w");
    if (!$pid) {
        exit;
    }
    if (flock($pid, LOCK_EX | LOCK_NB)) {
        $files = glob(DATA_PATH . '/*.php');
        foreach ($files as $file) {
            $filename = basename($file, ".php");
            $info = load_xss_record($filename);
            if ($info['keepsession'] === true) {
                $url = getLocation($info);
                $cookie = getCookie($info);
                $useragent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2535.0 Safari/537.36";
                if (isset($info['headers_data']['User-Agent'])) {
                    $useragent = $info['headers_data']['User-Agent'];
                }
                $ip = $info['user_IP'];
                if ($url != "" && $cookie != "") {
                    $ch = curl_init();
                    $header[] = 'User-Agent: ' . $useragent;
                    $header[] = 'Cookie: ' . $cookie;
                    $header[] = 'X-Forwarded-For: ' . $ip;
                    curl_setopt($ch, CURLOPT_URL, $url);
                    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                    //https不校验证书,按需开启吧
Ejemplo n.º 28
0
function editVehiclePOST()
{
    $hashUsername = getCookie('ID');
    $check = mysql_query("SELECT * FROM users WHERE sha256_user = '******'") or die(mysql_error());
    while ($info = mysql_fetch_array($check)) {
        $username = $info['username'];
        $postYear = $_POST['year'];
        $postMake = $_POST['make'];
        $postModel = $_POST['model'];
        $postColor = $_POST['color'];
        $postTreadware = $_POST['treadware'];
        $postNumber = $_POST['number'];
        $postSccaClass = $_POST['sccaClass'];
        $postSccnhClass = $_POST['sccnhClass'];
        $postNehaClass = $_POST['nehaClass'];
        $postHillclimbClass = $_POST['hillclimbClass'];
        $vehicleID = $_POST['vehicleID'];
        echo "<script type=\"text/javascript\">\n";
        echo "parent.main_enablePopupBackButtonHistory();\n";
        echo "</script>\n";
        if (!is_numeric($postNumber)) {
            die("Vehicle number entered is not a number. Please go back and try again.</body></html>");
        }
        if (!isNumberAvailable($username, $postNumber)) {
            die("Vehicle number entered is already taken. Please go back and try again.</body></html>");
        }
        if ($postTreadware != "Unknown" && !is_numeric($postTreadware)) {
            die("Vehicle treadwear entered is not a number. Please go back and try again.</body></html>");
        }
        if (!is_numeric($postYear)) {
            die("Vehicle year entered is not valid. Please go back and try again.</body></html>");
        }
        // now we insert it into the database
        $update = "UPDATE vehicles SET number='{$postNumber}', year='{$postYear}', make='{$postMake}', model='{$postModel}', color='{$postColor}', treadware='{$postTreadware}', scca_class='{$postSccaClass}', sccnh_class='{$postSccnhClass}', neha_class='{$postNehaClass}', hillclimb_class='{$postHillclimbClass}' WHERE vehicleID='{$vehicleID}'";
        if (!mysql_query($update)) {
            die(mysql_error());
        }
    }
    exitVehicleScript();
}
Ejemplo n.º 29
0
function main()
{
    $menustr = file_get_contents("../inc/dim_menu.txt");
    $menustr = replaceStr($menustr, chr(10), "");
    if (!is_null($menustr) && strlen($menustr) > 0) {
        $menuarr = explode(chr(13), $menustr);
        $rc = false;
    } else {
        $menuarr = array();
    }
    $menudiy = "\"welcome\":{\"text\":\"欢迎页面\",\"url\":\"index.php?action=wel\"}";
    if (count($menuarr) > 0) {
        $menudiy = $menudiy . ",";
    }
    for ($i = 0; $i < count($menuarr); $i++) {
        $name = "";
        $icon = "line";
        $url = "#";
        if ($rc) {
            $menudiy = $menudiy . ",";
        }
        if ($menuarr[$i] != "") {
            $valarr = explode(",", $menuarr[$i]);
            if (count($valarr) == 2) {
                $icon = "icon-100" . $i;
                $name = $valarr[0];
                $url = $valarr[1];
            }
        }
        $menudiy = $menudiy . "\"diym" . $i . "\":{\"text\":\"" . $name . "\",\"url\":\"" . $url . "\"}";
        $rc = true;
    }
    //	echo($menudiy);
    $menudiy = $menudiy . ",\"diym_1\":{\"text\":\"<font>修改密码</font>\",\"url\":\"admin_forgot_pwd.php\"}";
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>管理中心</title>
<link rel="stylesheet" type="text/css" href="../images/adm/style.css" />
<link rel="stylesheet" type="text/css" href="../images/adm/form.css" />
<script language="javascript" src="../js/jquery.js"></script>
<script language="javascript" src="../js/jquery.pngFix.js"></script>
</head>
<body>
	<script type="text/javascript">
	function updateindex(){
		$("#cachestate").text("Loading....");
		$.get("admin_cache.php?action=uptoindex&rnd"+Math.random(),function(obj){
			if(obj !="" && obj !=undefined){
				$("#cachestate").text("静态首页删除失败!");
			}
			else{
				$("#cachestate").text("静态首页删除完毕!");
			}
		});
	}
	
var menu = {
	"m1":{"text":"首页快捷","default":"welcome","children":{<?php 
    echo $menudiy;
    ?>
 }},
	
	"m2":{"text":"系统管理","default":"player_config","children":{"sql":{"text":"执行SQL语句","url":"admin_sql.php"},"player_config":{"text":"播放器管理","url":"admin_player.php"},"leftdim_config":{"text":"快捷菜单配置","url":"admin_leftdim.php"},"weixin_keyword":{"text":"微信配置","url":"http://weixin.joyplus.tv/admin_keyword.php"}}},
	
	
	"m4":{"text":"视频管理","default":"vod","children":{"vodtype":{"text":"视频分类","url":"admin_vod_type.php"},"arealang":{"text":"地区语言","url":"admin_vod_arealang.php"},"vodtopic":{"text":"视频榜单","url":"admin_vod_topic.php"},"vodpopular":{"text":"视频轮播图","url":"admin_vod_popular.php"},"vod":{"text":"视频数据","url":"admin_vod.php"},"vodadd":{"text":"添加视频","url":"admin_vod.php?action=add"},"vod_feedback":{"text":"用户视频反馈","url":"admin_vod_feedback.php"}}},
	

	
	"m6":{"text":"用户管理","default":"manager","children":{"manager":{"text":"用户管理","url":"admin_manager.php"},"usergroup":{"text":"会员组","url":"admin_user_group.php"},"user":{"text":"会员","url":"admin_user.php"}}},
	
	
	"m8":{"text":"采集管理","default":"vodcj","children":{"vodcj":{"text":"视频自定义采集","url":"collect/collect_vod_manage.php"},"artcjdatazhuiju":{"text":"追剧管理","url":"collect/collect_vod_zhuiju.php"},"vodcjdata":{"text":"入库管理","url":"collect/collect_vod.php?action=main"}}},

	 "m9":{"text":"消息推送","default":"subscribe","children":{"wel":{"text":"介绍页面","url":"message_default.php"},"subscribe":{"text":"追剧推送","url":"admin_subscribe.php"},"onlinesubscribe":{"text":"实时推送","url":"admin_online_subscribe.php"}}},
	"m7":{"text":"开放API","default":"api","children":{"api":{"text":"配置","url":"api_manager.php"}}},
    "m10":{"text":"电视直播","default":"program","children":{"program":{"text":"电视频道管理","url":"admin_program.php"},"program_items":{"text":"节目单管理","url":"admin_program_items.php"},"program_play":{"text":"电视直播源管理","url":"admin_program_play.php"},"program_play_cj":{"text":"导入直播源","url":"admin_program_play_import.php"},"program_items_config":{"text":"相关配置","url":"admin_program_config.php"}}} 
	

};
var currTab = 'm1';
var firstOpen = [];
var levels = '1, <?php 
    echo getCookie("adminlevels");
    ?>
';
</script>
	<div id="loading">
		数据加载中...<img src="../images/loading.gif" />
	</div>
	<div class="back_nav">
		<div class="back_nav_list">
			<dl>
				<dt></dt>
				<dd>
					<a href="javascript:;" onclick="openItem('','');none_fn();"></a>
				</dd>
			</dl>
		</div>
		<div class="shadow"></div>
		<div class="close_float">
			<img src="../images/adm/close2.gif" />
		</div>
	</div>
	<div id="head">
		<div id="logo">
			<img src="../images/adm/joylogo.png" />
		</div>
		<div id="menu">
			<span>您好,<strong><?php 
    echo getCookie("adminname");
    ?>
 </strong> [<a
				href="?action=logout" title="注销登陆">注销</a>]</span>


		</div>

		<ul id="nav"></ul>
		<!-- div id="headBg"></div -->
	</div>
	<div id="content">
		<div id="left">
			<div id="leftMenus">
				<dl id="submenu">
					<dt>
						<a class="ico1" id="submenuTitle" href="javascript:;"></a>
					</dt>
				</dl>
			</div>
			<div class="copyright">
				<p>&copy; 2012-2013</p>
				<p>
					Powered by <a href="http://www.joyplus.tv" target="_blank">Joyplus</a>
				</p>
			</div>
		</div>
		<div id="right">
			<iframe hspace="0" vspace="0" frameborder="0" scrolling="auto"
				style="display: none;" width="100%" id="workspace" name="workspace"></iframe>
		</div>
		<div class="clear"></div>
	</div>
	<script type="text/javascript" src="../js/adm/index.js"></script>
</body>
</html>
	<?php 
}
Ejemplo n.º 30
0
 public static function start()
 {
     // Include model
     incFile('modules/profile/system/Model.php');
     incFile('../mail/class.phpmailer.php');
     // Connect to DB
     $model = new ProfileModel();
     if (getSession('user')) {
         $id = getSession('user');
     } else {
         $id = getCookie('user');
         setSession('user', $id, false);
     }
     //  $id = (getSession('user')) ? getSession('user') : getCookie('user') ;
     if ($id) {
         $uData = array();
         // Update user
         $uData['controller'] = CONTROLLER;
         $uData['action'] = ACTION;
         $uData['dateLast'] = time();
         $model->updateUserByID($uData, $id);
         // Get data user
         Request::setParam('user', $model->getUserByID($id));
         // Count new message
         Request::setParam('countMsg', $model->countMsg($id));
         // Count new message
         Request::setParam('countRequests', $model->countRequests($id));
         // Count challenges
         Request::setParam('countChallenges', $model->countChallengesList($id));
     } else {
         $gip = ip2long($_SERVER['REMOTE_ADDR']);
         // Null
         Request::setParam('user', null);
         // Guest
         Request::setParam('guest', $model->getGuestByIP($gip));
         // Role
         Request::setRole('guest');
         /*
         // Language
         if (CONTROLLER == 'page' && ACTION == 'lang') {
             if (Request::getUri(0) == 'ru' OR Request::getUri(0) == 'en')
                 setMyCookie('lang', Request::getUri(0), time() + 365 * 86400);
         }
         
         $lang = getCookie('lang');
         
         if ($lang == 'ru' OR $lang == 'en')
             Lang::setLanguage($lang);
         else
             Lang::setLanguage();
         */
         if (Request::getParam('guest')->id) {
             $gData['count'] = Request::getParam('guest')->count + 1;
             $gData['time'] = time();
             $model->update('guests', $gData, "`id` = '" . Request::getParam('guest')->id . "' LIMIT 1");
         } else {
             $gData['ip'] = $gip;
             $gData['browser'] = $_SERVER['HTTP_USER_AGENT'];
             $gData['referer'] = $_SERVER['HTTP_REFERER'];
             $gData['count'] = 1;
             $gData['time'] = time();
             $model->insert('guests', $gData);
         }
     }
     // Count users online
     Request::setParam('countUsersOnline', $model->countUsersOnline());
     // Count guests online
     Request::setParam('countGuestsOnline', $model->countGuestsOnline());
 }