function check_dbwarning($text = '') { $kunena_db =& JFactory::getDBO(); if ($kunena_db->_errorNum != 0) { trigger_dbwarning($text); } }
function getLatestVersion($versionTable) { $kunena_db =& JFactory::getDBO(); $query = "SELECT\n\t\t `version`,\n\t\t `versiondate`,\n\t\t `installdate`,\n\t\t `build`,\n\t\t `versionname`\n\t\t FROM `{$versionTable}`\n\t\t ORDER BY `id` DESC"; $kunena_db->setQuery($query, 0, 1); // LIMIT 1 $currentVersion = $kunena_db->loadObject() or trigger_dbwarning('Could not load latest Version record.'); return $currentVersion; }
} $kunena_db->setQuery("TRUNCATE #__fb_favorites"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_favorites` DROP INDEX `thread`"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_favorites` ADD UNIQUE `thread`(`thread`,`userid`)"); $kunena_db->query() or trigger_dberror("Unable to alter fb_favorites table, please contact Kunena team at www.kunena.com!"); if ($temporary) { $kunena_db->setQuery("INSERT INTO #__fb_favorites (thread,userid) SELECT thread, userid FROM #__fb_favorites_temp"); $kunena_db->query() or trigger_dbwarning("Unable to fix fb_favorites table. All Favorites will be removed."); $kunena_db->setQuery("DROP TABLE #__fb_favorites_temp"); $kunena_db->query() or trigger_dbwarning("Unable to remove temporary table (#__fb_favorites_temp)."); } $temporary = 1; $kunena_db->setQuery("CREATE TABLE #__fb_subscriptions_temp SELECT thread, userid, future1 FROM #__fb_subscriptions WHERE userid>0 GROUP BY thread, userid"); if ($kunena_db->query() == FALSE) { $temporary = 0; trigger_dbwarning("Unable to fix fb_subscriptions table. All Subscriptions will be removed."); } $kunena_db->setQuery("TRUNCATE #__fb_subscriptions"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` DROP INDEX `thread`"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` ADD UNIQUE `thread`(`thread`,`userid`)"); $kunena_db->query() or trigger_dberror("Unable to alter fb_subscriptions table, please contact Kunena team at www.kunena.com!"); if ($temporary) { $kunena_db->setQuery("INSERT INTO #__fb_subscriptions (thread,userid,future1) SELECT thread, userid, future1 FROM #__fb_subscriptions_temp"); $kunena_db->query() or trigger_dbwarning("Unable to fix fb_subscriptions table. All Subscriptions will be removed."); $kunena_db->setQuery("DROP TABLE #__fb_subscriptions_temp"); $kunena_db->query() or trigger_dbwarning("Unable to remove temporary table (#__fb_subscriptions_temp)."); }
* component: com_kunena **/ defined('_JEXEC') or die('Restricted access'); // Add custom upgrade code here // Most or all sql statements should be covered within comupgrade.xml $kunena_db =& JFactory::getDBO(); $root = strtr(JPATH_ROOT, "\\", "/"); // now lets do some checks and upgrades to 1.0.2 version of attachment table $kunena_db->setQuery("SELECT COUNT(*) FROM #__fb_attachments WHERE filelocation LIKE '%com_fireboard/uploaded%'", 0, 1); // if >0 then it means we are on fb version below 1.0.2 $is_101_version = $kunena_db->loadResult(); if ($is_101_version) { // now do the upgrade $kunena_db->setQuery("update #__fb_attachments set filelocation = replace(filelocation,'{$root}/components/com_fireboard/uploaded','/images/fbfiles');"); if ($kunena_db->query()) { print '<li class="fbscslist">Tabela de anexos atualizada com sucesso para o esquema da versão 1.0.2+!</li>'; } else { print '<li class="fbscslisterror">Tabela de anexos não foi atualizada com sucesso para o esquema da versão 1.0.2+!</li>'; trigger_dbwarning("Não foi possível atualizar tabela de anexos."); } $kunena_db->setQuery("update #__fb_messages_text set message = replace(message,'/components/com_fireboard/uploaded','/images/fbfiles');"); if ($kunena_db->query()) { print '<li class="fbscslist">Anexos na tabela de mensagens foram atualizados com êxito para o esquema da versão 1.0.2+!</li>'; } else { print '<li class="fbscslist">Anexos na tabela de mensagens não foram atualizados com êxito para o esquema da versão 1.0.2+!</li>'; trigger_dbwarning("Não foi possível atualizar anexos na tabela de mensagens."); } //backward compatibility . all the cats are by default moderated $kunena_db->setQuery("UPDATE `#__fb_categories` SET `moderated` = '1';"); $kunena_db->query() or trigger_dbwarning("Não foi possível atualizar categorias."); }
function com_install() { global $database, $mainframe, $mosConfig_absolute_path; // Determine MySQL version from phpinfo $database->setQuery("SELECT VERSION() as mysql_version"); $mysqlversion = $database->loadResult(); //before we do anything else we want to check for minimum system requirements if (version_compare(phpversion(), KUNENA_MIN_PHP, ">=") && version_compare($mysqlversion, KUNENA_MIN_MYSQL, ">=")) { // we're on 4.3.0 or later //change fb menu icon $database->setQuery("SELECT id FROM #__components WHERE admin_menu_link = 'option=com_kunena'"); $id = $database->loadResult(); //add new admin menu images if (defined('_JEXEC') && class_exists('JApplication')) { // J1.5 $database->setQuery("UPDATE #__components SET admin_menu_img = 'components/com_kunena/images/kunenafavicon.png'" . ", admin_menu_link = 'option=com_kunena' " . "WHERE id='" . $id . "'"); } else { // J1.0 $database->setQuery("UPDATE #__components SET admin_menu_img = '../administrator/components/com_kunena/images/kunenafavicon.png'" . ", admin_menu_link = 'option=com_kunena' " . "WHERE id='" . $id . "'"); } $database->query() or trigger_dbwarning("Não foi possível definir imagem do menu do admin."); //install & upgrade class $fbupgrade = new fx_Upgrade("com_kunena", "kunena.install.upgrade.xml", "fb_", "install", false); // Legacy enabler // Versions prior to 1.0.5 did not came with a version table inside the database // this would make the installer believe this is a fresh install. We need to perform // a 'manual' check if this is going to be an upgrade and if so create that table // and write a dummy version entry to force an upgrade. $database->setQuery("SHOW TABLES LIKE '%fb_messages'"); $database->query() or trigger_dbwarning("Não foi possível pesquisar por tabela de mensagens."); if ($database->getNumRows()) { // fb tables exist, now lets see if we have a version table $database->setQuery("SHOW TABLES LIKE '%fb_version'"); $database->query() or trigger_dbwarning("Não foi possível pesquisar por tabela de versão."); if (!$database->getNumRows()) { //version table does not exist - this is a pre 1.0.5 install - lets create $fbupgrade->createVersionTable(); // insert dummy version entry to force upgrade $fbupgrade->insertDummyVersion(); } } // Start Installation/Upgrade $fbupgrade->doUpgrade(); // THIS PROCEDURE IS UNTRANSLATED! ?> <style> .fbscs { margin: 0; padding: 0; list-style: none; } .fbscslist { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #66CC66; background: #D6FEB8; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } .fbscslisterror { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #FF9999; background: #FFCCCC; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } </style> <div style="border: 1px solid #ccc; background: #FBFBFB; padding: 10px; text-align: left; margin: 10px 0;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" valign="top" style="padding: 10px;"><a href="index2.php?option=com_kunena"><img src="components/com_kunena/images/kunena.logo.png" alt="Kunena" border="0"></a> <br /> <a href="http://www.joomlaclube.com.br/" target="_blank"><img src="components/com_kunena/images/jcb.logo.png" alt="Joomla Clube - brazil open source" /></a> </td> <td width="80%" valign="top" style="padding: 10px;"> <div style="clear: both; text-align: left; padding: 0 20px;"> <ul class="fbscs"> <?php // // We might want to make the file copy below part of the install as well // if (is_writable($mainframe->getCfg("absolute_path") . "/images")) { //ok now it is installed, just copy the fbfiles directory, and apply 0777 dircopy($mainframe->getCfg("absolute_path") . "/components/com_kunena/kunena.files.distribution", $mainframe->getCfg("absolute_path") . "/images/fbfiles", false); } else { ?> <li class="fbscslisterror"> <div style="border: 1px solid #FF6666; background: #FFCC99; padding: 10px; text-align: left; margin: 10px 0;"> <img src='images/publish_x.png' align='absmiddle'> Criação/configuração de permissão dos seguintes diretórios falhou: <br> <pre> <?php echo $mainframe->getCfg("absolute_path"); ?> /images/fbfiles/ <?php echo $mainframe->getCfg("absolute_path"); ?> /images/fbfiles/avatars <?php echo $mainframe->getCfg("absolute_path"); ?> /images/fbfiles/avatars/gallery (você tem que colocar avatares aqui dentro se quiser usá-los) <?php echo $mainframe->getCfg("absolute_path"); ?> /images/fbfiles/category_images <?php echo $mainframe->getCfg("absolute_path"); ?> /images/fbfiles/files <?php echo $mainframe->getCfg("absolute_path"); ?> /images/fbfiles/images </pre> a) Você pode copiar o conteúdo de '_kunena.files.distribution' em 'componentes/com_kunena' para a raiz do seu Joomla, sob a pasta 'images/'. <br /> b) Se você já tem o conteúdo lá, mas a instalação do Kunena não foi capaz de torná-los graváveis e, então por favor, faça-o manualmente.</div> </li> <?php } ?> </ul> </div> <div style="border: 1px solid #FFCC99; background: #FFFFCC; padding: 20px; margin: 20px; clear: both;"> <strong>I N S T A L A Ç Ã O : <font color="green">Sucesso</font> </strong> <br /> <br /> <strong>versão do php: <font color="green"><?php echo phpversion(); ?> Requerida >= <?php echo KUNENA_MIN_PHP; ?> </font> </strong> <br /> <strong>versão do mysql: <font color="green"><?php echo $mysqlversion; ?> Requerida >= <?php echo KUNENA_MIN_MYSQL; ?> </font> </strong> </div> <?php } else { // Minimum version requirements not satisfied ?> <style> .fbscs { margin: 0; padding: 0; list-style: none; } .fbscslist { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #66CC66; background: #D6FEB8; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } .fbscslisterror { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #FF9999; background: #FFCCCC; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } </style> <div style="border: 1px solid #ccc; background: #FBFBFB; padding: 10px; text-align: left; margin: 10px 0;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" valign="top" style="padding: 10px;"><a href="index2.php?option=com_kunena"><img src="components/com_kunena/images/kunena.logo.png" alt="Kunena" border="0"></a> <br /> <a href="http://www.joomlaclube.com.br/" target="_blank"><img src="components/com_kunena/images/jcb.logo.png" alt="Joomla Clube - brazil open source" /></a> </td> <td width="80%" valign="top" style="padding: 10px;"> <div style="border: 1px solid #FFCC99; background: #FFFFCC; padding: 20px; margin: 20px; clear: both;"> <strong>I N S T A L A Ç Ã O : <font color="red">F A L H O U - Requisitos Mínimos da Versão não satisfeitos</font> </strong> <br /> <br /> <strong>versão do php: <font color="red"><?php echo phpversion(); ?> Requerida >= <?php echo KUNENA_MIN_PHP; ?> </font> </strong> <br /> <strong>versão do mysql: <font color="red"><?php echo $mysqlversion; ?> Requerida >= <?php echo KUNENA_MIN_MYSQL; ?> </font> </strong> </div> <?php } // Rest of footer ?> <div style="border: 1px solid #99CCFF; background: #D9D9FF; padding: 20px; margin: 20px; clear: both;"> <strong>Obrigado por usar Kunena!</strong> <br /> Kunena Forum Component <em>para Joomla! </em> © by <a href="http://www.Kunena.com" target="_blank">www.Kunena.com</a>. Todos os direitos reservados.</div> <div style="border: 1px solid #ccc; background: #eee; padding: 20px; margin: 20px; clear: both;"> <a href="http://www.joomlaclube.com.br/" target="_blank"><span style="color:#00adbc;">joomla</span><span style="color:#636363">clube</span></a> <span style="color:#aaa">brazil open source</span> </div> </td> </tr> </table> </div> <?php }
* Kunena Install file * component: com_kunena **/ defined('_JEXEC') or die('Restricted access'); // // This is a place to add custom install code required // Most of the work should be done by the comupgrade class // and the install/upgrade xml file. This is truly for one // off special code that can't be put into the xml file directly. // $kunena_db =& JFactory::getDBO(); include_once KUNENA_PATH . DS . "class.kunena.php"; //DEFINE('_KUNENA_SAMPLE_FORUM_MENU_TITLE', 'Forum'); // Install sample data on initial install (this will not get executed for upgrades) $posttime = CKunenaTools::fbGetInternalTime(); $query = "INSERT INTO `#__fb_categories` VALUES (1, 0, '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 1, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_HEADER) . "', '', 0, 0, 0, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Não foi possível inserir categoria de início de exemplo'); $query = "INSERT INTO `#__fb_categories` VALUES (2, 1, '" . addslashes(_KUNENA_SAMPLE_FORUM1_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 1, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_FORUM1_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_FORUM1_HEADER) . "', '', 0, 0, 0, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Não foi possível inserir Fórum 1 de exemplo'); $query = "INSERT INTO `#__fb_categories` VALUES (3, 1, '" . addslashes(_KUNENA_SAMPLE_FORUM2_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 2, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_FORUM2_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_FORUM2_HEADER) . "', '', 0, 0, 0, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Não foi possível inserir Fórum 2 de exemplo'); $query = "INSERT INTO `#__fb_messages` VALUES (1, 0, 1, 2, 'Kunena', 62, '*****@*****.**', '" . addslashes(_KUNENA_SAMPLE_POST1_SUBJECT) . "', {$posttime}, '127.0.0.1', 0, 0, 0, 0, 0, 0, NULL, NULL, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Não foi possível inserir mensagem de exemplo'); $query = "INSERT INTO `#__fb_messages_text` VALUES (1, '" . addslashes(_KUNENA_SAMPLE_POST1_TEXT) . "');"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('ão foi possível inserir texto da mensagem de exemplo'); CKunenaTools::reCountBoards();
* Kunena Upgrade file for 1.0.5 * component: com_kunena **/ defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); global $mainframe; // Add custom upgrade code here // Most or all sql statements should be covered within comupgrade.xml // now lets do some checks and upgrades to 1.0.2 version of attachment table $database->setQuery("select from #__fb_attachments where filelocation like '%" . $mainframe->getCfg("absolute_path") . "%'"); // if >0 then it means we are on fb version below 1.0.2 $is_101_version = $database->loadResult(); if ($is_101_version) { // now do the upgrade $database->setQuery("update #__fb_attachments set filelocation = replace(filelocation,'" . $mainframe->getCfg("absolute_path") . "/components/com_fireboard/uploaded','/images/fbfiles');"); if ($database->query()) { print '<li class="fbscslist">Tabela de anexos atualizada com sucesso para o esquema da versão 1.0.2+!</li>'; } else { print '<li class="fbscslisterror">Tabela de anexos não foi atualizada com sucesso para o esquema da versão 1.0.2+!</li>'; trigger_dbwarning("Não foi possível atualizar tabela de anexos."); } $database->setQuery("update #__fb_messages_text set message = replace(message,'/components/com_fireboard/uploaded','/images/fbfiles');"); if ($database->query()) { print '<li class="fbscslist">Anexos na tabela de mensagens foram atualizados com êxito para o esquema da versão 1.0.2+!</li>'; } else { print '<li class="fbscslist">Anexos na tabela de mensagens não foram atualizados com êxito para o esquema da versão 1.0.2+!</li>'; trigger_dbwarning("Não foi possível atualizar anexos na tabela de mensagens."); } //backward compatibility . all the cats are by default moderated $database->setQuery("UPDATE `#__fb_categories` SET `moderated` = '1';"); $database->query() or trigger_dbwarning("Não foi possível atualizar categorias."); }
**/ defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); // // This is a place to add custom install code required // Most of the work should be done by the comupgrade class // and the install/upgrade xml file. This is truly for one // off special code that can't be put into the xml file directly. // global $mainframe, $database; // Kill notices (we have many..) error_reporting(E_ALL ^ E_NOTICE); include_once $mainframe->getCfg("absolute_path") . "/components/com_kunena/class.kunena.php"; //DEFINE('_KUNENA_SAMPLE_FORUM_MENU_TITLE', 'Forum'); // Install sample data on initial install (this will not get executed for upgrades) $posttime = CKunenaTools::fbGetInternalTime(); $query = "INSERT INTO `#__fb_categories` VALUES (1, 0, '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 1, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_HEADER) . "', '', 0, 0, 0, NULL);"; $database->setQuery($query); $database->query() or trigger_dbwarning('Não foi possível inserir categoria de início de exemplo'); $query = "INSERT INTO `#__fb_categories` VALUES (2, 1, '" . addslashes(_KUNENA_SAMPLE_FORUM1_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 1, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_FORUM1_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_FORUM1_HEADER) . "', '', 0, 0, 0, NULL);"; $database->setQuery($query); $database->query() or trigger_dbwarning('Não foi possível inserir Fórum 1 de exemplo'); $query = "INSERT INTO `#__fb_categories` VALUES (3, 1, '" . addslashes(_KUNENA_SAMPLE_FORUM2_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 2, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_FORUM2_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_FORUM2_HEADER) . "', '', 0, 0, 0, NULL);"; $database->setQuery($query); $database->query() or trigger_dbwarning('Não foi possível inserir Fórum 2 de exemplo'); $query = "INSERT INTO `#__fb_messages` VALUES (1, 0, 1, 2, 'Kunena', 62, '*****@*****.**', '" . addslashes(_KUNENA_SAMPLE_POST1_SUBJECT) . "', {$posttime}, '127.0.0.1', 0, 0, 0, 0, 0, 0, NULL, NULL, NULL);"; $database->setQuery($query); $database->query() or trigger_dbwarning('Não foi possível inserir mensagem de exemplo'); $query = "INSERT INTO `#__fb_messages_text` VALUES (1, '" . addslashes(_KUNENA_SAMPLE_POST1_TEXT) . "');"; $database->setQuery($query); $database->query() or trigger_dbwarning('Não foi possível inserir texto da mensagem de exemplo'); CKunenaTools::reCountBoards();
* component: com_kunena **/ defined('_JEXEC') or die('Restricted access'); // Add custom upgrade code here // Most or all sql statements should be covered within comupgrade.xml $kunena_db =& JFactory::getDBO(); $root = strtr(JPATH_ROOT, "\\", "/"); // now lets do some checks and upgrades to 1.0.2 version of attachment table $kunena_db->setQuery("SELECT COUNT(*) FROM #__fb_attachments WHERE filelocation LIKE '%com_fireboard/uploaded%'", 0, 1); // if >0 then it means we are on fb version below 1.0.2 $is_101_version = $kunena_db->loadResult(); if ($is_101_version) { // now do the upgrade $kunena_db->setQuery("update #__fb_attachments set filelocation = replace(filelocation,'{$root}/components/com_fireboard/uploaded','/images/fbfiles');"); if ($kunena_db->query()) { print '<li class="fbscslist">Attachment table successfully upgraded to 1.0.2+ version schema!</li>'; } else { print '<li class="fbscslisterror">Attachment table was not successfully upgraded to 1.0.2+ version schema!</li>'; trigger_dbwarning("Unable to upgrade attachement table."); } $kunena_db->setQuery("update #__fb_messages_text set message = replace(message,'/components/com_fireboard/uploaded','/images/fbfiles');"); if ($kunena_db->query()) { print '<li class="fbscslist">Attachments in messages table successfully upgraded to 1.0.2+ version schema!</li>'; } else { print '<li class="fbscslist">Attachments in messages table were not successfully upgraded to 1.0.2+ version schema!</li>'; trigger_dbwarning("Unable to upgrade attachements in messages table."); } //backward compatibility . all the cats are by default moderated $kunena_db->setQuery("UPDATE `#__fb_categories` SET `moderated` = '1';"); $kunena_db->query() or trigger_dbwarning("Unable to update categories."); }
function com_install() { $kunena_db = JFactory::getDBO(); // Determine MySQL version from phpinfo $kunena_db->setQuery("SELECT VERSION() as mysql_version"); $mysqlversion = $kunena_db->loadResult(); //before we do anything else we want to check for minimum system requirements if (version_compare(phpversion(), KUNENA_MIN_PHP, ">=") && version_compare($mysqlversion, KUNENA_MIN_MYSQL, ">")) { //change fb menu icon $kunena_db->setQuery("SELECT id FROM #__components WHERE admin_menu_link = 'option=com_kunena'"); $id = $kunena_db->loadResult(); //add new admin menu images $kunena_db->setQuery("UPDATE #__components SET admin_menu_img = 'components/com_kunena/images/kunenafavicon.png'" . ", admin_menu_link = 'option=com_kunena' " . "WHERE id='" . $id . "'"); $kunena_db->query() or trigger_dbwarning("Unable to set admin menu image."); //install & upgrade class $fbupgrade = new fx_Upgrade("com_kunena", "kunena.install.upgrade.xml", "fb_", "install", false); // Legacy enabler // Versions prior to 1.0.5 did not came with a version table inside the database // this would make the installer believe this is a fresh install. We need to perform // a 'manual' check if this is going to be an upgrade and if so create that table // and write a dummy version entry to force an upgrade. $kunena_db->setQuery("SHOW TABLES LIKE '%fb_messages'"); $kunena_db->query() or trigger_dbwarning("Unable to search for messages table."); if ($kunena_db->getNumRows()) { // fb tables exist, now lets see if we have a version table $kunena_db->setQuery("SHOW TABLES LIKE '%fb_version'"); $kunena_db->query() or trigger_dbwarning("Unable to search for version table."); if (!$kunena_db->getNumRows()) { //version table does not exist - this is a pre 1.0.5 install - lets create $fbupgrade->createVersionTable(); // insert dummy version entry to force upgrade $fbupgrade->insertDummyVersion(); } } // Start Installation/Upgrade $fbupgrade->doUpgrade(); // THIS PROCEDURE IS UNTRANSLATED! ?> <style> .fbscs { margin: 0; padding: 0; list-style: none; } .fbscslist { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #66CC66; background: #D6FEB8; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } .fbscslisterror { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #FF9999; background: #FFCCCC; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } </style> <div style="border: 1px solid #ccc; background: #FBFBFB; padding: 10px; text-align: left; margin: 10px 0;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" valign="top" style="padding: 10px;"><a href="index2.php?option=com_kunena"><img src="components/com_kunena/images/kunena.logo.png" alt="Kunena" border="0"></a></td> <td width="80%" valign="top" style="padding: 10px;"> <div style="clear: both; text-align: left; padding: 0 20px;"> <ul class="fbscs"> <?php // // We might want to make the file copy below part of the install as well // jimport('joomla.filesystem.folder'); $ret = JFolder::copy(JPATH_ROOT . DS . "components" . DS . "com_kunena" . DS . "kunena.files.distribution", JPATH_ROOT . DS . "images" . DS . "fbfiles", '', true); if ($ret !== true) { ?> <li class="fbscslisterror"> <div style="border: 1px solid #FF6666; background: #FFCC99; padding: 10px; text-align: left; margin: 10px 0;"> <img src='images/publish_x.png' align='absmiddle' /> Creation/permission setting of the following directories failed: <br /> <pre> <?php echo JPATH_ROOT; ?> /images/fbfiles/ <?php echo JPATH_ROOT; ?> /images/fbfiles/avatars <?php echo JPATH_ROOT; ?> /images/fbfiles/avatars/gallery (you have to put avatars inside if you want to use it) <?php echo JPATH_ROOT; ?> /images/fbfiles/category_images <?php echo JPATH_ROOT; ?> /images/fbfiles/files <?php echo JPATH_ROOT; ?> /images/fbfiles/images </pre> a) You can copy the contents of _kunena.files.distribution under components/com_kunena to your Joomla root, under images/ folder. <br /> b) If you already have the contents there, but Kunena installation was not able to make them writable, then please do it manually.</div> </li> <?php } ?> </ul> </div> <div style="border: 1px solid #FFCC99; background: #FFFFCC; padding: 20px; margin: 20px; clear: both;"> <strong>I N S T A L L : <font color="green">Successful</font> </strong> <br /> <br /> <strong>php version: <font color="green"><?php echo phpversion(); ?> </font> (Required >= <?php echo KUNENA_MIN_PHP; ?> )</strong> <br /> <strong>mysql version: <font color="green"><?php echo $mysqlversion; ?> </font> (Required > <?php echo KUNENA_MIN_MYSQL; ?> )</strong> </div> <?php } else { // Minimum version requirements not satisfied ?> <style> .fbscs { margin: 0; padding: 0; list-style: none; } .fbscslist { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #66CC66; background: #D6FEB8; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } .fbscslisterror { list-style: none; padding: 5px 10px; margin: 3px 0; border: 1px solid #FF9999; background: #FFCCCC; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; } </style> <div style="border: 1px solid #ccc; background: #FBFBFB; padding: 10px; text-align: left; margin: 10px 0;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" valign="top" style="padding: 10px;"><a href="index2.php?option=com_kunena"><img src="components/com_kunena/images/kunena.logo.png" alt="Kunena" border="0"></a></td> <td width="80%" valign="top" style="padding: 10px;"> <div style="border: 1px solid #FFCC99; background: #FFFFCC; padding: 20px; margin: 20px; clear: both;"> <strong>I N S T A L L : <font color="red">F A I L E D - Minimum Version Requirements not satisfied</font> </strong> <br /> <br /> <strong>php version: <font color="<?php echo version_compare(phpversion(), KUNENA_MIN_PHP, '>=') ? 'green' : 'red'; ?> "><?php echo phpversion(); ?> </font> (Required >= <?php echo KUNENA_MIN_PHP; ?> )</strong> <br /> <strong>mysql version: <font color="<?php echo version_compare($mysqlversion, KUNENA_MIN_MYSQL, '>') ? 'green' : 'red'; ?> "><?php echo $mysqlversion; ?> </font> (Required > <?php echo KUNENA_MIN_MYSQL; ?> )</strong> </div> <?php } // Rest of footer ?> <div style="border: 1px solid #99CCFF; background: #D9D9FF; padding: 20px; margin: 20px; clear: both;"> <strong>Thank you for using Kunena!</strong> <br /> Kunena Forum Component <em>for Joomla! </em> © by <a href="http://www.Kunena.com" target="_blank">www.Kunena.com</a>. All rights reserved.</div> </td> </tr> </table> </div> <?php }
* Kunena Install file * component: com_kunena **/ defined('_JEXEC') or die('Restricted access'); // // This is a place to add custom install code required // Most of the work should be done by the comupgrade class // and the install/upgrade xml file. This is truly for one // off special code that can't be put into the xml file directly. // $kunena_db =& JFactory::getDBO(); include_once KUNENA_PATH . DS . "class.kunena.php"; //DEFINE('_KUNENA_SAMPLE_FORUM_MENU_TITLE', 'Forum'); // Install sample data on initial install (this will not get executed for upgrades) $posttime = CKunenaTools::fbGetInternalTime(); $query = "INSERT INTO `#__fb_categories` VALUES (1, 0, '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 1, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_MAIN_CATEGORY_HEADER) . "', '', 0, 0, 0, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Unable to insert sample top category'); $query = "INSERT INTO `#__fb_categories` VALUES (2, 1, '" . addslashes(_KUNENA_SAMPLE_FORUM1_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 1, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_FORUM1_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_FORUM1_HEADER) . "', '', 0, 0, 0, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Unable to insert sample Forum 1'); $query = "INSERT INTO `#__fb_categories` VALUES (3, 1, '" . addslashes(_KUNENA_SAMPLE_FORUM2_TITLE) . "', 0, 0, 0, 1, NULL, 0, 0, 0, 0, 2, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, '" . addslashes(_KUNENA_SAMPLE_FORUM2_DESC) . "', '" . addslashes(_KUNENA_SAMPLE_FORUM2_HEADER) . "', '', 0, 0, 0, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Unable to insert sample Forum 2'); $query = "INSERT INTO `#__fb_messages` VALUES (1, 0, 1, 2, 'Kunena', 62, '*****@*****.**', '" . addslashes(_KUNENA_SAMPLE_POST1_SUBJECT) . "', {$posttime}, '127.0.0.1', 0, 0, 0, 0, 0, 0, NULL, NULL, NULL);"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Unable to insert sample post'); $query = "INSERT INTO `#__fb_messages_text` VALUES (1, '" . addslashes(_KUNENA_SAMPLE_POST1_TEXT) . "');"; $kunena_db->setQuery($query); $kunena_db->query() or trigger_dbwarning('Unable to insert sample post text'); CKunenaTools::reCountBoards();
} $kunena_db->setQuery("TRUNCATE #__fb_favorites"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_favorites` DROP INDEX `thread`"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_favorites` ADD UNIQUE `thread`(`thread`,`userid`)"); $kunena_db->query() or trigger_dberror("Não é possível alterar a tabela fb_favorites, por favor entre em contato com a equipe do Kunena em www.kunena.com!"); if ($temporary) { $kunena_db->setQuery("INSERT INTO #__fb_favorites (thread,userid) SELECT thread, userid FROM #__fb_favorites_temp"); $kunena_db->query() or trigger_dbwarning("Não é possível fixar a tabela fb_favorites. Todos os favoritos serão removidos."); $kunena_db->setQuery("DROP TABLE #__fb_favorites_temp"); $kunena_db->query() or trigger_dbwarning("Não foi possível remover a tabela temporária (#__fb_favorites_temp)."); } $temporary = 1; $kunena_db->setQuery("CREATE TABLE #__fb_subscriptions_temp SELECT thread, userid, future1 FROM #__fb_subscriptions WHERE userid>0 GROUP BY thread, userid"); if ($kunena_db->query() == FALSE) { $temporary = 0; trigger_dbwarning("Não é possível fixar a tabela fb_subscriptions. Todas as inscrições serão removidas."); } $kunena_db->setQuery("TRUNCATE #__fb_subscriptions"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` DROP INDEX `thread`"); $kunena_db->query(); $kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` ADD UNIQUE `thread`(`thread`,`userid`)"); $kunena_db->query() or trigger_dberror("Não é possível alterar a tabela fb_subscriptions, por favor entre em contato com a equipe do Kunena em www.kunena.com!"); if ($temporary) { $kunena_db->setQuery("INSERT INTO #__fb_subscriptions (thread,userid,future1) SELECT thread, userid, future1 FROM #__fb_subscriptions_temp"); $kunena_db->query() or trigger_dbwarning("Não é possível fixar a tabela fb_subscriptions. Todas as inscrições serão removidas."); $kunena_db->setQuery("DROP TABLE #__fb_subscriptions_temp"); $kunena_db->query() or trigger_dbwarning("Não foi possível remover a tabela temporária (#__fb_subscriptions_temp)."); }
$temporary = 0; trigger_dbwarning("Não é possível fixar a tabela fb_favorites. Todos os favoritos serão removidos."); } $database->setQuery("TRUNCATE #__fb_favorites"); $database->query(); $database->setQuery("ALTER TABLE `#__fb_favorites` DROP INDEX `thread`, ADD UNIQUE `thread`(`thread`,`userid`)"); $database->query() or trigger_dberror("Não é possível alterar a tabela fb_favorites, por favor entre em contato com a equipe do Kunena em www.kunena.com!"); if ($temporary) { $database->setQuery("INSERT INTO #__fb_favorites (thread,userid) SELECT thread, userid FROM #__fb_temp"); $database->query() or trigger_dbwarning("Não é possível fixar a tabela fb_favorites. Todos os favoritos serão removidos."); $database->setQuery("DROP TEMPORARY TABLE #__fb_temp"); $database->query(); // Temporary table will go away, no check needed. } $temporary = 1; $database->setQuery("CREATE TEMPORARY TABLE #__fb_temp SELECT thread, userid, future1 FROM #__fb_subscriptions WHERE userid>0 GROUP BY thread, userid"); if ($database->query() == FALSE) { $temporary = 0; trigger_dbwarning("Não é possível fixar a tabela fb_subscriptions. Todas as inscrições serão removidas."); } $database->setQuery("TRUNCATE #__fb_subscriptions"); $database->query(); $database->setQuery("ALTER TABLE `#__fb_subscriptions` DROP INDEX `thread`, ADD UNIQUE `thread`(`thread`,`userid`)"); $database->query() or trigger_dberror("Não é possível alterar a tabela fb_subscriptions, por favor entre em contato com a equipe do Kunena em www.kunena.com!"); if ($temporary) { $database->setQuery("INSERT INTO #__fb_subscriptions (thread,userid,future1) SELECT thread, userid, future1 FROM #__fb_temp"); $database->query() or trigger_dbwarning("Não é possível fixar a tabela fb_subscriptions. Todas as inscrições serão removidas."); $database->setQuery("DROP TEMPORARY TABLE #__fb_temp"); $database->query(); // Temporary table will go away, no check needed. }