Example #1
0
function penConfigLoad($penId)
{
    global $srkEnv;
    $fileName = $srkEnv->penPath . '/' . $penId . '/config.json';
    $cfgContent = getFileContent($fileName);
    if ($cfgContent === -1) {
        $ret = (object) array('error' => 'No config file');
    } else {
        $ret = json_decode($cfgContent);
    }
    if (!isset($ret->error)) {
        if (!isset($ret->penId)) {
            $ret->penId = $penId;
        }
        if (!isset($ret->title)) {
            $ret->title = $penId;
        }
        if (!isset($ret->modifyTime)) {
            $ret->modifyTime = filectime($fileName);
        }
        if (!isset($ret->priority)) {
            $ret->priority = $ret->modifyTime;
        }
        require_once $srkEnv->appPath . '/modules/db.php';
        $ret->visitCount = srkVisitCountGet($ret->penId);
    }
    return $ret;
}
Example #2
0
function srkVisitCountUpdate($penId)
{
    $prevVal = srkVisitCountGet($penId);
    $queryStr = '';
    if ($prevVal === false) {
        $queryStr = 'INSERT INTO penVisitCount VALUES ( \'' . $penId . '\', 1 )';
    } else {
        $queryStr = 'UPDATE penVisitCount SET value = ' . ($prevVal + 1) . ' WHERE penId = \'' . $penId . '\'';
    }
    $db = srkDBConnect();
    if ($db) {
        $res = $db->query($queryStr);
        srkDBClose();
    }
    return $res;
}
Example #3
0
<?php

if (!defined('srkVersion')) {
    exit(403);
}
require_once $srkEnv->appPath . '/modules/db.php';
if ($srkEnv->reqMethod == 'GET') {
    require_once $srkEnv->appPath . '/modules/render.php';
    srkRender('home', array('visitCount' => srkVisitCountGet('shiruku_site_total')));
}