1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Made a start on media-manager and added a deprecated LAN checking function to remain enabled up until release.

This commit is contained in:
CaMer0n
2009-11-07 11:20:34 +00:00
parent 51e4e7d9f2
commit 7fca058ad5
9 changed files with 605 additions and 178 deletions

View File

@@ -9,8 +9,8 @@
* Admin Navigation * Admin Navigation
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/ad_links.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/ad_links.php,v $
* $Revision: 1.18 $ * $Revision: 1.19 $
* $Date: 2009-09-18 23:13:59 $ * $Date: 2009-11-07 11:20:25 $
* $Author: e107coders $ * $Author: e107coders $
*/ */
@@ -558,7 +558,7 @@ $array_functions = array(
8 => array(e_ADMIN.'emoticon.php', ADLAN_58, ADLAN_59, 'F', 1, E_16_EMOTE, E_32_EMOTE), 8 => array(e_ADMIN.'emoticon.php', ADLAN_58, ADLAN_59, 'F', 1, E_16_EMOTE, E_32_EMOTE),
9 => array(e_ADMIN.'filemanager.php', ADLAN_30, ADLAN_31, '6', 5, E_16_FILE, E_32_FILE), 9 => array(e_ADMIN.'filemanager.php', ADLAN_30, ADLAN_31, '6', 5, E_16_FILE, E_32_FILE),
10 => array(e_ADMIN.'frontpage.php', ADLAN_60, ADLAN_61, 'G', 1, E_16_FRONT, E_32_FRONT), 10 => array(e_ADMIN.'frontpage.php', ADLAN_60, ADLAN_61, 'G', 1, E_16_FRONT, E_32_FRONT),
11 => array(e_ADMIN.'image.php', ADLAN_105, ADLAN_106, 'A', 1, E_16_IMAGES, E_32_IMAGES), 11 => array(e_ADMIN.'image.php', LAN_MEDIAMANAGER, ADLAN_106, 'A', 5, E_16_IMAGES, E_32_IMAGES),
12 => array(e_ADMIN.'links.php', ADLAN_138, ADLAN_139, 'I', 1, E_16_LINKS, E_32_LINKS), 12 => array(e_ADMIN.'links.php', ADLAN_138, ADLAN_139, 'I', 1, E_16_LINKS, E_32_LINKS),
13 => array(e_ADMIN.'wmessage.php', ADLAN_28, ADLAN_29, 'M', 3, E_16_WELCOME, E_32_WELCOME), 13 => array(e_ADMIN.'wmessage.php', ADLAN_28, ADLAN_29, 'M', 3, E_16_WELCOME, E_32_WELCOME),
14 => array(e_ADMIN.'ugflag.php', ADLAN_40, ADLAN_41, '9', 4, E_16_MAINTAIN, E_32_MAINTAIN), 14 => array(e_ADMIN.'ugflag.php', ADLAN_40, ADLAN_41, '9', 4, E_16_MAINTAIN, E_32_MAINTAIN),

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/comment.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/comment.php,v $
| $Revision: 1.13 $ | $Revision: 1.14 $
| $Date: 2009-11-06 18:37:23 $ | $Date: 2009-11-07 11:20:26 $
| $Author: secretr $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
require_once("../class2.php"); require_once("../class2.php");
@@ -78,20 +78,20 @@ class comments_admin_ui extends e_admin_ui
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields //TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array( protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'comment_id' => array('title'=> ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE), 'comment_id' => array('title'=> ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE),
'comment_item_id' => array('title'=> "item id", 'type' => 'text', 'width' => 'auto'), 'comment_item_id' => array('title'=> "item id", 'type' => 'text', 'width' => '5%'),
'comment_subject' => array('title'=> "subject", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name 'comment_subject' => array('title'=> "subject", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
'comment_comment' => array('title'=> "comment", 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name 'comment_comment' => array('title'=> "comment", 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
'comment_author_id' => array('title'=> "authorID", 'type' => 'user', 'data' => 'int', 'width' => 'auto'), // User id 'comment_author_id' => array('title'=> "authorID", 'type' => 'user', 'data' => 'int', 'width' => 'auto'), // User id
'comment_author_name' => array('title'=> "authorName",'type' => 'text', 'width' => 'auto'), // User name 'comment_author_name' => array('title'=> "authorName", 'type' => 'text', 'width' => 'auto'), // User name
'user_name' => array('title'=> "System user", 'type' => 'text', 'width' => 'auto', 'table' => 'user', 'noedit' => true), // User name 'user_name' => array('title'=> "System user", 'type' => 'text', 'width' => 'auto', 'table' => 'user', 'noedit' => true), // User name
'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date 'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date
'comment_blocked' => array('title'=> "blocked", 'type' => 'boolean', 'data'=> 'int', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo 'comment_blocked' => array('title'=> "blocked", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_ip' => array('title'=> "IP", 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting) 'comment_ip' => array('title'=> "IP", 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
'comment_type' => array('title'=> "Type", 'type' => 'method', 'width' => '10%', 'thclass' => 'center', 'filter'=>TRUE,'batch'=>TRUE ), // No real vetting 'comment_type' => array('title'=> "Type", 'type' => 'method', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ), // No real vetting
'comment_lock' => array('title'=> "Lock", 'type' => 'boolean', 'data'=> 'int', 'filter' => true, 'batch' => true, 'width' => 'auto'), 'comment_lock' => array('title'=> "Lock", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'),
'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center') 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
); );
//required (but should be optional) - default column user prefs //required (but should be optional) - default column user prefs
protected $fieldpref = array('checkboxes', 'comment_id', 'comment_item_id', 'comment_author_id', 'comment_author_name', 'comment_subject', 'comment_comment', 'comment_type', 'options'); protected $fieldpref = array('checkboxes', 'comment_id', 'comment_item_id', 'comment_author_id', 'comment_author_name', 'comment_subject', 'comment_comment', 'comment_type', 'options');
@@ -132,7 +132,8 @@ class comments_admin_form_ui extends e_admin_form_ui
if($mode == 'batch') if($mode == 'batch')
{ {
$types = e107::getComment()->known_types; $types = e107::getComment()->known_types;
// sort($types); asort($types);
return $types; return $types;
} }
} }

View File

@@ -9,8 +9,8 @@
* Image Administration Area * Image Administration Area
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
* $Revision: 1.25 $ * $Revision: 1.26 $
* $Date: 2009-11-07 02:10:34 $ * $Date: 2009-11-07 11:20:26 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -21,17 +21,6 @@ if (!getperms("A"))
exit; exit;
} }
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'image';
require_once("auth.php");
require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."userclass_class.php");
require_once(e_HANDLER."message_handler.php");
$frm = new e_form(); //new form handler
$emessage = &eMessage::getInstance();
/* /*
* CLOSE - GO TO MAIN SCREEN * CLOSE - GO TO MAIN SCREEN
*/ */
@@ -41,6 +30,127 @@ if(isset($_POST['submit_cancel_show']))
exit(); exit();
} }
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'image';
// require_once("auth.php");
// require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."userclass_class.php");
require_once(e_HANDLER."message_handler.php");
// $frm = new e_form(); //new form handler
$emessage = &eMessage::getInstance();
class media_admin extends e_admin_dispatcher
{
protected $modes = array(
'main' => array(
'controller' => 'media_admin_ui',
'path' => null,
'ui' => 'comments_admin_form_ui',
'uipath' => null
)
);
protected $adminMenu = array(
'main/list' => array('caption'=> 'Media Library', 'perm' => 'A'),
'main/create' => array('caption'=> "Add New Media", 'perm' => 'A'),
'main/icons' => array('caption'=> IMALAN_71, 'perm' => 'A'),
'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'A'),
'main/avatars' => array('caption'=> IMALAN_23, 'perm' => 'A')
);
/*
$var['main']['text'] = IMALAN_7;
$var['main']['link'] = e_SELF;
$var['icons']['text'] = IMALAN_71;
$var['icons']['link'] = e_SELF."?icons";
$var['avatars']['text'] = IMALAN_23;
$var['avatars']['link'] = e_SELF."?avatars";
$var['editor']['text'] = "Image Manipulation (future release)";
$var['editor']['link'] = e_SELF."?editor";*/
protected $adminMenuAliases = array(
'main/edit' => 'main/list'
);
protected $menuTitle = LAN_MEDIAMANAGER;
}
class media_admin_ui extends e_admin_ui
{
protected $pluginTitle = LAN_MEDIAMANAGER;
protected $pluginName = 'core';
protected $table = "core_media";
protected $listQry = "SELECT * FROM #core_media"; // without any Order or Limit.
// //protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
protected $pid = "media_id";
protected $perPage = 10;
protected $batchDelete = true;
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'media_id' => array('title'=> ID, 'type' => 'int', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE),
'media_preview' => array('title'=> "Preview", 'type' => null, 'data'=> null, 'width' => '10%'), // Generate on the fly.
'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> null, 'readParm' => 'hidden', 'width' => '10%'), // Generate on the fly.
'media_title' => array('title'=> "Title", 'type' => 'text', 'data'=> 'str', 'width' => '5%'),
'media_caption' => array('title'=> "Caption", 'type' => 'text', 'data'=> 'str', 'width' => '5%'),
'media_description' => array('title'=> "Description", 'type' => 'textarea', 'data'=> 'str', 'width' => 'auto', 'thclass' => 'left first'), // Display name
'media_category' => array('title'=> "Category", 'type' => 'int', 'data'=> 'int', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
'media_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'data'=> 'int', 'width' => 'auto'), // User date
'media_url' => array('title'=> "URL", 'type' => 'url', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'media_userclass' => array('title'=> "Userclass", 'type' => 'userclass', 'data'=> 'str', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
'media_tags' => array('title'=> "Tags/Keywords", 'type' => 'text', 'data'=> 'str', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ), // No real vetting
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'data'=> null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
);
protected $fieldpref = array('checkboxes', 'media_id', 'media_thumb', 'media_title', 'media_caption', 'media_description', 'media_category', 'media_datestamp','media_userclass', 'options');
/*
protected $prefs = array(
'pref_type' => array('title'=> 'type', 'type'=>'text'),
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean'),
'pref_name' => array('title'=> 'name', 'type' => 'text')
);*/
}
new media_admin();
require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
// -----------------------------------------------------------------------
$action = e_QUERY; $action = e_QUERY;
@@ -49,17 +159,17 @@ if(isset($_POST['delpref']) || (isset($_POST['delpref_checked']) && isset($_POST
del_pref_val(); del_pref_val();
} }
if($action == "icons") if($_GET['action'] == "icons")
{ {
icon_editor(); icon_editor();
} }
if($action == "avatars") if($_GET['action'] == "avatars")
{ {
show_avatars(); show_avatars();
} }
if($action !='avatars' && $action !='icons') if($_GET['action'] == 'settings')
{ {
main_config(); main_config();
} }
@@ -243,9 +353,15 @@ if (isset($_POST['update_options']))
*/ */
function show_avatars() function show_avatars()
{ {
global $ns, $sql, $frm, $tp, $emessage, $e107, $pref; global $e107, $pref;
$ns = e107::getRender();
$sql = e107::getDb();
$frm = e107::getForm();
$tp = e107::getParser();
$mes = e107::getMessage();
$handle = opendir(e_UPLOAD."avatars/"); $handle = opendir(e_UPLOAD."avatars/"); //TODO replace with $fl
$dirlist = array(); $dirlist = array();
while ($file = readdir($handle)) while ($file = readdir($handle))
{ {
@@ -348,7 +464,7 @@ function show_avatars()
} }
$ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_18, $emessage->render().$text); $ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_18, $mes->render().$text);
} }
/* /*
@@ -531,7 +647,14 @@ if (isset($_POST['check_avatar_sizes']))
*/ */
function main_config() function main_config()
{ {
global $pref, $frm, $tp, $sql, $ns, $emessage; global $pref;
$frm = e107::getForm();
$tp = e107::getParser();
$sql = e107::getDb();
$ns = e107::getRender();
$mes = e107::getMessage();
if(function_exists('gd_info')) if(function_exists('gd_info'))
{ {
$gd_info = gd_info(); $gd_info = gd_info();
@@ -650,7 +773,7 @@ if (isset($_POST['check_avatar_sizes']))
</fieldset> </fieldset>
</form>"; </form>";
$ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_7, $emessage->render().$text); $ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_7, $mes->render().$text);
} }
//Just in case... //Just in case...
if(!e_AJAX_REQUEST) require_once("footer.php"); if(!e_AJAX_REQUEST) require_once("footer.php");
@@ -660,10 +783,12 @@ if(!e_AJAX_REQUEST) require_once("footer.php");
function icon_editor() function icon_editor()
{ {
global $iconpool, $e107, $emessage, $frm, $tp; global $iconpool, $e107;
$ns = e107::getRender(); $ns = e107::getRender();
$tp = e107::getParser(); $tp = e107::getParser();
$frm = e107::getForm();
$mes = e107::getMessage();
ksort($iconpool); ksort($iconpool);
@@ -738,7 +863,7 @@ function icon_editor()
"; ";
//$text .= "<div style='text-align:center'><a href='".e_SELF."'>".DBLAN_13."</a></div>\n"; //$text .= "<div style='text-align:center'><a href='".e_SELF."'>".DBLAN_13."</a></div>\n";
$ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_71, $emessage->render().$text); $ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_71, $mes->render().$text);
return $text; return $text;
} }
@@ -776,29 +901,6 @@ function del_pref_val()
} }
function image_adminmenu()
{
global $action;
if($action == "")
{
$action = "main";
}
$var['main']['text'] = IMALAN_7;
$var['main']['link'] = e_SELF;
$var['icons']['text'] = IMALAN_71;
$var['icons']['link'] = e_SELF."?icons";
$var['avatars']['text'] = IMALAN_23;
$var['avatars']['link'] = e_SELF."?avatars";
$var['editor']['text'] = "Image Manipulation (future release)";
$var['editor']['link'] = e_SELF."?editor";
e_admin_menu(LAN_IMAGEMANAGER, $action, $var);
}

