This is for those who needs to provide individual private image upload and rich text editing using PHPRunner.
Currently there is some issues with preview and path settings, this guide provides a fix to that as well as
allow individual self-management of image based on logged in user.
- Upgrade to latest version of the phpr.
- Create a folder to store members images, eg: /c/news/images/members
- Add this to "AfterAppInit" event in phprunner:
$projectPath = 'http://localhost/my_web_portal';; // change to URL of your project root path
- Change settings.php in plugin folder of generated files:
<?php
//@@ Add this to inherit the session var $_SESSION["User_ID"];
include("../../../include/dbcommon.php");
//@@ Add this to inherit the session var $_SESSION["User_ID"];
$bReturnAbsolute=true;
$sBaseVirtual0="/c/news/images/members/".$_SESSION["User_ID"];
//@@ $_SESSION["User_ID"] is preferably numeric and unique,
//@@ so that unique user image folders can be created later base on this.
//@@ SESSION variable used by assestmanager.php
$_SESSION["asset_path"] = $sBaseVirtual0;
//@@ SESSION variable used by assestmanager.php
//@@ Set the path and generate folder base on User ID
//@@ This works for WINDOWS, LUNUX needs to cnage the path
$sBase_path0 = "c:\www\htdocs\c\\news\images\members\\";
$sBase_path1 = $sBase_path0.$_SESSION["User_ID"];
// echo getcwd();
if (!is_dir($sBase_path1))
{
mkdir($sBase_path1); //@@ create the folder as User_ID if it is not there.
//@@ copy default file to created folder, this file is empty html to hide the files.
$file=$sBase_path0."\index.html";
$newfile=$sBase_path1."\index.html";
if (!copy($file, $newfile))
{
echo "failed to copy files.";
}
}
$sBase0=$sBase_path1;
$sName0="Images";
/////////
$sBaseVirtual1="";
$sBase1="";
$sName1="";
$sBaseVirtual2="";
$sBase2="";
$sName2="";
$sBaseVirtual3="";
$sBase3="";
$sName3="";
?>
/////////////////////////////////////////
- Change assestmanager.php (in plugin folder of generated files) at line around 330:
$v_path = $_SESSION["asset_path"];
echo "<input type=hidden name=inpFile".$nIndex." id=inpFile".$nIndex." value=\"".$v_path.$sCurrent_virtual."\">";
////////////////////////////////////////
- change innova.php found in generated folder (remove the // to enable preview)
echo "
oEdit".$cfieldname." = new InnovaEditor('oEdit".$cfieldname."');
oEdit".$cfieldname.".mode='HTMLBody';
oEdit".$cfieldname.".width='".($nWidth)."px';
oEdit".$cfieldname.".height='".($nHeight)."px';
oEdit".$cfieldname.".cmdAssetManager = 'modalDialogShow(\"".$projectPath."/plugins/innovaeditor/assetmanager/assetmanager.php\",640,445);';
//oEdit".$cfieldname.".arrCustomButtons = [['AssetManager', oEdit".$cfieldname.".cmdAssetManager, 'Asset Manager', 'btnCustom1.gif']];
oEdit".$cfieldname.".features=['Preview'];
oEdit".$cfieldname.".REPLACE('".$cfield."');
";
//////////////////////////////////////////