Example #1
0
 function Result()
 {
     global $page;
     if ($this->from_page && $this->title) {
         if (!$this->show_popup) {
             $url = common::AbsoluteUrl($this->title, '', true, false);
             $page->ajaxReplace[] = array('eval', '', 'window.location="' . $url . '";');
         }
         return true;
     }
     return $this->show_popup;
 }
Example #2
0
 /**
  * Perform a page copy
  *
  */
 function CopyPage()
 {
     global $gp_index, $gp_titles, $page, $langmessage;
     //existing page info
     $from_title = $_POST['from_title'];
     if (!isset($gp_index[$from_title])) {
         message($langmessage['OOPS_TITLE']);
         return false;
     }
     $from_index = $gp_index[$from_title];
     $info = $gp_titles[$from_index];
     //check the new title
     $title = $_POST['title'];
     $title = admin_tools::CheckPostedNewPage($title, $message);
     if ($title === false) {
         message($message);
         return false;
     }
     //get the existing content
     $from_file = gpFiles::PageFile($from_title);
     $contents = file_get_contents($from_file);
     //add to $gp_index first!
     $index = common::NewFileIndex();
     $gp_index[$title] = $index;
     $file = gpFiles::PageFile($title);
     if (!gpFiles::Save($file, $contents)) {
         message($langmessage['OOPS'] . ' (File not saved)');
         return false;
     }
     //add to gp_titles
     $new_titles = array();
     $new_titles[$index]['label'] = admin_tools::PostedLabel($_POST['title']);
     $new_titles[$index]['type'] = $info['type'];
     $gp_titles += $new_titles;
     if (!admin_tools::SavePagesPHP()) {
         message($langmessage['OOPS'] . ' (CP2)');
         return false;
     }
     message($langmessage['SAVED']);
     if (isset($_REQUEST['redir'])) {
         $url = common::AbsoluteUrl($title, '', true, false);
         $page->ajaxReplace[] = array('eval', '', 'window.setTimeout(function(){window.location="' . $url . '"},15000);');
         message(sprintf($langmessage['will_redirect'], common::Link_Page($title)));
     }
     return $index;
 }
Example #3
0
 static function IdUrl($request_cmd = 'cv')
 {
     global $config, $dataDir, $gpLayouts;
     $path = addon_browse_path . '/Resources?';
     //command
     $args['cmd'] = $request_cmd;
     $_SERVER += array('SERVER_SOFTWARE' => '');
     //checkin
     //$args['uniq'] = $config['gpuniq'];
     $args['mdu'] = substr(md5($config['gpuniq']), 0, 20);
     $args['site'] = common::AbsoluteUrl('');
     //keep full path for backwards compat
     $args['gpv'] = gpversion;
     $args['php'] = phpversion();
     $args['se'] =& $_SERVER['SERVER_SOFTWARE'];
     $args['data'] = $dataDir;
     $args['zlib'] = (int) function_exists('gzcompress');
     if (defined('service_provider_id') && is_numeric(service_provider_id)) {
         $args['provider'] = service_provider_id;
     }
     //plugins
     $addon_ids = array();
     if (isset($config['addons']) && is_array($config['addons'])) {
         foreach ($config['addons'] as $addon => $addon_info) {
             if (!isset($addon_info['id'])) {
                 continue;
             }
             $addon_id = $addon_info['id'];
             if (isset($addon_info['order'])) {
                 $addon_id .= '.' . $addon_info['order'];
             }
             $addon_ids[] = $addon_id;
         }
     }
     //themes
     if (isset($config['themes']) && is_array($config['themes'])) {
         foreach ($config['themes'] as $addon => $addon_info) {
             if (!isset($addon_info['id'])) {
                 continue;
             }
             $addon_id = $addon_info['id'];
             if (isset($addon_info['order'])) {
                 $addon_id .= '.' . $addon_info['order'];
             }
             $addon_ids[] = $addon_id;
         }
     }
     //layouts
     if (is_array($gpLayouts)) {
         foreach ($gpLayouts as $layout_info) {
             if (!isset($layout_info['addon_id'])) {
                 continue;
             }
             $addon_ids[] = $layout_info['addon_id'];
         }
     }
     $addon_ids = array_unique($addon_ids);
     $args['as'] = implode('-', $addon_ids);
     return $path . http_build_query($args, '', '&');
 }
 /**
  * Try to fetch a response using RemoteGet to see if we're getting a 500 error
  *
  * @access public
  * @static
  * @since 1.7
  *
  * @return boolean
  */
 static function TestResponse()
 {
     //get url, force gp_rewrite to $new_gp_rewrite
     $rewrite_before = $_SERVER['gp_rewrite'];
     $_SERVER['gp_rewrite'] = true;
     common::SetLinkPrefix();
     $abs_url = common::AbsoluteUrl('Site_Map', '', true, false);
     $_SERVER['gp_rewrite'] = $rewrite_before;
     common::SetLinkPrefix();
     $result = gpRemoteGet::Get_Successful($abs_url);
     if (!$result) {
         return false;
     }
     return true;
 }
