function runAction($action, $params) { global $DIALOG; if (!isset($params['tagName'])) { require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php'; $msg = new wproMessageExit(); $msg->msgCode = WPRO_CRITICAL; $msg->msg = 'No tag selected'; $msg->alert(); } require WPRO_DIR . 'conf/tagAttributes.inc.php'; $tagName = strtoupper($DIALOG->makeVarOk($params['tagName'])); $DIALOG->headContent->add('<link rel="stylesheet" href="core/plugins/wproCore_tagEditor/dialog.css" type="text/css" />'); $DIALOG->headContent->add('<script type="text/javascript" src="core/plugins/wproCore_tagEditor/dialog_src.js"></script>'); if ($tagName == 'INPUT') { $DIALOG->headContent->add('<script type="text/javascript" src="core/plugins/wproCore_tagEditor/input_src.js"></script>'); } $DIALOG->title = $DIALOG->langEngine->get('wproCore_tagEditor', 'title') . ' - ' . $tagName; $DIALOG->bodyInclude = WPRO_DIR . 'core/plugins/wproCore_tagEditor/dialog.tpl.php'; $DIALOG->template->bulkAssign(array('attributes' => $attributes, 'tagInfo' => $tagInfo, 'tagName' => $tagName)); $DIALOG->options = array(array('type' => 'submit', 'name' => 'ok', 'value' => $DIALOG->langEngine->get('core', 'apply')), array('onclick' => 'dialog.close()', 'type' => 'button', 'name' => 'cancel', 'value' => $DIALOG->langEngine->get('core', 'cancel'))); }
} else { if (!wpro_class_exists('xajax')) { require_once WPRO_PATH_XAJAX . "xajax.inc.php"; } } if (wpro_class_exists('wpro_xajax')) { $xajax = new wpro_xajax(); } else { $xajax = new xajax(); } $xajax->registerCatchAllFunction("wpro_xajaxCatchSessionTimeout"); $xajax->processRequests(); } else { // session has expired; alert user require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php'; $msg = new wproMessageExit(); $msg->msgCode = WPRO_WARNING; $msg->msg = WPRO_STR_SESSION_TIMEOUT; $msg->alert(); } } else { if (!WPRO_ANONYMOUS_ACCESS) { if (isset($_POST['xajax'])) { if (WPRO_PATH_XAJAX == WPRO_DIR . 'core/libs/xajax/') { require_once WPRO_PATH_XAJAX . "xajax.inc.php"; } else { if (!wpro_class_exists('xajax')) { require_once WPRO_PATH_XAJAX . "xajax.inc.php"; } } if (wpro_class_exists('wpro_xajax')) {
function runAction($action, $params) { global $EDITOR, $DIALOG, $WPRO_SESS; $DIALOG->template->assign('wpsid', $WPRO_SESS->sessionId); $DIALOG->template->assign('wpsname', $WPRO_SESS->sessionName); $DIALOG->template->assign('action', $action); $DIALOG->options = array(); $this->params = $params; if (isset($params['properties'])) { $DIALOG->assign('properties', true); } else { $DIALOG->assign('properties', false); } $DIALOG->template->assign('fbOptions', array(array('class' => 'button', 'type' => 'submit', 'name' => 'ok', 'value' => $DIALOG->langEngine->get('core', 'insert')), array('class' => 'button', 'onclick' => 'dialog.close()', 'type' => 'button', 'name' => 'close', 'value' => $DIALOG->langEngine->get('core', 'cancel')))); $canGD = false; $canGif = false; if (function_exists('imagecreate')) { //if (!(imagetypes() & IMG_PNG)) { //} else { $canGD = true; //} if (!function_exists('imagegif') && (!function_exists('imagecreatefromgif') || !function_exists('imagepng'))) { $canGif = false; } else { $canGif = true; } } $DIALOG->template->assign('canGD', $canGD); $DIALOG->template->assign('canGif', $canGif); if (!$canGD) { $EDIITOR->thumbnails = false; } switch (strtolower($action)) { case 'image': case 'media': case 'document': case 'link': case 'imageeditor': case 'ajax': // register all the Ajax functions... $DIALOG->registerAjaxFunction(array('displayFolderList', &$this, 'displayFolderListWrapper')); $DIALOG->registerAjaxFunction(array('delete', &$this, 'delete')); $DIALOG->registerAjaxFunction(array('rename', &$this, 'rename')); $DIALOG->registerAjaxFunction(array('newFolder', &$this, 'newFolder')); $DIALOG->registerAjaxFunction(array('uploadFinished', &$this, 'uploadFinished')); $DIALOG->registerAjaxFunction(array('moveCopyFinished', &$this, 'moveCopyFinished')); $DIALOG->registerAjaxFunction(array('editImage', &$this, 'editImage')); $DIALOG->registerAjaxFunction(array('displayFileDetails', &$this, 'displayFileDetails')); $DIALOG->registerAjaxFunction(array('displayFolderDetails', &$this, 'displayFolderDetails')); // end } switch (strtolower($action)) { case 'ajax': return true; break; case 'thumbnail': require dirname(__FILE__) . '/processors/thumbnail.inc.php'; break; case 'move': case 'copy': require dirname(__FILE__) . '/processors/move-copy.inc.php'; break; case 'upload': require dirname(__FILE__) . '/processors/upload.inc.php'; break; case 'outlook': require dirname(__FILE__) . '/processors/outlook.inc.php'; break; case 'preview': $DIALOG->classIsolator = 'wproCore_fileBrowser_preview'; //$DIALOG->title = str_replace('...', '', $DIALOG->langEngine->get('editor', 'image')); //$DIALOG->bodyInclude = WPRO_DIR.'core/plugins/wproCore_fileBrowser/tpl/dialog.tpl.php'; $DIALOG->headContent->add('<style type="text/css"> body { background-color: #ffffff; background-image: none; padding: 10px; padding-top: 70px; text-align: center; } </style>'); $DIALOG->chromeless = true; $DIALOG->bodyContent = '<p>' . $DIALOG->langEngine->get('wproCore_fileBrowser', 'preview') . '</p>'; break; case 'nopreview': $DIALOG->classIsolator = 'wproCore_fileBrowser_preview'; //$DIALOG->title = str_replace('...', '', $DIALOG->langEngine->get('editor', 'image')); //$DIALOG->bodyInclude = WPRO_DIR.'core/plugins/wproCore_fileBrowser/tpl/dialog.tpl.php'; $DIALOG->headContent->add('<style type="text/css"> body { background-color: #ffffff; background-image: none; padding: 10px; padding-top: 60px; text-align: center; } </style>'); $DIALOG->chromeless = true; $DIALOG->bodyContent = '<p>' . $DIALOG->langEngine->get('wproCore_fileBrowser', 'nopreview') . '</p>'; break; case 'imageeditor': require dirname(__FILE__) . '/processors/imageeditor.inc.php'; break; case 'linksbrowser': $DIALOG->classIsolator = 'wproCore_fileBrowser_linksBrowser'; $DIALOG->headContent->add('<style type="text/css"> body { background-color: #ffffff; background-image: none; } </style>'); $EDITOR->triggerEvent('onBeforeGetLinks'); $DIALOG->assign('links', $EDITOR->links); $DIALOG->chromeless = true; $DIALOG->bodyInclude = WPRO_DIR . 'core/plugins/wproCore_fileBrowser/tpl/linksBrowser.tpl.php'; break; case 'image': require dirname(__FILE__) . '/processors/image.inc.php'; break; case 'media': require dirname(__FILE__) . '/processors/media.inc.php'; break; case 'document': require dirname(__FILE__) . '/processors/document.inc.php'; break; case 'link': require dirname(__FILE__) . '/processors/link.inc.php'; break; case 'basiclink': require dirname(__FILE__) . '/processors/basiclink.inc.php'; break; case 'mediapreview': require dirname(__FILE__) . '/processors/mediapreview.inc.php'; break; default: // check vars require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php'; $msg = new wproMessageExit(); $msg->msgCode = WPRO_CRITICAL; $msg->msg = 'Sorry not enough parameters.'; $msg->alert(); } }
function loadPlugin($name, $default = false) { require_once WPRO_DIR . 'core/libs/wproFilesystem.class.php'; $files = new wproFilesystem(); $name = $this->makeVarOk($name); if (!isset($this->plugins[$name])) { $baseDir = WPRO_DIR . '/plugins/'; if (substr($name, 0, 9) == 'wproCore_') { $baseDir = WPRO_DIR . 'core/plugins/'; } else { $baseDir = WPRO_DIR . 'plugins/'; } // load componant file if (!wpro_class_exists("wproDialogPlugin_{$name}")) { if ($files->includeFileOnce($name, $baseDir, '/dialog.php')) { $this->EDITOR->langEngine->loadFile('wysiwygpro/includes/' . $name . '.inc.php'); // } else { return false; } } // create componant object if (wpro_class_exists("wproDialogPlugin_{$name}")) { @eval('$this->plugins["' . $name . '"] = & new wproDialogPlugin_' . $name . '();'); if (method_exists($this->plugins[$name], 'init')) { $this->plugins[$name]->init($this); } if ($default) { $this->dialogName = $name; } return true; } } else { if ($default) { $this->dialogName = $name; } return true; } if ($default) { // do exit require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php'; $msg = new wproMessageExit(); $msg->msgCode = WPRO_CRITICAL; $msg->msg = 'No dialog or incorrect dialog specified.'; $msg->alert(); exit; } else { return false; } }