function execute($file)
{
    _backup($file);
    $result = _execute($file);
    _restore($file);
    return $result;
}
Example #2
0
/**
 * @param callable $callable
 * @param $args
 * @param bool $left
 * @return callable
 */
function _curry_array_args($callable, $args, $left = true)
{
    return function () use($callable, $args, $left) {
        if (_is_fullfilled($callable, $args)) {
            return _execute($callable, $args, $left);
        }
        $newArgs = array_merge($args, func_get_args());
        if (_is_fullfilled($callable, $newArgs)) {
            return _execute($callable, $newArgs, $left);
        }
        return _curry_array_args($callable, $newArgs, $left);
    };
}
Example #3
0
/**
 * cmdExec()
 *
 * @param  string $sModule
 * @param  array  &$aryPear
 * @return void
 */
function cmdExec($sModule, &$aryPear)
{
    $sScript = BLOCKEN_BIN_DIR . '/' . $sModule . '.php';
    if (!is_file($sScript)) {
        echo "拡張モジュールが存在しません: {$sModule}\n";
        return;
    }
    include_once $sScript;
    if (!function_exists('_execute')) {
        echo "拡張モジュールが実行できません: _execute()\n";
        return;
    }
    _execute($aryPear);
}
Example #4
0
function rank_keyword($keyword)
{
    // 1. Select key from db
    $sql = "SELECT Keyword, Hits FROM KeyHits WHERE Keyword=:keyword";
    $params = array(':keyword' => $keyword);
    $stmt = _execute($sql, $params);
    $results = $stmt->fetchAll();
    // 2. Create a new entry or rank exists.
    if (count($results) == 0) {
        // Add as new record
        $sql = "INSERT INTO KeyHits (Keyword, Hits)\n            VALUES(:keyword, :hits) ";
        $params = array(':keyword' => $keyword, ':hits' => 1);
    } else {
        // Update hits
        $hits = $results[0]['Hits'];
        $sql = "UPDATE KeyHits SET Hits=:hits WHERE Keyword=:keyword";
        $params = array(':hits' => $hits + 1, ':keyword' => $keyword);
    }
    $stmt = _execute($sql, $params);
}
Example #5
0
    $id = @$_POST["id"];
    $catname = @$_POST["catname"];
    $status = @$_POST["status"];
    $template_list = @$_POST["template_list"];
    $template_show = @$_POST["template_show"];
    $pagesize = @$_POST["pagesize"];
    #if
    if (!empty($catname) && !empty($pagesize)) {
        if (empty($template_list)) {
            $template_list = "house_list.html";
        }
        if (empty($template_show)) {
            $template_show = "house_show.html";
        }
        #sql
        $sql = "insert into " . tablePrefix() . "house_category (catname,status,template_list,template_show,pagesize) values (?,?,?,?,?)";
        $sql_data = array($catname, $status, $template_list, $template_show, $pagesize);
        if (!empty($id)) {
            $sql = "update " . tablePrefix() . "house_category set catname=?,status=?,template_list=?,template_show=?,pagesize=? where id = ?";
            $sql_data[] = $id;
        }
        #execute
        _execute($sql, $sql_data);
        #tishi
        $error = "操作成功";
    } else {
        $error = "操作失败,缺少必要参数";
    }
    include_once getTPL("tishi");
    exit;
}
Example #6
0
    exit;
}
//status
if (!empty($type) && $type == "status") {
    #param
    $status = @$_GET["status"];
    $id = @$_GET["id"];
    #update
    if (!empty($id)) {
        if ($status != null && $status == "0") {
            $status = 1;
        } else {
            $status = 0;
        }
        $sql = "update " . tablePrefix() . "house_village set status =? where id = ?";
        _execute($sql, array($status, $id));
        $error = "操作成功";
    } else {
        $error = "操作失败,缺少必要参数";
    }
    #tpl
    include_once getTPL("tishi");
    exit;
}
//edit
if (!empty($type) && $type == 'edit') {
    #地区
    $sql_dq = "select id,name,parent_id from " . tablePrefix() . "house_area where status= 0 order by id asc";
    $arr_dq = _select($sql_dq);
    #tpl
    include_once getTPL("house_village-edit");
Example #7
0
        }
        # insert thumbs to $id
        if (!empty($id) && !empty($thumbs)) {
            $sql2 = "insert into " . tablePrefix() . "thumbs (refer_id,refer_table,url,createtime) values";
            $arr = explode(",", $thumbs);
            for ($i = 0; $i < count($arr); $i++) {
                if ($i == count($arr) - 1) {
                    $sql2 .= " (" . $id . ",'house','" . $arr[$i] . "'," . time() . ")";
                } else {
                    $sql2 .= " (" . $id . ",'house','" . $arr[$i] . "'," . time() . "),";
                }
            }
            _execute($sql2);
            $error = "操作成功";
        }
    } else {
        $error = "操作失败,缺少必要参数";
    }
    include_once getTPL("tishi");
    exit;
}
//delete
if (!empty($type) && $type == "delete") {
    $id = @$_GET["id"];
    #sql
    $sql = "update " . tablePrefix() . "house set status=1 where id=?";
    #execute
    _execute($sql, array($id));
    include_once getTPL("tishi");
    exit;
}