Esempio n. 1
0
                 echo $thename;
             }
             echo ' - <a href = "?action=install&module=' . $value . '">install</a><br />';
             if (is_array($text)) {
                 foreach ($text as $tex) {
                     echo $tex;
                 }
             }
         } else {
             // this is where folders are found but don't have the install file.
         }
     }
 }
 if ($action == 'install') {
     $module = $_REQUEST['module'];
     if ($module_info = include_module_settings($module)) {
         $version = $module_info['version'];
         $name = $module_info['name'];
         $requires = $module_info['requires'];
         check_module_requirements($requires);
         process_db_requirements($module_info);
     } else {
         die('no install file exists');
     }
     $db->query("INSERT INTO " . table_modules . " (`name`, `version`, `folder`, `enabled`) values ('" . $name . "', '" . $version . "', '" . $module . "', 1);");
     header('Location: ' . $thispage);
 }
 if ($action == 'disable') {
     $module = $_REQUEST['module'];
     $sql = "UPDATE " . table_modules . " set enabled = 0 where `name` = '" . $module . "';";
     //echo $sql;
Esempio n. 2
0
            @eval($module_info['install']);
        }
    } else {
        die('No install file exists.');
    }
    $res_total_module = mysql_query('SELECT * from ' . table_modules);
    $total_module = mysql_num_rows($res_total_module);
    $db->query("INSERT IGNORE INTO " . table_modules . " (`name`, `version`, `folder`, `enabled`,`weight`) values ('" . $name . "', '" . $version . "', '" . $module . "', 1,'" . $total_module . "');");
    clear_module_cache();
    header('Location: admin_modules.php?status=uninstalled');
}
if ($action == 'remove') {
    $module = $db->escape(sanitize($_REQUEST['module'], 3));
    $sql = "SELECT * FROM " . table_modules . " WHERE `name` = '" . $module . "';";
    $row = $db->get_row($sql);
    if ($module_info = include_module_settings($row->folder)) {
        if ($module_info['uninstall']) {
            @eval($module_info['uninstall'] . '();');
        } elseif ($module_info['uninstall2']) {
            @eval($module_info['uninstall2']);
        }
    }
    $sql = "Delete from " . table_modules . " where `name` = '" . $module . "';";
    //echo $sql;
    $db->query($sql);
    clear_module_cache();
    header('Location: admin_modules.php');
}
function clear_module_cache()
{
    global $db;