示例#1
0
function feed_display_name(&$record)
{
    if ($record['display_name']) {
        return $record['display_name'];
    }
    return friendly_url($record['feed_url']);
}
function get_party($short_name, $parties)
{
    $k = 1;
    foreach ($parties as $party) {
        if ($party['party_short_name'] == $short_name) {
            return array('party' => $party['party'], 'party_short_name' => $party['party_short_name'], 'id' => $k, 'friendly_name' => friendly_url($party['party_short_name']));
        }
        $k++;
    }
}
示例#3
0
 function do_registrar($id)
 {
     $imagen = $this->upload_file('imagen');
     $imagen2 = $this->upload_file('imagen2');
     $logo = array();
     if ($imagen) {
         $logo['lo_nombre'] = $imagen['file_name'];
     }
     if ($imagen2) {
         $logo['lo_nombre2'] = $imagen2['file_name'];
     }
     $logo['lo_usu_id'] = $id;
     $logo['lo_key'] = friendly_url($logo['lo_nombre']);
     $idinsert = $this->logotipo_model->save_logotipo($logo);
     redirect('administrador/logotipo/listar_logotipos');
 }
示例#4
0
 function editar($id)
 {
     $val = $this->form_validation;
     $val->set_rules('tipo', 'tipo', 'callback_reqsel_check|xss_clean');
     $val->set_rules('nombre', 'nombre', 'required|xss_clean');
     if ($val->run()) {
         $data = array('cat_nombre' => $val->set_value('nombre'), 'cat_key' => friendly_url($val->set_value('nombre')), 'cat_padre' => $val->set_value('tipo'));
         $this->categoria->update_file($id, $data);
         $this->session->set_flashdata('msje', '<h2> La categoria con el id: <b>' . $id . '</b> fue editado correctamente </h2>');
         redirect('administrador/categoria/listar');
     } else {
         $cont['categoria'] = $this->categoria->get_file($id);
         $cont['tipo'] = $this->categoria->get_all_array(0);
         $data['contenido'] = $this->load->view('administrador/categoria_editar', $cont, TRUE);
         $this->load->view('administrador/template_admin', $data);
     }
 }
