"File could not be saved." ))); }else{ /* Security Check */ if( !logged_in() ){ exit(json_encode(array( "error" => "File could not be saved." ))); }else{ //upload S3 thumbnail if($_FILES['file']['name'] != ''){ $filename = 'file_'.md5(rand(100, 200)).bw_ExtractFileExt($_FILES['file']['name']); //tmp saves images to server if(!is_dir(MEDIA_DIR)){ mkdir(MEDIA_DIR, 0777); } $file = Renderosity\Facades\Image::open($_FILES['file']['tmp_name'])->save(MEDIA_DIR.$filename, array('quality' => 100)); //uploads to s3 from server if(Renderosity\Facades\S3::bucket("forumpro")->putObject(MEDIA_DIR.$filename, 'forumpro_tmp/'.$filename)){ @unlink(MEDIA_DIR.$filename); exit(json_encode(array( "link" => array( "url" => Renderosity\Facades\S3::bucket("forumpro")->getObjectUrl('forumpro_tmp/'.$filename), "alt" => $_FILES['file']['name'], "basename" => $filename, "is_image" => true )))); } } } } } /* Global Variables */ Renderosity\Facades\DB::execute("SELECT group_id, name FROM forumpro_group WHERE status='active' ORDER BY priority,name;"); $fgroups = Renderosity\Facades\DB::getResults(); if( intval($_GET['thread_id']) ){ Renderosity\Facades\DB::execute("select forum_id from forumpro_thread where thread_id=".intval($_GET['thread_id'])); $tid = Renderosity\Facades\DB::getAtIndex(0,'forum_id'); } elseif( intval($_GET['forum_id']) ){ $tid = intval($_GET['forum_id']); } else{ $tid = 0; } /* User edits personal forum settings */ if( isset($_GET['sfp']) ){ require_once root_dir().'secure.php'; require_once root_dir().'mod/forumpro/settings/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => "Forum Settings | Renderosity" )); require_once root_dir().'settings/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } /* Actions for a specific thread */ elseif( is_numeric($_GET['thread_id']) || isset($_GET['thread']) ){ require_once root_dir().'mod/forumpro/thread/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => empty($title) ? "Forums | Renderosity" : $title )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } /* Actions for a specific forum */ elseif( is_numeric($_GET['forum_id']) ){ require_once root_dir().'mod/forumpro/forum/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => empty($title) ? "Forums | Renderosity" : $title )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } elseif( isset($_GET['message']) ){ require_once root_dir().'secure.php'; require_once root_dir().'mod/forumpro/message/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => empty($title) ? "Forums | Renderosity" : $title )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } /* Admin area for managing forums and groups */ elseif( isset($_GET['manage']) ){ require_once root_dir().'secure.php'; require_once root_dir().'mod/forumpro/manage/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => "Forums | Renderosity" )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } /* User stats for forum */ elseif( isset($_GET['stats']) ){ require_once root_dir().'mod/forumpro/stats/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js", "assets/javascripts/highcharts-style.js"), "css" => array("assets/css/forumpro.css"), "title" => "Forum Stats | Renderosity" )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } /* User stats for forum */ elseif( isset($_GET['reports']) ){ require_once root_dir().'secure.php'; require_once root_dir().'mod/forumpro/manage/reports/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => "Forum Reports | Renderosity" )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } /* Search */ elseif( isset($_GET['search']) ){ require_once root_dir().'secure.php'; require_once root_dir().'mod/forumpro/search/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => "Forum Reports | Renderosity" )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } /* Display groups (index page) */ else{ require_once root_dir().'mod/forumpro/groups/index.php'; Renderosity\Facades\TMPL::renderHeader('layouts/application/header.html.php', array( "js" => array("assets/javascripts/forumpro.js"), "css" => array("assets/css/forumpro.css"), "title" => "Forums | Renderosity" )); require_once root_dir().'mod/forumpro/_index.html.php'; Renderosity\Facades\TMPL::renderFooter('layouts/application/footer.html.php'); } ?>