per_page = 25; // number results per page } /** * Settings */ function set($m, $u, $p, $c){ $this->max = $m; // max records $this->url = $u; // url $this->per_page = $p; // number results per page $this->cur = intval($c) - 1; $this->pages = ceil( $this->max / $this->per_page ); // check and fix current $this->cur = $this->cur < 0 ? 0 : $this->cur; $this->cur = $this->cur+1 > $this->pages ? $this->pages - 1 : $this->cur; // out put $this->out["offset"] = $this->cur * $this->per_page; $this->out["count"] = $this->per_page; $this->out["pages"] = $this->pages; $this->out["current"] = $this->cur+1; $this->out["hrefs"] = array(); $this->out["names"] = array(); $this->out["prev"] = -1; $this->out["next"] = -1; if($this->cur!=0 && $this->pages > 1){ $this->out["first"] = $this->url(1); }else{ $this->out["first"] = -1; } if($this->cur != $this->pages - 1 && $this->pages > 1){ $this->out["last"] = $this->url($this->pages); }else{ $this->out["last"] = -1; } } /** * get url */ function url($page){ return sprintf($this->url, $page); } /** * Generate pagination * @t - type */ function get($type){ //------------decade(<< 12345678910 >> )---------------------------- if($type == 'decade'){ $n = $this->decade; $p = $this->cur + 1; $decada_c = ceil( $p / $n ); $decada_p = $decada_c - 1; $decada_p = $decada_p < 0 ? 0 : $decada_p; // prev if( $decada_p > 0 ){ $this->out["prev"] = $this->url( $decada_p * $n ); } // next if($decada_c * $n < $this->pages){ $this->out["next"] = $this->url( $decada_c * $n + 1 ); } // pages and next for($i = $decada_p * $n; $i < $decada_c * $n && $i < $this->pages; $i++){ $this->out["names"][] = $i+1; if($this->cur == $i){ $this->out["hrefs"][] = "-PN-"; }else{ $this->out["hrefs"][] = $this->url($i+1); } } return $this->out; } //------------decade(<< 12345678910 >> )---------------------------- //------------arrow(<< < > >>)---------------------------- if($type == 'arrow'){ // prev if($this->cur != 0 && $this->pages > 1){ $this->out["prev"] = $this->url($this->cur); } // next if($this->cur != $this->pages - 1 && $this->pages > 1){ $this->out["next"] = $this->url($this->cur+2); } return $this->out; } //------------arrow(<< < > >>)---------------------------- //------------full string(123456)------------------------- if($type=='full'){ // prev if($this->cur != 0 && $this->pages > 1){ $this->out["prev"] = $this->url($this->cur); } // next if($this->cur != $this->pages - 1 && $this->pages > 1){ $this->out["next"] = $this->url($this->cur+2); } for($i=0;$imax/$this->per_page);$i++){ $this->out["names"][] = $i + 1; if($this->cur==$i){ $this->out["hrefs"][] = "-PN-"; }else{ $this->out["hrefs"][] = $this->url($i + 1); } } return $this->out; } //------------full string(123456)------------------------- //-----------short string(1...34567...20)----------------- if($type=='short'){ // prev if($this->cur != 0 && $this->pages > 1){ $this->out["prev"] = $this->url($this->cur); } // next if($this->cur != $this->pages - 1 && $this->pages > 1){ $this->out["next"] = $this->url($this->cur+2); } // it's to short display like full if($this->pages < 8){ for($i = 0 ; $i < $this->pages ; $i++){ $this->out["names"][] = $i+1; if($this->cur == $i){ $this->out["hrefs"][] = "-PN-"; }else{ $this->out["hrefs"][] = $this->url($i+1); } } // long enough }else{ // if current page near begin if($this->cur < 3){ for($i = 0 ; $i < 5 ; $i++){ $this->out["names"][] = $i+1; if($this->cur == $i){ $this->out["hrefs"][] = "-PN-"; }else{ $this->out["hrefs"][] = $this->url($i+1); } } // separator $this->out["hrefs"][] = "-SP-"; $this->out["names"][] = "..."; $this->out["hrefs"][] = $this->url($this->pages); $this->out["names"][] = $this->pages; }else{ // first $this->out["names"][] = "1"; $this->out["hrefs"][] = $this->url(1); // separator $this->out["names"][] = "..."; $this->out["hrefs"][] = "-SP-"; // near end if( $this->cur + 5 > $this->pages ){ for($i = $this->pages - 5 ; $i< $this->pages ; $i++){ $this->out["names"][] = $i+1; if($this->cur == $i){ $this->out["hrefs"][] = "-PN-"; }else{ $this->out["hrefs"][] = $this->url($i+1); } } // at the middle }else{ // middle part for($i = $this->cur - 2; $i < $this->cur + 3 ; $i++){ $this->out["names"][] = $i+1; if($this->cur == $i){ $this->out["hrefs"][] = "-PN-"; }else{ $this->out["hrefs"][] = $this->url($i+1); } } // separator $this->out["names"][] = "..."; $this->out["hrefs"][] = "-SP-"; // last $this->out["hrefs"][] = $this->url($this->pages); $this->out["names"][] = $this->pages; } } } return $this->out; } //-----------short string(1...34567...20)----------------- } function parse($total, $url){ global $_SETTINGS; global $tpl; $this->set($total, $url, $_SETTINGS["per_page"], get_param("p")); $pages = $this->get('short'); $tpl->assign("pagination", $pages); return $pages; } }; ?> reset(); } /** * Reset account info */ function reset(){ $this -> ACCOUNT_INFO = array(); } /** * Account Info */ function info($name){ return $this -> ACCOUNT_INFO[$name]; } /** * Account Info */ function account_info(){ return $this -> ACCOUNT_INFO; } /** * Logout from System */ function logout(){ session_start(); $_SESSION['admin_id'] = 0; session_write_close(); $this -> reset(); } /** * Login into system */ function login($login, $pass, $remember = 0){ global $db; session_start(); session_register('admin_id'); $_SESSION['admin_id'] = 0; $is_success = false; if(!empty($login) && !empty($pass)){ $db->query("adm","SELECT * FROM "._PREFIX."admins WHERE login='".tosql($login)."'"); if($db->next_record("adm")) { $adm = $db->record("adm"); if($adm["pass"] == crypt($pass, $adm["pass"])){ $this->ACCOUNT_INFO = $adm; $_SESSION['admin_id'] = $adm['id']; $is_success = true; } } } session_write_close(); return $is_success; } /** * Login validation */ function validate(){ global $db; session_start(); session_register('admin_id'); $is_success = false; if(!empty($_SESSION['admin_id'])){ $db->query("adm","SELECT * FROM "._PREFIX."admins WHERE id=".intval($_SESSION['admin_id'])); if($db->next_record("adm")){ $adm = $db->record("adm"); $this->ACCOUNT_INFO = $adm; $_SESSION['admin_id'] = $adm['id']; $is_success = true; } } session_write_close(); return $is_success; } /** * short user login validation (WORK ONLY AFTER login or validate) */ function is_admin(){ return isset($this -> ACCOUNT_INFO['id']) && $this -> ACCOUNT_INFO['id'] > 0; } /** * test if login is unique */ function is_login($login, $id = 0){ global $db; $db->query("adm","SELECT id FROM "._PREFIX."admins WHERE login='".tosql($login)."' AND id!=".intval($id)); return $db->next_record("adm"); } } ?> reset(); } /** * Reset account info */ function reset(){ $this -> ACCOUNT_INFO = array(); } function ip(){ return $_SERVER['REMOTE_ADDR']; } /** * Account Info */ function info($name){ return $this -> ACCOUNT_INFO[$name]; } /** * Account Info */ function account_info(){ return $this -> ACCOUNT_INFO; } /** * Logout from System */ function logout(){ $session_id1 = get_cookie('session_id1'); // reset session if(!empty($session_id1)){ run_db_sql("UPDATE "._PREFIX."users SET session_id = '".tosql(makeHash(32))."' WHERE session_id = '".tosql($session_id1)."'"); } setcookie('session_id1', '', time() - 3600*24*120, '/'); setcookie('session_id2', '', time() - 3600*24*120, '/'); $this -> reset(); } /** * Login into system */ function login($login, $pass, $remember = 0){ global $db; $is_success = false; if(!empty($login) && !empty($pass)){ $db->query("adm","SELECT * FROM "._PREFIX."users WHERE login='".tosql($login)."'"); if($db->next_record("adm")) { $adm = $db->record("adm"); // check password if($adm["pass"] == crypt($pass, $adm["pass"])){ $this -> ACCOUNT_INFO = $adm; $session_id1 = makeHash(32); setcookie('session_id1', $session_id1, time() + 3600*24*120, '/'); setcookie('session_id2', md5($adm['id'] . '#' . $adm['pass']), time() + 3600*24*120, '/'); // check IP if($this -> ip() != $adm['ip']){ if($adm['ip'] == '' || time() - $adm['last_ip_check'] >= 600){ run_db_sql("UPDATE "._PREFIX."users SET ip = '".tosql($this -> ip())."' WHERE id = " . $adm['id']); } else{ // change IP and Password and send mail $password = makeHash(8); run_db_sql("UPDATE "._PREFIX."users SET pass = '".tosql(crypt($password))."', ip = '".tosql($this -> ip())."' WHERE id = " . $adm['id']); // create and send mail $html = new Smarty_Ext(); $adm['pass'] = $password; $adm['ip'] = $this -> ip(); $html -> assign('user', $adm); send_mail($adm['email'], $adm['name'], 'New password', $html -> fetch('mails/new_password.tpl'), 'no-reply@freetofuckhotbabes.com'); } } run_db_sql("UPDATE "._PREFIX."users SET session_id = '".tosql($session_id1)."', last_ip_check=" . time() . " WHERE id = " . $adm['id']); $is_success = true; } } } return $is_success; } /** * Login validation */ function validate(){ global $db; $is_success = false; $session_id1 = get_cookie('session_id1'); $session_id2 = get_cookie('session_id2'); if(!empty($session_id1)){ // check session id $db->query("adm","SELECT * FROM "._PREFIX."users WHERE session_id='".tosql($session_id1)."'"); if($db->next_record("adm")){ $adm = $db->record("adm"); // check password and IP if(time() - $adm['last_ip_check'] < 600 || ( md5($adm['id'] . '#' . $adm['pass']) == $session_id2 && $this -> ip() == $adm['ip'] )){ $this -> ACCOUNT_INFO = $adm; setcookie('session_id1', $session_id1, time() + 3600*24*120, '/'); setcookie('session_id2', $session_id2, time() + 3600*24*120, '/'); $is_success = true; } // become OLD -> update last ip check if(time() - $adm['last_ip_check'] >= 600){ run_db_sql("UPDATE "._PREFIX."users SET last_ip_check=" . time() . " WHERE id = " . $adm['id']); } } } return $is_success; } /** * short user login validation (WORK ONLY AFTER login or validate) */ function is_user(){ return isset($this -> ACCOUNT_INFO['id']) && $this -> ACCOUNT_INFO['id'] > 0; } /** * test if login is unique */ function is_login($login, $id = 0){ global $db; $db->query("adm","SELECT id FROM "._PREFIX."users WHERE login='".tosql($login)."' AND id!=".intval($id)); return $db->next_record("adm"); } } ?>From = $from_email; $mail->FromName = ''; $mail->Mailer = 'mail'; //mail $mail->Subject = $subject; $mail->Body = $msg_html; $mail->IsHTML(true); $mail->AddAddress($to_email, $to_name); $mail->Send(); } ?>loadImage($file_src)) return false; if($_USE_RESIZER==true && $_USE_CROPPER==true && !$save_ratio){ //=============================================== // Crop & Resize the best way i think :) //----------------------------------------------- // 1. Crop list($Xn,$Yn) = $cc->getMaxCropSizes($Xo, $Yo); $cc->cropToSize($Xn, $Yn); // 2. Final to Original $cc->FinalToOriginal(); // 3. Resize $cc->resizeToSize($Xo, $Yo); }elseif($_USE_CROPPER==true && !$save_ratio){ //=============================================== // Just Crop //----------------------------------------------- $cc->cropToSize($Xo,$Yo); }elseif($_USE_RESIZER==true && !$save_ratio){ //=============================================== // Just Resize //----------------------------------------------- $cc->resizeToSize($Xo, $Yo); }elseif($save_ratio){ /** * Save ratio */ $cc->resizeToSizeRatio($Xo, $Yo); }else{ //=============================================== // Without Resize and Crop (just convert to jpeg) //----------------------------------------------- $cc->OriginalToFinal(); } // save or show if($save_file){ // save image $cc->saveImage($file_dst, $_SETTINGS['jpeg_quality']); }else{ // display image $cc->showImage('jpeg', $_SETTINGS['jpeg_quality']); } // clean $cc->flushImages(); unset($cc); return true; } ?> path = $_SETTINGS['path'] . 'sets/'; $this -> url = $_SETTINGS['url'] . 'sets/'; } function set_folder($set_id){ return 'set'.sPos($set_id); } function set_folder_path($set_id){ return $this -> path . $this -> set_folder($set_id); } /** * Upload image */ function upload($input, $set_id, $size_type, $image_id){ global $_FILES; // make hash $pathinfo = pathinfo(strtolower($_FILES[$input]['name'])); $ext = $pathinfo["extension"]; // update //$this -> update($image_id, $size_type, $ext); // get path $file_path = $this -> path($set_id, $image_id, $size_type, $ext); // upload move_uploaded_file($_FILES[$input]['tmp_name'], $file_path); @chmod($file_path, 0777); // return return $ext; } /** * Move image */ function move($from_file, $set_id, $size_type, $image_id){ // make hash $pathinfo = pathinfo(strtolower($from_file)); $ext = 'jpg'; // update //$this -> update($image_id, $size_type, $ext); // get path $file_path = $this -> path($set_id, $image_id, $size_type, $ext); @rename($from_file, $file_path); @chmod($file_path, 0777); // return return $ext; } function resize($set_id, $image_id, $image_big){ global $_SETTINGS; $big_file = $this -> path($set_id, $image_id, 'big', $image_big); $small_file = $this -> path($set_id, $image_id, 'small', 'jpg'); // update //$this -> update($image_id, 'small', 'jpg'); @chmod($small_file, 0777); makeThumb($big_file, $small_file, $_SETTINGS['model_thumb_small_width'], $_SETTINGS['model_thumb_small_height']); } /** * Update image */ function update($image_id, $size_type, $ext){ global $db; $field_name = $size_type == 'big' ? 'image_big' : 'image_small'; // update $sql = "UPDATE "._PREFIX."images SET ".$field_name."_ext = '".tosql($ext)."'" . " WHERE id = " . $image_id; run_db_sql($sql); return $image_id; } /** * File name */ function name($image_id, $size_type, $ext){ if($size_type == 'big') { return 'p' . sPos($image_id) . "." . $ext; } else{ return 'p' . sPos($image_id) . "t." . $ext; } } /** * Get URL */ function url($set_id, $image_id, $size_type, $ext){ return $this -> url . $this -> name($image_id, $size_type, $ext); } /** * Get path */ function path($set_id, $image_id, $size_type, $ext){ return $this -> path . $this -> name($image_id, $size_type, $ext); } function delete($set_id, $image_id, $size_type){ // make hash $file_path = $this -> path($set_id, $image_id, $size_type, 'jpg'); @unlink($file_path); } } /** * Webcams Provider Preview */ class WebcamProviderImage{ var $path = ''; var $url = ''; /** * Constructor */ function WebcamProviderImage(){ global $_SETTINGS; $this -> path = $_SETTINGS['path'] . 'webcams/'; $this -> url = $_SETTINGS['url'] . 'webcams/'; } /** * Upload image */ function upload($input, $id){ global $_FILES; // make hash $pathinfo = pathinfo(strtolower($_FILES[$input]['name'])); $ext = $pathinfo["extension"]; // update $this -> update($id, $ext); // get path $file_path = $this -> path($id, $ext); // upload move_uploaded_file($_FILES[$input]['tmp_name'], $file_path); @chmod($file_path, 0777); // return return $this -> url($id, $ext); } /** * Update image */ function update($id, $ext){ global $db; // update $sql = "UPDATE "._PREFIX."webcams_providers SET image = '".tosql($ext)."'" . " WHERE id = " . $id; run_db_sql($sql); return $id; } /** * File name */ function name($id, $ext){ return 'wp' . sPos($id) . '.' . $ext; } /** * Get URL */ function url($id, $ext){ return $this -> url . $this -> name($id, $ext); } /** * Get path */ function path($id, $ext){ return $this -> path . $this -> name($id, $ext); } } /** * Banner image */ class BannerImage{ var $path = ''; var $url = ''; /** * Constructor */ function BannerImage(){ global $_SETTINGS; $this -> path = $_SETTINGS['path'] . 'banners/'; $this -> url = $_SETTINGS['url'] . 'banners/'; } /** * Upload image */ function upload($input, $id){ global $_FILES; // make hash $pathinfo = pathinfo(strtolower($_FILES[$input]['name'])); $ext = $pathinfo["extension"]; // update $this -> update($id, $ext); // get path $file_path = $this -> path($id, $ext); // upload move_uploaded_file($_FILES[$input]['tmp_name'], $file_path); @chmod($file_path, 0777); // return return $this -> url($id, $ext); } /** * Update image */ function update($id, $ext){ global $db; // update $sql = "UPDATE "._PREFIX."banners SET image = '".tosql($ext)."'" . " WHERE id = " . $id; run_db_sql($sql); return $id; } /** * File name */ function name($id, $ext){ return 'ban' . sPos($id) . '.' . $ext; } /** * Get URL */ function url($id, $ext){ return $this -> url . $this -> name($id, $ext); } /** * Get path */ function path($id, $ext){ return $this -> path . $this -> name($id, $ext); } } /** * Model Image */ class ModelImage{ var $path = ''; var $url = ''; /** * Constructor */ function ModelImage(){ global $_SETTINGS; $this -> path = $_SETTINGS['path'] . 'images/models/'; $this -> url = $_SETTINGS['url'] . 'images/models/'; } /** * Upload image */ function upload($input, $size_type, $image_id){ global $_FILES; // make hash $pathinfo = pathinfo(strtolower($_FILES[$input]['name'])); $ext = $pathinfo["extension"]; // update //$this -> update($image_id, $size_type, $ext); // get path $file_path = $this -> path($image_id, $size_type, $ext); // upload move_uploaded_file($_FILES[$input]['tmp_name'], $file_path); @chmod($file_path, 0777); // return return $ext; } /** * Move image */ function move($from_file, $size_type, $image_id){ // make hash $pathinfo = pathinfo(strtolower($from_file)); $ext = $pathinfo["extension"]; // update //$this -> update($image_id, $size_type, $ext); // get path $file_path = $this -> path($image_id, $size_type, $ext); @rename($from_file, $file_path); @chmod($file_path, 0777); // return return $ext; } function delete($image_id, $size_type){ // make hash $file_path = $this -> path($image_id, $size_type, 'jpg'); @unlink($file_path); } function resize($image_id, $size_type){ global $_SETTINGS; $big_file = $this -> path($image_id, 'big', 'jpg'); $small_file = $this -> path($image_id, $size_type, 'jpg'); // update //$this -> update($image_id, $size_type, 'jpg'); @chmod($small_file, 0777); makeThumb($big_file, $small_file, $_SETTINGS['model_thumb_'.$size_type.'_width'], $_SETTINGS['model_thumb_'.$size_type.'_height']); } /** * Update image * function update($image_id, $size_type, $ext){ global $db; $field_name = $size_type == 'big' ? 'image_big' : 'image_small'; // update $sql = "UPDATE "._PREFIX."models SET ".$field_name."_ext = '".tosql($ext)."'" . " WHERE id = " . $image_id; run_db_sql($sql); return $image_id; }*/ /** * File name */ function name($image_id, $size_type, $ext){ if($size_type == 'big') { return 'model' . sPos($image_id) . "." . $ext; } elseif($size_type == 'small'){ return 'model' . sPos($image_id) . "s." . $ext; } elseif($size_type == 'medium'){ return 'model' . sPos($image_id) . "m." . $ext; } else { return 'model' . sPos($image_id) . "." . $ext; } } /** * Get URL */ function url($image_id, $size_type, $ext){ if(is_file($this -> path($image_id, $size_type, $ext))) { return $this -> url . $this -> name($image_id, $size_type, $ext); } else { return $this -> url . $this -> name(99999, $size_type, $ext); } } /** * Get path */ function path($image_id, $size_type, $ext){ return $this -> path . $this -> name($image_id, $size_type, $ext); } } /********************************************/ class SetVideosImage{ var $path = ''; var $url = ''; /** * Constructor */ function SetVideosImage(){ global $_SETTINGS; $this -> path = $_SETTINGS['path'] . 'videos/'; $this -> url = $_SETTINGS['url'] . 'videos/'; } function set_folder($set_id){ return 'set'.sPos($set_id); } function set_folder_path($set_id){ return $this -> path . $this -> set_folder($set_id); } /** * Upload image */ function upload($input, $set_id, $size_type, $image_id){ global $_FILES; // make hash $pathinfo = pathinfo(strtolower($_FILES[$input]['name'])); $ext = $pathinfo["extension"]; // update //$this -> update($image_id, $size_type, $ext); // get path $file_path = $this -> path($set_id, $image_id, $size_type, $ext); // upload move_uploaded_file($_FILES[$input]['tmp_name'], $file_path); @chmod($file_path, 0777); // return return $ext; } /** * Move image */ function move($from_file, $set_id, $size_type, $image_id){ // make hash $pathinfo = pathinfo(strtolower($from_file)); $ext = 'jpg'; // update //$this -> update($image_id, $size_type, $ext); // get path $file_path = $this -> path($set_id, $image_id, $size_type, $ext); @rename($from_file, $file_path); @chmod($file_path, 0777); // return return $ext; } function resize($set_id, $image_id, $image_big){ global $_SETTINGS; $big_file = $this -> path($set_id, $image_id, 'big', $image_big); $small_file = $this -> path($set_id, $image_id, 'small', 'jpg'); // update //$this -> update($image_id, 'small', 'jpg'); @chmod($small_file, 0777); makeThumb($big_file, $small_file, $_SETTINGS['thumb_width'], $_SETTINGS['thumb_height']); } /** * File name */ function name($image_id, $size_type, $ext){ if($size_type == 'big') { return 'p' . sPos($image_id) . "." . $ext; } else{ return 'p' . sPos($image_id) . "t." . $ext; } } /** * Get URL */ function url($set_id, $image_id, $size_type, $ext){ return $this -> url . $this -> name($image_id, $size_type, $ext); } /** * Get path */ function path($set_id, $image_id, $size_type, $ext){ return $this -> path . $this -> name($image_id, $size_type, $ext); } function delete($set_id, $image_id, $size_type){ // make hash $file_path = $this -> path($set_id, $image_id, $size_type, 'jpg'); @unlink($file_path); } } path = $_SETTINGS['path'] . $new_folder . '/'; $this -> url = $_SETTINGS['url'] . $new_folder . '/'; $this -> db = _PREFIX.$new_folder; } function set_folder($set_id){ return 'set'.sPos($set_id); } function set_folder_path($set_id){ return $this -> path . $this -> set_folder($set_id); } /** * Upload video */ function video_upload($input, $set_id, $video_id){ global $_FILES; $pathinfo = pathinfo(strtolower($_FILES[$input]['name'])); $video_ext = $pathinfo["extension"]; // update $this -> video_update($video_id, $video_ext); // get path $video_file = $this -> video_path($set_id, $video_id, $video_ext); // upload move_uploaded_file($_FILES[$input]['tmp_name'], $video_file); @chmod($video_file, 0777); // return return $this -> video_url($set_id, $video_id, $video_ext); } function preview_upload($input, $set_id, $video_id){ global $_FILES; $pathinfo = pathinfo(strtolower($_FILES[$input]['name'])); $preview_ext = $pathinfo["extension"]; // update $this -> preview_update($video_id, $preview_ext); // get path $preview_file = $this -> preview_path($set_id, $video_id, $preview_ext); // upload move_uploaded_file($_FILES[$input]['tmp_name'], $preview_file); @chmod($preview_file, 0777); // return return $this -> preview_url($set_id, $video_id, $preview_ext); } /** * Move image */ function move($video_file_src, $set_id, $video_id){ $pathinfo = pathinfo($video_file_src); $video_ext = strtolower($pathinfo["extension"]); // looking for preview $preview_ext = ''; $preview_file_src = ''; $exts = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); foreach($exts as $ext){ $preview_file_src = substr($video_file_src, 0, strlen($video_file_src) - strlen($video_ext)) . $ext; if(file_exists( $preview_file_src )){ $preview_ext = $ext; break; } } // update $this -> video_update($video_id, $video_ext); $this -> preview_update($video_id, $preview_ext); // video $video_file = $this -> video_path($set_id, $video_id, $video_ext); @rename($video_file_src, $video_file); @chmod($video_file, 0777); // preview if(!empty($preview_ext)){ $preview_file = $this -> preview_path($set_id, $video_id, $preview_ext); @rename($preview_file_src, $preview_file); @chmod($preview_file, 0777); } return array('video' => $this -> video_url($set_id, $video_id, $video_ext), 'preview' => $this -> preview_url($set_id, $video_id, $preview_ext)); } /** * Update image */ function video_update($video_id, $video_ext){ global $db; // update $sql = "UPDATE ". $this -> db ." SET ". "video_ext = '".tosql($video_ext)."'" . " WHERE id = " . $video_id; run_db_sql($sql); return $video_id; } function preview_update($video_id, $preview_ext){ global $db; // update $sql = "UPDATE ". $this -> db ." SET preview_ext = '".tosql($preview_ext)."' " . " WHERE id = " . $video_id; run_db_sql($sql); return $video_id; } /** * File name */ function video_name($video_id, $video_ext){ return 'video' . sPos($video_id) . "." . $video_ext; } /** * Get URL */ function video_url($set_id, $video_id, $video_ext){ return $this -> url . $this -> set_folder($set_id) . '/' . $this -> video_name($video_id, $video_ext); } /** * Get path */ function video_path($set_id, $video_id, $video_ext){ return $this -> path . $this -> set_folder($set_id) . '/' . $this -> video_name($video_id, $video_ext); } /** * File name */ function preview_name($video_id, $preview_ext){ return 'preview' . sPos($video_id) . "." . $preview_ext; } /** * Get URL */ function preview_url($set_id, $video_id, $preview_ext){ return $this -> url . $this -> set_folder($set_id) . '/' . $this -> preview_name($video_id, $preview_ext); } /** * Get path */ function preview_path($set_id, $video_id, $preview_ext){ return $this -> path . $this -> set_folder($set_id) . '/' . $this -> preview_name($video_id, $preview_ext); } function preview_resize($set_id, $video_id, $preview_ext, $size_type){ global $_SETTINGS; $big_file = $this -> preview_path($set_id, $video_id, $preview_ext); $small_file = $this -> preview_path($set_id, $video_id, 's'.$preview_ext); @chmod($small_file, 0777); makeThumb($big_file, $small_file, $_SETTINGS['model_thumb_'.$size_type.'_width'], $_SETTINGS['model_thumb_'.$size_type.'_height']); } } ?>Smarty(); $this->debugging = false; $this->template_dir = './tmpl/'; $this->compile_dir = './tmpl_c/'; $this->force_compile = true; } } ?>