Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: HElp Pagalbos

Parašė cipis· 2008 Lie. 31 17:07:34
#19

sakau kad sugadintas modas

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Coding by BadBoy aka GoogleDude
| Email: webmaster@googlecityfourms.com
| Support: http://www.googlecityforums.com
+----------------------------------------------------+
| Original Coding developed by CrappoMan
| email: simonpatterson@dsl.pipex.com
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once ADMIN."navigation.php";
require_once INCLUDES."photo_functions_include.php";
include LOCALE.LOCALESET."admin/videos.php";

define("SAFEMODE", @ini_get("safe_mode") ? true : false);

if (!checkrights("PH") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php");
if (!isset($album_id) && !isNum($album_id)) fallback("videoalbums.php".$aidlink);
if (isset($video_id) && !isNum($video_id)) fallback(FUSION_SELF.$aidlink);
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
if (!isset($action)) $action = "";

if (isset($status)) {
   if ($status == "savepn") {
      $title = $locale['400'];
      $message = "<b>".$locale['410']."</b>";
   } elseif ($status == "savepu") {
      $title = $locale['401'];
      $message = "<b>".$locale['411']."</b>";
   } elseif ($status == "delp") {
      $title = $locale['402'];
      $message = "<b>".$locale['412']."</b>";
   } elseif ($status == "delpd") {
      $title = $locale['402'];
      $message = "<b>".$locale['413']."</b>";
   } elseif ($status == "savepe") {
      $title = $locale['420'];
      $message = "<b>".$locale['421']."</b><br>\n";
      if ($error == 1) { $message .= $locale['422']; }
      elseif ($error == 2) { $message .= sprintf($locale['423'], parsebytesize($settings['photo_max_b'])); }
      elseif ($error == 3) { $message .= $locale['424']; }
      elseif ($error == 4) { $message .= sprintf($locale['425'], $settings['photo_max_w'], $settings['photo_max_h']); }
   }
   opentable($title);
   echo "<div align='center'>".$message."</div>\n";
   closetable();
   tablebreak();
}

if (isset($_POST['cancel'])) {
   redirect(FUSION_SELF.$aidlink."&album_id=$album_id");
}

define("VIDEODIR", VIDEOS.(!SAFEMODE ? "album_".$album_id."/" : ""));

if ($action == "deletepic") {
   $data = dbarray(dbquery("SELECT video_filename,video_thumb1,video_thumb2 FROM ".$db_prefix."videos WHERE video_id='$video_id'"));
   $result = dbquery("UPDATE ".$db_prefix."videos SET video_filename='', video_thumb1='', video_thumb2='' WHERE video_id='$video_id'");
   @unlink(VIDEODIR.$data['video_filename']);
   @unlink(VIDEODIR.$data['video_thumb1']);
   if ($data['video_thumb2']) @unlink(VIDEODIR.$data['video_thumb2']);
   redirect(FUSION_SELF.$aidlink."&status=delp&album_id=$album_id");
} elseif ($action == "delete") {
   $data = dbarray(dbquery("SELECT album_id,video_filename,video_thumb1,video_thumb2,video_order FROM ".$db_prefix."videos WHERE video_id='$video_id'"));
   $result = dbquery("UPDATE ".$db_prefix."videos SET video_order=(video_order-1) WHERE video_order>'".$data['video_order']."' AND album_id='$album_id'");
   $result = dbquery("DELETE FROM ".$db_prefix."videos WHERE video_id='$video_id'");
   $result = dbquery("DELETE FROM ".$db_prefix."comments WHERE comment_item_id='$video_id' and comment_type='V'");
   $result = dbquery("DELETE FROM ".$db_prefix."ratings WHERE rating_item_id='$video_id' and rating_type='V'");
   if ($data['video_filename']) @unlink(VIDEODIR.$data['video_filename']);
   if ($data['video_thumb1']) @unlink(VIDEODIR.$data['video_thumb1']);
   if ($data['video_thumb2']) @unlink(VIDEODIR.$data['video_thumb2']);
   redirect(FUSION_SELF.$aidlink."&status=delpd&album_id=$album_id");
} elseif($action=="mup") {
   if (!isNum($order)) fallback(FUSION_SELF.$aidlink."&album_id=$album_id");
   $data = dbarray(dbquery("SELECT video_id FROM ".$db_prefix."videos WHERE album_id='$album_id' AND video_order='$order'"));
   $result = dbquery("UPDATE ".$db_prefix."videos SET video_order=video_order+1 WHERE video_id='".$data['video_id']."'");
   $result = dbquery("UPDATE ".$db_prefix."videos SET video_order=video_order-1 WHERE video_id='$video_id'");
   $rowstart = $order > $settings['thumbs_per_page'] ? ((ceil($order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0";
   redirect(FUSION_SELF.$aidlink."&album_id=$album_id&rowstart=$rowstart");
} elseif ($action=="mdown") {
   if (!isNum($order)) fallback(FUSION_SELF.$aidlink."&album_id=$album_id");
   $data = dbarray(dbquery("SELECT video_id FROM ".$db_prefix."videos WHERE album_id='$album_id' AND video_order='$order'"));
   $result = dbquery("UPDATE ".$db_prefix."videos SET video_order=video_order-1 WHERE video_id='".$data['video_id']."'");
   $result = dbquery("UPDATE ".$db_prefix."videos SET video_order=video_order+1 WHERE video_id='$video_id'");
   $rowstart = $order > $settings['thumbs_per_page'] ? ((ceil($order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0";
   redirect(FUSION_SELF.$aidlink."&album_id=$album_id&rowstart=$rowstart");
} elseif (isset($_POST['save_video'])) {
   $error="";
   $video_title = stripinput($_POST['video_title']);
   $video_description = stripinput($_POST['video_description']);
   $video_order = isNum($_POST['video_order']) ? $_POST['video_order'] : "";
   $video_video = stripinput($_POST['video_video']);
   $video_comments = isset($_POST['video_comments']) ? "1" : "0";
   $video_ratings = isset($_POST['video_ratings']) ? "1" : "0";
   $video_file = ""; $video_thumb1 = ""; $video_thumb2 = "";
   if (is_uploaded_file($_FILES['video_pic_file']['tmp_name'])) {
      $video_types = array(".gif",".jpg",".jpeg",".png");
      $video_pic = $_FILES['video_pic_file'];
      $video_name = strtolower(substr($video_pic['name'], 0, strrpos($video_pic['name'], ".")));
      $video_ext = strtolower(strrchr($video_pic['name'],"."));
      $video_dest = VIDEODIR;
      if (!preg_match("/^[-0-9A-Z_\.\[\]]+$/i", $video_pic['name'])) {
         $error = 1;
      } elseif ($video_pic['size'] > $settings['photo_max_b']){
         $error = 2;
      } elseif (!in_array($video_ext, $video_types)) {
         $error = 3;
      } else {
         $video_file = image_exists($video_dest, $video_name.$video_ext);
         move_uploaded_file($video_pic['tmp_name'], $video_dest.$video_file);
         chmod($video_dest.$video_file, 0644);
         $imagefile = @getimagesize($video_dest.$video_file);
         if ($imagefile[0] > $settings['photo_max_w'] || $imagefile[1] > $settings['photo_max_h']) {
            $error = 4;
            unlink($video_dest.$video_file);
         } else {
            $video_thumb1 = image_exists($video_dest, $video_name."_t1".$video_ext);
            createthumbnail($imagefile[2], $video_dest.$video_file, $video_dest.$video_thumb1, $settings['thumb_w'], $settings['thumb_h']);
            if ($imagefile[0] > $settings['photo_w'] || $imagefile[1] > $settings['photo_h']) {
               $video_thumb2 = image_exists($video_dest, $video_name."_t2".$video_ext);
               createthumbnail($imagefile[2], $video_dest.$video_file, $video_dest.$video_thumb2, $settings['photo_w'], $settings['photo_h']);
            }
         }
      }
   }
   if (!$error) {
      if ($action == "edit") {
         $update_videos = $video_file ? "video_filename='$video_file', video_thumb1='$video_thumb1', video_thumb2='$video_thumb2', " : "";
         $result = dbquery("UPDATE ".$db_prefix."videos SET video_title='$video_title', video_description='$video_description', video_video='$video_video', ".$update_videos."video_datestamp='".time()."', video_allow_comments='$video_comments', video_allow_ratings='$video_ratings' WHERE video_id='$video_id'");
         $rowstart = $video_order > $settings['thumbs_per_page'] ? ((ceil($video_order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0";
         redirect(FUSION_SELF.$aidlink."&status=savepu&album_id=$album_id&rowstart=$rowstart");
      }else{
         if (!$video_order) $video_order = dbresult(dbquery("SELECT MAX(video_order) FROM ".$db_prefix."videos WHERE album_id='$album_id'"), 0) + 1;
         $result = dbquery("UPDATE ".$db_prefix."videos SET video_order=(video_order+1) WHERE video_order>='$video_order' AND album_id='$album_id'");
         $result = dbquery("INSERT INTO ".$db_prefix."videos (album_id, video_title, video_description, video_video, video_filename, video_thumb1, video_thumb2, video_datestamp, video_user, video_views, video_order, video_allow_comments, video_allow_ratings) VALUES ('$album_id', '$video_title', '$video_description', '$video_video', '$video_file', '$video_thumb1', '$video_thumb2', '".time()."', '".$userdata['user_id']."', '0', '$video_order', '$video_comments', '$video_ratings')");
         $rowstart = $video_order > $settings['thumbs_per_page'] ? ((ceil($video_order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0";
         redirect(FUSION_SELF.$aidlink."&status=savepn&album_id=$album_id&rowstart=$rowstart");
      }
   }
   if ($error) {
      redirect(FUSION_SELF.$aidlink."&status=savepe&error=$error&album_id=$album_id");
   }
}else{
   if ($action == "edit") {
      $result = dbquery("SELECT * FROM ".$db_prefix."videos WHERE video_id='$video_id'");
      $data = dbarray($result);
      $video_title = $data['video_title'];
      $video_description = $data['video_description'];
      $video_video = $data['video_video'];
      $video_filename = $data['video_filename'];
      $video_thumb1 = $data['video_thumb1'];
      $video_thumb2 = $data['video_thumb2'];
      $video_order = $data['video_order'];
      $video_comments = $data['video_allow_comments'] == "1" ? " checked" : "";
      $video_ratings = $data['video_allow_ratings'] == "1" ? " checked" : "";
      $formaction = FUSION_SELF.$aidlink."&amp;action=edit&amp;album_id=$album_id&amp;video_id=".$data['video_id'];
      opentable($locale['400']." - ($video_id - $video_title)");
   }else{
      $video_title = "";
      $video_description = "";
      $video_video = "";
      $video_filename = "";
      $video_thumb1 = "";
      $video_thumb2 = "";
      $video_order = "";
      $video_comments = " checked";
      $video_ratings = " checked";
      $formaction = FUSION_SELF.$aidlink."&amp;album_id=$album_id";
      opentable($locale['401']);
   }
   echo "<form name='inputform' method='post' action='$formaction' enctype='multipart/form-data'>
   <table align='center' cellspacing='0' cellpadding='0'>
<tr>
<td class='tbl'>".$locale['440']."</td>
<td class='tbl'><input type='textbox' name='video_title' value='$video_title' maxlength='100' class='textbox' style='width:330px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>".$locale['441']."</td>
<td class='tbl'><textarea name='video_description' rows='5' class='textbox' style='width:330px;'>$video_description</textarea><br>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('video_description', '', '');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('video_description', '', '');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('video_description', '', '');\">
<input type='button' value='url' class='button' style='width:30px;' onClick=\"addText('video_description', '[url]', '[/url]');\">
<input type='button' value='mail' class='button' style='width:35px;' onClick=\"addText('video_description', '[mail]', '[/mail]');\">
<input type='button' value='img' class='button' style='width:30px;' onClick=\"addText('video_description', '[img]', '[/img]');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('video_description', '
', '
');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('video_description', '', '');\">
<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('video_description', '
', '
');\">
</td>
</tr>
<tr>\n";
   if (!$action) {
      echo "<td class='tbl'>".$locale['442']."</td>
<td class='tbl'><input type='textbox' name='video_order' value='$video_order' maxlength='5' class='textbox' style='width:40px;'></td>
</tr>\n";
   }
   if ($action && $video_thumb1 && file_exists(VIDEODIR.$video_thumb1)) {
      echo "<tr>\n<td valign='top' class='tbl'></td>
<td class='tbl'><img src='".VIDEODIR.$video_thumb1."' border='1' alt='$video_thumb1'></td>
</tr>\n";
   }
   echo "<tr>\n<td valign='top' class='tbl'>";
   if ($action && $video_thumb2 && file_exists(VIDEODIR.$video_thumb2)) {
      echo "<br>\n<a class='small' href='".FUSION_SELF.$aidlink."&amp;action=deletepic&amp;album_id=$album_id&amp;video_id=$video_id'>".$locale['470']."</a></td>
<td class='tbl'>";
   } elseif ($action && $video_filename && file_exists(VIDEODIR.$video_filename)) {
      echo "<br>\n<a class='small' href='".FUSION_SELF.$aidlink."&amp;action=deletepic&amp;album_id=$album_id&amp;video_id=$video_id'>".$locale['470']."</a></td>
<td class='tbl'>";
   } else {
      echo "</td>\n<td class='tbl'><input type='file' name='video_pic_file' class='textbox' style='width:250px;'>\n";
   }

   echo "<tr><td class='tbl'>".$locale['449'].":</td><td class='tbl'><input type='textbox' name='video_video' value=\"$video_video\" maxlength='100' class='textbox' style='width:250px;'></td></tr>\n";

   echo "</td>
</tr>
<tr>
<td colspan='2' align='center' class='tbl'><br>
<input type='checkbox' name='video_comments' value='yes'$video_comments> ".$locale['445']."<br>
<input type='checkbox' name='video_ratings' value='yes'$video_ratings> ".$locale['446']."<br><br>
<input type='submit' name='save_video' value='".$locale['447']."' class='button'>\n";
   if ($action) {
      echo "<input type='submit' name='cancel' value='".$locale['448']."' class='button'>\n";
      echo "<input type='hidden' name='video_order' value='$video_order'>\n";
   }
   echo "</td></tr>\n</table></form>\n";
   closetable();
}
tablebreak();
opentable($locale['460']);
$rows = dbcount("(video_id)", "videos", "album_id='$album_id'");
if ($rows) {
   $result = dbquery(
      "SELECT tp.*, tu.user_id,user_name FROM ".$db_prefix."videos tp
      LEFT JOIN ".$db_prefix."users tu ON tp.video_user=tu.user_id
      WHERE album_id='$album_id' ORDER BY video_order
      LIMIT $rowstart,".$settings['thumbs_per_page']
   );
   $counter = 0; $k = ($rowstart == 0 ? 1 : $rowstart + 1);
   echo "<table cellpadding='0' cellspacing='1' width='100%'>\n<tr>\n";
   while ($data = dbarray($result)) {
      $up = ""; $down = "";
      if ($rows != 1){
         $orderu = $data['video_order'] - 1;
         $orderd = $data['video_order'] + 1;
         if ($k == 1) {
            $down = " &middot;\n<a href='".FUSION_SELF.$aidlink."&amp;album_id=$album_id&amp;rowstart=$rowstart&amp;action=mdown&amp;order=$orderd&amp;video_id=".$data['video_id']."'><img src='".THEME."images/right.gif' alt='".$locale['469']."' title='".$locale['469']."' border='0' style='vertical-align:middle'></a>\n";
         } elseif ($k < $rows){
            $up = "<a href='".FUSION_SELF.$aidlink."&amp;album_id=$album_id&amp;rowstart=$rowstart&amp;action=mup&amp;order=$orderu&amp;video_id=".$data['video_id']."'><img src='".THEME."images/left.gif' alt='".$locale['468']."' title='".$locale['468']."' border='0' style='vertical-align:middle'></a> &middot;\n";
            $down = " &middot;\n<a href='".FUSION_SELF.$aidlink."&amp;album_id=$album_id&amp;rowstart=$rowstart&amp;action=mdown&amp;order=$orderd&amp;video_id=".$data['video_id']."'><img src='".THEME."images/right.gif' alt='".$locale['469']."' title='".$locale['469']."' border='0' style='vertical-align:middle'></a>\n";
         } else {
            $up = "<a href='".FUSION_SELF.$aidlink."&amp;album_id=$album_id&amp;rowstart=$rowstart&amp;action=mup&amp;order=$orderu&amp;video_id=".$data['video_id']."'><img src='".THEME."images/left.gif' alt='".$locale['468']."' title='".$locale['468']."' border='0' style='vertical-align:middle'></a> &middot;\n";
         }
      }
      if ($counter != 0 && ($counter % $settings['thumbs_per_row'] == 0)) echo "</tr>\n<tr>\n";
      echo "<td align='center' valign='top' class='tbl' style='white-space:nowrap'>\n";
      echo "<b>".$data['video_title']."</b><br><br>\n";
      if ($data['video_thumb1'] && file_exists(VIDEODIR.$data['video_thumb1'])){
         echo "<img src='".VIDEODIR.$data['video_thumb1']."' alt='".$locale['461']."' border='0'>";
      } else {
         echo $locale['462'];
      }
      echo "<br>".$data['video_video']."";
      echo "<br><br>\n<span class='small'>".$up;
      echo "<a href='".FUSION_SELF.$aidlink."&amp;action=edit&amp;album_id=$album_id&amp;video_id=".$data['video_id']."'>".$locale['469']."</a> &middot;\n";
      echo "<a href='".FUSION_SELF.$aidlink."&amp;action=delete&amp;album_id=$album_id&amp;video_id=".$data['video_id']."'>".$locale['471']."</a> ".$down;
      echo "<br><br>\n".$locale['463'].showdate("shortdate", $data['video_datestamp'])."<br>\n";
      echo $locale['464']."<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a><br>\n";
      echo $locale['465'].$data['video_views']."<br>\n";
      echo $locale['466'].dbcount("(comment_id)", "comments", "comment_type='V' AND comment_item_id='".$data['video_id']."'")."</span><br>\n";
      echo "</td>\n";
      $counter++; $k++;
   }
   echo "</tr>\n<tr>\n<td align='center' colspan='".$settings['thumbs_per_row']."' class='tbl2'><a href='videoalbums.php".$aidlink."'>".$locale['481']."</a></td>\n</tr>\n</table>\n";
   if ($rows > $settings['thumbs_per_page']) echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,$settings['thumbs_per_page'],$rows,3,FUSION_SELF.$aidlink."&amp;album_id=$album_id&amp;")."\n</div>\n";
}else{
   echo "<center>".$locale['480']."</center>\n";
}
closetable();

echo "</td>\n";
require_once BASEDIR."footer.php";
?>



Redagavo cipis· 2008 Lie. 31 17:07:56