<?php

if (!cmsms()) {
    exit;
}
header("Content-type:text/javascript; charset=utf-8");
// Adapted from http://www.php.net/manual/en/function.session-id.php#54084
// session_id() returns an empty string if there is no current session, sotest if a session already exists before calling session_start() to prevent error notices:
if (session_id() == '') {
    session_start();
}
$frontend = false;
if (isset($params['frontend']) && $params['frontend'] == true) {
    $frontend = true;
    echo 'hi';
    // Stikki says: hi hi, how you doing?
}
$templateid = '';
if (isset($params['templateid'])) {
    $templateid = $params['templateid'];
}
$languageid = '';
if (isset($params['languageid'])) {
    $languageid = $params['languageid'];
}
$configcontent = microtiny_utils::GenerateConfig($frontend, $templateid, $languageid);
echo $configcontent;
exit;
Esempio n. 2
0
 public function WYSIWYGTextarea($name = 'textarea', $columns = '80', $rows = '15', $encoding = '', $content = '', $stylesheet = '', $addtext = '')
 {
     return microtiny_utils::WYSIWYGTextarea($name, $columns, $rows, $encoding, $content, $stylesheet, $addtext);
 }
Esempio n. 3
0
 $file["fullpath"] = $startdir . '/' . $entry;
 $file["fullurl"] = $starturl . '/' . $entry;
 $file["ext"] = strtolower(substr($entry, strrpos($entry, ".")));
 $file["isdir"] = is_dir($file["fullpath"]);
 if (!$file["isdir"]) {
     if ($type == "image") {
         if ($file["ext"] != ".jpeg" && $file["ext"] != ".jpg" && $file["ext"] != ".gif" && $file["ext"] != ".png") {
             continue;
         } else {
             $file["isimage"] = "1";
         }
         if ($filepickerstyle != "filename") {
             if ($this->GetPreference("showthumbnailfiles") == '1') {
                 $file["thumbnail"] = microtiny_utils::GetThumbnailFile(str_replace("thumb_", "", $entry), $startdir, $starturl);
             } else {
                 $file["thumbnail"] = microtiny_utils::GetThumbnailFile($entry, $startdir, $starturl);
             }
         }
         $imgsize = @getimagesize($file["fullpath"]);
         if ($imgsize) {
             $file["dimensions"] = $imgsize[0] . "x" . $imgsize[1];
         } else {
             $file["dimensions"] = "&nbsp;";
         }
     }
 }
 if ($fmmodule) {
     $file["fileicon"] = $fmmodule->GetFileIcon($file["ext"], $file["isdir"]);
 }
 if (!$file["isdir"]) {
     $info = @stat($file["fullpath"]);
Esempio n. 4
0
 /**
  * Generate dynamic config file
  *
  * @since 1.0
  * @param boolean Frontend true/false
  * @param string Templateid
  * @param string A2 Languageid
  * @return string
  */
 public static function GenerateConfig($frontend = false, $templateid = "", $languageid = "en")
 {
     $mod = cms_utils::get_module('MicroTiny');
     // Check if we are in object instance
     if (!is_object($mod)) {
         return false;
     }
     // TODO: return static file if this fails, or something
     // Init
     $config = cms_utils::get_config();
     $result = "";
     $linker = "";
     if ($frontend) {
         $mod->smarty->assign("isfrontend", true);
     } else {
         $mod->smarty->assign("isfrontend", false);
         $result .= self::GetCMSLinker();
         $linker = "cmslinker,";
     }
     if (count(self::$_textareas)) {
         $tmp = implode(',', self::$_textareas);
         self::$_textareas = array();
         $mod->smarty->assign('textareas', $tmp);
     }
     if ($templateid <= 0) {
         $pageinfo = cmsms()->get_variable('pageinfo');
         if (is_object($pageinfo)) {
             $templateid = $pageinfo->template_id;
         } else {
             $contentobj = cms_utils::get_app_data('editing_content');
             if (is_object($contentobj)) {
                 $templateid = $contentobj->TemplateId();
             } else {
                 $templateops = cmsms()->GetTemplateOperations();
                 $dflt_template = $templateops->LoadDefaultTemplate();
                 if (is_object($dflt_template)) {
                     $templateid = $dflt_template->id;
                 }
             }
         }
     }
     if ($templateid > 0) {
         $mod->smarty->assign('templateid', $templateid);
     }
     $urlext = "";
     if (isset($_SESSION[CMS_USER_KEY])) {
         $urlext = CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
     }
     $mod->smarty->assign("urlext", $urlext);
     //,pasteword,,|,undo,redo
     $image = "";
     if ($mod->GetPreference("allowimages", 0) && !$frontend) {
         $image = ",image,|";
     }
     $toolbar = "undo,|,bold,italic,underline,|,cut,copy,paste,pastetext,removeformat,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|," . $linker . "link,unlink,|" . $image . ",formatselect";
     //,separator,styleselect
     // handle css styles... newline OR comma separated (why, kinda dumb?)
     $tmp = $mod->GetPreference('css_styles');
     $tmp = str_replace("\r\n", "\n", $tmp);
     $tmp = explode("\n", $tmp);
     $tmp2 = array();
     foreach ($tmp as $one) {
         $one = trim($one);
         if (empty($one)) {
             continue;
         }
         $tmp3 = explode(',', $one);
         foreach ($tmp3 as $one2) {
             $tmp2[] = trim($one2);
         }
     }
     $tmp3 = array();
     foreach ($tmp2 as $one) {
         $tmp4 = explode('=', trim($one), 2);
         if (count($tmp4) == 1) {
             $tmp3[$tmp4[0]] = $tmp4[0];
         } else {
             $tmp3[$tmp4[0]] = $tmp4[1];
         }
     }
     $css_styles = '';
     foreach ($tmp3 as $key => $value) {
         $css_styles .= $key . '=' . $value . ';';
     }
     $css_styles = substr($css_styles, 0, -1);
     if ($css_styles != '') {
         $toolbar .= ",separator,styleselect";
         $mod->smarty->assign("css_styles", $css_styles);
     }
     // give the rest to smarty.
     $mod->smarty->assign('show_statusbar', $mod->GetPreference('show_statusbar', 0));
     $mod->smarty->assign('allow_resize', $mod->GetPreference('allow_resize', 0));
     $mod->smarty->assign('strip_background', $mod->GetPreference('strip_background', 1));
     $mod->smarty->assign('force_blackonwhite', $mod->GetPreference('force_blackonwhite', 0));
     $mod->smarty->assign("toolbar", $toolbar);
     $mod->smarty->assign("language", $languageid);
     $mod->smarty->assign("filepickertitle", $mod->Lang("filepickertitle"));
     $fpurl = $mod->create_url("", "filepicker");
     $fpurl = str_replace("&amp;", "&", $fpurl);
     $mod->smarty->assign("filepickerurl", $fpurl);
     $result .= $mod->ProcessTemplate('microtinyconfig.tpl');
     return $result;
 }
Esempio n. 5
0
 $file["fullpath"] = $thisdir . $entry;
 $file["fullurl"] = $thisurl . $entry;
 $file["ext"] = strtolower(substr($entry, strrpos($entry, ".")));
 $file["isdir"] = is_dir($file["fullpath"]);
 if (!$file["isdir"]) {
     if ($_GET["type"] == "image") {
         if ($file["ext"] != ".jpeg" && $file["ext"] != ".jpg" && $file["ext"] != ".gif" && $file["ext"] != ".png") {
             continue;
         } else {
             $file["isimage"] = "1";
         }
         if ($filepickerstyle != "filename") {
             if ($tiny->GetPreference("showthumbnailfiles") == "1") {
                 $file["thumbnail"] = microtiny_utils::GetThumbnailFile(str_replace("thumb_", "", $entry), $thisdir, $thisurl);
             } else {
                 $file["thumbnail"] = microtiny_utils::GetThumbnailFile($entry, $thisdir, $thisurl);
             }
         }
         $imgsize = @getimagesize($file["fullpath"]);
         if ($imgsize) {
             $file["dimensions"] = $imgsize[0] . "x" . $imgsize[1];
         } else {
             $file["dimensions"] = "&nbsp;";
         }
     }
 }
 if ($fmmodule) {
     $file["fileicon"] = $fmmodule->GetFileIcon($file["ext"], $file["isdir"]);
 }
 if (!$file["isdir"]) {
     $info = @stat($file["fullpath"]);
 /**
  * Generate dynamic config file
  *
  * @since 1.0
  * @param boolean Frontend true/false
  * @param string Templateid
  * @param string A2 Languageid
  * @return string
  */
 public static function GenerateConfig($frontend = false, $templateid = "", $languageid = "en")
 {
     $mod = cms_utils::get_module('MicroTiny');
     // Check if we are in object instance
     if (!is_object($mod)) {
         return false;
     }
     // TODO: return static file if this fails, or something
     // Init
     $config = cms_utils::get_config();
     $result = "";
     $linker = "";
     if ($frontend) {
         $mod->smarty->assign("isfrontend", true);
     } else {
         $mod->smarty->assign("isfrontend", false);
         $result .= self::GetCMSLinker();
         $linker = "cmslinker,";
     }
     if (count(self::$_textareas)) {
         $tmp = implode(',', self::$_textareas);
         self::$_textareas = array();
         $mod->smarty->assign('textareas', $tmp);
     }
     if ($templateid == '') {
         $pageinfo = cmsms()->get_variable('pageinfo');
         if (is_object($pageinfo)) {
             $templateid = $pageinfo->template_id;
         } else {
             $templateops = cmsms()->GetTemplateOperations();
             $dflt_template = $templateops->LoadDefaultTemplate();
             if (is_object($dflt_template)) {
                 $templateid = $dflt_template->id;
             }
         }
     }
     if ($templateid) {
         $mod->smarty->assign('templateid', $templateid);
     }
     $mod->smarty->assign("rooturl", $config["root_url"]);
     $urlext = "";
     if (isset($_SESSION[CMS_USER_KEY])) {
         $urlext = CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
     }
     $mod->smarty->assign("urlext", $urlext);
     //,pasteword,,|,undo,redo
     $image = "";
     if ($mod->GetPreference("allowimages", 0) && !$frontend) {
         $image = ",image,|";
     }
     $toolbar = "undo,|,bold,italic,underline,|,cut,copy,paste,pastetext,removeformat,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|," . $linker . "link,unlink,|" . $image . ",formatselect";
     //,separator,styleselect
     $css_styles = $mod->GetPreference('css_styles');
     $css_styles = str_replace("\n", ",", $css_styles);
     $css_styles = str_replace("\r", ",", $css_styles);
     if ($css_styles != "") {
         $toolbar .= ",separator,styleselect";
         $mod->smarty->assign("css_styles", $css_styles);
     }
     $mod->smarty->assign('show_statusbar', $mod->GetPreference('show_statusbar', 0));
     $mod->smarty->assign('allow_resize', $mod->GetPreference('allow_resize', 0));
     $mod->smarty->assign("toolbar", $toolbar);
     $mod->smarty->assign("language", $languageid);
     $mod->smarty->assign("filepickertitle", $mod->Lang("filepickertitle"));
     $result .= $mod->ProcessTemplate('microtinyconfig.tpl');
     return $result;
 }