} else { $outoforder = 0; } if (isset($_POST['newdescription_revision'])) { $newdescription_revision = 1; } else { $newdescription_revision = 0; } } if ($updatesite) { update_site($claimsiteid, $site_name, $site_processoris64bits, $site_processorvendor, $site_processorvendorid, $site_processorfamilyid, $site_processormodelid, $site_processorcachesize, $site_numberlogicalcpus, $site_numberphysicalcpus, $site_totalvirtualmemory, $site_totalphysicalmemory, $site_logicalprocessorsperphysical, $site_processorclockfrequency, $site_description, $site_ip, $site_latitude, $site_longitude, !$newdescription_revision, $outoforder); } // If we should retrieve the geolocation if ($geolocation) { $location = get_geolocation($site_ip); update_site($claimsiteid, $site_name, $site_processoris64bits, $site_processorvendor, $site_processorvendorid, $site_processorfamilyid, $site_processormodelid, $site_processorcachesize, $site_numberlogicalcpus, $site_numberphysicalcpus, $site_totalvirtualmemory, $site_totalphysicalmemory, $site_logicalprocessorsperphysical, $site_processorclockfrequency, $site_description, $site_ip, $location['latitude'], $location['longitude'], false, $outoforder); } // If we have a projectid that means we should list all the sites @($projectid = $_GET['projectid']); if ($projectid != null) { $projectid = pdo_real_escape_numeric($projectid); } if (isset($projectid) && is_numeric($projectid)) { $project_array = pdo_fetch_array(pdo_query("SELECT name FROM project WHERE id='{$projectid}'")); $xml .= '<project>'; $xml .= add_XML_value('id', $projectid); $xml .= add_XML_value('name', $project_array['name']); $xml .= '</project>'; // Select sites that belong to this project $beginUTCTime = gmdate(FMT_DATETIME, time() - 3600 * 7 * 24); // 7 days
if (isset($_POST['site_path'])) { $site_path = $_POST['site_path']; } if (isset($_POST['site_name'])) { $site_name = $_POST['site_name']; } if (isset($_POST['motto'])) { $motto = $_POST['motto']; } if (isset($_POST['background'])) { $background = $_POST['background']; } if (isset($_POST['logo'])) { $logo = $_POST['logo']; } if (isset($_POST['meta_author'])) { $meta_author = $_POST['meta_author']; } if (isset($_POST['meta_keywords'])) { $meta_keywords = $_POST['meta_keywords']; } if (isset($_POST['meta_description'])) { $meta_description = $_POST['meta_description']; } if ($site_path != '') { echo "Going to modify: {$site_path} {$site_name} {$motto} {$background} {$logo} {$meta_author} {$meta_author} {$meta_keywords} {$meta_description}"; $result = update_site($db, $site_path, $site_name, $motto, $background, $logo, $meta_author, $meta_author, $meta_keywords, $meta_description); header("Location: ../?section=site_settings&error={$result}"); } elseif ($pass == '') { header("Location: ../?section=site_settings&error=URL_empty"); }
function edit_site_page() { global $wpdb, $current_site, $wp_version; if (isset($_POST['update']) && isset($_GET['id'])) { $site = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->site} WHERE id=%d", $_GET['id'])); if (!$site) { wp_die(__('Invalid network ID selected', 'njsl-networks')); } switch_to_site((int) $_GET['id']); $upload_handling = get_site_option('ms_files_rewriting'); $primary_blog_id = $current_site->blog_id; restore_current_site(); if (isset($_POST['upload_handling']) && $_POST['upload_handling'] != 'auto') { // Update the site / network update_site((int) $_GET['id'], $_POST['domain'], $_POST['path'], array('ms_files_rewriting' => $_POST['upload_handling'] == 'php' ? '1' : '0')); // Update the primary blog / site if ($_POST['upload_handling'] == 'direct' && $upload_handling) { // If switching from PHP to direct serving, need to fix upload_url_path // on the network's primary site (if one exists) if (!empty($primary_blog_id)) { $upload_dir = WP_CONTENT_DIR . '/uploads'; $current_siteurl = get_option('siteurl'); $new_siteurl = untrailingslashit(get_blogaddress_by_id($primary_blog_id)); $upload_url = str_replace($current_siteurl, $new_siteurl, WP_CONTENT_URL); $upload_url = $upload_url . '/uploads'; if (defined('MULTISITE')) { $ms_dir = '/sites/' . $primary_blog_id; } else { $ms_dir = '/' . $primary_blog_id; } $upload_dir .= $ms_dir; $upload_url .= $ms_dir; update_blog_option($primary_blog_id, 'upload_path', $upload_dir); update_blog_option($primary_blog_id, 'upload_url_path', $upload_url); } } else { if ($_POST['upload_handling'] == 'php') { // If switching to PHP serving, remove upload_url_path to allow // native processing to work if (!empty($primary_blog_id)) { delete_blog_option($primary_blog_id, 'upload_path', ''); delete_blog_option($primary_blog_id, 'upload_url_path', ''); } } } } else { update_site((int) $_GET['id'], $_POST['domain'], $_POST['path']); if (isset($_POST['upload_handling']) && $_POST['upload_handling'] == 'auto') { switch_to_site((int) $_GET['id']); delete_site_option('ms_files_rewriting'); restore_current_site(); } } $_GET['updated'] = 'true'; $_GET['action'] = 'saved'; } else { $site = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->site} WHERE id=%d", $_GET['id'])); if (!$site) { wp_die(__('Invalid network ID selected', 'njsl-networks')); } switch_to_site((int) $_GET['id']); $upload_handling = get_site_option('ms_files_rewriting'); restore_current_site(); if (is_bool($upload_handling)) { $upload_default = $upload_handling; $upload_handling = 'auto'; } else { if ($upload_handling === '0') { $upload_handling = 'direct'; } else { $upload_handling = 'php'; } } if (!isset($upload_default)) { $upload_default = 'Unknown'; } else { $upload_default = $upload_default ? 'PHP' : 'Direct'; } /* strip off the action tag */ $queryStr = add_query_arg(array('action' => false)); ?> <div class="wrap"> <div class="icon32" id="icon-ms-admin"><br></div> <h2><?php _e('Edit Network', 'njsl-networks'); ?> : <a href="http://<?php echo $site->domain . $site->path; ?> "><?php echo $site->domain . $site->path; ?> </a></h2> <form method="post" action="<?php echo $queryStr; ?> "> <table class="form-table"> <tr class="form-field"><th scope="row"><label for="domain"><?php _e('Domain', 'njsl-networks'); ?> </label></th><td> http://<input type="text" id="domain" name="domain" value="<?php echo $site->domain; ?> "></td></tr> <tr class="form-field"><th scope="row"><label for="path"><?php _e('Path', 'njsl-networks'); ?> </label></th><td><input type="text" id="path" name="path" value="<?php echo $site->path; ?> " /></td></tr> <?php if (version_compare($wp_version, '3.5', '>=')) { ?> <tr class="form-field"> <th scope="row"><label for="upload_handling"><?php _e('Upload Handling', 'njsl-networks'); ?> </label></th> <td> <select name="upload_handling" id="upload_handling"> <option value="auto" <?php selected($upload_handling, 'auto'); ?> ><?php printf(__('Auto (%s)', 'njsl-networks'), $upload_default); ?> </option> <option value="direct" <?php selected($upload_handling, 'direct'); ?> ><?php _e('Direct (WP 3.5+)', 'njsl-networks'); ?> </option> <option value="php" <?php selected($upload_handling, 'php'); ?> ><?php _e('PHP (WP < 3.5)', 'njsl-networks'); ?> </option> </select> <p class="alert"> <strong><?php _e('WARNING', 'njsl-networks'); ?> :</strong> <?php _e("Changing this setting may change your root site's upload path, making uploaded files inaccessible.", 'njsl-networks'); ?> </p> </td> </tr> <?php } ?> </table> <?php if (has_action('add_edit_site_option')) { ?> <h3>Options:</h3> <table class="form-table"> <?php do_action('add_edit_site_option'); ?> </table> <?php } ?> <p> <input type="hidden" name="siteId" value="<?php echo $site->id; ?> " /> <?php submit_button(__('Update Network', 'njsl-networks'), 'primary', 'update', false); ?> <a class="button" href="<?php echo $this->listPage; ?> "><?php _e('Cancel', 'njsl-networks'); ?> </a> </p> </form> </div> <?php } }
$action = isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : NULL); if ($action == NULL) $action='read'; // SWITCH sur l'action (CRUD) switch($action) { case 'create': create_site($id_site); break; case 'read': read_sites(); break; case 'update': update_site($id_site); break; case 'delete': delete_site($id_site); break; case 'right': check_right($id_site); break; default: read_sites(); break; } // fin de l'affichage de la colonne de droite echo "</td></tr></table>\n"; ?> </body>
add_site(); break; case 'get_location': get_location(); break; case 'get_site': get_site(); break; case 'delete_site': delete_site(); break; case ' get_sites_details': get_sites_details(); break; case 'update_site': update_site(); break; } function add_site() { $data = json_decode(file_get_contents("php://input")); $rgAddress = mysql_real_escape_string($data->rgAddress); $rgmanagername = mysql_real_escape_string($data->rgmanagername); $rgstartdate = mysql_real_escape_string($data->rgstartdate); $rgplandate = mysql_real_escape_string($data->rgplandate); $rgpactualdate = mysql_real_escape_string($data->rgpactualdate); $rgstatues = mysql_real_escape_string($data->rgstatues); $s = 1; //$upswd = mysql_real_escape_string($data->pswd); //$uemail = mysql_real_escape_string($data->email); $con = mysql_connect('localhost', 'root', '');