function search($json)
{
    function GetActive($id, $id2, $elem)
    {
        if ($id == $id2) {
            $rs = " active";
            echo '<span style="display: none" id="window_popup_hidden" sel_elem=' . $elem . '></span>';
        } else {
            $rs = "";
        }
        return $rs;
    }
    $model = Model::getModel();
    $type = $json[5055];
    $filters[50100] = ParseForSearch($json[9092]);
    $results = $model->getResourcesGen($filters, $type);
    $i = 0;
    if (!empty($results)) {
        //$json[50104]
        foreach ($results as $result) {
            $rets = $rets . '<a href="#" class="list-group-item popup_find_list_item' . GetActive($result->items[5048], $json[5099], '"popup_list' . $i . '"') . '" onclick="popup_list_change_item(this)" targetId="' . $json[50104] . '" itemId="' . $result->items[5048] . '" val="' . $result->items[501] . '" id="popup_list' . $i . '">' . $result->items[501] . '<br />' . $result->items[50136] . '</a>';
            $i++;
        }
    } else {
        $rets = '<span style="margin: 10px 0 0 10px;">Результатов нет</span>';
    }
    return $rets;
}
Beispiel #2
0
function EditBlock($block_id)
{
    global $db;
    if (isset($_POST['processed'])) {
        //Secure our data to prevent injection attacks.
        $weight = (int) addslashes($_POST['weight']);
        $dir_name = addslashes($_POST['dir_name']);
        $position = (int) addslashes($_POST['position']);
        $active = addslashes($_POST['active']);
        $title = addslashes($_POST['title']);
        if (!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position)) {
            echo "You must fill everything out before proceeding.";
            return;
        }
        //Update the database with the new data.
        $db->Query("UPDATE bayonet_blocks SET title = '{$title}', weight = '{$weight}', dir_name = '{$dir_name}', position = '{$position}', active = '{$active}' WHERE block_id = '{$block_id}'");
        //$isActive = $active ? "IS" : "IS NOT";
        echo "Block, '{$dir_name}', at position '{$weight}'(order) has been edited.\n";
        PageRedirect(3, "?op=blocks");
        //die, because we have completed what we wanted to do.
        return;
    }
    //Grab the page from the database according to the $page_id passed to the function.
    $result = $db->Query("SELECT weight,dir_name,position,active,title FROM bayonet_blocks WHERE block_id = '{$block_id}'");
    $block = $db->FetchRow($result);
    ?>
  You are currently editing the '<?php 
    echo $block['title'];
    ?>
' block<br /><br />
  <form action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
" method="post">
  <table align="center">
  <tr><th>Title</th><td><input type="text" name="title" value="<?php 
    echo $block['title'];
    ?>
" /></td></tr>
  <tr><th>Weight</th><td><input type="text" name="weight" value="<?php 
    echo $block['weight'];
    ?>
" /></td></tr>
  <tr><th>Position</th><td><?php 
    GetPosition($block['position']);
    ?>
</td></tr>
  <tr><th>Directory Name</th><td><input type="text" name="dir_name" value="<?php 
    echo $block['dir_name'];
    ?>
" /></td>
  <tr><th>Active</th><td>
    <select name="active">
      <?php 
    GetActive($block_id, $block['active']);
    ?>
  
    </select>
  </td>
  
  <tr><th colspan="2"><input type="submit" name="processed" value="Submit" /><?php 
    echo LinkInternal('<input type="button" value="Cancel" />', "?op=blocks");
    ?>
</th></tr>
  </table>
  </form>
  <?php 
}
Beispiel #3
0
function EditBlock($block_id)
{
    global $db;
    if (isset($_POST['processed'])) {
        //Secure our data to prevent injection attacks.
        $weight = addslashes($_POST['weight']);
        $dir_name = addslashes($_POST['dir_name']);
        $position = addslashes($_POST['position']);
        $active = addslashes($_POST['active']);
        if (empty($weight) || empty($dir_name) || empty($position)) {
            echo "You must fill everything out before proceeding.";
            return;
        }
        //Update the database with the new data.
        $db->Query("UPDATE bayonet_blocks SET weight = '{$weight}', dir_name = '{$dir_name}', position = '{$position}', active = '{$active}' WHERE block_id = '{$block_id}'");
        //$isActive = $active ? "IS" : "IS NOT";
        echo "Block, '{$dir_name}', at position '{$weight}' has been edited.\n";
        //die, because we have completed what we wanted to do.
        return;
    }
    //Grab the page from the database according to the $page_id passed to the function.
    // {{{ XXX: FIXME -- Re-write this
    /*
    $result = $db->Query("SELECT weight,dir_name,position,active FROM bayonet_blocks WHERE block_id = '$block_id'");
    while(($row = $db->Fetch($result))!=false)
    {
      //We only want one row, so we don't have to $block[]...  No foreach necessary.
      $block = $row; 
    }    
    */
    // }}}
    ?>
  <form action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
" method="post">
  <table align="center">
  <tr><th>Weight</th><td><input type="text" name="weight" value="<?php 
    echo $block['weight'];
    ?>
"></td></tr>
  <tr><th>Position</th><td><input type="text" name="position" value="<?php 
    echo $block['position'];
    ?>
"></td></tr>
  <tr><th>Directory Name</th><td><input type="text" name="dir_name" value="<?php 
    echo $block['dir_name'];
    ?>
"></td>
  <tr><th>Active</th><td>
    <select name="active">
      <?php 
    GetActive($block_id, $block['active']);
    ?>
  
    </select>
  </td>
  
  <tr><th colspan="2"><input type="submit" name="processed" value="Submit"></th></tr>
  </table>
  </form>
  <?php 
}