示例#1
0
 function logout()
 {
     $sql = new sql();
     $table = "session";
     $campos = "date_logout=now()";
     $where = "session='" . $_SESSION['session'] . "'";
     $sql->update($table, $campos, $where, 'N');
     $_SESSION['cod_usuario'] = "";
     $_SESSION['user'] = "";
     $_SESSION['loged'] = false;
     $_SESSION['session'] = "";
     $_SESSION['cod_empresa'] = "";
     $_SESSION['razao_social'] = "";
     $_SESSION['endereco'] = "";
     $_SESSION['numero'] = "";
     $_SESSION['complemento'] = "";
     $_SESSION['cep'] = "";
     $_SESSION['cidade'] = "";
     $_SESSION['uf'] = "";
     $_SESSION['cnpj'] = "";
     $_SESSION['logo'] = "";
     $_SESSION['email'] = "";
     $_SESSION['telefone'] = "";
     //header("Location: index.php");
 }
示例#2
0
文件: sql.php 项目: DINKIN/rokket
 public static function sortTable($table, $sort, $where = '', $select = ['id', 'sort'])
 {
     if ($where) {
         $where = ' WHERE ' . $where;
     }
     $update = new sql();
     $update->setTable($table);
     $i = 1;
     $sql = new sql();
     $sql->query('SELECT `' . $select[0] . '`, `' . $select[1] . '` FROM ' . self::table($table) . $where . ' ORDER BY `' . $select[1] . '` ASC')->result();
     while ($sql->isNext()) {
         if ($sort == $i) {
             $i++;
         }
         $update->addPost($select[1], $i);
         $update->setWhere($select[0] . '=' . $sql->get($select[0]));
         $update->update();
         $sql->next();
         $i++;
     }
 }
/**
 * Kopiert die Metadaten eines Artikels in einen anderen Artikel
 * 
 * @param $from_id      ArtikelId des Artikels, aus dem kopiert werden (Quell ArtikelId)
 * @param $to_id        ArtikelId des Artikel, in den kopiert werden sollen (Ziel ArtikelId)
 * @param [$from_clang] ClangId des Artikels, aus dem kopiert werden soll (Quell ClangId)
 * @param [$to_clang]   ClangId des Artikels, in den kopiert werden soll (Ziel ClangId)
 * @param [$params]     Array von Spaltennamen, welche kopiert werden sollen
 */
function rex_copyMeta($from_id, $to_id, $from_clang = 0, $to_clang = 0, $params = array())
{
    global $REX, $REX_USER;
    $from_clang = (int) $from_clang;
    $to_clang = (int) $to_clang;
    $from_id = (int) $from_id;
    $to_id = (int) $to_id;
    if (!is_array($params)) {
        $params = array();
    }
    if ($from_id == $to_id && $from_clang == $to_clang) {
        return false;
    }
    $gc = new sql();
    $gc->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='{$from_clang}' and id='{$from_id}'");
    if ($gc->getRows() == 1) {
        $uc = new sql();
        // $uc->debugsql = 1;
        $uc->setTable($REX['TABLE_PREFIX'] . "article");
        $uc->where("clang='{$to_clang}' and id='{$to_id}'");
        $uc->setValue("updatedate", time());
        $uc->setValue("updateuser", addslashes($REX_USER->getValue("login")));
        foreach ($params as $key => $value) {
            $var = $gc->getValue("{$value}");
            $uc->setValue("{$value}", $var);
        }
        $uc->update();
        rex_generateArticle($to_id, false);
        return true;
    }
    return false;
}
示例#4
0
 /**
  * The select method, call sql::update().
  * 
  * @param  string $table 
  * @access public
  * @return object the dao object self.
  */
 public function update($table)
 {
     $this->setMode('raw');
     $this->setMethod('update');
     $this->sqlobj = sql::update($table);
     $this->setTable($table);
     return $this;
 }
