public function processCleanUp() { $configs = OW::getConfig()->getValues('cacheextreme'); //clean template cache if ($configs['template_cache']) { OW_ViewRenderer::getInstance()->clearCompiledTpl(); } //clean db backend cache if ($configs['backend_cache']) { OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL); } //clean themes static contents cache if ($configs['theme_static']) { OW::getThemeManager()->getThemeService()->processAllThemes(); } //clean plugins static contents cache if ($configs['plugin_static']) { $pluginService = BOL_PluginService::getInstance(); $activePlugins = $pluginService->findActivePlugins(); /* @var $pluginDto BOL_Plugin */ foreach ($activePlugins as $pluginDto) { $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS; if (file_exists($pluginStaticDir)) { $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS; if (file_exists($staticDir)) { UTIL_File::removeDir($staticDir); } mkdir($staticDir); chmod($staticDir, 0777); UTIL_File::copyDir($pluginStaticDir, $staticDir); } } } }
public function copyDir($sourcePath, $destPath, array $fileTypes = null, $level = -1) { if (!$this->fileExists($destPath)) { $this->mkdir($destPath); } UTIL_File::copyDir($sourcePath, $destPath, $fileTypes, $level); }
private function exportThemes(ZipArchive $za, $archiveDir) { $currentTheme = OW::getThemeManager()->getSelectedTheme()->getDto(); $currentThemeDir = OW::getThemeManager()->getSelectedTheme()->getRootDir(); $currentThemeUserfilesDir = OW_DIR_THEME_USERFILES; $this->configs['currentTheme'] = array('name' => $currentTheme->name, 'customCss' => $currentTheme->customCss, 'customCssFileName' => $currentTheme->customCssFileName, 'description' => $currentTheme->description, 'isActive' => $currentTheme->isActive, 'sidebarPosition' => $currentTheme->sidebarPosition, 'title' => $currentTheme->title); $controlValueList = OW::getDbo()->queryForList(" SELECT * FROM " . BOL_ThemeControlValueDao::getInstance()->getTableName() . " WHERE themeId = :themeId ", array('themeId' => $currentTheme->id)); foreach ($controlValueList as $controlValue) { $this->configs['controlValue'][$controlValue['themeControlKey']] = $controlValue['value']; } $za->addEmptyDir($archiveDir . '/' . $currentTheme->getName()); $this->zipFolder($za, $currentThemeDir, $archiveDir . '/' . $currentTheme->getName() . '/'); $themesDir = Ow::getPluginManager()->getPlugin('dataexporter')->getPluginFilesDir() . 'themes' . DS; UTIL_File::copyDir(OW_DIR_THEME_USERFILES, $themesDir); $fileList = Ow::getStorage()->getFileNameList(OW_DIR_THEME_USERFILES); mkdir($themesDir, 0777); foreach ($fileList as $file) { if (Ow::getStorage()->isFile($file)) { Ow::getStorage()->copyFileToLocalFS($file, $themesDir . mb_substr($file, mb_strlen(OW_DIR_THEME_USERFILES))); } } $za->addEmptyDir($archiveDir . '/themes'); $this->zipFolder($za, $themesDir, $archiveDir . '/themes/'); }
* use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ try { $sql = "SHOW COLUMNS FROM `" . OW_DB_PREFIX . "video_clip` LIKE 'plugin';"; $cols = Updater::getDbo()->queryForList($sql); if (!count($cols)) { $sql = "ALTER TABLE `" . OW_DB_PREFIX . "video_clip` ADD `plugin` VARCHAR(255) NULL DEFAULT 'video' ; "; Updater::getDbo()->update($sql); } } catch (Exception $e) { } // refresh static cache $plugin = OW::getPluginManager()->getPlugin('spvideolite'); $staticDir = OW_DIR_STATIC_PLUGIN . $plugin->getModuleName() . DS; $pluginStaticDir = OW_DIR_PLUGIN . $plugin->getModuleName() . DS . 'static' . DS; if (file_exists($staticDir)) { UTIL_File::removeDir($staticDir); } mkdir($staticDir); chmod($staticDir, 0777); UTIL_File::copyDir($pluginStaticDir, $staticDir);
/** * Updates/adds whole theme content, generating static files and inserting theme content in DB. * * @param integer $id */ public function processTheme($id) { $theme = $this->getThemeById($id); $themeName = $theme->getName(); if (!file_exists($this->getRootDir($themeName))) { throw new LogicException("Can't find theme dir for `" . $themeName . "`!"); } $themeStaticDir = $this->getStaticDir($themeName); $themeRootDir = $this->getRootDir($themeName); $mobileRootDir = $this->getRootDir($themeName, true); // deleting DB entries and files $this->unlinkTheme($theme->getId()); mkdir($themeStaticDir); // copy all static files UTIL_File::copyDir($themeRootDir, $this->getStaticDir($themeName)); $files = UTIL_File::findFiles($themeStaticDir, array('psd', 'html')); foreach ($files as $file) { unlink($file); } $themeControls = array(); // copy main css file if (file_exists($themeRootDir . self::CSS_FILE_NAME)) { $controlsContent = file_get_contents($themeRootDir . self::CSS_FILE_NAME); $themeControls = $this->getThemeControls($controlsContent); $mobileControls = array(); if (file_exists($mobileRootDir . self::CSS_FILE_NAME)) { $controlsContent .= PHP_EOL . file_get_contents($mobileRootDir . self::CSS_FILE_NAME); $mobileControls = $this->getThemeControls(file_get_contents($mobileRootDir . self::CSS_FILE_NAME)); foreach ($mobileControls as $key => $val) { $mobileControls[$key]['mobile'] = true; } } $themeControls = array_merge($mobileControls, $themeControls); // adding theme controls in DB if (!empty($themeControls)) { foreach ($themeControls as $value) { $themeControl = new BOL_ThemeControl(); $themeControl->setAttribute($value['attrName']); $themeControl->setKey($value['key']); $themeControl->setSection($value['section']); $themeControl->setSelector($value['selector']); $themeControl->setThemeId($theme->getId()); $themeControl->setDefaultValue($value['defaultValue']); $themeControl->setType($value['type']); $themeControl->setLabel($value['label']); if (isset($value['description'])) { $themeControl->setDescription(trim($value['description'])); } $themeControl->setMobile(!empty($value['mobile'])); $this->themeControlDao->save($themeControl); } } } // decorators if (file_exists($this->getDecoratorsDir($themeName))) { $files = UTIL_File::findFiles($this->getDecoratorsDir($themeName), array('html'), 0); foreach ($files as $value) { $decoratorEntry = new BOL_ThemeContent(); $decoratorEntry->setThemeId($theme->getId()); $decoratorEntry->setType(BOL_ThemeContentDao::VALUE_TYPE_ENUM_DECORATOR); $decoratorEntry->setValue(UTIL_File::stripExtension(basename($value))); $this->themeContentDao->save($decoratorEntry); } } // master pages if (file_exists($this->getMasterPagesDir($themeName))) { $files = UTIL_File::findFiles($this->getMasterPagesDir($themeName), array('html'), 0); foreach ($files as $value) { $masterPageEntry = new BOL_ThemeContent(); $masterPageEntry->setThemeId($theme->getId()); $masterPageEntry->setType(BOL_ThemeContentDao::VALUE_TYPE_ENUM_MASTER_PAGE); $masterPageEntry->setValue(UTIL_File::stripExtension(basename($value))); $this->themeContentDao->save($masterPageEntry); } } if (file_exists($this->getMasterPagesDir($themeName, true))) { $files = UTIL_File::findFiles($this->getMasterPagesDir($themeName, true), array('html'), 0); foreach ($files as $value) { $masterPageEntry = new BOL_ThemeContent(); $masterPageEntry->setThemeId($theme->getId()); $masterPageEntry->setType(BOL_ThemeContentDao::VALUE_TYPE_ENUM_MOBILE_MASTER_PAGE); $masterPageEntry->setValue(UTIL_File::stripExtension(basename($value))); $this->themeContentDao->save($masterPageEntry); } } // xml master page assignes $xml = simplexml_load_file($this->getRootDir($themeName) . self::MANIFEST_FILE); $masterPages = (array) $xml->masterPages; foreach ($masterPages as $key => $value) { $masterPageLinkEntry = new BOL_ThemeMasterPage(); $masterPageLinkEntry->setThemeId($theme->getId()); $masterPageLinkEntry->setDocumentKey(trim($key)); $masterPageLinkEntry->setMasterPage(trim($value)); $this->themeMasterPageDao->save($masterPageLinkEntry); } }
/** * Installs plugins. * * @param string $key */ public function install($key, $generateCache = true) { $availablePlugins = $this->getAvailablePluginsList(); if (empty($key) || !array_key_exists($key, $availablePlugins)) { throw new LogicException('Invalid plugin key - `' . $key . '` provided!'); } $pluginInfo = $availablePlugins[$key]; $dirArray = explode(DS, $pluginInfo['path']); $moduleName = array_pop($dirArray); // add DB entry $pluginDto = new BOL_Plugin(); $pluginDto->setTitle(!empty($pluginInfo['title']) ? trim($pluginInfo['title']) : 'No Title'); $pluginDto->setDescription(!empty($pluginInfo['description']) ? trim($pluginInfo['description']) : 'No Description'); $pluginDto->setKey(trim($pluginInfo['key'])); $pluginDto->setModule($moduleName); $pluginDto->setIsActive(true); $pluginDto->setIsSystem(false); $pluginDto->setBuild((int) $pluginInfo['build']); if (!empty($pluginInfo['developerKey'])) { $pluginDto->setDeveloperKey(trim($pluginInfo['developerKey'])); } $this->pluginDao->save($pluginDto); $this->readPluginsList(); OW::getPluginManager()->readPluginsList(); // copy static dir $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS; if (!defined('OW_PLUGIN_XP') && file_exists($pluginStaticDir)) { $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS; if (!file_exists($staticDir)) { mkdir($staticDir); chmod($staticDir, 0777); } UTIL_File::copyDir($pluginStaticDir, $staticDir); } // create dir in pluginfiles $pluginfilesDir = OW_DIR_PLUGINFILES . $pluginDto->getModule(); if (!file_exists($pluginfilesDir)) { mkdir($pluginfilesDir); chmod($pluginfilesDir, 0777); } // create dir in userfiles $userfilesDir = OW_DIR_PLUGIN_USERFILES . $pluginDto->getModule(); if (!file_exists($userfilesDir)) { mkdir($userfilesDir); chmod($userfilesDir, 0777); } include_once OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'install.php'; include_once OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'activate.php'; if ($generateCache) { BOL_LanguageService::getInstance()->generateCacheForAllActiveLanguages(); } // trigger event $event = new OW_Event(OW_EventManager::ON_AFTER_PLUGIN_INSTALL, array('pluginKey' => $pluginDto->getKey())); OW::getEventManager()->trigger($event); return $pluginDto; }
public function update(array $params) { $this->checkXP(); $pluginDto = $this->getPluginDtoByKey($params); if (!empty($_GET['mode'])) { switch (trim($_GET['mode'])) { case 'plugin_up_to_date': OW::getFeedback()->warning(OW::getLanguage()->text('admin', 'manage_plugins_up_to_date_message')); break; case 'plugin_update_success': if ($pluginDto !== null) { $event = new OW_Event(OW_EventManager::ON_AFTER_PLUGIN_UPDATE, array('pluginKey' => $pluginDto->getKey())); OW::getEventManager()->trigger($event); } OW::getFeedback()->info(OW::getLanguage()->text('admin', 'manage_plugins_update_success_message')); break; default: OW::getFeedback()->error(OW::getLanguage()->text('admin', 'manage_plugins_update_process_error')); break; } $this->redirectToAction('index'); } $ftp = $this->getFtpConnection(); try { $archivePath = $this->pluginService->downloadItem($pluginDto->getKey(), $pluginDto->getDeveloperKey(), !empty($params['licenseKey']) ? $params['licenseKey'] : null); } catch (Exception $e) { OW::getFeedback()->error($e->getMessage()); $this->redirectToAction('index'); } if (!file_exists($archivePath)) { OW::getFeedback()->error(OW::getLanguage()->text('admin', 'plugin_update_download_error')); $this->redirectToAction('index'); } $zip = new ZipArchive(); $tempDir = OW_DIR_PLUGINFILES . 'ow' . DS . uniqid('plugin_update') . DS; if ($zip->open($archivePath) === true) { $zip->extractTo($tempDir); $zip->close(); } else { OW::getFeedback()->error(OW::getLanguage()->text('admin', 'plugin_update_download_error')); $this->redirectToAction('index'); } if (file_exists($tempDir . 'plugin.xml')) { $localDir = $tempDir; } else { $handle = opendir($tempDir); while (($item = readdir($handle)) !== false) { if ($item === '.' || $item === '..') { continue; } $innerDir = $item; } closedir($handle); if (!empty($innerDir) && file_exists($tempDir . $innerDir . DS . 'plugin.xml')) { $localDir = $tempDir . $innerDir; } else { OW::getFeedback()->error(OW::getLanguage()->text('admin', 'plugin_update_download_error')); $this->redirectToAction('index'); } } if (substr($name, -1) === DS) { $name = substr($name, 0, strlen($name) - 1); } $remoteDir = OW_DIR_PLUGIN . $pluginDto->getModule(); if (!file_exists($remoteDir)) { $ftp->mkDir($remoteDir); } $ftp->uploadDir($localDir, $remoteDir); UTIL_File::removeDir($localDir); // copy static dir $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS; if (!defined('OW_PLUGIN_XP') && file_exists($pluginStaticDir)) { $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS; if (!file_exists($staticDir)) { mkdir($staticDir); chmod($staticDir, 0777); } UTIL_File::copyDir($pluginStaticDir, $staticDir); } $this->redirect(OW::getRequest()->buildUrlQueryString(OW_URL_HOME . 'ow_updates/index.php', array('plugin' => $pluginDto->getKey(), 'back-uri' => urlencode(OW::getRequest()->getRequestUri())))); }
protected function updateCachedEntities($options) { $options = intval($options); if ($options === 1 || $options & 1 << 1) { OW_ViewRenderer::getInstance()->clearCompiledTpl(); } if ($options === 1 || $options & 1 << 2) { BOL_ThemeService::getInstance()->updateThemeList(); BOL_ThemeService::getInstance()->processAllThemes(); if (OW::getConfig()->configExists('base', 'cachedEntitiesPostfix')) { OW::getConfig()->saveConfig('base', 'cachedEntitiesPostfix', uniqid()); } $event = new OW_Event('base.update_cache_entities'); OW::getEventManager()->trigger($event); } if ($options === 1 || $options & 1 << 3) { BOL_LanguageService::getInstance()->generateCacheForAllActiveLanguages(); } if ($options === 1 || $options & 1 << 4) { OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL); } if (($options === 1 || $options & 1 << 5) && !defined('OW_PLUGIN_XP')) { $pluginService = BOL_PluginService::getInstance(); $activePlugins = $pluginService->findActivePlugins(); /* @var $pluginDto BOL_Plugin */ foreach ($activePlugins as $pluginDto) { $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS; if (file_exists($pluginStaticDir)) { $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS; if (!file_exists($staticDir)) { mkdir($staticDir); chmod($staticDir, 0777); } UTIL_File::copyDir($pluginStaticDir, $staticDir); } } } }
function skadate_after_route_handler() { OW_ViewRenderer::getInstance()->assignVar('adminDashboardIframeUrl', "//static.oxwall.org/spotlight/?platform=skadate&platform-version=" . OW::getConfig()->getValue('base', 'soft_version') . "&platform-build=" . OW::getConfig()->getValue('base', 'soft_build')); $config = OW::getConfig(); if (!$config->configExists('skadate', 'installInit')) { return; } $installDir = dirname(__FILE__) . DS . "files" . DS; $installPluginfiles = $installDir . 'ow_pluginfiles' . DS; $installUserfiles = $installDir . 'ow_userfiles' . DS; /* read all plugins from DB */ $plugins = BOL_PluginService::getInstance()->findActivePlugins(); $pluginList = array(); /* @var $value BOL_Plugin */ foreach ($plugins as $value) { $pluginList[$value->getKey()] = $value->isSystem ? new OW_SystemPlugin(array('dir_name' => $value->getModule(), 'key' => $value->getKey(), 'active' => $value->isActive(), 'dto' => $value)) : new OW_Plugin(array('dir_name' => $value->getModule(), 'key' => $value->getKey(), 'active' => $value->isActive(), 'dto' => $value)); } /* @var $plugin OW_Plugin */ foreach ($pluginList as $plugin) { if (!file_exists($plugin->getPluginFilesDir())) { mkdir($plugin->getPluginFilesDir()); } chmod($plugin->getPluginFilesDir(), 0777); if (file_exists($installPluginfiles . $plugin->getModuleName())) { UTIL_File::copyDir($installPluginfiles . $plugin->getModuleName(), $plugin->getPluginFilesDir()); } if (!file_exists($plugin->getUserFilesDir())) { mkdir($plugin->getUserFilesDir()); } chmod($plugin->getUserFilesDir(), 0777); if (file_exists($installUserfiles . $plugin->getModuleName())) { UTIL_File::copyDir($installUserfiles . $plugin->getModuleName(), $plugin->getUserFilesDir()); } } $config->deleteConfig('skadate', 'installInit'); }
/** * Updates/adds whole theme content, generating static files and inserting theme content in DB. * * @param int $id */ public function processTheme($id) { $theme = $this->getThemeById($id); if (empty($theme)) { throw new InvalidArgumentException("Can't process theme with id `" . $id . "`, not found!"); } $themeName = $theme->getKey(); if (!file_exists($this->getRootDir($themeName))) { throw new LogicException("Can't find theme dir for `" . $themeName . "`!"); } $themeStaticDir = $this->getStaticDir($themeName); $themeRootDir = $this->getRootDir($themeName); $mobileRootDir = $this->getRootDir($themeName, true); // deleting DB entries and files $this->unlinkTheme($theme->getId()); mkdir($themeStaticDir); // copy all static files UTIL_File::copyDir($themeRootDir, $this->getStaticDir($themeName), function ($itemPath) { if (substr($itemPath, 0, 1) == ".") { return false; } if (is_dir($itemPath)) { return true; } $fileExtension = strtolower(UTIL_File::getExtension(basename($itemPath))); if (in_array($fileExtension, array("psd", "html"))) { return false; } return true; }); $themeControls = array(); // copy main css file if (file_exists($themeRootDir . self::CSS_FILE_NAME)) { $controlsContent = file_get_contents($themeRootDir . self::CSS_FILE_NAME); $themeControls = $this->getThemeControls($controlsContent); $mobileControls = array(); if (file_exists($mobileRootDir . self::CSS_FILE_NAME)) { $controlsContent .= PHP_EOL . file_get_contents($mobileRootDir . self::CSS_FILE_NAME); $mobileControls = $this->getThemeControls(file_get_contents($mobileRootDir . self::CSS_FILE_NAME)); foreach ($mobileControls as $key => $val) { $mobileControls[$key]["mobile"] = true; } } $themeControls = array_merge($mobileControls, $themeControls); // adding theme controls in DB if (!empty($themeControls)) { foreach ($themeControls as $value) { $themeControl = new BOL_ThemeControl(); $themeControl->setAttribute($value["attrName"]); $themeControl->setKey($value["key"]); $themeControl->setSection($value["section"]); $themeControl->setSelector($value["selector"]); $themeControl->setThemeId($theme->getId()); $themeControl->setDefaultValue($value["defaultValue"]); $themeControl->setType($value["type"]); $themeControl->setLabel($value["label"]); if (isset($value["description"])) { $themeControl->setDescription(trim($value["description"])); } $themeControl->setMobile(!empty($value["mobile"])); $this->themeControlDao->save($themeControl); } } } // decorators if (file_exists($this->getDecoratorsDir($themeName))) { $files = UTIL_File::findFiles($this->getDecoratorsDir($themeName), array("html"), 0); foreach ($files as $value) { $decoratorEntry = new BOL_ThemeContent(); $decoratorEntry->setThemeId($theme->getId()); $decoratorEntry->setType(BOL_ThemeContentDao::VALUE_TYPE_ENUM_DECORATOR); $decoratorEntry->setValue(UTIL_File::stripExtension(basename($value))); $this->themeContentDao->save($decoratorEntry); } } // master pages if (file_exists($this->getMasterPagesDir($themeName))) { $files = UTIL_File::findFiles($this->getMasterPagesDir($themeName), array("html"), 0); foreach ($files as $value) { $masterPageEntry = new BOL_ThemeContent(); $masterPageEntry->setThemeId($theme->getId()); $masterPageEntry->setType(BOL_ThemeContentDao::VALUE_TYPE_ENUM_MASTER_PAGE); $masterPageEntry->setValue(UTIL_File::stripExtension(basename($value))); $this->themeContentDao->save($masterPageEntry); } } if (file_exists($this->getMasterPagesDir($themeName, true))) { $files = UTIL_File::findFiles($this->getMasterPagesDir($themeName, true), array("html"), 0); foreach ($files as $value) { $masterPageEntry = new BOL_ThemeContent(); $masterPageEntry->setThemeId($theme->getId()); $masterPageEntry->setType(BOL_ThemeContentDao::VALUE_TYPE_ENUM_MOBILE_MASTER_PAGE); $masterPageEntry->setValue(UTIL_File::stripExtension(basename($value))); $this->themeContentDao->save($masterPageEntry); } } // xml master page assignes $xml = simplexml_load_file($this->getRootDir($themeName) . self::THEME_XML); $masterPages = (array) $xml->masterPages; foreach ($masterPages as $key => $value) { $masterPageLinkEntry = new BOL_ThemeMasterPage(); $masterPageLinkEntry->setThemeId($theme->getId()); $masterPageLinkEntry->setDocumentKey(trim($key)); $masterPageLinkEntry->setMasterPage(trim($value)); $this->themeMasterPageDao->save($masterPageLinkEntry); } }
* licensed under The BSD license. * --- * Copyright (c) 2011, Oxwall Foundation * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ if (!defined('OW_PLUGIN_XP')) { $fbconnect = OW::getPluginManager()->getPlugin('fbconnect'); $staticDir = OW_DIR_STATIC_PLUGIN . $fbconnect->getModuleName() . DS; UTIL_File::removeDir($staticDir); UTIL_File::copyDir($fbconnect->getStaticDir(), $staticDir); } $updateDir = dirname(__FILE__) . DS; Updater::getLanguageService()->importPrefixFromZip($updateDir . 'langs.zip', 'fbconnect');
<?php /** * This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is a proprietary licensed product. * For more information see License.txt in the plugin folder. * --- * Copyright (c) 2012, Purusothaman Ramanujam * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are not permitted provided. * This plugin should be bought from the developer by paying money to PayPal account (purushoth.r@gmail.com). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ Updater::getLanguageService()->importPrefixFromZip(OW::getPluginManager()->getPlugin('ivideo')->getRootDir() . 'langs.zip', 'ivideo'); $ivideo = OW::getPluginManager()->getPlugin('ivideo'); $staticDir = OW_DIR_STATIC_PLUGIN . $ivideo->getModuleName() . DS; UTIL_File::removeDir($staticDir); UTIL_File::copyDir($ivideo->getStaticDir(), $staticDir); if (!OW::getConfig()->configExists('ivideo', 'ffmpegPath')) { OW::getConfig()->addConfig('ivideo', 'ffmpegPath', '', ''); } //Updater::getConfigService()->saveConfig('ivideo', 'allowedExtensions', 'mp4,flv,avi,wmv,swf,mov,mpg,3g2,ram'); OW::getDbo()->query("alter table " . OW_DB_PREFIX . "ivideo_videos add column privacy varchar(50) NOT NULL default 'everybody'");
/** * Creates platform reserved dirs for plugin, copies all plugin static data * * @param BOL_Plugin $pluginDto */ public function addPluginDirs(BOL_Plugin $pluginDto) { $plugin = new OW_Plugin($pluginDto); if (file_exists($plugin->getStaticDir())) { UTIL_File::copyDir($plugin->getStaticDir(), $plugin->getPublicStaticDir()); UTIL_File::chmodDir($plugin->getPublicStaticDir(), 0777, 0666); } // create dir in pluginfiles if (file_exists($plugin->getInnerPluginFilesDir())) { UTIL_File::copyDir($plugin->getInnerPluginFilesDir(), $plugin->getPluginFilesDir()); UTIL_File::chmodDir($plugin->getPluginFilesDir(), 0777, 0666); } else { if (!file_exists($plugin->getPluginFilesDir())) { mkdir($plugin->getPluginFilesDir()); chmod($plugin->getPluginFilesDir(), 0777); } } // create dir in userfiles if (file_exists($plugin->getInnerUserFilesDir())) { OW::getStorage()->copyDir($plugin->getInnerUserFilesDir(), $plugin->getUserFilesDir()); UTIL_File::chmodDir($plugin->getUserFilesDir(), 0777, 0666); } else { if (!file_exists($plugin->getUserFilesDir())) { OW::getStorage()->mkdir($plugin->getUserFilesDir()); } } }
public function import() { if (!is_dir(OW_DIR_PLUGIN . 'event')) { throw new Redirect404Exception(); return; } $importForm = new Form('importForm'); $language = OW::getLanguage(); $element = new Submit('importVideos'); $element->setValue($language->text('eventx', 'admin_import_events')); $importForm->addElement($element); if (OW::getRequest()->isPost()) { if ($importForm->isValid($_POST)) { $sql = "INSERT INTO " . OW_DB_PREFIX . "eventx_item (title,description,location,createTimeStamp,startTimeStamp,endTimeStamp,userId,whoCanView,whoCanInvite,maxInvites,status,image,endDateFlag,startTimeDisabled,endTimeDisabled,importId,importStatus) \n SELECT title,description,location,createTimeStamp,startTimeStamp,endTimeStamp,userId,whoCanView,whoCanInvite,0,'approved',image,endDateFlag,startTimeDisabled,endTimeDisabled,id,1 FROM " . OW_DB_PREFIX . "event_item c\n WHERE NOT EXISTS (SELECT 1 FROM " . OW_DB_PREFIX . "eventx_item WHERE importId = c.id)"; OW::getDbo()->query($sql); $sourcePath = OW_DIR_USERFILES . 'plugins' . DS . 'event' . DS; $destPath = OW::getPluginManager()->getPlugin('eventx')->getUserFilesDir(); UTIL_File::copyDir($sourcePath, $destPath); EVENTX_BOL_EventService::getInstance()->importAll(); OW::getFeedback()->info($language->text('eventx', 'admin_import_ok')); } } $this->addForm($importForm); }