function votesys_edit_vote_site_form()
{
    echo "<h1>Balsavimo svetaines redagavimas</h1>";
    if (isset($_POST['save_edit']) && isset($_POST['site_id'])) {
        edit_site();
        echo "Balsavimo svetaine <b>" . $_POST['site_name'] . "</b> sekmingai atnaujinta!<br><br>";
        echo "<form action='" . get_admin_url() . "admin.php?page=edit_vote_site' id='option_form' method='POST'>";
        echo "<input type='hidden' name='site_id' value='" . $_POST['site_id'] . "'>";
        echo "<input type='submit' value='GRYZTI I REDAGAVIMA'></form>";
        echo "<form action='" . get_admin_url() . "admin.php?page=manage_sites' id='option_form' method='POST'>";
        echo "<input type='submit' value='GRYZTI I SVETAINIU VALDYMA'></form>";
    } else {
        if (isset($_POST['site_id']) && isset($_POST['delete_site'])) {
            delete_site();
            echo "<b>Svetaine sekmingai istrinta!</b>";
            echo "<form action='" . get_admin_url() . "admin.php?page=manage_sites' id='option_form' method='POST'>";
            echo "<input type='submit' value='GRYZTI I SVETAINIU VALDYMA'></form>";
        } else {
            if (isset($_POST['site_id'])) {
                generate_edit_form();
            } else {
                echo "<b>Prasome pasirinkti svetaine redagavimui!</b><br><br>";
                generate_site_table();
            }
        }
    }
}
Example #2
0
// +-----------------------------------------------------------------------+
// |                            actions on site                            |
// +-----------------------------------------------------------------------+
if (isset($_GET['site']) and is_numeric($_GET['site'])) {
    $page['site'] = $_GET['site'];
}
if (isset($_GET['action']) and isset($page['site'])) {
    $query = '
SELECT galleries_url
  FROM ' . SITES_TABLE . '
  WHERE id = ' . $page['site'] . '
;';
    list($galleries_url) = pwg_db_fetch_row(pwg_query($query));
    switch ($_GET['action']) {
        case 'delete':
            delete_site($page['site']);
            $page['infos'][] = $galleries_url . ' ' . l10n('deleted');
            break;
    }
}
$template->assign(array('F_ACTION' => get_root_url() . 'admin.php' . get_query_string_diff(array('action', 'site', 'pwg_token')), 'PWG_TOKEN' => get_pwg_token()));
$query = '
SELECT c.site_id, COUNT(DISTINCT c.id) AS nb_categories, COUNT(i.id) AS nb_images
  FROM ' . CATEGORIES_TABLE . ' AS c LEFT JOIN ' . IMAGES_TABLE . ' AS i
  ON c.id=i.storage_category_id 
  WHERE c.site_id IS NOT NULL
  GROUP BY c.site_id
;';
$sites_detail = hash_from_query($query, 'site_id');
$query = '
SELECT *
Example #3
0
 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>
