當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Update::u0001方法代碼示例

本文整理匯總了PHP中Update::u0001方法的典型用法代碼示例。如果您正苦於以下問題:PHP Update::u0001方法的具體用法?PHP Update::u0001怎麽用?PHP Update::u0001使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Update的用法示例。


在下文中一共展示了Update::u0001方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: admin_controller

function admin_controller()
{
    global $mysqli, $session, $route, $updatelogin;
    // Allow for special admin session if updatelogin property is set to true in settings.php
    // Its important to use this with care and set updatelogin to false or remove from settings
    // after the update is complete.
    if ($updatelogin || $session['admin']) {
        $sessionadmin = true;
    }
    // if ($session['userid']==4) $sessionadmin = true;
    if ($sessionadmin) {
        if ($route->action == 'view') {
            $result = view("Modules/admin/admin_main_view.php", array());
        }
        if ($route->action == 'db') {
            $applychanges = get('apply');
            if (!$applychanges) {
                $applychanges = false;
            } else {
                $applychanges = true;
            }
            require "Modules/admin/update_class.php";
            require_once "Lib/dbschemasetup.php";
            $update = new Update($mysqli);
            $updates = array();
            $updates[] = array('title' => "Database schema", 'description' => "", 'operations' => db_schema_setup($mysqli, load_db_schema(), $applychanges));
            if (!$updates[0]['operations']) {
                // In future versions we could check against db version number as to what updates should be applied
                $updates[] = $update->u0001($applychanges);
                //$updates[] = $update->u0002($applychanges);
                $updates[] = $update->u0003($applychanges);
                $updates[] = $update->u0004($applychanges);
            }
            $result = view("Modules/admin/update_view.php", array('applychanges' => $applychanges, 'updates' => $updates));
        }
        if ($route->action == 'users' && $session['write'] && $session['admin']) {
            $result = view("Modules/admin/userlist_view.php", array());
        }
        if ($route->action == 'userlist' && $session['write'] && $session['admin']) {
            $data = array();
            $result = $mysqli->query("SELECT id,username,email FROM users");
            while ($row = $result->fetch_object()) {
                $data[] = $row;
            }
            $result = $data;
        }
        if ($route->action == 'setuser' && $session['write'] && $session['admin']) {
            $_SESSION['userid'] = intval(get('id'));
            header("Location: ../user/view");
        }
    }
    return array('content' => $result);
}
開發者ID:EMT,項目名稱:MyHomeEnergyPlanner,代碼行數:53,代碼來源:admin_controller.php


注:本文中的Update::u0001方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。