Fixed minor bugs

parent d99c6003
......@@ -9,6 +9,7 @@ based on the ideas I planned for www.sexhack.me:
- Version 0.0.3:
* Integration of Ultimate Members plugin for user and model profiles
* Show thumbnail in video post list in admin
* 404 Not Found page with gallery instead of WC products
- Version 0.0.4:
......
......@@ -36,6 +36,7 @@ if(!class_exists('SH_GDrive')) {
function get_download_url($file)
{
if(!($file && is_string($file) && strlen($file)>3)) return $file;
if ( function_exists( 'igd_fs' ) )
{
// Integrate Google Drive Plugin is installed and active, so, filter it!
......@@ -47,12 +48,11 @@ if(!class_exists('SH_GDrive')) {
$gparts = explode('/', $gpath);
if(count($gparts) > 0)
{
$parent=false;
$gfile=false;
$success=false;
$igd = \IGD\App::instance();
// Try root first
foreach($gparts as $k => $part)
{
......@@ -100,13 +100,12 @@ if(!class_exists('SH_GDrive')) {
if($g['name']==$part)
{
$parent=$g['id'];
$gf=$g;
$gf=$g;
}
}
}
}
if(count($gparts)-1 == $k) $success=true;
if($success) $gfile = $gf;
......
......@@ -184,7 +184,6 @@ if(!class_exists('SH_Video')) {
public function get_guests($usedb=true)
{
if(isset($this->attributes['guests'])) return $this->guests;
sexhack_log("(TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT");
$this->attributes['guests'] = array();
if($usedb)
{
......
......@@ -59,10 +59,10 @@ if(!class_exists("SH_VideoProducts")) {
// main product settings
$prod->set_name($video->title);
$prod->set_slug($video->slug); // XXX TODO Compose slug with username too to avoid name collisions?
$prod->set_slug($video->slug);
// Product description.
$video_link=site_url().'/'.get_option('gallery_slug', 'v')."/"; // XXX TODO Get the right product link
$video_link=site_url().'/'.get_option('gallery_slug', 'v')."/".$video->slug."/";
$prod->set_short_description('<p>Whach me <a href="'.$video_link.'">ONLINE HERE</a></p>');
$prod->set_description($video->description);
......
......@@ -81,13 +81,13 @@ function save_sexhack_video_meta_box_data( $post_id )
//
// Title and slug
$video->title = $post->post_title;
$video->slug = $post->post_name;
$video->slug = uniqidReal()."-".$post->post_name;
// TODO Remove debug
sexhack_log("SAVE post object:");
sexhack_log($post);
sexhack_log(' - $POST:');
sexhack_log($_POST);
//sexhack_log("SAVE post object:");
// sexhack_log($post);
// sexhack_log(' - $POST:');
// sexhack_log($_POST);
// Model
if(array_key_exists('video_model', $_POST) && is_numeric($_POST['video_model']) && intval($_POST['video_model']) > 0)
......
......@@ -261,6 +261,18 @@ function check_url_or_path($url)
return false;
}
function uniqidReal($lenght = 13) {
// uniqid gives 13 chars, but you could adjust it to your needs.
if (function_exists("random_bytes")) {
$bytes = random_bytes(ceil($lenght / 2));
} elseif (function_exists("openssl_random_pseudo_bytes")) {
$bytes = openssl_random_pseudo_bytes(ceil($lenght / 2));
} else {
throw new Exception("no cryptographically secure random function available");
}
return substr(bin2hex($bytes), 0, $lenght);
}
function html2text($html)
{
// remove comments and any content found in the the comment area (strip_tags only removes the actual tags).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment