/** * @todo document this */ function action_skinieoverview() { global $member, $DIR_LIBS, $manager; $member->isAdmin() or $this->disallow(); // load skinie class include_once $DIR_LIBS . 'skinie.php'; $this->pagehead(); echo '<p><a href="index.php?action=manage">(', _BACKTOMANAGE, ')</a></p>'; ?> <h2><?php echo _SKINIE_TITLE_IMPORT; ?> </h2> <p><label for="skinie_import_local"><?php echo _SKINIE_LOCAL; ?> </label> <?php global $DIR_SKINS; $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS); if (sizeof($candidates) > 0) { ?> <form method="post" action="index.php"><div> <input type="hidden" name="action" value="skinieimport" /> <?php $manager->addTicketHidden(); ?> <input type="hidden" name="mode" value="file" /> <select name="skinfile" id="skinie_import_local"> <?php foreach ($candidates as $skinname => $skinfile) { $html = htmlspecialchars($skinfile); echo '<option value="', $html, '">', $skinname, '</option>'; } ?> </select> <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT; ?> " /> </div></form> <?php } else { echo _SKINIE_NOCANDIDATES; } ?> </p> <p><em><?php echo _OR; ?> </em></p> <form method="post" action="index.php"><p> <?php $manager->addTicketHidden(); ?> <input type="hidden" name="action" value="skinieimport" /> <input type="hidden" name="mode" value="url" /> <label for="skinie_import_url"><?php echo _SKINIE_FROMURL; ?> </label> <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" /> <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT; ?> " /> </p></form> <h2><?php echo _SKINIE_TITLE_EXPORT; ?> </h2> <form method="post" action="index.php"><div> <input type="hidden" name="action" value="skinieexport" /> <?php $manager->addTicketHidden(); ?> <p><?php echo _SKINIE_EXPORT_INTRO; ?> </p> <table><tr> <th colspan="2"><?php echo _SKINIE_EXPORT_SKINS; ?> </th> </tr><tr> <?php // show list of skins $res = sql_query('SELECT * FROM ' . sql_table('skin_desc')); while ($skinObj = sql_fetch_object($res)) { $id = 'skinexp' . $skinObj->sdnumber; echo '<td><input type="checkbox" name="skin[', $skinObj->sdnumber, ']" id="', $id, '" />'; echo '<label for="', $id, '">', htmlspecialchars($skinObj->sdname), '</label></td>'; echo '<td>', htmlspecialchars($skinObj->sddesc), '</td>'; echo '</tr><tr>'; } echo '<th colspan="2">', _SKINIE_EXPORT_TEMPLATES, '</th></tr><tr>'; // show list of templates $res = sql_query('SELECT * FROM ' . sql_table('template_desc')); while ($templateObj = sql_fetch_object($res)) { $id = 'templateexp' . $templateObj->tdnumber; echo '<td><input type="checkbox" name="template[', $templateObj->tdnumber, ']" id="', $id, '" />'; echo '<label for="', $id, '">', htmlspecialchars($templateObj->tdname), '</label></td>'; echo '<td>', htmlspecialchars($templateObj->tddesc), '</td>'; echo '</tr><tr>'; } ?> <th colspan="2"><?php echo _SKINIE_EXPORT_EXTRA; ?> </th> </tr><tr> <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td> </tr><tr> <th colspan="2"><?php echo _SKINIE_TITLE_EXPORT; ?> </th> </tr><tr> <td colspan="2"><input type="submit" value="<?php echo _SKINIE_BTN_EXPORT; ?> " /></td> </tr></table> </div></form> <?php $this->pagefoot(); }
/** * Install custom skins * Prepares the installation of custom skins */ function installCustomSkins(&$manager) { global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS; $aErrors = array(); global $manager; if (empty($manager)) { $manager = new MANAGER(); } if (count($aConfSkinsToImport) == 0) { return $aErrors; } // load skinie class include_once $DIR_LIBS . 'skinie.php'; $importer = new SKINIMPORT(); foreach ($aConfSkinsToImport as $skinName) { $importer->reset(); $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml'; if (!@file_exists($skinFile)) { array_push($aErrors, _ERROR23_1 . $skinFile . ' : ' . _ERROR23_2); continue; } $error = $importer->readFile($skinFile); if ($error) { array_push($aErrors, _ERROR24 . $skinName . ' : ' . $error); continue; } $error = $importer->writeToDatabase(1); if ($error) { array_push($aErrors, _ERROR24 . $skinName . ' : ' . $error); continue; } } return $aErrors; }