ActionApps PHP Cross Reference Groupware Applications

Source: /admin/se_inter_import2.php3 - 109 lines - 5242 bytes - Summary - Text - Print

   1  <?php
   2  /** se_inter_import2.php3 - Inter node feed import settings
   3   *
   4   *             $slice_id
   5   *   optionaly $Msg to show under <h1>Headline</h1> (typicaly: Fields' mapping update)
   6   *
   7   * PHP versions 4 and 5
   8   *
   9   * LICENSE: This program is free software; you can redistribute it and/or modify
  10   * it under the terms of the GNU General Public License as published by
  11   * the Free Software Foundation; either version 2 of the License, or
  12   * (at your option) any later version.
  13   *
  14   * This program is distributed in the hope that it will be useful,
  15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17   * GNU General Public License for more details.
  18   *
  19   * You should have received a copy of the GNU General Public License
  20   * along with this program (LICENSE); if not, write to the Free Software
  21   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22   *
  23   * @version   $Id: se_inter_import2.php3 2483 2007-08-24 16:34:18Z honzam $
  24   * @author    Honza Malik <honza.malik@ecn.cz>
  25   * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
  26   * @copyright Copyright (C) 1999, 2000 Association for Progressive Communications
  27   * @link      http://www.apc.org/ APC
  28   *
  29  */
  30  
  31  require_once  "../include/init_page.php3";
  32  
  33  if (!IfSlPerm(PS_FEEDING)) {
  34      MsgPage($sess->url(self_base()."index.php3"), _m("You have not permissions to change feeding setting"));
  35      exit;
  36  }
  37  
  38  require_once  AA_INC_PATH."formutil.php3";
  39  require_once  AA_INC_PATH."xml_fetch.php3";
  40  require_once  AA_INC_PATH."xml_rssparse.php3";
  41  require_once  AA_INC_PATH."csn_util.php3";
  42  
  43  $db->query("SELECT server_url, password FROM nodes WHERE name='$rem_nodes'");
  44  if ($db->next_record()) {
  45      $server_url = $db->f('server_url');
  46      $password   = $db->f('password');
  47  }
  48  
  49  if (!($data = xml_fetch($server_url, ORG_NAME, $password, $auth->auth["uname"],"",0,""))) {
  50      MsgPage($sess->url(self_base() . "se_inter_import.php3"), _m("Unable to connect and/or retrieve data from the remote node. Contact the administrator of the local node.") );
  51  }
  52  
  53  // find out first character of fetched data: if it is not '<' exit
  54  if (substr($data,0,1) != "<") {
  55      AA_Log::write("CSN","Establishing mode: $data");
  56      switch ($data) {
  57          case ERR_NO_SLICE : $err_msg = _m("No slices available. You have not permissions to import any data of that node. Contact the administrator of the remote slice and check, that he obtained your correct username."); break;
  58          case ERR_PASSWORD : $err_msg = _m("Invalid password for the node name:") . " ".ORG_NAME . ". "._m("Contact the administrator of the local node."); break;
  59          default:            $err_msg = _m("Remote server returns following error:") . " $data"; break;
  60      }
  61      MsgPage($sess->url(self_base() . "se_inter_import.php3"), $err_msg); // $data contains error message
  62  }                                                                   // from the server module
  63  
  64  // try to parse xml document
  65  if (!($aa_rss = aa_rss_parse($data,"establish_mode"))) {
  66      AA_Log::write("CSN","Establishing mode: Unable to parse XML data");
  67      MsgPage($sess->url(self_base() . "se_inter_import.php3"), _m("Unable to connect and/or retrieve data from the remote node. Contact the administrator of the local node.") );
  68  }
  69  
  70  while (list($id,) = each($aa_rss['channels'])) {
  71      $chan[$id] = $aa_rss['channels'][$id]['title'];
  72  }
  73  
  74  $err["Init"] = "";          // error array (Init - just for initializing variable
  75  HtmlPageBegin();   // Print HTML start page tags (html begin, encoding, style sheet, but no title)
  76  
  77  echo '<title>'. _m("Inter node import settings") ."</title>\n<head>\n";
  78  FrmJavascript('function InitPage() {}');
  79  echo "\n</head>\n<body>\n";
  80  
  81  $useOnLoad = true;
  82  require_once  AA_INC_PATH."menu.php3";
  83  showMenu($aamenus, "sliceadmin","n_import");
  84  
  85  echo "<h1><b>" . _m("Inter node import settings"). "</b></h1>";
  86  PrintArray($err);
  87  echo $Msg;
  88  
  89  $form_buttons = array("new_in_feed"      => array('type'=>'submit', 'value'=>_m("Choose slice")),
  90                        "cancel"           => array('url'=>'se_inter_import.php3'),
  91                        "remote_node_name" => array( 'type' => 'hidden', 'value' => $rem_nodes),
  92                        "aa"               => array( 'type' => 'hidden', 'value' => htmlspecialchars(serialize($aa_rss)))
  93                       );
  94  
  95  ?>
  96  <form method="post" name="f" action="<?php echo $sess->url(self_base() . "se_inter_import3.php3")?>">
  97  <?php
  98    FrmTabCaption(_m("List of available slices from the node "). "<b>$rem_nodes</b>", '','', $form_buttons, $sess, $slice_id);
  99    FrmInputMultiSelect('f_slices[]', _m('Slice to import'), $chan, '', 5, false, true);
 100    FrmInputChBox('exact_copy', _m("Exact copy"), $exact_copy, false, '', 1, false,
 101                 _m('The slice will be exact copy of the remote slice. All items will be copied including holdingbin and trash bin items. Also on anychange in the remote item, the content will be copied to local copy of the item. The items will have the same long ids (not the short ones!). It make no sence to change items in local copy - it will be overwriten from remote master.'));
 102  
 103    FrmTabEnd($form_buttons, $sess, $slice_id);
 104  ?>
 105  </form>
 106  <?php
 107  HtmlPageEnd();
 108  page_close();
 109  ?>

title

Description

title

Description

title

Description

title

title

Body