Example #5
0
 function IdUrl($request_cmd = 'cv')
 {
     global $config, $gpversion, $addonBrowsePath;
     $path = $addonBrowsePath . '/Special_Resources?';
     //command
     $args['cmd'] = $request_cmd;
     $_SERVER += array('SERVER_SOFTWARE' => '');
     //checkin
     //$args['uniq'] = $config['gpuniq'];
     $args['mdu'] = substr(md5($config['gpuniq']), 0, 20);
     $args['site'] = common::AbsoluteUrl('');
     //keep full path for backwards compat
     $args['gpv'] = $gpversion;
     $args['php'] = phpversion();
     $args['se'] =& $_SERVER['SERVER_SOFTWARE'];
     if (defined('service_provider_id') && is_numeric(service_provider_id)) {
         $args['provider'] = service_provider_id;
     }
     //plugins
     $addon_ids = array();
     if (isset($config['addons']) && is_array($config['addons'])) {
         foreach ($config['addons'] as $addon => $addon_info) {
             if (isset($addon_info['id'])) {
                 $addon_id = $addon_info['id'];
                 if (isset($addon_info['order'])) {
                     $addon_id .= '.' . $addon_info['order'];
                 }
                 $addon_ids[] = $addon_id;
             }
         }
     }
     //themes
     if (isset($config['themes']) && is_array($config['themes'])) {
         foreach ($config['themes'] as $addon => $addon_info) {
             if (isset($addon_info['id'])) {
                 $addon_id = $addon_info['id'];
                 if (isset($addon_info['order'])) {
                     $addon_id .= '.' . $addon_info['order'];
                 }
                 $addon_ids[] = $addon_id;
             }
         }
     }
     $args['as'] = implode('-', $addon_ids);
     return $path . http_build_query($args, '', '&');
 }
Example #6
0
 /**
  * Message or redirect when file is saved
  *
  */
 public function HiddenSaved($new_index)
 {
     global $langmessage;
     msg($langmessage['SAVED']);
     $this->search_page = 0;
     //take user back to first page where the new page will be displayed
     if (isset($_REQUEST['redir'])) {
         $title = common::IndexToTitle($new_index);
         $url = common::AbsoluteUrl($title, '', true, false);
         $page->ajaxReplace[] = array('location', $url, 0);
     }
 }
Example #7
0
 /**
  * Try to fetch a response using RemoteGet to see if we're getting a 500 error
  *
  * @access public
  * @static
  * @since 1.7
  *
  * @return boolean
  */
 public static function TestResponse($new_rewrite = true)
 {
     //get url, force gp_rewrite to $new_gp_rewrite
     $rewrite_before = $_SERVER['gp_rewrite'];
     $_SERVER['gp_rewrite'] = $new_rewrite;
     common::SetLinkPrefix();
     $abs_url = common::AbsoluteUrl('Site_Map', '', true, false);
     //can't be special_site_map, otherwise common::IndexToTitle() will be called during install
     $_SERVER['gp_rewrite'] = $rewrite_before;
     common::SetLinkPrefix();
     return self::ConfirmGet($abs_url, false);
 }