Ejemplo n.º 1
0
 $filecreatedcount = count($filescreatedlist);
 // Format numbers
 $filecreatedcount_format = number_format($filecreatedcount);
 $totallinescalculated_format = number_format($totallinescalculated);
 // Connect to database
 $database = new Database(HOST, DBNAME, DBUSER, DBPASS);
 // Posted data
 $posted_date = date('Y-m-d H:i:s');
 // Insert into database
 $varObject->description = str_replace("'", "\\'", $varObject->description);
 $create_package_record = array('uid' => $_SESSION['uid'], 'midparent' => $varObject->midparent, 'm_name' => $varObject->name, 'm_file_name' => $varObject->filename, 'version' => $varObject->version, 'jversion' => $varObject->jversion, 'brversion' => $varObject->brversion, 'description' => $varObject->description, 'license' => $varObject->license, 'copyright' => $varObject->copyright, 'author' => $varObject->author, 'author_email' => $varObject->author_email, 'author_url' => $varObject->author_url, 'date_created' => $posted_date, 'filesize' => $bytes, 'lines_created' => $totallinescalculated, 'files_created' => $filecreatedcount, 'minutes_saved' => $totaltimesaved, 'download_count' => 1);
 $mid = $database->insert('br_modules', $create_package_record);
 $filesize = FileHelper::formatBytes($bytes);
 // Move to user folder from tmp
 $userfolder = $folderusersmodules . $mid . DS;
 FileHelper::foldercheck($userfolder);
 FileHelper::createfile($userfolder . $indexfile, $indexlines);
 FileHelper::copyToLocation($folderusersmodulestmp . $packagename, $userfolder . $packagename);
 $filecreatedpath = BASE_URL . 'users' . DS . $_SESSION['uid'] . DS . 'modules' . DS . $mid . DS . $packagename;
 // Clean up tmp folder now that zip has been created
 FileHelper::deleteDir($folderusersmodulestmp);
 // account for hours in display..
 if ($totaltimesaved > 60) {
 }
 // Set permissions of paths
 chmod($folderusersmodules, 0777);
 chmod($userfolder, 0777);
 // Call header
 $pageTitle = 'Module Created | Free | Joomla 2.5 & Joomla 3.0';
 $pageActive = 'modules';
 $pageActiveBreadcrumb = '<li class="active">Module Created</li>';
Ejemplo n.º 2
0
 // Save user record of component and move to their repo
 if ($_SESSION['loggedin'] && $filescreatedlist && $_SESSION['paid'] == 1) {
     // get all fields to save and relation
     $user_component_record = array('uid' => $_SESSION['uid'], 'cidparent' => $varObject->cidparent, 'c_name' => $varObject->comp_name, 'c_file_name' => $packagename, 'version' => $varObject->version, 'jversion' => $varObject->j_version, 'brversion' => $br_version, 'description' => $varObject->description, 'license' => $varObject->license, 'copyright' => $varObject->copyright, 'author' => $varObject->author, 'a_email' => $varObject->a_email, 'a_url' => $varObject->a_url, 'category_view' => $varObject->includeCat, 'tags_view' => $varObject->includeTags, 'use_usercreated' => $varObject->usermodified, 'use_datecreated' => $varObject->datemodified, 'use_database' => $varObject->useDatabase, 'use_imageupload' => $varObject->imageUpload, 'imageheight' => $varObject->imageHeight, 'imagewidth' => $varObject->imageWidth, 'imagethumbhw' => $varObject->imageThumbHW, 'date_created' => $posted_date, 'filesize' => $bytes, 'lines_created' => $totallinescalculated, 'files_created' => $filecreatedcount, 'minutes_saved' => $totallinescalculated / 4, 'downloadcount' => 1);
     $cid = $database->insert('br_components', $user_component_record);
     // Set folders for user
     $usersFolder = MAINDIR . DS . 'users' . DS;
     $userFolder = $usersFolder . $_SESSION['uid'] . DS;
     $userFolderComp = $userFolder . $cid . DS;
     $userComponent = $userFolderComp . $filecreated;
     $usersFolderIndex = $usersFolder . 'index.html';
     $userFolderIndex = $userFolder . 'index.html';
     $userFolderCompIndex = $userFolderComp . 'index.html';
     FileHelper::foldercheck($usersFolder);
     FileHelper::foldercheck($userFolder);
     FileHelper::foldercheck($userFolderComp);
     // Set permissions of paths
     chmod($usersFolder, 0777);
     chmod($userFolder, 0777);
     chmod($userFolderComp, 0777);
     if (!copy($filedirectpath, $userComponent)) {
         // send e-mail?
     }
     // Move index.html - no browsing this folder!
     if (!copy($componentsfolderindex, $usersFolderIndex)) {
         // send e-mail?
     }
     if (!copy($componentsfolderindex, $userFolderIndex)) {
         // send e-mail?
     }
     if (!copy($componentsfolderindex, $userFolderCompIndex)) {