示例#5
0
     $meta_sql->setValue("online_from", mktime(0, 0, 0, $monat_von, $tag_von, $jahr_von));
     $meta_sql->setValue("online_to", mktime(0, 0, 0, $monat_bis, $tag_bis, $jahr_bis));
     $meta_sql->setValue("keywords", $meta_keywords);
     $meta_sql->setValue("description", $meta_description);
     $meta_sql->setValue("name", $meta_article_name);
     $meta_sql->setValue("type_id", $type_id);
     if (!isset($meta_teaser)) {
         $meta_teaser = 0;
     }
     $meta_sql->setValue("teaser", $meta_teaser);
     $meta_sql->setValue("updatedate", time());
     $meta_sql->setValue("updateuser", $REX_USER->getValue("login"));
     // -------------------------- FILE UPLOAD META BILD/FILE
     $meta_sql->setValue("file", $REX_MEDIA_1);
     // ----------------------------- / FILE UPLOAD
     $meta_sql->update();
     $article->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where id='{$article_id}' and clang='{$clang}'");
     if (!isset($message)) {
         $message = '';
     }
     $err_msg = $I18N->msg("metadata_updated") . $message;
     rex_generateArticle($article_id);
 }
 $typesel = new select();
 $typesel->set_name("type_id");
 $typesel->set_style("width:100%;");
 $typesel->set_size(1);
 $typesql = new sql();
 $typesql->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_type order by name");
 for ($i = 0; $i < $typesql->getRows(); $i++) {
     $typesel->add_option($typesql->getValue("name"), $typesql->getValue("type_id"));
 function deleteMessage($message_id)
 {
     // reply
     $r_sql = new sql();
     $r_sql->setQuery("select * from rex_5_board where message_id='{$message_id}' and board_id='" . $this->boardname . "'");
     if ($r_sql->getRows() == 1) {
         if ($r_sql->getValue("re_message_id") != 0) {
             // reply
             $ur_sql = new sql();
             $ur_sql->setTable("rex_5_board");
             $ur_sql->where("message_id='{$message_id}'");
             $ur_sql->setValue("status", 0);
             $ur_sql->update();
             $message_id = $r_sql->getValue("re_message_id");
             // update topic
             $u_sql = new sql();
             $u_sql->setQuery("select * from rex_5_board where re_message_id='{$message_id}' and status='1'");
             $u_sql->setTable("rex_5_board");
             $u_sql->where("message_id='{$message_id}'");
             $u_sql->setValue("replies", $u_sql->getRows());
             $u_sql->update();
             $this->msg["bb_msg_id"] = $r_sql->getValue("re_message_id");
             $return = $this->showMessage();
         } else {
             // topic
             $u_sql = new sql();
             $u_sql->setTable("rex_5_board");
             $u_sql->where("message_id='{$message_id}' or re_message_id='{$message_id}'");
             $u_sql->setValue("status", 0);
             $u_sql->update();
             $this->errmsg = $this->text[250];
             $return = $this->showMessages();
         }
     } else {
         $this->errmsg = $this->text[260];
         $return = $this->showMessages();
     }
     return $return;
 }
     // --------------------- ARTIKEL EDIT
     $Position_Article = (int) $Position_Article;
     if ($Position_Article == 0) {
         $Position_Article = 1;
     }
     $amessage = $I18N->msg("article_updated");
     $EA = new sql();
     $EA->setTable($REX['TABLE_PREFIX'] . "article");
     $EA->where("id='{$article_id}' and clang={$clang}");
     $EA->setValue("name", $article_name);
     $EA->setValue("template_id", $template_id);
     // $EA->setValue("path",$KATPATH);
     $EA->setValue("updatedate", time());
     $EA->setValue("updateuser", $REX_USER->getValue("login"));
     $EA->setValue("prior", $Position_Article);
     $EA->update();
     // ----- PRIOR
     rex_newArtPrio($category_id, $clang, $Position_Article, $thisArt->getValue("prior"));
     rex_generateArticle($article_id);
     // ----- EXTENSION POINT
     $message = rex_register_extension_point('ART_UPDATED', $message, array("id" => $article_id, "status" => $thisArt->getValue("status"), "name" => $article_name, "clang" => $clang, "re_id" => $category_id, "prior" => $Position_Article, "path" => $KATPATH, "template_id" => $template_id));
 } elseif (isset($function) and $function == "delete_article" && $article_id != "" && $KATPERM && !$REX_USER->isValueOf("rights", "editContentOnly[]")) {
     // --------------------- ARTIKEL DELETE
     $message = rex_deleteArticle($article_id);
     $re_id = $thisArt->getValue("re_id");
     // ----- PRIO
     $CL = $REX['CLANG'];
     reset($CL);
     for ($j = 0; $j < count($CL); $j++) {
         $mlang = key($CL);
         rex_newArtPrio($thisArt->getValue("re_id"), $mlang, 0, 1);
示例#8
0
<?php 
session_start();
include "../../../php/login.php";
include "php.php";
include "config.php";
$sql = new sql();
function data_($data)
{
    if ($data != null) {
        $data = str_replace('/', '-', $data);
        return date('Y-m-d', strtotime($data));
    }
}
$login = new login();
$login->checklogin();
if (isset($_SESSION['loged']) and $_SESSION['loged'] == true) {
    if (isset($_POST['act']) and $_POST['act'] == "conciliar" and isset($_POST['itens']) and $_POST['itens'] != "") {
        $key = md5(mt_rand(1, 10000) . strtotime(date('Y-m-d H:i:s')));
        $itens = explode(',', $_POST['itens']);
        $tabela = "cad_documento_item";
        $campos = "data_ultima_alteracao=DATE_FORMAT(now(),'%Y-%m-%d'), cod_documento_compensacao='" . $key . "' ";
        for ($n = 1; $n < count($itens); $n++) {
            $where = "cod_documento_item='" . $itens[$n] . "'";
            $sql->update($tabela, $campos, $where, 'S');
        }
    }
}
        $size = getimagesize($REX[INCLUDE_PATH] . "/../../files/{$filename}");
        $fwidth = $size[0];
        $fheight = $size[1];
        $width = $width + 0;
        $height = $height + 0;
        if ($width > 0 and $height > 0 and $fwidth != $width and $fheight != $height) {
            media_resize($REX[MEDIAFOLDER] . "/{$filename}", $width, $height);
            $msg .= "<br>" . $I18N->msg('pool_file_is_resized');
        } elseif ($width > 0 and $fwidth != $width) {
            media_resize($REX[MEDIAFOLDER] . "/{$filename}", $width, $height);
            $msg .= "<br>" . $I18N->msg('pool_file_is_resized');
        } elseif ($height > 0 and $fheight != $height) {
            media_resize($REX[MEDIAFOLDER] . "/{$filename}", $width, $height);
            $msg .= "<br>" . $I18N->msg('pool_file_is_resized');
        }
        $FILESQL->update();
    } else {
        $msg = $I18N->msg('pool_file_not_found');
        $mode = "";
    }
}
if ($mode == "detail") {
    $gf = new sql();
    if ($file_name != "") {
        $gf->setQuery("select * from rex_file where filename='{$file_name}'");
    }
    if ($gf->getRows() == 1) {
        $file_id = $gf->getValue("file_id");
    }
    $gf->setQuery("select * from rex_file where file_id='{$file_id}'");
    if ($gf->getRows() == 1) {
        $body = str_replace("###LOGIN###", $gu->getValue("user_login"), $body);
        $body = str_replace("###PSW###", $gu->getValue("user_password"), $body);
        $mail->Subject = $subject;
        $mail->AltBody = $body;
        $mail->Send();
        echo "Mail wurde versendet<br /><br />";
        $aktionen = $mails[$mail_id]["action"];
        if (is_array($aktionen)) {
            $uu = new sql();
            $uu->debugsql = 0;
            $uu->setTable("rex_5_user");
            $uu->where("id='" . $oid . "'");
            foreach ($aktionen as $key => $value) {
                $uu->setValue($key, $value);
            }
            $uu->update();
            echo "Aktion/en wurden ausgeführt!<br /><br />";
        }
    } else {
        foreach ($mails as $key => $value) {
            echo "<br /><br /><a href=index.php?page=community&subpage=user&oid={$oid}&func=sendmail&subfunc=send&mail_id={$key}>&raquo; " . $value["name"] . "</a>";
        }
        echo "<br /><br />";
    }
    echo "</td></tr></table>";
    echo "<br /><table cellpadding=5 class=rex><tr><td><a href=index.php?page=" . $mypage . "&subpage=" . $subpage . "&func=edit&oid={$oid}><b>&laquo; Zurück zum User</b></a></td></tr></table>";
    $func = "nothing";
} else {
    // kein exit -> fehler -> zurueck zur übersicht
    unset($oid);
}
示例#11
0
    $updateuser->setValue("newsletter", $unewsletter);
    if ($ushowinfo != "") {
        $ushowinfo = 1;
    } else {
        $ushowinfo = 0;
    }
    $updateuser->setValue("showinfo", $ushowinfo);
    if ($usendmail != "") {
        $usendmail = 1;
    } else {
        $usendmail = 0;
    }
    // Markus => http://forum.redaxo.de/viewtopic.php?t=235
    $updateuser->setValue("sendmail", $usendmail);
    echo $usendmail;
    $updateuser->update();
    $user_id = 0;
    $function = "";
    $message = "Benutzerdaten wurden aktualisiert !";
} elseif ($FDEL != "") {
    $deleteuser = new sql();
    $deleteuser->query("delete from rex__user where id='{$user_id}'");
    $deleteuser->query("delete from rex__article_comment where user_id='{$user_id}'");
    $deleteuser->query("delete from rex__board where user_id='{$user_id}'");
    $deleteuser->query("delete from rex__user_comment where user_id='{$user_id}' or from_user_id='{$user_id}'");
    $deleteuser->query("delete from rex__user_mail where user_id='{$user_id}' or from_user_id='{$user_id}'");
    $message = "Benutzer gelöscht !";
    $user_id = "";
} elseif ($FADD != "" && $save == 1) {
    $adduser = new sql();
    $adduser->setQuery("select * from rex__user where login='******'");
          $SETTINGSQL->setValue("color2",$EDITcolor2);
          $SETTINGSQL->setValue("color3",$EDITcolor3);
          $SETTINGSQL->setValue("color4",$EDITcolor4);
          $SETTINGSQL->setValue("color5",$EDITcolor5);
          $SETTINGSQL->setValue("color6",$EDITcolor6);
          $SETTINGSQL->setValue("color7",$EDITcolor7);
          $SETTINGSQL->setValue("color8",$EDITcolor8);
          $SETTINGSQL->setValue("color9",$EDITcolor9);
          $SETTINGSQL->setValue("color10",$EDITcolor10);
          $SETTINGSQL->setValue("color11",$EDITcolor11);
          $SETTINGSQL->setValue("color12",$EDITcolor12);
          $SETTINGSQL->setValue("color13",$EDITcolor13);
          $SETTINGSQL->setValue("color14",$EDITcolor14);
          $SETTINGSQL->setValue("color15",$EDITcolor15);
          $SETTINGSQL->setValue("color16",$EDITcolor16);*/
        $SETTINGSQL->update();
    } else {
        $errorMsg .= '<p class="warning">Einstellungen wurden nicht gespeichert.</p>';
    }
}
if (!isset($aid)) {
    $aid = '';
}
if (!isset($subpage)) {
    $subpage = '';
}
if (!isset($EDITeditorWindow)) {
    $EDITeditorWindow = '';
}
if (!isset($errorMsg)) {
    $errorMsg = '';
if (isset($_POST) and isset($_POST['act']) and $_POST['act'] == 'salvar_resposta') {
    //se 'cod_formulario_resposta' == 'nova_resposta'
    if ($_POST['cod_formulario_resposta'] == 'nova_resposta') {
        $table = "`cad_formulario_resposta`";
        $campos = "`cod_formulario`, `descricao`";
        $values = "'" . $_POST['cod_formulario'] . "','" . $_POST['descricao'] . "'";
        $msg = "N";
        $sql->insert($table, $campos, $values, $msg);
    }
    //se 'cod_formulario_resposta' != 'nova_resposta'
    if ($_POST['cod_formulario_resposta'] != 'nova_resposta') {
        $table = "cad_formulario_resposta";
        $campos = "`cod_formulario`='" . $_POST['cod_formulario'] . "', `descricao`='" . $_POST['descricao'] . "' ";
        $where = "cod_formulario_resposta='" . $_POST['cod_formulario_resposta'] . "'";
        $msg = "N";
        $sql->update($table, $campos, $where, $msg);
    }
    //pesquisar os atuais
    echo $formulario->itens_formulario($_POST['cod_formulario']);
}
if (isset($_POST) and isset($_POST['act']) and $_POST['act'] == 'excluir_resposta') {
    $table = "cad_formulario_resposta";
    $where = "cod_formulario_resposta='" . $_POST['cod_formulario_resposta'] . "'";
    $msg = "N";
    $sql->delete($table, $where, $msg);
    echo $formulario->itens_formulario($_POST['cod_formulario']);
}
if (isset($_POST) and isset($_POST['act']) and $_POST['act'] == 'editar_formulario') {
    //var_dump($_POST);
    $formulario = new formulario();
    $formulario->editar_formulario($_POST['cod_formulario']);
示例#14
0
<?php 
//print_r($_GET);
session_start();
include "php.php";
if (isset($_GET['baixa']) and isset($_GET['cod_captacao']) and $_GET['baixa'] != '' and $_GET['cod_captacao'] != '') {
    //		$select= "DELETE FROM `".$schema."`.`captacao_cartas_baixas` WHERE `captacao_cartas_baixas`.`cod_captacao_cartas_baixas` = ".$cod_captacao_cartas_baixas.";";
    $sql = new sql();
    $sql->delete('captacao_cartas_baixas', " cod_captacao_cartas_baixas= " . $_GET['baixa'] . " and cod_captacao_cartas=" . $_GET['cod_captacao']);
    $sql->update('captacao_cartas', " status='-02' ", " cod_captacao_cartas=" . $_GET['cod_captacao']);
    //	$sql->baixar_captacao('00',$_GET['data_baixa'],$_GET['valor_baixa'],$_GET['cod_captacao_cartas'],$_GET['cod_carteira'],"","","BAIXA MANUAL");
}
header("Location:../cadastro_captacoes.php?id=" . $_GET['cod_captacao'] . "");
示例#15
0
 function upload_logo()
 {
     $sql = new sql();
     //move arquivo
     $arquivo = $_FILES['upload_logo'];
     //Salvando o Arquivo
     $nome_arquivo = md5(mt_rand(1, 10000) . $arquivo['name']) . '.jpg';
     $caminho_arquivo = "imagens/";
     $caminho = $caminho_arquivo . $nome_arquivo;
     move_uploaded_file($arquivo['tmp_name'], "../" . $caminho);
     $table = "cad_empresa";
     $campos = "`logo`='" . $caminho . "'";
     $where = "cod_empresa='" . $_POST['cod_empresa'] . "'";
     $msg = "N";
     $sql->update($table, $campos, $where, $msg);
     echo "<img src='" . $caminho . "' class='uk-cover-background' alt='' height='100' width='200'>";
 }
示例#16
0
 public function estorno_documento($cod_documento)
 {
     include "config.php";
     $pesquisa = new pesquisa();
     $documento = $pesquisa->documento($_GET['id']);
     //estornar
     $sql = new sql();
     $key = md5(mt_rand(1, 10000) . strtotime(date('Y-m-d H:i:s')));
     $select_cad_documento = "\n\t\t\t\t\t\t\t\tINSERT INTO \n\t\t\t\t\t\t\t\t\t`" . $schema . "`.`cad_documento`\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t`cod_empresa`,\n\t\t\t\t\t\t\t\t\t\t`cod_tipo_documento`,\n\t\t\t\t\t\t\t\t\t\t`referencia`,\n\t\t\t\t\t\t\t\t\t\t`texto_cabecalho_documento`,\n\t\t\t\t\t\t\t\t\t\t`data_lancamento`,\n\t\t\t\t\t\t\t\t\t\t`data_base`,\n\t\t\t\t\t\t\t\t\t\t`data_estorno`,\n\t\t\t\t\t\t\t\t\t\t`data_alteracao`,\n\t\t\t\t\t\t\t\t\t\t`exercicio`,\n\t\t\t\t\t\t\t\t\t\t`periodo`,\n\t\t\t\t\t\t\t\t\t\t`historico`,\n\t\t\t\t\t\t\t\t\t\t`data_inclusao`,\n\t\t\t\t\t\t\t\t\t\t`data_ultima_alteracao`,\n\t\t\t\t\t\t\t\t\t\t`usuario_inclusao`,\n\t\t\t\t\t\t\t\t\t\t`usuario_ultima_alteracao`)\n\n\n\t\t\t\t\t\t\t\tselect \n\n\t\t\t\t\t\t\t\t\t`cod_empresa`,\n\t\t\t\t\t\t\t\t\t'2',\n\t\t\t\t\t\t\t\t\t'" . $key . "',\n\t\t\t\t\t\t\t\t\tconcat('ESTORNO - ',`texto_cabecalho_documento`),\n\t\t\t\t\t\t\t\t\t`data_lancamento`,\n\t\t\t\t\t\t\t\t\t`data_base`,\n\t\t\t\t\t\t\t\t\tDATE_FORMAT(now(),'%Y-%m-%d'),\n\t\t\t\t\t\t\t\t\tDATE_FORMAT(now(),'%Y-%m-%d'),\n\t\t\t\t\t\t\t\t\t`exercicio`,\n\t\t\t\t\t\t\t\t\t`periodo`,\n\t\t\t\t\t\t\t\t\t`historico`,\n\t\t\t\t\t\t\t\t\tnow(),\n\t\t\t\t\t\t\t\t\tDATE_FORMAT(now(),'%Y-%m-%d'),\n\t\t\t\t\t\t\t\t\t`usuario_inclusao`,\n\t\t\t\t\t\t\t\t\t`usuario_ultima_alteracao`\n\n\t\t\t\t\t\t\t\t from \n\t\t\t\t\t\t\t\t\t" . $schema . ".cad_documento \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\twhere \n\t\t\t\t\t\t\t\t\tcod_empresa='" . $_SESSION['cod_empresa'] . "' and \n\t\t\t\t\t\t\t\t\tcod_documento='" . $cod_documento . "'\t";
     $resultado = mysql_query($select_cad_documento, $conexao) or die(mysql_error());
     //2//pesquisar cod_documento
     $select = "SELECT cod_documento FROM " . $schema . ".cad_documento WHERE referencia='" . $key . "' and cod_empresa=" . $_SESSION['cod_empresa'] . "; ";
     $resultado = mysql_query($select, $conexao) or die(mysql_error());
     $cod_documento_ = mysql_fetch_array($resultado);
     $cod_documento_ = $cod_documento_[0];
     //3//update referencia
     $tabela = "cad_documento";
     $campos = "referencia='ESTORNO - " . $documento['referencia'] . "'";
     $where = "referencia='" . $key . "'";
     $sql->update($tabela, $campos, $where, 'N');
     $tabela = "cad_documento";
     $campos = "data_estorno=DATE_FORMAT(now(),'%Y-%m-%d')";
     $where = "cod_documento='" . $cod_documento . "'";
     $sql->update($tabela, $campos, $where, 'N');
     $tabela = "cad_documento_item";
     $campos = "cod_documento_compensacao='" . $key . "'";
     $where = "cod_documento='" . $cod_documento . "'";
     $sql->update($tabela, $campos, $where, 'N');
     $select_cad_documento_item = "\n\t\t\t\t\t\t\t\t INSERT INTO \n\t\t\t\t\t\t\t\t\t`" . $schema . "`.`cad_documento_item`\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t`cod_empresa`,\n\t\t\t\t\t\t\t\t\t\t`cod_documento`,\n\t\t\t\t\t\t\t\t\t\t`numero_item`,\n\t\t\t\t\t\t\t\t\t\t`codigo_lancamento`,\n\t\t\t\t\t\t\t\t\t\t`cod_conta`,\n\t\t\t\t\t\t\t\t\t\t`cod_ctr_custo`,\n\t\t\t\t\t\t\t\t\t\t`montante`,\n\t\t\t\t\t\t\t\t\t\t`historico`,\n\t\t\t\t\t\t\t\t\t\t`data_vencimento_liquidacao`,\n\t\t\t\t\t\t\t\t\t\t`cod_documento_compensacao`,\n\t\t\t\t\t\t\t\t\t\t`data_inclusao`,\n\t\t\t\t\t\t\t\t\t\t`data_ultima_alteracao`,\n\t\t\t\t\t\t\t\t\t\t`usuario_inclusao`,\n\t\t\t\t\t\t\t\t\t\t`usuario_ultima_alteracao`)\n\n\t\t\t\t\t\t\t\tSELECT \n\t\t\t\t\t\t\t\t\t`cad_documento_item`.`cod_empresa`,\n\t\t\t\t\t\t\t\t\t'" . $cod_documento_ . "',\n\t\t\t\t\t\t\t\t\t`cad_documento_item`.`numero_item`,\n\t\t\t\t\t\t\t\t\tif(`cad_documento_item`.`codigo_lancamento`='D','C','D'),\n\t\t\t\t\t\t\t\t\t`cad_documento_item`.`cod_conta`,\n\t\t\t\t\t\t\t\t\t`cad_documento_item`.`cod_ctr_custo`,\n\t\t\t\t\t\t\t\t\t`cad_documento_item`.`montante`,\n\t\t\t\t\t\t\t\t\t`cad_documento_item`.`historico`,\n\t\t\t\t\t\t\t\t\t`cad_documento_item`.`data_vencimento_liquidacao`,\n\t\t\t\t\t\t\t\t\t'" . $key . "',\n\t\t\t\t\t\t\t\t\tnow(),\n\t\t\t\t\t\t\t\t\tnow(),\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['cod_usuario'] . "',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['cod_usuario'] . "'\n\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t\t\t`" . $schema . "`.`cad_documento_item`\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\twhere \n\t\t\t\t\t\t\t\t\tcod_empresa='" . $_SESSION['cod_empresa'] . "' and \n\t\t\t\t\t\t\t\t\tcod_documento='" . $cod_documento . "'";
     $resultado = mysql_query($select_cad_documento_item, $conexao) or die(mysql_error());
 }
示例#17
0
文件: index.php 项目: Alex4S/beta
<?php

/**
 * Created by PhpStorm.
 * User: Alex Sandiyarov
 * Date: 13.12.15
 * Time: 12:17
 */
$news = new News();
$a = $news->getAll();
var_dump($a);
//$news->add($data);
//$news->update($title2, $id);
$a = new sql();
$a->get('*', 'news', 'ORDER BY date DESC');
print_r($a->packToArray());
print_r($a->get('*', 'news', 'WHERE  id = 4'));
$a->insert('news', 'id, title', '"34543435434534353453455", "sadsadas"');
$a->update('news', 'title = "KUKU"', '4');
示例#18
0
 function inserir_arquivo_ofx_lancamentos($tb, $data_inicio, $data_fim, $carteira)
 {
     include "config.php";
     $sql = new sql();
     $table = "arquivo_ofx_lancamentos";
     $where = "cod_carteira='" . $carteira . "' and (DTPOSTED between '" . $data_inicio . "' and '" . $data_fim . "')";
     $sql->delete($table, $where);
     $table = "captacao_cartas_baixas";
     $campos = "cod_conciliacao=0";
     $where = "cod_carteira='" . $carteira . "' and (data_baixa between '" . $data_inicio . "' and '" . $data_fim . "')";
     $sql->update($table, $campos, $where);
     $table = "arquivo_ofx_lancamentos";
     $campos = "`cod_carteira`,`TRNTYPE`,`DTPOSTED`,`TRNAMT`,`FITID`,`CHECKNUM`,`MEMO`";
     $values = $tb;
     $sql->insert($table, $campos, $values);
 }
    $s = new sql();
    $s->setQuery("select * from rex_opf_lang where id='" . $oid . "'");
    if ($s->getRows() == 0) {
        $msg = "";
    } else {
        $SF = true;
        $msg = "";
        if (isset($_REQUEST["opfname"])) {
            $msg = "Value saved.";
            $SF = false;
            $sv = new sql();
            // $sv->debugsql = 1;
            $sv->setTable("rex_opf_lang");
            $sv->where("id='" . $oid . "'");
            $sv->setValue("name", trim($_REQUEST["opfname"]));
            $sv->update();
        }
        if ($msg != "") {
            echo rex_opf_msg($msg);
        }
        if ($SF) {
            echo "<table style='width: 770px' cellpadding=5 cellspacing=1 border=0 class=rextbl>";
            echo "<form action=index.php method=post><input type=hidden name=oid value={$oid}><input type=hidden name=clang value=" . $clang . "><input type=hidden name=page value=" . $mypage . "><input type=hidden name=func value=" . $func . " />";
            // echo "<tr><th colspan=2 align=left class=dgrey>Schnipsel hinzufuegen</th></tr>";
            echo "<tr><td class=grey width=150>New value</td><td class=grey><textarea cols=30 rows=2 name=opfname class=inp100>" . htmlspecialchars($s->getValue("name")) . "</textarea></td></tr>";
            echo "<tr><td class=grey>Replace value</td><td class=grey>" . htmlspecialchars($s->getValue("replacename")) . "</td></tr>";
            echo "<tr><td class=dgrey>&nbsp;</td><td class=dgrey><input type=submit value=add></td></tr>";
            echo "</table><br />";
        }
    }
}
            echo "</form></tr>";
        } else {
            echo "<tr>" . "<td></td>" . "<td align=center>" . key($REX[CLANG]) . "</td>" . "<td><a href=index.php?page=specials&spage=lang&func=editclang&clang_id=" . key($REX[CLANG]) . "#clang>" . htmlentities(current($REX[CLANG])) . "</a></td>" . "<td></td></tr>";
        }
        next($REX[CLANG]);
    }
    echo "</table>";
} else {
    // ----- eigene typen definieren
    if ($function == "Update" or $function == "Ändern") {
        $update = new sql();
        $update->setTable("rex_article_type");
        $update->where("type_id='{$type_id}'");
        $update->setValue("name", $typname);
        $update->setValue("description", $description);
        $update->update();
        $type_id = 0;
        $function = "";
        $message = $I18N->msg("article_type_updated");
    } elseif ($function == "Delete" or $function == "Löschen") {
        if ($type_id != 1) {
            $delete = new sql();
            $result = $delete->get_array("SELECT name,id FROM rex_article WHERE type_id = {$type_id}");
            if (is_array($result)) {
                $message = $I18N->msg("article_type_still_used") . "<br>";
                foreach ($result as $var) {
                    $message .= "<br><a href=index.php?page=content&article_id=" . $var[id] . "&mode=meta target=_blank>" . $var[name] . "</a>";
                }
                $message .= "<br><br>";
            } else {
                $delete->query("delete from rex_article_type where type_id='{$type_id}'");
     $thumbnail = $REX_MEDIA_1;
 }
 $sql->setValue("thumbnail", $thumbnail);
 if ($REX_MEDIA_2 == "delete file") {
     $picture = "";
 } else {
     $picture = $REX_MEDIA_2;
 }
 $sql->setValue("picture", $picture);
 $sql->setValue("relation_1", $article[relation_1]);
 $sql->setValue("relation_2", $article[relation_2]);
 $sql->setValue("relation_3", $article[relation_3]);
 if ($aid != "") {
     // ----> update eines Artikels
     $sql->where("id='" . $aid . "' AND clang='{$clang}'");
     $sql->update();
     if (strlen($sql->error) > 3) {
         echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("error"), $message_corpus);
     } else {
         echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("product_saved"), $message_corpus);
         if ($uebernehmen) {
             $send = 0;
             $function = "edit_article";
         } else {
             $send = 1;
             $function = "";
         }
     }
     $sql->flush();
     $sql->setTable("rex_4_article");
     $sql->setValue("category", $diecats);
示例#22
0
 public function salvar($tabela, $key_id)
 {
     function formatar_data($data)
     {
         if ($data != null) {
             $date = str_replace('/', '-', $data);
             return date('Y-m-d', strtotime($data));
         }
     }
     $keys = array_keys($_POST);
     for ($i = 0; $i < count($keys); $i++) {
         if (strpos($keys[$i], 'data') === false) {
         } else {
             $_POST[$keys[$i]] = DateTime::createFromFormat('d/m/Y', $_POST[$keys[$i]])->format('Y-m-d');
         }
     }
     //update
     $json = "{";
     $keys = array_keys($_POST);
     for ($c = 0; $c < count($keys); $c++) {
         $json .= '"' . $keys[$c] . '":"' . $_POST[$keys[$c]] . '",';
     }
     $json .= "}";
     $json = str_replace(',}', "}", $json);
     $json = str_replace('{"', "`", $json);
     $json = str_replace('":"', "`='", $json);
     $json = str_replace('","', "',`", $json);
     $json = str_replace('"}', "'", $json);
     $sql = new sql();
     $campos = $json;
     $where = "`" . $key_id . "`='" . $_POST[$key_id] . "'";
     //insert
     $campos_insert = "";
     $values = "";
     for ($i = 0; $i < count($keys); $i++) {
         if ($_POST[$keys[$i]] != "") {
             $campos_insert .= "`" . $keys[$i] . "`";
             $values .= "'" . $_POST[$keys[$i]] . "',";
         }
     }
     $values = "(" . $values . ")";
     $campos_insert = str_replace('``', "`,`", $campos_insert);
     $values = str_replace(",)", ")", $values);
     $values = str_replace(")", "", $values);
     $values = str_replace("(", "", $values);
     if ($_POST[$key_id] != "" and $_POST[$key_id] != null) {
         $sql->update($tabela, $campos, $where, 'S');
     } else {
         $sql->insert($tabela, $campos_insert, $values, 'S');
         if ($tabela == "cad_itens") {
             $tabela = "cad_movimento";
             $campos_insert = "cod_item, data, valor, cod_tipo_movimento";
             $values = "(SELECT max(cod_item) from imobilizado.cad_itens), '" . $_POST['data_aquisicao'] . "','" . $_POST['valor_aquisicao'] . "','1'";
             $sql->insert($tabela, $campos_insert, $values, 'N');
         }
     }
 }
示例#23
0
 protected function control($type)
 {
     $id = $this->id;
     $SSH = rp::get('SSH');
     $host = $SSH['ip'];
     $user = $SSH['user'];
     $pass = $SSH['password'];
     unset($SSH);
     $ssh = new ssh($host, $user, $pass);
     $sql = new sql();
     $sql->setTable('server');
     $sql->setWhere('id=' . $id);
     #$ssh->read('[prompt]');
     switch ($type) {
         case 'install':
             $ssh->exec("cd {$id}; ./control.sh auto-install  > /dev/null &");
             $sql->addPost('status', 0);
             break;
         case 'start':
             $ssh->exec("cd {$id}; ./control.sh start >> /dev/null 2>&1 & /n");
             $sql->addPost('status', 1);
             break;
         case 'stop':
             $ssh->exec("cd {$id}; ./control.sh stop >> /dev/null 2>&1 & /n");
             $sql->addPost('status', 0);
             break;
         case 'restart':
             $ssh->exec("cd {$id}; ./control.sh restart >> /dev/null 2>&1 & /n");
             $sql->addPost('status', 1);
             break;
     }
     $sql->update();
 }
示例#24
0
文件: news.php 项目: Alex4S/beta
 public function update($set, $id)
 {
     $sql = new sql();
     $sql->update('news', $set, $id);
 }
 function showForm()
 {
     global $FORM, $REX;
     // --------------------------------- EDIT: 1. WERTE AUS DB HOLEN
     for ($i = 0; $i < $this->counter; $i++) {
         if ($this->value_type[$i] != "multipleselectsql") {
             if ($FORM[$this->rfid][submit] != 1 && $this->form_type == "edit") {
                 $FORM[$this->rfid][values][$i] = htmlentities($this->sql->getValue($this->value_tbl[$i]));
             } else {
                 $FORMVAL[$this->rfid][values][$i] = htmlentities($this->sql->getValue($this->value_tbl[$i]));
             }
         } else {
             $selsql = new sql();
             $selsql->setQuery("select * from " . $this->type_value5[$i] . " where " . $this->type_value6[$i]);
             for ($j = 0; $j < $selsql->getRows(); $j++) {
                 if ($FORM[$this->rfid][submit] != 1 && $this->form_type == "edit") {
                     $FORM[$this->rfid][values][$i][] = $selsql->getValue($this->type_value7[$i]);
                 } else {
                     $FORMVAL[$this->rfid][values][$i][] = $selsql->getValue($this->type_value7[$i]);
                 }
                 $selsql->next();
             }
         }
     }
     // --------------------------------- ABGESCHICKTE EINGABEN CHECKEN
     if ($FORM[$this->rfid][submit] == 1) {
         // ----------------------------- eingaben überprüfen
         $this->form_show = false;
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->value_check[$i] != "") {
                 if ($FORM[$this->rfid][values][$i] == "") {
                     $errmsg .= "Bitte tragen Sie '" . $this->value_form[$i] . "' ein! <br>";
                     $this->form_show = true;
                 }
             }
         }
     }
     // --------------------------------- EDIT: SPEICHERN FALLS MÖGLICH
     if ($FORM[$this->rfid][submit] == 1 && $this->form_type == "edit") {
         if ($errmsg == "") {
             $aa = new sql();
             $aa->debugsql = 0;
             $aa->setTable($this->tbl_name);
             $aa->where($this->form_where);
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] == "picjpg") {
                     $folder = $this->type_value1[$i];
                     $foldertmp = $REX[INCLUDE_PATH] . "/../../ss_pics/";
                     $fname = $_FILES[FORM][name][$this->rfid][values][$i];
                     if ($fname != "") {
                         // neues file
                         $nfname = $this->checkFilename($fname, $folder);
                         if ($nfname[ext] == ".jpg") {
                             $ftmpname = $_FILES[FORM][tmp_name][$this->rfid][values][$i];
                             move_uploaded_file($ftmpname, $foldertmp . $nfname[nname]);
                             $this->resizeJPGImage($foldertmp . $nfname[nname], $folder . $nfname[nname], $this->type_value3[$i], $this->type_value4[$i]);
                             $FORM[$this->rfid][values][$i] = $nfname[nname];
                             $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                         }
                     } elseif ($FORM[$this->rfid][values][$i][delete] != "") {
                         $FORM[$this->rfid][values][$i] = "";
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } else {
                         $FORM[$this->rfid][values][$i] = $FORMVAL[$this->rfid][values][$i];
                     }
                 } elseif ($this->value_type[$i] == "file") {
                     $folder = $REX[INCLUDE_PATH] . "/../../ss_pics/";
                     $fname = $_FILES[FORM][name][$this->rfid][values][$i];
                     if ($fname != "") {
                         $nfname = $this->checkFilename($fname, $folder);
                         $ftmpname = $_FILES[FORM][tmp_name][$this->rfid][values][$i];
                         move_uploaded_file($ftmpname, $folder . $nfname[nname]);
                         $FORM[$this->rfid][values][$i] = $nfname[nname];
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } elseif ($FORM[$this->rfid][values][$i][delete] != "") {
                         $FORM[$this->rfid][values][$i] = "";
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } else {
                         $FORM[$this->rfid][values][$i] = $FORMVAL[$this->rfid][values][$i];
                     }
                 } elseif ($this->value_type[$i] == "multipleselectsql") {
                     // multipleselect
                     $ms = new sql();
                     $ms->query("delete from " . $this->type_value5[$i] . " where " . $this->type_value6[$i]);
                     if (is_Array($FORM[$this->rfid][values][$i])) {
                         reset($FORM[$this->rfid][values][$i]);
                         for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                             $val = current($FORM[$this->rfid][values][$i]);
                             $sql = "insert into " . $this->type_value5[$i] . " set " . $this->type_value6[$i] . ", " . $this->type_value7[$i] . "={$val}";
                             $ms->query($sql);
                             next($FORM[$this->rfid][values][$i]);
                         }
                     }
                 } elseif ($this->value_type[$i] == "subline" || $this->value_type[$i] == "empty") {
                 } elseif ($this->value_type[$i] == "datum") {
                     $tag = substr($FORM[$this->rfid][values][$i], 0, 2);
                     $monat = substr($FORM[$this->rfid][values][$i], 3, 2);
                     $jahr = substr($FORM[$this->rfid][values][$i], 6, 4);
                     $aa->setValue($this->value_tbl[$i], mktime(0, 0, 0, $monat, $tag, $jahr));
                 } else {
                     $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                 }
             }
             $aa->update();
             $msg = "Daten wurden gespeichert";
         } else {
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] != "multipleselectsql") {
                     $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
                 }
             }
         }
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->value_type[$i] != "multipleselectsql") {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             } else {
                 // multipleselect
                 if (is_Array($FORM[$this->rfid][values][$i])) {
                     reset($FORM[$this->rfid][values][$i]);
                     for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                         $val = $FORM[$this->rfid][values][$i][j];
                     }
                 }
             }
         }
     }
     // --------------------------------- ADD: SPEICHERN FALLS MÖGLICH
     if ($FORM[$this->rfid][submit] == 1 && $this->form_type == "add") {
         if ($errmsg == "") {
             $aa = new sql();
             $aa->debugsql = 0;
             $aa->setTable($this->tbl_name);
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] == "datum") {
                     $tag = substr($FORM[$this->rfid][values][$i], 0, 2);
                     $monat = substr($FORM[$this->rfid][values][$i], 3, 2);
                     $jahr = substr($FORM[$this->rfid][values][$i], 6, 4);
                     $aa->setValue($this->value_tbl[$i], mktime(0, 0, 0, $monat, $tag, $jahr));
                 } elseif ($this->value_type[$i] != "multipleselectsql" && $this->value_type[$i] != "subline" && $this->value_type[$i] != "empty") {
                     $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                 }
             }
             $aa->insert();
             $msg = "Daten wurden gespeichert";
             for ($i = 0; $i < $this->counter; $i++) {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             }
         } else {
             for ($i = 0; $i < $this->counter; $i++) {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             }
         }
     }
     // --------------------------------- FORMULAR
     if ($this->form_show || $this->ShowFormAlways) {
         $ausgabe = "<table width=" . $this->width . " cellpadding=6 cellspacing=1 border=0 >";
         $ausgabe .= "<form ENCTYPE='multipart/form-data' action='" . $this->url . "' method='" . $this->method . "' name='" . $this->formname . "'>" . $this->form_header;
         $ausgabe .= "<input type=hidden name=FORM[{$this->rfid}][submit] value=1>";
         // ---------------------- FORM REIHEN
         $colcounter = $this->cols[0];
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->cols[$i] != "") {
                 $colcounter = $this->cols[$i];
             } else {
                 $this->cols[$i] = $colcounter;
             }
             if ($maxcount < $this->cols[$i]) {
                 $maxcount = $this->cols[$i];
             }
         }
         $colcounter = 0;
         if ($errmsg != "") {
             $ausgabe .= "<tr><td colspan=" . ($maxcount + 2) . " class=warning>{$errmsg}<br>Daten wurden noch nicht gespeichert</td></tr>";
         }
         if ($msg != "") {
             $ausgabe .= "<tr><td colspan=" . ($maxcount + 2) . " class=warning>{$msg}</td></tr>";
         }
         for ($i = 0; $i < $this->counter; $i++) {
             $name = "FORM[{$this->rfid}][values][{$i}]";
             $value = $FORM[$this->rfid][values][$i];
             // echo "<br>$i $maxcounter ".$this->cols[$i]." ".$this->cols[$i-1]." ".$this->value_form[$i];
             $colcounter++;
             if ($this->cols[$i - 1] != $this->cols[$i]) {
                 if ($i != 0) {
                     $ausgabe .= "</tr>\n\n";
                 }
                 $ausgabe .= "\n\n<tr>";
                 $colcounter = 0;
             } else {
                 // anfang
                 // ende
                 if ($colcounter == $this->cols[$i]) {
                     $ausgabe .= "</tr>\n\n";
                     $ausgabe .= "\n\n<tr>";
                     $colcounter = 0;
                 }
             }
             $addcolspawn = 0;
             if ($this->cols[$i] < $maxcount) {
                 $addcolspawn = 2;
             }
             switch ($this->value_type[$i]) {
                 // ---------------------- MULTIPLE SQL SELECT AUSGABE
                 case "multipleselectsql":
                     if ($this->form_type == "add") {
                         $ausgabe .= "<td colspan=2>Multiple Felder nur bei edit möglich\t</td>";
                     } else {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ssql = new sql();
                         $ssql->setQuery($this->type_value1[$i]);
                         $ssel = new rexselect();
                         $ssel->setName($name . "[]");
                         $ssel->setMultiple(1);
                         $ssel->setSize($this->type_value4[$i]);
                         $ssel->setStyle("width:100%;");
                         for ($j = 0; $j < $ssql->getRows(); $j++) {
                             $ssel->addOption($ssql->getValue($this->type_value3[$i]), $ssql->getValue($this->type_value2[$i]));
                             $ssql->next();
                         }
                         // $selsql = new sql;
                         // $selsql->setQuery("select * from ".$this->type_value5[$i]." where ".$this->type_value6[$i]);
                         if (is_Array($FORM[$this->rfid][values][$i])) {
                             reset($FORM[$this->rfid][values][$i]);
                             for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                                 $ssel->setSelected(current($FORM[$this->rfid][values][$i]));
                                 next($FORM[$this->rfid][values][$i]);
                             }
                         }
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                         $ausgabe .= "";
                     }
                     break;
                     // ---------------------- SINGLE SQL SELECT AUSGABE
                 // ---------------------- SINGLE SQL SELECT AUSGABE
                 case "singleselectsql":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ssql = new sql();
                     $ssql->setQuery($this->type_value1[$i]);
                     $ssel = new rexselect();
                     $ssel->setName($name);
                     $ssel->setStyle("width:100%;");
                     if ($this->value_check[$i] != 1) {
                         $ssel->addOption("----------------- keine Angabe -----------------", "0");
                     }
                     for ($j = 0; $j < $ssql->getRows(); $j++) {
                         $ssel->addOption($ssql->getValue($this->type_value3[$i]), $ssql->getValue($this->type_value2[$i]));
                         $ssql->next();
                     }
                     $ssel->setSelected($value);
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- SINGLE SELECT AUSGABE
                 // ---------------------- SINGLE SELECT AUSGABE
                 case "singleselect":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $stype = explode("|", $this->type_value1[$i]);
                     $ssel = new rexselect();
                     $ssel->setName($name);
                     $ssel->setStyle("width:100%;");
                     for ($j = 0; $j < count($stype); $j++) {
                         $svalue = $stype[$j];
                         $j++;
                         $sname = $stype[$j];
                         $ssel->addOption($sname, $svalue);
                     }
                     $ssel->setSelected($value);
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- Checkbox
                 // ---------------------- Checkbox
                 case "checkbox":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=checkbox name={$name} value=1 ";
                     if ($value == 1 || $value == "on") {
                         $ausgabe .= "checked";
                     }
                     $ausgabe .= "></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- PIC/JPG
                 // ---------------------- PIC/JPG
                 case "picjpg":
                     if ($value != "") {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><table cellpadding=2 cellspacing=0><tr><td><input name={$name} type=file size=10></td><td rowspan=2>&nbsp;&nbsp;&nbsp;</td><td rowspan=2><img src=" . $this->type_value2[$i] . "{$value} width=" . $this->type_value3[$i] . " height=" . $this->type_value4[$i] . "></td></tr>";
                         $ausgabe .= "<tr><td valign=middle align=left class=grey><input type=checkbox name=FORM[{$this->rfid}][values][{$i}][delete]>&nbsp;&nbsp;Datei löschen </td></tr></table>";
                         $ausgabe .= "</td>";
                     } else {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input name={$name} type=file size=10></td>";
                         $ausgabe .= "";
                     }
                     break;
                     // ---------------------- FILE
                 // ---------------------- FILE
                 case "file":
                     $myout = "";
                     if ($value != "") {
                         $myout = "\n\n<table><tr>";
                         $myout .= "<td valign=middle align=right class=grey><input type=checkbox name=FORM[{$this->rfid}][values][{$i}][delete]></td>";
                         $myout .= "<td class=grey>Datei löschen <a href=" . $this->type_value2[$i] . "{$value} target=_blank>{$value}</a></td>";
                         $myout .= "</tr></table>";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "<br>{$myout}</td>";
                     $ausgabe .= "<td class=grey><input name={$name} type=file size=10></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- HTMLAREA
                 // ---------------------- HTMLAREA
                 case "htmlarea":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%; height:100px;";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=top class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . REXHTMLAREA($name, $value) . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- TEXTAREA
                 // ---------------------- TEXTAREA
                 case "textarea":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%; height:100px;";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=top class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><textarea name={$name} cols=30 rows=5 style='" . $this->type_value1[$i] . "'>{$value}</textarea></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- HIDDEN
                 // ---------------------- HIDDEN
                 case "hidden":
                     $ausgabe .= "<input type=hidden name={$name} value=\"" . $this->type_value1[$i] . "\">";
                     break;
                     // ---------------------- TEXT
                 // ---------------------- TEXT
                 case "text":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%;";
                     }
                     if ($this->type_value2[$i] != "") {
                         $this->type_value2[$i] = "maxlength=" . $this->type_value2[$i];
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" " . $this->type_value2[$i] . " size=20 style='" . $this->type_value1[$i] . "'></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- DATUM
                 // ---------------------- DATUM
                 case "datum":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%;";
                     }
                     if ($this->type_value2[$i] != "") {
                         $this->type_value2[$i] = "maxlength=" . $this->type_value2[$i];
                     }
                     if (!preg_match("![0-9]{2}\\.[0-9]{2}\\.[0-9]{4}!", $value)) {
                         $value = date("d.m.Y", $value);
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" " . $this->type_value2[$i] . " size=20 style='" . $this->type_value1[$i] . "'></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- Überschrift
                 // ---------------------- Überschrift
                 case "subline":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<th valign=middle align=" . $this->value_tbl[$i] . " colspan=" . (2 + $addcolspawn) . ">" . $this->value_form[$i] . "</th>\n";
                     $ausgabe .= "\n";
                     break;
                     // ---------------------- Überschrift
                 // ---------------------- Überschrift
                 case "empty":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey colspan=" . (2 + $addcolspawn) . ">&nbsp;</td>\n";
                     $ausgabe .= "\n";
                     break;
                     // ---------------------- STANDARD AUSGABE - TEXT
                 // ---------------------- STANDARD AUSGABE - TEXT
                 default:
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" size=20 style='width:100%'></td>";
                     $ausgabe .= "";
             }
         }
         $ausgabe .= "</tr>";
         // ---------------------- SUBMIT
         $ausgabe .= "<tr>\n\n";
         $ausgabe .= "<td class=dgrey  width=" . $this->labelwidth . " >&nbsp;</td>\n\n";
         $ausgabe .= "<td align=left class=dgrey colspan=" . ($maxcount + 1) . "><input type=submit value='" . $this->submit_value . "'></td>\n\n";
         $ausgabe .= "</tr>\n\n";
         $ausgabe .= "</form></table>\n\n";
         return $ausgabe;
     } else {
         if ($msg != "") {
             $ausgabe = "<table width=" . $this->width . " cellpadding=6 cellspacing=1 border=0 bgcolor=#ffffff>";
             $ausgabe .= "<tr><td class=warning>{$msg}</td></tr>";
             $ausgabe .= "</table>";
             return $ausgabe;
         }
     }
 }
         $ITPL->setValue("active", $active);
         $ITPL->setValue("content", $content);
         $ITPL->insert();
         $template_id = $ITPL->last_insert_id;
         $message = $I18N->msg("template_added");
     } else {
         if (!isset($active)) {
             $active = 0;
         }
         $TMPL = new sql();
         $TMPL->setTable("rex_template");
         $TMPL->where("id='{$template_id}'");
         $TMPL->setValue("name", $templatename);
         $TMPL->setValue("content", $content);
         $TMPL->setValue("active", $active);
         $TMPL->update();
         $message = $I18N->msg("template_added");
     }
     $gt = new sql();
     $gt->setQuery("SELECT * FROM rex_template WHERE id = '{$template_id}'");
     $fp = fopen($REX['INCLUDE_PATH'] . "/generated/templates/" . $template_id . ".template", "w");
     fputs($fp, $gt->getValue("content"));
     fclose($fp);
     if (isset($goon) and $goon != "") {
         $function = "edit";
         $save = "nein";
     } else {
         $function = "";
     }
 }
 if ($save != "ja") {
    print "</td></tr>";
    print "</table>";
    print "</form>";
}
// *************************************** EXTRA FUNCTIONS
if ($PERMALL && isset($media_method) and $media_method == 'updatecat_selectedmedia') {
    if (is_array($_POST["selectedmedia"])) {
        foreach ($_POST["selectedmedia"] as $file_id) {
            $db = new sql();
            // $db->debugsql = true;
            $db->setTable($REX['TABLE_PREFIX'] . 'file');
            $db->where("file_id='{$file_id}'");
            $db->setValue('category_id', $rex_file_category);
            $db->setValue("updatedate", time());
            $db->setValue("updateuser", $REX_USER->getValue("login"));
            $db->update();
            $msg = $I18N->msg('pool_selectedmedia_moved');
        }
    } else {
        $msg = $I18N->msg('pool_selectedmedia_error');
    }
}
if ($PERMALL && isset($media_method) and $media_method == 'delete_selectedmedia') {
    if (is_array($_POST["selectedmedia"])) {
        $msg = "";
        foreach ($_POST["selectedmedia"] as $file_id) {
            //kopiet von Dateidetails delete_file
            $gf = new sql();
            $gf->setQuery("select * from " . $REX['TABLE_PREFIX'] . "file where file_id='{$file_id}'");
            if ($gf->getRows() == 1) {
                $file_name = $gf->getValue("filename");
 function write()
 {
     global $REX, $REX_USER;
     $sql = new sql();
     $sql->setTable($REX['TABLE_PREFIX'] . '51_cache_article');
     foreach ($this->vars as $key => $value) {
         $sql->setValue($key, $value);
     }
     $user = $REX['REDAXO'] ? $REX_USER->getValue('login') : '';
     if ($this->exists()) {
         $sql->where('article_id=' . $this->article_id . ' AND clang=' . $this->clang);
         $sql->setValue('updatedate', time());
         $sql->setValue('updateuser', $user);
         $sql->update();
     } else {
         $sql->setValue('article_id', $this->article_id);
         $sql->setValue('clang', $this->clang);
         $sql->setValue('createdate', time());
         $sql->setValue('createuser', $user);
         $sql->insert();
     }
 }
示例#29
0
         $sql->insert($table, $campos, $values, $msg);
     } else {
         $campos = "`email`='" . $_POST['email'] . "',`nome`='" . $_POST['nome'] . "', `status`='" . $_POST['status'] . "', `usuario`='" . $_POST['usuario'] . "' ";
         $where = "cod_usuario='" . $_POST['cod_usuario'] . "'";
         $msg = "S";
         $sql->update($table, $campos, $where, $msg);
     }
 }
 if ($_POST['act'] == "enviar_senha") {
     include "config.php";
     $senha = substr(md5(mt_rand(1, 10000) . date("Y-m-d H:i:s")), 0, 6);
     $sql = new sql();
     $table = "cad_usuario";
     $campos = "senha='" . $senha . "'";
     $where = "cod_usuario='" . $_POST['cod_usuario'] . "'";
     $sql->update($table, $campos, $where, 'N');
     $select = "\n\t\t\t\t\tselect \n\t\t\t\t\t\t*\n\t\t\t\t\tfrom \n\t\t\t\t\t\t" . $schema . ".cad_usuario \n\t\t\t\t\t\t\n\t\t\t\t\twhere  \n\t\t\t\t\t\t`cad_usuario`.`cod_usuario` = " . $_POST['cod_usuario'] . ";";
     $resultado = mysql_query($select, $conexao) or die(mysql_error());
     while ($row = mysql_fetch_array($resultado)) {
         $username = $row['usuario'];
         $_email = $row['email'];
     }
     $email = new email();
     $email->enviar_senha($_email, $username, $senha);
     echo "Uma nova senha foi encaminhada para o seu email.";
 }
 if (isset($_POST) and $_POST['cod_usuario'] != "") {
     if ($_POST['act'] == "acesso_modulos") {
         include "config.php";
         if ($_POST['checked'] == 'true') {
             $cheked = '1';
 function save_css($cssFile = false, $cssDir, $styles)
 {
     $style_arr = $this->parse_css($styles);
     global $REX_USER;
     $FILESQL = new sql();
     $FILESQL->setQuery("select * from rex_file where filename='{$cssFile}'");
     if ($FILESQL->getRows() == 1) {
         $openFile = fopen($cssDir . $cssFile, "w");
         fputs($openFile, $styles);
         fclose($openFile);
         $FILESIZE = filesize($cssDir . $cssFile);
         //if($upload) {
         @chmod($cssDir . "/{$NFILENAME}", 0777);
         //$FILESQL->debugsql=1;
         $FILESQL->setTable("rex_file");
         $FILESQL->where("filename='{$cssFile}'");
         //$FILESQL->setValue("filetype",$FILETYPE);
         $FILESQL->setValue("filesize", $FILESIZE);
         $FILESQL->setValue("updatedate", time());
         $FILESQL->setValue("updateuser", $REX_USER->getValue("login"));
         $FILESQL->update();
         $ok = 1;
         //}
     } elseif ($FILESQL->getRows() > 1) {
         $this->errorMsg .= 'Es gibt mehere Dateinamen mit ' . $cssFile . ' in der Datenbank';
     } else {
         $this->errorMsg .= 'Dateinamen ' . $cssFile . ' im Medienpool nicht gefunden';
     }
 }