Revision 1297
Added by Dietmar almost 15 years ago
functions.php | ||
---|---|---|
816 | 816 |
$sql .= '`function` = "'.$module_function.'", '; |
817 | 817 |
$sql .= '`version` = "'.$module_version.'", '; |
818 | 818 |
$sql .= '`platform` = "'.$module_platform.'", '; |
819 |
$sql .= '`author` = "'.$module_author.'", ';
|
|
820 |
$sql .= '`license` = "'.$module_license.'"';
|
|
819 |
$sql .= '`author` = "'.addslashes($module_author).'", ';
|
|
820 |
$sql .= '`license` = "'.addslashes($module_license).'"';
|
|
821 | 821 |
$database->query($sql); |
822 | 822 |
// Run installation script |
823 | 823 |
if($install == true) |
... | ... | |
835 | 835 |
// Load template into DB |
836 | 836 |
function load_template($directory) |
837 | 837 |
{ |
838 |
global $database; |
|
838 |
global $database, $admin;
|
|
839 | 839 |
if(is_dir($directory) AND file_exists($directory.'/info.php')) |
840 | 840 |
{ |
841 | 841 |
require($directory.'/info.php'); |
842 | 842 |
if(isset($template_name)) |
843 | 843 |
{ |
844 |
if(!isset($template_license)) { $template_license = 'GNU General Public License'; } |
|
845 |
if(!isset($template_platform) AND isset($template_designed_for)) { $template_platform = $template_designed_for; } |
|
846 |
if(!isset($template_function)) { $template_function = 'template'; } |
|
844 |
if(!isset($template_license)) |
|
845 |
{ |
|
846 |
$template_license = 'GNU General Public License'; |
|
847 |
} |
|
848 |
if(!isset($template_platform) AND isset($template_designed_for)) |
|
849 |
{ |
|
850 |
$template_platform = $template_designed_for; |
|
851 |
} |
|
852 |
if(!isset($template_function)) |
|
853 |
{ |
|
854 |
$template_function = 'template'; |
|
855 |
} |
|
847 | 856 |
// Check that it doesn't already exist |
848 | 857 |
$sql = 'SELECT `addon_id` FROM `'.TABLE_PREFIX.'addons` '; |
849 | 858 |
$sql .= 'WHERE `type` = "template" AND `directory` = "'.$template_directory.'" LIMIT 0,1'; |
... | ... | |
851 | 860 |
if($result->numRows() == 0) |
852 | 861 |
{ |
853 | 862 |
// Load into DB |
854 |
$sql = 'INSERT INTO `'.TABLE_PREFIX.'addons` SET '; |
|
863 |
$sql = 'INSERT INTO `'.TABLE_PREFIX.'addons` SET ';
|
|
855 | 864 |
$sql .= '`directory` = "'.$template_directory.'", '; |
856 | 865 |
$sql .= '`name` = "'.$template_name.'", '; |
857 | 866 |
$sql .= '`description`= "'.addslashes($template_description).'", '; |
... | ... | |
859 | 868 |
$sql .= '`function` = "'.$template_function.'", '; |
860 | 869 |
$sql .= '`version` = "'.$template_version.'", '; |
861 | 870 |
$sql .= '`platform` = "'.$template_platform.'", '; |
862 |
$sql .= '`author` = "'.$template_author.'", ';
|
|
863 |
$sql .= '`license` = "'.$template_license.'"';
|
|
871 |
$sql .= '`author` = "'.addslashes($template_author).'", ';
|
|
872 |
$sql .= '`license` = "'.addslashes($template_license).'" ';
|
|
864 | 873 |
$database->query($sql); |
865 | 874 |
} |
866 | 875 |
} |
... | ... | |
870 | 879 |
// Load language into DB |
871 | 880 |
function load_language($file) |
872 | 881 |
{ |
873 |
global $database; |
|
882 |
global $database,$admin;
|
|
874 | 883 |
if (file_exists($file) && preg_match('#^([A-Z]{2}.php)#', basename($file))) |
875 | 884 |
{ |
876 | 885 |
require($file); |
... | ... | |
891 | 900 |
$sql .= '`type`= "language", '; |
892 | 901 |
$sql .= '`version` = "'.$language_version.'", '; |
893 | 902 |
$sql .= '`platform` = "'.$language_platform.'", '; |
894 |
$sql .= '`author` = "'.$language_author.'", ';
|
|
895 |
$sql .= '`license` = "'.$language_license.'"';
|
|
903 |
$sql .= '`author` = "'.addslashes($language_author).'", ';
|
|
904 |
$sql .= '`license` = "'.addslashes($language_license).'"';
|
|
896 | 905 |
$database->query($sql); |
897 | 906 |
} |
898 | 907 |
} |
... | ... | |
921 | 930 |
{ |
922 | 931 |
// Update in DB |
923 | 932 |
$sql = 'UPDATE `'.TABLE_PREFIX.'addons` SET '; |
924 |
$sql .= '`version` = "'.$module_version.'", ';
|
|
925 |
$sql .= '`description` = "'.addslashes($module_description).'", ';
|
|
926 |
$sql .= '`platform` = "'.$module_platform.'", ';
|
|
927 |
$sql .= '`author` = "'.$module_author.'", ';
|
|
928 |
$sql .= '`license` = "'.$module_license.'", ';
|
|
933 |
$sql .= '`version` = "'.$module_version.'", '; |
|
934 |
$sql .= '`description` = "'.addslashes($module_description).'", '; |
|
935 |
$sql .= '`platform` = "'.$module_platform.'", '; |
|
936 |
$sql .= '`author` = "'.addslashes($module_author).'", ';
|
|
937 |
$sql .= '`license` = "'.addslashes($module_license).'", ';
|
|
929 | 938 |
$sql .= 'WHERE `directory` = "'.$module_directory.'"'; |
930 | 939 |
$database->query($sql); |
931 | 940 |
// Run upgrade script |
Also available in: Unified diff
Ticket #945 fixed reloads function