// filter down
                if ($total_width <= $break_point) {
                    $resolution = $break_point;
                }
            }
        }
    }
}
/* No resolution was found (no cookie or invalid cookie) */
if (!$resolution) {
    // We send the lowest resolution for mobile-first approach, and highest otherwise
    $resolution = $is_mobile ? min($resolutions) : max($resolutions);
}
/* if the requested URL starts with a slash, remove the slash */
if (substr($requested_uri, 0, 1) == "/") {
    $requested_uri = substr($requested_uri, 1);
}
/* whew might the cache file be? */
$cache_file = $document_root . "/{$cache_path}/{$resolution}/" . $requested_uri;
/* Use the resolution value as a path variable and check to see if an image of the same name exists at that path */
if (file_exists($cache_file)) {
    // it exists cached at that size
    if ($watch_cache) {
        // if cache watching is enabled, compare cache and source modified dates to ensure the cache isn't stale
        $cache_file = refreshCache($source_file, $cache_file, $resolution);
    }
    sendImage($cache_file, $browser_cache);
}
/* It exists as a source file, and it doesn't exist cached - lets make one: */
$file = generateImage($source_file, $cache_file, $resolution);
sendImage($file, $browser_cache);
Exemplo n.º 2
0
            $DB->exe("UPDATE " . TABLE_PREFIX . "guest SET isbanned = 1 WHERE guestid = '{$gid}'");
        }
        break;
    case 'unbanned':
        if ($gid) {
            $DB->exe("UPDATE " . TABLE_PREFIX . "guest SET isbanned = 0 WHERE guestid = '{$gid}'");
        }
        break;
    case 'kickout':
        if ($gid) {
            $DB->exe("DELETE FROM " . TABLE_PREFIX . "guest WHERE guestid = '{$gid}'");
        }
        break;
    case 'iplocation':
        $ip = ForceIncomingString('ip');
        echo convertip($ip);
        break;
    case 'setbusy':
        //设置为忙碌状态
        refreshCache($uid, 'isbusy', '1');
        //更新缓存
        break;
    case 'unsetbusy':
        //解除忙碌状态
        refreshCache($uid, 'isbusy', '0');
        //更新缓存
        break;
}
?>

Exemplo n.º 3
0
    //faqindex 0.2 archetecture: FAQ Index, Title, Contents
    $grandfaq = explode("|;|", file_get_contents("../doc/faqindex.txt"));
    $articlecount = count($grandfaq);
    //echo "ARTICLE COUNT: $articlecount <br>";
    $articletitle = stripslashes($_REQUEST["QSub"]);
    //echo "ARTICLE Title: $articletitle <br>";
    $articlecontent = stripslashes($_REQUEST["ASub"]);
    //echo "ARTICLE Contnet: $articlecontent <br>";
    $faqentry = array($articlecount, $articletitle, $articlecontent);
    array_push($grandfaq, implode("|,|", $faqentry));
    writeF("../doc/faqindex.txt", implode("|;|", $grandfaq));
    //writeA("../doc/faqcount.txt","I");
    //writeA("../doc/faqindex.txt",$fqc.",".stripslashes($_REQUEST["QSub"]).";");
    echo "Added To Database<br>";
    //writeA("../doc/faq.txt","<br><div id='QID".($fqc+1)."' name='QID".($fqc+1)."'><b>Q: ".stripslashes($_REQUEST["QSub"])."</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A: ".stripslashes($_REQUEST["ASub"])."</div>");
    refreshCache();
    echo "Reloading FAQ Cache<br>";
}
?>



<?php 
//Generates Administration User Interface
function AdminUI()
{
    if (checkAdmin() == true) {
        ?>
<b>FAQ Admin</b>
<br>
<form method="post" action="?faqadmin=true">
Exemplo n.º 4
0
            CreateSession($userid);
            header("Location: ./");
            exit;
        }
    }
} else {
    if (ForceIncomingInt('logout') == 1) {
        $sessionid = ForceIncomingCookie(COOKIE_NAME);
        if ($sessionid and IsPass($sessionid)) {
            $user = $DB->getOne("SELECT u.userid, u.usergroupid FROM " . TABLE_PREFIX . "session s \r\n\t\tLEFT JOIN " . TABLE_PREFIX . "user u ON u.userid = s.userid\r\n\t\tWHERE sessionid    = '{$sessionid}'");
            $DB->exe("UPDATE " . TABLE_PREFIX . "user SET isonline = 0 WHERE userid = '{$user['userid']}' ");
            $DB->exe("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionid = '{$sessionid}' ");
            $DB->exe("DELETE FROM " . TABLE_PREFIX . "vvc WHERE date < " . ($realtime - 3600 * 8));
            $DB->exe("DELETE FROM " . TABLE_PREFIX . "session WHERE created < " . ($realtime - 3600 * 48));
            if ($user['usergroupid'] != 1) {
                refreshCache($user['userid'], 'isonline', '0');
                //仅客服退出时更新缓存
            }
        }
        setcookie(COOKIE_NAME, "", 0, "/");
        LogIn();
    } else {
        $sessionid = ForceIncomingCookie(COOKIE_NAME);
        if ($sessionid and IsPass($sessionid)) {
            $sql = "SELECT u.*, (select COUNT(*)  FROM " . TABLE_PREFIX . "comment WHERE touserid = s.userid) AS comments FROM " . TABLE_PREFIX . "session s\r\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user u ON u.userid = s.userid\r\n\t\t\t\t\tWHERE s.sessionid    = '{$sessionid}'\r\n\t\t\t\t\tAND   s.ipaddress = '" . GetIP() . "'\r\n\t\t\t\t\tAND   u.activated = 1";
            $userinfo = $DB->getOne($sql);
            if (!$userinfo or !$userinfo['userid']) {
                unset($userinfo);
                setcookie(COOKIE_NAME, "", 0, "/");
                LogIn();
            }