mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 04:10:38 +02:00
IN PROGRESS - task EONE-10: System thumbnails
- media manager now uses thumb.php - form handler uses thumb.php (UI) when type is image and parameter thumb is passed - minor issues fixed - thumbUrl() method added (Parser, for now)
This commit is contained in:
@@ -8,10 +8,8 @@
|
|||||||
*
|
*
|
||||||
* Cache Administration Area
|
* Cache Administration Area
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/cache.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
|
@@ -8,10 +8,8 @@
|
|||||||
*
|
*
|
||||||
* Image Administration Area
|
* Image Administration Area
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
@@ -39,7 +37,7 @@ $e_sub_cat = 'image';
|
|||||||
require_once(e_HANDLER."userclass_class.php");
|
require_once(e_HANDLER."userclass_class.php");
|
||||||
require_once(e_HANDLER."message_handler.php");
|
require_once(e_HANDLER."message_handler.php");
|
||||||
// $frm = new e_form(); //new form handler
|
// $frm = new e_form(); //new form handler
|
||||||
$emessage = &eMessage::getInstance();
|
$emessage = eMessage::getInstance();
|
||||||
|
|
||||||
class media_admin extends e_admin_dispatcher
|
class media_admin extends e_admin_dispatcher
|
||||||
{
|
{
|
||||||
@@ -56,8 +54,8 @@ class media_admin extends e_admin_dispatcher
|
|||||||
'path' => null,
|
'path' => null,
|
||||||
'ui' => 'faq_cat_form_ui',
|
'ui' => 'faq_cat_form_ui',
|
||||||
'uipath' => null
|
'uipath' => null
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
protected $adminMenu = array(
|
protected $adminMenu = array(
|
||||||
@@ -68,11 +66,11 @@ class media_admin extends e_admin_dispatcher
|
|||||||
// 'cat/create' => array('caption'=> "Create Category", 'perm' => 'A'),
|
// 'cat/create' => array('caption'=> "Create Category", 'perm' => 'A'),
|
||||||
'main/icons' => array('caption'=> IMALAN_71, 'perm' => 'A'),
|
'main/icons' => array('caption'=> IMALAN_71, 'perm' => 'A'),
|
||||||
'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'A'),
|
'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'A'),
|
||||||
|
|
||||||
'main/avatar' => array('caption'=> IMALAN_23, 'perm' => 'A')
|
'main/avatar' => array('caption'=> IMALAN_23, 'perm' => 'A')
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$var['main']['text'] = IMALAN_7;
|
$var['main']['text'] = IMALAN_7;
|
||||||
$var['main']['link'] = e_SELF;
|
$var['main']['link'] = e_SELF;
|
||||||
|
|
||||||
@@ -85,38 +83,38 @@ class media_admin extends e_admin_dispatcher
|
|||||||
|
|
||||||
$var['editor']['text'] = "Image Manipulation (future release)";
|
$var['editor']['text'] = "Image Manipulation (future release)";
|
||||||
$var['editor']['link'] = e_SELF."?editor";*/
|
$var['editor']['link'] = e_SELF."?editor";*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected $adminMenuAliases = array(
|
protected $adminMenuAliases = array(
|
||||||
'main/edit' => 'main/list'
|
'main/edit' => 'main/list'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $menuTitle = LAN_MEDIAMANAGER;
|
protected $menuTitle = LAN_MEDIAMANAGER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class faq_cat_ui extends e_admin_ui
|
class faq_cat_ui extends e_admin_ui
|
||||||
{
|
{
|
||||||
protected $pluginTitle = 'Media Categories';
|
protected $pluginTitle = 'Media Categories';
|
||||||
protected $pluginName = 'core';
|
protected $pluginName = 'core';
|
||||||
protected $table = "core_media_cat";
|
protected $table = "core_media_cat";
|
||||||
protected $pid = "media_cat_id";
|
protected $pid = "media_cat_id";
|
||||||
protected $perPage = 0; //no limit
|
protected $perPage = 0; //no limit
|
||||||
protected $batchDelete = false;
|
protected $batchDelete = false;
|
||||||
// protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit.
|
// protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit.
|
||||||
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
||||||
|
|
||||||
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'),
|
||||||
'media_cat_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
|
'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_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_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=50&bb=1','readonly'=>TRUE), // Display name
|
'media_cat_diz' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1','readonly'=>TRUE), // Display name
|
||||||
'media_cat_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'),
|
'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')
|
// 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get FAQ Category data
|
* Get FAQ Category data
|
||||||
*
|
*
|
||||||
@@ -128,14 +126,14 @@ class faq_cat_ui extends e_admin_ui
|
|||||||
{
|
{
|
||||||
// TODO get faq category tree
|
// TODO get faq category tree
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class faq_cat_form_ui extends e_admin_form_ui
|
/*class faq_cat_form_ui extends e_admin_form_ui
|
||||||
{
|
{
|
||||||
public function faq_info_parent($curVal,$mode)
|
public function faq_info_parent($curVal,$mode)
|
||||||
{
|
{
|
||||||
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter
|
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter
|
||||||
// Get UI instance
|
// Get UI instance
|
||||||
$controller = $this->getController();
|
$controller = $this->getController();
|
||||||
switch($mode)
|
switch($mode)
|
||||||
@@ -143,27 +141,27 @@ class faq_cat_form_ui extends e_admin_form_ui
|
|||||||
case 'read':
|
case 'read':
|
||||||
return e107::getParser()->toHTML($controller->getFaqCategoryTree($curVal), false, 'TITLE');
|
return e107::getParser()->toHTML($controller->getFaqCategoryTree($curVal), false, 'TITLE');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'write':
|
case 'write':
|
||||||
return $this->selectbox('faq_info_parent', $controller->getFaqCategoryTree(), $curVal);
|
return $this->selectbox('faq_info_parent', $controller->getFaqCategoryTree(), $curVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'filter':
|
case 'filter':
|
||||||
case 'batch':
|
case 'batch':
|
||||||
return $controller->getFaqCategoryTree();
|
return $controller->getFaqCategoryTree();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class media_form_ui extends e_admin_form_ui
|
class media_form_ui extends e_admin_form_ui
|
||||||
{
|
{
|
||||||
|
|
||||||
private $cats = array();
|
private $cats = array();
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
@@ -172,30 +170,30 @@ class media_form_ui extends e_admin_form_ui
|
|||||||
while($row = $sql->db_Fetch())
|
while($row = $sql->db_Fetch())
|
||||||
{
|
{
|
||||||
$cat = $row['media_cat_nick'];
|
$cat = $row['media_cat_nick'];
|
||||||
$this->cats[$cat] = $row['media_cat_title'];
|
$this->cats[$cat] = $row['media_cat_title'];
|
||||||
}
|
}
|
||||||
asort($this->cats);
|
asort($this->cats);
|
||||||
}
|
}
|
||||||
|
|
||||||
function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
|
function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
|
||||||
{
|
{
|
||||||
|
|
||||||
if($mode == 'read')
|
if($mode == 'read')
|
||||||
{
|
{
|
||||||
return $this->cats[$curVal];
|
return $this->cats[$curVal];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mode == 'batch') // Custom Batch List for release_type
|
if($mode == 'batch') // Custom Batch List for release_type
|
||||||
{
|
{
|
||||||
return $this->cats;
|
return $this->cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mode == 'filter') // Custom Filter List for release_type
|
if($mode == 'filter') // Custom Filter List for release_type
|
||||||
{
|
{
|
||||||
return $this->cats;
|
return $this->cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$text = "<select class='tbox>' name='media_category' >";
|
$text = "<select class='tbox>' name='media_category' >";
|
||||||
foreach($this->cats as $key=>$val)
|
foreach($this->cats as $key=>$val)
|
||||||
{
|
{
|
||||||
@@ -209,51 +207,51 @@ class media_form_ui extends e_admin_form_ui
|
|||||||
|
|
||||||
class media_admin_ui extends e_admin_ui
|
class media_admin_ui extends e_admin_ui
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $pluginTitle = LAN_MEDIAMANAGER;
|
protected $pluginTitle = LAN_MEDIAMANAGER;
|
||||||
protected $pluginName = 'core';
|
protected $pluginName = 'core';
|
||||||
protected $table = "core_media";
|
protected $table = "core_media";
|
||||||
|
|
||||||
// protected $listQry = "SELECT * FROM #core_media"; // without any Order or Limit.
|
// protected $listQry = "SELECT * FROM #core_media"; // without any Order or Limit.
|
||||||
|
|
||||||
// //protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
|
// //protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
|
||||||
|
|
||||||
// protected $tableJoin = array(
|
// protected $tableJoin = array(
|
||||||
// 'u.user' => array('leftField' => 'media_author', 'rightField' => 'user_id', 'fields' => 'user_id,user_loginname,user_name')
|
// 'u.user' => array('leftField' => 'media_author', 'rightField' => 'user_id', 'fields' => 'user_id,user_loginname,user_name')
|
||||||
// );
|
// );
|
||||||
|
|
||||||
protected $pid = "media_id";
|
protected $pid = "media_id";
|
||||||
protected $perPage = 10;
|
protected $perPage = 10;
|
||||||
protected $batchDelete = true;
|
protected $batchDelete = true;
|
||||||
|
|
||||||
//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
|
||||||
/*
|
/*
|
||||||
* We need a column with a preview that is generated from the path of another field.
|
* We need a column with a preview that is generated from the path of another field.
|
||||||
* ie. the preview column should show a thumbnail which is generated from the media_url column.
|
* ie. the preview column should show a thumbnail which is generated from the media_url column.
|
||||||
* It needs to also take into consideration the type of media (image, video etc) which comes from another field.
|
* It needs to also take into consideration the type of media (image, video etc) which comes from another field.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $fields = array(
|
protected $fields = array(
|
||||||
'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
'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_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=100', 'width' => 'auto','readonly'=>TRUE),
|
'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60', 'width' => '110px','readonly'=>TRUE),
|
||||||
|
|
||||||
// 'media_preview' => array('title'=> "Preview", 'type' => 'image', 'data'=> null, 'width' => '10%'),
|
// 'media_preview' => array('title'=> "Preview", 'type' => 'image', 'data'=> null, 'width' => '10%'),
|
||||||
'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParm' => 'hidden', 'width' => '10%', 'nolist' => true),
|
'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParm' => 'hidden', 'width' => '10%', 'nolist' => true),
|
||||||
'media_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data'=> 'str', 'width' => 'auto'),
|
'media_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data'=> 'str', 'width' => 'auto'),
|
||||||
'media_caption' => array('title'=> "Caption", 'type' => 'text', 'data'=> 'str', 'width' => 'auto'),
|
'media_caption' => array('title'=> "Caption", 'type' => 'text', 'data'=> 'str', 'width' => 'auto'),
|
||||||
'media_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'data'=> 'str', 'width' => 'auto', 'thclass' => 'left first', 'readParms' => 'truncate=100', 'writeParms' => 'counter=0'),
|
'media_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'data'=> 'str', 'width' => 'auto', 'thclass' => 'left first', 'readParms' => 'truncate=100', 'writeParms' => 'counter=0'),
|
||||||
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,),
|
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,),
|
||||||
'media_type' => array('title'=> "Mime Type", 'type' => 'text', 'data'=> 'str', 'width' => 'auto', 'noedit'=>TRUE),
|
'media_type' => array('title'=> "Mime Type", 'type' => 'text', 'data'=> 'str', 'width' => 'auto', 'noedit'=>TRUE),
|
||||||
// 'media_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data'=> 'int'),
|
// 'media_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data'=> 'int'),
|
||||||
'media_author' => array('title'=> LAN_USER, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'noedit'=>TRUE ),
|
'media_author' => array('title'=> LAN_USER, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'noedit'=>TRUE ),
|
||||||
'media_datestamp' => array('title'=> LAN_DATESTAMP, 'type' => 'datestamp', 'data'=> 'int', 'width' => '10%', 'noedit'=>TRUE), // User date
|
'media_datestamp' => array('title'=> LAN_DATESTAMP, 'type' => 'datestamp', 'data'=> 'int', 'width' => '10%', 'noedit'=>TRUE), // User date
|
||||||
'media_size' => array('title'=> "Size", 'type' => 'number', 'data'=> 'int', 'width' => 'auto', 'noedit'=>TRUE),
|
'media_size' => array('title'=> "Size", 'type' => 'number', 'data'=> 'int', 'width' => 'auto', 'noedit'=>TRUE),
|
||||||
'media_dimensions' => array('title'=> "Dimensions", 'type' => 'text', 'data'=> 'str', 'width' => '5%', 'noedit'=>TRUE, 'class'=>'nowrap'),
|
'media_dimensions' => array('title'=> "Dimensions", 'type' => 'text', 'data'=> 'str', 'width' => '5%', 'noedit'=>TRUE, 'class'=>'nowrap'),
|
||||||
'media_userclass' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=> 'str', 'width' => '10%', 'thclass' => 'center','filter'=>TRUE,'batch'=>TRUE ),
|
'media_userclass' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=> 'str', 'width' => '10%', 'thclass' => 'center','filter'=>TRUE,'batch'=>TRUE ),
|
||||||
'media_tags' => array('title'=> "Tags/Keywords", 'type' => 'text', 'data'=> 'str', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ),
|
'media_tags' => array('title'=> "Tags/Keywords", 'type' => 'text', 'data'=> 'str', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ),
|
||||||
'media_usedby' => array('title'=> '', 'type' => 'text', 'data'=> 'text', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'nolist'=>true, 'readonly'=>TRUE ),
|
'media_usedby' => array('title'=> '', 'type' => 'text', 'data'=> 'text', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'nolist'=>true, 'readonly'=>TRUE ),
|
||||||
|
|
||||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'data'=> null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
|
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'data'=> null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -267,34 +265,34 @@ class media_admin_ui extends e_admin_ui
|
|||||||
'other' => 'files'
|
'other' => 'files'
|
||||||
);
|
);
|
||||||
// protected $fieldpref = array('checkboxes','media_url', 'media_id', 'media_thumb', 'media_title', 'media_caption', 'media_description', 'media_category', 'media_datestamp','media_userclass', 'options');
|
// protected $fieldpref = array('checkboxes','media_url', 'media_id', 'media_thumb', 'media_title', 'media_caption', 'media_description', 'media_category', 'media_datestamp','media_userclass', 'options');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
protected $prefs = array(
|
protected $prefs = array(
|
||||||
'pref_type' => array('title'=> 'type', 'type'=>'text'),
|
'pref_type' => array('title'=> 'type', 'type'=>'text'),
|
||||||
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean'),
|
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean'),
|
||||||
'pref_name' => array('title'=> 'name', 'type' => 'text')
|
'pref_name' => array('title'=> 'name', 'type' => 'text')
|
||||||
);*/
|
);*/
|
||||||
|
|
||||||
protected $cats = array();
|
protected $cats = array();
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
//FIXME - would prefer not to have to read this twice on the same page.
|
//FIXME - would prefer not to have to read this twice on the same page.
|
||||||
$sql = e107::getDb();
|
$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_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_cat_nick FROM #core_media_cat");
|
||||||
while($row = $sql->db_Fetch())
|
while($row = $sql->db_Fetch())
|
||||||
{
|
{
|
||||||
$cat = $row['media_cat_nick'];
|
$cat = $row['media_cat_nick'];
|
||||||
$this->cats[$cat] = $row['media_cat_title'];
|
$this->cats[$cat] = $row['media_cat_title'];
|
||||||
}
|
}
|
||||||
asort($this->cats);
|
asort($this->cats);
|
||||||
|
|
||||||
|
|
||||||
if(varset($_POST['batch_import_selected']))
|
if(varset($_POST['batch_import_selected']))
|
||||||
{
|
{
|
||||||
$this->batchImport();
|
$this->batchImport();
|
||||||
@@ -304,26 +302,26 @@ class media_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
function importPage()
|
function importPage()
|
||||||
{
|
{
|
||||||
$this->batchImportForm();
|
$this->batchImportForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
function settingsPage()
|
function settingsPage()
|
||||||
{
|
{
|
||||||
main_config();
|
main_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
function avatarPage()
|
function avatarPage()
|
||||||
{
|
{
|
||||||
show_avatars();
|
show_avatars();
|
||||||
}
|
}
|
||||||
|
|
||||||
function iconsPage()
|
function iconsPage()
|
||||||
{
|
{
|
||||||
$this->icon_editor();
|
$this->icon_editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked just before item create event
|
* Invoked just before item create event
|
||||||
* @return array
|
* @return array
|
||||||
@@ -337,9 +335,9 @@ class media_admin_ui extends e_admin_ui
|
|||||||
$this->getModel()->setDataFields($dataFields);
|
$this->getModel()->setDataFields($dataFields);
|
||||||
return $this->observeUploaded($new_data);
|
return $this->observeUploaded($new_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as beforeCreate() but invoked on edit
|
* Same as beforeCreate() but invoked on edit
|
||||||
* @return TBD
|
* @return TBD
|
||||||
*/
|
*/
|
||||||
public function beforeUpdate($new_data, $old_data, $id)
|
public function beforeUpdate($new_data, $old_data, $id)
|
||||||
@@ -347,122 +345,122 @@ class media_admin_ui extends e_admin_ui
|
|||||||
// return data to be merged with posted model data
|
// return data to be merged with posted model data
|
||||||
return $this->observeUploaded($new_data);
|
return $this->observeUploaded($new_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX - strict mysql error on Create without UPLOAD!
|
// XXX - strict mysql error on Create without UPLOAD!
|
||||||
function observeUploaded($new_data)
|
function observeUploaded($new_data)
|
||||||
{
|
{
|
||||||
$fl = e107::getFile();
|
$fl = e107::getFile();
|
||||||
|
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$pref['upload_storagetype'] = "1";
|
$pref['upload_storagetype'] = "1";
|
||||||
require_once(e_HANDLER."upload_handler.php"); //TODO - still not a class!
|
require_once(e_HANDLER."upload_handler.php"); //TODO - still not a class!
|
||||||
|
|
||||||
$uploaded = process_uploaded_files(e_MEDIA.'temp/'); //FIXME doesn't handle xxx.JPG (uppercase)
|
$uploaded = process_uploaded_files(e_MEDIA.'temp/'); //FIXME doesn't handle xxx.JPG (uppercase)
|
||||||
|
|
||||||
foreach($uploaded as $upload)
|
foreach($uploaded as $upload)
|
||||||
{
|
{
|
||||||
if(vartrue($upload['error']))
|
if(vartrue($upload['error']))
|
||||||
{
|
{
|
||||||
$mes->add($upload['message'], E_MESSAGE_ERROR);
|
$mes->add($upload['message'], E_MESSAGE_ERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$typePath = $this->getPath($upload['type']))
|
if(!$typePath = $this->getPath($upload['type']))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oldpath = 'temp/'.$upload['name'];
|
$oldpath = 'temp/'.$upload['name'];
|
||||||
$newpath = $typePath.'/'.$upload['name'];
|
$newpath = $typePath.'/'.$upload['name'];
|
||||||
|
|
||||||
$info = $fl->get_file_info(e_MEDIA.$oldpath);
|
$info = $fl->get_file_info(e_MEDIA.$oldpath);
|
||||||
|
|
||||||
$upload_data = array( // not saved if 'noedit' is active.
|
$upload_data = array( // not saved if 'noedit' is active.
|
||||||
'media_type' => $upload['type'],
|
'media_type' => $upload['type'],
|
||||||
'media_datestamp' => time(),
|
'media_datestamp' => time(),
|
||||||
'media_url' => "{e_MEDIA}".$newpath,
|
'media_url' => "{e_MEDIA}".$newpath,
|
||||||
'media_size' => $upload['size'],
|
'media_size' => $upload['size'],
|
||||||
'media_author' => USERID,
|
'media_author' => USERID,
|
||||||
'media_usedby' => '',
|
'media_usedby' => '',
|
||||||
'media_tags' => '',
|
'media_tags' => '',
|
||||||
'media_dimensions' => $info['img-width']." x ".$info['img-height']
|
'media_dimensions' => $info['img-width']." x ".$info['img-height']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if(!varset($new_data['media_name']))
|
if(!varset($new_data['media_name']))
|
||||||
{
|
{
|
||||||
$upload_data['media_name'] = $upload['name'];
|
$upload_data['media_name'] = $upload['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// only one upload? Not sure what's the idea here
|
// only one upload? Not sure what's the idea here
|
||||||
// we are currently creating one media item
|
// we are currently creating one media item
|
||||||
if(!rename(e_MEDIA.$oldpath, e_MEDIA.$newpath))
|
if(!rename(e_MEDIA.$oldpath, e_MEDIA.$newpath))
|
||||||
{
|
{
|
||||||
$mes->add("Couldn't move file from ".$oldpath." to ".$newpath, E_MESSAGE_ERROR);
|
$mes->add("Couldn't move file from ".$oldpath." to ".$newpath, E_MESSAGE_ERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
return $upload_data;
|
return $upload_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeDelete($data, $id) // call before 'delete' is executed. - return false to prevent delete execution (e.g. some dependencies check)
|
function beforeDelete($data, $id) // call before 'delete' is executed. - return false to prevent delete execution (e.g. some dependencies check)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterDelete($deleted_data, $id) // call after 'delete' is successfully executed. - delete the file with the db record (optional pref)
|
function afterDelete($deleted_data, $id) // call after 'delete' is successfully executed. - delete the file with the db record (optional pref)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPath($mime)
|
function getPath($mime)
|
||||||
{
|
{
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
list($pmime,$tmp) = explode('/',$mime);
|
list($pmime,$tmp) = explode('/',$mime);
|
||||||
|
|
||||||
if(!vartrue($this->mimePaths[$pmime]))
|
if(!vartrue($this->mimePaths[$pmime]))
|
||||||
{
|
{
|
||||||
$mes->add("Couldn't detected mime-type($type). Upload failed.", E_MESSAGE_ERROR);
|
$mes->add("Couldn't detected mime-type($type). Upload failed.", E_MESSAGE_ERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = $this->mimePaths[$pmime]."/".date("Y-m");
|
$dir = $this->mimePaths[$pmime]."/".date("Y-m");
|
||||||
|
|
||||||
if(!is_dir(e_MEDIA.$dir))
|
if(!is_dir(e_MEDIA.$dir))
|
||||||
{
|
{
|
||||||
if(!mkdir(e_MEDIA.$dir, 0755))
|
if(!mkdir(e_MEDIA.$dir, 0755))
|
||||||
{
|
{
|
||||||
$mes->add("Couldn't create folder ($dir).", E_MESSAGE_ERROR);
|
$mes->add("Couldn't create folder ($dir).", E_MESSAGE_ERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return $dir;
|
return $dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
function batchImportForm()
|
function batchImportForm()
|
||||||
{
|
{
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$fl = e107::getFile();
|
$fl = e107::getFile();
|
||||||
|
|
||||||
$fl->setFileInfo('all');
|
$fl->setFileInfo('all');
|
||||||
$files = $fl->get_files(e_MEDIA."temp/");
|
$files = $fl->get_files(e_MEDIA."temp/");
|
||||||
|
|
||||||
//TODO Detect XML file, and if found - read that instead of the directory.
|
//TODO Detect XML file, and if found - read that instead of the directory.
|
||||||
|
|
||||||
if(!vartrue($_POST['batch_import_selected']))
|
if(!vartrue($_POST['batch_import_selected']))
|
||||||
{
|
{
|
||||||
$mes->add("Scanning Media in folder: ".e_MEDIA."temp/", E_MESSAGE_INFO);
|
$mes->add("Scanning Media in folder: ".e_MEDIA."temp/", E_MESSAGE_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!count($files))
|
if(!count($files))
|
||||||
{
|
{
|
||||||
$mes->add("No media Found!", E_MESSAGE_INFO);
|
$mes->add("No media Found!", E_MESSAGE_INFO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = "
|
$text = "
|
||||||
<form method='post' action='".e_SELF."?".e_QUERY."' id='batch_import'>
|
<form method='post' action='".e_SELF."?".e_QUERY."' id='batch_import'>
|
||||||
<fieldset id='core-mediamanager-batch'>
|
<fieldset id='core-mediamanager-batch'>
|
||||||
@@ -479,7 +477,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
<th class='center'>Checkbox</th>
|
<th class='center'>Checkbox</th>
|
||||||
<th class='center' style='width:50px'>Preview</th>
|
<th class='center' style='width:50px'>Preview</th>
|
||||||
<th class='center'>".LAN_NAME."</th>
|
<th class='center'>".LAN_NAME."</th>
|
||||||
<th>Mime Type</th>
|
<th>Mime Type</th>
|
||||||
<th>File Size</th>
|
<th>File Size</th>
|
||||||
<th>".LAN_DATESTAMP."</th>
|
<th>".LAN_DATESTAMP."</th>
|
||||||
<th class='center last'>Dimensions</th>
|
<th class='center last'>Dimensions</th>
|
||||||
@@ -497,12 +495,12 @@ class media_admin_ui extends e_admin_ui
|
|||||||
<td>".$f['mime']."</td>
|
<td>".$f['mime']."</td>
|
||||||
<td>".$f['fsize']."</td>
|
<td>".$f['fsize']."</td>
|
||||||
<td>".e107::getDateConvert()->convert_date($f['modified'])."</td>
|
<td>".e107::getDateConvert()->convert_date($f['modified'])."</td>
|
||||||
<td class='center last'>".$f['img-width']." x ".$f['img-height']."</td>
|
<td class='center last'>".$f['img-width']." x ".$f['img-height']."</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -514,63 +512,63 @@ class media_admin_ui extends e_admin_ui
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
echo $mes->render().$text;
|
echo $mes->render().$text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function batchImport()
|
function batchImport()
|
||||||
{
|
{
|
||||||
$fl = e107::getFile();
|
$fl = e107::getFile();
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
|
||||||
foreach($_POST['batch_selected'] as $file)
|
foreach($_POST['batch_selected'] as $file)
|
||||||
{
|
{
|
||||||
$oldpath = "temp/".$file;
|
$oldpath = "temp/".$file;
|
||||||
$f = $fl->get_file_info(e_MEDIA.$oldpath);
|
$f = $fl->get_file_info(e_MEDIA.$oldpath);
|
||||||
$newpath = $this->getPath($f['mime']).'/'.$file;
|
$newpath = $this->getPath($f['mime']).'/'.$file;
|
||||||
|
|
||||||
$f['fname'] = $file;
|
$f['fname'] = $file;
|
||||||
|
|
||||||
if(rename(e_MEDIA.$oldpath,e_MEDIA.$newpath))
|
if(rename(e_MEDIA.$oldpath,e_MEDIA.$newpath))
|
||||||
{
|
{
|
||||||
$insert = array(
|
$insert = array(
|
||||||
'media_caption' => $f['fname'],
|
'media_caption' => $f['fname'],
|
||||||
'media_description' => '',
|
'media_description' => '',
|
||||||
'media_category' => $_POST['batch_category'],
|
'media_category' => $_POST['batch_category'],
|
||||||
'media_datestamp' => $f['modified'],
|
'media_datestamp' => $f['modified'],
|
||||||
'media_url' => "{e_MEDIA}".$newpath,
|
'media_url' => "{e_MEDIA}".$newpath,
|
||||||
'media_userclass' => 0,
|
'media_userclass' => 0,
|
||||||
'media_name' => $f['fname'],
|
'media_name' => $f['fname'],
|
||||||
'media_author' => USERID,
|
'media_author' => USERID,
|
||||||
'media_size' => $f['fsize'],
|
'media_size' => $f['fsize'],
|
||||||
'media_dimensions' => $f['img-width']." x ".$f['img-height'],
|
'media_dimensions' => $f['img-width']." x ".$f['img-height'],
|
||||||
'media_usedby' => '',
|
'media_usedby' => '',
|
||||||
'media_tags' => '',
|
'media_tags' => '',
|
||||||
'media_type' => $f['mime']
|
'media_type' => $f['mime']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if($sql->db_Insert("core_media",$insert))
|
if($sql->db_Insert("core_media",$insert))
|
||||||
{
|
{
|
||||||
$mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS);
|
$mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rename(e_MEDIA.$newpath,e_MEDIA.$oldpath); //move it back.
|
rename(e_MEDIA.$newpath,e_MEDIA.$oldpath); //move it back.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function preview($f)
|
function preview($f)
|
||||||
{
|
{
|
||||||
list($type,$tmp) = explode("/",$f['mime']);
|
list($type,$tmp) = explode("/",$f['mime']);
|
||||||
@@ -581,22 +579,22 @@ class media_admin_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return; //TODO generic icon/image for no preview.
|
return; //TODO generic icon/image for no preview.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function icon_editor()
|
function icon_editor()
|
||||||
{
|
{
|
||||||
global $iconpool, $e107;
|
global $iconpool, $e107;
|
||||||
|
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
ksort($iconpool);
|
ksort($iconpool);
|
||||||
|
|
||||||
$text = "
|
$text = "
|
||||||
<form method='post' action='".e_SELF."?".e_QUERY."' id='icon_edit'>
|
<form method='post' action='".e_SELF."?".e_QUERY."' id='icon_edit'>
|
||||||
<fieldset id='core-imagemanager-icons'>
|
<fieldset id='core-imagemanager-icons'>
|
||||||
@@ -619,7 +617,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
<tbody>
|
<tbody>
|
||||||
";
|
";
|
||||||
$tmp = array(16, 32, 48, 64, 128);
|
$tmp = array(16, 32, 48, 64, 128);
|
||||||
|
|
||||||
foreach($iconpool as $key => $val)
|
foreach($iconpool as $key => $val)
|
||||||
{
|
{
|
||||||
$tmp1 = array();
|
$tmp1 = array();
|
||||||
@@ -628,7 +626,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
$filepath = $icon;
|
$filepath = $icon;
|
||||||
$filepath_abs = $tp->replaceConstants($icon);
|
$filepath_abs = $tp->replaceConstants($icon);
|
||||||
$icon_file = basename($filepath_abs);
|
$icon_file = basename($filepath_abs);
|
||||||
|
|
||||||
$str = "<img class='icon picker list%%size%%' src='{$filepath_abs}' alt='{$icon_file}' />";
|
$str = "<img class='icon picker list%%size%%' src='{$filepath_abs}' alt='{$icon_file}' />";
|
||||||
foreach ($tmp as $isize)
|
foreach ($tmp as $isize)
|
||||||
{
|
{
|
||||||
@@ -640,12 +638,12 @@ class media_admin_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
$tmp1['other'] = varset($tmp1['other']).$str;//other
|
$tmp1['other'] = varset($tmp1['other']).$str;//other
|
||||||
}
|
}
|
||||||
|
|
||||||
$ptext = "<div class='field-spacer iconeditor'>".str_replace('%%size%%', '', implode('</div><div class="field-spacer iconeditor">', $tmp1))."</div>";
|
$ptext = "<div class='field-spacer iconeditor'>".str_replace('%%size%%', '', implode('</div><div class="field-spacer iconeditor">', $tmp1))."</div>";
|
||||||
|
|
||||||
// $ptext = (is_array($val)) ? "<pre>".print_r($val, TRUE)."</pre>" : htmlspecialchars($val, ENT_QUOTES, CHARSET);
|
// $ptext = (is_array($val)) ? "<pre>".print_r($val, TRUE)."</pre>" : htmlspecialchars($val, ENT_QUOTES, CHARSET);
|
||||||
// $ptext = $e107->tp->textclean($ptext, 80);
|
// $ptext = $e107->tp->textclean($ptext, 80);
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='center autocheck e-pointer'>".$frm->checkbox("delpref2[$key]", 1)."</td>
|
<td class='center autocheck e-pointer'>".$frm->checkbox("delpref2[$key]", 1)."</td>
|
||||||
@@ -655,7 +653,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -664,15 +662,15 @@ class media_admin_ui extends e_admin_ui
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
";
|
";
|
||||||
//$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_MEDIAMANAGER." :: ".IMALAN_71, $mes->render().$text);
|
// $ns->tablerender(LAN_MEDIAMANAGER." :: ".IMALAN_71, $mes->render().$text);
|
||||||
|
|
||||||
echo $mes->render().$text;
|
echo $mes->render().$text;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -694,7 +692,7 @@ e107::getAdminUI()->runPage();
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$action = e_QUERY;
|
$action = e_QUERY;
|
||||||
@@ -900,7 +898,7 @@ if (isset($_POST['update_options']))
|
|||||||
function show_avatars()
|
function show_avatars()
|
||||||
{
|
{
|
||||||
global $e107, $pref;
|
global $e107, $pref;
|
||||||
|
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
@@ -1195,7 +1193,7 @@ if (isset($_POST['check_avatar_sizes']))
|
|||||||
function main_config()
|
function main_config()
|
||||||
{
|
{
|
||||||
global $pref;
|
global $pref;
|
||||||
|
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
@@ -14,8 +14,9 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @package e107
|
* @package e107
|
||||||
* @subpackage shortcodes|admin|user|e107_handler|bbcodes
|
* @subpackage e107_handler
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @author secretr
|
||||||
*
|
*
|
||||||
* Simple, quick and efective way of testing performance of parts of your code
|
* Simple, quick and efective way of testing performance of parts of your code
|
||||||
* Example:
|
* Example:
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
* // Do something, e.g. loop 1000000 times
|
* // Do something, e.g. loop 1000000 times
|
||||||
*
|
*
|
||||||
* // stop timer and check your e_LOG folder
|
* // stop timer and check your e_LOG folder
|
||||||
* $bench->end()->$bench->('myevent');
|
* $bench->end()->logResult('myevent');
|
||||||
* //OR print out the result (don't forget to stop the timer if used without the above line!
|
* //OR print out the result (don't forget to stop the timer if used without the above line!
|
||||||
* $bench->printResult();
|
* $bench->printResult();
|
||||||
* </code>
|
* </code>
|
||||||
|
@@ -1612,6 +1612,28 @@ class e_parse
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function thumbUrl($url, $options = array(), $raw = false, $full = false)
|
||||||
|
{
|
||||||
|
if(!is_array($options))
|
||||||
|
{
|
||||||
|
parse_str($options, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($raw) $url = $this->createConstants($url, 'mix');
|
||||||
|
|
||||||
|
$thurl = ($full ? SITEURL : e_HTTP).'thumb.php?src='.$url.'&';
|
||||||
|
if(vartrue($options['aw']))
|
||||||
|
{
|
||||||
|
$thurl .= 'aw='.intval($options['aw']).'&ah='.(vartrue($options['ah']) ? intval($options['ah']) : intval($options['aw']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!vartrue($options['w'])) $options['w'] = 100;
|
||||||
|
$thurl .= 'aw='.intval($options['w']).'&ah='.(vartrue($options['h']) ? intval($options['h']) : intval($options['w']));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $thurl;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace e107 path constants
|
* Replace e107 path constants
|
||||||
@@ -1687,7 +1709,6 @@ class e_parse
|
|||||||
"{e_THEME}",
|
"{e_THEME}",
|
||||||
//,"{e_DOWNLOAD}"
|
//,"{e_DOWNLOAD}"
|
||||||
"{e_HANDLER}",
|
"{e_HANDLER}",
|
||||||
//FIXME need another name
|
|
||||||
"{e_MEDIA}"
|
"{e_MEDIA}"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -1226,10 +1226,31 @@ class e_form
|
|||||||
case 'image': //TODO - thumb, js tooltip...
|
case 'image': //TODO - thumb, js tooltip...
|
||||||
if($value)
|
if($value)
|
||||||
{
|
{
|
||||||
$src = $tp->replaceConstants(vartrue($parms['pre']).$value, 'abs');
|
if(vartrue($parms['thumb']))
|
||||||
$alt = $src; //basename($value);
|
{
|
||||||
$ttl = vartrue($parms['thumb']) ? '<img src="'.$src.'" alt="'.$alt.'" style="width: '.(is_numeric($parms['thumb']) ? $parms['thumb'] : 80).'px" />' : vartrue($parms['title'], 'LAN_PREVIEW');
|
$src = $tp->replaceConstants(vartrue($parms['pre']).$value, 'abs');
|
||||||
$value = '<a href="'.$src.'" class="e-image-preview" title="'.$alt.'" rel="external">'.defset($ttl, $ttl).'</a>';
|
$thumb = $parms['thumb'];
|
||||||
|
$thparms = array();
|
||||||
|
if(is_numeric($thumb) && '1' != $thumb)
|
||||||
|
{
|
||||||
|
$thparms['w'] = intval($thumb);
|
||||||
|
}
|
||||||
|
elseif(vartrue($parms['thumb_aw']))
|
||||||
|
{
|
||||||
|
$thparms['aw'] = intval($parms['thumb_aw']);
|
||||||
|
}
|
||||||
|
$thsrc = $tp->thumbUrl(vartrue($parms['pre']).$value, $thparms, varset($parms['thumb_urlraw']));
|
||||||
|
$alt = $src;
|
||||||
|
$ttl = '<img src="'.$thsrc.'" alt="'.$alt.'" class="e-thumb" />';
|
||||||
|
$value = '<a href="'.$src.'" class="e-image-preview" title="'.$alt.'" rel="external">'.$ttl.'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$src = $tp->replaceConstants(vartrue($parms['pre']).$value, 'abs');
|
||||||
|
$alt = $src; //basename($value);
|
||||||
|
$ttl = vartrue($parms['title'], 'LAN_PREVIEW');
|
||||||
|
$value = '<a href="'.$src.'" class="e-image-preview" title="'.$alt.'" rel="external">'.defset($ttl, $ttl).'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -8,10 +8,8 @@
|
|||||||
*
|
*
|
||||||
* Release Plugin Administration UI
|
* Release Plugin Administration UI
|
||||||
*
|
*
|
||||||
* $Source: /cvsroot/e107/e107_0.8/e107_plugins/release/includes/admin.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//require_once(e_HANDLER.'admin_handler.php'); - autoloaded - see class2.php __autoload()
|
//require_once(e_HANDLER.'admin_handler.php'); - autoloaded - see class2.php __autoload()
|
||||||
@@ -26,9 +24,9 @@ class plugin_release_admin extends e_admin_dispatcher
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $modes = array(
|
protected $modes = array(
|
||||||
'main' => array('controller' => 'plugin_release_admin_ui', 'path' => null, 'ui' => 'plugin_release_admin_form_ui', 'uipath' => null)
|
'main' => array('controller' => 'plugin_release_admin_ui', 'path' => null, 'ui' => 'plugin_release_admin_form_ui', 'uipath' => null)
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Both are optional
|
/* Both are optional
|
||||||
protected $defaultMode = null;
|
protected $defaultMode = null;
|
||||||
protected $defaultAction = null;
|
protected $defaultAction = null;
|
||||||
@@ -43,19 +41,19 @@ class plugin_release_admin extends e_admin_dispatcher
|
|||||||
'main/list' => array('caption'=> 'Manage', 'perm' => '0'),
|
'main/list' => array('caption'=> 'Manage', 'perm' => '0'),
|
||||||
'main/create' => array('caption'=> LAN_CREATE, 'perm' => '0'),
|
'main/create' => array('caption'=> LAN_CREATE, 'perm' => '0'),
|
||||||
'main/prefs' => array('caption'=> 'Settings', 'perm' => '0'),
|
'main/prefs' => array('caption'=> 'Settings', 'perm' => '0'),
|
||||||
'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0')
|
'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0')
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional, mode/action aliases, related with 'selected' menu CSS class
|
* Optional, mode/action aliases, related with 'selected' menu CSS class
|
||||||
* Format: 'MODE/ACTION' => 'MODE ALIAS/ACTION ALIAS';
|
* Format: 'MODE/ACTION' => 'MODE ALIAS/ACTION ALIAS';
|
||||||
* This will mark active main/list menu item, when current page is main/edit
|
* This will mark active main/list menu item, when current page is main/edit
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $adminMenuAliases = array(
|
protected $adminMenuAliases = array(
|
||||||
'main/edit' => 'main/list'
|
'main/edit' => 'main/list'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigation menu title
|
* Navigation menu title
|
||||||
* @var string
|
* @var string
|
||||||
@@ -67,180 +65,182 @@ class plugin_release_admin_ui extends e_admin_ui
|
|||||||
{
|
{
|
||||||
// required
|
// required
|
||||||
protected $pluginTitle = "e107 Release";
|
protected $pluginTitle = "e107 Release";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plugin name or 'core'
|
* plugin name or 'core'
|
||||||
* IMPORTANT: should be 'core' for non-plugin areas because this
|
* IMPORTANT: should be 'core' for non-plugin areas because this
|
||||||
* value defines what CONFIG will be used. However, I think this should be changed
|
* value defines what CONFIG will be used. However, I think this should be changed
|
||||||
* very soon (awaiting discussion with Cam)
|
* very soon (awaiting discussion with Cam)
|
||||||
* Maybe we need something like $prefs['core'], $prefs['release'] ... multiple getConfig support?
|
* Maybe we need something like $prefs['core'], $prefs['release'] ... multiple getConfig support?
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $pluginName = 'release';
|
protected $pluginName = 'release';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DB Table, table alias is supported
|
* DB Table, table alias is supported
|
||||||
* Example: 'r.release'
|
* Example: 'r.release'
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $table = "release";
|
protected $table = "release";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If present this array will be used to build your list query
|
* If present this array will be used to build your list query
|
||||||
* You can link fileds from $field array with 'table' parameter, which should equal to a key (table) from this array
|
* You can link fileds from $field array with 'table' parameter, which should equal to a key (table) from this array
|
||||||
* 'leftField', 'rightField' and 'fields' attributes here are required, the rest is optional
|
* 'leftField', 'rightField' and 'fields' attributes here are required, the rest is optional
|
||||||
* Table alias is supported
|
* Table alias is supported
|
||||||
* Note:
|
* Note:
|
||||||
* - 'leftTable' could contain only table alias
|
* - 'leftTable' could contain only table alias
|
||||||
* - 'leftField' and 'rightField' shouldn't contain table aliases, they will be auto-added
|
* - 'leftField' and 'rightField' shouldn't contain table aliases, they will be auto-added
|
||||||
* - 'whereJoin' and 'where' should contain table aliases e.g. 'whereJoin' => 'AND u.user_ban=0'
|
* - 'whereJoin' and 'where' should contain table aliases e.g. 'whereJoin' => 'AND u.user_ban=0'
|
||||||
*
|
*
|
||||||
* @var array [optional] table_name => array join parameters
|
* @var array [optional] table_name => array join parameters
|
||||||
*/
|
*/
|
||||||
protected $tableJoin = array(
|
protected $tableJoin = array(
|
||||||
//'u.user' => array('leftField' => 'comment_author_id', 'rightField' => 'user_id', 'fields' => '*'/*, 'leftTable' => '', 'joinType' => 'LEFT JOIN', 'whereJoin' => '', 'where' => ''*/)
|
//'u.user' => array('leftField' => 'comment_author_id', 'rightField' => 'user_id', 'fields' => '*'/*, 'leftTable' => '', 'joinType' => 'LEFT JOIN', 'whereJoin' => '', 'where' => ''*/)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is only needed if you need to JOIN tables AND don't wanna use $tableJoin
|
* This is only needed if you need to JOIN tables AND don't wanna use $tableJoin
|
||||||
* Write your list query without any Order or Limit.
|
* Write your list query without any Order or Limit.
|
||||||
* NOTE: $tableJoin array is recommended join method
|
* NOTE: $tableJoin array is recommended join method
|
||||||
*
|
*
|
||||||
* @var string [optional]
|
* @var string [optional]
|
||||||
*/
|
*/
|
||||||
protected $listQry = "";
|
protected $listQry = "";
|
||||||
//
|
//
|
||||||
|
|
||||||
// optional - required only in case of e.g. tables JOIN. This also could be done with custom model (set it in init())
|
// optional - required only in case of e.g. tables JOIN. This also could be done with custom model (set it in init())
|
||||||
// NOT NEEDED ANYMORE!!!
|
// NOT NEEDED ANYMORE!!!
|
||||||
//protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
//protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
||||||
|
|
||||||
// required - if no custom model is set in init() (primary id)
|
// required - if no custom model is set in init() (primary id)
|
||||||
protected $pid = "release_id";
|
protected $pid = "release_id";
|
||||||
|
|
||||||
// optional
|
// optional
|
||||||
protected $perPage = 20;
|
protected $perPage = 20;
|
||||||
|
|
||||||
// default - true - TODO - move to displaySettings
|
// default - true - TODO - move to displaySettings
|
||||||
protected $batchDelete = true;
|
protected $batchDelete = true;
|
||||||
|
|
||||||
// UNDER CONSTRUCTION
|
// UNDER CONSTRUCTION
|
||||||
protected $displaySettings = array();
|
protected $displaySettings = array();
|
||||||
|
|
||||||
// UNDER CONSTRUCTION
|
// UNDER CONSTRUCTION
|
||||||
protected $disallowPages = array('main/create', 'main/prefs');
|
protected $disallowPages = array('main/create', 'main/prefs');
|
||||||
|
|
||||||
//TODO change the release_url type back to URL before release.
|
//TODO change the release_url type back to URL before release.
|
||||||
// required
|
// required
|
||||||
/**
|
/**
|
||||||
* (use this as starting point for wiki documentation)
|
* (use this as starting point for wiki documentation)
|
||||||
* $fields format (string) $field_name => (array) $attributes
|
* $fields format (string) $field_name => (array) $attributes
|
||||||
*
|
*
|
||||||
* $field_name format:
|
* $field_name format:
|
||||||
* 'table_alias_or_name.field_name.field_alias' (if JOIN support is needed) OR just 'field_name'
|
* 'table_alias_or_name.field_name.field_alias' (if JOIN support is needed) OR just 'field_name'
|
||||||
* NOTE: Keep in mind the count of exploded data can be 1 or 3!!! This means if you wanna give alias
|
* NOTE: Keep in mind the count of exploded data can be 1 or 3!!! This means if you wanna give alias
|
||||||
* on main table field you can't omit the table (first key), alternative is just '.' e.g. '.field_name.field_alias'
|
* on main table field you can't omit the table (first key), alternative is just '.' e.g. '.field_name.field_alias'
|
||||||
*
|
*
|
||||||
* $attributes format:
|
* $attributes format:
|
||||||
* - title (string) Human readable field title, constant name will be accpeted as well (multi-language support
|
* - title (string) Human readable field title, constant name will be accpeted as well (multi-language support
|
||||||
*
|
*
|
||||||
* - type (string) null (means system), number, text, dropdown, url, image, icon, datestamp, userclass, userclasses, user[_name|_loginname|_login|_customtitle|_email],
|
* - type (string) null (means system), number, text, dropdown, url, image, icon, datestamp, userclass, userclasses, user[_name|_loginname|_login|_customtitle|_email],
|
||||||
* boolean, method, ip
|
* boolean, method, ip
|
||||||
* full/most recent reference list - e_form::renderTableRow(), e_form::renderElement(), e_admin_form_ui::renderBatchFilter()
|
* full/most recent reference list - e_form::renderTableRow(), e_form::renderElement(), e_admin_form_ui::renderBatchFilter()
|
||||||
* for list of possible read/writeParms per type see below
|
* for list of possible read/writeParms per type see below
|
||||||
*
|
*
|
||||||
* - data (string) Data type, one of the following: int, integer, string, str, float, bool, boolean, model, null
|
* - data (string) Data type, one of the following: int, integer, string, str, float, bool, boolean, model, null
|
||||||
* Default is 'str'
|
* Default is 'str'
|
||||||
* Used only if $dataFields is not set
|
* Used only if $dataFields is not set
|
||||||
* full/most recent reference list - e_admin_model::sanitize(), db::_getFieldValue()
|
* full/most recent reference list - e_admin_model::sanitize(), db::_getFieldValue()
|
||||||
* - dataPath (string) - xpath like path to the model/posted value. Example: 'dataPath' => 'prefix/mykey' will result in $_POST['prefix']['mykey']
|
* - dataPath (string) - xpath like path to the model/posted value. Example: 'dataPath' => 'prefix/mykey' will result in $_POST['prefix']['mykey']
|
||||||
* - primary (boolean) primary field (obsolete, $pid is now used)
|
* - primary (boolean) primary field (obsolete, $pid is now used)
|
||||||
*
|
*
|
||||||
* - help (string) edit/create table - inline help, constant name will be accpeted as well, optional
|
* - help (string) edit/create table - inline help, constant name will be accpeted as well, optional
|
||||||
* - note (string) edit/create table - text shown below the field title (left column), constant name will be accpeted as well, optional
|
* - note (string) edit/create table - text shown below the field title (left column), constant name will be accpeted as well, optional
|
||||||
*
|
*
|
||||||
* - validate (boolean|string) any of accepted validation types (see e_validator::$_required_rules), true == 'required'
|
* - validate (boolean|string) any of accepted validation types (see e_validator::$_required_rules), true == 'required'
|
||||||
* - rule (string) condition for chosen above validation type (see e_validator::$_required_rules), not required for all types
|
* - rule (string) condition for chosen above validation type (see e_validator::$_required_rules), not required for all types
|
||||||
* - error (string) Human readable error message (validation failure), constant name will be accepted as well, optional
|
* - error (string) Human readable error message (validation failure), constant name will be accepted as well, optional
|
||||||
*
|
*
|
||||||
* - batch (boolean) list table - add current field to batch actions, in use only for boolean, dropdown, datestamp, userclass, method field types
|
* - batch (boolean) list table - add current field to batch actions, in use only for boolean, dropdown, datestamp, userclass, method field types
|
||||||
* NOTE: batch may accept string values in the future...
|
* NOTE: batch may accept string values in the future...
|
||||||
* full/most recent reference type list - e_admin_form_ui::renderBatchFilter()
|
* full/most recent reference type list - e_admin_form_ui::renderBatchFilter()
|
||||||
*
|
*
|
||||||
* - filter (boolean) list table - add current field to filter actions, rest is same as batch
|
* - filter (boolean) list table - add current field to filter actions, rest is same as batch
|
||||||
*
|
*
|
||||||
* - forced (boolean) list table - forced fields are always shown in list table
|
* - forced (boolean) list table - forced fields are always shown in list table
|
||||||
* - nolist (boolean) list table - don't show in column choice list
|
* - nolist (boolean) list table - don't show in column choice list
|
||||||
* - noedit (boolean) edit table - don't show in edit mode
|
* - noedit (boolean) edit table - don't show in edit mode
|
||||||
*
|
*
|
||||||
* - width (string) list table - width e.g '10%', 'auto'
|
* - width (string) list table - width e.g '10%', 'auto'
|
||||||
* - thclass (string) list table header - th element class
|
* - thclass (string) list table header - th element class
|
||||||
* - class (string) list table body - td element additional class
|
* - class (string) list table body - td element additional class
|
||||||
*
|
*
|
||||||
* - readParms (mixed) parameters used by core routine for showing values of current field. Structure on this attribute
|
* - readParms (mixed) parameters used by core routine for showing values of current field. Structure on this attribute
|
||||||
* depends on the current field type (see below). readParams are used mainly by list page
|
* depends on the current field type (see below). readParams are used mainly by list page
|
||||||
*
|
*
|
||||||
* - writeParms (mixed) parameters used by core routine for showing control element(s) of current field.
|
* - writeParms (mixed) parameters used by core routine for showing control element(s) of current field.
|
||||||
* Structure on this attribute depends on the current field type (see below).
|
* Structure on this attribute depends on the current field type (see below).
|
||||||
* writeParams are used mainly by edit page, filter (list page), batch (list page)
|
* writeParams are used mainly by edit page, filter (list page), batch (list page)
|
||||||
*
|
*
|
||||||
* $attributes['type']->$attributes['read/writeParams'] pairs:
|
* $attributes['type']->$attributes['read/writeParams'] pairs:
|
||||||
*
|
*
|
||||||
* - null -> read: n/a
|
* - null -> read: n/a
|
||||||
* -> write: n/a
|
* -> write: n/a
|
||||||
*
|
*
|
||||||
* - dropdown -> read: 'pre', 'post', array in format posted_html_name => value
|
* - dropdown -> read: 'pre', 'post', array in format posted_html_name => value
|
||||||
* -> write: 'pre', 'post', array in format as required by e_form::selectbox()
|
* -> write: 'pre', 'post', array in format as required by e_form::selectbox()
|
||||||
*
|
*
|
||||||
* - user -> read: [optional] 'link' => true - create link to user profile, 'idField' => 'author_id' - tells to renderValue() where to search for user id (used when 'link' is true and current field is NOT ID field)
|
* - user -> read: [optional] 'link' => true - create link to user profile, 'idField' => 'author_id' - tells to renderValue() where to search for user id (used when 'link' is true and current field is NOT ID field)
|
||||||
* 'nameField' => 'comment_author_name' - tells to renderValue() where to search for user name (used when 'link' is true and current field is ID field)
|
* 'nameField' => 'comment_author_name' - tells to renderValue() where to search for user name (used when 'link' is true and current field is ID field)
|
||||||
* -> write: [optional] 'nameField' => 'comment_author_name' the name of a 'user_name' field; 'currentInit' - use currrent user if no data provided; 'current' - use always current user(editor); '__options' e_form::userpickup() options
|
* -> write: [optional] 'nameField' => 'comment_author_name' the name of a 'user_name' field; 'currentInit' - use currrent user if no data provided; 'current' - use always current user(editor); '__options' e_form::userpickup() options
|
||||||
*
|
*
|
||||||
* - number -> read: (array) [optional] 'point' => '.', [optional] 'sep' => ' ', [optional] 'decimals' => 2, [optional] 'pre' => '€ ', [optional] 'post' => 'LAN_CURRENCY'
|
* - number -> read: (array) [optional] 'point' => '.', [optional] 'sep' => ' ', [optional] 'decimals' => 2, [optional] 'pre' => '€ ', [optional] 'post' => 'LAN_CURRENCY'
|
||||||
* -> write: (array) [optional] 'pre' => '€ ', [optional] 'post' => 'LAN_CURRENCY', [optional] 'maxlength' => 50, [optional] '__options' => array(...) see e_form class description for __options format
|
* -> write: (array) [optional] 'pre' => '€ ', [optional] 'post' => 'LAN_CURRENCY', [optional] 'maxlength' => 50, [optional] '__options' => array(...) see e_form class description for __options format
|
||||||
*
|
*
|
||||||
* - ip -> read: n/a
|
* - ip -> read: n/a
|
||||||
* -> write: [optional] element options array (see e_form class description for __options format)
|
* -> write: [optional] element options array (see e_form class description for __options format)
|
||||||
*
|
*
|
||||||
* - text -> read: (array) [optional] 'htmltruncate' => 100, [optional] 'truncate' => 100, [optional] 'pre' => '', [optional] 'post' => ' px'
|
* - text -> read: (array) [optional] 'htmltruncate' => 100, [optional] 'truncate' => 100, [optional] 'pre' => '', [optional] 'post' => ' px'
|
||||||
* -> write: (array) [optional] 'pre' => '', [optional] 'post' => ' px', [optional] 'maxlength' => 50 (default - 255), [optional] '__options' => array(...) see e_form class description for __options format
|
* -> write: (array) [optional] 'pre' => '', [optional] 'post' => ' px', [optional] 'maxlength' => 50 (default - 255), [optional] '__options' => array(...) see e_form class description for __options format
|
||||||
*
|
*
|
||||||
* - textarea -> read: (array) 'noparse' => '1' default 0 (disable toHTML text parsing), [optional] 'bb' => '1' (parse bbcode) default 0,
|
* - textarea -> read: (array) 'noparse' => '1' default 0 (disable toHTML text parsing), [optional] 'bb' => '1' (parse bbcode) default 0,
|
||||||
* [optional] 'parse' => '' modifiers passed to e_parse::toHTML() e.g. 'BODY', [optional] 'htmltruncate' => 100,
|
* [optional] 'parse' => '' modifiers passed to e_parse::toHTML() e.g. 'BODY', [optional] 'htmltruncate' => 100,
|
||||||
* [optional] 'truncate' => 100, [optional] 'expand' => '[more]' title for expand link, empty - no expand
|
* [optional] 'truncate' => 100, [optional] 'expand' => '[more]' title for expand link, empty - no expand
|
||||||
* -> write: (array) [optional] 'rows' => '' default 15, [optional] 'cols' => '' default 40, [optional] '__options' => array(...) see e_form class description for __options format
|
* -> write: (array) [optional] 'rows' => '' default 15, [optional] 'cols' => '' default 40, [optional] '__options' => array(...) see e_form class description for __options format
|
||||||
* [optional] 'counter' => 0 number of max characters - has only visual effect, doesn't truncate the value (default - false)
|
* [optional] 'counter' => 0 number of max characters - has only visual effect, doesn't truncate the value (default - false)
|
||||||
*
|
*
|
||||||
* - bbarea -> read: same as textarea type
|
* - bbarea -> read: same as textarea type
|
||||||
* -> write: (array) [optional] 'pre' => '', [optional] 'post' => ' px', [optional] 'maxlength' => 50 (default - 0),
|
* -> write: (array) [optional] 'pre' => '', [optional] 'post' => ' px', [optional] 'maxlength' => 50 (default - 0),
|
||||||
* [optional] 'size' => [optional] - medium, small, large - default is medium,
|
* [optional] 'size' => [optional] - medium, small, large - default is medium,
|
||||||
* [optional] 'counter' => 0 number of max characters - has only visual effect, doesn't truncate the value (default - false)
|
* [optional] 'counter' => 0 number of max characters - has only visual effect, doesn't truncate the value (default - false)
|
||||||
*
|
*
|
||||||
* - image -> read: [optional] 'title' => 'SOME_LAN' (default - LAN_PREVIEW), [optional] 'pre' => '{e_PLUGIN}myplug/images/'
|
* - image -> read: [optional] 'title' => 'SOME_LAN' (default - LAN_PREVIEW), [optional] 'pre' => '{e_PLUGIN}myplug/images/',
|
||||||
|
* 'thumb' => 1 (true) or number width in pixels, 'thumb_urlraw' => 1|0 if true, it's a 'raw' url (no sc path constants),
|
||||||
|
* 'thumb_aw' => if 'thumb' is 1|true, this is used for Adaptive thumb width
|
||||||
* -> write: (array) [optional] 'label' => '', [optional] '__options' => array(...) see e_form::imagepicker() for allowed options
|
* -> write: (array) [optional] 'label' => '', [optional] '__options' => array(...) see e_form::imagepicker() for allowed options
|
||||||
*
|
*
|
||||||
* - icon -> read: [optional] 'class' => 'S16', [optional] 'pre' => '{e_PLUGIN}myplug/images/'
|
* - icon -> read: [optional] 'class' => 'S16', [optional] 'pre' => '{e_PLUGIN}myplug/images/'
|
||||||
* -> write: (array) [optional] 'label' => '', [optional] 'ajax' => true/false , [optional] '__options' => array(...) see e_form::iconpicker() for allowed options
|
* -> write: (array) [optional] 'label' => '', [optional] 'ajax' => true/false , [optional] '__options' => array(...) see e_form::iconpicker() for allowed options
|
||||||
*
|
*
|
||||||
* - datestamp -> read: [optional] 'mask' => 'long'|'short'|strftime() string, default is 'short'
|
* - datestamp -> read: [optional] 'mask' => 'long'|'short'|strftime() string, default is 'short'
|
||||||
* -> write: (array) [optional] 'label' => '', [optional] 'ajax' => true/false , [optional] '__options' => array(...) see e_form::iconpicker() for allowed options
|
* -> write: (array) [optional] 'label' => '', [optional] 'ajax' => true/false , [optional] '__options' => array(...) see e_form::iconpicker() for allowed options
|
||||||
*
|
*
|
||||||
* - url -> read: [optional] 'pre' => '{ePLUGIN}myplug/'|'http://somedomain.com/', 'truncate' => 50 default - no truncate, NOTE:
|
* - url -> read: [optional] 'pre' => '{ePLUGIN}myplug/'|'http://somedomain.com/', 'truncate' => 50 default - no truncate, NOTE:
|
||||||
* -> write:
|
* -> write:
|
||||||
*
|
*
|
||||||
* - method -> read: optional, passed to given method (the field name)
|
* - method -> read: optional, passed to given method (the field name)
|
||||||
* -> write: optional, passed to given method (the field name)
|
* -> write: optional, passed to given method (the field name)
|
||||||
*
|
*
|
||||||
* - hidden -> read: 'show' => 1|0 - show hidden value, 'empty' => 'something' - what to be shown if value is empty (only id 'show' is 1)
|
* - hidden -> read: 'show' => 1|0 - show hidden value, 'empty' => 'something' - what to be shown if value is empty (only id 'show' is 1)
|
||||||
* -> write: same as readParms
|
* -> write: same as readParms
|
||||||
*
|
*
|
||||||
* - upload -> read: n/a
|
* - upload -> read: n/a
|
||||||
* -> write: Under construction
|
* -> write: Under construction
|
||||||
*
|
*
|
||||||
* Special attribute types:
|
* Special attribute types:
|
||||||
* - method (string) field name should be method from the current e_admin_form_ui class (or its extension).
|
* - method (string) field name should be method from the current e_admin_form_ui class (or its extension).
|
||||||
* Example call: field_name($value, $render_action, $parms) where $value is current value,
|
* Example call: field_name($value, $render_action, $parms) where $value is current value,
|
||||||
* $render_action is on of the following: read|write|batch|filter, parms are currently used paramateres ( value of read/writeParms attribute).
|
* $render_action is on of the following: read|write|batch|filter, parms are currently used paramateres ( value of read/writeParms attribute).
|
||||||
* Return type expected (by render action):
|
* Return type expected (by render action):
|
||||||
* - read: list table - formatted value only
|
* - read: list table - formatted value only
|
||||||
@@ -253,36 +253,36 @@ class plugin_release_admin_ui extends e_admin_ui
|
|||||||
'checkboxes' => array('title'=> '', 'type' => null, 'data' => null, 'width'=>'5%', 'thclass' =>'center', 'forced'=> TRUE, 'class'=>'center', 'toggle' => 'e-multiselect'),
|
'checkboxes' => array('title'=> '', 'type' => null, 'data' => null, 'width'=>'5%', 'thclass' =>'center', 'forced'=> TRUE, 'class'=>'center', 'toggle' => 'e-multiselect'),
|
||||||
'release_id' => array('title'=> ID, 'type' => 'number', 'data' => 'int', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'primary'=>TRUE/*, 'noedit'=>TRUE*/), //Primary ID is not editable
|
'release_id' => array('title'=> ID, 'type' => 'number', 'data' => 'int', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'primary'=>TRUE/*, 'noedit'=>TRUE*/), //Primary ID is not editable
|
||||||
'release_type' => array('title'=> 'Type', 'type' => 'method', 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
|
'release_type' => array('title'=> 'Type', 'type' => 'method', 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
|
||||||
'release_folder' => array('title'=> 'Folder', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
'release_folder' => array('title'=> 'Folder', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||||
'release_name' => array('title'=> 'Name', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
'release_name' => array('title'=> 'Name', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||||
'release_version' => array('title'=> 'Version', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
'release_version' => array('title'=> 'Version', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||||
'release_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
'release_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'release_authorURL' => array('title'=> LAN_AUTHOR_URL, 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
'release_authorURL' => array('title'=> LAN_AUTHOR_URL, 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'release_date' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => ''),
|
'release_date' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => ''),
|
||||||
'release_compatibility' => array('title'=> 'compatib', 'type' => 'text', 'data' => 'str', 'width' => '10%', 'thclass' => 'center' ),
|
'release_compatibility' => array('title'=> 'compatib', 'type' => 'text', 'data' => 'str', 'width' => '10%', 'thclass' => 'center' ),
|
||||||
'release_url' => array('title'=> 'release_url', 'type' => 'url', 'data' => 'str', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'parms' => 'truncate=30', 'validate' => true, 'help' => 'Enter release URL here', 'error' => 'please, ener valid URL'),
|
'release_url' => array('title'=> 'release_url', 'type' => 'url', 'data' => 'str', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'parms' => 'truncate=30', 'validate' => true, 'help' => 'Enter release URL here', 'error' => 'please, ener valid URL'),
|
||||||
'test_list_1' => array('title'=> 'test 1', 'type' => 'boolean', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
|
'test_list_1' => array('title'=> 'test 1', 'type' => 'boolean', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
|
||||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced'=>TRUE)
|
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced'=>TRUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
//required - default column user prefs
|
//required - default column user prefs
|
||||||
protected $fieldpref = array('checkboxes', 'release_id', 'release_type', 'release_url', 'release_compatibility', 'options');
|
protected $fieldpref = array('checkboxes', 'release_id', 'release_type', 'release_url', 'release_compatibility', 'options');
|
||||||
|
|
||||||
// FORMAT field_name=>type - optional if fields 'data' attribute is set or if custom model is set in init()
|
// FORMAT field_name=>type - optional if fields 'data' attribute is set or if custom model is set in init()
|
||||||
/*protected $dataFields = array();*/
|
/*protected $dataFields = array();*/
|
||||||
|
|
||||||
// optional, could be also set directly from $fields array with attributes 'validate' => true|'rule_name', 'rule' => 'condition_name', 'error' => 'Validation Error message'
|
// optional, could be also set directly from $fields array with attributes 'validate' => true|'rule_name', 'rule' => 'condition_name', 'error' => 'Validation Error message'
|
||||||
/*protected $validationRules = array(
|
/*protected $validationRules = array(
|
||||||
'release_url' => array('required', '', 'Release URL', 'Help text', 'not valid error message')
|
'release_url' => array('required', '', 'Release URL', 'Help text', 'not valid error message')
|
||||||
);*/
|
);*/
|
||||||
|
|
||||||
// optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName);
|
// optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName);
|
||||||
protected $prefs = array(
|
protected $prefs = array(
|
||||||
'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true),
|
'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true),
|
||||||
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'),
|
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'),
|
||||||
'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
|
'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
|
||||||
);
|
);
|
||||||
|
|
||||||
// optional
|
// optional
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
@@ -291,23 +291,23 @@ class plugin_release_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
class plugin_release_admin_form_ui extends e_admin_form_ui
|
class plugin_release_admin_form_ui extends e_admin_form_ui
|
||||||
{
|
{
|
||||||
function release_type($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
|
function release_type($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
|
||||||
{
|
{
|
||||||
if($mode == 'read')
|
if($mode == 'read')
|
||||||
{
|
{
|
||||||
return $curVal.' (custom!)';
|
return $curVal.' (custom!)';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mode == 'batch') // Custom Batch List for release_type
|
if($mode == 'batch') // Custom Batch List for release_type
|
||||||
{
|
{
|
||||||
return array('theme'=>"Theme","plugin"=>'Plugin');
|
return array('theme'=>"Theme","plugin"=>'Plugin');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mode == 'filter') // Custom Filter List for release_type
|
if($mode == 'filter') // Custom Filter List for release_type
|
||||||
{
|
{
|
||||||
return array('theme'=>"Theme","plugin"=>'Plugin');
|
return array('theme'=>"Theme","plugin"=>'Plugin');
|
||||||
}
|
}
|
||||||
|
|
||||||
$types = array("theme","plugin");
|
$types = array("theme","plugin");
|
||||||
$text = "<select class='tbox' name='release_type' >";
|
$text = "<select class='tbox' name='release_type' >";
|
||||||
foreach($types as $val)
|
foreach($types as $val)
|
||||||
|
56
thumb.php
56
thumb.php
@@ -15,13 +15,21 @@
|
|||||||
/**
|
/**
|
||||||
* @package e107
|
* @package e107
|
||||||
* @subpackage core
|
* @subpackage core
|
||||||
|
* @author secretr
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
|
* @todo cache management - max age, max size, image cache manager (?), cron (?)
|
||||||
|
*
|
||||||
* On-the-fly thumbnail generator
|
* On-the-fly thumbnail generator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('e107_INIT', true);
|
define('e107_INIT', true);
|
||||||
|
|
||||||
|
//error_reporting(E_ALL);
|
||||||
|
//require_once './e107_handlers/benchmark.php';
|
||||||
|
//$bench = new e_benchmark();
|
||||||
|
//$bench->start();
|
||||||
|
|
||||||
$thumbpage = new e_thumbpage();
|
$thumbpage = new e_thumbpage();
|
||||||
|
|
||||||
if(!$thumbpage->checkSrc())
|
if(!$thumbpage->checkSrc())
|
||||||
@@ -30,17 +38,28 @@ if(!$thumbpage->checkSrc())
|
|||||||
}
|
}
|
||||||
$thumbpage->sendImage();
|
$thumbpage->sendImage();
|
||||||
|
|
||||||
/**
|
// Check your e_LOG folder
|
||||||
* Handle on-the-fly created thumbnails
|
//$bench->end()->logResult('thumb.php', $_GET['src'].' - no cache');
|
||||||
*
|
exit;
|
||||||
* @author secretr
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class e_thumbpage
|
class e_thumbpage
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Page request
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected $_request = array();
|
protected $_request = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string image source path (e107 path shortcode)
|
||||||
|
*/
|
||||||
protected $_src = null;
|
protected $_src = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string source path modified/sanitized
|
||||||
|
*/
|
||||||
|
protected $_src_path = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor - init paths
|
* Constructor - init paths
|
||||||
* @todo FIX e107 (new folder structure), simplify all this, e.g. e107::getInstance()->initMinimal($path_to_e107_config);
|
* @todo FIX e107 (new folder structure), simplify all this, e.g. e107::getInstance()->initMinimal($path_to_e107_config);
|
||||||
@@ -80,7 +99,14 @@ class e_thumbpage
|
|||||||
'CORE_DIRECTORY'
|
'CORE_DIRECTORY'
|
||||||
);
|
);
|
||||||
$sql_info = array(); //compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix', 'mySQLcharset');
|
$sql_info = array(); //compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix', 'mySQLcharset');
|
||||||
e107::getInstance()->initCore($e107_paths, $self, $sql_info, varset($e107_CONFIG, array()));
|
//e107::getInstance()->initCore($e107_paths, $self, $sql_info, varset($e107_CONFIG, array()));
|
||||||
|
$e107 = e107::getInstance();
|
||||||
|
$e107->setDirs($e107_paths, varset($e107_CONFIG, array()));
|
||||||
|
$e107->set_constants();
|
||||||
|
$e107->set_paths();
|
||||||
|
$e107->file_path = $e107->fix_windows_paths($self)."/";
|
||||||
|
$e107->set_base_path();
|
||||||
|
$e107->set_urls();
|
||||||
unset($tmp, $self);
|
unset($tmp, $self);
|
||||||
|
|
||||||
// parse request
|
// parse request
|
||||||
@@ -89,8 +115,9 @@ class e_thumbpage
|
|||||||
|
|
||||||
function parseRequest()
|
function parseRequest()
|
||||||
{
|
{
|
||||||
parse_str(str_replace('&', '&', e_QUERY), $request);
|
//parse_str(str_replace('&', '&', e_QUERY), $this->_request);
|
||||||
$this->_request = $request;
|
parse_str($_SERVER['QUERY_STRING'], $this->_request);
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkSrc()
|
function checkSrc()
|
||||||
@@ -119,7 +146,8 @@ class e_thumbpage
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $tp->replaceConstants($this->_src);
|
// should be safe enough
|
||||||
|
$path = $tp->replaceConstants(str_replace('..', '', $this->_src));
|
||||||
|
|
||||||
if(is_file($path) && is_readable($path))
|
if(is_file($path) && is_readable($path))
|
||||||
{
|
{
|
||||||
@@ -131,6 +159,7 @@ class e_thumbpage
|
|||||||
|
|
||||||
function sendImage()
|
function sendImage()
|
||||||
{
|
{
|
||||||
|
//global $bench;
|
||||||
if(!$this->_src_path)
|
if(!$this->_src_path)
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
@@ -139,7 +168,7 @@ class e_thumbpage
|
|||||||
$thumbnfo = pathinfo($this->_src_path);
|
$thumbnfo = pathinfo($this->_src_path);
|
||||||
$options = $this->getRequestOptions();
|
$options = $this->getRequestOptions();
|
||||||
|
|
||||||
$cache_str = md5(serialize($options).md5_file($this->_src_path));
|
$cache_str = md5(serialize($options).$this->_src_path);
|
||||||
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
|
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
|
||||||
|
|
||||||
if(is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname))
|
if(is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname))
|
||||||
@@ -152,6 +181,7 @@ class e_thumbpage
|
|||||||
if (@$_SERVER['HTTP_IF_MODIFIED_SINCE'] && ($thumbnfo['lmodified'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) && (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $thumbnfo['md5s']))
|
if (@$_SERVER['HTTP_IF_MODIFIED_SINCE'] && ($thumbnfo['lmodified'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) && (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $thumbnfo['md5s']))
|
||||||
{
|
{
|
||||||
header('HTTP/1.1 304 Not Modified');
|
header('HTTP/1.1 304 Not Modified');
|
||||||
|
//$bench->end()->logResult('thumb.php', $_GET['src'].' - 304 not modified');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +189,7 @@ class e_thumbpage
|
|||||||
$this->sendHeaders($thumbnfo);
|
$this->sendHeaders($thumbnfo);
|
||||||
|
|
||||||
@readfile(e_CACHE_IMAGE.$fname);
|
@readfile(e_CACHE_IMAGE.$fname);
|
||||||
|
//$bench->end()->logResult('thumb.php', $_GET['src'].' - retrieve cache');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +220,6 @@ class e_thumbpage
|
|||||||
|
|
||||||
// show thumb
|
// show thumb
|
||||||
$thumb->show();
|
$thumb->show();
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRequestOptions()
|
function getRequestOptions()
|
||||||
@@ -243,3 +273,5 @@ class e_thumbpage
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user