return;
}
/* Import installation database and dump result into status variable */
if ($status = $GLOBALS["core"]->sqlImport(PHPWS_SOURCE_DIR . "mod/xwysiwyg/boost/install.sql", TRUE)) {
    $content .= "All xwysiwyg tables successfully written.<br /><br />";
    $status = 1;
} else {
    $content .= "There was a problem writing to the database!<br /><br />";
    return;
}
/* Create images directory */
if (!is_dir("{$GLOBALS['core']->home_dir}images/javascript/wysiwyg/")) {
    PHPWS_File::makeDir($GLOBALS['core']->home_dir . "images/javascript/wysiwyg/");
}
/* Create files/xwysiwyg directory */
if (!is_dir("{$GLOBALS['core']->home_dir}files/xwysiwyg/")) {
    PHPWS_File::makeDir($GLOBALS['core']->home_dir . "files/xwysiwyg/");
}
/* Create files/xwysiwyg/editors directory */
if (!is_dir("{$GLOBALS['core']->home_dir}files/xwysiwyg/editors/")) {
    PHPWS_File::makeDir($GLOBALS['core']->home_dir . "files/xwysiwyg/editors/");
}
if (is_dir("{$GLOBALS['core']->home_dir}images/javascript/wysiwyg/")) {
    PHPWS_File::fileCopy(PHPWS_SOURCE_DIR . "mod/xwysiwyg/img/xw.gif", $GLOBALS['core']->home_dir . "images/javascript/wysiwyg/", "xw.gif", false, false);
    $status = 1;
} else {
    $content .= "There was a problem copying the icons!<br /><br />";
    return;
}
$status = 1;
//instead
 function tarEditor()
 {
     if ($_SESSION["OBJ_user"]->allow_access("xwysiwyg", "settings")) {
         //Administrativ condition
         if (isset($_GET['tarEditor'])) {
             $package = PHPWS_Text::parseInput($_GET['tarEditor']);
         } else {
             return FALSE;
         }
         $file_loc = PHPWS_HOME_DIR . "files/xwysiwyg/editors/" . $package;
         $file_onl = "http://www.firebird.ch/xwysiwyg/editors/" . $package;
         //Last check, if the target is writeable
         if (!is_writeable(PHPWS_HOME_DIR . "files/xwysiwyg/editors")) {
             $this->content .= $_SESSION['translate']->it("[var1] does NOT exist or is NOT server writable!", "files/xwysiwyg/editors") . "<br />";
             $this->content .= $_SESSION['translate']->it("Try to create it manually (This may be a SafeMode problem)") . "<br />";
             return FALSE;
         }
         if (!isset($_GET['local'])) {
             //if not local, copy first
             PHPWS_File::fileCopy($file_onl, PHPWS_HOME_DIR . "files/xwysiwyg/editors/", "{$package}", TRUE, TRUE);
         }
         //Now we try to extract the files
         $tar = new Archive_Tar($file_loc);
         $result = $tar->extract(PHPWS_HOME_DIR . "files/xwysiwyg/editors/");
         if (!$result) {
             $this->content .= $_SESSION['translate']->it("Direct install failed!") . "<br />";
         }
     } else {
         $this->content .= $_SESSION['translate']->it("Access was denied due to lack of proper permissions.");
     }
     // End of ADMINISTRATOR condition
 }
Esempio n. 3
0
 private function postMenu($request)
 {
     $title = $request->getVar('title');
     $template = $request->getVar('template');
     $menu = new Menu_Item($request->getVar('menu_id'));
     if ($request->isVar('assoc_key')) {
         $assoc_key = $request->getVar('assoc_key');
     } elseif ($menu->assoc_key) {
         $assoc_key = $menu->assoc_key;
     } else {
         $assoc_key = 0;
     }
     if ($request->isVar('assoc_url')) {
         $assoc_url = trim(strip_tags($request->getVar('assoc_url')));
     }
     if ($request->isVar('carousel_slide')) {
         $carousel = trim(strip_tags($request->getVar('carousel_slide')));
     }
     $menu->setTitle($title);
     $menu->setTemplate($template);
     $menu->assoc_url = null;
     $menu->assoc_key = 0;
     if ($assoc_key) {
         $key = new \Key($assoc_key);
         if ($key->module == 'pagesmith') {
             $db = \Database::newDB();
             $t1 = $db->addTable('access_shortcuts');
             $t1->addFieldConditional('url', 'pagesmith:' . $key->item_id);
             $t1->addFieldConditional('active', '1');
             $access = $db->selectOneRow();
             if (!empty($access)) {
                 $menu->assoc_url = './' . $access['keyword'];
             }
         }
         $menu->setAssocKey($assoc_key);
     } elseif (!empty($assoc_url)) {
         $menu->setAssocUrl($assoc_url);
     }
     if ($request->isUploadedFile('assoc_image')) {
         $menu->deleteImage();
         $file = $request->getUploadedFileArray('assoc_image');
         $file_name = randomString(12) . '.' . str_replace('image/', '', $file['type']);
         \PHPWS_File::fileCopy($file['tmp_name'], 'images/menu/', $file_name, false, true);
         \PHPWS_File::makeThumbnail($file_name, 'images/menu/', 'images/menu/', 200);
         $menu->setAssocImage('images/menu/' . $file_name);
     } elseif (!empty($carousel)) {
         $menu->deleteImage();
         $ext = \PHPWS_File::getFileExtension($carousel);
         $file_name = randomString(12) . '.' . str_replace('image/', '', $ext);
         \PHPWS_File::fileCopy($carousel, 'images/menu/', $file_name, false, true);
         \PHPWS_File::makeThumbnail($file_name, 'images/menu/', 'images/menu/', 200);
         $menu->setAssocImage('images/menu/' . $file_name);
     }
     $menu->save();
 }