예제 #1
0
function map($obj, $array_map, $template)
{
    $mapped_string = read_template($template);
    foreach ($array_map as $var => $tag) {
        $mapped_string = str_replace($tag, $obj->{$var}, $mapped_string);
    }
    return $mapped_string;
}
예제 #2
0
function reset_user_password($username)
{
    /* resets the password for the user with the username $username, and sends it
     * to him/her via email */
    global $CFG;
    /* load up the user record */
    $user = sql_getUserdataFromUsername($username);
    /* reset the password */
    $newpassword = generate_password();
    sql_setUserpasswd($username, $newpassword);
    /* email the user with the new account information */
    $var = new Object();
    $var->username = $username;
    $var->fullname = $user->Firstname . " " . $user->Lastname;
    $var->newpassword = $newpassword;
    $var->support = $CFG->support;
    $emailbody = read_template("{$CFG->templatedir}/email/reset_password.php", $var);
    mail("{$var->fullname} <{$user->Email}>", "OTMP Account Information", $emailbody, "From: {$var->support}");
}
예제 #3
0
function processChpasswd ( )
{
    $oU = $_SESSION["oU"];
    $response_cont = read_template($GLOBALS["_TPL_PATH"] . "response.tpl");
    $oC = new clsConnection($GLOBALS["DBHOST"], $GLOBALS["DBNAME_UMS"], $GLOBALS["DBUSER_UMS"], $GLOBALS["DBPASS_UMS"]);
    if ($oC->c && $oC->errmsg == "" && isset($_POST["Continue"])) {
        $db = $GLOBALS["DBNAME_UMS"];
        $qstring = "select umuser.UsLogin, umuser.UsPassword from $db.umuser where umuser.UsID = " . $oU->userID . " and umuser.UsPassword = '******'";
        $dbres = mysql_query($qstring, $oC->c);
        $startup = "if (parent.ResetCurPWD) {parent.alertRejectMsg('ÃËÑʼèÒ¹à´ÔÁäÁè¶Ù¡µéͧ - ¡ÃسҾÔÁ¾ìãËÁè  '); parent.ResetCurPWD();}";
        if (mysql_num_rows($dbres) > 0 && trim($_POST["NewPW1"]) == trim($_POST["NewPW2"])) {
            mysql_query("update $db.umuser set UsPassword = '******' where umuser.UsID = " . $oU->userID, $oC->c);
            if (mysql_affected_rows($oC->c) != 1)
                $startup = "if (parent.ResetCurPWD) {parent.alertRejectMsg('ÃËÑʼèÒ¹ãËÁèµÃ§¡ÑºÃËÑʼèÒ¹à´ÔÁ - ¡ÃسҾÔÁ¾ìãËÁè  '); parent.ResetCurPWD();}";
            else
                $startup = "if (parent.ResetCurPWD) {parent.alertRejectMsg('¡ÒÃá¡éä¢ÃËÑʼèÒ¹ÊÓàÃç¨áÅéÇ - ¡ÃسÒãªéÃËÑʼèÒ¹ãËÁè㹡ÒÃà¢éÒãªéÃкº¤ÃÑ駵èÍä»  '); parent.ResetCurPWD(); parent.location.replace('" . "http://" . $GLOBALS["_INFO_INDEX"] . "?__m=config');}";
        }
        bind_content(array("JSFILE" => "js/blank.js",
                           "STARTCODE" => $startup,
                           "RESTAGS" => "&nbsp;"), $response_cont);
        echo $response_cont;
        $oC->Disconnect();
    }
}
예제 #4
0
function getLeftTplContent_rt ( )
{
    global $oU;
    $subsys = &$_SESSION["SubSys"];
    if (isset($_GET["__ss"], $_GET["__ii"], $_GET["__gp"], $subsys[$_GET["__ii"]])) {
        $test = $GLOBALS["_SUBSYS_URL"];
        if ($_GET["__ss"] != "" && $_GET["__gp"] != "" && isset($test[$_GET["__ss"]], $test[$_GET["__ss"]][$_GET["__gp"]])) {
            $row_index = $_GET["__ii"];
            $sys_index = $_GET["__ss"];
            $sys_group = $_GET["__gp"];
            $_SESSION["SysInfo_ii"] = $_GET["__ii"];
            $_SESSION["SysInfo_ss"] = $_GET["__ss"];
            $_SESSION["SysInfo_gp"] = $_GET["__gp"];
            $first_page = $_SESSION["first_page"][$sys_index];
            $_SESSION["SysIcon"] = $GLOBALS["_SYSICO_BIGZ"][$sys_index];
            if (preg_match("/(¼Ùé´ÙáÅÃкº)/", $subsys[$row_index]["gpnamet"])) {
                $_SESSION["SysName"] = "ÃкººÃÔËÒÃÃкº";
                $_SESSION["SysSGrp"] = "¡ÅØèÁ¼Ùé´ÙáÅÃкº";
            } else {
                list($system_name, $system_sgrp) = preg_split("[-]", $subsys[$row_index]["gpnamet"]);
                $_SESSION["SysName"] = "Ãкº" . $system_name;
                $_SESSION["SysSGrp"] = $system_sgrp;
            }
        } else {
            $full_url = $GLOBALS["_PROTOCOL"] . $GLOBALS["_INFO_INDEX"];
            header("Location: $full_url");
        }
    } else if (isset($_SESSION["SysInfo_ss"], $_SESSION["SysInfo_ii"], $_SESSION["SysInfo_gp"])) {
        $row_index = $_SESSION["SysInfo_ii"];
        $sys_index = $_SESSION["SysInfo_ss"];
        $sys_group = $_SESSION["SysInfo_gp"];
        $first_page = $_SESSION["first_page"][$sys_index];
        $_SESSION["SysIcon"] = $GLOBALS["_SYSICO_BIGZ"][$sys_index];
        if (preg_match("/(¼Ùé´ÙáÅÃкº)/", $subsys[$row_index]["gpnamet"])) {
            $_SESSION["SysName"] = "ÃкººÃÔËÒÃÃкº";
            $_SESSION["SysSGrp"] = "¡ÅØèÁ¼Ùé´ÙáÅÃкº";
        } else {
            list($system_name, $system_sgrp) = preg_split("[-]", $subsys[$row_index]["gpnamet"]);
            $_SESSION["SysName"] = "Ãкº" . $system_name;
            $_SESSION["SysSGrp"] = $system_sgrp;
        }
    }
    $rtblogmenu_content = "";
    if (isset($row_index)) {
        $oC = new clsConnection($GLOBALS["DBHOST"], $GLOBALS["DBNAME_UMS"], $GLOBALS["DBUSER_UMS"], $GLOBALS["DBPASS_UMS"]);
        if ($oC->c && $oC->errmsg == "") {
            $rtblogmenu_content = read_template($GLOBALS["_TPL_PATH"] . "postlogmenublog_rt.tpl");
            $rtblogitem_content = read_template($GLOBALS["_TPL_PATH"] . "postlogmenublog_item_rt.tpl");
            $item_content = "";
            $url_padding = "__ss=${sys_index}&__ii=${row_index}&__gp=${sys_group}";
            $pattern = "";
            foreach ($GLOBALS["_SYS1ST_NAME"] as $firstpage_name)
                $pattern .= "($firstpage_name)|";
            $pattern = rtrim($pattern, "|");
            $toskippattern = "";
            foreach ($GLOBALS["_SYSLNK_SKIP"] as $skippage_linked)
                $toskippattern .= "($skippage_linked)|";
            $toskippattern = rtrim($toskippattern, "|");
            $oMmn = new ummenu($oC);
            $oUp = new umpermission($oC);
            $oGp = new umgpermission($oC);
            $oMmn->RSMainMenuBySt($subsys[$row_index]["gpstid"]);
            while ($oMmn->GetRecord()) {
                $flg = 1;
                $oUp->SearchByKey($oU->userID, $oMmn->MnID);
                if ($oUp->GetRecord()) {
                    $flg = $oUp->pmX;
                } else {
                    $oGp->SearchByKey($subsys[$row_index]["uggpid"], $oMmn->MnID);
                    if ($oGp->GetRecord()) {
                        $flg = $oGp->gpX;
                    }
                }
                if ($flg == 1) {
                    if (preg_match("/$toskippattern/", $oMmn->MnNameT))
                        continue;
                    if (preg_match("/$pattern/", $oMmn->MnNameT)) {
                        $item_link = $GLOBALS["_SUBSYS_URL"][$sys_index][$sys_group] . $GLOBALS["_SYS1ST_URL"][$sys_index][$sys_group] . "?" . $url_padding;
                    } else {
                        $oMmn->MnURL = trim($oMmn->MnURL);
                        if ($oMmn->MnURL == "")
                            $item_link = $GLOBALS["_SUBSYS_URL"][$sys_index][$sys_group] . $GLOBALS["_SYS1ST_URL"][$sys_index][$sys_group] . "?StID=" . $sys_index . "&GpID=" . $sys_group . "&MmnID=" . $oMmn->MnID . "&mm=1&" . $url_padding;
                        else
                            $item_link = $oMmn->MnURL;
                    }
                    $item_title = trim($oMmn->MnNameT);
                    $tmpitem_cont = $rtblogitem_content;
                    $item_content .= bind_content(array("ITEMLINK" => htmlspecialchars($item_link),
                                                        "ITEMTITLE" => $item_title), $tmpitem_cont);
                }
            }
            if (!isset($flg, $item_title, $item_link)) {
                $item_title  = "äÁèÁÕÃÒ¡ÒÃàÁ¹ÙÂèÍÂËÃ×ÍÂѧäÁè<br>à»Ô´ãËéãªé§Ò¹¡ÃسҵԴµèͼÙé´Ù<br>áÅÃкº¢Í§·èÒ¹";
                $rtblogitem_content = read_template($GLOBALS["_TPL_PATH"] . "postlogmenublog_item_bx.tpl");
                $item_content = bind_content(array("ITEMTITLE" => $item_title), $rtblogitem_content);
            }
            $oC->Disconnect();
        }
        bind_content(array("MENUTITLE" => trim(preg_replace("/^(.+\-)/", "", $subsys[$row_index]["gpnamet"])),
                           "MENUITEM" => $item_content), $rtblogmenu_content);
    }
    return $rtblogmenu_content;
}
예제 #5
0
function view_produtos()
{
    // Conecta com o banco de dados
    $conn = conexaoDB();
    $sql = "Select * from produtos";
    $stmt = $conn->prepare($sql);
    $stmt->execute();
    $produtos = $stmt->fetchALL(PDO::FETCH_ASSOC);
    $conteudo = "";
    // apos $coluna=2 muda de linha
    $coluna = 0;
    foreach ($produtos as $produto) {
        if ($coluna == 0) {
            $conteudo .= '<div class="row">';
        }
        //if ($coluna<=2) {
        $conteudo .= '<div class="col-md-6">';
        $conteudo .= '<img src="' . $produto['link_imagem'] . '" class="img-polaroid" height="100">';
        $conteudo .= '<h2>' . $produto['titulo'] . '</h2>';
        $conteudo .= '<p>' . $produto['descricao'] . '</p>';
        $conteudo .= '</div>';
        $coluna += 1;
        if ($coluna > 1) {
            $conteudo .= '</div>';
            $conteudo .= '<div class="clearfix visible-lg"></div>';
            $coluna = 0;
        }
    }
    // carrega o conteudo da template
    $template_conteudo = read_template("produtos.temp");
    // Tags a serem substituidas
    $substituir = array("###CONTEUDO###");
    // Valores que substituirao as tags acima
    $por = array("{$conteudo}");
    // Processo de substituicao
    $home_page = str_ireplace($substituir, $por, $template_conteudo);
    // Retorna a pagina pronta
    return $home_page;
}