示例#5
0
 function do_registrar()
 {
     $val = $this->form_validation;
     $val->set_rules('cat_nombre', 'Nombre Categoria', 'trim|required|xss_clean');
     if (!$val->run()) {
         $this->load_registrar();
     } else {
         $res = '';
         $ta_id = $this->input->post('tipoarticulo');
         if ($ta_id == 1) {
             $categoria = array('cat_nombre' => $this->input->post('cat_nombre'), 'cat_key' => friendly_url($this->input->post('cat_nombre')), 'cat_ta_id' => 1);
             $res = $this->categorias_model->insert_categoria($categoria);
         } else {
             $categoria = array('cat_nombre' => $this->input->post('cat_nombre'), 'cat_ta_id' => 2);
             $res = $this->categorias_model->insert_categoria($categoria);
         }
         redirect('administrador/categorias/listar_categorias');
     }
 }
    $answers_id[$key] = $ids;
}
//print_r($keys);die();
foreach ($answers0 as $key => $region) {
    array_shift($region);
    array_shift($region);
    $i = 1;
    foreach ($region as $row) {
        //print_r($row);die();
        $vote = array();
        foreach ($answers_id[$key] as $ikey => $id) {
            $vote[$id] = answer2value($row[$ikey]);
        }
        if (isset($parties[$row[$unique_code_column[$key]]])) {
            $party = $parties[$row[$unique_code_column[$key]]];
            $data[$key][] = array('vote' => $vote, 'last_name' => $party['last_name'], 'first_name' => $party['first_name'], 'short_name' => $party['short_name'], 'name' => $party['name'], 'friendly_name' => friendly_url($party['last_name']), 'id' => $i);
            $i++;
        } else {
            //report wrong unique key
            echo $key . "::" . $row[$unique_code_column[$key]] . "<br/>\n";
        }
    }
    //print_r($data);die();
    //if direcotry not existing, create it
    $dir = $path . 'volba-prezidenta-cr-2-kolo' . '-2013/';
    if (!file_exists($dir)) {
        mkdir($dir);
    }
    $fout = fopen($dir . 'answers.json', "w+");
    $json = json_encode($data[$key]);
    fwrite($fout, $json);
        }
    }
    $answers_id[$key] = $ids;
}
//print_r($answers0);die();
foreach ($answers0 as $key => $region) {
    array_shift($region);
    $i = 1;
    foreach ($region as $row) {
        $vote = array();
        foreach ($answers_id[$key] as $ikey => $id) {
            $vote[$id] = answer2value($row[$ikey]);
        }
        if (isset($parties[$row[$unique_code_column[$key]]])) {
            $party = $parties[$row[$unique_code_column[$key]]];
            $data[$key][] = array('vote' => $vote, 'last_name' => $party['last_name'], 'first_name' => $party['first_name'], 'short_name' => $party['short_name'], 'name' => $party['name'], 'party' => $party['party'], 'constituency_code' => $party['constituency_code'], 'friendly_name' => friendly_url($party['party']), 'id' => $i);
            $i++;
        } else {
            //report wrong unique key
            echo $key . "::" . $row[$unique_code_column[$key]] . "<br/>\n";
        }
    }
    //print_r($data);die();
    //if direcotry not existing, create it
    $dir = $path . 'senat' . '-2012/';
    if (!file_exists($dir)) {
        mkdir($dir);
    }
    $fout = fopen($dir . 'answers.json', "w+");
    $json = json_encode($data[$key]);
    fwrite($fout, $json);
示例#8
0
            header('location: ./mn-galleries.php?back=added');
            exit;
        } else {
            overal_header($lang['galleries_galleries'], $lang['galleries_msg_put_contents_error'], 'error');
        }
    } else {
        overall_header($lang['galleries_galleries'], $lang['galleries_msg_empty_gallery_name'], 'error');
    }
} elseif (isset($_POST['action']) && $_POST['action'] == 'edit' && isset($_POST['id']) && file_exists($file['galleries'])) {
    if (!empty($_POST['gallery_name'])) {
        $galleries_file = file($file['galleries']);
        $galleries_file_content = '';
        foreach ($galleries_file as $single_line) {
            $gallery_data = explode(DELIMITER, $single_line);
            if ($gallery_data[0] == $_POST['id']) {
                $galleries_file_content .= $gallery_data[0] . DELIMITER . $_POST['gallery_name'] . DELIMITER . friendly_url($_POST['gallery_name']) . "\n";
            } else {
                $galleries_file_content .= $single_line;
            }
        }
        if (mn_put_contents($file['galleries'], $galleries_file_content)) {
            header('location: ./mn-galleries.php?back=edited');
            exit;
        } else {
            overal_header($lang['galleries_galleries'], $lang['galleries_msg_put_contents_error'], 'error');
        }
    } else {
        overall_header($lang['galleries_galleries'], $lang['galleries_msg_empty_gallery_name'], 'error');
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id']) && file_exists($file['galleries']) && !empty($var['gallery_name'])) {
    overall_header($lang['galleries_edit_gallery'] . ' &raquo; ' . $var['gallery_name'], $lang['galleries_edit_gallery'], 'main');
示例#9
0
?>
 single h-entry">
  <td>
    <div class="title p-name"><a href="<?php 
echo $this->post->href;
?>
" class="u-url"><?php 
echo htmlspecialchars($this->post->title ?: preg_replace('/^https?:\\/\\//', '', $this->post->href));
?>
</a></div>
    <div class="details">
      <span class="p-author h-card"><a href="<?php 
echo $this->post->post_author;
?>
" class="u-url"><?php 
echo friendly_url($this->post->post_author);
?>
</a></span> | 
      <? if($this->post->in_reply_to) { ?>
        <a href="<?php 
echo $this->post->in_reply_to;
?>
" class="u-in-reply-to"><?php 
echo __('in reply to');
?>
</a> |
      <? } ?>
      <?php 
echo $this->post->post_date ? '<time class="dt-published" datetime="' . date('c', strtotime($this->post->post_date)) . '">' . date('Y-m-d H:i T', strtotime($this->post->post_date)) . '</time> |' : '';
?>
      <?php 
//for each region
foreach ($out as $key => $region) {
    print_r($key);
    //if direcotry not existing, create it
    $dir = $path . friendly_url($regions[$key]['name']) . '-2012/';
    if (!file_exists($dir)) {
        mkdir($dir);
    }
    //questions
    $fout = fopen($dir . 'questions.json', "w+");
    $json = json_encode($region);
    fwrite($fout, $json);
    fclose($fout);
    //info about region
    $rout = $regions[$key];
    $rout['friendly_calc_url'] = friendly_url($regions[$key]['name']) . '-2012';
    $rout['calc'] = $regions[$key]['name'] . ' 2012';
    $fout = fopen($dir . 'region.json', "w+");
    $json = json_encode($rout);
    fwrite($fout, $json);
    fclose($fout);
}
/**
* creates "friendly url" version of text, translits string (gets rid of diacritics) and substitutes ' ' for '-', etc.
* @return friendly url version of text
* example:
* friendly_url('klub ČSSD')
*     returns 'klub-cssd'
*/
function friendly_url($text, $locale = 'cs_CZ.utf-8')
{
示例#11
0
<?php

include './stuff/inc/mn-start.php';
# --- xFIELDs
if (isset($_GET['action']) && $_GET['action'] == 'xfields') {
    $auth = user_auth('8');
    $xfields = get_unserialized_array('xfields');
    # --- add new xField
    if (isset($_POST['action']) && $_POST['action'] == 'xfield_add') {
        if (!in_array($_POST['field_section'], array('posts', 'comments', 'pages', 'users'))) {
            die;
        } else {
            $xSection = $_POST['field_section'];
        }
        $xName = check_text(trim($_POST['field_name']), true);
        $xVar = str_replace('-', '_', friendly_url(trim($_POST['field_variable'])));
        $xType = $_POST['field_type'] == 'select' && !empty($_POST['field_options']) ? 'select' : 'input';
        if (empty($xName) || empty($xVar) || array_key_exists($xVar, $xfields)) {
            $var = array('name' => $xName, 'var' => $xVar, 'section' => $xSection, 'type' => $xType, 'options' => trim($_POST['field_options']), 'action' => 'add');
            $admin_tmpl['xfields_list'] = true;
            $xError = array_key_exists($xVar, $xfields) ? 'xfields_msg_variable_exists' : 'xfields_msg_empty_fields';
            overall_header($lang['xfields_xfields'], $lang[$xError], 'error');
        } else {
            if ($xType == 'select' && !empty($_POST['field_options'])) {
                $xOptions = array();
                $xOptions_lines = explode("\n", trim($_POST['field_options']));
                foreach ($xOptions_lines as $xLine) {
                    $xO = explode('=', check_text($xLine, true));
                    if (isset($xO[1])) {
                        $xOptions[$xO[0]] = $xO[1];
                    } else {
示例#12
0
文件: layout.php 项目: diplix/Monocle
        <?php 
if (session('me')) {
    ?>
          <li><a href="/channels">Channels</a></li>
        <?php 
}
?>
        <!-- <li><a href="/docs">Docs</a></li> -->

      </ul>
      <ul class="nav navbar-nav navbar-right">
        <?php 
if (session('me')) {
    ?>
          <li><span class="navbar-text"><?php 
    echo friendly_url(session('me'));
    ?>
</span></li>
          <li><a href="/signout">Sign Out</a></li>
        <?php 
    /* } else if(!property_exists($this, 'authorizing')) { ?>
         <li class="navbar-text"><?= $this->authorizing ?></li>
       <?php */
} else {
    ?>
          <form action="/auth/start" method="get" class="navbar-form">
            <input type="text" name="me" placeholder="yourdomain.com" class="form-control" />
            <button type="submit" class="btn">Sign In</button>
          </form>
        <?php 
}
示例#13
0
            header('location: ./mn-categories.php?back=added');
            exit;
        } else {
            overal_header($lang['cats_categories'], $lang['cats_msg_put_contents_error'], 'error');
        }
    } else {
        overall_header($lang['cats_categories'], $lang['cats_msg_empty_cat_name'], 'error');
    }
} elseif (isset($_POST['action']) && $_POST['action'] == 'edit' && isset($_POST['id']) && file_exists($file['categories'])) {
    if (!empty($_POST['cat_name'])) {
        $cats_file = file($file['categories']);
        $cats_file_content = '';
        foreach ($cats_file as $single_line) {
            $cat_data = explode(DELIMITER, $single_line);
            if ($cat_data[0] == $_POST['id']) {
                $cats_file_content .= $cat_data[0] . DELIMITER . $_POST['cat_name'] . DELIMITER . friendly_url($_POST['cat_name']) . "\n";
            } else {
                $cats_file_content .= $single_line;
            }
        }
        if (mn_put_contents($file['categories'], $cats_file_content)) {
            header('location: ./mn-categories.php?back=edited');
            exit;
        } else {
            overal_header($lang['cats_categories'], $lang['cats_msg_put_contents_error'], 'error');
        }
    } else {
        overall_header($lang['cats_categories'], $lang['cats_msg_empty_cat_name'], 'error');
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id']) && file_exists($file['categories']) && !empty($var['cat_name'])) {
    overall_header($lang['cats_edit_category'] . ' &raquo; ' . $var['cat_name'], $lang['cats_edit_category'], 'main');
    foreach ($region as $row) {
        $vote = array();
        foreach ($answers_id[$key] as $ikey => $id) {
            $vote[$id] = answer2value($row[$ikey]);
        }
        if (isset($parties[$row[$unique_code_column[$key]]])) {
            $party = $parties[$row[$unique_code_column[$key]]];
            $data[$key][] = array('vote' => $vote, 'name' => $party['name'], 'short_name' => $party['short_name'], 'friendly_name' => friendly_url($party['short_name']), 'id' => $i);
            $i++;
        } else {
            //report wrong unique key
            echo $key . "::" . $row[$unique_code_column[$key]] . "<br/>\n";
        }
    }
    //if direcotry not existing, create it
    $dir = $path . friendly_url($regions[$key]['name']) . '-2012/';
    if (!file_exists($dir)) {
        mkdir($dir);
    }
    $fout = fopen($dir . 'answers.json', "w+");
    $json = json_encode($data[$key]);
    fwrite($fout, $json);
    fclose($fout);
}
print_r($data);
die;
function answer2value($a)
{
    if ($a == 'Souhlasím.') {
        return 1;
    }
$path = '../www/';
$out = array();
$i = 1;
while (($row = fgetcsv($fin)) !== FALSE) {
    if ($i == 1) {
        $j = 0;
        $ids = array();
        foreach ($row as $item) {
            if ($j >= $columns) {
                $ids[$j] = $item;
            }
            $j++;
        }
    } else {
        if ($i > 2) {
            $mp = array('last_name' => $row[1], 'first_name' => $row[0], 'party' => $row[2], 'friendly_name' => friendly_url($row[2]), 'id' => $row[6], 'sex' => $row[5], 'region' => $row[4], 'party_long' => $row[3]);
            for ($j = $columns; $j < count($row); $j++) {
                if (trim($row[$j]) != '') {
                    $mp['vote'][$ids[$j]] = $row[$j];
                }
            }
            $out[] = $mp;
        }
    }
    $i++;
}
$fout = fopen($path . $directory . 'answers.json', "w+");
$json = json_encode($out);
fwrite($fout, $json);
fclose($fout);
/**
示例#16
0
function decode_friendly($url)
{
    return friendly_url($url, false);
}
示例#17
0
<?php

// put full path to Smarty.class.php
require '/usr/local/lib/php/Smarty/libs/Smarty.class.php';
$smarty = new Smarty();
$smarty->setTemplateDir('../../smarty/templates');
$smarty->setCompileDir('../../smarty/templates_c');
$smarty->setCacheDir('../../smarty/cache');
$smarty->setConfigDir('../../smarty/configs');
//regions
include '../regions.php';
//add friendly url
foreach ($regions as $key => $r) {
    $regions[$key]['friendly_url'] = friendly_url($r['name'] . '-2012') . '/?';
}
$constit = array('0' => 'Celá ČR', '2' => 'Sokolov (2)', '5' => 'Chomutov (5)', '8' => 'Rokycany (8)', '11' => 'Domažlice (11)', '14' => 'České Budějovice (14)', '17' => 'Praha 12 (17)', '20' => 'Praha 4 (20)', '23' => 'Praha 8 (23)', '26' => 'Praha 2 (26)', '29' => 'Litoměřice (29)', '32' => 'Teplice (32)', '35' => 'Jablonec nad Nisou (35)', '38' => 'Mladá Boleslav (38)', '41' => 'Benešov (41)', '44' => 'Chrudim (44)', '47' => 'Náchod (47)', '50' => 'Svitavy (50)', '53' => 'Třebíč (53)', '56' => 'Břeclav (56)', '59' => 'Brno-město (59)', '62' => 'Prostějov (62)', '65' => 'Šumperk (65)', '68' => 'Opava (68)', '71' => 'Ostrava-město (71)', '74' => 'Karviná (74)', '77' => 'Vsetín (77)', '80' => 'Zlín (80)');
foreach ($constit as $ckey => $c) {
    $constit[$ckey] = array('name' => $c, 'friendly_url' => $ckey == 0 ? 'senat-2012/?' : 'senat-2012/page.php?constituency_code=' . $ckey . '&');
}
$inventory2014 = array(array('name' => 'Inventura hlasování ve Sněmovně 2014', 'friendly_url' => 'inventura-hlasovani-2014', 'custom' => true));
$calc2014zdarnadsazavou = array(array('name' => 'Volební kalkulačka Žďár nad Sázavou 2014', 'friendly_url' => 'zdar-nad-sazavou-2014', 'custom' => true));
$calc2014karlovyvary = array(array('name' => 'Volební kalkulačka Karlovy Vary 2014', 'friendly_url' => 'karlovy-vary-2014', 'custom' => true));
$calc2014trutnov = array(array('name' => 'Volební kalkulačka Trutnoc 2014', 'friendly_url' => 'trutnov-2014', 'custom' => true));
$calc2014ceskebudejovice = array(array('name' => 'Volební kalkulačka České Budějovice 2014', 'friendly_url' => 'ceske-budejovice-2014', 'custom' => true));
$calc2014olomouc = array(array('name' => 'Volební kalkulačka Olomouc 2014', 'friendly_url' => 'olomouc-2014', 'custom' => true));
$calc2014liberec = array(array('name' => 'Volební kalkulačka Liberec 2014', 'friendly_url' => 'liberec-2014', 'custom' => true));
$calc2014liberec2010 = array(array('name' => 'Inventura hlasování Liberec 2010-2014', 'friendly_url' => 'liberec-2010-2014', 'custom' => true));
$calc2014decin = array(array('name' => 'Volební kalkulačka Děčín 2014', 'friendly_url' => 'decin-2014', 'custom' => true));
$calc2014prostejov = array(array('name' => 'Volební kalkulačka Prostějov 2014', 'friendly_url' => 'prostejov-2014', 'custom' => true));
$calc2014pardubice = array(array('name' => 'Volební kalkulačka Pardubice 2014', 'friendly_url' => 'pardubice-2014', 'custom' => true));
$calc2014bohumin = array(array('name' => 'Volební kalkulačka Bohumín 2014', 'friendly_url' => 'bohumin-2014', 'custom' => true));
示例#18
0
function menu_tratamentos()
{
    global $pdo;
    $sql = "SELECT * FROM tb_paginas WHERE tipo = 'tratamentos' AND status = '1' ORDER BY subtitulo ASC, datacad DESC";
    $exec = $pdo->query($sql);
    $count = $exec->rowCount();
    echo '<li class="atvdo">';
    echo '<a class="sub-menu pointer">tratamentos</a>';
    echo '<img class="sub-menu" src="' . url_site() . 'imagens/sub-menu.png" alt="">';
    echo '<ul class="insub-menu">';
    echo '<img class="img-submenu" src="' . url_site() . 'imagens/top-submenu.png" alt="">';
    foreach ($exec as $tratamento) {
        echo '<li><a href="' . url_site() . 'tratamentos/' . friendly_url($tratamento['titulo']) . '">' . $tratamento['titulo'] . '</a></li>';
    }
    echo '</ul>';
    echo '</li>';
}
示例#19
0
function ZobrazMenu($spojeni)
{
    ?>

<div id="vrch"> 
<div id="pole">
   <a href="http://www.koneridec.cz/"><img height="100" src="img/logo.png" title="Vyjíždky na koních Koně řídeč "  alt="Vyjíždky na koních Koně Řídeč"/></a>
    <div id="menu">
       <ul id="nav">
<?php 
    $sql = "SELECT * from hlavnimenu order by poradi";
    $res = PrSql($spojeni, $sql);
    $pocet = mysqli_num_rows($res);
    setlocale(LC_ALL, 'czech');
    $i = 1;
    while ($zaznam = mysqli_fetch_array($res)) {
        $id = $zaznam["id"];
        $nazev = $zaznam["nazev"];
        $typ = $zaznam["typ"];
        $input = friendly_url($nazev);
        $class = "";
        if ($i == 1) {
            $class = "class=\"first\"";
        }
        if ($i == $pocet) {
            $class = "class=\"noborder\"";
        }
        ?>
        <li><a href="<?php 
        echo $input;
        ?>
.html"  <?php 
        echo $class;
        ?>
><?php 
        echo $nazev;
        ?>
</a>
  <?php 
        /*  if ($typ=="T") {$rr=$rr."RewriteRule ^$input.html index.php?cmd=zobrazContent&id=$id\n";}
          if ($typ=="K") {$rr=$rr."RewriteRule ^$input.html index.php?cmd=zobrazKone&id=-1\n";}
          if ($typ=="G") {$rr=$rr."RewriteRule ^$input.html index.php?cmd=zobrazGalerii\n";}
          if ($typ=="U") {$rr=$rr."RewriteRule ^$input.html index.php\n";}
          if ($typ=="G") {$rr=$rr."RewriteRule ^$input.html index.php?cmd=zobrazGalerii\n";}
          if ($typ=="V") {$rr=$rr."RewriteRule ^$input.html index.php?cmd=zobrazVzkazy\n";}
        */
        if ($typ == "K") {
            $sqlk = "SELECT * from konemenu order by poradi";
            $resk = PrSql($spojeni, $sqlk);
            $pocetk = mysqli_num_rows($resk);
            $j = 1;
            echo "      <ul>";
            while ($zaznamk = mysqli_fetch_array($resk)) {
                $id = $zaznamk["id"];
                $nazevk = $zaznamk["nazev"];
                $input = friendly_url($nazevk);
                if ($j == 1) {
                    $class = "class=\"top\"";
                }
                if ($j == $pocetk) {
                    $class = "class=\"bottom\"";
                }
                ?>
          <li><a href="kone-ridec-<?php 
                echo $input;
                ?>
.html" <?php 
                echo $class;
                ?>
><?php 
                echo $nazevk;
                ?>
</a></li>
    <?php 
                $rr = $rr . "RewriteRule ^kone-ridec-{$input}.html index.php?cmd=zobrazKone&id={$id}\n";
                $j = $j + 1;
            }
            echo "</ul>";
        }
        if ($typ == "M") {
            $sqlk = "SELECT * from content_menu where id_hlavni_menu=" . $zaznam["id"] . " order by poradi";
            $resk = PrSql($spojeni, $sqlk);
            $pocetk = mysqli_num_rows($resk);
            $j = 1;
            echo "      <ul>";
            while ($zaznamk = mysqli_fetch_array($resk)) {
                $id = $zaznamk["id_content_Menu"];
                $nazevk = $zaznamk["nazev"];
                $input = friendly_url($nazevk);
                if ($j == 1) {
                    $class = "class=\"top\"";
                }
                if ($j == $pocetk) {
                    $class = "class=\"bottom\"";
                }
                ?>
          <li><a href="tabory-<?php 
                echo $input;
                ?>
.html" <?php 
                echo $class;
                ?>
><?php 
                echo $nazevk;
                ?>
</a></li>
    <?php 
                $rr = $rr . "RewriteRule ^tabory-{$input}.html index.php?cmd=zobrazKone&id={$id}\n";
                $j = $j + 1;
            }
            echo "</ul>";
        }
        echo "</li>";
        $i = $i + 1;
    }
    ?>
      <li><div id="facebook"><a href="https://www.facebook.com/profile.php?id=738842372871955&ref=ts&fref=ts"><img height="44px" src="img/logo-facebook.png"></a></div></li>
      </ul>
   </div>
  <div style="clear:both"></div>
 </div>

</div>

<?php 
}
function unique_code2id($unique_code, $parties, $json)
{
    if (isset($parties[$unique_code])) {
        $party = $parties[$unique_code];
        foreach ($json as $p) {
            if ($p->friendly_name == friendly_url($party['party_short_name'])) {
                return $p->id;
            }
        }
    } else {
        echo "<br/>unique code not present in parties: **{$unique_code}**<br/>";
        return false;
    }
}
$i = 1;
foreach ($fanswers as $row) {
    if ($i > 1) {
        $row_ar = str_getcsv($row, "\t");
        $exists[$row_ar[2]] = true;
    }
    $i++;
}
//read parties
$out = array();
$i = 1;
foreach ($fparties as $row) {
    if ($i > 1) {
        $row_ar = str_getcsv($row, "\t");
        if (!isset($exists[$row_ar[2]]) and $row_ar[3] == 1) {
            $out[] = array('party' => trim($row_ar[0]), 'party_short_name' => trim($row_ar[1]), 'friendly_name' => friendly_url(trim($row_ar[1])), 'id' => $i - 1);
        }
    }
    $i++;
}
$fouts = array("../www/poslanecka-snemovna-2013/noreply.json", "../www/poslanecka-snemovna-2013-iinfo/noreply.json");
foreach ($fouts as $fout) {
    $f = fopen($fout, "w+");
    fwrite($f, json_encode($out));
    fclose($f);
}
/**
* creates "friendly url" version of text, translits string (gets rid of diacritics) and substitutes ' ' for '-', etc.
* @return friendly url version of text
* example:
* friendly_url('klub ČSSD')
示例#22
0
 function dumpFilename($identifier)
 {
     $connection = connection();
     return friendly_url(($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost")) . "-" . $connection->result("SELECT NOW()"));
 }
示例#23
0
             echo '0';
         } else {
             header('location: ./mn-files.php?back=wrongitype');
             exit;
         }
     }
 } elseif (in_array($file_ext, $ext['media']) || in_array($file_ext, $ext['others'])) {
     $source_file = pathinfo_utf($_FILES['file']['name']);
     $clean_file_name = friendly_url($source_file['filename']);
     $clean_file_ext = strtolower($source_file['extension']);
     $file_dir = in_array($file_ext, $ext['media']) ? 'media' : 'others';
     $target_file = './' . $dir[$file_dir] . $clean_file_name . '.' . $clean_file_ext;
     if (file_exists($target_file)) {
         $i = 2;
         while (file_exists($target_file) && $i < 100) {
             $clean_file_name = friendly_url($source_file['filename']) . '-' . $i;
             $clean_file = $clean_file_name . '.' . $clean_file_ext;
             $target_file = './' . $dir[$file_dir] . $clean_file;
             $i++;
         }
     }
     move_uploaded_file($_FILES['file']['tmp_name'], $target_file);
     $files_file = file($file['files']);
     $files_file_lines = '';
     foreach ($files_file as $single_line) {
         $file_data = explode(DELIMITER, $single_line);
         if (substr($file_data[0], 0, 2) == '<?') {
             $auto_increment_id = trim($file_data[1]);
         } else {
             $files_file_lines .= $single_line;
         }
示例#24
0
<?php

$TABLE = $_GET["download"];
$fields = fields($TABLE);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . friendly_url("{$TABLE}-" . implode("_", $_GET["where"])) . "." . friendly_url($_GET["field"]));
$select = array(idf_escape($_GET["field"]));
$result = $driver->select($TABLE, $select, array(where($_GET, $fields)), $select);
$row = $result ? $result->fetch_row() : array();
echo $row[0];
exit;
// don't output footer
示例#25
0
    ?>
      <div class="col-xs-6 col-md-3">
        <div class="thumbnail">
          <a href="<?php 
    echo $user->last_micropub_url;
    ?>
"><img src="<?php 
    echo $user->last_instagram_img_url;
    ?>
"></a>
          <div class="caption">
            <p><a href="<?php 
    echo $user->url;
    ?>
"><?php 
    echo friendly_url($user->url);
    ?>
</a></p>
            <p>
              <?php 
    echo $user->photo_count_this_week;
    ?>
 this week<br>
              <?php 
    echo $user->photo_count;
    ?>
 total<br>
            </p>
          </div>
        </div>
      </div>
示例#26
0
        // xFields
        if (isset($_POST['x_fields']) && file_exists(MN_ROOT . $file['xfields'])) {
            $xfields = get_unserialized_array('xfields');
            $post_xfields = array();
            foreach ($xfields as $xVar => $x) {
                if ($x['section'] != 'pages') {
                    continue;
                } else {
                    $post_xfields[$xVar] = check_text($_POST['x' . $xVar], true, 'xf');
                }
            }
            $xfields_serialized = serialize($post_xfields);
        } else {
            $xfields_serialized = '';
        }
        $p_content = SAFETY_LINE . "\n" . DELIMITER . $_POST['id'] . DELIMITER . mn_time() . DELIMITER . check_text($_POST['title']) . DELIMITER . friendly_url($_POST['title']) . DELIMITER . $var['author'] . DELIMITER . $_POST['visible'] . DELIMITER . $p_order . DELIMITER . $p_pass . DELIMITER . '' . DELIMITER . $xfields_serialized . DELIMITER . "\n" . check_text($_POST['text']);
        if (mn_put_contents($dir['pages'] . 'page_' . $_POST['id'] . '.php', $p_content)) {
            header('location: ./mn-pages.php?action=edit&id=' . $_POST['id'] . '&back=edited');
            exit;
        } else {
            overall_header($lang['pages_edit_page'] . ' &raquo; ' . $var['title'], $lang['pages_msg_put_contents_error'], 'error', true);
        }
    } else {
        $var['title'] = check_text($_POST['title']);
        $var['text'] = check_text($_POST['text']);
        $var['id'] = check_text($_POST['id']);
        overall_header($lang['pages_edit_page'] . ' &raquo; ' . $var['title'], $lang['pages_msg_empty_values'], 'error', true);
        $admin_tmpl['form'] = true;
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && file_exists($dir['pages'] . 'page_' . $_GET['id'] . '.php')) {
    $var = get_page_data($_GET['id']);
示例#27
0
 /** Set export filename
  * @param string
  * @return string filename without extension
  */
 function dumpFilename($identifier)
 {
     return friendly_url($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost"));
 }
示例#28
0
文件: entry.php 项目: diplix/Monocle
<div class="entry<?php 
echo $this->entry->in_reply_to_url ? ' has-context' : '';
?>
">
  <div class="author">
    <div class="photo">
      <img src="<?php 
echo $this->entry->author_photo;
?>
" width="48">
    </div>
    <a class="url" href="<?php 
echo $this->entry->author_url;
?>
"><?php 
echo friendly_url($this->entry->author_url);
?>
</a>
    <div class="name"><?php 
echo $this->entry->author_name;
?>
</div>
  </div>
  <div class="clear"></div>

  <?php 
if ($this->entry->name) {
    ?>
    <h2 class="name"><?php 
    echo $this->entry->name;
    ?>
示例#29
0
        }
    }
    if (isset($_GET['back']) && $_GET['back'] == 'exists') {
        overall_header($lang['tmpl_add_template'], $lang['tmpl_msg_tmpl_group_exists'], 'error');
    } elseif (isset($_GET['back']) && $_GET['back'] == 'empty') {
        overall_header($lang['tmpl_add_template'], $lang['tmpl_msg_tmpl_group_empty'], 'error');
    } else {
        overall_header($lang['tmpl_add_template'], $lang['tmpl_add_template'] . ' &raquo; ' . $lang['tmpl_step'] . ' 1/3', 'main');
    }
} elseif (isset($_POST['action']) && $_POST['action'] == 'add' && $_POST['step'] == '1') {
    if ($_POST['group_mode'] == '1' && $_POST['tmpl_group'] == '0') {
        $tg_name = 'mn_default';
    } elseif ($_POST['group_mode'] == '1' && $_POST['tmpl_group'] != '0') {
        $tg_name = $t_groups[$_POST['tmpl_group']];
    } else {
        $tg_name = friendly_url($_POST['tmpl_new_group']);
        if (@in_array($tg_name, $t_groups) || $tg_name == 'mn_default') {
            header('location: ./mn-templates.php?action=add&back=exists');
            exit;
        }
    }
    if (!empty($tg_name)) {
        $tmpl_types = array();
        foreach ($templates as $i) {
            if (file_exists($dir['templates'] . $tg_name . '_' . $i . '.html')) {
                continue;
            } else {
                $tmpl_types[$i] = $lang['tmpl_tmpl_type_' . $i];
            }
        }
        if (empty($tmpl_types)) {
示例#30
0
     $status = 5;
 } elseif ($auth > 1 && $var['status'] > 3 && $_POST['status'] < 4) {
     $status = $var['status'];
 } else {
     $status = $_POST['status'];
 }
 if ($status == '3' && $_POST['date'] != 'specific' && $var['timestamp'] == '9999999999') {
     $timestamp = '9999999999';
 }
 $author = $auth == 1 ? $_POST['author'] : $var['author'];
 //$_POST['tags'] = sort($_POST['tags']);
 $post_tags = !empty($_POST['tags']) ? implode(',', $_POST['tags']) : '';
 if (isset($_POST['slug']) && !empty($_POST['slug'])) {
     $post_friendly_url = $_POST['slug'];
 } else {
     $post_friendly_url = friendly_url($_POST['title']);
 }
 $posts_file = file($file['posts']);
 $p_lines = '';
 foreach ($posts_file as $single_line) {
     $p_data = explode(DELIMITER, $single_line);
     if (isset($p_data[1]) && $p_data[1] == $_POST['id']) {
         $p_lines .= $timestamp . DELIMITER . $_POST['id'] . DELIMITER . check_text($_POST['title']) . DELIMITER . $post_friendly_url . DELIMITER . $author . DELIMITER . $_POST['cat'] . DELIMITER . $status . DELIMITER . $post_tags . "\n";
     } else {
         $p_lines .= $single_line;
     }
 }
 $short_story = str_replace($conf['admin_url'], '{%MN_URL%}', $_POST['short_story']);
 $full_story = str_replace($conf['admin_url'], '{%MN_URL%}', $_POST['full_story']);
 if (isset($conf['posts_image']) && $conf['posts_image'] && isset($_FILES['image']['name']) && is_image($_FILES['image']['name'])) {
     $source_file = pathinfo_utf($_FILES['image']['name']);