Exemple #1
0
function update_70x_to_706($type = '')
{
    global $sql, $ns, $pref, $e107info, $admin_log, $emessage;
    $just_check = $type == 'do' ? FALSE : TRUE;
    if (!$sql->db_Field("plugin", 5)) {
        if ($just_check) {
            return update_needed();
        }
        $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` ADD `plugin_addons` TEXT NOT NULL ;");
        catch_error($sql);
    }
    //rename plugin_rss field
    if ($sql->db_Field("plugin", 5) == "plugin_rss") {
        if ($just_check) {
            return update_needed();
        }
        $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` CHANGE `plugin_rss` `plugin_addons` TEXT NOT NULL;");
        catch_error($sql);
    }
    if ($sql->db_Field("dblog", 5) == "dblog_query") {
        if ($just_check) {
            return update_needed();
        }
        $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "dblog` CHANGE `dblog_query` `dblog_title` VARCHAR( 255 ) NOT NULL DEFAULT '';");
        catch_error($sql);
        $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "dblog` CHANGE `dblog_remarks` `dblog_remarks` TEXT NOT NULL;");
        catch_error($sql);
    }
    if (!$sql->db_Field("plugin", "plugin_path", "UNIQUE")) {
        if ($just_check) {
            return update_needed();
        }
        if (!$sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` ADD UNIQUE (`plugin_path`);")) {
            $mesg = LAN_UPDATE_12 . " : <a href='" . e_ADMIN . "db.php?plugin'>" . ADLAN_145 . "</a>.";
            //$ns -> tablerender(LAN_ERROR,$mes);
            $emessage->add($mesg, E_MESSAGE_ERROR);
            catch_error($sql);
        }
    }
    if (!$sql->db_Field("online", 6)) {
        if ($just_check) {
            return update_needed();
        }
        $sql->db_Select_gen("ALTER TABLE " . MPREFIX . "online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'");
        catch_error($sql);
    }
    if ($sql->db_Query("SHOW INDEX FROM " . MPREFIX . "tmp")) {
        $row = $sql->db_Fetch();
        if (!in_array('tmp_ip', $row)) {
            if ($just_check) {
                return update_needed();
            }
            $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "tmp` ADD INDEX `tmp_ip` (`tmp_ip`);");
            $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "upload` ADD INDEX `upload_active` (`upload_active`);");
            $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "generic` ADD INDEX `gen_type` (`gen_type`);");
        }
    }
    if (!$just_check) {
        // update new fields
        require_once e_HANDLER . "plugin_class.php";
        $ep = new e107plugin();
        $ep->update_plugins_table('update');
        $ep->save_addon_prefs('update');
    }
    if (!isset($pref['displayname_maxlength'])) {
        if ($just_check) {
            return update_needed();
        }
        $pref['displayname_maxlength'] = 15;
        save_prefs();
    }
    // If we get to here, in checking mode no updates are required. In update mode, all done.
    if ($just_check) {
        return TRUE;
    }
    e107::getLog()->add('UPDATE_02', LAN_UPDATE_14 . $e107info['e107_version'], E_LOG_INFORMATIVE, '');
    // Log result of actual update
    return $just_check;
    // TRUE if no updates needed, FALSE if updates needed and completed
}
Exemple #2
0
 /**
  * Plugin Folder Scanner
  * @return none
  */
 private function plugin_viewscan()
 {
     $error_messages = array(0 => DBLAN_31, 1 => DBLAN_32, 2 => DBLAN_33, 3 => DBLAN_34);
     $error_image = array("integrity_pass.png", "integrity_fail.png", "warning.png", "blank.png");
     global $e107;
     $sql = e107::getDb();
     $tp = e107::getParser();
     $frm = e107::getForm();
     $emessage = e107::getMessage();
     require_once e_HANDLER . "plugin_class.php";
     $ep = new e107plugin();
     $ep->update_plugins_table();
     // scan for e_xxx changes and save to plugin table.
     $ep->save_addon_prefs();
     // generate global e_xxx_list prefs from plugin table.
     /* we all are awaiting for PHP5 only support - method chaining...
     		$emessage->add(DBLAN_22.' - '.DBLAN_23, E_MESSAGE_SUCCESS)
     				 ->add("<a href='".e_SELF."'>".LAN_BACK."</a>", E_MESSAGE_SUCCESS)
     				 ->add(DBLAN_30);
     		*/
     $emessage->add(DBLAN_23, E_MESSAGE_SUCCESS);
     $emessage->add("<a href='" . e_SELF . "'>" . LAN_BACK . "</a>", E_MESSAGE_SUCCESS);
     $emessage->add(DBLAN_30);
     $text = "\n\t\t\t\t<form method='post' action='" . e_ADMIN . "db.php?mode=" . $_GET['mode'] . "' id='plug_edit'>\n\t\t\t\t\t<fieldset id='core-db-plugin-scan'>\n\t\t\t\t\t\t<legend class='e-hideme'>" . ADLAN_CL_7 . "</legend>\n\t\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t\t\t<col style='width: 35%' />\n\t\t\t\t\t\t\t\t<col style='width: 25%' />\n\t\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_24 . "</th>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_25 . "</th>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_26 . "</th>\n\t\t\t\t\t\t\t\t\t<th class='center last'>" . DBLAN_27 . "</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody>\n\t\t\t";
     $sql->db_Select("plugin", "*", "plugin_id !='' order by plugin_path ASC");
     // Must order by path to pick up duplicates. (plugin names may change).
     $previous = '';
     while ($row = $sql->db_Fetch()) {
         e107::loadLanFiles($row['plugin_path'], 'admin');
         $text .= "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . $e107->tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off") . "</td>\n\t               \t\t\t\t\t<td>" . $row['plugin_path'] . "</td>\n\t\t\t\t\t\t\t\t\t<td>";
         if (trim($row['plugin_addons'])) {
             //XXX - $nl_code = ''; - OLD VAR?
             foreach (explode(',', $row['plugin_addons']) as $this_addon) {
                 $ret_code = 3;
                 // Default to 'not checked
                 if (strpos($this_addon, 'e_') === 0 && substr($this_addon, -4, 4) != '_sql') {
                     $ret_code = $ep->checkAddon($row['plugin_path'], $this_addon);
                     // See whether spaces before opening tag or after closing tag
                 }
                 $text .= "<div class='clear'>";
                 $text .= "<img class='icon action S16' src='" . e_IMAGE_ABS . "fileinspector/" . $error_image[$ret_code] . "' alt='" . $error_messages[$ret_code] . "' title='" . $error_messages[$ret_code] . "' />";
                 $text .= trim($this_addon);
                 // $ret_code - 0=OK, 1=content error, 2=access error
                 $text .= "</div>";
             }
         }
         $text .= "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='center'>\n\t\t\t\t";
         if ($previous == $row['plugin_path']) {
             $delid = $row['plugin_id'];
             $delname = $row['plugin_name'];
             //Admin delete button
             $text .= $frm->admin_button("delplug[{$delid}]", DBLAN_52, 'delete', '', array('title' => LAN_CONFIRMDEL . " ID:{$delid} [{$delname}]"));
             //Or maybe image submit? -
             //$text .= $frm->submit_image("delplug[{$delid}]", DBLAN_52, 'delete', LAN_CONFIRMDEL." ID:{$delid} [$delname]");
         } else {
             $text .= $row['plugin_installflag'] == 1 ? DBLAN_27 : " ";
             // "Installed and not installed";
         }
         $text .= "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t";
         $previous = $row['plugin_path'];
     }
     $text .= "\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t";
     e107::getRender()->tablerender(DBLAN_10 . ' - ' . DBLAN_22, $emessage->render() . $text);
 }