Posted by alvan on Wed 9th Apr 12:50 (modification of post by Anonymous view diff)
diff | download | new post
- <?php
- include("include/config.php");
- // check
- $row = $db->fetch($db->query("select * from stiri where id='$id'"));
- } else
- $id = false;
- // config
- $t->set_file('tpl_main','adauga.stiri.tpl');
- 'NUME_BUTON' => ($id)?'Modifica':'Adauga',
- 'MSG' => '',
- ));
- // categorii
- $t->set_block('tpl_main','cat','var_cat');
- $cat = $db->queryAll("select * from cat where activ='1' order by `order` asc");
- foreach ($cat as $c) {
- $selected = ($id and $row['cat']==$c['id'])?'selected="selected"':'';
- 'CAT_ID' => $c['id'],
- 'CAT_SELECTED' => $selected
- ));
- $t->parse('var_cat','cat',true);
- }
- } else {
- $t->set_var('var_cat','Nici o categorie activa.');
- }
- // oameni
- $t->set_block('tpl_main','oameni','var_oameni');
- $oameni = $db->queryAll("select * from oameni_politici where activ='1' order by nume asc");
- foreach ($oameni as $o) {
- 'O_ID' => $o['id'],
- 'O_SELECTED' => $selected
- ));
- $t->parse('var_oameni','oameni',true);
- }
- } else {
- $t->set_var('var_oameni','Nici un om politic activ.');
- }
- // adaugare/modificare
- $error = '';
- $error .= 'Va rugam introduceti un titlu.<br />';
- if (!$id) {
- $ident = ident($db->escape($_POST['titlu']));
- $ident_check = $db->queryAll("select id from stiri where ident='$ident'");
- $error .= 'Va rugam introduceti un alt titlu, acesta este deja activ in baza de date.<br />';
- if ($error=='') {
- $movie = 0;
- $titlu = $db->escape($_POST['titlu']);
- $ident = ident($titlu);
- $cat = $db->escape($_POST['cat']);
- $continut = $db->escape($_POST['continut']);
- $imagine = $_FILES['imagine']['name'];
- $film = $_FILES['film']['name'];
- if ($imagine!='') {
- $upl = new Upload('foto');
- $imagine = $upl->uploadFile($_FILES['imagine'],'../upload/imagini/',200,100);
- }
- $oameni = $_POST['oameni'];
- } else
- $oameni = '';
- if ($film!='') {
- exec("/usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' -qscale 7 -ar 22050 -ab 32 -f flv -s 480x360 ../upload/filme/".$cat."/".$ident."/movie.flv ; /usr/bin/flvtool2 -U stdin ../upload/filme/".$cat."/".$ident."/movie.flv ; /usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' -vframes 1 -ss 00:00:15 -an -vcodec png -f rawvideo -s 480x360 ../upload/filme/".$cat."/".$ident."/image.png ; /usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' -vframes 1 -ss 00:00:15 -an -vcodec png -f rawvideo -s 480x360 ../upload/filme/".$cat."/".$ident."/thumb.png ; /usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' &> ../upload/filme/".$cat."/".$ident."/movie.info");
- $upl = new Upload;
- $imagine = $upl->resize("../upload/filme/".$cat."/".$ident."/image.png","../upload/filme/".$cat."/".$ident."/thumb.png",100);
- $movie = 1;
- }
- $db->query("insert into stiri set cat='$cat', titlu='$titlu', movie='$movie', text='$continut', imagine='$imagine', oameniPolitici='$oameni', ora='$ora', date=NOW(), ident='$ident'");
- redirect('vizualizare.stiri.php');
- } else {
- 'MSG' => $error,
- 'TITLU' => $_POST['titlu'],
- 'CONTINUT' => $_POST['continut']
- ));
- }
- } else {
- $ident = ident($db->escape($_POST['titlu']));
- $ident_check = $db->queryAll("select id from stiri where ident='$ident' and id!='$id'");
- $error .= 'Va rugam introduceti un alt titlu, acesta este deja activ in baza de date.<br />';
- if ($error=='') {
- $movie = '';
- $image = '';
- $titlu = $db->escape($_POST['titlu']);
- $ident = ident($titlu);
- $cat = $db->escape($_POST['cat']);
- $continut = $db->escape($_POST['continut']);
- $imagine = $_FILES['imagine']['name'];
- $film = $_FILES['film']['name'];
- $old = $db->fetch("select cat,ident from stiri where id='$id'");
- if ($imagine!='') {
- if ($row['imagine']!='') {
- }
- $upl = new Upload('foto');
- $imagine = $upl->uploadFile($_FILES['imagine'],'../upload/imagini/',200,100);
- $image = ", imagine='$imagine'";
- }
- $oameni = $_POST['oameni'];
- } else
- $oameni = '';
- if ($film!='') {
- if ($row['movie']==1) {
- full_rmdir("../upload/filme/".$cat."/".$ident);
- } else {
- }
- exec("/usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' -qscale 7 -ar 22050 -ab 32 -f flv -s 480x360 ../upload/filme/".$cat."/".$ident."/movie.flv ; /usr/bin/flvtool2 -U stdin ../upload/filme/".$cat."/".$ident."/movie.flv ; /usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' -vframes 1 -ss 00:00:15 -an -vcodec png -f rawvideo -s 480x360 ../upload/filme/".$cat."/".$ident."/image.png ; /usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' -vframes 1 -ss 00:00:15 -an -vcodec png -f rawvideo -s 100x100 ../upload/filme/".$cat."/".$ident."/thumb.png ; /usr/bin/ffmpeg -y -i '".$_FILES['film']['tmp_name']."' &> ../upload/filme/".$cat."/".$ident."/movie.info");
- $upl = new Upload;
- $imagine = $upl->resize("../upload/filme/".$cat."/".$ident."/image.png","../upload/filme/".$cat."/".$ident."/thumb.png",100);
- $movie = ", movie='1'";
- } elseif ($row['movie']==1 and ($old['ident']!=$ident or $old['cat']!=$cat)) {
- }
- $db->query("update stiri set cat='$cat', titlu='$titlu' $movie , text='$continut' $image , oameniPolitici='$oameni', ident='$ident' where id='$id'");
- redirect('vizualizare.stiri.php');
- } else {
- 'MSG' => $error,
- 'TITLU' => $_POST['titlu'],
- 'CONTINUT' => $_POST['continut']
- ));
- }
- }
- }
- // html
- getMenu();
- getHeader(1);
- $t->pparse('','tpl_main');
- getFooter();
- ?>
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.