</html>
Example #4
0
    $sites_es = new entity_selector();
    $sites_es->add_type(id_of('site'));
    $sites_es->add_relation('entity.unique_name NOT IN ("' . implode('","', $minimal_sites) . '")');
    $sites_es->set_num($num_sites);
    $sites_es->set_order('entity.last_modified DESC');
    $sites = $sites_es->run_one();
    $test_mode = true;
    if (!PREVENT_MINIMIZATION_OF_REASON_DB && !empty($_POST['do_it'])) {
        $test_mode = false;
    }
    if (!empty($sites)) {
        foreach ($sites as $site_id => $site) {
            if ($test_mode) {
                pray(delete_site($site_id, false, array(), $limit));
            } else {
                pray(delete_site($site_id, true, array(), $limit));
            }
        }
    } else {
        echo '<p>It appears that all of the sites have been deleted. You are now ready to start <a href="minimize_2.php">step 2</a>.</p>';
    }
    echo '<p><a href="?">Return to form</a></p>';
}
function delete_site($site_id, $do_it = false, $types = array(), $limit_dels = -1)
{
    static $all_types = array();
    if (empty($all_types)) {
        $es = new entity_selector();
        $es->add_type(id_of('type'));
        $all_types = $es->run_one();
    }
Example #5
0
    function delete_multiple_site_page()
    {
        global $wpdb;
        if (isset($_POST['delete_multiple']) && isset($_POST['deleted_sites'])) {
            foreach ($_POST['deleted_sites'] as $deleted_site) {
                $result = delete_site((int) $deleted_site, isset($_POST['override']));
                if (is_a($result, 'WP_Error')) {
                    wp_die($result->get_error_message());
                }
            }
            $_GET['deleted'] = 'yes';
            $_GET['action'] = 'saved';
        } else {
            /** ensure a list of sites was sent */
            if (!isset($_POST['allsites'])) {
                wp_die(__('You have not selected any networks to delete.'));
            }
            /** Ensure that all sites are integers */
            $allsites = array_map(create_function('$val', 'return (int)$val;'), $_POST['allsites']);
            /** ensure each site is valid */
            foreach ($allsites as $site) {
                if (!site_exists((int) $site)) {
                    wp_die(__('You have selected an invalid network.', 'njsl-networks'));
                }
            }
            /** remove primary site from list */
            if (in_array(1, $allsites)) {
                $sites = array();
                foreach ($allsites as $site) {
                    if ($site != 1) {
                        $sites[] = $site;
                    }
                }
                $allsites = $sites;
            }
            $query = "SELECT * FROM {$wpdb->site} WHERE id IN (" . implode(',', $allsites) . ')';
            $site = $wpdb->get_results($query);
            if (!$site) {
                wp_die(__('You have selected an invalid network or networks.', 'njsl-networks'));
            }
            $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id IN (" . implode(',', $allsites) . ')';
            $blogs = $wpdb->get_results($query);
            ?>
			<form method="POST" action="<?php 
            echo add_query_arg(array('action' => false, 'id' => false));
            ?>
"><div>
			<h2><?php 
            _e('Delete Multiple Networks', 'njsl-networks');
            ?>
</h2>
			<?php 
            if ($blogs) {
                if (RESCUE_ORPHANED_BLOGS && ENABLE_HOLDING_SITE) {
                    ?>
					
			<div id="message" class="error">
				<h3><?php 
                    _e('You have selected the following networks for deletion', 'njsl-networks');
                    ?>
:</h3>
				<ul>
				<?php 
                    foreach ($site as $deleted_site) {
                        ?>
					<li><input type="hidden" name="deleted_sites[]" value="<?php 
                        echo $deleted_site->id;
                        ?>
" /><?php 
                        echo $deleted_site->domain . $deleted_site->path;
                        ?>
</li>
				<?php 
                    }
                    ?>
				</ul>
				<p><?php 
                    _e('There are sites assigned to one or more of these networks.', 'njsl-networks');
                    _e('Deleting them will move these sites to the holding network.', 'njsl-networks');
                    ?>
</p>
				<p><label for="override"><?php 
                    _e('If you still want to delete these networks, check the following box', 'njsl-networks');
                    ?>
:</label> <input type="checkbox" name="override" id="override" /></p>
			</div>
					
					<?php 
                } else {
                    ?>
					
			<div id="message" class="error">
				<h3><?php 
                    _e('You have selected the following networks for deletion', 'njsl-networks');
                    ?>
:</h3>
				<ul>
				<?php 
                    foreach ($site as $deleted_site) {
                        ?>
					<li><input type="hidden" name="deleted_sites[]" value="<?php 
                        echo $deleted_site->id;
                        ?>
" /><?php 
                        echo $deleted_site->domain . $deleted_site->path;
                        ?>
</li>
				<?php 
                    }
                    ?>
				</ul>
				<p><?php 
                    _e('There are sites associated with one or more of these networks.', 'njsl-networks');
                    _e('Deleting them will delete those sites as well.', 'njsl-networks');
                    ?>
</p>
				<p><label for="override"><?php 
                    _e('If you still want to delete these networks, check the following box', 'njsl-networks');
                    ?>
:</label> <input type="checkbox" name="override" id="override" /></p>
			</div>
					
					<?php 
                }
            } else {
                ?>
					
			<div id="message">
				<h3><?php 
                _e('You have selected the following networks for deletion', 'njsl-networks');
                ?>
:</h3>
				<ul>
				<?php 
                foreach ($site as $deleted_site) {
                    ?>
					<li><input type="hidden" name="deleted_sites[]" value="<?php 
                    echo $deleted_site->id;
                    ?>
" /><?php 
                    echo $deleted_site->domain . $deleted_site->path;
                    ?>
</li>
				<?php 
                }
                ?>
				</ul>
			</div>
					
				<?php 
            }
            ?>
				<p><?php 
            _e('Are you sure you want to delete these networks?', 'njsl-networks');
            ?>
</p>
				<?php 
            submit_button(__('Delete Networks', 'njsl-networks'), 'primary', 'delete_multiple', false);
            ?>
 
				<input type="submit" name="cancel" value="<?php 
            _e('Cancel', 'njsl-networks');
            ?>
" class="button" />
			</div></form>
			<?php 
        }
    }
Example #6
0
 * User: Administrator
 * Date: 7/4/2015
 * Time: 9:33 PM
 */
switch ($_GET['action']) {
    case 'add_site':
        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);