diff --git a/upload/ajax.php b/upload/ajax.php index 24e95ad6..bf570daa 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -899,7 +899,7 @@ if(!empty($mode)) $type = "photos"; $CollectParams = array("collection_name"=>$name,"collection_description"=>$desc,"collection_tags"=>$tags,"category"=>$cat,"type"=>$type,"allow_comments"=>"yes","broadcast"=>"public","public_upload"=>"yes"); - $cbcollection->create_collection($CollectParams); + $insert_id = $cbcollection->create_collection($CollectParams); if(msg()) { @@ -915,6 +915,7 @@ if(!empty($mode)) $ajax['msg'] = $msg; $ajax['err'] = $err; + $ajax['id'] = $insert_id; echo json_encode($ajax); } @@ -923,6 +924,7 @@ if(!empty($mode)) case "ajaxPhotos": { $cbphoto->insert_photo(); + if(msg()) { $msg = msg_list(); diff --git a/upload/includes/classes/collections.class.php b/upload/includes/classes/collections.class.php index efcc31e0..408fee46 100644 --- a/upload/includes/classes/collections.class.php +++ b/upload/includes/classes/collections.class.php @@ -789,8 +789,9 @@ class Collections extends CBCategory $query_field[] = "active"; $query_val[] = "yes"; - $db->insert(tbl($this->section_tbl),$query_field,$query_val); - e(lang("collect_added_msg"),"m"); + $insert_id = $db->insert(tbl($this->section_tbl),$query_field,$query_val); + e(lang("collect_added_msg"),"m"); + return $insert_id; } } @@ -902,7 +903,7 @@ class Collections extends CBCategory */ function delete_collection($cid) { - global $db; + global $db,$eh; $collection = $this->get_collection($cid); if(empty($collection)) e(lang("collection_not_exists")); @@ -923,6 +924,7 @@ class Collections extends CBCategory $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)); + $eh->flush(); e(lang("collection_deleted"),"m"); } } diff --git a/upload/includes/classes/photos.class.php b/upload/includes/classes/photos.class.php index 1f88a782..33e771d8 100644 --- a/upload/includes/classes/photos.class.php +++ b/upload/includes/classes/photos.class.php @@ -1560,77 +1560,8 @@ class CBPhotos */ function get_image_file($pid,$size='t',$multi=false,$assign=NULL,$with_path=true,$with_orig=false) { - - if(empty($pid)) - return false; - else - { - if(($size != 't' && $size != 'm' && $size != 'l' && $size != 'o') || empty($size)) - $size = 't'; - - if(!is_array($pid)) - $photo = $this->get_photo($pid); - else - $photo = $pid; - - if(!empty($photo)) - { - if(empty($photo['photo_id']) && empty($photo['photo_key'])) - return false; // Something is wrong, so return false; - else - { - if(!empty($photo['filename']) && !empty($photo['ext'])) - { - $files = glob(PHOTOS_DIR."/".$photo['filename']."*.".$photo['ext']); - - if(is_array($files)) - { - foreach($files as $file) - { - $file_parts = explode('/',$file); - $thumb_name = $file_parts[count($file_parts)-1]; - $type = $this->get_image_type($thumb_name); - if($with_orig) - { - if($with_path) - $thumbs[] = PHOTOS_URL."/".$thumb_name; - else - $thumbs[] = $thumb_name; - } - elseif(!empty($type)) - { - if($with_path) - $thumbs[] = PHOTOS_URL."/".$thumb_name; - else - $thumbs[] = $thumb_name; - } - } - //pr($thumbs,TRUE); - if($assign && $multi) - { - assign($assign,$thumbs); - } elseif(!$assign && $multi) { - return $thumbs; - } else { - $size = "_".$size; - - $return_thumb = array_find($photo['filename'].$size,$thumbs); - if($assign != NULL) - assign($assign,$return_thumb); - else - return $return_thumb; - } - - } else { - return false; - } - } else { - return false; - } - } - } else - return false; - } + $params = array("details"=>$pid,"size"=>$size,"multi"=>$multi,"assign"=>$assign,"with_path"=>$with_path,"with_orig"=>$with_orig); + return $this->getFileSmarty($params); } /** @@ -1640,13 +1571,11 @@ class CBPhotos */ function getFileSmarty($p) { - $details = $p['details']; if(empty($details)) { return $this->default_thumb($size); - } else { - + } else { //Calling Custom Functions if(count($Cbucket->custom_get_photo_funcs) > 0) { @@ -1665,14 +1594,16 @@ class CBPhotos if(($p['size'] != 't' && $p['size'] != 'm' && $p['size'] != 'l' && $p['size'] != 'o') || empty($p['size'])) $p['size'] = 't'; - $with_path = $p['with_path'] ? $p['with_path'] : TRUE; + if($p['with_path'] === FALSE) $p['with_path'] = FALSE; else $p['with_path'] = TRUE; + $with_path = $p['with_path']; + $with_orig = $p['with_orig'] ? $p['with_orig'] : FALSE; if(!is_array($details)) $photo = $this->get_photo($details); else $photo = $details; - if(empty($photo['photo_id']) || empty($photo['photo_key'])) + if(empty($photo['photo_id']) || empty($photo['photo_key'])) return $this->default_thumb($size); else { @@ -1685,10 +1616,21 @@ class CBPhotos { $file_parts = explode("/",$file); $thumb_name = $file_parts[count($file_parts)-1]; - if($with_path) - $thumbs[] = PHOTOS_URL."/".$thumb_name; - else - $thumbs[] = $thumb_name; + $type = $this->get_image_type($thumb_name); + if($with_orig) + { + if($with_path) + $thumbs[] = PHOTOS_URL."/".$thumb_name; + else + $thumbs[] = $thumb_name; + } + elseif(!empty($type)) + { + if($with_path) + $thumbs[] = PHOTOS_URL."/".$thumb_name; + else + $thumbs[] = $thumb_name; + } } if(empty($p['output']) || $p['output'] == 'non_html') @@ -1703,6 +1645,7 @@ class CBPhotos $size = "_".$p['size']; $return_thumb = array_find($photo['filename'].$size,$thumbs); + if(empty($return_thumb)) { $this->default_thumb($size); @@ -1710,7 +1653,7 @@ class CBPhotos if($p['assign'] != NULL) assign($p['assign'],$return_thumb); else - echo $return_thumb; + return $return_thumb; } } } @@ -1724,7 +1667,8 @@ class CBPhotos if(empty($src)) $src = $this->default_thumb($size); else - $src = $src; + $src = $src; + $dem = getimagesize($src); $width = $dem[0]; $height = $dem[1]; @@ -2265,9 +2209,12 @@ class CBPhotos foreach($types as $type) { - $type = str_replace(' ','',$type); - $newArr['type'] = $type; - $codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr)); + $type = strtolower($type); + if(in_array($type,$this->embed_types)) { + $type = str_replace(' ','',$type); + $newArr['type'] = $type; + $codes[] = array("name"=>ucwords($type),"type"=>$type,"code"=>$this->generate_embed_codes($newArr)); + } } if($newArr['assign']) diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 0d7791ac..3a145307 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -426,7 +426,7 @@ function get_photo($params) { global $cbphoto; - $cbphoto->getFileSmarty($params); + return $cbphoto->getFileSmarty($params); } //Photo Upload BUtton diff --git a/upload/rss.php b/upload/rss.php index f66b5a9a..c1c5a8f1 100644 --- a/upload/rss.php +++ b/upload/rss.php @@ -29,7 +29,7 @@ switch($mode) { case 'recent': default: - {echo $limit; + { $videos = get_videos(array('limit'=>$limit)); $title = "Recently Added Videos"; } diff --git a/upload/styles/cbv2new/layout/blocks/group/group_header.html b/upload/styles/cbv2new/layout/blocks/group/group_header.html index c310d973..6cfef087 100644 --- a/upload/styles/cbv2new/layout/blocks/group/group_header.html +++ b/upload/styles/cbv2new/layout/blocks/group/group_header.html @@ -53,7 +53,7 @@
  • {lang code='members'}
  • {/if} {if isSectionEnabled('videos')} -
  • {lang code='videos'}
  • +
  • {lang code='videos'}
  • {/if}
  • {lang code='report_this'}
  • @@ -125,7 +125,7 @@ - {/if} {else} - {if !$has_collection} +
    Create Collection
    - {assign var='reqFields' value=$cbcollection->load_required_fields()} - + {assign var='reqFields' value=$cbcollection->load_required_fields()} +
    {foreach from=$reqFields item=field} {if $field.id != 'type'}
    -   - {$formObj->createField($field)} + +
    {$formObj->createField($field)}
    {/if} {/foreach}
    - - {/if} + {/if} \ No newline at end of file diff --git a/upload/styles/cbv2new/layout/body.html b/upload/styles/cbv2new/layout/body.html index 50c1c35c..c9ae25a8 100644 --- a/upload/styles/cbv2new/layout/body.html +++ b/upload/styles/cbv2new/layout/body.html @@ -1,7 +1,7 @@ {* Including Global Header *} {include file="$style_dir/global_header.html"} - +{include_header file="admin_bar"}
    {include file="$style_dir/header.html" } diff --git a/upload/styles/cbv2new/layout/global_header.html b/upload/styles/cbv2new/layout/global_header.html index c547959c..ca7ea865 100644 --- a/upload/styles/cbv2new/layout/global_header.html +++ b/upload/styles/cbv2new/layout/global_header.html @@ -53,7 +53,7 @@ var imageurl = '{$imageurl}'; {include_header file='global_header'} -{include_header file="admin_bar"} + @@ -84,9 +84,9 @@ var mid = {$smarty.get.mid}; {/literal} {if $smarty.get.query == ""} {literal} - $("#searchSelectWrapper ul li:first-child").addClass('selected'); - $('#selectedText').text($("#searchSelectWrapper ul li:first-child a").text()); - $('#searchType').val($("#searchSelectWrapper ul li:first-child a").attr('id')); + $("#searchSelectWrapper ul li a").filter('#videos').parent().addClass('selected'); + $('#selectedText').text($("#searchSelectWrapper ul li a").filter('#videos').text()); + $('#searchType').val($("#searchSelectWrapper ul li a").filter('#videos').attr('id')); {/literal} {else} {literal} diff --git a/upload/view_group.php b/upload/view_group.php index 32de42ea..15c7b71a 100644 --- a/upload/view_group.php +++ b/upload/view_group.php @@ -37,12 +37,6 @@ if($details) //Leaving if($_GET['leave']) $cbgroup->leave_group($details['group_id'],userid()); - - //Getting list of topics - $topics = $cbgroup->get_topics(array('group'=>$details['group_id'])); - assign('topics',$topics); - - subtitle($details['group_name']); //Calling all functions when a topic is called call_view_group_functions($details); @@ -58,6 +52,11 @@ if($details) } } + //Getting list of topics + $topics = $cbgroup->get_topics(array('group'=>$details['group_id'])); + assign('topics',$topics); + + subtitle($details['group_name']); }else { e(lang("grp_exist_error"));