/** * prepares and stores group logo * * @param string $file * @return string */ public function storeLogo( $file ) { global $ueConfig; if ( isset( $_FILES[$file]['tmp_name'] ) && ! empty( $_FILES[$file]['tmp_name'] ) && ( $_FILES[$file]['error'] == 0 ) && ( is_uploaded_file( $_FILES[$file]['tmp_name'] ) ) ) { $plugin = cbgjClass::getPlugin(); $logoSize = $plugin->params->get( 'logo_size', 2000 ); $logoWidth = $plugin->params->get( 'logo_width', 200 ); $logoHeight = $plugin->params->get( 'logo_height', 500 ); $logoThumbwidth = $plugin->params->get( 'logo_thumbwidth', 60 ); $logoThumbheight = $plugin->params->get( 'logo_thumbheight', 86 ); $categoryPath = $plugin->imgsAbs . '/' . (int) $this->get( 'category' ); $groupPath = $categoryPath . '/' . (int) $this->get( 'id' ); $mode = cbgjClass::getFilePerms(); cbgjClass::createFolderPath( $plugin->imgsAbs, $categoryPath, $groupPath ); $allwaysResize = ( isset( $ueConfig['avatarResizeAlways'] ) ? $ueConfig['avatarResizeAlways'] : 1 ); $fileNameInDir = preg_replace( '/[^-a-zA-Z0-9_]/', '', uniqid( (int) $this->get( 'user_id' ) . '_' ) ); $imgToolBox = new imgToolBox(); $imgToolBox->_conversiontype = $ueConfig['conversiontype']; $imgToolBox->_IM_path = $ueConfig['im_path']; $imgToolBox->_NETPBM_path = $ueConfig['netpbm_path']; $imgToolBox->_maxsize = (int) ( $logoSize ? $logoSize : $ueConfig['avatarSize'] ); $imgToolBox->_maxwidth = (int) ( $logoWidth ? $logoWidth : $ueConfig['avatarWidth'] ); $imgToolBox->_maxheight = (int) ( $logoHeight ? $logoHeight : $ueConfig['avatarHeight'] ); $imgToolBox->_thumbwidth = (int) ( $logoThumbwidth ? $logoThumbwidth : $ueConfig['thumbWidth'] ); $imgToolBox->_thumbheight = (int) ( $logoThumbheight ? $logoThumbheight : $ueConfig['thumbHeight'] ); $imgToolBox->_debug = 0; $newFileName = $imgToolBox->processImage( $_FILES[$file], $fileNameInDir, $groupPath . '/', 0, 0, 1, $allwaysResize ); if ( $newFileName ) { if ( $this->get( 'logo' ) ) { if ( file_exists( $groupPath . '/' . $this->getCleanLogo() ) ) { @unlink( $groupPath . '/' . $this->getCleanLogo() ); } if ( file_exists( $groupPath . '/tn' . $this->getCleanLogo() ) ) { @unlink( $groupPath . '/tn' . $this->getCleanLogo() ); } } $this->set( 'logo', $newFileName ); @chmod( $groupPath . '/', $this->getCleanLogo(), $mode ); @chmod( $groupPath . '/tn', $this->getCleanLogo(), $mode ); $this->store(); } else { $this->set( '_error', CBTxt::T( str_replace( 'Error: ', '', $imgToolBox->_errMSG ) ) ); } } elseif ( $this->get( 'logo' ) && isset( $this->_previousCategory ) && ( $this->_previousCategory != $this->get( 'category' ) ) ) { $plugin = cbgjClass::getPlugin(); $categoryPath = $plugin->imgsAbs . '/' . (int) $this->get( 'category' ); $groupPath = $categoryPath . '/' . (int) $this->get( 'id' ); $oldCategoryPath = $plugin->imgsAbs . '/' . (int) $this->_previousCategory; $oldGroupPath = $oldCategoryPath . '/' . (int) $this->get( 'id' ); if ( file_exists( $oldGroupPath ) ) { cbgjClass::createFolderPath( $plugin->imgsAbs, $categoryPath, $groupPath ); cbgjClass::copyDirectory( $oldGroupPath, $groupPath ); cbgjClass::deleteDirectory( $oldGroupPath ); } } }
/** * delete old groupjive data * * @param moscomprofilerUser $user * @param object $plugin */ private function deleteMigrate( $user, $plugin ) { global $_CB_framework, $_CB_database; $query = 'DROP TABLE IF EXISTS ' . $_CB_database->NameQuote( '#__gj_active' ); $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { cbgjClass::getPluginURL( array( 'tools' ), CBTxt::P( 'GroupJive failed to delete! Error: [error]', array( '[error]' => $_CB_database->stderr( true ) ) ), false, true, 'error' ); } $query = 'DROP TABLE IF EXISTS ' . $_CB_database->NameQuote( '#__gj_bul' ); $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { cbgjClass::getPluginURL( array( 'tools' ), CBTxt::P( 'GroupJive failed to delete! Error: [error]', array( '[error]' => $_CB_database->stderr( true ) ) ), false, true, 'error' ); } $query = 'DROP TABLE IF EXISTS ' . $_CB_database->NameQuote( '#__gj_grcategory' ); $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { cbgjClass::getPluginURL( array( 'tools' ), CBTxt::P( 'GroupJive failed to delete! Error: [error]', array( '[error]' => $_CB_database->stderr( true ) ) ), false, true, 'error' ); } $query = 'DROP TABLE IF EXISTS ' . $_CB_database->NameQuote( '#__gj_groups' ); $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { cbgjClass::getPluginURL( array( 'tools' ), CBTxt::P( 'GroupJive failed to delete! Error: [error]', array( '[error]' => $_CB_database->stderr( true ) ) ), false, true, 'error' ); } $query = 'DROP TABLE IF EXISTS ' . $_CB_database->NameQuote( '#__gj_jb' ); $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { cbgjClass::getPluginURL( array( 'tools' ), CBTxt::P( 'GroupJive failed to delete! Error: [error]', array( '[error]' => $_CB_database->stderr( true ) ) ), false, true, 'error' ); } $query = 'DROP TABLE IF EXISTS ' . $_CB_database->NameQuote( '#__gj_users' ); $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { cbgjClass::getPluginURL( array( 'tools' ), CBTxt::P( 'GroupJive failed to delete! Error: [error]', array( '[error]' => $_CB_database->stderr( true ) ) ), false, true, 'error' ); } $gj_path = $_CB_framework->getCfg( 'absolute_path' ) . '/images/com_groupjive'; if ( is_dir( $gj_path ) ) { cbgjClass::deleteDirectory( $gj_path ); } cbgjClass::getPluginURL( array( 'tools' ), CBTxt::T( 'GroupJive deleted successful.' ), false, true ); }