📄 install.easygallery.php
字号:
<?php/*** @package EasyGallery* @copyright (C) 2006 Joomla-addons.org* @author Adam van Dongen* @version $Id: install.easygallery.php 10 2007-06-22 13:48:41Z websmurf $* * --------------------------------------------------------------------------------* All rights reserved. Easy Gallery Component for Joomla!** This program is free software; you can redistribute it and/or* modify it under the terms of the Joomla-addons Free Software License * See LICENSE.php for more information.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * --------------------------------------------------------------------------------**/defined( '_VALID_MOS' ) or die( 'Restricted access' );function com_install(){ global $mainframe, $database; if(!file_exists($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/')){ mkdir($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/'); mosChmod($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/', 0777); } if(!file_exists($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/thumbs/')){ mkdir($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/thumbs/'); mosChmod($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/thumbs/', 0777); } if(!file_exists($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/resized/')){ mkdir($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/resized/'); mosChmod($mainframe->getCfg('absolute_path') . '/images/stories/easygallery/resized/', 0777); } //Updates menu option $query = "UPDATE #__components SET admin_menu_img='../administrator/components/com_easygallery/icons/16x16_kview.png' WHERE admin_menu_link='option=com_easygallery'"; $database->setQuery($query); if(!$database->query()){ echo $database->getErrorMsg() . '<br />'; } //Updates menu option $query = "UPDATE #__components SET admin_menu_img='../administrator/components/com_easygallery/icons/16x16_configure.png' WHERE admin_menu_link='option=com_easygallery&act=configuration'"; $database->setQuery($query); if(!$database->query()){ echo $database->getErrorMsg() . '<br />'; } //Updates menu option $query = "UPDATE #__components SET admin_menu_img='../administrator/components/com_easygallery/icons/16x16_image.png' WHERE admin_menu_link='option=com_easygallery&act=photos'"; $database->setQuery($query); if(!$database->query()){ echo $database->getErrorMsg() . '<br />'; } //Updates menu option $query = "UPDATE #__components SET admin_menu_img='js/ThemeOffice/categories.png' WHERE admin_menu_link='option=com_easygallery&act=categories'"; $database->setQuery($query); if(!$database->query()){ echo $database->getErrorMsg() . '<br />'; } $tablefields = $database->getTableFields(array('#__easygallery')); $fields = array_keys($tablefields['#__easygallery']); echo '<table border="0" width="400">'; if(!in_array("default", $fields)){ $query = "ALTER TABLE #__easygallery ADD `default` tinyint(1) NOT NULL default '0' AFTER `path`"; $database->setQuery($query); if(!$database->query()){ echo '<tr><td><font color="red"><strong>ERROR</strong></font></td><td>' . $database->getErrorMsg() . '</td></tr>'; } else { echo '<tr><td><font color="green"><strong>SUCCESS</strong></font></td><td>Created field \'default\'</td></tr>'; } $query = "ALTER TABLE #__easygallery ADD INDEX ( `default` )"; $database->setQuery($query); if(!$database->query()){ echo '<tr><td><font color="red"><strong>ERROR</strong></font></td><td>' . $database->getErrorMsg() . '</td></tr>'; } else { echo '<tr><td><font color="green"><strong>SUCCESS</strong></font></td><td>Created index \'default\'</td></tr>'; } } echo '</table>'; if(!is_writable($mainframe->getCfg('absolute_path') . '/mambots/search')){ echo $mainframe->getCfg('absolute_path') . '/mambots/search is not writable, please correct this error and re-install Easy Gallery'; } //copy mambot in Joomla 1.0 if(!copy($mainframe->getCfg('absolute_path') . '/administrator/components/com_easygallery/mambots/search.easygallery.xm', $mainframe->getCfg('absolute_path') . '/mambots/search/search.easygallery.xml')){ echo '<b>Failed</b> to copy mambot xml file<br />'; } if(!copy($mainframe->getCfg('absolute_path') . '/administrator/components/com_easygallery/mambots/search.easygallery.php', $mainframe->getCfg('absolute_path') . '/mambots/search/search.easygallery.php')){ echo '<b>Failed</b> to copy mambot php file<br />'; } $mambot = new mosMambot($database); $mambot->name = 'Easy Gallery Search'; $mambot->element = 'search.easygallery'; $mambot->folder = 'search'; $mambot->ordering = 1; $mambot->published = 1; if (!$mambot->store()) { echo 'Search plugin install failed: ' .$mambot->getError().'<br />'; } //update menu items $query = "SELECT id FROM #__components WHERE link = 'option=com_easygallery'"; $database->setQuery($query); $id = $database->loadResult(); echo $database->getErrorMsg(); $query = "UPDATE #__menu SET componentid = $id WHERE type = 'components' AND link='index.php?option=com_easygallery'"; $database->setQuery($query); if(!$database->query()){ $database->getErrorMsg(); }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -