mirror of
https://github.com/e107inc/e107.git
synced 2025-08-10 16:46:50 +02:00
Work on Media-Manager
This commit is contained in:
@@ -139,27 +139,33 @@ class page_admin extends e_admin_dispatcher
|
||||
|
||||
class page_admin_form_ui extends e_admin_form_ui
|
||||
{
|
||||
/*public function faq_info_parent($curVal,$mode)
|
||||
|
||||
function page_title($curVal,$mode,$parm)
|
||||
{
|
||||
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter
|
||||
// Get UI instance
|
||||
$controller = $this->getController();
|
||||
switch($mode)
|
||||
// $parm = $this->getController()->getUI()->getDataFields(); //$model->getData();
|
||||
// print_a($parm);
|
||||
$parm = "";
|
||||
if($mode == 'read') // FIXME - Link not working as intended.
|
||||
{
|
||||
case 'read':
|
||||
return e107::getParser()->toHTML($controller->getFaqCategoryTree($curVal), false, 'TITLE');
|
||||
break;
|
||||
|
||||
case 'write':
|
||||
return $this->selectbox('faq_info_parent', $controller->getFaqCategoryTree(), $curVal);
|
||||
break;
|
||||
|
||||
case 'filter':
|
||||
case 'batch':
|
||||
return $controller->getFaqCategoryTree();
|
||||
break;
|
||||
return "<a href='".e_BASE."page.php?".$parm."' >".$curVal."</a>";
|
||||
}
|
||||
}*/
|
||||
|
||||
if($mode == 'write')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if($mode == 'filter')
|
||||
{
|
||||
return;
|
||||
}
|
||||
if($mode == 'batch')
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +190,7 @@ class page_admin_ui extends e_admin_ui
|
||||
protected $fields = array(
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'page_id' => array('title'=> 'ID', 'width'=>'5%', 'forced'=> TRUE),
|
||||
'page_title' => array('title'=> CUSLAN_1, 'type' => 'text', 'width'=>'auto'),
|
||||
'page_title' => array('title'=> CUSLAN_1, 'type' => 'method', 'width'=>'auto'),
|
||||
'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true),
|
||||
'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto'),
|
||||
'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'width' => 'auto', 'thclass' => 'left'),
|
||||
@@ -785,6 +791,8 @@ class page_admin_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
require_once('auth.php');
|
||||
new page_admin();
|
||||
|
||||
|
@@ -33,13 +33,14 @@ $frm = e107::getForm();
|
||||
function run_updates($dbupdate)
|
||||
{
|
||||
global $mes;
|
||||
|
||||
foreach($dbupdate as $func => $rmks)
|
||||
{
|
||||
if(function_exists('update_'.$func)) // Legacy Method.
|
||||
{
|
||||
$installed = call_user_func("update_".$func);
|
||||
//?! (LAN_UPDATE == $_POST[$func])
|
||||
if(varsettrue($_POST[$func]) && !$installed)
|
||||
if(varsettrue($_POST['update_core'][$func]) && !$installed)
|
||||
{
|
||||
if(function_exists("update_".$func))
|
||||
{
|
||||
@@ -117,7 +118,7 @@ function show_updates($dbupdate, $what)
|
||||
else
|
||||
{
|
||||
$updates ++;
|
||||
$text .= "<td>".$frm->admin_button($func, LAN_UPDATE, 'update', '', "id=e-{$func}")."</td>";
|
||||
$text .= "<td>".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'update', '', "id=e-{$func}")."</td>";
|
||||
}
|
||||
$text .= "</tr>\n";
|
||||
}
|
||||
@@ -151,7 +152,7 @@ function show_updates($dbupdate, $what)
|
||||
return $updates; // Number of updates to do
|
||||
}
|
||||
|
||||
if($_POST['update'])
|
||||
if(is_array($_POST['update_core']))
|
||||
{
|
||||
$message = run_updates($dbupdate);
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ if (!defined('ADMIN_AREA'))
|
||||
}
|
||||
define("USER_AREA", FALSE);
|
||||
|
||||
$sql->db_Mark_Time('(Header Top)');
|
||||
e107::getDb()->db_Mark_Time('(Header Top)');
|
||||
|
||||
//
|
||||
// *** Code sequence for headers ***
|
||||
@@ -262,7 +262,7 @@ if ((strpos(e_SELF, 'fileinspector.php') === FALSE) && getperms("0"))
|
||||
echo "<script type='text/javascript'>
|
||||
<!--
|
||||
function savepreset(ps,pid){
|
||||
if(confirm('".$tp->toJS(LAN_PRESET_CONFIRMSAVE)."'))
|
||||
if(confirm('".e107::getParser()->toJS(LAN_PRESET_CONFIRMSAVE)."'))
|
||||
{
|
||||
document.getElementById(ps).action='".e_SELF."?savepreset.'+pid;
|
||||
document.getElementById(ps).submit();
|
||||
@@ -385,7 +385,7 @@ echo "</head>
|
||||
// Header included notification, from this point header includes are not possible
|
||||
define('HEADER_INIT', TRUE);
|
||||
|
||||
$sql->db_Mark_Time("End Head, Start Body");
|
||||
e107::getDb()->db_Mark_Time("End Head, Start Body");
|
||||
|
||||
//
|
||||
// K: (The rest is ignored for popups, which have no menus)
|
||||
|
@@ -12,7 +12,12 @@
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
require_once("../class2.php");
|
||||
|
||||
if (!defined('e107_INIT'))
|
||||
{
|
||||
require_once("../class2.php");
|
||||
}
|
||||
|
||||
if (!getperms("A"))
|
||||
{
|
||||
header("location:".e_HTTP."index.php");
|
||||
@@ -61,9 +66,9 @@ class media_admin extends e_admin_dispatcher
|
||||
protected $adminMenu = array(
|
||||
'main/list' => array('caption'=> 'Media Library', 'perm' => 'A'),
|
||||
'main/create' => array('caption'=> "Add New Media", 'perm' => 'A'), // Should be handled in Media-Import.
|
||||
'main/import' => array('caption'=> "Media Import", 'perm' => 'A'),
|
||||
'main/import' => array('caption'=> "Media Import", 'perm' => 'A|A2'),
|
||||
'cat/list' => array('caption'=> 'Media Categories', 'perm' => 'A'),
|
||||
// 'cat/create' => array('caption'=> "Create Category", 'perm' => 'A'), // is automatic.
|
||||
'cat/create' => array('caption'=> "Create Category", 'perm' => 'A'), // is automatic.
|
||||
// 'main/icons' => array('caption'=> IMALAN_71, 'perm' => 'A'),
|
||||
'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'A'),
|
||||
|
||||
@@ -102,56 +107,74 @@ class media_cat_ui extends e_admin_ui
|
||||
protected $pid = "media_cat_id";
|
||||
protected $perPage = 0; //no limit
|
||||
protected $batchDelete = false;
|
||||
|
||||
public $ownerCount = array();
|
||||
// protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit.
|
||||
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
||||
|
||||
protected $fields = array(
|
||||
//'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'media_cat_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
|
||||
'media_cat_nick' => array('title'=> "Nickname", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE),
|
||||
'media_cat_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE),
|
||||
'media_cat_diz' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=150&bb=1','readonly'=>TRUE), // Display name
|
||||
'media_cat_image' => array('title'=> LAN_IMAGE, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE),
|
||||
'media_cat_owner' => array('title'=> "Owner", 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
|
||||
'media_cat_category' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE),
|
||||
'media_cat_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
|
||||
'media_cat_diz' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=150&bb=1','readonly'=>FALSE), // Display name
|
||||
'media_cat_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'),
|
||||
// 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
'media_cat_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => '5%', 'thclass' => 'right', 'class'=> 'right' ),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
);
|
||||
|
||||
/**
|
||||
* Get FAQ Category data
|
||||
*
|
||||
* @param integer $id [optional] get category title, false - return whole array
|
||||
* @param mixed $default [optional] default value if not found (default 'n/a')
|
||||
* @return TBD
|
||||
*/
|
||||
function getMediaCategoryTree($id = false, $default = 'n/a')
|
||||
function init()
|
||||
{
|
||||
// TODO get faq category tree
|
||||
$this->fields['media_cat_owner']['writeParms'] = array(
|
||||
"_common" => "_common",
|
||||
"news" => "news",
|
||||
"page" => "page",
|
||||
"download" => "download",
|
||||
"gallery" => "gallery"
|
||||
);
|
||||
|
||||
$sql = e107::getDb();
|
||||
$sql->db_Select_gen("SELECT media_cat_owner, count(media_cat_id) as number FROM `#core_media_cat` GROUP BY media_cat_owner");
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
$this->ownerCount[$row['media_cat_owner']] = $row['number'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function beforeCreate($new_data)
|
||||
{
|
||||
|
||||
//$replace = array("_"," ","'",'"',"."); //FIXME Improve
|
||||
//$new_data['media_cat_category'] = str_replace($replace,"-",$new_data['media_cat_category']);
|
||||
|
||||
$increment = ($this->ownerCount[$new_data['media_cat_owner']] +1);
|
||||
$new_data['media_cat_category'] = $new_data['media_cat_owner']."_".$increment;
|
||||
|
||||
return $new_data;
|
||||
}
|
||||
|
||||
|
||||
public function beforeUpdate($new_data, $old_data, $id)
|
||||
{
|
||||
$mes = e107::getMessage();
|
||||
|
||||
if($new_data['media_cat_owner'] != "gallery")
|
||||
{
|
||||
$mes->addError("Modification is not permitted");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $new_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class faq_cat_form_ui extends e_admin_form_ui
|
||||
class media_cat_form_ui extends e_admin_form_ui
|
||||
{
|
||||
/*public function faq_info_parent($curVal,$mode)
|
||||
{
|
||||
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter
|
||||
// Get UI instance
|
||||
$controller = $this->getController();
|
||||
switch($mode)
|
||||
{
|
||||
case 'read':
|
||||
return e107::getParser()->toHTML($controller->getFaqCategoryTree($curVal), false, 'TITLE');
|
||||
break;
|
||||
|
||||
case 'write':
|
||||
return $this->selectbox('faq_info_parent', $controller->getFaqCategoryTree(), $curVal);
|
||||
break;
|
||||
|
||||
case 'filter':
|
||||
case 'batch':
|
||||
return $controller->getFaqCategoryTree();
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@@ -160,24 +183,28 @@ class faq_cat_form_ui extends e_admin_form_ui
|
||||
class media_form_ui extends e_admin_form_ui
|
||||
{
|
||||
|
||||
//private $cats = array();
|
||||
|
||||
function init()
|
||||
{
|
||||
/*$sql = e107::getDb();
|
||||
// $sql->db_Select_gen("SELECT media_cat_title, media_title_nick FROM #core_media as m LEFT JOIN #core_media_cat as c ON m.media_category = c.media_cat_nick GROUP BY m.media_category");
|
||||
$sql->db_Select_gen("SELECT media_cat_title, media_cat_nick FROM #core_media_cat");
|
||||
// $sql->db_Select_gen("SELECT media_cat_title, media_title_nick FROM #core_media as m LEFT JOIN #core_media_cat as c ON m.media_category = c.media_cat_owner GROUP BY m.media_category");
|
||||
$sql->db_Select_gen("SELECT media_cat_title, media_cat_owner FROM #core_media_cat");
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
$cat = $row['media_cat_nick'];
|
||||
$cat = $row['media_cat_owner'];
|
||||
$this->cats[$cat] = $row['media_cat_title'];
|
||||
}
|
||||
asort($this->cats);*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
|
||||
{
|
||||
|
||||
|
||||
if($mode == 'read')
|
||||
{
|
||||
return $this->getController()->getMediaCategory($curVal);
|
||||
@@ -238,9 +265,9 @@ class media_admin_ui extends e_admin_ui
|
||||
protected $fields = array(
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'media_id' => array('title'=> LAN_ID, 'type' => 'number', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE, 'nolist'=>TRUE),
|
||||
'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>TRUE, 'writeParams' => 'path={e_MEDIA}', 'width' => '110px','readonly'=>false),
|
||||
'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>TRUE, 'writeParams' => 'path={e_MEDIA}', 'width' => '110px'),
|
||||
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,),
|
||||
|
||||
|
||||
// Upload should be managed completely separately via upload-handler.
|
||||
'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParms' => 'hidden', 'writeParms' => 'disable_button=1', 'width' => '10%', 'nolist' => true),
|
||||
'media_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data'=> 'str', 'width' => 'auto'),
|
||||
@@ -282,19 +309,25 @@ class media_admin_ui extends e_admin_ui
|
||||
);*/
|
||||
|
||||
protected $cats = array();
|
||||
protected $owner = array();
|
||||
protected $ownercats = array();
|
||||
|
||||
|
||||
function init()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
// $sql->db_Select_gen("SELECT media_cat_title, media_title_nick FROM #core_media as m LEFT JOIN #core_media_cat as c ON m.media_category = c.media_cat_nick GROUP BY m.media_category");
|
||||
$sql->db_Select_gen("SELECT media_cat_title, media_cat_nick FROM #core_media_cat");
|
||||
// $sql->db_Select_gen("SELECT media_cat_title, media_title_nick FROM #core_media as m LEFT JOIN #core_media_cat as c ON m.media_category = c.media_cat_owner GROUP BY m.media_category");
|
||||
$sql->db_Select_gen("SELECT media_cat_title, media_cat_owner, media_cat_category FROM #core_media_cat");
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
$cat = $row['media_cat_nick'];
|
||||
$cat = $row['media_cat_category'];
|
||||
$owner = $row['media_cat_owner'];
|
||||
$this->owner[$owner] = $owner;
|
||||
$this->ownercats[$owner.'|'.$cat] = $row['media_cat_title'];
|
||||
$this->cats[$cat] = $row['media_cat_title'];
|
||||
}
|
||||
asort($this->cats);
|
||||
|
||||
|
||||
|
||||
if(varset($_POST['batch_import_selected']))
|
||||
{
|
||||
@@ -548,6 +581,8 @@ class media_admin_ui extends e_admin_ui
|
||||
<th class='center'>".e107::getForm()->checkbox_toggle('e-column-toggle', 'batch_selected')."</th>
|
||||
<th class='center' style='width:50px'>Preview</th>
|
||||
<th class='center'>".LAN_FILE."</th>
|
||||
<th >Title</th>
|
||||
<th >Caption</th>
|
||||
<th>Mime Type</th>
|
||||
<th>File Size</th>
|
||||
<th>".LAN_DATESTAMP."</th>
|
||||
@@ -555,19 +590,24 @@ class media_admin_ui extends e_admin_ui
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>";
|
||||
|
||||
|
||||
$c = 0;
|
||||
foreach($files as $f)
|
||||
{
|
||||
|
||||
$text .= "<tr>
|
||||
<td class='center'>".$frm->checkbox("batch_selected[]",$f['fname'])."</td>
|
||||
<td class='center'>".$this->preview($f)."</td>
|
||||
<td class='center'>".$frm->checkbox("batch_selected[$c]",$f['fname'])."</td>
|
||||
<td class='center'>".$this->preview($f)."</td>
|
||||
<td>".$f['fname']."</td>
|
||||
<td>".$frm->text('batch_import_name[$c]', $f['fname'])."</td>
|
||||
<td>".$frm->textarea('batch_import_diz[$c]', $_POST['batch_import_diz'][$c])."</td>
|
||||
<td>".$f['mime']."</td>
|
||||
<td>".$f['fsize']."</td>
|
||||
<td>".e107::getDateConvert()->convert_date($f['modified'])."</td>
|
||||
<td class='center last'>".$f['img-width']." x ".$f['img-height']."</td>
|
||||
</tr>";
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
|
||||
@@ -620,7 +660,7 @@ class media_admin_ui extends e_admin_ui
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
require(e_HANDLER.'phpthumb/ThumbLib.inc.php'); // For resizing on import.
|
||||
list($img_import_w,$img_import_h) = explode("x",e107::getPref('img_import_resize'));
|
||||
|
||||
@@ -635,9 +675,9 @@ class media_admin_ui extends e_admin_ui
|
||||
$WM = FALSE;
|
||||
}
|
||||
|
||||
foreach($_POST['batch_selected'] as $file)
|
||||
foreach($_POST['batch_selected'] as $key=>$file)
|
||||
{
|
||||
|
||||
|
||||
$oldpath = e_MEDIA."temp/".$file;
|
||||
|
||||
// Resize on Import Routine ------------------------
|
||||
@@ -677,23 +717,25 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
|
||||
$newpath = $this->getPath($f['mime']).'/'.$file;
|
||||
|
||||
$newname = $tp->toDB($_POST['batch_import_name'][$key]);
|
||||
$newdiz = $tp->toDB($_POST['batch_import_diz'][$key]);
|
||||
|
||||
// echo "oldpath=".$file;
|
||||
//
|
||||
// echo "<br />newpath=".$tp->createConstants($newpath,'rel');
|
||||
// continue;
|
||||
$f['fname'] = $file;
|
||||
|
||||
|
||||
if(rename($oldpath,$newpath))
|
||||
{
|
||||
$insert = array(
|
||||
'media_caption' => $f['fname'],
|
||||
'media_caption' => $newdiz,
|
||||
'media_description' => '',
|
||||
'media_category' => $_POST['batch_category'],
|
||||
'media_datestamp' => $f['modified'],
|
||||
'media_url' => $tp->createConstants($newpath,'rel'),
|
||||
'media_userclass' => 0,
|
||||
'media_name' => $f['fname'],
|
||||
'media_name' => $newname,
|
||||
'media_author' => USERID,
|
||||
'media_size' => $f['fsize'],
|
||||
'media_dimensions' => $f['img-width']." x ".$f['img-height'],
|
||||
|
@@ -142,12 +142,15 @@ CREATE TABLE core_media (
|
||||
|
||||
CREATE TABLE core_media_cat (
|
||||
media_cat_id int(10) unsigned NOT NULL auto_increment,
|
||||
media_cat_nick varchar(255) NOT NULL default '',
|
||||
media_cat_owner varchar(255) NOT NULL default '',
|
||||
media_cat_category varchar(255) NOT NULL default '',
|
||||
media_cat_title text NOT NULL,
|
||||
media_cat_diz text NOT NULL,
|
||||
media_cat_class int(5) default '0',
|
||||
media_cat_image varchar(255) NOT NULL default '',
|
||||
media_cat_order int(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (media_cat_id),
|
||||
UNIQUE KEY media_cat_nick (media_cat_nick)
|
||||
UNIQUE KEY media_cat_category (media_cat_category)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
|
||||
|
@@ -982,50 +982,105 @@ function update_706_to_800($type='')
|
||||
|
||||
//-- Media-manger import --------------------------------------------------
|
||||
|
||||
$med = e107::getMedia();
|
||||
$med = e107::getMedia();
|
||||
|
||||
$count = $sql->db_Select_gen("SELECT * FROM `#core_media_cat` WHERE `media_cat_nick` = '_common' ");
|
||||
// Media Category Update
|
||||
if($sql->db_Field("core_media_cat","media_cat_nick"))
|
||||
{
|
||||
$count = $sql->db_Select_gen("SELECT * FROM `#core_media_cat` WHERE media_cat_nick = '_common' ");
|
||||
if($count ==1)
|
||||
{
|
||||
if ($just_check) return update_needed('Media-Manager Categories needs to be updated.');
|
||||
$sql->db_Update('core_media_cat', "media_cat_owner = media_cat_nick, media_cat_category = media_cat_nick WHERE media_cat_nick REGEXP '_common|news|page|_icon_16|_icon_32|_icon_48|_icon_64' ");
|
||||
$sql->db_Update('core_media_cat', "media_cat_owner = '_icon', media_cat_category = media_cat_nick WHERE media_cat_nick REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ");
|
||||
$sql->db_Update('core_media_cat', "media_cat_owner = 'download', media_cat_category='download_image' WHERE media_cat_nick = 'download' ");
|
||||
$sql->db_Update('core_media_cat', "media_cat_owner = 'download', media_cat_category='download_thumb' WHERE media_cat_nick = 'downloadthumb' ");
|
||||
$sql->db_Update('core_media_cat', "media_cat_owner = 'news', media_cat_category='thumb' WHERE media_cat_nick = 'newsthumb' ");
|
||||
e107::getMessage()->addDebug("core-media-cat Categories and Ownership updated");
|
||||
if(mysql_query("ALTER TABLE `".MPREFIX."core_media_cat` DROP `media_cat_nick`"))
|
||||
{
|
||||
e107::getMessage()->addDebug("core-media-cat `media_cat_nick` field removed.");
|
||||
}
|
||||
|
||||
$query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_owner`, `media_cat_category`, `media_cat_title`, `media_cat_diz`, `media_cat_class`, `media_cat_image`, `media_cat_order`) VALUES
|
||||
(0, 'gallery', 'gallery_1', 'Gallery 1', 'Visible to the public at /gallery.php', 0, '', 0);
|
||||
";
|
||||
|
||||
if(mysql_query($query))
|
||||
{
|
||||
e107::getMessage()->addDebug("Added core-media-cat Gallery.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Media Update
|
||||
$count = $sql->db_Select_gen("SELECT * FROM `#core_media` WHERE media_category = 'newsthumb' OR media_category = 'downloadthumb' LIMIT 1 ");
|
||||
if($count ==1)
|
||||
{
|
||||
if ($just_check) return update_needed('Media-Manager Data needs to be updated.');
|
||||
$sql->db_Update('core_media', "media_category='download_image' WHERE media_category = 'download' ");
|
||||
$sql->db_Update('core_media', "media_category='download_thumb' WHERE media_category = 'downloadthumb' ");
|
||||
$sql->db_Update('core_media', "media_category='news_thumb' WHERE media_category = 'newsthumb' ");
|
||||
e107::getMessage()->addDebug("core-media Category names updated");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$count = $sql->db_Select_gen("SELECT * FROM `#core_media_cat` WHERE `media_cat_owner` = '_common' ");
|
||||
|
||||
if($count != 1)
|
||||
{
|
||||
if ($just_check) return update_needed('Add Media-Manager Categories and Import existing images.');
|
||||
|
||||
$query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_nick`, `media_cat_title`, `media_cat_diz`, `media_cat_class`) VALUES
|
||||
(0, '_common', '(Common Area)', 'Media in this category will be available in all areas of admin. ', 253),
|
||||
(0, 'news', 'News', 'Will be available in the news area. ', 253),
|
||||
(0, 'page', 'Custom Pages', 'Will be available in the custom pages area of admin. ', 253),
|
||||
(0, 'download', 'Download Images', '', 253),
|
||||
(0, 'downloadthumb', 'Download Thumbnails (legacy)', '', 253),
|
||||
(0, 'newsthumb', 'News Thumbnails (legacy)', '', 253);";
|
||||
$query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_owner`, `media_cat_title`, `media_cat_diz`, `media_cat_class`) VALUES
|
||||
(1, '_common', '_common', '(Common Area)', 'Media in this category will be available in all areas of admin. ', 253, '', 0),
|
||||
(2, 'news', 'news', 'News', 'Will be available in the news area. ', 253, '', 0),
|
||||
(3, 'page', 'page', 'Custom Pages', 'Available in the custom pages area of admin. ', 253, '', 0),
|
||||
(4, 'gallery', 'gallery_1', 'Gallery 1', 'Available to the public at /gallery.php ', 0, '', 0),
|
||||
(5, 'download', 'thumb', 'Download Thumbnails', 'Available to the downloads plugin', 253, '', 0),
|
||||
(6, 'download', 'image', 'Download Images', 'Available to the downloads plugin', 253, '', 0),
|
||||
(7, '_icon', '_icon_16', 'Icons 16px', 'Available where icons are used in admin. ', 253, '', 0),
|
||||
(8, '_icon', '_icon_32', 'Icons 32px', 'Available where icons are used in admin. ', 253, '', 0),
|
||||
(9, '_icon', '_icon_48', 'Icons 48px', 'Available where icons are used in admin. ', 253, '', 0),
|
||||
(10, '_icon', '_icon_64', 'Icons 64px', 'Available where icons are used in admin. ', 253, '', 0);
|
||||
|
||||
";
|
||||
|
||||
mysql_query($query);
|
||||
|
||||
$med->import('newsthumb',e_IMAGE.'newspost_images',"^thumb_");
|
||||
$med->import('news_thumb', e_IMAGE.'newspost_images',"^thumb_");
|
||||
$med->import('news',e_IMAGE.'newspost_images');
|
||||
$med->import('page',e_IMAGE.'custom');
|
||||
|
||||
}
|
||||
|
||||
// Check for Legacy Download Images.
|
||||
if(!$sql->db_Select_gen("SELECT * FROM `#core_media` WHERE `media_category` = 'download' "))
|
||||
|
||||
$fl = e107::getFile();
|
||||
$dl_images = $fl->get_files(e_FILE.'downloadimages');
|
||||
|
||||
if(count($dl_images) && !$sql->db_Select_gen("SELECT * FROM `#core_media` WHERE `media_category` = 'download_image' "))
|
||||
{
|
||||
if ($just_check) return update_needed('Import Download Images into Media Manager');
|
||||
$med->import('download',e_FILE.'downloadimages');
|
||||
$med->import('downloadthumb',e_FILE.'downloadthumbs');
|
||||
$med->import('download_image',e_FILE.'downloadimages');
|
||||
$med->import('download_thumb',e_FILE.'downloadthumbs');
|
||||
}
|
||||
|
||||
|
||||
$count = $sql->db_Select_gen("SELECT * FROM `#core_media_cat` WHERE media_cat_nick='_icon_16' OR media_cat_nick='_icon_32' ");
|
||||
$count = $sql->db_Select_gen("SELECT * FROM `#core_media_cat` WHERE media_cat_owner='_icon' ");
|
||||
|
||||
if($count < 2)
|
||||
if(!$count)
|
||||
{
|
||||
if ($just_check) return update_needed('Add icons to media-manager');
|
||||
|
||||
$query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_nick`, `media_cat_title`, `media_cat_diz`, `media_cat_class`) VALUES
|
||||
(0, '_icon_16', 'Icons 16px', 'Available where icons are used in admin. ', 253),
|
||||
(0, '_icon_32', 'Icons 32px', 'Available where icons are used in admin. ', 253),
|
||||
(0, '_icon_48', 'Icons 48px', 'Available where icons are used in admin. ', 253),
|
||||
(0, '_icon_64', 'Icons 64px', 'Available where icons are used in admin. ', 253);";
|
||||
|
||||
$query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_owner`, `media_cat_category`, `media_cat_title`, `media_cat_diz`, `media_cat_class`, `media_cat_image`, `media_cat_order`) VALUES
|
||||
(0, '_icon', '_icon_16', 'Icons 16px', 'Available where icons are used in admin. ', 253, '', 0),
|
||||
(0, '_icon', '_icon_32', 'Icons 32px', 'Available where icons are used in admin. ', 253, '', 0),
|
||||
(0, '_icon', '_icon_48', 'Icons 48px', 'Available where icons are used in admin. ', 253, '', 0),
|
||||
(0, '_icon', '_icon_64', 'Icons 64px', 'Available where icons are used in admin. ', 253, '', 0);
|
||||
";
|
||||
|
||||
if(!mysql_query($query))
|
||||
{
|
||||
@@ -1035,7 +1090,6 @@ function update_706_to_800($type='')
|
||||
|
||||
$med->importIcons(e_PLUGIN);
|
||||
$med->importIcons(e_IMAGE."icons/");
|
||||
$med->importIcons(e_IMAGE."icons/",16);
|
||||
$med->importIcons(e_THEME.$pref['sitetheme']."/images/");
|
||||
e107::getMessage()->addDebug("Icon category added");
|
||||
}
|
||||
|
@@ -31,14 +31,14 @@ if ($parm == '')
|
||||
else
|
||||
{
|
||||
$type = $tp -> toAttribute($parm);
|
||||
$listtext = "\n<ol class='bbcode' style='list-style-type: $type'>";
|
||||
$listtext = "\n<ol class='bbcode ".$type."' style='list-style-type: $type'>";
|
||||
$trailer = "</ol>";
|
||||
}
|
||||
foreach($listitems as $item)
|
||||
{
|
||||
if($item && $item != E_NL)
|
||||
{
|
||||
$listtext .= "<li class='bbcode'>$item</li>";
|
||||
$listtext .= "<li class='bbcode ".$type."'>$item</li>";
|
||||
}
|
||||
}
|
||||
return $listtext.$trailer;
|
||||
|
@@ -204,7 +204,23 @@ class e_form
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (".USERCLASS_LIST.") ";
|
||||
$qry .= vartrue($sc_parameters['media']) ? " AND (`media_category` = '".$tp->toDB($sc_parameters['media'])."' OR `media_category` = '_common' )" : " AND `media_category` = '_common' "; // " AND `media_category` NOT REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
|
||||
|
||||
// Old Method
|
||||
$qry .= vartrue($sc_parameters['media']) ? " AND (`media_category` = '".$tp->toDB($sc_parameters['media'])."' OR `media_category` = '_common' )" : " AND `media_category` = '_common' ";
|
||||
|
||||
// New Method
|
||||
/*
|
||||
if(vartrue($sc_parameters['owner']) && vartrue($sc_parameters['cat']))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
$qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (".USERCLASS_LIST.") ";
|
||||
$qry .= " AND (`media_owner` = '".$tp->toDB($sc_parameters['owner'])."' AND `media_category` = '".$tp->toDB($sc_parameters['cat'])."' ) OR `media_owner` = '_common' ";
|
||||
} */
|
||||
|
||||
|
||||
$qry .= "ORDER BY media_name";
|
||||
|
||||
|
||||
@@ -247,6 +263,7 @@ class e_form
|
||||
$thpath = isset($sc_parameters['nothumb']) || $hide ? $default : $tp->thumbUrl($default_thumb, 'w='.$width, true);
|
||||
$ret .= "<img src='{$thpath}' alt='{$default_url}' class='image-selector' /></a>";
|
||||
$ret .= "</div>\n";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
// ----------------
|
||||
@@ -1836,6 +1853,8 @@ class e_form
|
||||
|
||||
case 'hidden':
|
||||
$ret = (vartrue($parms['show']) ? ($value ? $value : varset($parms['empty'], $value)) : '');
|
||||
$value = (vartrue($parms['value'])) ? $parms['value'] : $value;
|
||||
echo "key=".$key."<br />value=".$value;
|
||||
return $ret.$this->hidden($key, $value);
|
||||
break;
|
||||
|
||||
|
@@ -33,12 +33,13 @@ class e_media
|
||||
public function import($cat,$epath,$fmask='')
|
||||
{
|
||||
if(!vartrue($cat)){ return $this;}
|
||||
|
||||
|
||||
if(!is_readable($epath))
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
$fl = e107::getFile();
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
@@ -175,7 +176,7 @@ class e_media
|
||||
|
||||
$path = $tp->createConstants($epath, 'rel');
|
||||
|
||||
$status = ($sql->db_Select_gen("SELECT * FROM `#core_media` WHERE `media_url` LIKE '".$path."%' AND media_category REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ")) ? TRUE : FALSE;
|
||||
$status = ($sql->db_Select_gen("SELECT * FROM `#core_media` WHERE `media_url` LIKE '".$path."%' AND media_owner = '_icon' ")) ? TRUE : FALSE;
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
$ret[] = $row['media_url'];
|
||||
@@ -225,14 +226,20 @@ class e_media
|
||||
/**
|
||||
* Return an Array of Media Categories
|
||||
*/
|
||||
public function getCategories()
|
||||
public function getCategories($owner='')
|
||||
{
|
||||
$ret = array();
|
||||
e107::getDb()->db_Select_gen("SELECT * FROM #core_media_cat ORDER BY media_cat_title");
|
||||
|
||||
|
||||
$qry = "SELECT * FROM #core_media_cat ";
|
||||
$qry .= ($owner) ? " WHERE media_cat_owner = '".$owner."' " : "";
|
||||
$qry .= "ORDER BY media_cat_order";
|
||||
|
||||
e107::getDb()->db_Select_gen($qry);
|
||||
while($row = e107::getDb()->db_Fetch(mySQL_ASSOC))
|
||||
{
|
||||
$id = $row['media_cat_nick'];
|
||||
$ret[$id] = $row['media_cat_title'];
|
||||
$id = $row['media_cat_category'];
|
||||
$ret[$id] = $row;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
@@ -881,6 +881,8 @@ class e_userperms
|
||||
"B" => array(ADMSLAN_37,E_16_COMMENT, E_32_COMMENT), // Moderate Comments
|
||||
"6" => array(ADMSLAN_25,E_16_FILE, E_32_FILE), // File-Manager - Upload /manage files -
|
||||
"A" => array(ADMSLAN_36,E_16_IMAGES, E_32_IMAGES), // Media-Manager and Image Settings
|
||||
"A1"=> array(ADMSLAN_36,E_16_IMAGES, E_32_IMAGES), // Media-Manager (Media Add)
|
||||
"A2"=> array(ADMSLAN_36,E_16_IMAGES, E_32_IMAGES), // Media-Manager (Media-Import)
|
||||
|
||||
|
||||
"2" => array(ADMSLAN_20,E_16_MENUS, E_32_MENUS), // Alter Menus
|
||||
|
@@ -820,7 +820,7 @@ $columnInfo = array(
|
||||
$text .= " </select>";
|
||||
*/
|
||||
|
||||
$text .= $frm->imagepicker('download_image', $download_image,'','download');
|
||||
$text .= $frm->imagepicker('download_image', $download_image,'','download_image');
|
||||
|
||||
if ($subAction == "dlm" && $download_image)
|
||||
{
|
||||
@@ -844,7 +844,7 @@ $columnInfo = array(
|
||||
$text .= " </select>";
|
||||
*/
|
||||
|
||||
$text .= $frm->imagepicker('download_thumb', $download_thumb,'','downloadthumb');
|
||||
$text .= $frm->imagepicker('download_thumb', $download_thumb,'','download_thumb');
|
||||
|
||||
|
||||
$text .= "
|
||||
|
Reference in New Issue
Block a user