Installation Process:
"; $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/content.png' WHERE admin_menu_link='option=com_comprofiler&task=showLists'"); $iconresult[0] = $database->query(); $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/content.png' WHERE admin_menu_link='option=com_comprofiler&task=showField'"); $iconresult[1] = $database->query(); $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/content.png' WHERE admin_menu_link='option=com_comprofiler&task=showTab'"); $iconresult[2] = $database->query(); $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/config.png' WHERE admin_menu_link='option=com_comprofiler&task=showconfig'"); $iconresult[3] = $database->query(); $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/users.png' WHERE admin_menu_link='option=com_comprofiler&task=showusers'"); $iconresult[4] = $database->query(); foreach ($iconresult as $i=>$icresult) { if ($icresult) { echo "FINISHED: Image of menu entry $i has been corrected.
"; } else { echo "ERROR: Image of menu entry $i could not be corrected.
"; } } $database->setQuery("SELECT COUNT(*) FROM #__components WHERE link = 'option=com_comprofiler'"); $components = $database->loadresult(); IF($components > 1) { $database->setQuery("SELECT id FROM #__components WHERE link = 'option=com_comprofiler' ORDER BY id DESC LIMIT 1"); $comid = $database->loadresult(); $database->setQuery("DELETE FROM #__components WHERE link = 'option=com_comprofiler' AND id != $comid "); $database->query(); //print $database->getquery(); $database->setQuery("DELETE FROM #__components WHERE #__components.option = 'com_comprofiler' AND parent != $comid AND id != $comid "); $database->query(); //print $database->getquery(); echo "FINISHED: Administrator Menu Corrected.
"; } //Manage Database Upgrades $MCBUpgrades = array(); //Beta 3 Upgrade $MCBUpgrades[0]['test'] = "SELECT `default` FROM #__comprofiler_lists"; $MCBUpgrades[0]['updates'][0] = "ALTER TABLE `#__comprofiler_lists`" ."\n ADD `default` TINYINT( 1 ) DEFAULT '0' NOT NULL," ."\n ADD `usergroupids` VARCHAR( 255 )," ."\n ADD `sortfields` VARCHAR( 255 )," ."\n ADD `ordering` INT( 11 ) DEFAULT '0' NOT NULL AFTER `published`"; $MCBUpgrades[0]['updates'][1] = "UPDATE #__comprofiler_lists SET `default`=1 WHERE published =1"; $MCBUpgrades[0]['updates'][2] = "UPDATE #__comprofiler_lists SET usergroupids = '29, 18, 19, 20, 21, 30, 23, 24, 25', sortfields = '`username` ASC'"; $MCBUpgrades[0]['updates'][3] = "ALTER TABLE `#__comprofiler` ADD `acceptedterms` TINYINT( 1 ) DEFAULT '0' NOT NULL AFTER `bannedreason`"; $MCBUpgrades[0]['message'] = "1.0 Beta 2 to 1.0 Beta 3"; //Beta 4 Upgrade $MCBUpgrades[1]['test'] = "SELECT `firstname` FROM #__comprofiler"; $MCBUpgrades[1]['updates'][0] = "ALTER TABLE #__comprofiler ADD `firstname` VARCHAR( 100 ) AFTER `user_id` ," ."\n ADD `middlename` VARCHAR( 100 ) AFTER `firstname` ," ."\n ADD `lastname` VARCHAR( 100 ) AFTER `middlename` "; $MCBUpgrades[1]['updates'][1] = "ALTER TABLE `#__comprofiler_fields` ADD `readonly` TINYINT( 1 ) DEFAULT '0' NOT NULL AFTER `profile`"; $MCBUpgrades[1]['updates'][3] = "ALTER TABLE `#__comprofiler_tabs` ADD `width` VARCHAR( 10 ) DEFAULT '.5' NOT NULL AFTER `ordering` ," ."\n ADD `enabled` TINYINT( 1 ) DEFAULT '1' NOT NULL AFTER `width` ," ."\n ADD `plugin` VARCHAR( 255 ) DEFAULT NULL AFTER `enabled`" ; $MCBUpgrades[1]['message'] = "1.0 Beta 3 to 1.0 Beta 4"; //Apply Upgrades foreach ($MCBUpgrades AS $MCBUpgrade) { $database->setQuery($MCBUpgrade['test']); //if it fails test then apply upgrade if (!$database->query()) { foreach($MCBUpgrade['updates'] as $MCBScript) { $database->setQuery($MCBScript); if(!$database->query()) { //Upgrade failed print("".$MCBUpgrade['message']." failed! SQL error:" . $database->stderr(true)."
"); return; } } //Upgrade was successful print "".$MCBUpgrade['message']." Upgrade Applied Successfully!"; } } $sql="SELECT listid FROM #__comprofiler_lists ORDER BY published desc"; $database->setQuery($sql); $lists = $database->loadObjectList(); $order=0; foreach($lists AS $list) { $database->setQuery("UPDATE #__comprofiler_lists SET ordering = $order WHERE listid='".$list->listid."'"); $database->query(); $order++; } ?>
".$mosConfig_absolute_path . "/images/comprofiler/ Successfully added!
"; } else { print "".$mosConfig_absolute_path . "/images/comprofiler/ Failed to be to be created, please do so manually!
"; } } else { print "".$mosConfig_absolute_path . "/images/comprofiler/ already exists!
"; } if(!file_exists($mosConfig_absolute_path . "/images/comprofiler/gallery/")){ if(mkdir($mosConfig_absolute_path . "/images/comprofiler/gallery/")) { print "".$mosConfig_absolute_path . "/images/comprofiler/gallery/ Successfully added!
"; } else { print "".$mosConfig_absolute_path . "/images/comprofiler/gallery/ Failed to be to be created, please do so manually!
"; } } else { print "".$mosConfig_absolute_path . "/images/comprofiler/gallery/ already exists!
"; } if(!is_writable($mosConfig_absolute_path . "/images/comprofiler/")){ if(!chmod($mosConfig_absolute_path . "/images/comprofiler/", 0777)) { print "".$mosConfig_absolute_path . "/images/comprofiler/ Failed to be chmod'd to 777 please do so manually!
"; } } if(!is_writable($mosConfig_absolute_path . "/images/comprofiler/gallery/")){ if(!chmod($mosConfig_absolute_path . "/images/comprofiler/gallery/", 0777)) { print "".$mosConfig_absolute_path . "/images/comprofiler/gallery/ Failed to be chmod'd to 777 please do so manually!
"; } } foreach($galleryFiles AS $galleryFile) { IF(copy($mosConfig_absolute_path . "/components/com_comprofiler/images/gallery/".$galleryFile,$mosConfig_absolute_path . "/images/comprofiler/gallery/".$galleryFile)) { print "".$galleryFile." Successfully added to the gallery!
"; } ELSE { print "".$galleryFile." Failed to be added to the gallery please do so manually!
"; } } } else { print "".$mosConfig_absolute_path . "/images/ is not writable!
Manually do the following:
1.) create ".$mosConfig_absolute_path . "/images/comprofiler/ directory
2.) chmod it to 777
3.) create ".$mosConfig_absolute_path . "/images/comprofiler/gallery/
4.) chmod it to 777
5.) copy ".$mosConfig_absolute_path . "/components/com_comprofiler/images/gallery/ and its contents to ".$mosConfig_absolute_path . "/images/gallery/

"; } ?> Installation finished.