Пример #1
0
 // prepare to pack
 $pack_error = '';
 $pack_list = array();
 $pack_replace = array('./theme_info.cfg' => $theme_data);
 // pack style
 for ($i = 0; $i < sizeof($theme_rowset); $i++) {
     $id = $theme_rowset[$i]['themes_id'];
     $theme_name = $theme_rowset[$i]['style_name'];
     for ($j = 0; $j < $total; $j++) {
         if (!empty($_POST['export_style_name_' . $j]) && $_POST['export_style_id_' . $j] == $id) {
             $theme_name = stripslashes($_POST['export_style_name_' . $j]);
         }
     }
     $theme_rowset[$i]['style_name'] = $theme_name;
 }
 $data = pack_style($export, $exportas, $theme_rowset, '');
 // check errors
 if ($pack_error) {
     xs_error(str_replace('{TPL}', $export, $lang['xs_export_error']) . $pack_error . '<br /><br />' . $lang['xs_clone_back']);
 }
 if (!$data) {
     xs_error(str_replace('{TPL}', $export, $lang['xs_export_error2']) . '<br /><br />' . $lang['xs_clone_back']);
 }
 // save as file
 $filename = 'clone_' . time() . '.tmp';
 $tmp_filename = XS_TEMP_DIR . $filename;
 $f = @fopen($tmp_filename, 'wb');
 if (!$f) {
     xs_error(str_replace('{FILE}', $tpl_filename, $lang['xs_error_cannot_create_tmp']) . '<br /><br />' . $lang['xs_clone_back']);
 }
 fwrite($f, $data);
Пример #2
0
 // prepare to pack
 $pack_error = '';
 $pack_list = array();
 $pack_replace = array('./theme_info.cfg' => $theme_data);
 // pack style
 for ($i = 0; $i < count($theme_rowset); $i++) {
     $id = $theme_rowset[$i]['themes_id'];
     $theme_name = $theme_rowset[$i]['style_name'];
     for ($j = 0; $j < $total; $j++) {
         if (!empty($HTTP_POST_VARS['export_style_name_' . $j]) && $HTTP_POST_VARS['export_style_id_' . $j] == $id) {
             $theme_name = stripslashes($HTTP_POST_VARS['export_style_name_' . $j]);
         }
     }
     $theme_rowset[$i]['style_name'] = $theme_name;
 }
 $data = pack_style($export, $exportas, $theme_rowset, $comment);
 // check errors
 if ($pack_error) {
     xs_error(str_replace('{TPL}', $export, $lang['xs_export_error']) . $pack_error . '<br /><br />' . $lang['xs_export_back']);
 }
 if (!$data) {
     xs_error(str_replace('{TPL}', $export, $lang['xs_export_error2']) . '<br /><br />' . $lang['xs_export_back']);
 }
 //
 // Got file. Sending it.
 //
 $send_method = isset($HTTP_POST_VARS['export_to']) ? $HTTP_POST_VARS['export_to'] : '';
 $export_filename = empty($HTTP_POST_VARS['export_filename']) ? $exportas . STYLE_EXTENSION : $HTTP_POST_VARS['export_filename'];
 if ($send_method === 'file') {
     // store on local server
     $send_dir = isset($HTTP_POST_VARS['export_to_dir']) ? $HTTP_POST_VARS['export_to_dir'] : '';