// Uninstall plugin $key = array_search($_GET['delete'], $installed_plugins); if ($key !== false) { if (method_exists($_GET['delete'], 'Uninstall')) { call_user_func(array($_GET['delete'], 'Uninstall')); } unset($installed_plugins[$key]); Settings::Set('installed_plugins', serialize($installed_plugins)); } // Delete plugin files $plugin_info = Plugin::GetPluginInfo($_GET['delete']); $message = $plugin_info->name . ' plugin has been deleted'; $message_type = 'success'; try { Filesystem::Open(); Filesystem::Delete(DOC_ROOT . '/cc-content/plugins/' . $_GET['delete']); Filesystem::Close(); } catch (Exception $e) { $message = $e->getMessage(); $message_type = 'error'; } } } else { if (!empty($_GET['enable']) && !ctype_space($_GET['enable'])) { // Validate plugin if (Plugin::ValidPlugin($_GET['enable']) && !in_array($_GET['enable'], $enabled_plugins)) { // Install plugin if applicable if (!in_array($_GET['enable'], $installed_plugins)) { if (method_exists($_GET['enable'], 'Install')) { call_user_func(array($_GET['enable'], 'Install')); }
<?php // Include required files include_once dirname(dirname(__FILE__)) . '/cc-core/config/admin.bootstrap.php'; App::LoadClass('User'); // Establish page variables, objects, arrays, etc Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/'); $admin = new User($logged_in); Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/'); $page_title = 'CumulusClips Admin Panel - Dashboard'; $first_run = null; // Execute post install / first run operations if (isset($_GET['first_run']) && file_exists(DOC_ROOT . '/cc-install')) { Settings::Set('version', CURRENT_VERSION); Filesystem::Open(); Filesystem::Delete(DOC_ROOT . '/cc-install'); Filesystem::Close(); $first_run = true; } // Retrieve news from mothership if (isset($_POST['news'])) { $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, MOTHERSHIP_URL . '/news/'); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true); $news = curl_exec($curl_handle); curl_close($curl_handle); $news = !empty($news) ? $news : '<strong>Nothing to report.</strong>'; exit($news); } // Retrieve Video totals
### Setting required permissions Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/flv', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/mobile', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/thumbs', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/temp', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/avatars', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-core/logs', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/bin', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/bin/qtfaststart', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/exceptions.py', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/__init__.py', 0777); Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/processor.py', 0777); ### Delete temp. dir. Filesystem::Delete($tmp); ### Activate themes ### Activate plugins Filesystem::Close(); unset($_SESSION['updates_available']); Settings::Set('version', $update->version); } catch (Exception $e) { $error = $e->getMessage(); $page_title = 'Error During Update'; } // Output Header $dont_show_update_prompt = true; include 'header.php'; ?> <div id="updates-complete">
// Enable plugin $enabled_plugins[] = $plugin_name; Settings::Set('enabled_plugins', serialize($enabled_plugins)); } // Display success message $plugin_info = Plugin::GetPluginInfo($plugin_name); $message = $plugin_info->name . ' has been added.'; $message_type = 'success'; unset($data); } catch (Exception $e) { $message = $e->getMessage(); $message_type = 'error'; // Perform clean up if plugin contained errors if ($clean_up) { try { Filesystem::Delete($temp_dir); Filesystem::Close(); } catch (Exception $e) { $message = $e->getMessage(); $message_type = 'error'; } } } // END extract and move plugin } else { $message = 'The following error occured. Please correct it and try again.<br /><br /> - '; $message .= implode('<br /> - ', $errors); $message_type = 'error'; } // END check for form errors }
### Handle "Delete" language if requested if (!empty($_GET['delete']) && !ctype_space($_GET['delete'])) { $language_file = DOC_ROOT . '/cc-content/languages/' . $_GET['delete'] . '.xml'; if (file_exists($language_file) && $_GET['delete'] != Settings::Get('default_language')) { // Deactivate language if applicable if (array_key_exists($_GET['delete'], $active_languages)) { unset($active_languages[$_GET['delete']]); Settings::Set('active_languages', serialize($active_languages)); } // Delete language file $xml = simplexml_load_file($language_file); $message = $xml->information->lang_name . ' language has been deleted'; $message_type = 'success'; try { Filesystem::Open(); Filesystem::Delete($language_file); Filesystem::Close(); } catch (Exception $e) { $message = $e->getMessage(); $message_type = 'error'; } } } else { if (!empty($_GET['activate']) && !ctype_space($_GET['activate'])) { // Validate theme $language_file = DOC_ROOT . '/cc-content/languages/' . $_GET['activate'] . '.xml'; if (file_exists($language_file)) { $xml = simplexml_load_file($language_file); $active_languages[$_GET['activate']] = array('lang_name' => (string) $xml->information->lang_name, 'native_name' => (string) $xml->information->native_name); Settings::Set('active_languages', serialize($active_languages)); $message = $xml->information->lang_name . ' has been activated.';
/** * Delete an avatar * @param integer $filename Name of file to be deleted * @return void Avatar is deleted from filesystem */ static function Delete($filename) { try { Filesystem::Open(); Filesystem::Delete(UPLOAD_PATH . '/avatars/' . $filename); Filesystem::Close(); } catch (Exception $e) { App::Alert('Error During Avatar Removal', "Unable to delete avatar: {$filename}. Error: " . $e->getMessage()); } }
/** * Delete a video * @param integer $video_id ID of video to be deleted * @return void Video is deleted from database and all related files and records are also deleted */ static function Delete($video_id) { App::LoadClass('Rating'); App::LoadClass('Flag'); App::LoadClass('Favorite'); App::LoadClass('Comment'); $db = Database::GetInstance(); $video = new self($video_id); Plugin::Trigger('video.delete'); // Delete files try { Filesystem::Open(); Filesystem::Delete(UPLOAD_PATH . '/flv/' . $video->filename . '.flv'); Filesystem::Delete(UPLOAD_PATH . '/thumbs/' . $video->filename . '.jpg'); Filesystem::Delete(UPLOAD_PATH . '/mobile/' . $video->filename . '.mp4'); Filesystem::Close(); } catch (Exception $e) { App::Alert('Error During Video Removal', "Unable to delete video files for: {$video->filename}. The video has been removed from the system, but the files still remain. Error: " . $e->getMessage()); } // Delete Comments $query = "SELECT comment_id FROM " . DB_PREFIX . "comments WHERE video_id = {$video_id}"; $result = $db->Query($query); while ($row = $db->FetchObj($result)) { Comment::Delete($row->comment_id); } // Delete Ratings $query = "SELECT rating_id FROM " . DB_PREFIX . "ratings WHERE video_id = {$video_id}"; $result = $db->Query($query); while ($row = $db->FetchObj($result)) { Rating::Delete($row->rating_id); } // Delete Favorites $query = "SELECT fav_id FROM " . DB_PREFIX . "favorites WHERE video_id = {$video_id}"; $result = $db->Query($query); while ($row = $db->FetchObj($result)) { Favorite::Delete($row->fav_id); } // Delete Flags $query = "SELECT flag_id FROM " . DB_PREFIX . "flags WHERE id = {$video_id} AND type = 'video'"; $result = $db->Query($query); while ($row = $db->FetchObj($result)) { Flag::Delete($row->flag_id); } // Delete Video $query = "DELETE FROM " . DB_PREFIX . "videos WHERE video_id = {$video_id}"; $db->Query($query); }
$video->Update($data); Plugin::Trigger('encode.update'); // Activate video $video->Approve('activate'); ///////////////////////////////////////////////////////////// // STEP 8 // // Clean up // ///////////////////////////////////////////////////////////// try { // Debug Log $config->debug_conversion ? App::Log(CONVERSION_LOG, 'Deleting raw video...') : null; ### Delete raw videos & pre-faststart files Filesystem::Open(); Filesystem::Delete($raw_video); Filesystem::Delete($mobile_temp); ### Delete encoding log files if ($config->debug_conversion) { App::Log(CONVERSION_LOG, "Video ID: {$video->video_id}, has completed processing!\n"); } else { Filesystem::Delete($debug_log); } } catch (Exception $e) { App::Alert('Error During Video Encoding', $e->getMessage()); App::Log(CONVERSION_LOG, $e->getMessage()); } Plugin::Trigger('encode.complete'); } catch (Exception $e) { App::Alert('Error During Video Encoding', $e->getMessage()); App::Log(CONVERSION_LOG, $e->getMessage()); exit; }
if (empty(View::$vars->Errors)) { View::$vars->message = Language::GetText('success_profile_updated'); View::$vars->message_type = 'success'; View::$vars->user->Update(View::$vars->data); Plugin::Trigger('update_profile.update_profile'); } else { View::$vars->message = Language::GetText('errors_below'); View::$vars->message .= '<br /><br /> - ' . implode('<br /> - ', View::$vars->Errors); View::$vars->message_type = 'error'; } } // END Handle Profile form /************************** Handle Reset Avatar Action **************************/ if (!empty($_GET['action']) && $_GET['action'] == 'reset' && !empty(View::$vars->user->avatar)) { try { Filesystem::Open(); Filesystem::Delete(UPLOAD_PATH . '/avatars/' . View::$vars->user->avatar); Filesystem::Close(); } catch (Exception $e) { App::Alert('Error during Avatar Reset', $e->getMessage()); } View::$vars->user->Update(array('avatar' => '')); View::$vars->message = Language::GetText('success_avatar_reset'); View::$vars->message_type = 'success'; Plugin::Trigger('update_profile.avatar_reset'); } // Output page Plugin::Trigger('update_profile.before_render'); View::Render('myaccount/update_profile.tpl');
Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/'); $message = null; $page_title = 'Themes'; $admin_js[] = ADMIN . '/extras/fancybox/jquery.fancybox-1.3.4.js'; $admin_js[] = ADMIN . '/js/fancybox.js'; ### Handle "Delete" theme if requested if (!empty($_GET['delete']) && !ctype_space($_GET['delete']) && Functions::ValidTheme($_GET['delete'])) { $theme_path = THEMES_DIR . '/' . $_GET['delete']; $xml = simplexml_load_file($theme_path . '/theme.xml'); if (Settings::Get('active_theme') != $_GET['delete']) { // DELETE THEME CODE $message = $xml->name . ' theme has been deleted'; $message_type = 'success'; try { Filesystem::Open(); Filesystem::Delete($theme_path); Filesystem::Close(); } catch (Exception $e) { $message = $e->getMessage(); $message_type = 'error'; } } else { $message = 'Active theme cannot be deleted. Activate another theme and then try again'; $message_type = 'error'; } } else { if (!empty($_GET['activate']) && !ctype_space($_GET['activate'])) { // Validate theme if (Functions::ValidTheme($_GET['activate'])) { $xml = simplexml_load_file(THEMES_DIR . '/' . $_GET['activate'] . '/theme.xml'); Settings::Set('active_theme', $_GET['activate']);