View File

@@ -9,8 +9,8 @@
* Administration Area - Languages * Administration Area - Languages
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/language.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/language.php,v $
* $Revision: 1.23 $ * $Revision: 1.24 $
* $Date: 2009-11-05 08:07:48 $ * $Date: 2009-11-07 11:20:27 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -149,6 +149,13 @@ if (isset($_POST['create_tables']) && $_POST['language'])
} }
*/ */
unset($text); unset($text);
if (!e_QUERY || $action == 'main' && !$_POST['language'] && !$_POST['edit_existing']) if (!e_QUERY || $action == 'main' && !$_POST['language'] && !$_POST['edit_existing'])
@@ -175,8 +182,56 @@ if (varset($_POST['ziplang']) && varset($_POST['language']))
if (varset($action) == "tools") if (varset($action) == "tools")
{ {
show_tools(); show_tools();
e107::getRender()->tablerender(LANG_LAN_34, available_langpacks()); if($languagePacks = available_langpacks() )
{
e107::getRender()->tablerender(LANG_LAN_34,$languagePacks );
}
} }
if(varset($_POST['searchDeprecated']) && varset($_POST['deprecatedLans']))
{
$mes = e107::getMessage();
$lanfile = $_POST['deprecatedLans'];
$scriptname = str_replace("lan_","",basename($lanfile));
if(is_readable(e_ADMIN.$script))
{
$script = e_ADMIN.$scriptname; // matching files. lan_xxxx.php and xxxx.php
}
// Exceptions - same language loaded by several scripts.
if($lanfile == e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_e107_update.php")
{
$script = e_ADMIN."update_routines.php,".e_ADMIN."e107_update.php";
}
if(is_readable($lanfile))
{
if($res = unused($lanfile,$script))
{
$ns -> tablerender($res['caption'],$mes->render(). $res['text']);
}
}
else
{
// echo 'PROBLEM';
}
}
//FIX - create or edit check //FIX - create or edit check
if (isset($_POST['create_edit_existing'])) if (isset($_POST['create_edit_existing']))
$_POST['edit_existing'] = true; $_POST['edit_existing'] = true;
@@ -495,7 +550,9 @@ function multilang_db()
function show_tools() function show_tools()
{ {
global $emessage; $frm = e107::getForm();
$mes = e107::getMessage();
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_lancheck.php"); include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_lancheck.php");
$text = " $text = "
<form id='core-language-lancheck-form' method='post' action='".e_ADMIN."lancheck.php'> <form id='core-language-lancheck-form' method='post' action='".e_ADMIN."lancheck.php'>
@@ -564,7 +621,33 @@ function show_tools()
<button class='submit' type='submit' name='ziplang' value='no-value'><span>".LANG_LAN_24."</span></button> <button class='submit' type='submit' name='ziplang' value='no-value'><span>".LANG_LAN_24."</span></button>
<input type='checkbox' name='contribute_pack' value='1' /> Check to share your language-pack with the e107 community. <input type='checkbox' name='contribute_pack' value='1' /> Check to share your language-pack with the e107 community.
</td> </td>
</tr> </tr>";
$text .= "
<tr>
<td class='label'>Search for Deprecated Lans</td>
<td class='control'>
<select name='deprecatedLans' class='tbox select'>
<option value=''>".LAN_SELECT."</option>";
$fl = e107::getFile();
$fl->mode = 'full';
$lans = $fl->get_files(e_LANGUAGEDIR."English/admin");
foreach($lans as $script=>$lan)
{
$selected = ($lan == varset($_POST['deprecatedLans'])) ? "selected='selected'" : "";
$text .= "<option value='".$lan."' {$selected}>".str_replace(e_LANGUAGEDIR."English/","",$lan)."</option>\n";
}
$text .= "
</select>".$frm->admin_button('searchDeprecated',"Check")."
</td>
</tr>";
$text .= "
</tbody> </tbody>
</table> </table>
</fieldset> </fieldset>
@@ -573,7 +656,7 @@ function show_tools()
e107::getRender()->tablerender(LANG_LAN_PAGE_TITLE.' - '.LANG_LAN_21, $emessage->render().$text); e107::getRender()->tablerender(LANG_LAN_PAGE_TITLE.' - '.LANG_LAN_21, $mes->render().$text);
} }
@@ -588,6 +671,11 @@ function available_langpacks()
if($rawData = $xml -> loadXMLfile($feed, TRUE)) if($rawData = $xml -> loadXMLfile($feed, TRUE))
{ {
if(!varset($rawData['language']))
{
return FALSE;
}
$text .= "<div class='block-text'>".LANG_LAN_35."</div>"; $text .= "<div class='block-text'>".LANG_LAN_35."</div>";
$text .= "<table cellpadding='0' cellspacing='0' class='adminlist'>"; $text .= "<table cellpadding='0' cellspacing='0' class='adminlist'>";
foreach($rawData['language'] as $val) foreach($rawData['language'] as $val)
@@ -754,6 +842,184 @@ function grab_lans($path, $language, $filter = "")
} }
return $pzip; return $pzip;
} }
// -----------------------
/**
* Compare Language File against script and find unused LANs
* @param object $lanfile
* @param object $script
* @return
*/
function unused($lanfile,$script)
{
$lanDefines = file_get_contents($lanfile);
$tmp = explode(",",$script);
foreach($tmp as $scr)
{
$compare[$scr] = file_get_contents($scr);
}
$mes = e107::getMessage();
if(!$compare)
{
$mes = e107::getMessage();
$mes->add("Couldn't read ".$script, E_MESSAGE_ERROR);
}
if(!$lanDefines)
{
$mes = e107::getMessage();
$mes->add("Couldn't read ".$lanfile, E_MESSAGE_ERROR);
}
$srch = array("<?php","<?","?>");
$lanDefines = str_replace($srch,"",$lanDefines);
$lanDefines = explode("\n", $lanDefines);
if($lanDefines && $compare)
{
$text = "<table class='adminlist' style='width:100%'>
<thead>
<tr>
<th>".$lanfile."</th>";
foreach($compare as $k=>$val)
{
$text .= "<th>".$k."</th>";
}
$text .= "
</tr>
</thead>
<tbody>";
// for ($i=0; $i<count($lanDefines); $i++)
// {
foreach($lanDefines as $line)
{
if(trim($line) !="")
{
$disabled = (eregi("^//",$line)) ? " (disabled)" : FALSE;
if($match = getDefined($line))
{
$text .= compareit($match['define'],$compare,$match['value'],$disabled);
}
}
}
$text .= "</tbody></table>";
$ret['text'] = $text;
$ret['caption'] = "Deprecated LAN Check (experimental!)";
return $ret;
}
else
{
return FALSE;
}
}
function getDefined($line)
{
if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$match) ||
preg_match("#\'(.*?)\'.*?\"(.*)\"#",$line,$match) ||
preg_match("#\"(.*?)\".*?\'(.*)\'#",$line,$match) ||
preg_match("#\'(.*?)\'.*?\'(.*)\'#",$line,$match) ||
preg_match("#\((.*?)\,.*?\"(.*)\"#",$line,$match) ||
preg_match("#\((.*?)\,.*?\'(.*)\'#",$line,$match))
{
return array('define'=>$match[1],'value'=>$match[2]);
}
}
function compareit($needle,$haystack,$value='',$disabled){
// return "Need=".$needle."<br />hack=".$haystack."<br />val=".$val;
//TODO Move this into a separate function (use a class for this whole script)
$commonPhrases = file_get_contents(e_LANGUAGEDIR."English/admin/lan_admin.php");
$commonLines = explode("\n",$commonPhrases);
foreach($commonLines as $line)
{
if($match = getDefined($line))
{
$id = $match['define'];
$ar[$id] = $match['value'];
}
}
// Check if a common phrases was used.
foreach($ar as $def=>$common)
{
if(strtoupper(trim($value)) == strtoupper($common))
{
//$text .= "<div style='color:yellow'><b>$common</b></div>";
$foundCommon = TRUE;
break;
}
}
foreach($haystack as $script)
{
$lines = explode("\n",$script);
$text .= "<td>";
$count = 1;
foreach($lines as $ln)
{
if(strpos($ln,$needle.'.')!==FALSE || strpos($ln,$needle.';')!==FALSE || strpos($ln,$needle.';')!==FALSE)
{
$text .= "Line:<b>".$count."</b> "; // "' Found";
$found = TRUE;
}
$count++;
}
if(!$found)
{
$text .= "-";
}
$text .= "</td>";
}
$color = $found ? "" : "background-color:pink";
if($foundCommon && $found)
{
$color = "background-color:yellow";
$disabled .= "<br /><i>".$common."</i> is a common phrase.<br />(Use <b>".$def."</b> instead.)";
// return "<tr><td style='width:25%;'>".$needle .$disabled. "</td><td></td></tr>";
}
return "<tr><td style='width:25%;$color'>".$needle .$disabled. "</td>".$text."</tr>";
}
/** /**
* Handle page DOM within the page header * Handle page DOM within the page header
* *
@@ -761,6 +1027,17 @@ function grab_lans($path, $language, $filter = "")
*/ */
function headerjs() function headerjs()
{ {
//FIXME breaking functionality. //FIXME breaking functionality.

View File

@@ -9,8 +9,8 @@
* Core SQL * Core SQL
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
* $Revision: 1.33 $ * $Revision: 1.34 $
* $Date: 2009-11-06 11:53:20 $ * $Date: 2009-11-07 11:20:28 $
* $Author: e107coders $ * $Author: e107coders $
*/ */
@@ -119,6 +119,26 @@ CREATE TABLE core (
) TYPE=MyISAM; ) TYPE=MyISAM;
# -------------------------------------------------------- # --------------------------------------------------------
#
# Table structure for table `core_media` - media manager
#
CREATE TABLE core_media (
media_id int(10) unsigned NOT NULL auto_increment,
media_caption varchar(255) NOT NULL default '',
media_description varchar(255) NOT NULL default '',
media_category int(10) unsigned NOT NULL default '0',
media_datestamp int(10) unsigned NOT NULL default '0',
media_url varchar(255) NOT NULL default '',
media_userclass varchar(255) NOT NULL default '',
media_tags text NOT NULL,
PRIMARY KEY (media_id)
) TYPE=MyISAM;
# #
# Table structure for table `dblog` - db/debug/rolling # Table structure for table `dblog` - db/debug/rolling
# #

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.57 $ | $Revision: 1.58 $
| $Date: 2009-11-04 03:37:56 $ | $Date: 2009-11-07 11:20:27 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -254,7 +254,7 @@ function update_706_to_800($type='')
// List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed) // List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed)
$new_tables = array('admin_log','audit_log', 'dblog','news_rewrite'); $new_tables = array('admin_log','audit_log', 'dblog','news_rewrite', 'core_media');
// List of core prefs that need to be converted from serialized to e107ArrayStorage. // List of core prefs that need to be converted from serialized to e107ArrayStorage.
$serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'"); $serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'");
@@ -346,14 +346,9 @@ function update_706_to_800($type='')
$s_prefs = $tp -> toDB($notify_prefs); $s_prefs = $tp -> toDB($notify_prefs);
$s_prefs = $eArrayStorage -> WriteArray($s_prefs); $s_prefs = $eArrayStorage -> WriteArray($s_prefs);
// Could we use $sysprefs->set($s_prefs,'notify_prefs') instead - avoids caching problems ???? // Could we use $sysprefs->set($s_prefs,'notify_prefs') instead - avoids caching problems ????
if ($sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'") === FALSE) $status = ($sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'") === FALSE) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
{ $message = str_replace('--COUNT--',$nt_changed,LAN_UPDATE_20);
$updateMessages[] = LAN_UPDATE_21; // Log error $mes->add($message, $status);
}
else
{
$updateMessages[] = str_replace('--COUNT--',$nt_changed,LAN_UPDATE_20); // Log success
}
} }
@@ -363,7 +358,7 @@ function update_706_to_800($type='')
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$pref['signup_option_customtitle'] = $pref['forum_user_customtitle']; $pref['signup_option_customtitle'] = $pref['forum_user_customtitle'];
unset($pref['forum_user_customtitle']); unset($pref['forum_user_customtitle']);
$updateMessages[] = LAN_UPDATE_22; $mes->add(LAN_UPDATE_20.'customtitle', E_MESSAGE_SUCCESS);
$do_save = TRUE; $do_save = TRUE;
} }
@@ -375,8 +370,8 @@ function update_706_to_800($type='')
if ($just_check) return update_needed(); if ($just_check) return update_needed();
while ($row = e107::getDb()->db_Fetch(MYSQL_ASSOC)) while ($row = e107::getDb()->db_Fetch(MYSQL_ASSOC))
{ {
e107::getDb('sql2')->db_Update('core',"e107_value=\"".convert_serialized($row['e107_value'])."\" WHERE e107_name='".$row['e107_name']."'"); $status = e107::getDb('sql2')->db_Update('core',"e107_value=\"".convert_serialized($row['e107_value'])."\" WHERE e107_name='".$row['e107_name']."'");
$updateMessages[] = "Converted Serialized prefs [".$row['e107_name']."]"; // LAN_UPDATE_23; $mes->add(LAN_UPDATE_22.$row['e107_name'], $status);
} }
} }
@@ -392,8 +387,8 @@ function update_706_to_800($type='')
{ {
if ($just_check) return update_needed('Menu path changed required: '.$val['menu'].' '); if ($just_check) return update_needed('Menu path changed required: '.$val['menu'].' ');
$updqry = "menu_path='".$val['newpath']."/' WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) "; $updqry = "menu_path='".$val['newpath']."/' WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) ";
$sql->db_Update("menus", $updqry); $status = $sql->db_Update("menus", $updqry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add('Updating Menu Path for <b>'.$val['menu'].'</b> from '.$val['oldpath'].' => '.$val['newpath'], E_MESSAGE_DEBUG); // LAN_UPDATE_25; $mes->add(LAN_UPDATE_23.'<b>'.$val['menu'].'</b> : '.$val['oldpath'].' => '.$val['newpath'], $status); // LAN_UPDATE_25;
// catch_error(); // catch_error();
} }
} }
@@ -410,14 +405,14 @@ function update_706_to_800($type='')
//if online_extended is activated, we need to activate the new 'online' menu, and delete this record //if online_extended is activated, we need to activate the new 'online' menu, and delete this record
if($row['menu_location']!=0) if($row['menu_location']!=0)
{ {
$sql->db_Update("menus", "menu_name='online_menu', menu_path='online/' WHERE menu_path='online_extended_menu' || menu_path='online_extended_menu/' "); $status = $sql->db_Update("menus", "menu_name='online_menu', menu_path='online/' WHERE menu_path='online_extended_menu' || menu_path='online_extended_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$updateMessages[] = LAN_UPDATE_30; $mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status);
} }
else else
{ //else if the menu is not active { //else if the menu is not active
//we need to delete the online_extended menu row, and change the online_menu to online //we need to delete the online_extended menu row, and change the online_menu to online
$sql->db_Delete("menus", " menu_path='online_extended_menu' || menu_path='online_extended_menu/' "); $sql->db_Delete("menus", " menu_path='online_extended_menu' || menu_path='online_extended_menu/' ");
$updateMessages[] = LAN_UPDATE_31; // $updateMessages[] = LAN_UPXXDATE_31;
} }
catch_error(); catch_error();
} }
@@ -426,8 +421,8 @@ function update_706_to_800($type='')
if($sql->db_Select("menus", "menu_path", "menu_path='online_menu' || menu_path='online_menu/'")) if($sql->db_Select("menus", "menu_path", "menu_path='online_menu' || menu_path='online_menu/'"))
{ {
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$sql->db_Update("menus", "menu_path='online/' WHERE menu_path='online_menu' || menu_path='online_menu/' "); $status = $sql->db_Update("menus", "menu_path='online/' WHERE menu_path='online_menu' || menu_path='online_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$updateMessages[] = LAN_UPDATE_32; $mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status);
catch_error(); catch_error();
} }
@@ -438,32 +433,35 @@ function update_706_to_800($type='')
if($sql->db_Field("comments","comment_author")) if($sql->db_Field("comments","comment_author"))
{ {
if ($just_check) return update_needed('Comment table author field update'); if ($just_check) return update_needed('Comment table author field update');
$commentMessage = LAN_UPDATE_33;
if ((!$sql->db_Field("comments","comment_author_id")) // Check to see whether new fields already added - maybe data copy failed part way through if ((!$sql->db_Field("comments","comment_author_id")) // Check to see whether new fields already added - maybe data copy failed part way through
&& (!$sql->db_Select_gen("ALTER TABLE `#comments` && (!$sql->db_Select_gen("ALTER TABLE `#comments`
ADD COLUMN comment_author_id int(10) unsigned NOT NULL default '0' AFTER `comment_author`, ADD COLUMN comment_author_id int(10) unsigned NOT NULL default '0' AFTER `comment_author`,
ADD COLUMN comment_author_name varchar(100) NOT NULL default '' AFTER `comment_author_id`"))) ADD COLUMN comment_author_name varchar(100) NOT NULL default '' AFTER `comment_author_id`")))
{ {
// Flag error // Flag error
$commentMessage = LAN_UPDATE_34; // $commentMessage = LAN_UPDAXXTE_34;
$mes->add(LAN_UPDATE_21."comments", E_MESSAGE_ERROR);
} }
else else
{ {
if (FALSE ===$sql->db_Update("comments","comment_author_id=SUBSTRING_INDEX(`comment_author`,'.',1), comment_author_name=SUBSTRING(`comment_author` FROM POSITION('.' IN `comment_author`)+1)")) if (FALSE ===$sql->db_Update("comments","comment_author_id=SUBSTRING_INDEX(`comment_author`,'.',1), comment_author_name=SUBSTRING(`comment_author` FROM POSITION('.' IN `comment_author`)+1)"))
{ {
// Flag error // Flag error
$commentMessage = LAN_UPDATE_35; $mes->add(LAN_UPDATE_21."comments", E_MESSAGE_ERROR);
} }
else else
{ // Delete superceded field - comment_author { // Delete superceded field - comment_author
if (!$sql->db_Select_gen("ALTER TABLE `#comments` DROP COLUMN `comment_author`")) if (!$sql->db_Select_gen("ALTER TABLE `#comments` DROP COLUMN `comment_author`"))
{ {
// Flag error // Flag error
$commentMessage = LAN_UPDATE_36; $mes->add(LAN_UPDATE_24."comments - comment_author", E_MESSAGE_ERROR);
} }
} }
} }
$updateMessages[] = $commentMessage; // Hopefully this will usually add the 'success' message
$mes->add(LAN_UPDATE_21."comments", E_MESSAGE_SUCCESS);
} }
@@ -501,7 +499,8 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Change front page prefs'); if ($just_check) return update_needed('Change front page prefs');
$pref['frontpage_force'] = array(e_UC_PUBLIC => ''); $pref['frontpage_force'] = array(e_UC_PUBLIC => '');
$pref['frontpage'] = array(e_UC_PUBLIC => 'news.php'); $pref['frontpage'] = array(e_UC_PUBLIC => 'news.php');
$updateMessages[] = LAN_UPDATE_38; // $_pdateMessages[] = LAN_UPDATE_38; //FIXME
$mes->add(LAN_UPDATE_20."frontpage",E_MESSAGE_SUCCESS);
$do_save = TRUE; $do_save = TRUE;
} }
@@ -514,14 +513,15 @@ function update_706_to_800($type='')
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(250)') if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(250)')
{ {
if ($just_check) return update_needed('Update newsfeed field definition'); if ($just_check) return update_needed('Update newsfeed field definition');
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."newsfeed` MODIFY `newsfeed_url` VARCHAR(250) NOT NULL DEFAULT '' "); $status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX."newsfeed` MODIFY `newsfeed_url` VARCHAR(250) NOT NULL DEFAULT '' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$updateMessages[] = LAN_UPDATE_40; $updateMessages[] = LAN_UPDATE_40; //FIXME
catch_error(); $mes->add(LAN_UPDATE_21."newsfeed",$status);
// catch_error();
} }
} }
} }
//TODO use generic function for this update.
if ($sql->db_Table_exists('download')) if ($sql->db_Table_exists('download'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'")) if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'"))
@@ -531,12 +531,13 @@ function update_706_to_800($type='')
{ {
if ($just_check) return update_needed('Update download table field definition'); if ($just_check) return update_needed('Update download table field definition');
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."download` MODIFY `download_url` VARCHAR(255) NOT NULL DEFAULT '' "); $sql->db_Select_gen("ALTER TABLE `".MPREFIX."download` MODIFY `download_url` VARCHAR(255) NOT NULL DEFAULT '' ");
$updateMessages[] = LAN_UPDATE_52; $updateMessages[] = LAN_UPDATE_52; //FIXME
catch_error(); catch_error();
} }
} }
} }
//TODO use generic function for this update.
if ($sql->db_Table_exists('download_mirror')) if ($sql->db_Table_exists('download_mirror'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql->db_Select_gen("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'")) if ($sql->db_Select_gen("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'"))
@@ -546,7 +547,7 @@ function update_706_to_800($type='')
{ {
if ($just_check) return update_needed('Update download mirror table field definition'); if ($just_check) return update_needed('Update download mirror table field definition');
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."download_mirror` MODIFY `mirror_url` VARCHAR(255) NOT NULL DEFAULT '' "); $sql->db_Select_gen("ALTER TABLE `".MPREFIX."download_mirror` MODIFY `mirror_url` VARCHAR(255) NOT NULL DEFAULT '' ");
$updateMessages[] = LAN_UPDATE_53; $updateMessages[] = LAN_UPDATE_53; //FIXME
catch_error(); catch_error();
} }
} }
@@ -561,7 +562,7 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Move user timezone info'); if ($just_check) return update_needed('Move user timezone info');
if (!copy_user_timezone()) if (!copy_user_timezone())
{ // Error doing the transfer { // Error doing the transfer
$updateMessages[] = LAN_UPDATE_42; $updateMessages[] = LAN_UPDATE_42; //FIXME
return FALSE; return FALSE;
} }
$updateMessages[] = LAN_UPDATE_41; $updateMessages[] = LAN_UPDATE_41;
@@ -576,19 +577,19 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Rename dblog to admin_log'); if ($just_check) return update_needed('Rename dblog to admin_log');
$sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'dblog` RENAME `'.MPREFIX.'admin_log`'); $sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'dblog` RENAME `'.MPREFIX.'admin_log`');
catch_error(); catch_error();
$updateMessages[] = LAN_UPDATE_43; $updateMessages[] = LAN_UPDATE_43; //FIXME
} }
// Next bit will be needed only by the brave souls who used an early CVS - probably delete before release // Next bit will be needed only by the brave souls who used an early CVS - probably delete before release
if ($sql->db_Table_exists('rl_history') && !$sql->db_Table_exists('dblog')) if ($sql->db_Table_exists('rl_history') && !$sql->db_Table_exists('dblog'))
{ {
if ($just_check) return update_needed('Rename rl_history to dblog'); if ($just_check) return update_needed('Rename rl_history to dblog');
$sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'rl_history` RENAME `'.MPREFIX.'dblog`'); $sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'rl_history` RENAME `'.MPREFIX.'dblog`');
$updateMessages[] = LAN_UPDATE_44; $updateMessages[] = LAN_UPDATE_44; //FIXME
catch_error(); catch_error();
} }
// New tables required (list at top. Definitions in core_sql.php) // New tables required (list at top. Definitions in core_sql.php)
foreach ($new_tables as $nt) foreach ($new_tables as $nt)
{ {
@@ -597,15 +598,16 @@ function update_706_to_800($type='')
if ($just_check) return update_needed("Add table: ".$nt); if ($just_check) return update_needed("Add table: ".$nt);
// Get the definition // Get the definition
$defs = $db_parser->get_table_def($nt,e_ADMIN."sql/core_sql.php"); $defs = $db_parser->get_table_def($nt,e_ADMIN."sql/core_sql.php");
if (count($defs)) if (count($defs)) // **** Add in table here
{ // **** Add in table here {
$sql->db_Select_gen('CREATE TABLE `'.MPREFIX.$defs[0][1].'` ('.$defs[0][2].') TYPE='.$defs[0][3]); $status = $sql->db_Select_gen('CREATE TABLE `'.MPREFIX.$defs[0][1].'` ('.$defs[0][2].') TYPE='.$defs[0][3]) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$updateMessages[] = LAN_UPDATE_45.$defs[0][1]; // $updateMessages[] = LAN_UPDATE_45.$defs[0][1];
catch_error(); $mes->add(LAN_UPDATE_27.$defs[0][1], $status); //TODO - all update messages should work like this.
// catch_error();
} }
else else
{ // error parsing defs file { // error parsing defs file
$updateMessages[] = LAN_UPDATE_46.$defs[0][1]; $mes->add(LAN_UPDATE_46.$defs[0][1], E_MESSAGE_ERROR);
} }
unset($defs); unset($defs);
} }
@@ -619,29 +621,45 @@ function update_706_to_800($type='')
{ {
$req_defs = $db_parser->get_table_def($ct,e_ADMIN."sql/core_sql.php"); $req_defs = $db_parser->get_table_def($ct,e_ADMIN."sql/core_sql.php");
$req_fields = $db_parser->parse_field_defs($req_defs[0][2]); // Required definitions $req_fields = $db_parser->parse_field_defs($req_defs[0][2]); // Required definitions
if ($debugLevel) echo "Required table structure: <br />".$db_parser->make_field_list($req_fields); if ($debugLevel)
{
$mes->add("Required table structure: <br />".$db_parser->make_field_list($req_fields), E_MESSAGE_DEBUG);
}
if ((($actual_defs = $db_parser->get_current_table($ct)) === FALSE) || !is_array($actual_defs)) // Adds current default prefix if ((($actual_defs = $db_parser->get_current_table($ct)) === FALSE) || !is_array($actual_defs)) // Adds current default prefix
{ {
echo "Couldn't get table structure: {$ct}<br />"; $mes->add("Couldn't get table structure: ".$ct, E_MESSAGE_DEBUG);
} }
else else
{ {
// echo $db_parser->make_table_list($actual_defs); // echo $db_parser->make_table_list($actual_defs);
$actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]); $actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]);
if ($debugLevel) echo "Actual table structure: <br />".$db_parser->make_field_list($actual_fields); if ($debugLevel)
{
$mes->add("Actual table structure: <br />".$db_parser->make_field_list($actual_fields), E_MESSAGE_DEBUG);
}
$diffs = $db_parser->compare_field_lists($req_fields,$actual_fields); $diffs = $db_parser->compare_field_lists($req_fields,$actual_fields);
if (count($diffs[0])) if (count($diffs[0]))
{ // Changes needed { // Changes needed
if ($just_check) return update_needed("Field changes rqd; table: ".$ct); if ($just_check) return update_needed("Field changes rqd; table: ".$ct);
// Do the changes here
if ($debugLevel) echo "List of changes found:<br />".$db_parser->make_changes_list($diffs); // Do the changes here
$qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]); if ($debugLevel)
if ($debugLevel) echo "Update Query used: ".$qry."<br />"; {
$sql->db_Select_gen($qry); $mes->add("List of changes found:<br />".$db_parser->make_changes_list($diffs), E_MESSAGE_DEBUG);
$updateMessages[] = LAN_UPDATE_47.$ct; }
catch_error();
$qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]);
if ($debugLevel)
{
$mes->add("Update Query used: ".$qry, E_MESSAGE_DEBUG);
}
$status = $sql->db_Select_gen($qry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_21.$ct, $status);
catch_error();
} }
} }
} }
@@ -704,7 +722,7 @@ function update_706_to_800($type='')
$mes->add($message, E_MESSAGE_DEBUG); $mes->add($message, E_MESSAGE_DEBUG);
} }
$sql->db_Select_gen($qry); $sql->db_Select_gen($qry);
$updateMessages[] = LAN_UPDATE_51.$ct; $updateMessages[] = LAN_UPDATE_51.$ct; //FIXME
catch_error(); catch_error();
} }
} }
@@ -719,7 +737,7 @@ function update_706_to_800($type='')
require_once(e_HANDLER."plugin_class.php"); require_once(e_HANDLER."plugin_class.php");
$ep = new e107plugin; $ep = new e107plugin;
$ep -> update_plugins_table(); $ep -> update_plugins_table();
$updateMessages[] = LAN_UPDATE_24; // $_pdateMessages[] = LAN_UPDATE_XX24;
// catch_error(); // catch_error();
} }
@@ -730,8 +748,8 @@ function update_706_to_800($type='')
if ($sql->db_Table_exists($ot)) if ($sql->db_Table_exists($ot))
{ {
if ($just_check) return update_needed("Delete table: ".$ot); if ($just_check) return update_needed("Delete table: ".$ot);
$sql->db_Select_gen('DROP TABLE `'.MPREFIX.$ot.'`'); $status = $sql->db_Select_gen('DROP TABLE `'.MPREFIX.$ot.'`') ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$updateMessages[] = LAN_UPDATE_48.$ot; $mes->add(LAN_UPDATE_25.$ot, $status);
} }
} }
@@ -747,9 +765,9 @@ function update_706_to_800($type='')
if (strtolower($field_info['Type']) != 'varchar(45)') if (strtolower($field_info['Type']) != 'varchar(45)')
{ {
if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t); if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t);
$sql->db_Select_gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `{$f}` VARCHAR(45) NOT NULL DEFAULT '';"); $status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `{$f}` VARCHAR(45) NOT NULL DEFAULT '';") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$updateMessages[] = LAN_UPDATE_49.$t.' - '.$f; $mes->add(LAN_UPDATE_26.$t.' - '.$f, $status);
catch_error(); // catch_error();
} }
} }
else else
@@ -777,8 +795,10 @@ function update_706_to_800($type='')
if ($do_save) if ($do_save)
{ {
save_prefs(); save_prefs();
$updateMessages[] = LAN_UPDATE_50.implode(', ',$accum); $updateMessages[] = LAN_UPDATE_50.implode(', ',$accum); // FIXME
} }
//FIXME grab message-stack from $mes for the log.
if ($just_check) return TRUE; if ($just_check) return TRUE;
$admin_log->log_event('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update $admin_log->log_event('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/file_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/file_class.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2009-11-05 08:07:48 $ | $Date: 2009-11-07 11:20:28 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -56,7 +56,7 @@ class e_file
{ {
var $dirFilter; // Array of directory names to ignore (in addition to any set by caller) var $dirFilter; // Array of directory names to ignore (in addition to any set by caller)
var $fileFilter; // Array of file names to ignore (in addition to any set by caller) var $fileFilter; // Array of file names to ignore (in addition to any set by caller)
var $mode = 'default';
// Constructor // Constructor
function e_file() function e_file()
@@ -141,10 +141,27 @@ class e_file
} }
} }
if($rejected == FALSE) if($rejected == FALSE)
{ {
$finfo['path'] = $path."/"; // important: leave this slash here and update other file instead. switch($this->mode) //TODO remove this check from the loop.
$finfo['fname'] = $file; {
$ret[] = $finfo; case 'fname':
$ret[] = $file;
break;
case 'path':
$ret[] = $path."/";
break;
case 'full':
$ret[] = $path."/".$file;
break;
default:
$finfo['path'] = $path."/"; // important: leave this slash here and update other file instead.
$finfo['fname'] = $file;
$ret[] = $finfo;
break;
}
} }
} }
} }

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: lan_admin.php,v 1.33 2009-11-05 08:07:53 e107coders Exp $ * $Id: lan_admin.php,v 1.34 2009-11-07 11:20:33 e107coders Exp $
* *
* Admin Language File * Admin Language File
*/ */
@@ -300,7 +300,7 @@ define("LAN_CATEGORY", "Category");
define("LAN_HELP", "Help"); define("LAN_HELP", "Help");
define("LAN_MENULAYOUT", "Menu Layout"); define("LAN_MENULAYOUT", "Menu Layout");
define("LAN_IMAGEMANAGER", "Image Manager"); define("LAN_MEDIAMANAGER", "Media Manager");
define("LAN_MOREINFO","More Information..."); define("LAN_MOREINFO","More Information...");
define("LAN_COMMENTMAN", "Comments Manager"); define("LAN_COMMENTMAN", "Comments Manager");

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: lan_e107_update.php,v 1.8 2008-12-30 15:56:12 secretr Exp $ * $Id: lan_e107_update.php,v 1.9 2009-11-07 11:20:34 e107coders Exp $
* *
* Administration Language File * Administration Language File
* *
@@ -10,7 +10,7 @@
define("LAN_UPDATE_2", "Action"); define("LAN_UPDATE_2", "Action");
define("LAN_UPDATE_3", "Not Needed"); define("LAN_UPDATE_3", "Not Needed");
define("LAN_UPDATE_5", "Update available"); // define("LAN_UPDATE_5", "Update available");
define("LAN_UPDATE_7", "Executed"); define("LAN_UPDATE_7", "Executed");
define("LAN_UPDATE_8", "Update from"); define("LAN_UPDATE_8", "Update from");
define("LAN_UPDATE_9", "to"); define("LAN_UPDATE_9", "to");
@@ -21,47 +21,37 @@ define("LAN_UPDATE_13", "Add additional/missing core settings");
define('LAN_UPDATE_14', 'Start version: '); define('LAN_UPDATE_14', 'Start version: ');
// Messages as part of 0.7 to 0.8 update process // Messages as part of 0.7 to 0.8 update process
define('LAN_UPDATE_20', 'Notify values written - --COUNT-- updates'); define('LAN_UPDATE_20', 'Updating Preference(s): ');
define('LAN_UPDATE_21', 'Error writing notify values'); define('LAN_UPDATE_21', 'Updating Table Structure: ');
define('LAN_UPDATE_22', 'Update customtitle'); define('LAN_UPDATE_22', "Converting Serialized Preference(s): ");
define('LAN_UPDATE_23', 'Update theme menu paths'); define('LAN_UPDATE_23', 'Updating Menu Path: ');
define('LAN_UPDATE_24', 'Update user menu paths'); define('LAN_UPDATE_24', "Deleting Deprecated Table Field: ");
define('LAN_UPDATE_25', 'Update compliance menu path'); define('LAN_UPDATE_25', 'Deleting obsolete table: ');
define('LAN_UPDATE_26', 'Update \'powered by\' menu path'); define('LAN_UPDATE_26', 'Extending IP address field: ');
define('LAN_UPDATE_27', 'Update sitebutton menu path'); define('LAN_UPDATE_27', 'Adding Table: ');
define('LAN_UPDATE_28', 'Update counter menu path');
define('LAN_UPDATE_29', 'Update \'last seen\' menu path'); // Everything below here needs reviewing.
define('LAN_UPDATE_30', 'Update online_extended to online menu');
define('LAN_UPDATE_31', 'Delete online_extended menu path'); // define('LAN_UPDATE_35', 'Error modifying data in comment table');
define('LAN_UPDATE_32', 'Update online_menu path'); // define('LAN_UPDATE_36', 'Error deleting old field in comment table');
define('LAN_UPDATE_33', 'Update comment table format'); // define('LAN_UPDATE_37', 'Add index --INDEX-- to table --TABLE--');
define('LAN_UPDATE_34', 'Error adding columns to comment table');
define('LAN_UPDATE_35', 'Error modifying data in comment table');
define('LAN_UPDATE_36', 'Error deleting old field in comment table');
define('LAN_UPDATE_37', 'Add index --INDEX-- to table --TABLE--');
define('LAN_UPDATE_38', 'Update front page settings'); define('LAN_UPDATE_38', 'Update front page settings');
define('LAN_UPDATE_39', 'Update linkwords table'); // define('LAN_UPDATE_39', 'Update linkwords table');
define('LAN_UPDATE_40', 'Update newsfeeds table'); define('LAN_UPDATE_40', 'Update newsfeeds table');
define('LAN_UPDATE_41', 'User timezone field processed'); define('LAN_UPDATE_41', 'User timezone field processed');
define('LAN_UPDATE_42', 'Error transferring user timezone data - aborted'); define('LAN_UPDATE_42', 'Error transferring user timezone data - aborted');
define('LAN_UPDATE_43', 'Rename dblog table'); define('LAN_UPDATE_43', 'Rename dblog table');
define('LAN_UPDATE_44', 'Rename rolling log table'); define('LAN_UPDATE_44', 'Rename rolling log table');
define('LAN_UPDATE_45', 'Add new table to database: '); define('LAN_UPDATE_45', 'Adding new table to database: ');
define('LAN_UPDATE_46', 'Error reading table definition: '); define('LAN_UPDATE_46', 'Error reading table definition: ');
define('LAN_UPDATE_47', 'Update table definition: ');
define('LAN_UPDATE_48', 'Delete obsolete table: ');
define('LAN_UPDATE_49', 'Extend IP address field: ');
define('LAN_UPDATE_50', 'Obsolete prefs deleted: '); define('LAN_UPDATE_50', 'Obsolete prefs deleted: ');
define('LAN_UPDATE_51', 'Update plugin table definition: '); define('LAN_UPDATE_51', 'Update plugin table definition: ');
define('LAN_UPDATE_52', 'Update downloads table'); define('LAN_UPDATE_52', 'Update downloads table');
define('LAN_UPDATE_53', 'Update download mirror table'); define('LAN_UPDATE_53', 'Update download mirror table');
define('LAN_UPDATE_54', 'Missing table --TABLE-- - cannot add index --INDEX--'); // define('LAN_UPDATE_54', 'Missing table --TABLE-- - cannot add index --INDEX--');
define('LAN_UPDATE_55', 'Description'); define('LAN_UPDATE_55', 'Description');
define('LAN_UPDATE_56', 'System Update'); // define('LAN_UPDATE_56', 'System Update');
define('LAN_UPDATE_57', '');
define('LAN_UPDATE_58', '');
define('LAN_UPDATE_59', '');
define('LAN_UPDATE_60', '');
define('LAN_UPDATE_CAPTION_PLUGIN', 'Plugin Updates'); define('LAN_UPDATE_CAPTION_PLUGIN', 'Plugin Updates');
define('LAN_UPDATE_CAPTION_CORE', 'Core Updates'); define('LAN_UPDATE_CAPTION_CORE', 'Core Updates');