diff --git a/sql/cb_photos.sql b/sql/cb_photos.sql
new file mode 100644
index 00000000..8046c698
--- /dev/null
+++ b/sql/cb_photos.sql
@@ -0,0 +1,155 @@
+-- phpMyAdmin SQL Dump
+-- version 3.2.0.1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Nov 06, 2010 at 07:46 AM
+-- Server version: 5.1.36
+-- PHP Version: 5.3.0
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `clipbucket_svn`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `cb_photos`
+--
+
+CREATE TABLE IF NOT EXISTS `cb_photos` (
+ `photo_id` bigint(255) NOT NULL AUTO_INCREMENT,
+ `photo_title` mediumtext NOT NULL,
+ `photo_description` mediumtext NOT NULL,
+ `photo_tags` mediumtext NOT NULL,
+ `userid` int(255) NOT NULL,
+ `collection_id` int(255) NOT NULL,
+ `date_added` datetime NOT NULL,
+ `last_viewed` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `views` bigint(255) NOT NULL,
+ `allow_comments` enum('yes','no') NOT NULL DEFAULT 'yes',
+ `allow_embedding` enum('yes','no') NOT NULL DEFAULT 'yes',
+ `allow_tagging` enum('yes','no') NOT NULL DEFAULT 'yes',
+ `featured` enum('yes','no') NOT NULL DEFAULT 'no',
+ `reported` enum('yes','no') NOT NULL DEFAULT 'no',
+ `allow_rating` enum('yes','no') NOT NULL DEFAULT 'yes',
+ `total_comments` int(255) NOT NULL,
+ `total_favorites` int(255) NOT NULL,
+ `rating` int(15) NOT NULL,
+ `rated_by` int(25) NOT NULL,
+ `voters` mediumtext NOT NULL,
+ `filename` varchar(100) NOT NULL,
+ `ext` char(5) NOT NULL,
+ `downloaded` bigint(255) NOT NULL,
+ `owner_ip` varchar(20) NOT NULL,
+ PRIMARY KEY (`photo_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `cb_photos`
+--
+
+/* ADDING BROADCAST AND ACTIVE */
+ALTER TABLE `cb_photos` ADD `broadcast` ENUM( 'public', 'private' ) NOT NULL DEFAULT 'public' AFTER `allow_rating` ,
+ADD `active` ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'yes' AFTER `broadcast`
+
+/* ADDING PHOTO KEY */
+ALTER TABLE `cb_photos` ADD `photo_key` MEDIUMTEXT NOT NULL AFTER `photo_id`
+
+/* ADDING PHOTO CONFIG */
+INSERT INTO `cb_config` (`configid`, `name`, `value`) VALUES (NULL, 'photo_ratio', '16:10'), (NULL, 'photo_thumb_width', '120'), (NULL, 'photo_thumb_height', '75'), (NULL, 'photo_med_width', '185'), (NULL, 'photo_med_height', '116'), (NULL, 'photo_lar_width', '600'), (NULL, 'photo_crop', '1'), (NULL, 'photo_multi_upload', '5'), (NULL, 'photo_download', '1'), (NULL, 'photo_comments', '1'), (NULL, 'photo_rating', '1');
+
+INSERT INTO `cb_config` (`configid`, `name`, `value`) VALUES (NULL, 'max_photo_size', '2');
+
+/* ADDING WATERMARK CONFIG */
+INSERT INTO `clipbucket_svn`.`cb_config` (`configid`, `name`, `value`) VALUES (NULL, 'watermark_photo', '0'), (NULL, 'watermark_max_width', '120'), (NULL,'watermark_placement','left:top');
+
+/* SETTING COLLECTION FEATURED DEFAULT TO 'NO' */
+ALTER TABLE `cb_collections` CHANGE `featured` `featured` VARCHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'no';
+
+/* SHARE TEMPLATE */
+INSERT INTO `cb_email_templates` (`email_template_id`, `email_template_name`, `email_template_code`, `email_template_subject`, `email_template`, `email_template_allowed_tags`) VALUES (NULL, 'Photo Share Template', 'photo_share_template', '{username} wants to share photo with you', '
+
+
+
+
+
+
+ {website_title}
+
+
+
+ {username} wants to share this photo with you
+
+
+
+ Photo Description
+ {photo_description}
+
+
+ Personal Message
+ {user_message}
+
+
+Thanks,
+{website_title}
+
+
+ copyrights {date_year} {website_title}
+
+
+
+', '');
\ No newline at end of file
diff --git a/upload/.htaccess b/upload/.htaccess
index da9ce18c..0b35d427 100644
--- a/upload/.htaccess
+++ b/upload/.htaccess
@@ -76,7 +76,11 @@ RewriteRule ^create_group create_group.php [L]
#Collection Section
RewriteRule ^collections/(.*)/(.*)/(.*)/(.*)/(.*) collections.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^collections collections.php [L]
-RewriteRule ^collection/(.*)/(.*)/(.*) view_collection.php?cid=$1&%{QUERY_STRING} [L]
+RewriteRule ^collection/(.*)/(.*)/(.*)/(.*) view_collection.php?cid=$1&%{QUERY_STRING} [L]
+
+#Photo Section
+RewriteRule ^item/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L]
+
#
RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^signup signup.php
diff --git a/upload/actions/photo_uploader.php b/upload/actions/photo_uploader.php
new file mode 100644
index 00000000..325d2877
--- /dev/null
+++ b/upload/actions/photo_uploader.php
@@ -0,0 +1,134 @@
+
+ * This file is used to upload file using SWFUpload
+ * you dont need to edit this file, edit it at yout own risk :)
+ */
+include('../includes/config.inc.php');
+
+$exts = $cbphoto->exts;
+$max_size = 1048576; // 2MB in bytes
+$form = "photoUpload";
+$path = PHOTOS_DIR."/";
+// These are found in $_FILES. We can access them like $_FILES['file']['error'].
+$upErrors = array(
+ 0 => "There is no error, the file uploaded with success.",
+ 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini.",
+ 2 => " The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.",
+ 3 => "The uploaded file was only partially uploaded.",
+ 4 => "No file was uploaded.",
+ 6 => "Missing a temporary folder.",
+ 7 => "Failed to write file to disk."
+ );
+
+// Let's see if everything is working fine by checking $_FILES.
+if(!isset($_FILES[$form])) {
+ HandleError("No upload found in \$_FILES for " . $form);
+ exit(0);
+}
+elseif(isset($_FILES[$form]['error']) && $_FILES[$form]['error'] != 0) {
+ HandleError($upErrors[$_FILES[$form]['error']]);
+ exit(0);
+}
+elseif(!isset($_FILES[$form]["tmp_name"]) || !@is_uploaded_file($_FILES[$form]["tmp_name"])) {
+ HandleError("Upload failed is_uploaded_file test.");
+ exit(0);
+} elseif(empty($_FILES[$form]['name'])) {
+ HandleError("File name is empty");
+ exit(0);
+}
+
+// Time to check if Filesize is according to demands
+//$filesize = filesize($_FILES[$form]['tmp_name']);
+//if(!$filesize || $filesize > $max_size)
+//{
+// HandleError("File exceeds the maximum allowed size");
+// exit(0);
+//}
+//
+//if($filesize < 0)
+//{
+// HandleError("File size outside allowed lower bound");
+// exit(0);
+//}
+
+//Checking Extension of File
+$info = pathinfo($_FILES[$form]['name']);
+$extension = strtolower($info['extension']);
+$valid_extension = false;
+
+foreach ($exts as $ext) {
+ if (strcasecmp($extension, $ext) == 0) {
+ $valid_extension = true;
+ break;
+ }
+}
+
+if(!$valid_extension)
+{
+ HandleError("Invalid file extension");
+ exit(0);
+}
+
+$filename = $cbphoto->create_filename();
+
+
+//Now uploading the file
+if(move_uploaded_file($_FILES[$form]['tmp_name'],$path.$filename.".".$extension))
+{
+ // Photo Details
+ $userid = $_POST['userid'];
+ $collection = $_POST['collection'];
+ $name = mysql_clean(substr($info['filename'],0,40));
+ $desc = $name." description";
+ $tag = strtolower($name);
+ $key = $cbphoto->photo_key();
+
+ //Making Array for inserting
+ $flds = array("photo_key","photo_title","photo_description","photo_tags","userid","date_added","filename","ext","owner_ip");
+ $vls = array($key,$name,$desc,$tag,$userid,NOW(),$filename,$extension,$_SERVER['REMOTE_ADDR']);
+
+ if(!empty($collection))
+ {
+ $flds[] = "collection_id";
+ $vls[] = $collection;
+ }
+ $total = count($flds);
+
+ for($i=0;$i<$total;$i++)
+ {
+ $detailsArray[$flds[$i]] = $vls[$i];
+ }
+
+ //$FileArray[$key] = $detailsArray;
+ $FinalVar = base64_encode(serialize($detailsArray));
+ echo $FinalVar;
+
+
+ // Creating Thumb and Med Size Image
+
+ //$cbphoto->createThumb($path.$filename.".".$extension,$path.$filename."_t.".$extension,$extension,$cbphoto->thumb_width,$cbphoto->thumb_height);
+ //$cbphoto->createThumb($path.$filename.".".$extension,$path.$filename."_m.".$extension,$extension,$cbphoto->mid_width,$cbphoto->mid_height);
+
+
+
+ //Inserting into Database
+ //$db->insert(tbl("photos"),$flds,$vls);
+ //$insert_id = $db->insert_id();
+
+ //Sending ID of photo to SWFupload
+
+} else {
+ HandleError("File could not be saved.");
+ exit(0);
+}
+
+
+/* Handles the error output. This error message will be sent to the uploadSuccess event handler. The event handler
+will have to check for any error messages and react as needed. */
+function HandleError($message) {
+ echo $message;
+}
+?>
\ No newline at end of file
diff --git a/upload/admin_area/collection_manager.php b/upload/admin_area/collection_manager.php
new file mode 100644
index 00000000..bdd21e7d
--- /dev/null
+++ b/upload/admin_area/collection_manager.php
@@ -0,0 +1,154 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+if(isset($_GET['make_feature']))
+{
+ $id = mysql_clean($_GET['make_feature']);
+ $cbcollection->collection_actions('mcf',$id);
+}
+
+if(isset($_GET['make_unfeature']))
+{
+ $id = mysql_clean($_GET['make_unfeature']);
+ $cbcollection->collection_actions('mcuf',$id);
+}
+
+if(isset($_GET['activate']))
+{
+ $id = mysql_clean($_GET['activate']);
+ $cbcollection->collection_actions('ac',$id);
+}
+
+if(isset($_GET['deactivate']))
+{
+ $id = mysql_clean($_GET['deactivate']);
+ $cbcollection->collection_actions('dac',$id);
+}
+
+if(isset($_GET['delete_collection']))
+{
+ $id = mysql_clean($_GET['delete_collection']);
+ $cbcollection->delete_collection($id);
+}
+//pr($cbcollection->collection_delete_functions,TRUE);
+
+/* ACTIONS ON MULTI ITEMS */
+if(isset($_POST['activate_selected']))
+{
+ $total = count($_POST['check_collection']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbcollection->collection_actions('ac',$_POST['check_collection'][$i]);
+ }
+ $eh->flush();
+ e($total." collections has been activated","m");
+}
+
+if(isset($_POST['deactivate_selected']))
+{
+ $total = count($_POST['check_collection']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbcollection->collection_actions('dac',$_POST['check_collection'][$i]);
+ }
+ $eh->flush();
+ e($total." collections has been deactivated","m");
+}
+
+if(isset($_POST['make_featured_selected']))
+{
+ $total = count($_POST['check_collection']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbcollection->collection_actions('mcf',$_POST['check_collection'][$i]);
+ }
+ $eh->flush();
+ e($total." collections has been marked as Featured ","m");
+}
+
+if(isset($_POST['make_unfeatured_selected']))
+{
+ $total = count($_POST['check_collection']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbcollection->collection_actions('mcuf',$_POST['check_collection'][$i]);
+ }
+ $eh->flush();
+ e($total." collections has been marked as Unfeatured ","m");
+}
+
+if(isset($_POST['make_unfeatured_selected']))
+{
+ $total = count($_POST['check_collection']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbcollection->collection_actions('mcuf',$_POST['check_collection'][$i]);
+ }
+ $eh->flush();
+ e($total." collections has been marked as Unfeatured ","m");
+}
+
+if(isset($_POST['delete_selected']))
+{
+ $total = count($_POST['check_collection']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbcollection->delete_collection($_POST['check_collection'][$i]);
+ }
+ $eh->flush();
+ e($total." collection(s) has been deleted successfully","m");
+}
+
+/* IF SEARCH EXISTS */
+if($_GET['search'])
+{
+ $array = array(
+ 'name' => $_GET['title'],
+ 'tags' => $_GET['tags'],
+ 'cid' => $_GET['collectionid'],
+ 'type' => $_GET['collection_type'],
+ 'user' => $_GET['userid'],
+ 'order' => $_GET['order'],
+ 'broadcast' => $_GET['broadcast'],
+ 'featured' => $_GET['featured'],
+ 'active' => $_GET['active']
+ );
+}
+
+$carray = $array;
+
+/* CREATING LIMIT */
+$page = mysql_clean($_GET['page']);
+$get_limit = create_query_limit($page,RESULTS);
+
+$carray['limit'] = $get_limit;
+if(!empty($carray['order']))
+ $carray['order'] = $carray['order']." DESC";
+else
+ $carray['order'] = " collection_id DESC";
+
+$collections = $cbcollection->get_collections($carray);
+assign('c',$collections);
+
+/* COUNTING ALL COLLECTIONS */
+$ccount = $carray;
+$ccount['count_only'] = TRUE;
+$total_rows = $cbcollection->get_collections($ccount);
+$total_pages = count_pages($total_rows,RESULTS);
+$pages->paginate($total_pages,$page);
+
+subtitle("Collection Manager");
+template_files('collection_manager.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/edit_collection.php b/upload/admin_area/edit_collection.php
new file mode 100644
index 00000000..945ab6ff
--- /dev/null
+++ b/upload/admin_area/edit_collection.php
@@ -0,0 +1,58 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+$id = mysql_clean($_GET['collection']);
+
+if(isset($_POST['update_collection']))
+{
+ $cbcollection->update_collection();
+}
+
+if(isset($_POST['delete_preview']))
+{
+ $id = mysql_clean($_POST['delete_preview']);
+ $cbcollection->delete_thumbs($id);
+}
+
+//Performing Actions
+if($_GET['mode']!='')
+{
+ $cbcollection->collection_actions($_GET['mode'],$id);
+}
+
+$c = $cbcollection->get_collection($id);
+switch($c['type'])
+{
+ case "videos":
+ case "v":
+ {
+ $items = $cbvideo->collection->get_collection_items_with_details($c['collection_id'],NULL,4);
+ }
+ break;
+
+ case "photos":
+ case "p":
+ {
+ $items = $cbphoto->collection->get_collection_items_with_details($c['collection_id'],NULL,4);
+ }
+ break;
+}
+if(!empty($items))
+ assign('objects',$items);
+assign('data',$c);
+
+subtitle("Edit Collection");
+template_files('edit_collection.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/edit_photo.php b/upload/admin_area/edit_photo.php
new file mode 100644
index 00000000..73f092b7
--- /dev/null
+++ b/upload/admin_area/edit_photo.php
@@ -0,0 +1,42 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+$id = mysql_clean($_GET['photo']);
+
+
+if(isset($_POST['update']))
+{
+ $cbphoto->update_photo();
+}
+
+//Performing Actions
+if($_GET['mode']!='')
+{
+ $cbphoto->photo_actions($_GET['mode'],$id);
+}
+
+$p = $cbphoto->get_photo($id);
+$p['without_user'] = TRUE;
+
+assign('data',$p);
+
+$requiredFields = $cbphoto->load_required_forms($p);
+$otherFields = $cbphoto->load_other_forms($p);
+assign('requiredFields',$requiredFields);
+assign('otherFields',$otherFields);
+
+subtitle("Edit Photo");
+template_files('edit_photo.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/flagged_collections.php b/upload/admin_area/flagged_collections.php
new file mode 100644
index 00000000..cea2f09d
--- /dev/null
+++ b/upload/admin_area/flagged_collections.php
@@ -0,0 +1,90 @@
+admin_login_check();
+$pages->page_redir();
+//$userquery->perm_check('group_moderation',true);
+
+$mode = $_GET['mode'];
+
+//Delete Photo
+if(isset($_GET['delete_collect'])){
+ $collect = mysql_clean($_GET['delete_collect']);
+ $cbcollection->delete_collection($collect);
+}
+
+//Deleting Multiple Photos
+if(isset($_POST['delete_selected']))
+{
+ for($id=0;$id<=count($_POST['check_collect']);$id++)
+ {
+ $cbphoto->delete_photo($_POST['check_collect'][$id]);
+ }
+ $eh->flush();
+ e("Selected collections have been deleted","m");
+}
+
+if(isset($_REQUEST['delete_flags']))
+{
+ $collect = mysql_clean($_GET['delete_flags']);
+ $cbcollection->action->delete_flags($collect);
+}
+
+//Deleting Multiple Videos
+if(isset($_POST['delete_flags']))
+{
+ for($id=0;$id<=count($_POST['check_collect']);$id++)
+ {
+ $eh->flush();
+ $cbcollection->action->delete_flags($_POST['check_collect'][$id]);
+ }
+}
+
+switch($mode)
+{
+ case "view":
+ default:
+ {
+ assign("mode","view");
+ //Getting Video List
+ $page = mysql_clean($_GET['page']);
+ $get_limit = create_query_limit($page,5);
+ $collects = $cbcollection->action->get_flagged_objects($get_limit);
+ assign('c', $collects);
+
+ //Collecting Data for Pagination
+ $total_rows = $cbcollection->action->count_flagged_objects();
+ $total_pages = count_pages($total_rows,5);
+
+ //Pagination
+ $pages->paginate($total_pages,$page);
+ }
+ break;
+
+ case "view_flags":
+ {
+ assign("mode","view_flags");
+ $cid = mysql_clean($_GET['cid']);
+ $cdetails = $cbcollection->get_collection($cid);
+ if($cdetails)
+ {
+ $flags = $cbcollection->action->get_flags($pid);
+ assign('flags',$flags);
+ assign('collection',$cdetails);
+ }else
+ e("Collection does not exist");
+ }
+
+}
+
+subtitle("Flagged Collections");
+template_files('flagged_collections.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/flagged_photos.php b/upload/admin_area/flagged_photos.php
new file mode 100644
index 00000000..65c62103
--- /dev/null
+++ b/upload/admin_area/flagged_photos.php
@@ -0,0 +1,91 @@
+admin_login_check();
+$pages->page_redir();
+//$userquery->perm_check('group_moderation',true);
+
+$mode = $_GET['mode'];
+
+//Delete Photo
+if(isset($_GET['delete_photo'])){
+ $photo = mysql_clean($_GET['delete_photo']);
+ $cbphoto->delete_photo($photo);
+}
+
+//Deleting Multiple Photos
+if(isset($_POST['delete_selected']))
+{
+ for($id=0;$id<=count($_POST['check_photo']);$id++)
+ {
+ $cbphoto->delete_photo($_POST['check_photo'][$id]);
+ }
+ $eh->flush();
+ e("Selected photos have been deleted","m");
+}
+
+if(isset($_REQUEST['delete_flags']))
+{
+ $photo = mysql_clean($_GET['delete_flags']);
+ $cbphoto->action->delete_flags($photo);
+}
+
+//Deleting Multiple Videos
+if(isset($_POST['delete_flags']))
+{
+ for($id=0;$id<=count($_POST['check_photo']);$id++)
+ {
+ $eh->flush();
+ $cbphoto->action->delete_flags($_POST['check_photo'][$id]);
+ }
+}
+
+switch($mode)
+{
+ case "view":
+ default:
+ {
+ assign("mode","view");
+ //Getting Video List
+ $page = mysql_clean($_GET['page']);
+ $get_limit = create_query_limit($page,5);
+ $photos = $cbphoto->action->get_flagged_objects($get_limit);
+ assign('photos', $photos);
+
+ //Collecting Data for Pagination
+ $total_rows = $cbphoto->action->count_flagged_objects();
+ $total_pages = count_pages($total_rows,5);
+
+ //Pagination
+ $pages->paginate($total_pages,$page);
+ }
+ break;
+
+ case "view_flags":
+ {
+ assign("mode","view_flags");
+ $pid = mysql_clean($_GET['pid']);
+ $pdetails = $cbphoto->get_photo($pid);
+ if($pdetails)
+ {
+ $flags = $cbphoto->action->get_flags($pid);
+ assign('flags',$flags);
+ assign('photo',$pdetails);
+ }else
+ e("Photo does not exist");
+ }
+
+}
+
+subtitle("Flagged Photos");
+template_files('flagged_photos.html');
+display_it();
+
+?>
\ No newline at end of file
diff --git a/upload/admin_area/manage_items.php b/upload/admin_area/manage_items.php
new file mode 100644
index 00000000..eda9464c
--- /dev/null
+++ b/upload/admin_area/manage_items.php
@@ -0,0 +1,93 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+$id = mysql_clean($_GET['collection']);
+$type = mysql_clean($_GET['type']);
+
+switch($type)
+{
+ case "photos":
+ {
+
+ if(isset($_POST['remove_selected']))
+ {
+ $total = count($_POST['check_obj']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->collection->remove_item($_POST['check_obj'][$i],$id);
+ $cbphoto->make_photo_orphan($id,$_POST['check_obj'][$i]);
+ }
+ $eh->flush();
+ e($total." photos have been removed.","m");
+ }
+
+ if(isset($_POST['move_selected']))
+ {
+ $total = count($_POST['check_obj']);
+ $new = mysql_clean($_POST['collection_id']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->collection->change_collection($new,$_POST['check_obj'][$i],$id);
+ $db->update(tbl('photos'),array('collection_id'),array($new)," collection_id = $id AND photo_id = ".$_POST['check_obj'][$i]."");
+ }
+ $eh->flush();
+ e($total." photo(s) have been moved to '".get_collection_field($new,'collection_name')." '","m");
+
+ }
+
+ $items = $cbphoto->collection->get_collection_items_with_details($id);
+ $collection = $cbphoto->collection->get_collections(array("type"=>"photos"));
+ }
+ break;
+
+ case "videos":
+ {
+
+ if(isset($_POST['remove_selected']))
+ {
+ $total = count($_POST['check_obj']);
+ for($i=0;$i<$total;$i)
+ {
+ $cbvideo->collection->remove_item($_POST['check_obj'][$i],$id);
+ }
+ }
+
+ if(isset($_POST['move_selected']))
+ {
+ $total = count($_POST['check_obj']);
+ $new = mysql_clean($_POST['collection_id']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbvideo->collection->change_collection($new,$_POST['check_obj'][$i],$id);
+ }
+ $eh->flush();
+ e($total." video(s) have been moved to '".get_collection_field($new,'collection_name')." '","m");
+
+ }
+
+ $items = $cbvideo->collection->get_collection_items_with_details($id);
+ $collection = $cbphoto->collection->get_collections(array("type"=>"videos"));
+ }
+}
+
+$data = $cbcollection->get_collection($id);
+
+assign('data',$data);
+assign('obj',$items);
+assign('type',$type);
+assign('c',$collection);
+
+subtitle("Manage Items");
+template_files('manage_items.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/orphan_photos.php b/upload/admin_area/orphan_photos.php
new file mode 100644
index 00000000..772dbf33
--- /dev/null
+++ b/upload/admin_area/orphan_photos.php
@@ -0,0 +1,77 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+if(isset($_GET['delete_photo']))
+{
+ $id = mysql_clean($_GET['delete_photo']);
+ $cbphoto->delete_photo($id);
+}
+
+if(isset($_POST['deleted_selected']))
+{
+ $total = $_POST['check_photo'];
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->delete_photo($_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been deleted successfully.","m");
+}
+
+//Multi-featured
+if(isset($_POST['make_featured_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->photo_actions('feature_photo',$_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been marked as Featured ","m");
+}
+
+//Multi-unfeatured
+if(isset($_POST['make_unfeatured_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->photo_actions('unfeature_photo',$_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been marked as Unfeatured ","m");
+}
+
+if(isset($_POST['move_selected']))
+{
+ $total = count($_POST['check_photo']);
+ $new = mysql_clean($_POST['collection_id']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->collection->change_collection($new,$_POST['check_photo'][$i]);
+ $db->update(tbl('photos'),array('collection_id'),array($new)," photo_id = ".$_POST['check_photo'][$i]."");
+ }
+ $eh->flush();
+ e($total." photo(s) have been moved to '".get_collection_field($new,'collection_name')." '","m");
+
+}
+
+$photos = $cbphoto->get_photos(array("extra_cond"=>" collection_id = '0'"));
+$collection = $cbphoto->collection->get_collections(array("type"=>"photos"));
+assign('photos',$photos);
+assign('c',$collection);
+
+subtitle("Orphan Photos");
+template_files('orphan_photos.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/photo_manager.php b/upload/admin_area/photo_manager.php
new file mode 100644
index 00000000..706f280a
--- /dev/null
+++ b/upload/admin_area/photo_manager.php
@@ -0,0 +1,164 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+//Photo Actions are following
+
+//Feature
+if(isset($_GET['make_feature']))
+{
+ $id = mysql_clean($_GET['make_feature']);
+ $cbphoto->photo_actions('feature_photo',$id);
+}
+
+//Unfeature
+if(isset($_GET['make_unfeature']))
+{
+ $id = mysql_clean($_GET['make_unfeature']);
+ $cbphoto->photo_actions('unfeature_photo',$id);
+}
+
+//Activate
+if(isset($_GET['activate']))
+{
+ $id = mysql_clean($_GET['activate']);
+ $cbphoto->photo_actions('activation',$id);
+}
+
+//Deactivate
+if(isset($_GET['deactivate']))
+{
+ $id = mysql_clean($_GET['deactivate']);
+ $cbphoto->photo_actions('deactivation',$id);
+}
+
+//Delete
+if(isset($_GET['delete_photo']))
+{
+ $id = mysql_clean($_GET['delete_photo']);
+ $cbphoto->delete_photo($id);
+}
+
+//Multi-Active
+if(isset($_POST['deactivate_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->photo_actions('deactivation',$_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been deactivated","m");
+}
+
+//Multi-Deactive
+if(isset($_POST['activate_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->photo_actions('activation',$_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been activated","m");
+}
+
+//Multi-featured
+if(isset($_POST['make_featured_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->photo_actions('feature_photo',$_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been marked as Featured ","m");
+}
+
+//Multi-unfeatured
+if(isset($_POST['make_unfeatured_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->photo_actions('unfeature_photo',$_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been marked as Unfeatured ","m");
+}
+
+//Multi-delete
+if(isset($_POST['delete_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->delete_photo($_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photos has been deleted successfully","m");
+}
+
+if(isset($_POST['move_to_selected']))
+{
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $id_array[] = $_POST['check_photo'][$i];
+ }
+ //$eh->flush();
+}
+
+if(isset($_GET['search']))
+{
+ $array = array(
+ 'title' => $_GET['title'],
+ 'pid' => $_GET['photoid'],
+ 'key' => $_GET['photokey'],
+ 'tags' => $_GET['tags'],
+ 'featured' => $_GET['featured'],
+ 'active' => $_GET['active'],
+ 'user' => $_GET['userid'],
+ 'extension' => $_GET['extension'],
+ 'order' => $_GET['order']
+ );
+}
+
+$parr = $array;
+
+// Creating Limit
+$page = mysql_clean($_GET['page']);
+$get_limit = create_query_limit($page,RESULTS);
+
+$parr['limit'] = $get_limit;
+if(!$parr['order'])
+ $parr['order'] = " date_added DESC ";
+else
+ $parr['order'] = $parr['order']." DESC";
+
+$collections = $cbcollection->get_collections(array("type"=>"photos"));
+$photos = $cbphoto->get_photos($parr);
+Assign('photos', $photos);
+assign('c',$collections);
+
+$pcount = $parr;
+$pcount['count_only'] = true;
+$total_rows = $cbphoto->get_photos($pcount);
+$total_pages = count_pages($total_rows,RESULTS);
+$pages->paginate($total_pages,$page);
+
+
+subtitle("Photo Manager");
+template_files('photo_manager.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/photo_settings.php b/upload/admin_area/photo_settings.php
new file mode 100644
index 00000000..e782b856
--- /dev/null
+++ b/upload/admin_area/photo_settings.php
@@ -0,0 +1,109 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+$mode = $_GET['mode'];
+assign('mode',$mode);
+
+switch($mode)
+{
+ case "photo_settings":
+ default:
+ {
+ if($_POST['update'])
+ {
+ $rows = array(
+ 'photo_ratio',
+ 'photo_thumb_width',
+ 'photo_thumb_height',
+ 'photo_med_width',
+ 'photo_med_height',
+ 'photo_lar_width',
+ 'photo_crop',
+ 'photo_multi_upload',
+ 'max_photo_size',
+ 'photo_download',
+ 'photo_comments',
+ 'photo_rating');
+
+ $numeric = array(
+ 'photo_thumb_width',
+ 'photo_thumb_height',
+ 'photo_med_width',
+ 'photo_med_height',
+ 'photo_lar_width',
+ 'photo_crop',
+ 'max_photo_size',
+ 'photo_multi_upload',
+ 'photo_download',
+ 'photo_comments',
+ 'photo_rating');
+
+ foreach($rows as $field)
+ {
+ $value = $_POST[$field];
+ if(in_array($field,$numeric))
+ {
+ if($value < 0 || !is_numeric($value))
+ $value = 1;
+ }
+ $myquery->Set_Website_Details($field,$value);
+ }
+ e("Photo Settings Have Been Updated",'m');
+ }
+
+
+ subtitle("Photo Settings");
+ }
+ break;
+
+ case "watermark_settings":
+ {
+ if($_POST['update_watermark'])
+ {
+ $rows = array(
+ 'watermark_photo',
+ 'watermark_max_width',
+ 'watermark_placement');
+ $numeric = array(
+ 'watermark_max_width'
+ );
+
+ foreach($rows as $field)
+ {
+ $value = $_POST[$field];
+ if(in_array($filed,$numeric))
+ {
+ if($value < 0 || !is_numeric($value))
+ $value = 1;
+ }
+ $myquery->Set_Website_Details($field,$value);
+ }
+ if(!empty($_FILES['watermark_file']['tmp_name']))
+ $cbphoto->update_watermark($_FILES['watermark_file']);
+
+ e("Watermark Settings Have Been Updated",'m');
+
+ subtitle("Watermark Settings");
+ }
+ }
+ break;
+}
+
+$row = $myquery->Get_Website_Details();
+assign('row',$row);
+
+template_files('photo_settings.html');
+display_it();
+
+?>
\ No newline at end of file
diff --git a/upload/admin_area/recreate_thumbs.php b/upload/admin_area/recreate_thumbs.php
new file mode 100644
index 00000000..a38d6e2d
--- /dev/null
+++ b/upload/admin_area/recreate_thumbs.php
@@ -0,0 +1,116 @@
+admin_login_check();
+$userquery->login_check('video_moderation');
+$pages->page_redir();
+
+$mode = $_GET['mode'];
+$photo = mysql_clean($_GET['photo']);
+
+
+switch($mode)
+{
+ case "single":
+ {
+ assign('mode',$mode);
+ if($cbphoto->photo_exists($photo))
+ {
+
+
+ if($_GET['recreate'])
+ {
+ $cbphoto->generate_photos($photo);
+ e("Photo has been re-created. Please remove cache if you dont see any change.","m");
+ }
+
+ $files = $cbphoto->get_image_file($photo,'t',TRUE);
+ $p = $cbphoto->get_photo($photo);
+
+ assign('files',$files);
+ assign('p',$p);
+ } else
+ e("Photo does not exist");
+ }
+ break;
+
+ case "mass":
+ default:
+ {
+ assign('mode',$mode);
+ $start_index = $_GET['start_index'] ? $_GET['start_index'] : 0;
+ $loop_size = $_GET['loop_size'];
+ $loop_size = $loop_size ? $loop_size : 2;
+ assign('loop_size',$loop_size);
+ $next_index = $start_index+$loop_size;
+ assign('next_index',$next_index);
+ if(isset($_GET['mass_recreation']))
+ {
+ $photos = $cbphoto->get_photos(array("limit"=>$start_index.",".$loop_size));
+ $total = $cbphoto->get_photos(array("count_only"=>true));
+ $i = 0;
+
+ assign('total',$total);
+ assign('from',$start_index+1);
+ $to = $start_index+$loop_size;
+ if($to>$total)
+ {
+ $to = $total;
+ e($total." photos image have been recreated.","m");
+ assign("stop_loop","yes");
+ }
+ assign('to',$to);
+
+ while($i < $total)
+ {
+ if($photos[$i]['photo_id'])
+ {
+ $cbphoto->generate_photos($photos[$i]['photo_id']);
+ $msg[] = $photos[$i]['photo_id'].": Updating ".$photos[$i]['photo_title']." ";
+ }
+ $i++;
+ }
+ e($start_index+1 ." - ".$to." photos image have been recreated.","m");
+ assign("index_msgs",$msg);
+ assign("indexing","yes");
+ assign('button','mass_recreation');
+ }
+ }
+ break;
+
+ case "collection":
+ {
+ assign('mode',$mode);
+ $cid = mysql_clean($_GET['cid']);
+ if($cbphoto->collection->collection_exists($cid))
+ {
+ if(isset($_POST['recreating']))
+ {
+ $total = count($_POST['check_photo']);
+ for($i=0;$i<$total;$i++)
+ {
+ $cbphoto->generate_photos($_POST['check_photo'][$i]);
+ }
+ $eh->flush();
+ e($total." photo(s) have been re-created. Please remove browser cache if you don't see any change.","m");
+ }
+ $items = $cbphoto->collection->get_collection_items_with_details($cid);
+ assign('items',$items);
+ } else {
+ e(lang("Collection does not exist"));
+ }
+ }
+ break;
+}
+
+subtitle("Recreate Photos");
+template_files('recreate_thumbs.html');
+display_it();
+?>
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/collection_manager.html b/upload/admin_area/styles/cbv2/layout/collection_manager.html
new file mode 100644
index 00000000..d2f33510
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/collection_manager.html
@@ -0,0 +1,160 @@
+Collection Manager
+
+
+
+
+
+{include file="$style_dir/blocks/pagination.html" }
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/edit_collection.html b/upload/admin_area/styles/cbv2/layout/edit_collection.html
new file mode 100644
index 00000000..79d6e5af
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/edit_collection.html
@@ -0,0 +1,135 @@
+{assign var=requiredFields value=$cbcollection->load_required_fields($data)}
+{assign var=otherFields value=$cbcollection->load_other_fields($data)}
+
+
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/edit_photo.html b/upload/admin_area/styles/cbv2/layout/edit_photo.html
new file mode 100644
index 00000000..906714d7
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/edit_photo.html
@@ -0,0 +1,146 @@
+
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/flagged_photos.html b/upload/admin_area/styles/cbv2/layout/flagged_photos.html
new file mode 100644
index 00000000..ddae5016
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/flagged_photos.html
@@ -0,0 +1,105 @@
+{if $mode == 'view'}
+Flagged Photos Manager
+
+
+
+
+
+{if $photos}
+{section name=list loop=$photos}
+
+
+
+ {$photos[list].photo_id}
+
+
+ {get_photo details=$photos[list] id='photo' style='padding:2px; border:1px solid #ccc' output='html'}
+
+
+
+
+{/section}
+{else}
+ No Flags Found
+{/if}
+
+
+
+
+
+{include file="$style_dir/blocks/pagination.html" }
+{/if}
+
+{if $mode == 'view_flags'}
+Viewing {$photo.photo_title} flags — View Photo • Edit Photo • Delete Flags • Delete Photo
+
+
+
+
+{section name=list loop=$flags}
+
+ {$smarty.section.list.iteration}
+
+ Reported as "{$flags[list].flag_type|flag_type}" by {$flags[list].userid|get_username} {$flags[list].date_added|niceTime}
+
+
+{/section}
+
+{/if}
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/global_header.html b/upload/admin_area/styles/cbv2/layout/global_header.html
index b56fd576..13ca4e33 100644
--- a/upload/admin_area/styles/cbv2/layout/global_header.html
+++ b/upload/admin_area/styles/cbv2/layout/global_header.html
@@ -61,7 +61,6 @@ var imageurl = "{$imageurl}";
{/literal}
+
+{literal}
+
+{/literal}
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/manage_items.html b/upload/admin_area/styles/cbv2/layout/manage_items.html
new file mode 100644
index 00000000..fcb4403c
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/manage_items.html
@@ -0,0 +1,117 @@
+
+
+
+
+
+{if $obj}
+{if $type == ''}
+ Unknown Type
+{else}
+{if $type == 'photos'}
+
+
+
+{/if}
+{section name=list loop=$obj}
+ {if $type == 'photos'}
+
+
+ {$obj[list].photo_id}
+
+
+
+
+
+
+
+ {/if}
+
+ {if $type == 'videos'}
+
+
+ {$obj[list].videoid}
+
+
+
+
+
+
+
+
+ {/if}
+{/section}
+{/if}
+{else}
+ No Object Found
+{/if}
+
+
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/orphan_photos.html b/upload/admin_area/styles/cbv2/layout/orphan_photos.html
new file mode 100644
index 00000000..47e6cf04
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/orphan_photos.html
@@ -0,0 +1,84 @@
+Orphan Photos
+
+
+
+
+
+{if $photos}
+
+{section name=list loop=$photos}
+
+
+ {$photos[list].photo_id}
+
+
+
+ {get_photo details=$photos[list] id='photo' style='padding:2px; border:1px solid #ccc' output='html'}
+
+
+
+
+{/section}
+
+
+
+
+
+{else}
+ No Photo Found
+{/if}
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/photo_manager.html b/upload/admin_area/styles/cbv2/layout/photo_manager.html
new file mode 100644
index 00000000..5a6130a4
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/photo_manager.html
@@ -0,0 +1,148 @@
+Photo Manager
+
+
+
+
+
+
+
+
+
+{if $photos}
+
+{section name=list loop=$photos}
+
+
+
+ {$photos[list].photo_id}
+
+
+ {get_photo details=$photos[list] id='photo' style='padding:2px; border:1px solid #ccc' output='html'}
+
+
+
+
+{/section}
+
+
+
+
+
+{else}
+ No Photo Found
+{/if}
+
+{include file="$style_dir/blocks/pagination.html" }
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/photo_settings.html b/upload/admin_area/styles/cbv2/layout/photo_settings.html
new file mode 100644
index 00000000..f89ee96c
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/photo_settings.html
@@ -0,0 +1,223 @@
+{if $mode == '' || $mode == 'photo_settings'}
+
+Photo Settings
+
+
+
+
+
+ Photo Resizing
+
+
+
+ Photo Behavior
+
+
+
+
+
+
+
+
+
+
+
+
+
+{/if}
+
+
+{if $mode == 'watermark_settings'}
+Watermark Settings
+
+
+
+
+
+
+
Watermark Settings
+
+
+
+
Upload New Watermark
+
This will over-write your existing watermark file, if exists.
+
+
+
+
+
+
Current Watermark
+
+ {assign var=file value=$cbphoto->watermark_file()}
+ {if $file}
+
+ {else}
+
Watermark not found
+ {/if}
+
+
+
+
+
+
+
+
+
+
+{/if}
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/layout/recreate_thumbs.html b/upload/admin_area/styles/cbv2/layout/recreate_thumbs.html
new file mode 100644
index 00000000..58a3dca7
--- /dev/null
+++ b/upload/admin_area/styles/cbv2/layout/recreate_thumbs.html
@@ -0,0 +1,245 @@
+{if $mode == 'single'}
+Re-create Photos
+
+ « Back to Edit Details
+
+
+
+ Settings on which photos will be re-created
+
+ Ratio
+
+
+
+ Thumb Size
+ x
+
+
+
+ Medium Size
+ x
+
+
+
+ Large Size
+
+
+
+ Cropping
+
+ {assign var=cropping value=$Cbucket->configs.photo_crop}
+ {if $cropping == 1}
+ Enabled
+ {else}
+ Disabled
+ {/if}
+
+
+
+ Watermarking
+
+ {assign var=watermark value=$Cbucket->configs.watermark_photo}
+ {if $watermark == 1}
+ Enabled | Placement -
+ {else}
+ Disabled
+ {/if}
+
+
+
+
+
+ Update settings if they are not according to your needs.
+
+
+
+
+ Re-create Photo
+
+ {foreach from=$files item=file}
+
+
+ {assign var=size value=$cbphoto->get_image_type($file)}
+ Filename: {$p.filename}{if $size} - Size: {$size}{/if}
+
+
+
+
+ {/foreach}
+
+
+
+{/if}
+
+{if $mode == 'mass' || $mode == ''}
+ Mass Re-creation of Photos
+
+ This will re-create all the photos uploaded on your website, according to the settings shown below
+
+
+ Settings on which photos will be re-created
+
+ Ratio
+
+
+
+ Thumb Size
+ x
+
+
+
+ Medium Size
+ x
+
+
+
+ Large Size
+
+
+
+ Cropping
+
+ {assign var=cropping value=$Cbucket->configs.photo_crop}
+ {if $cropping == 1}
+ Enabled
+ {else}
+ Disabled
+ {/if}
+
+
+
+ Watermarking
+
+ {assign var=watermark value=$Cbucket->configs.watermark_photo}
+ {if $watermark == 1}
+ Enabled | Placement -
+ {else}
+ Disabled
+ {/if}
+
+
+
+
+
+ Update settings if they are not according to your needs.
+
+
+
+
+
+
Loop Size -
+
Number of photos to re-create in one go.
+
+
+
+
+
+
+ {if $indexing}
+ {$from} - {$to} of {$total}
+
+ {foreach from=$index_msgs item=themsg}
+ {$themsg}
+ {/foreach}
+
+ {if $stop_loop!='yes'}
+
+ redirecting....do not close this window
+ {else}
+ Re-creation of photos have been completed.
+ {/if}
+ {/if}
+{/if}
+
+{if $mode == "collection"}
+ Recreate Photos
+
+ {if $items}
+ {assign var=cid value=$items[0].collection_id}
+ {assign var=c_name value=$items[0].collection_id|get_collection_field}
+ {$c_name}
+
+ - View Collection -
+ Edit Collection -
+ Manage Items
+
+
+
+ Settings on which photos will be re-created
+
+ Ratio
+
+
+
+ Thumb Size
+ x
+
+
+
+ Medium Size
+ x
+
+
+
+ Large Size
+
+
+
+ Cropping
+
+ {assign var=cropping value=$Cbucket->configs.photo_crop}
+ {if $cropping == 1}
+ Enabled
+ {else}
+ Disabled
+ {/if}
+
+
+
+ Watermarking
+
+ {assign var=watermark value=$Cbucket->configs.watermark_photo}
+ {if $watermark == 1}
+ Enabled | Placement -
+ {else}
+ Disabled
+ {/if}
+
+
+
+
+
+ Update settings if they are not according to your needs.
+
+
+
+
+
+ Photos
+
+
+ Select photos you want to re-created |
+ Select All
+
+
+
+ {else}
+
+ {/if}
+{/if}
\ No newline at end of file
diff --git a/upload/admin_area/styles/cbv2/theme/main.css b/upload/admin_area/styles/cbv2/theme/main.css
index 47b97ea4..cf2c4ba9 100644
--- a/upload/admin_area/styles/cbv2/theme/main.css
+++ b/upload/admin_area/styles/cbv2/theme/main.css
@@ -285,4 +285,23 @@ margin-top: 0;
.cb_div input[type=submit]{padding:5px}
.reindex_tbl .button {width:130px}
-.reindex_tbl td{height:60px}
\ No newline at end of file
+.reindex_tbl td{height:60px}
+
+.RatioBox { background:#0099cc; border:1px solid #026f93; font:bold 11px Tahoma; color:#FFF; text-align:center; display:inline-block; }
+.smallText { font:normal 10px Tahoma; color:#7b7b7b; display:inline-block; margin-top:5px; }
+.AdminBoldText { font:bold 11px Tahoma; color:#7b7b7b; }
+/* I GOT FUKING ANNOYED THOSE TD's TR's SO I HAVE DEDICED TO ADD THIS CSS */
+.moveL { float:left; }
+.moveR { float:right; }
+
+li.myAdminList { list-style:none; padding:5px 0px; border-bottom:1px solid #ccc; position:relative; }
+li.myAdminList .PhotoCheckBox { width:30px; }
+li.myAdminList .PhotoID { width:75px; font:bold 11px Tahoma; text-align:center; }
+li.myAdminList .PhotoDetails { min-height:90px; height:90px; height:auto !important; }
+li.myAdminList .PhotoDetails a { color:#0C4469; font-size:13px; font-weight:bold; text-decoration:none; }
+li.myAdminList .AdminPhotoThumb { margin-right:8px; }
+li.myAdminList .AdminPhotoActions a { font:bold 11px Tahoma; }
+li.myAdminList .AdminPhotoActions a:hover { border-bottom:1px dashed #0099cc; }
+li.myAdminList input[disabled=disabled].disabled { font:normal 11px Tahoma; padding:1px; }
+
+.myAdminButton { background:url(../images/gradients.png); border:1px solid #000; padding:4px; margin:0px; font:bold 11px Tahoma; color:#FFF; }
\ No newline at end of file
diff --git a/upload/ajax.php b/upload/ajax.php
index edf42b96..18881c9f 100644
--- a/upload/ajax.php
+++ b/upload/ajax.php
@@ -68,6 +68,16 @@ if(!empty($mode))
$cbvid->show_video_rating($result);
}
break;
+
+ case "photo":
+ {
+ $rating = $_POST['rating']*2;
+ $id = $_POST['id'];
+ $result = $cbphoto->rate_photo($id,$rating);
+ $result['is_rating'] = true;
+ $cbvid->show_video_rating($result);
+ }
+ break;
}
}
break;
@@ -101,6 +111,28 @@ if(!empty($mode))
echo $msg;
}
break;
+
+ case "p":
+ case "photo":
+ {
+ $id = $_POST['id'];
+ $ph = $cbphoto->get_photo($id);
+ $cbphoto->set_share_email($ph);
+ $cbphoto->action->share_content($ph['photo_id']);
+ if(msg())
+ {
+ $msg = msg_list();
+ $msg = ''.$msg[0].'
';
+ }
+ if(error())
+ {
+ $msg = error_list();
+ $msg = ''.$msg[0].'
';
+ }
+
+ echo $msg;
+ }
+ break;
}
}
break;
@@ -131,6 +163,27 @@ if(!empty($mode))
echo $msg;
}
break;
+
+ case 'p':
+ case 'photo':
+ {
+ $id = $_POST['id'];
+ $cbphoto->action->add_to_fav($id);
+ // Need a function to update favs count
+ if(msg())
+ {
+ $msg = msg_list();
+ $msg = ''.$msg[0].'
';
+ }
+ if(error())
+ {
+ $msg = error_list();
+ $msg = ''.$msg[0].'
';
+ }
+
+ echo $msg;
+ }
+ break;
}
}
break;
@@ -167,6 +220,16 @@ if(!empty($mode))
$userquery->action->report_it($id);
}
break;
+
+ case 'p':
+ case 'photo':
+ default:
+ {
+ $id = $_POST['id'];
+ $cbphoto->action->report_it($id);
+ // Need a function to set photo reported field to yes
+ }
+ break;
}
if(msg())
@@ -582,13 +645,13 @@ if(!empty($mode))
}
break;
- case "pictures":
- case "picture":
+ case "photos":
+ case "photo":
case "p":
{
$cid = $_POST['cid'];
$id = $_POST['obj_id'];
- $cbpicture->collection->add_collection_item($id,$cid);
+ $cbphoto->collection->add_collection_item($id,$cid);
}
}
@@ -626,11 +689,12 @@ if(!empty($mode))
}
break;
- case "pictures":
+ case "photos":
{
$obj_id = $_POST['obj_id'];
$cid = $_POST['cid'];
- $cbpicture->collection->remove_item($obj_id,$cid);
+ $cbphoto->collection->remove_item($obj_id,$cid);
+ $cbphoto->make_photo_orphan($cid,$obj_id);
}
break;
}
@@ -644,7 +708,7 @@ if(!empty($mode))
if(error())
{
$err = error_list();
- $err = $err[0];
+ $err = ''.$err[0].'
';
}
$ajax['msg'] = $msg;
@@ -654,9 +718,9 @@ if(!empty($mode))
}
break;
- case "NePrItem":
+ case "get_item":
{
- $item_id = $_POST['item_id'];
+ $item_id = $_POST['ci_id'];
$cid = $_POST['cid'];
$direc = mysql_clean($_POST['direction']);
$t = $_POST['type'];
@@ -664,17 +728,36 @@ if(!empty($mode))
switch($t)
{
case "videos":
+ case "video":
case "v":
{
$N_item = $cbvideo->collection->get_next_prev_item($item_id,$cid,$direc);
+ //increment_views($N_item[0]['videoid'],'video');
+ $cbvideo->collection->set_item_cookie($N_item[0]['videokey']);
+ $ajax['key'] = $N_item[0]['videokey'];
+ $ajax['cid'] = $N_item[0]['collection_id'];
+ }
+ break;
+
+ case "photos":
+ case "photo":
+ case "p":
+ {
+ $N_item = $cbphoto->collection->get_next_prev_item($item_id,$cid,$direc);
+ increment_views($N_item[0]['photo_id'],'photo');
+ $cbphoto->collection->set_item_cookie($N_item[0]['photo_key']);
+ $ajax['key'] = $N_item[0]['photo_key'];
+ $ajax['cid'] = $N_item[0]['collection_id'];
+
}
break;
}
if($N_item)
{
- $ajax['ci_id'] = $N_item[0]['ci_id'];
- $ajax['cid'] = $N_item[0]['collection_id'];
+ assign('type',$t);
+ assign('object',$N_item[0]);
+ $ajax['content'] = Fetch('view_item.html');
echo json_encode($ajax);
} else {
return false;
@@ -682,27 +765,89 @@ if(!empty($mode))
}
break;
- case "get_item":
+ case "load_more_items":
+ case "more_items":
+ case "moreItems":
{
- $t = $_POST['type'];
- $ci_id = $_POST['ci_id'];
$cid = $_POST['cid'];
-
- switch($t)
+ $page = $_POST['page'];
+ $newPage = $page+1;
+ $type = $_POST['type'];
+ $limit = create_query_limit($page,VLISTPP);
+ $order = tbl("collection_items").".ci_id DESC";
+
+ switch($type)
{
case "videos":
+ case "video":
case "v":
{
- $item = $cbvideo->collection->get_next_prev_item($ci_id,$cid,NULL);
- assign('type',$t);
- assign('object',$item[0]);
+ $items = $cbvideo->collection->get_collection_items_with_details($cid,$order,$limit);
}
+ break;
+
+ case "photos":
+ case "photo":
+ case "p":
+ {
+ $items = $cbphoto->collection->get_collection_items_with_details($cid,$order,$limit);
+ }
+ break;
+ }
+ if($items)
+ {
+ assign('page_no',$newPage);
+ assign('type',$type);
+ assign('cid',$cid);
+ $itemsArray['pagination'] = Fetch("blocks/new_pagination.html");
+
+ foreach($items as $item)
+ {
+ assign('object',$item);
+ assign('display_type','view_collection');
+ assign('type',$type);
+ $itemsArray['content'] .= Fetch("blocks/collection.html");
+ }
+
+ echo json_encode($itemsArray);
+ } else
+ return false;
+ }
+ break;
+
+
+ case "add_collection":
+ {
+ $name = mysql_clean($_POST['collection_name']);
+ $desc = mysql_clean($_POST['collection_description']);
+ $tags = mysql_clean(genTags($_POST['collection_tags']));
+ $cat = ($_POST['category']);
+ $type = "photos";
+ $CollectParams = array("collection_name"=>$name,"collection_description"=>$desc,"collection_tags"=>$tags,"category"=>$cat,"type"=>$type);
+ $cbcollection->create_collection($CollectParams);
+
+ if(msg())
+ {
+ $msg = msg_list();
+ $msg = ''.$msg[0].'
';
}
- if(!empty($item))
+ if(error())
{
- Template('blocks/view_item.html');
+ $err = error_list();
+ $err = ''.$err[0].'
';
}
+
+ $ajax['msg'] = $msg;
+ $ajax['err'] = $err;
+
+ echo json_encode($ajax);
+ }
+ break;
+
+ case "ajaxPhotos":
+ {
+ echo "TEST SUCCESSFULL";
}
break;
diff --git a/upload/includes/classes/collections.class.php b/upload/includes/classes/collections.class.php
index 2c3a93ac..04293d9e 100644
--- a/upload/includes/classes/collections.class.php
+++ b/upload/includes/classes/collections.class.php
@@ -9,25 +9,26 @@
class Collections extends CBCategory
{
- var $collect_thumb_width = 140;
- var $collect_thumb_height = 140;
- var $collect_small_thumb_width = 60;
- var $collect_small_thumb_height = 60;
+ var $collect_thumb_width = 160;
+ var $collect_thumb_height = 120;
+ var $collect_small_thumb_width = 120;
+ var $collect_small_thumb_height = 90;
var $items = 'collection_items'; // ITEMS TABLE
var $types = ''; // TYPES OF COLLECTIONS
var $user_links = '';
var $custom_collection_fields = array();
-
+ var $collection_delete_functions = array();
+ var $action = '';
/**
* Setting variables of different thing which will
* help makes this class reusble for very object
*/
- var $objTable = 'pictures';
+ var $objTable = 'photos';
var $objType = 'p';
- var $objName = 'Picture';
- var $objClass = 'cbpicture';
- var $objFunction = 'picture_exists';
- var $objFieldID = 'picture_id';
+ var $objName = 'Photo';
+ var $objClass = 'cbphoto';
+ var $objFunction = 'photo_exists';
+ var $objFieldID = 'photo_id';
/**
@@ -37,11 +38,26 @@ class Collections extends CBCategory
{
$this->cat_tbl = "collection_categories";
$this->section_tbl = "collections";
- $this->types = array('videos' => lang("Videos"),'pictures' => lang("Pictures"));
+ $this->types = array('videos' => lang("Videos"),'photos' => lang("Photos"));
ksort($this->types);
$this->setting_up_collections();
}
+ /**
+ * Settings up Action Class
+ */
+ function init_actions()
+ {
+ $this->action = new cbactions();
+ $this->action->init(); // Setting up reporting excuses
+ $this->action->type = 'cl';
+ $this->action->name = 'collection';
+ $this->action->obj_class = 'cbcollection';
+ $this->action->check_func = 'collection_exists';
+ $this->action->type_tbl = "collection";
+ $this->action->type_id_field = 'collection_id';
+ }
+
/**
* Setting links up in my account
*/
@@ -53,13 +69,19 @@ class Collections extends CBCategory
$links = array();
$links[lang('Collections')] = array(
lang('Add New Collection') => "manage_collections.php?mode=add_new",
- lang('Manage Collections') => "manage_collections.php"
+ lang('Manage Collections') => "manage_collections.php",
+ lang('Favorite Collections') => "manage_collections.php?mode=favorites"
);
$userquery->user_account = $links;
// Adding Search Type
$Cbucket->search_types['collections'] = "cbcollection";
+ // Adding Collection links in Admin Area
+ $Cbucket->AdminMenu['Collections'] = array(
+ lang('Manage Collections')=>'collection_manager.php',
+ lang('Flagged Collections')=>'flagged_collections.php');
+
// Adding Collection links in Cbucket Class
$Cbucket->links['manage_collections'] = array('manage_collections.php','manage_collections');
$Cbucket->links['edit_collection'] = array('manage_collections.php?mode=edit_collection&cid=',
@@ -120,11 +142,12 @@ class Collections extends CBCategory
'value'=>cleanForm($default['query'])
),
'category' => array(
- 'title' => lang('vdo_cat'),
+ 'title' => lang('category'),
'type' => 'checkbox',
'name' => 'category[]',
'id' => 'category',
'value' => array('category',$cat_array),
+ 'category_type' => 'collections'
),
'uploaded' => array(
'title' => lang('uploaded'),
@@ -140,7 +163,7 @@ class Collections extends CBCategory
'name' => 'sort',
'value' => $sorting,
'checked' => $sort
- )
+ )
);
$this->search->search_type['collections']['fields'] = $fields;
@@ -186,6 +209,31 @@ class Collections extends CBCategory
return false;
}
+ function is_viewable($cid)
+ {
+ global $userquery;
+
+ $c = $this->get_collection($cid);
+ if(empty($c))
+ {
+ e(lang('collection_not_exists'));
+ return false;
+ } elseif($c['active'] == 'no') {
+ e(lang('collection_not_active'));
+ if(!has_access('admin_access',TRUE))
+ return false;
+ else
+ return true;
+ } elseif($c['broadcast'] == 'private' && !$userquery->is_confirmed_friend($c['userid'],userid())
+ && $c['userid']!=userid() && !has_access('admin_access',TRUE))
+ {
+ e(lang('collection_is_private'));
+ return false;
+ } else {
+ return true;
+ }
+ }
+
/**
* Function used to get collections
*/
@@ -197,8 +245,10 @@ class Collections extends CBCategory
$order = $p['order'];
$cond = "";
- if(!has_access('admin_access',TRUE))
+ if(!has_access('admin_access',TRUE) && $p['user'] != userid())
$cond .= " ".tbl('collections.active')." = 'yes' AND ".tbl('collections.broadcast')." = 'public' ";
+ elseif($p['user'] == userid())
+ $cond .= " ".tbl('collections.active')." = 'yes'";
else
{
if($p['active'])
@@ -371,7 +421,7 @@ class Collections extends CBCategory
/**
* Function used to get next / previous collection item
*/
- function get_next_prev_item($ci_id,$cid,$item="prev",$limit=1)
+ function get_next_prev_item($ci_id,$cid,$item="prev",$limit=1,$check_only=false)
{
global $db;
$iTbl = tbl($this->items);
@@ -394,8 +444,34 @@ class Collections extends CBCategory
$op = "=";
$order = '';
}
+
+ $cond = " $iTbl.collection_id = $cid AND $iTbl.ci_id $op $ci_id AND $iTbl.object_id = $oTbl.".$this->objFieldID." AND $oTbl.userid = $uTbl.userid";
+ if(!$check_only)
+ {
+ $result = $db->select($tbls,"$iTbl.*,$oTbl.*,$uTbl.username", $cond,$limit,$order);
- $result = $db->select($tbls,"$iTbl.*,$oTbl.*,$uTbl.username", " $iTbl.collection_id = $cid AND $iTbl.ci_id $op $ci_id AND $iTbl.object_id = $oTbl.".$this->objFieldID." AND $oTbl.userid = $uTbl.userid",$limit,$order);
+ // Result was empty. Checking if we were going backwards, So bring last item
+ if(empty($result) && $item == "prev")
+ {
+ $order = $iTbl.".ci_id ASC";
+ $op = "<";
+ $result = $db->select($tbls,"$iTbl.*,$oTbl.*,$uTbl.username", " $iTbl.collection_id = $cid AND $iTbl.ci_id $op $ci_id AND $iTbl.object_id = $oTbl.".$this->objFieldID." AND $oTbl.userid = $uTbl.userid",$limit,$order);
+ }
+
+ // Result was empty. Checking if we were going fowards, So bring first item
+ if(empty($result) && $item == "next")
+ {
+ $order = $iTbl.".ci_id DESC";
+ $op = ">";
+ $result = $db->select($tbls,"$iTbl.*,$oTbl.*,$uTbl.username", " $iTbl.collection_id = $cid AND $iTbl.ci_id $op $ci_id AND $iTbl.object_id = $oTbl.".$this->objFieldID." AND $oTbl.userid = $uTbl.userid",$limit,$order);
+ }
+ }
+
+ if($check_only)
+ {
+ $result = $db->count($iTbl.",".$oTbl,"$iTbl.ci_id", " $iTbl.collection_id = $cid AND $iTbl.ci_id $op $ci_id AND $iTbl.object_id = $oTbl.".$this->objFieldID,$limit,$order);
+ }
+
//echo $db->db_query;
if($result)
return $result;
@@ -404,6 +480,18 @@ class Collections extends CBCategory
}
+ /**
+ * Function used to set cookie on moving
+ * forward or backward
+ */
+ function set_item_cookie($value)
+ {
+ if(isset($_COOKIE['current_item']))
+ unset($_COOKIE['current_item']);
+
+ setcookie('current_item',$value,time()+240);
+ }
+
/**
* Function used to get collection items with details
*/
@@ -416,7 +504,7 @@ class Collections extends CBCategory
if(!$count_only)
{
- $result = $db->select($tables,"$itemsTbl.*,$objTbl.*,".tbl('users').".username"," $itemsTbl.collection_id = '$id' AND $itemsTbl.object_id = $objTbl.".$this->objFieldID." AND $objTbl.userid = ".tbl('users').".userid",$limit,$order);
+ $result = $db->select($tables,"$itemsTbl.ci_id,$itemsTbl.collection_id,$objTbl.*,".tbl('users').".username"," $itemsTbl.collection_id = '$id' AND $itemsTbl.object_id = $objTbl.".$this->objFieldID." AND $objTbl.userid = ".tbl('users').".userid",$limit,$order);
//echo $db->db_query;
} else {
$result = $db->count($itemsTbl,"ci_id"," collection_id = $id");
@@ -430,6 +518,20 @@ class Collections extends CBCategory
return false;
}
+ /**
+ * Function used to get collection items with
+ * specific fields
+ */
+ function get_collection_item_fields($cid,$objID,$fields)
+ {
+ global $db;
+ $result = $db->select(tbl($this->items),$fields," object_id = $objID AND collection_id = $cid");
+ if($result)
+ return $result;
+ else
+ return false;
+ }
+
/**
* Function used to load collections fields
*/
@@ -471,6 +573,7 @@ class Collections extends CBCategory
'value' => $description,
'db_field' => 'collection_description',
'required' => 'yes',
+ 'anchor_before' => 'before_desc_compose_box',
'invalid_err' => lang("collect_descp_er")
),
'tags' => array(
@@ -777,10 +880,20 @@ class Collections extends CBCategory
$collection = $this->get_collection($cid);
if(empty($collection))
e("collection_not_exists");
- elseif($collection['userid'] != userid() || !has_access('admin_access',true))
+ elseif($collection['userid'] != userid() && !has_access('admin_access',true))
e("cant_perform_action_collect");
else
{
+ $del_funcs = $this->collection_delete_functions;
+ if(is_array($del_funcs) && !empty($del_funcs))
+ {
+ foreach($del_funcs as $func)
+ {
+ if(function_exists($func))
+ $func($collection);
+ }
+ }
+
$db->delete(tbl($this->items),array("collection_id"),array($cid));
$this->delete_thumbs($cid);
$db->delete(tbl($this->section_tbl),array("collection_id"),array($cid));
@@ -797,7 +910,7 @@ class Collections extends CBCategory
$collection = $this->get_collection($id);
if(!$collection)
e("collection_not_exists");
- elseif($collection['userid'] != userid() || !has_access('admin_access',true))
+ elseif($collection['userid'] != userid() && !has_access('admin_access',true))
e("cant_perform_action_collect");
else {
$db->delete(tbl($this->items),array("collection_id"),array($cid));
@@ -819,7 +932,7 @@ class Collections extends CBCategory
e("you_not_logged_in");
elseif(!$this->object_in_collection($id,$cid))
e(sprintf(lang("object_not_in_collect"),$this->objName));
- elseif(!$this->is_collection_owner($cid) || !has_access('admin_access',true))
+ elseif(!$this->is_collection_owner($cid) && !has_access('admin_access',true))
e("cant_perform_action_collect");
else
{
@@ -869,7 +982,7 @@ class Collections extends CBCategory
*/
function upload_thumb($cid,$file)
{
- global $imgObj;
+ global $imgObj,$cbphoto;
$file_ext = strtolower(getext($file['name']));
$exts = array("jpg","gif","jpeg","png");
@@ -890,8 +1003,8 @@ class Collections extends CBCategory
e("pic_upload_vali_err");
else
{
- $imgObj->CreateThumb($thumb,$thumb,$this->collect_thumb_width,$ext,$this->collect_thumb_height,true);
- $imgObj->CreateThumb($thumb,$sThumb,$this->collect_small_thumb_width,$ext,$this->collect_small_thumb_height,true);
+ $imgObj->createThumb($thumb,$thumb,$this->collect_thumb_width,$ext,$this->collect_thumb_height);
+ $imgObj->createThumb($thumb,$sThumb,$this->collect_small_thumb_width,$ext,$this->collect_small_thumb_height);
}
}
}
@@ -954,22 +1067,24 @@ class Collections extends CBCategory
if(has_access('admin_access',TRUE))
{
- if(!empty($array['featured']))
- {
- $query_field[] = "featured";
- $query_val[] = $array['featured'];
- }
if(!empty($array['total_comments']))
{
+ $total_comments = $array['total_comments'];
+ if(!is_numeric($total_comments) || $total_comments<0)
+ $total_comments = 0;
+
$query_field[] = "total_comments";
- $query_val[] = $array['total_comments'];
+ $query_val[] = $total_comments;
}
if(!empty($array['total_objects']))
{
+ $tobj = $array['total_objects'];
+ if(!is_numeric($tobj) || $tobj<0)
+ $tobj = 0;
$query_field[] = "total_objects";
- $query_val[] = $array['total_objects'];
+ $query_val[] = $tobj;
}
}
}
@@ -980,7 +1095,7 @@ class Collections extends CBCategory
e("you_not_logged_in");
elseif(!$this->collection_exists($cid))
e("collect_not_exist");
- elseif(!$this->is_collection_owner($cid,userid()))
+ elseif(!$this->is_collection_owner($cid,userid()) && !has_access('admin_access',TRUE))
e("cant_edit_collection");
else
{
@@ -1037,7 +1152,7 @@ class Collections extends CBCategory
return COLLECT_THUMBS_URL."/".$cid.$s.".".$ext;
}
} else {
- $item = $this->get_collection_items($cid,'date_added DESC',1);
+ $item = $this->get_collection_items($cid,'ci_id DESC',1);
$type = $item[0]['type'];
switch($type)
{
@@ -1050,8 +1165,8 @@ class Collections extends CBCategory
case "p":
{
- global $cbpicture;
- return $cbpicture->get_preview($cbpicture->get_pic_details($item[0]['object_id']));
+ global $cbphoto;
+ return $cbphoto->get_image_file($cbphoto->get_photo($item[0]['object_id']));
}
}
}
@@ -1071,9 +1186,42 @@ class Collections extends CBCategory
{
global $cbvideo;
$items = $cbvideo->collection->get_collection_items_with_details($cid);
+ $total_rating = '';
+ if(!empty($items))
+ {
+ foreach($items as $item)
+ {
+ $total_rating += $item['rating'];
+ if(!empty($item['rated_by']) && $item['rated_by'] != 0)
+ $voters[] = $item['rated_by'];
+ }
+ }
+ }
+ break;
+
+ case "photos":
+ case "p":
+ {
+ global $cbphoto;
+ $items = $cbphoto->collection->get_collection_items_with_details($cid);
+ $total_rating = '';
+ if(!empty($items))
+ {
+ foreach($items as $item)
+ {
+ $total_rating += $item['rating'];
+ if(!empty($item['rated_by']) && $item['rated_by'] != 0)
+ $voters[] = $item['rated_by'];
+ }
+ }
}
}
-
+ $total_voters = count($voters);
+ if(!empty($total_rating) && $total_voters != 0)
+ {
+ $collect_rating = $total_rating / $total_voters;
+ return $collect_rating;
+ }
}
/**
@@ -1123,10 +1271,10 @@ class Collections extends CBCategory
* Function used return collection links
*/
function collection_links($details,$type=NULL)
- {
+ {
if(is_array($details))
{
- if(empty($details['collection_name']))
+ if(empty($details['collection_id']))
return BASEURL;
else
$cdetails = $details;
@@ -1152,12 +1300,77 @@ class Collections extends CBCategory
return BASEURL."/collection/".$cdetails['collection_id']."/".$cdetails['type']."/".SEO(clean(str_replace(' ','-',$cdetails['collection_name'])))."";
else
return BASEURL."/view_collection.php?cid=".$cdetails['collection_id']."&type=".$cdetails['type'];
+ } elseif($type == "vi" || $type == "view_item" ||$type == "item") {
+ $item_type = $this->get_collection_field($cdetails['collection_id'],'type');
+
+ switch($item_type)
+ {
+ case "videos":
+ case "v":
+ {
+ if(SEO == "yes")
+ return BASEURL."/item/".$item_type."/".$details['collection_id']."/".$details['videokey'];
+ else
+ return BASEURL."/view_item.php?item=".$details['videokey']."&type=".$item_type."&collection=".$details['collection_id'];
+ }
+ break;
+
+ case "photos":
+ case "p":
+ {
+ if(SEO == "yes")
+ return BASEURL."/item/".$item_type."/".$details['collection_id']."/".$details['photo_key'];
+ else
+ return BASEURL."/view_item.php?item=".$details['photo_key']."&type=".$item_type."&collection=".$details['collection_id'];
+ }
+ break;
+ }
+ } elseif($type == 'load_more' || $type == 'more_items' || $type='moreItems') {
+ if(empty($cdetails['page_no']))
+ $cdetails['page_no'] = 2;
+
+ if(SEO == 'yes')
+ return "?cid=".$cdetails['collection_id']."&type=".$cdetails['type']."&page=".$cdetails['page_no'];
+ else
+ return "?cid=".$cdetails['collection_id']."&type=".$cdetails['type']."&page=".$cdetails['page_no'];
}
} else {
return BASEURL;
}
}
+ /**
+ * Used to update counts
+ */
+ function update_collection_counts($id,$amount,$op)
+ {
+ global $db;
+ $db->update(tbl("collections"),array("total_objects"),array("|f|total_objects$op$amount")," collection_id = $id");
+ }
+
+ /**
+ * Used to change collection of product
+ */
+ function change_collection($new,$obj,$old=NULL)
+ {
+ global $db;
+
+ /* THIS MEANS OBJECT IS ORPHAN MOST PROBABLY AND HOPEFULLY - PHOTO
+ NOW WE WILL ADD $OBJ TO $NEW */
+ if($old == 0 || $old == NULL)
+ {
+ $this->add_collection_item($obj,$new);
+ } else {
+ $update = $db->update(tbl($this->items),array('collection_id'),array($new)," collection_id = $old AND type = '".$this->objType."' AND object_id = $obj");
+
+ if(!empty($update))
+ {
+ $this->update_collection_counts($new,1,'+');
+ $this->update_collection_counts($old,1,'-');
+ }
+ }
+ }
+
/**
* Sorting links for collection
*/
@@ -1176,6 +1389,57 @@ class Collections extends CBCategory
return $array;
}
+ /**
+ * Used to perform actions on collection
+ */
+ function collection_actions($action,$cid)
+ {
+ global $db;
+ switch($action)
+ {
+ case "activate":
+ case "activation":
+ case "ac":
+ {
+ $db->update(tbl($this->section_tbl),array("active"),array("yes")," collection_id = $cid");
+ e("collection_activated","m");
+ }
+ break;
+
+ case "deactivate":
+ case "deactivation":
+ case "dac":
+ {
+ $db->update(tbl($this->section_tbl),array("active"),array("no")," collection_id = $cid");
+ e("collection_deactivated","m");
+ }
+ break;
+
+ case "make_feature":
+ case "featured":
+ case "mcf":
+ {
+ $db->update(tbl($this->section_tbl),array("featured"),array("yes")," collection_id = $cid");
+ e("collection_featured","m");
+ }
+ break;
+
+ case "make_unfeature":
+ case "unfeatured":
+ case "mcuf":
+ {
+ $db->update(tbl($this->section_tbl),array("featured"),array("no")," collection_id = $cid");
+ e("collection_unfeatured","m");
+ }
+ break;
+
+ default:
+ {
+ header("location:".BASEURL);
+ }
+ }
+ }
+
}
?>
\ No newline at end of file
diff --git a/upload/includes/classes/form.class.php b/upload/includes/classes/form.class.php
index 9bba1b99..46906aa0 100644
--- a/upload/includes/classes/form.class.php
+++ b/upload/includes/classes/form.class.php
@@ -177,7 +177,11 @@ class formObj
$field_name = $this->rmBrackets($field_name);
$field_name = $field_name.$multi_cat_id.'[]';
}
- echo ' '.$value.' ' ;
+
+ if(!empty($field['id']))
+ $field_id = ' id="'.$field['id'].'" ';
+
+ echo ' '.$value.' ' ;
echo $field['sep'];
}
}
@@ -215,13 +219,15 @@ class formObj
$checked = '';
$count++;
}
+ if(!empty($field['id']))
+ $field_id = ' id="'.$field['id'].'" ';
if(!$multi)
$field_name = $field['name'];
else
$field_name = $field['name'].'[]';
- echo ' '.$value.' ' ;
+ echo ' '.$value.' ' ;
echo $sep;
}
}
diff --git a/upload/includes/classes/user.class.php b/upload/includes/classes/user.class.php
index 6d7b82c9..215e33dc 100644
--- a/upload/includes/classes/user.class.php
+++ b/upload/includes/classes/user.class.php
@@ -3745,12 +3745,12 @@ class userquery extends CBCategory{
$cond .= ' AND ';
$cond .= " ".$params['cond']." ";
}
-
- $result = $db->select(tbl('users'),'*',$cond,$limit,$order);
+ if(!$params['count_only'])
+ $result = $db->select(tbl('users'),'*',$cond,$limit,$order);
if($params['count_only'])
- return $result = $db->count(tbl('users'),'*',$cond);
+ return $result = $db->count(tbl('users'),'userid',$cond);
if($params['assign'])
assign($params['assign'],$result);
else
diff --git a/upload/includes/common.php b/upload/includes/common.php
index de7c6c78..ab91509e 100644
--- a/upload/includes/common.php
+++ b/upload/includes/common.php
@@ -27,6 +27,7 @@ define("DEV_INGNORE_SYNTAX",FALSE);
define('COOKIE_TIMEOUT',86400*30); // 30 Days
define('GARBAGE_TIMEOUT',COOKIE_TIMEOUT);
+
if(!@$in_bg_cron)
{
//Setting Session Max Life
@@ -77,6 +78,7 @@ if(!@$in_bg_cron)
require_once('classes/cbpage.class.php');
require_once('classes/reindex.class.php');
require_once('classes/collections.class.php');
+ require_once('classes/photos.class.php');
//Adding Gravatar
require_once('classes/gravatar.class.php');
@@ -108,6 +110,7 @@ if(!@$in_bg_cron)
$cbpage = new cbpage();
$cbindex = new CBreindex();
$cbcollection = new Collections();
+ $cbphoto = new CBPhotos();
require 'defined_links.php';
@@ -294,9 +297,22 @@ if(phpversion() < '5.2.0')
define('TOPIC_ICON_DIR',BASEDIR.'/images/icons/topic_icons');
define('TOPIC_ICON_URL',BASEURL.'/images/icons/topic_icons');
- //TOPIC ICON DIR
+ //COLLECTIONS ICON DIR
define('COLLECT_THUMBS_DIR',BASEDIR.'/images/collection_thumbs');
define('COLLECT_THUMBS_URL',BASEURL.'/images/collection_thumbs');
+
+ //PHOTOS DETAILS
+ define('PHOTOS_DIR',FILES_DIR."/photos");
+ define('PHOTOS_URL',FILES_URL."/photos");
+
+ //SETTING PHOTO SETTING
+ $cbphoto->thumb_width = $row['photo_thumb_width'];
+ $cbphoto->thumb_height = $row['photo_thumb_height'];
+ $cbphoto->mid_width = $row['photo_med_width'];
+ $cbphoto->mid_height = $row['photo_med_height'];
+ $cbphoto->lar_width = $row['photo_lar_width'];
+ $cbphoto->cropping = $row['photo_crop'];
+ $cbphoto->position = $row['watermark_placement'];
//Enable youtube videos
define("YOUTUBE_ENABLED",$row['youtube_enabled']);
@@ -420,6 +436,7 @@ $Smarty->assign_by_ref('cbpm',$cbpm);
$Smarty->assign_by_ref('cbpage',$cbpage);
$Smarty->assign_by_ref('cbemail',$cbemail);
$Smarty->assign_by_ref('cbcollection',$cbcollection);
+$Smarty->assign_by_ref('cbphoto',$cbphoto);
/*
REGISERTING FUNCTION FOR SMARTY TEMPLATES
*/
@@ -450,6 +467,7 @@ $Smarty->register_function('lang','smarty_lang');
$Smarty->register_function('get_videos','get_videos');
$Smarty->register_function('get_users','get_users');
$Smarty->register_function('get_groups','get_groups');
+$Smarty->register_function('get_photos','get_photos');
$Smarty->register_function('private_message','private_message');
$Smarty->register_function('show_video_rating','show_video_rating');
$Smarty->register_function('load_captcha','load_captcha');
@@ -462,6 +480,9 @@ $Smarty->register_function('get_binaries','get_binaries');
$Smarty->register_function('check_module_path','check_module_path');
$Smarty->register_function('rss_feeds','rss_feeds');
$Smarty->register_function('website_logo','website_logo');
+$Smarty->register_function('get_photo','get_photo');
+$Smarty->register_function('uploadButton','upload_photo_button');
+$Smarty->register_function('embedCodes','photo_embed_codes');
$Smarty->register_modifier('SetTime','SetTime');
$Smarty->register_modifier('getname','getname');
@@ -482,7 +503,9 @@ $Smarty->register_modifier('cbsearch',new cbsearch());
$Smarty->register_modifier('flag_type','flag_type');
$Smarty->register_modifier('get_username','get_username');
$Smarty->register_modifier('formatfilesize','formatfilesize');
-
+$Smarty->register_modifier('getWidth','getWidth');
+$Smarty->register_modifier('getHeight','getHeight');
+$Smarty->register_modifier('get_collection_name','get_collection_name');
/*
* Registering Video Remove Functions
@@ -507,6 +530,7 @@ include('admin.functions.php');
//Other settings
define("SEND_COMMENT_NOTIFICATION",config("send_comment_notification"));
define("SEND_VID_APPROVE_EMAIL",config("approve_video_notification"));
+
?>
\ No newline at end of file
diff --git a/upload/includes/functions.php b/upload/includes/functions.php
index ab289b57..b6ca4922 100644
--- a/upload/includes/functions.php
+++ b/upload/includes/functions.php
@@ -121,7 +121,18 @@
';
exit("Javascript is turned off, click here to go to requested page ");
}
-
+
+ //Test function to return template file
+ function Fetch($name,$inside=FALSE)
+ {
+ if($inside)
+ $file = CBTemplate::fetch(LAYOUT.'/'.$inside.'/'.$name);
+ else
+ $file = CBTemplate::fetch(LAYOUT.'/'.$name);
+
+ return $file;
+ }
+
//Simple Template Displaying Function
function Template($template,$layout=true){
@@ -394,7 +405,44 @@
}else {
return false;
}
- }
+ }
+
+ //Simple Width Fetcher
+ function getWidth($file)
+ {
+ $sizes = getimagesize($file);
+ if($sizes)
+ return $sizes[0];
+ }
+
+ //Simple Height Fetcher
+ function getHeight($file)
+ {
+ $sizes = getimagesize($file);
+ if($sizes)
+ return $sizes[1];
+ }
+
+ //Photo File Fetcher
+ function get_photo($params)
+ {
+ global $cbphoto;
+ $cbphoto->getFileSmarty($params);
+ }
+
+ //Photo Upload BUtton
+ function upload_photo_button($params)
+ {
+ global $cbphoto;
+ $cbphoto->upload_photo_button($params);
+ }
+
+ //Photo Embed Cides
+ function photo_embed_codes($params)
+ {
+ global $cbphoto;
+ $cbphoto->photo_embed_codes($params);
+ }
//Function Used To Validate Email
@@ -2806,6 +2854,18 @@
setcookie('collection_'.$id,'viewed',time()+3600);
}
}
+ break;
+
+ case "photos":
+ case "photo":
+ case "p":
+ {
+ if(!isset($_COOKIE['photo_'.$id]))
+ {
+ $db->update(tbl('photos'),array("views","last_viewed"),array("|f|views+1",NOW())," photo_id = '$id'");
+ setcookie('photo_'.$id,'viewed',time()+3600);
+ }
+ }
}
}
@@ -3143,6 +3203,15 @@
return $cbvideo->get_videos($param);
}
+ /**
+ * function used to get photos
+ */
+ function get_photos($param)
+ {
+ global $cbphoto;
+ return $cbphoto->get_photos($param);
+ }
+
/**
* function used to get vidos
@@ -3537,6 +3606,39 @@
return $userquery->get_username($uid,'username');
}
+ /**
+ * Function used to get collection name from id
+ * Smarty Function
+ */
+ function get_collection_field($cid,$field='collection_name')
+ {
+ global $cbcollection;
+ return $cbcollection->get_collection_field($cid,$field);
+ }
+
+ /**
+ * Function used to delete photos if
+ * whole collection is being deleted
+ */
+ function delete_collection_photos($details)
+ {
+ global $cbcollection,$cbphoto;
+ $type = $details['type'];
+
+ if($type == 'photos')
+ {
+ $ps = $cbphoto->get_photos(array("collection"=>$details['collection_id']));
+ if(!empty($ps))
+ {
+ foreach($ps as $p)
+ {
+ $cbphoto->make_photo_orphan($details,$p['photo_id']);
+ }
+ unset($ps); // Empty $ps. Avoiding the duplication prob
+ }
+ }
+ }
+
/**
* FUnction used to get head menu
*/
diff --git a/upload/includes/plugin.functions.php b/upload/includes/plugin.functions.php
index 9682a618..3873bd22 100644
--- a/upload/includes/plugin.functions.php
+++ b/upload/includes/plugin.functions.php
@@ -246,6 +246,12 @@
$Cbucket->actions_play_video[] = $func;
}
+ function register_collection_delete_functions($func)
+ {
+ global $cbcollection;
+ $cbcollection->collection_delete_functions[] = $func;
+ }
+
/**
diff --git a/upload/includes/plugins_functions.php b/upload/includes/plugins_functions.php
index 18846141..d06739f9 100644
--- a/upload/includes/plugins_functions.php
+++ b/upload/includes/plugins_functions.php
@@ -139,6 +139,20 @@
$obj = $cbgroup;
}
break;
+ case 'user':
+ case 'users':
+ {
+ global $userquery;
+ $obj = $userquery;
+ }
+ break;
+ case 'collection':
+ case 'collections':
+ {
+ global $cbcollection;
+ $obj = $cbcollection;
+ }
+ break;
}
preg_match_all('/#([0-9]+)#/',$input,$m);
diff --git a/upload/js/functions.js b/upload/js/functions.js
index 100e3cee..5814a26b 100644
--- a/upload/js/functions.js
+++ b/upload/js/functions.js
@@ -954,47 +954,196 @@ function collection_actions(form,mode,objID,result_con,type,cid)
return false;
}
-function get_collection_item(obj,ci_id,cid,type,direction)
-{
- var btn_text = $(obj).text();
- $(obj).text('Working ...');
- $(obj).attr('disabled','disalbed');
- $.post(page,
- {
- mode : 'NePrItem',
- item_id : ci_id,
- cid : cid,
- type : type,
- direction: direction
- },
- function(data)
- {
- if(!data)
- {
- alert("No "+btn_text+" "+type+" Found");
- $(obj).text(btn_text);
- $(obj).removeAttr('disabled');
- } else {
- //alert(data);
- get_item(data.ci_id,data.cid,type);
- }
- },'json')
+// Simple function to open url with javascript
+function openURL(url) {
+ document.location = url;
}
-function get_item(ci_id,cid,type)
+
+
+function get_item(obj,ci_id,cid,type,direction)
{
- $("#collectionItemsList div").removeClass('selected');
- $("#item_"+ci_id).addClass('selected');
-
+ var btn_text = $(obj).text();
+ $(obj).text('Working');
+
$.post(page,
{
mode : 'get_item',
ci_id: ci_id,
cid : cid,
- type: type
+ type: type,
+ direction: direction
},
function(data)
{
- $("#collectionItemView").html(data);
- },'text')
-}
\ No newline at end of file
+ if(!data)
+ {
+ alert('No '+type+' returned');
+ $(obj).text(btn_text);
+ } else {
+ var jsArray = new Array(type,data['cid'],data['key']);
+ construct_url(jsArray);
+ $("#collectionItemView").html(data['content']);
+ }
+ },'json')
+}
+
+function construct_url(jsArr)
+{
+ var url;
+ if(Seo == 'yes')
+ {
+ url = '#!/item/'+jsArr[0]+'/'+jsArr[1]+'/'+jsArr[2];
+ window.location.hash = url
+ } else {
+ url = '#!?item='+jsArr[2]+'&type='+jsArr[0]+'&collection='+jsArr[1];
+ window.location.hash = url
+ }
+}
+
+function onReload_item()
+{
+ var comURL,
+ regEX;
+ if(window.location.hash)
+ {
+ comURL = window.location.href;
+ if(Seo == 'yes')
+ {
+ regEX = RegExp('\/item.+#!');
+ if(regEX.test(comURL))
+ {
+ comURL = comURL.replace(regEX,'');
+ window.location.href = comURL;
+ }
+ } else {
+ regEX = RegExp('\\\?item.+#!');
+ if(regEX.test(comURL))
+ { comURL = comURL.replace(regEX,'')
+ window.location.href = comURL;
+ }
+ }
+ }
+}
+
+function pagination(object,cid,type,pageNumber)
+{
+ obj = $(object); objID = obj.id; parent = obj.parent();
+
+ if(parent.attr('id'))
+ parentID = parent.attr('id')
+ else
+ { parent.attr('id','loadMoreParent'); parentID = parent.attr('id'); }
+
+ newCall =
+ $.ajax({
+ url: page,
+ type: "post",
+ dataType: "json",
+ data: { mode: "moreItems", page:pageNumber, cid: cid, type: type },
+ beforeSend: function() { obj.removeAttr('onClick'); obj.html(loading) },
+ success : function(data) {
+ if(!data)
+ {
+ if(object.tagName == "BUTTON")
+ obj.attr('disabled','disabled');
+ obj.removeAttr('onClick'); obj.text('No more '+type);
+ } else {
+ $('#collectionItemsList').append(data['content']);
+ $('#NewPagination').html(data['pagination']);
+ obj.text('Load More');
+ }
+ }
+ });
+}
+
+function ajax_add_collection(obj)
+{
+ var formID = obj.form.id, Form = $('#'+formID),
+ This = $(obj), AjaxCall, ButtonHTML = This.html(),
+ Result = $('#CollectionResult');
+ AjaxCall =
+ $.ajax
+ ({
+ url: page,
+ type: "post",
+ dataType: "json",
+ data: "mode=add_collection&"+Form.serialize(),
+ beforeSend: function() { if(Result.css('display') == 'block') Result.slideUp('fast'); This.attr('disabled','disabled'); This.html(loading) },
+ success: function(data) {
+ if(data.msg)
+ {
+ $('#CollectionDIV').slideUp('fast');
+ Result.html(data['msg']).slideDown('fast');
+ }
+ else
+ {
+ Result.html(data['err']).slideDown('fast');
+ This.removeAttr('disabled'); This.html(ButtonHTML);
+ }
+ }
+ });
+}
+
+function updatePhotos(obj)
+{
+ var ID = obj.form.id,
+ Child = $("#"+ID).children().filter('div'),
+ total = Child.length, eachObj, AjaxCall;
+ for(i=0;icollection->get_collection_items_with_details($cid,$order);
}
break;
+
+ case "photos":
+ {
+ if(isset($_POST['delete_selected']))
+ {
+ $count = count($_POST['check_item']);
+ for($i=0;$i<$count;$i++)
+ {
+ $cbphoto->collection->remove_item($_POST['check_item'][$i],$cid);
+ }
+ $eh->flush();
+ e(sprintf("selected_items_removed","pictures"),"m");
+ }
+ $objs = $cbphoto->collection->get_collection_items_with_details($cid,$order);
+ }
+ break;
}
$collection = $cbcollection->get_collection($cid);
diff --git a/upload/player/pak_player/pak_player.php b/upload/player/pak_player/pak_player.php
index 4ec3d12a..970924ac 100644
--- a/upload/player/pak_player/pak_player.php
+++ b/upload/player/pak_player/pak_player.php
@@ -76,9 +76,9 @@ if(!function_exists("pak_player"))
$in['height'] = $in['height'].'px';
if($in['autoplay'] =='yes' || $in['autoplay']===true)
- $in['autoplay'] = "true";
+ $in['autoplay'] = true;
else
- $in['autoplay'] = "false";
+ $in['autoplay'] = false;
//Logo Placement
@@ -110,7 +110,7 @@ if(!function_exists("pak_player"))
break;
}
-
+
assign('player_data',$in);
assign('player_logo',website_logo());
assign('normal_vid_file',$vid_file);
diff --git a/upload/player/pak_player/player.html b/upload/player/pak_player/player.html
index 18efa2c7..03018209 100644
--- a/upload/player/pak_player/player.html
+++ b/upload/player/pak_player/player.html
@@ -85,7 +85,7 @@ flowplayer("the_Video_Player", "{$pak_player_url}/pak_player{if $Cbucket->config
,
clip:{
{/literal}
- autoplay:'{$player_data.autoplay}',
+ autoPlay :'{$player_data.autoplay}',
{if $youtube}
url : 'api:{$ytcode}',
diff --git a/upload/styles/cbv2new/layout/blocks/collection.html b/upload/styles/cbv2new/layout/blocks/collection.html
index 1c2e264e..4e0e9665 100644
--- a/upload/styles/cbv2new/layout/blocks/collection.html
+++ b/upload/styles/cbv2new/layout/blocks/collection.html
@@ -1,28 +1,35 @@
{if $display_type == "" || $display_type == "normal"}
-
+
{$collection.total_objects|number_format} {$collection.type|capitalize}
{$collection.views} {lang code="views"}
{$collection.username|truncate:16}
- {$cbcollection->collection_rating($collection.collection_id,"videos")}
+ {assign var=rating value=$cbcollection->collection_rating($collection.collection_id,$collection.type)}
+
{show_rating class='rating' rating=$rating total='10'}
{/if}
{if $display_type == "view_collection"}
+
{if $type == "videos"}
-
+
{/if}
+
+ {if $type == "photos"}
+
+ {/if}
+
{/if}
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/blocks/group.html b/upload/styles/cbv2new/layout/blocks/group.html
index fd7f2940..81849e28 100644
--- a/upload/styles/cbv2new/layout/blocks/group.html
+++ b/upload/styles/cbv2new/layout/blocks/group.html
@@ -8,3 +8,4 @@
discussions : {$group.total_topics|number_format}
owner : {$group.username}
+
{$collection.date_added|date_format}
@@ -44,4 +44,28 @@
{/if}
+
+ {if $type == "photos"}
+
+
+
+
+
+
+
+ {get_photo style='padding:1px; border:1px solid #999; float:left;' details=$collection output="html"}
+ {$collection.photo_title|truncate:100}
+
{lang code="view"}
+
+
+ {$collection.date_added|date_format}
+ {$collection.views|number_format}
+
+
+
+
+
+
+
+ {/if}
{/if}
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/blocks/new_pagination.html b/upload/styles/cbv2new/layout/blocks/new_pagination.html
new file mode 100644
index 00000000..6f6de447
--- /dev/null
+++ b/upload/styles/cbv2new/layout/blocks/new_pagination.html
@@ -0,0 +1,4 @@
+{if $page_no}{assign var=ajaxPage value=$page_no}{else}{assign var=ajaxPage value=2}{/if}
+
+ Load More
+
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/blocks/photo.html b/upload/styles/cbv2new/layout/blocks/photo.html
new file mode 100644
index 00000000..2a6f9edb
--- /dev/null
+++ b/upload/styles/cbv2new/layout/blocks/photo.html
@@ -0,0 +1,9 @@
+{if $display_type == 'related_photos'}
+
+{/if}
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/blocks/upload_head.html b/upload/styles/cbv2new/layout/blocks/upload_head.html
new file mode 100644
index 00000000..5781eb44
--- /dev/null
+++ b/upload/styles/cbv2new/layout/blocks/upload_head.html
@@ -0,0 +1,54 @@
+{if $smarty.get.collection}
+ {assign var=c value=$cbphoto->collection->get_collection($smarty.get.collection)}
+ {if $cbphoto->is_addable($c.collection_id)}
+
+
You are about to add new photos in {$c.collection_name}
+
+
+
+
+
+
+
+
+ Total Items: {$c.total_objects}
+ Views: {$c.views|number_format}
+ Date Added: {$c.date_added|niceTime}
+
+
+
+
+
+ {else}
+
+
You can not add new photos in collection because of following reasons:
+
+
Collection does not exist.
+ It is unactive.
+ It is private.
+ Your are not own of collection.
+ You can select collection once your photos have been uploaded.
+
+
+ {/if}
+{else}
+ {if !$c}
+
+
Create Collection
+ {assign var='reqFields' value=$cbcollection->load_required_fields()}
+
+
+ {foreach from=$reqFields item=field}
+ {if $field.id != 'type'}
+
+ {$field.title}
+ {$formObj->createField($field)}
+
+ {/if}
+ {/foreach}
+
Add Collection
+
+
+
+ {/if}
+{/if}
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/global_header.html b/upload/styles/cbv2new/layout/global_header.html
index e6585640..fa2ac6fa 100644
--- a/upload/styles/cbv2new/layout/global_header.html
+++ b/upload/styles/cbv2new/layout/global_header.html
@@ -52,6 +52,7 @@ var imageurl = '{$imageurl}';
{/foreach}
+{include_header file='global_header'}
{foreach from=$Cbucket->header_files key=file item=type}
@@ -62,7 +63,6 @@ var imageurl = '{$imageurl}';
-
{foreach key=file item=type from=$Cbucket->header_files}
{include_header file=$file type=$type}
@@ -81,7 +81,7 @@ var mid = {$smarty.get.mid};
{/if}
-{include_header file='global_header'}
+
{literal}
@@ -116,6 +116,7 @@ var mid = {$smarty.get.mid};
window.location = "?set_site_lang="+optionSelectedValue;
});
get_video('recent_viewed_vids','#index_vid_container');
+
});
@@ -148,7 +149,35 @@ var mid = {$smarty.get.mid};
+{literal}
+
+{/literal}
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/index.html b/upload/styles/cbv2new/layout/index.html
index 61198941..f7aae056 100644
--- a/upload/styles/cbv2new/layout/index.html
+++ b/upload/styles/cbv2new/layout/index.html
@@ -32,6 +32,7 @@
{lang code='being_watched'}
{lang code='most_viewed'}
{lang code='recently_added'}
+ Bookmark Site
@@ -53,7 +54,7 @@
-
{AD place=ad_300x250}
+ {AD place=ad_300x250}
{if !$userquery->login_check('',true)}
@@ -85,6 +86,7 @@
{lang code='t_10_users'}
{get_users assign=topusers limit=10 order=' total_videos DESC '}
+
{section name=tusers loop=$topusers}
{$smarty.section.tusers.iteration}
diff --git a/upload/styles/cbv2new/layout/photo_upload.html b/upload/styles/cbv2new/layout/photo_upload.html
new file mode 100644
index 00000000..ea3ad694
--- /dev/null
+++ b/upload/styles/cbv2new/layout/photo_upload.html
@@ -0,0 +1,66 @@
+
+
+
+{if $step == 1 || $step == ""}
+ {include file="$style_dir/blocks/upload_head.html"}
+
+ {lang code="Continue"}
+{/if}
+
+{if $step == 2}
+ Save All
+
+ {section name=p_list loop=$photos}
+ {assign var='reqFields' value=$cbphoto->load_required_forms($photos[p_list])}
+ {assign var='otherFields' value=$cbphoto->load_other_forms($photos[p_list])}
+
+
+
+
+ {foreach from=$reqFields item=item}
+
+
{$item.title}
+ {$formObj->createField($item)}
+ {if $item.hint_1}
+
+
{$item.hint_1}
+ {/if}
+
+ {/foreach}
+
+
+
+
+ {get_photo details=$photos[p_list] output='html' size='m'}
+
+
+
+
+
+
+ {foreach from=$otherFields item=field}
+ {$field.title}
+ {$formObj->createField($field)}
+ {/foreach}
+
+
+
+ {/section}
+{/if}
+
+{if $step == 3}
+ Photos have uploaded successfully.
+{/if}
+
+
+
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/search.html b/upload/styles/cbv2new/layout/search.html
index 7b54ff61..bf94fc11 100644
--- a/upload/styles/cbv2new/layout/search.html
+++ b/upload/styles/cbv2new/layout/search.html
@@ -17,10 +17,13 @@
{foreach from=$Cbucket->search_types item=search_type key=search_type_key}
+
{if $search_type}
{assign var='type' value=$cbsearch->init_search($search_type_key)}
+
{if $type}
{assign var='types' value=$type->search_type}
+
{foreach from=$types key=stype item=search}
{lang code='search_for_s' assign='searchfor'}
diff --git a/upload/styles/cbv2new/layout/view_collection.html b/upload/styles/cbv2new/layout/view_collection.html
index e6d2e58b..147137ab 100644
--- a/upload/styles/cbv2new/layout/view_collection.html
+++ b/upload/styles/cbv2new/layout/view_collection.html
@@ -1,30 +1,27 @@
-
{$c.collection_name}
+
{$c.collection_name}
+ {uploadButton details=$c target='_blank'}
-
-
- {section name=item loop=$objects max=1}
- {include file="$style_dir/blocks/view_item.html" object=$objects[item]}
- {/section}
-
-
+
-
-
{$c.type|capitalize} ({$c.total_objects})
-
-
-
- {section name=o_list loop=$objects}
- {include file="$style_dir/blocks/collection.html" object=$objects[o_list] display_type="view_collection" type=$c.type}
- {sectionelse}
-
{$c.collection_name} has 0 {$c.type}
- {/section}
-
+
+
{$c.type|capitalize} ({$c.total_objects})
-
-
-
+
+
+
+ {section name=list loop=$objects}
+ {include file="$style_dir/blocks/collection.html" object=$objects[list] display_type=view_collection type=$c.type}
+ {/section}
+
+
+
+
+
+
+
+
{lang code="date_added"}
@@ -53,7 +50,9 @@
{$c.collection_description|description}
{lang code="comments"} ({$c.total_comments})
- {include file="$style_dir/blocks/comments/comments.html" id=$c.collection_id type='cl'}
+
{if $myquery->is_commentable($c,'collection')}
{include file="$style_dir/blocks/comments/add_comment.html" id=$c.collection_id type='cl'}
diff --git a/upload/styles/cbv2new/layout/view_item.html b/upload/styles/cbv2new/layout/view_item.html
new file mode 100644
index 00000000..6ed8a2ab
--- /dev/null
+++ b/upload/styles/cbv2new/layout/view_item.html
@@ -0,0 +1,68 @@
+
+
+
+{if $type == 'photos'}
+
+
+
+
{get_photo output='html' size='l' details=$object}
+
+
+
+
+ {show_video_rating rating=$object.rating ratings=$object.rated_by total='10' id=$object.photo_id type=photo}
+
+
+
+
+
+
+
+
+
{$object.photo_title}
+
+ {$object.photo_description}
+
+
{$object.photo_tags|tags:photos}
+
+{assign var=cid value=$object.collection_id}
+{get_photos assign=related extra_cond=" collection_id <> $cid" show_related=TRUE title=$object.photo_title tags=$object.photo_tags exclude=$object.photo_id limit='5'}
+{if $related}
+
+
Related Photos
+
+{section name=list loop=$related}
+ {include file="$style_dir/blocks/photo.html" display_type="related_photos" photo=$related[list]}
+{/section}
+
+{/if}
+
+{/if}
+
+{if $type == 'videos'}
+
+
+
{FlashPlayer vdetails = $object}
+
+{$object.description}
+
+
+
+{/if}
+
+
\ No newline at end of file
diff --git a/upload/styles/cbv2new/layout/watch_video.html b/upload/styles/cbv2new/layout/watch_video.html
index 02b2dea8..03e4f697 100644
--- a/upload/styles/cbv2new/layout/watch_video.html
+++ b/upload/styles/cbv2new/layout/watch_video.html
@@ -3,7 +3,7 @@
{if $userquery->perm_check('admin_access')=='yes'}
{ANCHOR place=watch_admin_options data=$vdo}
{/if}
- {ANCHOR place="before_watch_player" data=$vdo}
+ {ANCHOR place="before_watch_player" data=$vdo }
{if has_hq($vdo)}
diff --git a/upload/styles/cbv2new/theme/main.css b/upload/styles/cbv2new/theme/main.css
index 155f2149..b140237e 100644
--- a/upload/styles/cbv2new/theme/main.css
+++ b/upload/styles/cbv2new/theme/main.css
@@ -518,6 +518,8 @@ display:inline-block; width:18px; height:18px; line-height:18px; text-align:cent
.add_comment_box{background-color:#f0f0f0}
.add_comment_box .input{ border:1px solid #CCC; background-image:url(../images/watch_video_details_bg.png); background-position:10px; padding:5px; width:400px; background-repeat:repeat-x}
+#collectionComments .comment .comm_other{width:86%; }
+
.cb_warning,.cb_error,.cb_message{border-radius:10px;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px; padding:5px; border:1px #0099cc solid; margin:5px;background-image:url(../images/watch_video_details_bg.png); background-position:10px}
.cb_warning ul,.cb_error ul,.cb_message ul{display:block; margin:0px; padding:0px; padding-left:10px;}
.cb_warning ul li,.cb_error ul li,.cb_message ul li{border-left:3px solid #ccc; list-style:none; padding-left:10px; cursor:pointer}
@@ -782,9 +784,50 @@ ul.upload_opts li.selected { cursor:pointer; background:none; border:1px solid;
width:0px
}
/* COLLECTION */
-.collect_grid { padding:5px; border:1px solid #FFF; height:120px; margin:0 0 10px -1px; position:relative; -moz-border-radius:6px; }
-.collect_grid:hover { border-color:#CCC; background:#fafafa; z-index:50; cursor:pointer; }
-.collect_grid.selected { background:url(../images/simple_gradient.png) bottom repeat-x; border:1px solid #aaa; z-index:51; }
-.collect_grid:first-child { margin-left:none; }
+.collect_grid { position:relative; }
.obj_title { width:110px; display:inline-block; }
.obj_title a { text-decoration:none; }
+
+.collectionTable { border-collapse:collapse; border-spacing:0px; width:100%; }
+td.collectItemBox { vertical-align:middle; display:inline-block; width:18%; text-align:center; padding:10px 0px; }
+a.CollectThumb { border:1px solid #ccc; display:inline-block; background:#FFF; }
+.collect_grid img { display:block; margin:3px; }
+
+/* PHOTOS */
+.photoBox { background:url(../images/simple_gradient.png) repeat-x bottom; border:1px solid #ccc; margin-bottom:10px; border-radius:4px; -webkit-border-radius:4px; -moz-border-radius:4px; }
+.photoBox .OptionalSettings { background:#f3f3f3; border:solid #ccc; border-width:1px 0px 0px; display:block;}
+.photoBox .Heading a { padding:5px; display:block; border-bottom:1px solid #ccc; font:bold 11px Tahoma; text-decoration:none; }
+.photoDetailsBox { padding:5px; }
+.photoDetailsBox .field { margin-bottom:5px; }
+.photoDetailsBox .field .label { font:bold 11px Tahoma; padding-top:6px; width:125px; display:inline-block; }
+.photoDetailsBox input[type=text], .photoDetailsBox textarea, .photoDetailsBox select { font:normal 11px Tahoma; padding:4px; width:200px; }
+.photoDetailsBox textarea { width:202px; height:50px; }
+.photoDetailsBox select { width:212px; }
+.photoDetailsBox .hint { color:#666; font:normal 10px Tahoma; float:right; }
+.photoThumbBox { padding:1px; background:#FFF; border:1px solid #aaa; }
+.OptionalBox { padding:5px; }
+.PhotoHeading { margin:5px 0px; padding-bottom:5px; border-bottom:1px solid #ccc; font:bold 11px Tahoma; }
+.PhotoHeading.hover:hover { cursor:pointer; }
+.relatedPhotos { clear:both; margin-bottom:10px; }
+.photoTitle { font:bold 11px Tahoma; }
+.photoTitle a { text-decoration:none; }
+.photoInfo { font:normal 10px Tahoma; color:#666; }
+
+
+/* VIEW ITEM */
+.borderLine { border-bottom:1px solid #ccc; padding:5px 0px 0px; margin:0 0 5px; }
+.NextPrevButtons { width:100%; margin-bottom:5px; }
+.NextPrevButtons li { list-style:none; width:49%; }
+.NextPrevButtons li a { font:bold 11px Tahoma, Geneva, sans-serif; text-decoration:none; }
+.NextPrevButtons li a { display:block; text-align:center; padding:8px 0px; border:1px solid #ccc; background:url(../images/simple_gradient.png) repeat-x bottom; color:#000;}
+.NextPrevButtons li a:hover { color:#FFF; background:#EEE url(../images/nav_grads.png) left top repeat-x; border:1px solid #053a5c }
+
+.LoadMoreButton { font:bold 11px Tahoma, Geneva, sans-serif; background:url(../images/simple_gradient.png) repeat-x bottom; border:1px solid #ccc; padding:6px; margin-top:5px; -moz-border-radius:4px; -webkit-border-radius:4px; border-radius:4px; }
+.LoadMoreButton:hover { color:#FFF; background:#115582 url(../images/nav_grads.png) left top repeat-x; border:1px solid #053a5c; cursor:pointer; }
+.LoadMoreButton:active { background:#115582; }
+.LoadMoreButton[disabled], .LoadMoreButton[disabled]:hover, .LoadMoreButton[disabled]:active { background:#EEE; border:1px solid #ccc; cursor:default; color:#7b7b7b; }
+
+.CollectionResult { background:#FFF url(../images/simple_gradient.png) bottom repeat-x; border:1px solid #aaa; margin:8px 8px 0px; padding:5px; font:bold 11px Tahoma; color:#666; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
+
+.CollectionResult .error { color:#ed0000; }
+.CollectionResult .msg { color:#0099cc; }
\ No newline at end of file
diff --git a/upload/styles/global/head.html b/upload/styles/global/head.html
index 0d833842..224dccf5 100644
--- a/upload/styles/global/head.html
+++ b/upload/styles/global/head.html
@@ -1,14 +1,15 @@
+
+
+
{if $smarty.const.THIS_PAGE == 'upload' && $step =="2"}
{/if}
-{literal}
+{if $smarty.const.THIS_PAGE == 'photo_upload'}
+
+
+
-{/literal}
\ No newline at end of file
+{/if}
\ No newline at end of file
diff --git a/upload/view_collection.php b/upload/view_collection.php
index 5b7ce34c..35e5aab5 100644
--- a/upload/view_collection.php
+++ b/upload/view_collection.php
@@ -13,57 +13,55 @@ require 'includes/config.inc.php';
$pages->page_redir();
$c = mysql_clean($_GET['cid']);
-$cdetails = $cbcollection->get_collection($c);
+$type = mysql_clean($_GET['type']);
+
$page = mysql_clean($_GET['page']);
$get_limit = create_query_limit($page,VLISTPP);
$order = tbl("collection_items").".ci_id DESC";
-if($cdetails)
+if($cbcollection->is_viewable($c))
{
- $type = $cdetails['type'];
+ $cdetails = $cbcollection->get_collection($c);
+
switch($type)
{
case "videos":
+ case "video":
+ case "v":
{
- $items = $cbvideo->collection->get_collection_items_with_details($cdetails['collection_id'],$order);
+ $items = $cbvideo->collection->get_collection_items_with_details($c,$order,$get_limit);
+ $count = $cbvideo->collection->get_collection_items_with_details($c,NULL,NULL,TRUE);
}
break;
-
- case "pictures":
+
+ case "photos":
+ case "photo":
+ case "p":
{
- // Following to two lines will be un-commented once we have written picture.class
- //$items = $cbpicture->collection->get_collection_items_with_details($cdetails['collection_id'],NULL,$get_limit);
- //$total_rows = $cbpicture->collection->get_collection_items_with_details($cdetails['collection_id'],NULL,NULL,true);
+ $items = $cbphoto->collection->get_collection_items_with_details($c,$order,$get_limit);
+ $count = $cbphoto->collection->get_collection_items_with_details($c,NULL,NULL,TRUE);
}
+ break;
}
-
// Calling nesscary function for view collection
call_view_collection_functions($cdetails);
+ $total_pages = count_pages($count,VLISTPP);
- $total_pages = count_pages($total_rows,VLISTPP);
-
//Pagination
$pages->paginate($total_pages,$page);
-
+
+ assign('objects',$items);
assign("c",$cdetails);
assign("type",$type);
- assign("objects",$items);
-
+ assign("cid",$c);
subtitle($cdetails['collection_name']);
} else {
- e(lang("collect_not_exist"));
$Cbucket->show_page = false;
}
-// Getting ready for Pagination
-$page = mysql_clean($_GET['page']);
-
-if($Cbucket->show_page)
-{
- template_files('view_collection.html');
-}
+template_files('view_collection.html');
display_it();
?>
\ No newline at end of file
diff --git a/upload/view_item.php b/upload/view_item.php
new file mode 100644
index 00000000..63b76106
--- /dev/null
+++ b/upload/view_item.php
@@ -0,0 +1,79 @@
+get_video($item);
+ if($video)
+ {
+ $info = $cbvideo->collection->get_collection_item_fields($cid,$video['videoid'],'ci_id,collection_id');
+ $video = array_merge($video,$info[0]);
+
+ increment_views($video['videoid'],'video');
+
+ assign('object',$video);
+ assign('c',$collect);
+ } else {
+ e("Item does not exist");
+ $Cbucket->show_page = false;
+ }
+ }
+ break;
+
+ case "photos":
+ case "p":
+ {
+ global $cbphoto;
+ $photo = $cbphoto->get_photo($item);
+ if($photo)
+ {
+ $info = $cbphoto->collection->get_collection_item_fields($cid,$photo['photo_id'],'ci_id');
+ $photo = array_merge($photo,$info[0]);
+
+ increment_views($photo['photo_id'],'photo');
+
+ assign('object',$photo);
+ assign('c',$collect);
+ } else {
+ e("Item does not exist");
+ $Cbucket->show_page = false;
+ }
+ }
+ break;
+ }
+ template_files('view_item.html');
+ display_it();
+ }
+
+}
+
+?>
\ No newline at end of file