Ejemplo n.º 1
0
function CheckFiles()
{
    global $TMP_FOLDER;
    $files = array("id.txt", "sql.txt", "sql_int.txt", "files.txt", "parameters.txt", "index.php", "install.php", "function.inc.php", "en.lang.php", "ru.lang.php");
    $files[] = MAIN_LANG != "ru" ? "message_int.txt" : "message.txt";
    foreach ($files as $v) {
        if (!is_readable($TMP_FOLDER . $v)) {
            print TOOLS_MODULES_ERR_CANTOPEN . " " . $v . ".<br />\n";
            InstallationAborted();
        }
    }
}
Ejemplo n.º 2
0
 if (!is_readable($TMP_FOLDER . "sql.txt")) {
     InstallationAborted(TOOLS_MODULES_ERR_CANTOPEN . " sql.txt", 'patch');
 }
 if (!is_readable($TMP_FOLDER . "required.txt")) {
     InstallationAborted(TOOLS_MODULES_ERR_CANTOPEN . " required.txt", 'patch');
 }
 if (!is_readable($TMP_FOLDER . "symlinks.txt")) {
     InstallationAborted(TOOLS_MODULES_ERR_CANTOPEN . " symlinks.txt", 'patch');
 }
 $Ability = CheckAbilityOfInstallation();
 if ($Ability["Success"] == 0) {
     InstallationAborted(TOOLS_PATCH_ERROR . ": " . $Ability["ErrorMessage"], 'patch');
 }
 $Install = InstallPatch();
 if ($Install["Success"] == 0) {
     InstallationAborted(TOOLS_PATCH_ERROR_DURINGINSTALL . ": " . $Install["ErrorMessage"], 'patch');
 }
 // copy files from files.txt
 $CopyFilesResult = CopyFiles();
 // execute queries from sql.txt, one per string
 $ExecSQLResult = ExecSQL($TMP_FOLDER . "sql.txt");
 // symlinks.txt
 $CreatLinksResult = CreatLinks();
 // insert patch info into the database
 $inserted = $db->query("INSERT INTO `Patch`\n\t\t\t(`Patch_Name`, `Created`, `Description`)\n\t\t\tVALUES ('" . $db->escape($PatchName) . "', NOW(), '" . $db->escape($Description) . "')");
 // don't show update notice once more
 if ($db->insert_id) {
     $LAST_LOCAL_PATCH = $PatchName;
 }
 $PatchResult = array();
 // results
Ejemplo n.º 3
0
 if (!is_readable($TMP_FOLDER . "sql.txt")) {
     InstallationAborted(TOOLS_MODULES_ERR_CANTOPEN . " sql.txt.", 'activation');
 }
 if (!is_readable($TMP_FOLDER . "required.txt")) {
     InstallationAborted(TOOLS_MODULES_ERR_CANTOPEN . " required.txt.", 'activation');
 }
 if (!is_readable($TMP_FOLDER . "symlinks.txt")) {
     InstallationAborted(TOOLS_MODULES_ERR_CANTOPEN . " symlinks.txt.", 'activation');
 }
 $Ability = CheckAbilityOfInstallation();
 if ($Ability["Success"] == 0) {
     InstallationAborted(TOOLS_PATCH_ERROR . ": " . $Ability["ErrorMessage"] . ".", 'activation');
 }
 $Install = InstallPatch();
 if ($Install["Success"] == 0) {
     InstallationAborted(TOOLS_PATCH_ERROR_DURINGINSTALL . ": " . $Install["ErrorMessage"] . ".", 'activation');
 }
 // copy files from files.txt
 $CopyFilesResult = CopyFiles();
 // execute queries from sql.txt, one per string
 $ExecSQLResult = ExecSQL($TMP_FOLDER . "sql.txt");
 // symlinks.txt
 $CreatLinksResult = CreatLinks();
 // insert patch info into the database
 $inserted = $db->query("INSERT INTO `Patch`\n\t\t\t(`Patch_Name`, `Created`, `Description`)\n\t\t\tVALUES ('" . $db->escape($PatchName) . "', NOW(), '" . $db->escape($Description) . "')");
 // don't show update notice once more
 $PatchResult = array();
 // results
 if ($CopyFilesResult['files']) {
     $PatchResult['files'] = str_replace("%COUNT", $CopyFilesResult['files'], TOOLS_PATCH_INFO_FILES_COPIED);
 }
Ejemplo n.º 4
0
 }
 if (IsAlreadyInstalled('module')) {
     //nc_print_status(TOOLS_MODULES_ERR_INSTALLED, 'error');
     InstallationAborted(TOOLS_MODULES_ERR_INSTALLED, 'module');
 }
 $Install = CheckAbilityOfInstallation();
 if ($Install["Success"] == 0) {
     //nc_print_status(TOOLS_MODULES_ERR_ITEMS, 'error');
     //print $Install["ErrorMessage"].".<br><br>\n\n";
     InstallationAborted(TOOLS_MODULES_ERR_ITEMS . "<br />" . $Install["ErrorMessage"], 'module');
 }
 unset($Install);
 $Install = InstallThisModule();
 if ($Install["Success"] == 0) {
     //nc_print_status(TOOLS_MODULES_ERR_DURINGINSTALL.": ".$Install["ErrorMessage"], 'error');
     InstallationAborted(TOOLS_MODULES_ERR_DURINGINSTALL . ": " . $Install["ErrorMessage"], 'module');
 }
 $db->query("INSERT INTO `Module`\n        (`Module_Name`, `Keyword`, `Description`, `Parameters`, `Example_URL`, `Help_URL`, `Checked`)\n        VALUES\n        ('" . $db->escape($Name) . "', '" . $db->escape($Keyword) . "', '" . $db->escape($Description) . "', '" . $db->escape($Parameters) . "', '" . $db->escape($ExampleURL) . "', '" . $db->escape($HelpURL) . "', '1')");
 if ($SysMessage) {
     InsertSystemMessage($SysMessage, $Name);
 }
 CopyFiles('module');
 $current_catalogue = $nc_core->catalogue->get_by_host_name($_SERVER['HTTP_HOST']);
 if ($current_catalogue['Language'] == "ru") {
     ExecSQLMultiline($TMP_FOLDER . "sql.txt");
 } else {
     ExecSQLMultiline($TMP_FOLDER . "sql_int.txt");
 }
 DeleteFilesInDirectory($TMP_FOLDER);
 // Здесь необходимо сбрасывать кэш запроса относящегося к модулям.
 TitleModule();