Changeset 1509 in ExiteCMS for branches/PLi-Fusion/administration/modules.php
- Timestamp:
- 07/02/08 18:27:06 (4 years ago)
- File:
-
- 1 edited
-
branches/PLi-Fusion/administration/modules.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/PLi-Fusion/administration/modules.php
r1335 r1509 110 110 111 111 // determine the next order in the menu for this link 112 $link_order = db result(dbquery("SELECT MAX(link_order) FROM ".$db_prefix."site_links WHERE panel_name = '$link_panel'"),0) + 1;112 $link_order = dbfunction("MAX(link_order)", "site_links", "panel_name = '$link_panel'") + 1; 113 113 114 114 // add the new link … … 171 171 // register the installation of this module 172 172 $result = dbquery("INSERT INTO ".$db_prefix."modules (mod_title, mod_folder, mod_version) VALUES ('$mod_title', '$mod_folder', '$mod_version')"); 173 // save the key, we might need it later 174 $mod_id = mysql_insert_id(); 175 176 // if a module is installed, and if reports are defined, install the report links for this module 177 if ($mod_id && isset($mod_report_links) && is_array($mod_report_links) && count($mod_report_links)) { 178 179 // loop through the defined reports 180 foreach ($mod_report_links as $mod_report) { 181 182 // check if the code exists for this report 183 if (isset($mod_report['name']) && file_exists(PATH_MODULES.$mod_folder."/report.".$mod_report['name'].".php")) { 184 // check if the template exists for this report 185 if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".report.".$mod_report['name'].".tpl")) { 186 // verify the other fields 187 $mod_report['visibility'] = (isset($mod_report['visibility']) && isNum($mod_report['visibility']) ? $mod_report['visibility'] : 103); 188 $mod_report['title'] = isset($mod_report['title']) ? $mod_report['title'] : ("Report: ".$mod_report['name']); 189 $mod_report['version'] = isset($mod_report['version']) ? $mod_report['version'] : $mod_version; 190 // add it to the report table 191 $result = dbquery("INSERT INTO ".$db_prefix."reports (report_mod_id, report_name, report_title, report_version, report_visibility) 192 VALUES ('".$mod_id."', '".$mod_report['name']."', '".$mod_report['title']."', '".$mod_report['version']."', '".$mod_report['visibility']."')"); 193 } 194 } 195 } 196 } 197 198 // if a module is installed, and if searches are defined, install the search links for this module 199 if ($mod_id && isset($mod_search_links) && is_array($mod_search_links) && count($mod_search_links)) { 200 201 // loop through the defined reports 202 foreach ($mod_search_links as $mod_search) { 203 204 // check if the code exists for this search 205 if (isset($mod_search['name']) && file_exists(PATH_MODULES.$mod_folder."/search.".$mod_search['name'].".php")) { 206 // check if the template exists for this search 207 if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".search.".$mod_search['name'].".tpl")) { 208 // verify the other fields 209 $mod_search['visibility'] = (isset($mod_search['visibility']) && isNum($mod_search['visibility']) ? $mod_search['visibility'] : 103); 210 $mod_search['title'] = isset($mod_search['title']) ? $mod_search['title'] : ("Search: ".$mod_search['name']); 211 $mod_search['version'] = isset($mod_search['version']) ? $mod_search['version'] : $mod_version; 212 // add it to the search table 213 $result = dbquery("INSERT INTO ".$db_prefix."searches (search_mod_id, search_name, search_title, search_version, search_visibility) 214 VALUES ('".$mod_id."', '".$mod_search['name']."', '".$mod_search['title']."', '".$mod_search['version']."', '".$mod_search['visibility']."')"); 215 } 216 } 217 } 218 } 173 219 174 220 // update the access rights of the site administrators to include this new module … … 303 349 // remove the module from the installed modules list 304 350 $result = dbquery("DELETE FROM ".$db_prefix."modules WHERE mod_id='$id'"); 351 352 // remove any reports associated with this module 353 $result = dbquery("DELETE FROM ".$db_prefix."reports WHERE report_mod_id='$id'"); 354 355 // remove any searches associated with this module 356 $result = dbquery("DELETE FROM ".$db_prefix."searches WHERE search_mod_id='$id'"); 357 } 358 359 if ($action == 'locales' && isset($id)) { 360 361 // make sure the ID passed is numeric 362 if (!isNum($id)) fallback(FUSION_SELF.$aidlink); 363 364 // check if it exists 365 $result = dbquery("SELECT * FROM ".$db_prefix."modules WHERE mod_id='$id'"); 366 if (!$result) fallback(FUSION_SELF.$aidlink); 367 368 // get the module data 369 $data = dbarray($result); 370 371 // load the module installer to start the upgrade 372 include PATH_MODULES.$data['mod_folder']."/module_installer.php"; 373 374 // if locale strings are defined, load them into the database 375 if (isset($localestrings) && is_array($localestrings)) { 376 foreach($localestrings as $locales_code => $locales_strings) { 377 load_localestrings($locales_strings, $locales_code, "modules.".$mod_folder); 378 } 379 } 380 305 381 } 306 382 … … 393 469 if (dbrows($result) == 0) { 394 470 // determine the next order in the menu for this link 395 $link_order = db result(dbquery("SELECT MAX(link_order) FROM ".$db_prefix."site_links WHERE panel_name = '$link_panel'"),0) + 1;471 $link_order = dbfunction("MAX(link_order)", "site_links", "panel_name = '$link_panel'") + 1; 396 472 397 473 // add the new link … … 419 495 foreach($localestrings as $locales_code => $locales_strings) { 420 496 load_localestrings($locales_strings, $locales_code, "modules.".$mod_folder); 497 } 498 } 499 500 // remove any reports associated with this module 501 $result = dbquery("DELETE FROM ".$db_prefix."reports WHERE report_mod_id='$id'"); 502 503 // if a module is installed, and if reports are defined, (re)install the report links for this module 504 if (isset($mod_report_links) && is_array($mod_report_links) && count($mod_report_links)) { 505 506 // loop through the defined reports 507 foreach ($mod_report_links as $mod_report) { 508 509 // check if the code exists for this report 510 if (isset($mod_report['name']) && file_exists(PATH_MODULES.$mod_folder."/report.".$mod_report['name'].".php")) { 511 // check if the template exists for this report 512 if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".report.".$mod_report['name'].".tpl")) { 513 // verify the other fields 514 $mod_report['visibility'] = (isset($mod_report['visibility']) && isNum($mod_report['visibility']) ? $mod_report['visibility'] : 103); 515 $mod_report['title'] = isset($mod_report['title']) ? $mod_report['title'] : ("Report: ".$mod_report['name']); 516 $mod_report['version'] = isset($mod_report['version']) ? $mod_report['version'] : $mod_version; 517 // add it to the report table 518 $result = dbquery("INSERT INTO ".$db_prefix."reports (report_mod_id, report_name, report_title, report_version, report_visibility) 519 VALUES ('".$id."', '".$mod_report['name']."', '".$mod_report['title']."', '".$mod_report['version']."', '".$mod_report['visibility']."')"); 520 } 521 } 522 } 523 524 } 525 526 // remove any searches associated with this module 527 $result = dbquery("DELETE FROM ".$db_prefix."searches WHERE search_mod_id='$id'"); 528 529 // if a module is installed, and if searches are defined, install the search links for this module 530 if (isset($mod_search_links) && is_array($mod_search_links) && count($mod_search_links)) { 531 532 // loop through the defined reports 533 foreach ($mod_search_links as $mod_search) { 534 535 // check if the code exists for this search 536 if (isset($mod_search['name']) && file_exists(PATH_MODULES.$mod_folder."/search.".$mod_search['name'].".php")) { 537 // check if the template exists for this search 538 if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".search.".$mod_search['name'].".tpl")) { 539 // verify the other fields 540 $mod_search['visibility'] = (isset($mod_search['visibility']) && isNum($mod_search['visibility']) ? $mod_search['visibility'] : 103); 541 $mod_search['title'] = isset($mod_search['title']) ? $mod_search['title'] : ("Search: ".$mod_search['name']); 542 $mod_search['version'] = isset($mod_search['version']) ? $mod_search['version'] : $mod_version; 543 // add it to the search table 544 $result = dbquery("INSERT INTO ".$db_prefix."searches (search_mod_id, search_name, search_title, search_version, search_visibility) 545 VALUES ('".$id."', '".$mod_search['name']."', '".$mod_search['title']."', '".$mod_search['version']."', '".$mod_search['visibility']."')"); 546 } 547 } 421 548 } 422 549 } … … 452 579 $mod_check = (isset($mod_title) && $mod_title != ""); 453 580 $mod_check = $mod_check && (isset($mod_version) && $mod_version!= ""); 454 $mod_check = $mod_check && (isset($mod_developer) && $mod_developer!= "");455 $mod_check = $mod_check && (isset($mod_email) && $mod_email!= "");456 581 if (!$mod_check) { 457 582 $mod_errors .= $locale['mod004']; … … 460 585 $this_module['description'] = isset($mod_description) ? $mod_description : ""; 461 586 $this_module['version'] = $mod_version; 462 $this_module['developer'] = $mod_developer;463 $this_module['email'] = $mod_email;587 $this_module['developer'] = isset($mod_developer) ? $mod_developer : ""; 588 $this_module['email'] = isset($mod_email) ? $mod_email : ""; 464 589 $this_module['url'] = isset($mod_weburl) ? $mod_weburl : ""; 465 590 $this_module['type'] = isset($mod_type) ? $mod_type : "M";
Note: See TracChangeset
for help on using the changeset viewer.
