Example #1
0
 public function testFormatShort()
 {
     $this->assertEquals('4ms', milliseconds(4)->format('ms'));
     $this->assertEquals('1s', milliseconds(1000)->format('s'));
     $this->assertEquals('4s', seconds(4)->format('s'));
     $this->assertEquals('4m', minutes(4)->format('m'));
     $this->assertEquals('32h', hours(32)->format('h'));
     $this->assertEquals('4d', days(4)->format('d'));
     $this->assertEquals('1w', days(7)->format('w'));
     $this->assertEquals('3mo', weeks(13)->format('mo'));
     $this->assertEquals('1y', months(12)->format('y'));
 }
Example #2
0
function http_afficher_rendez_vous($date_heure, $date_fin)
{
  global $spip_lang_rtl;

	$dirpuce = _DIR_RACINE . 'dist';
	if (jour($date_heure) == jour($date_fin) AND mois($date_heure) == mois($date_fin) AND annee($date_heure) == annee($date_fin)) {		
	  echo "<p class='verdana2' style='text-align: center'>"._T('titre_rendez_vous')." ".majuscules(nom_jour($date_heure))." <b>".majuscules(affdate($date_heure))."</b><br />\n<b>".heures($date_heure)." "._T('date_mot_heures')." ".minutes($date_heure)."</b>";
	  echo " &nbsp; <img src='$dirpuce/puce$spip_lang_rtl.gif' alt=' ' style='border: 0px;' /> &nbsp;  ".heures($date_fin)." "._T('date_mot_heures')." ".minutes($date_fin)."</p>";
	} else {
	  echo "<p class='verdana2' style='text-align: center'>"._T('titre_rendez_vous')."<br />\n".majuscules(nom_jour($date_heure))." <b>".majuscules(affdate($date_heure))."</b>, <b>".heures($date_heure)." "._T('date_mot_heures')." ".minutes($date_heure)."</b>";
	  echo "<br />\n<img src='$dirpuce/puce$spip_lang_rtl.gif' alt=' ' style='border: 0px;' /> ".majuscules(nom_jour($date_fin))." ".majuscules(affdate($date_fin)).", <b>".heures($date_fin)." "._T('date_mot_heures')." ".minutes($date_fin)."</b></p>";
	}
}
Example #3
0
function leerFeedCategoria($categoria)
{
    global $npag;
    global $cant;
    //http://gdata.youtube.com/feeds/api/videos/-/music
    $url_api = "http://gdata.youtube.com/feeds/api/videos/-/music?time=today";
    $sxml = simplexml_load_file($url_api);
    $contador = 0;
    foreach ($sxml->entry as $entry) {
        global $i;
        $i++;
        $media = $entry->children('http://search.yahoo.com/mrss/');
        $attrs = $media->group->player->attributes();
        $url[$i] = $attrs['url'];
        $titulo[$i] = $media->group->title;
        $titulo[$i] = substr(ucwords($titulo[$i]), 0, 50);
        $descripcion[$i] = $media->group->description;
        $etiqueta[$i] = $media->group->keywords;
        empty($etiqueta[$i]) ? $etiqueta[$i] = "Music" : ($etiqueta[$i] = $etiqueta[$i]);
        // get thumbnail
        $attrs = $media->group->thumbnail[0]->attributes();
        $img[$i] = $attrs['url'];
        // get <yt:duration> node for video length
        $yt = $media->children('http://gdata.youtube.com/schemas/2007');
        $attrs = $yt->duration->attributes();
        $length[$i] = $attrs['seconds'];
        //*****OK
        $yt = $entry->children('http://gdata.youtube.com/schemas/2007');
        $attrs = $yt->statistics->attributes();
        @($viewCount[$i] = $attrs['viewCount']);
        // buscar "google vs bing" ERROR  ERROR ERROR ERROR PASADO POR ALTO PROVAR
        $gd = $entry->children('http://schemas.google.com/g/2005');
        if ($gd->rating) {
            $attrs = $gd->rating->attributes();
            $rating[$i] = $attrs['average'];
        } else {
            $rating[$i] = 0;
        }
        //usa include functions.php
        $url_amigable = urls_amigables($titulo[$i]);
        // Creando Array almacen de DATOS
        $vid[$i] = array('titulo' => strtolower($titulo[$i]), 'id' => getIde($url[$i]), 'img' => 'http://img.youtube.com/vi/' . getIde($url[$i]) . '/hqdefault.jpg', 'duracion' => minutes($length[$i]), 'pag_video' => '' . getIde($url[$i]) . '-' . $url_amigable . '.html', 'url_amigable' => $url_amigable, 'pag_tag' => 'video.php?tag=', 'descripcion' => $descripcion[$i], 'contador_view' => $viewCount[$i], 'etiqueta' => strtolower($etiqueta[$i]));
    }
    //FIN foreach
    return $vid;
}
function BOUCLE_art_agendahtml_78503d8cb0bd66f2d97f4b9c0f7d329a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'articles';
        $command['id'] = '_art_agenda';
        $command['from'] = array('articles' => 'spip_articles', 'L1' => 'spip_mots_liens', 'L2' => 'spip_mots');
        $command['type'] = array();
        $command['groupby'] = array("articles.id_article");
        $command['select'] = array("articles.date_redac", "articles.id_article", "articles.texte", "articles.descriptif", "articles.chapo", "articles.titre", "articles.lang");
        $command['orderby'] = array('articles.date_redac');
        $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article')), 'L2' => array('L1', 'id_mot'));
        $command['limit'] = '0,5';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'L2.titre', "'Agenda'"), array('<', 'TIMESTAMPDIFF(HOUR,articles.date_redac,NOW())/24', "1"), array('=', 'articles.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\'')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-menu-agenda.html', 'html_78503d8cb0bd66f2d97f4b9c0f7d329a', '_art_agenda', 4, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
				<li>' . (($t1 = strval(affdate(normaliser_date($Pile[$SP]['date_redac'])))) !== '' ? '<span>' . $t1 . (' ' . (($t2 = strval(heures(normaliser_date($Pile[$SP]['date_redac'])) != '0' ? (($t3 = strval(heures(normaliser_date($Pile[$SP]['date_redac'])))) !== '' ? $t3 . ':' : '') . minutes(normaliser_date($Pile[$SP]['date_redac'])) : '')) !== '' ? '- ' . $t2 : '') . '</span>') : '') . '
					<a class="lien' . interdire_scripts(@$Pile[0]['exposer']) . ' article" href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '" ' . (($t1 = strval(interdire_scripts(entites_html(textebrut(filtre_introduction_dist($Pile[$SP]['descriptif'], strlen($Pile[$SP]['descriptif']) ? '' : $Pile[$SP]['chapo'] . "\n\n" . $Pile[$SP]['texte'], 500, $connect, null)))))) !== '' ? 'title="' . $t1 . '"' : '') . '>' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a>

				</li>
		';
            lang_select();
        }
        lang_select();
        $iter->free();
    }
    if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) {
        spip_log(intval(1000 * $timer) . "ms BOUCLE_art_agenda @ squelettes/inc/inc-menu-agenda.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Example #5
0
function liste_rv($query, $type)
{
    global $spip_lang_rtl, $spip_lang_left, $spip_lang_right;
    if ($type == annonces) {
        $titre = _T('info_annonces_generales');
        $couleur_titre = "ccaa00";
        $couleur_texte = "black";
        $couleur_fond = "#ffffee";
    } else {
        if ($type == pb) {
            $titre = _T('infos_vos_pense_bete');
            $couleur_titre = "#3874B0";
            $couleur_fond = "#EDF3FE";
            $couleur_texte = "white";
        } else {
            if ($type == rv) {
                $titre = _T('info_vos_rendez_vous');
                $couleur_titre = "#666666";
                $couleur_fond = "#eeeeee";
                $couleur_texte = "white";
            }
        }
    }
    $result = spip_query($query);
    if (spip_num_rows($result) > 0) {
        debut_cadre_enfonce("", false, "", $titre);
        echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>";
        while ($row = spip_fetch_array($result)) {
            if (preg_match("/^=([^[:space:]]+)\$/", $row['texte'], $match)) {
                $url = $match[1];
            } else {
                $url = "message.php3?id_message=" . $row['id_message'];
            }
            $type = $row['type'];
            $rv = $row['rv'];
            $date = $row['date_heure'];
            $date_fin = $row['date_fin'];
            if ($type == "normal") {
                $bouton = "message";
            } elseif ($type == "pb") {
                $bouton = "pense-bete";
            } elseif ($type == "affich") {
                $bouton = "annonce";
            } else {
                $bouton = "message";
            }
            $titre = typo($row['titre']);
            if ($rv == "oui") {
                echo "<tr><td colspan='2'>";
                $date_jour = affdate_jourcourt($date);
                if ($date_jour != $date_rv) {
                    echo "<div class='arial11'><b>{$date_jour}</b></div>";
                }
                echo "</td></tr>";
            }
            echo "<tr>";
            echo "<td width='24' valign='middle'>";
            echo "<a href='{$url}'>";
            if ($rv == "oui") {
                echo "<img src='img_pack/rv.gif' style='background: url(img_pack/{$bouton}.gif) no-repeat;' border='0'>";
            } else {
                echo "<img src='img_pack/{$bouton}.gif' border='0'>";
            }
            echo "</a>";
            echo "</td>";
            echo "<td valign='middle'>";
            if ($rv == "oui") {
                if (affdate($date) == affdate($date_fin)) {
                    echo "<div class='arial0' style='float: {$spip_lang_left}; line-height: 12px; color: #666666; margin-{$spip_lang_right}: 3px; padding-{$spip_lang_right}: 4px; background: url(img_pack/fond-agenda.gif) {$spip_lang_right} center no-repeat;'>" . heures($date) . ":" . minutes($date) . "<br />" . heures($date_fin) . ":" . minutes($date_fin) . "</div>";
                } else {
                    echo "<div class='arial0' style='float: {$spip_lang_left}; line-height: 12px; color: #666666; margin-{$spip_lang_right}: 3px; padding-{$spip_lang_right}: 4px; background: url(img_pack/fond-agenda.gif) {$spip_lang_right} center no-repeat; text-align: center;'>" . heures($date) . ":" . minutes($date) . "<br />...</div>";
                }
            }
            echo "<div><b><a href='{$url}' class='arial1' style='color: #333333;'>{$titre}</a></b></div>";
            echo "</td>";
            echo "</tr>\n";
            $date_rv = $date_jour;
        }
        echo "</table>";
        fin_cadre_enfonce();
    }
}
Example #6
0
 public function ping()
 {
     Redis::expire('online:' . $this->session, minutes(5));
 }
Example #7
0
function minute($numberOf)
{
    return minutes($numberOf);
}
Example #8
0
function afficher_si_rdv($date_heure, $date_fin, $choix)
{
	$heures_debut = heures($date_heure);
	$minutes_debut = minutes($date_heure);
	$heures_fin = heures($date_fin);
	$minutes_fin = minutes($date_fin);
  
	if ($date_fin == "0000-00-00 00:00:00") {
		$date_fin = $date_heure;
		$heures_fin = $heures_debut + 1;
	}
  
	if ($heures_fin >=24){
		$heures_fin = 23;
		$minutes_fin = 59;
	}
			
	$lib = _T('item_non_afficher_calendrier');
	if (!$choix)  $lib = "<b>$lib</b>";

	$res = "\n<div><input type='radio' name='rv' value='non' id='rv_off'" .
		(!$choix ? " checked='checked' " : '')
		. "\nonclick=\"changeVisible(this.checked, 'heure-rv', 'none', 'block');\"/>"
		. "<label for='rv_off'>"
		. $lib
		. "</label>"
		. "</div>";

	$lib = _T('item_afficher_calendrier');
	if ($choix)  $lib = "<b>$lib</b>";

	$res .= "\n<div><input type='radio' name='rv' value='oui' id='rv_on' " .
		($choix ? " checked='checked' " : '') .
		"\nonclick=\"changeVisible(this.checked, 'heure-rv', 'block', 'none');\"/>" . 
		"<label for='rv_on'>"
		. $lib
		. "</label>"
	  . '</div>';
	
	$display = ($choix ? "block" : "none");
	
	return $res .
	 "\n<div id='heure-rv' style='display: $display; padding-top: 4px; padding-left: 24px;'>" .
	  afficher_jour_mois_annee_h_m($date_heure, $heures_debut, $minutes_debut) .
	  "<br />".
	  afficher_jour_mois_annee_h_m($date_fin, $heures_fin, $minutes_fin, '_fin') .
	  "</div>";
}
Example #9
0
function http_calendrier_rv($messages, $type)
{
    global $lcm_lang_rtl;
    $total = '';
    if (!$messages) {
        return $total;
    }
    foreach ($messages as $row) {
        if (preg_match("/^=([^[:space:]]+)\$/", $row['texte'], $match)) {
            $url = $match[1];
        } else {
            $url = "message.php3?id_message=" . $row['id_message'];
        }
        $rv = $row['rv'] == 'oui';
        $date = $row['date_heure'];
        $date_fin = $row['date_fin'];
        if ($row['type'] == "pb") {
            $bouton = "pense-bete";
        } else {
            if ($row['type'] == "annonces") {
                $bouton = "annonce";
            } else {
                $bouton = "message";
            }
        }
        if ($rv) {
            $date_jour = affdate_jourcourt($date);
            $total .= "<tr><td colspan='2'>" . ($date_jour == $date_rv ? '' : "<div><b>{$date_jour}</b></div>") . "</td></tr>";
        }
        $total .= "<tr><td width='24' valign='middle'>" . http_href($url, $rv ? http_img_pack("rv.gif", '', http_style_background($bouton . '.gif', "no-repeat;' border='0'")) : http_img_pack("{$bouton}.gif", '', "border='0'"), '', '') . "</td>" . "<td valign='middle'>" . (!$rv ? '' : (affdate($date) == affdate($date_fin) ? "<div style='font-size: 9px;'" . http_style_background('fond-agenda.gif', "right center no-repeat; float: left; line-height: 12px; color: #666666; margin-right: 3px; padding-right: 4px;") . heures($date) . ":" . minutes($date) . "<br />" . heures($date_fin) . ":" . minutes($date_fin) . "</div>" : "<div style='font-size: 9px;'" . http_style_background('fond-agenda.gif', "right center no-repeat; float: left; line-height: 12px; color: #666666; margin-right: 3px; padding-right: 4px; text-align: center;") . heures($date) . ":" . minutes($date) . "<br />...</div>")) . "<div><b>" . http_href($url, typo($row['titre']), '', 'font-size: 10px;') . "</b></div>" . "</td>" . "</tr>\n";
        $date_rv = $date_jour;
    }
    if ($type == 'annonces') {
        $titre = _T('info_annonces_generales');
        $couleur_titre = "ccaa00";
        $couleur_texte = "black";
        $couleur_fond = "#ffffee";
    } else {
        if ($type == 'pb') {
            $titre = _T('infos_vos_pense_bete');
            $couleur_titre = "#3874B0";
            $couleur_fond = "#EDF3FE";
            $couleur_texte = "white";
        } else {
            if ($type == 'rv') {
                $titre = _T('info_vos_rendez_vous');
                $couleur_titre = "#666666";
                $couleur_fond = "#eeeeee";
                $couleur_texte = "white";
            }
        }
    }
    return debut_cadre_enfonce("", true, "", $titre) . "<table width='98%' border='0' cellpadding='0' cellspacing='2'>" . $total . "</table>" . fin_cadre_enfonce(true);
}
Example #10
0
function change_date_message($id_message, $heures,$minutes,$mois, $jour, $annee, $heures_fin,$minutes_fin,$mois_fin, $jour_fin, $annee_fin)
{
	$date = date("Y-m-d H:i:s", mktime($heures,$minutes,0,$mois, $jour, $annee));
	
	$jour = journum($date);
	$mois = mois($date);
	$annee = annee($date);
	$heures = heures($date);
	$minutes = minutes($date);
	
	// Verifier que la date de fin est bien posterieure au debut
	$unix_debut = date("U", mktime($heures,$minutes,0,$mois, $jour, $annee));
	$unix_fin = date("U", mktime($heures_fin,$minutes_fin,0,$mois_fin, $jour_fin, $annee_fin));
	if ($unix_fin <= $unix_debut) {
		$jour_fin = $jour;
		$mois_fin = $mois;
		$annee_fin = $annee;
		$heures_fin = $heures + 1;
		$minutes_fin = $minutes;
	}		

	$date_fin = date("Y-m-d H:i:s", mktime($heures_fin,$minutes_fin,0,$mois_fin, $jour_fin, $annee_fin));
	
	$jour_fin = journum($date_fin);
	$mois_fin = mois($date_fin);
	$annee_fin = annee($date_fin);
	$heures_fin = heures($date_fin);
	$minutes_fin = minutes($date_fin);

	sql_updateq('spip_messages', array('date_heure'=>"$annee-$mois-$jour $heures:$minutes:00",  'date_fin'=>"$annee_fin-$mois_fin-$jour_fin $heures_fin:$minutes_fin:00"), "id_message=$id_message");
}
function BOUCLE_article_languehtml_76ddbc2b5f1671bea60186a8fa5bb500(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    $doublons_index = array();
    $command['pagination'] = array(isset($Pile[0]['debut_article_langue']) ? $Pile[0]['debut_article_langue'] : null, 10);
    // Initialise le(s) critère(s) doublons
    if (!isset($doublons[$d = 'articles' . 'archives'])) {
        $doublons[$d] = '';
    }
    if (!isset($command['table'])) {
        $command['table'] = 'articles';
        $command['id'] = '_article_langue';
        $command['from'] = array('articles' => 'spip_articles');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("articles.id_article", "articles.date_redac", "articles.surtitre", "articles.titre", "articles.soustitre", "articles.descriptif", "articles.chapo", "articles.texte", "articles.lang");
        $command['orderby'] = array('articles.date_redac');
        $command['join'] = array();
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'articles.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\'')), array('<', 'TIMESTAMPDIFF(HOUR,articles.date_redac,NOW())/24', "1"), array(sql_in('articles.id_article', $doublons[$doublons_index[] = 'articles' . 'archives'], 'NOT')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/agenda.html', 'html_76ddbc2b5f1671bea60186a8fa5bb500', '_article_langue', 41, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        // COMPTEUR
        $Numrows['_article_langue']['compteur_boucle'] = 0;
        $Numrows['_article_langue']['total'] = @intval($iter->count());
        $debut_boucle = isset($Pile[0]['debut_article_langue']) ? $Pile[0]['debut_article_langue'] : _request('debut_article_langue');
        if (substr($debut_boucle, 0, 1) == '@') {
            $debut_boucle = $Pile[0]['debut_article_langue'] = quete_debut_pagination('id_article', $Pile[0]['@id_article'] = substr($debut_boucle, 1), 10, $iter);
            $iter->seek(0);
        }
        $debut_boucle = intval($debut_boucle);
        $debut_boucle = ($tout = $debut_boucle == -1) ? 0 : $debut_boucle;
        $debut_boucle = max(0, min($debut_boucle, floor(($Numrows['_article_langue']['total'] - 1) / 10) * 10));
        $debut_boucle = intval($debut_boucle);
        $fin_boucle = min($tout ? $Numrows['_article_langue']['total'] : $debut_boucle + 9, $Numrows['_article_langue']['total'] - 1);
        $Numrows['_article_langue']['grand_total'] = $Numrows['_article_langue']['total'];
        $Numrows['_article_langue']["total"] = max(0, $fin_boucle - $debut_boucle + 1);
        if ($debut_boucle > 0 and $debut_boucle < $Numrows['_article_langue']['grand_total'] and $iter->seek($debut_boucle, 'continue')) {
            $Numrows['_article_langue']['compteur_boucle'] = $debut_boucle;
        }
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            $Numrows['_article_langue']['compteur_boucle']++;
            if ($Numrows['_article_langue']['compteur_boucle'] <= $debut_boucle) {
                continue;
            }
            if ($Numrows['_article_langue']['compteur_boucle'] - 1 > $fin_boucle) {
                break;
            }
            foreach ($doublons_index as $k) {
                $doublons[$k] .= "," . $Pile[$SP]['id_article'];
            }
            // doublons
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
    <hr />
        <h4>' . nom_jour(normaliser_date($Pile[$SP]['date_redac'])) . ' ' . affdate(normaliser_date($Pile[$SP]['date_redac'])) . (($t1 = strval(heures(normaliser_date($Pile[$SP]['date_redac'])) != '0' ? (($t2 = strval(heures(normaliser_date($Pile[$SP]['date_redac'])))) !== '' ? $t2 . ':' : '') . (($t2 = strval(minutes(normaliser_date($Pile[$SP]['date_redac'])))) !== '' ? $t2 . (' ' . _T('public|spip|ecrire:heures')) : '') : '')) !== '' ? ' — ' . $t1 : '') . '</h4>
    <hr />
      ' . (($t1 = strval(filtrer('image_graver', filtrer('image_reduire', !is_array($l = quete_logo('id_article', 'ON', $Pile[$SP]['id_article'], '', 0)) ? '' : "<img class=\"spip_logo spip_logos\" alt=\"\" src=\"{$l['0']}\"" . $l[2] . ($l[1] ? " onmouseover=\"this.src='{$l['1']}'\" onmouseout=\"this.src='{$l['0']}'\"" : "") . ' />', '150', '0')))) !== '' ? '<span style="float:right;">' . $t1 . '</span>' : '') . '
			' . (($t1 = strval(interdire_scripts(typo($Pile[$SP]['surtitre'], "TYPO", $connect, $Pile[0])))) !== '' ? '<div class="surtitre">' . $t1 . '</div>' : '') . '
      <h3><a href="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '/' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '">' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a></h3>
      ' . (($t1 = strval(interdire_scripts(typo($Pile[$SP]['soustitre'], "TYPO", $connect, $Pile[0])))) !== '' ? '<div class="sous-titre">' . $t1 . '</div>' : '') . '
      <div class="detail">
      </div><!-- detail -->
      ' . (($t1 = strval(interdire_scripts(propre($Pile[$SP]['descriptif'], $connect, $Pile[0]) ? (($t2 = strval(interdire_scripts(propre($Pile[$SP]['descriptif'], $connect, $Pile[0])))) !== '' ? '<div class="">' . $t2 . ('</div>
		<div class="suite"><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '" title="...' . _T('public|spip|ecrire:suite') . ' : ' . interdire_scripts(attribut_html(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])))) . '" >' . _T('public|spip|ecrire:suite') . '</a></div>') : '') . '
		' : interdire_scripts(propre($Pile[$SP]['chapo'], $connect, $Pile[0]) ? (($t3 = strval(interdire_scripts(propre($Pile[$SP]['chapo'], $connect, $Pile[0])))) !== '' ? '<div class="">' . $t3 . ('</div>
      	<div class="suite"><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '" title="...' . _T('public|spip|ecrire:suite') . ' : ' . interdire_scripts(attribut_html(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])))) . '" >' . _T('public|spip|ecrire:suite') . '</a></div>') : '') . '
      		' : (($t3 = strval(interdire_scripts(couper(propre($Pile[$SP]['texte'], $connect, $Pile[0]), '300')))) !== '' ? '<div class="">' . $t3 . ('</div>
      	<div class="suite"><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '" title="...' . _T('public|spip|ecrire:suite') . ' : ' . interdire_scripts(attribut_html(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])))) . '" >' . _T('public|spip|ecrire:suite') . '</a></div>') : '') . '
		') . '
	'))) !== '' ? '<div class="texte">
	<div class="extrait">' . $t1 . '</div><!-- fin extrait -->
      </div>' : '') . '
      <br />
    ';
            lang_select();
        }
        lang_select();
        $iter->free();
    }
    if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) {
        spip_log(intval(1000 * $timer) . "ms BOUCLE_article_langue @ squelettes/agenda.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Example #12
0
function presenter_message_boucles($row, $afficher_auteurs)
{
	global $connect_id_auteur, $spip_lang_left, $spip_lang_rtl;

	$vals = array();

	$id_message = $row['id_message'];
	$date = $row["date_heure"];
	$date_fin = $row["date_fin"];
	$titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
	$type = $row["type"];
	$rv = $row["rv"];

			//
			// Titre
			//

	$s = "<a href='" . generer_url_ecrire("message","id_message=$id_message") . "' style='display: block;'>";

	switch ($type) {
	case 'pb' :
				$puce = "m_envoi_bleu$spip_lang_rtl.gif";
				break;
	case 'memo' :
				$puce = "m_envoi_jaune$spip_lang_rtl.gif";
				break;
	case 'affich' :
				$puce = "m_envoi_jaune$spip_lang_rtl.gif";
				break;
	case 'normal':
	default:
				$puce = "m_envoi$spip_lang_rtl.gif";
				break;
	}
				
	$s .= http_img_pack("$puce", "", "width='14' height='7'");
	$s .= "&nbsp;&nbsp;".typo($titre)."</a>";
	$vals[] = $s;

			//
			// Auteurs

	if ($afficher_auteurs) {
		$result_auteurs = sql_select("auteurs.id_auteur, auteurs.nom", "spip_auteurs AS auteurs, spip_auteurs_messages AS lien", "lien.id_message=$id_message AND lien.id_auteur!=$connect_id_auteur AND lien.id_auteur=auteurs.id_auteur");

		$auteurs = '';
		while ($row_auteurs = sql_fetch($result_auteurs)) {
			$id_auteur = $row_auteurs['id_auteur'];
			$auteurs[] = "<a href='" . generer_url_ecrire("auteur_infos","id_auteur=$id_auteur") . "'>".typo($row_auteurs['nom'])."</a>";
		}

		if ($auteurs AND $type == 'normal') {
			$s = "<span class='arial1 spip_x-small'>" . join(', ', $auteurs) . "</span>";
		} else $s = "&nbsp;";
		$vals[] = $s;
	}
			
			//
			// Messages de forums
			
	$total_forum = sql_countsel('spip_forum', "id_message=$id_message");
			
	if ($total_forum > 0) $vals[] = "($total_forum)";
	else $vals[] = "";
			
			//
			// Date
			//
			
	$s = affdate($date);
	if ($rv == 'oui') {
		$jour=journum($date);
		$mois=mois($date);
		$annee=annee($date);
				
		$heure = heures($date).":".minutes($date);
		if (affdate($date) == affdate($date_fin))
			$heure_fin = heures($date_fin).":".minutes($date_fin);
		else 
			$heure_fin = "...";

		$s = "<div " . 
			http_style_background('rv-12.gif', "$spip_lang_left center no-repeat; padding-$spip_lang_left: 15px") .
			"><a href='" . generer_url_ecrire("calendrier","type=jour&jour=$jour&mois=$mois&annee=$annee") . "'><b style='color: black;'>$s</b><br />$heure-$heure_fin</a></div>";
	} else {
		$s = "<span style='color: #999999'>$s</span>";
	}
			
	$vals[] = $s;

	return $vals;
}
Example #13
0
 Master Document</a> </td> </tr>
    <tr> <th> Most Recent Event </th> <td> <?php 
    echo $series->mostRecentEvent()->linkReport();
    ?>
 </td> </tr>
    <?php 
    $nextevent = $series->nextEvent();
    if ($nextevent) {
        $next_format = "%B %e %I:%M %P";
        if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") {
            $next_format = str_replace("P", "p", $next_format);
            $next_format = str_replace("e", "#d", $next_format);
        }
        ?>
      <tr> <th> Next Event </th> <td> <?php 
        echo strftime($next_format . " registration", strtotime($nextevent->start) - minutes(30));
        ?>
 </td> </tr>
    <?php 
    } else {
        ?>
      <tr> <th> Next Event </th> <td> Not scheduled yet </td> </tr>
    <?php 
    }
    ?>
    </table>
  </div> <!-- Series-info -->
</div> <!-- Series -->
<?php 
}
?>
Example #14
0
function lcm_page_start($title = "", $css_files = "", $meta = '', $help_code = '')
{
    global $connect_id_auteur;
    global $connect_status;
    global $auth_can_disconnect, $connect_login;
    global $options;
    global $lcm_lang, $lcm_lang_rtl, $lcm_lang_left, $lcm_lang_right;
    global $clean_link;
    global $prefs;
    // Clean the global link (i.e. remove actions passed in the URL)
    $clean_link->delVar('var_lang');
    $clean_link->delVar('set_options');
    $clean_link->delVar('set_couleur');
    $clean_link->delVar('set_disp');
    $clean_link->delVar('set_ecran');
    lcm_html_start($title, $css_files, $meta);
    //
    // Title (mandatory) and description (may be empty) of the site
    //
    $site_name = _T(read_meta('site_name'));
    if (!$site_name) {
        $site_name = _T('title_software');
    }
    $site_desc = _T(read_meta('site_description'));
    //
    // Most of the header/navigation html
    //
    echo '<div id="header">
		<a href="summary.php" class="balance_link">&nbsp;</a>
		<h1 class="lcm_main_head"><a href="summary.php" class="head_ttl_link">' . $site_name . '</a></h1>
		<div class="lcm_slogan"><a href="summary.php" class="head_subttl_link">' . $site_desc . "</a></div>\n\t\t<br />\n\t</div>\n";
    echo "<div id='wrapper_" . $prefs['screen'] . "'>\n\t\t<div id=\"container_" . $prefs['screen'] . "\">\n\t\t\t<div id=\"content_" . $prefs['screen'] . "\">\n\t\t\t<!-- This is the navigation column, usually used for menus and brief information -->\n\t\t\t\t<div id=\"navigation_menu_column\">\n\t\t\t\t<!-- Start of navigation_menu_column content -->\n\t\t\t\t\t<div class=\"nav_menu_box\">\n\t\t\t\t\t\t<div class=\"nav_column_menu_head\"><div class=\"mm_main_menu\">" . _T('menu_main') . "</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<ul class=\"nav_menu_list\">";
    echo show_navmenu_item("listcases.php", 'main_cases');
    // Require to be explicitly off in order to hide the menu item (avoid config errors)
    if (read_meta('client_hide_all') != 'yes') {
        echo show_navmenu_item("listclients.php", 'main_clients');
    }
    if (read_meta('org_hide_all') != 'yes') {
        echo show_navmenu_item("listorgs.php", 'main_orgs');
    }
    if (read_meta('expenses_hide_all') != 'yes') {
        echo show_navmenu_item("listexps.php", "main_expenses");
    }
    echo show_navmenu_item("listauthors.php", 'main_authors');
    echo "</ul>\n";
    echo "</div>\n";
    if ($connect_status == 'admin') {
        echo "<div class=\"nav_menu_box\">\n";
        echo "<div class=\"nav_column_menu_head\"><div class=\"mm_admin\">" . _T('menu_admin') . "</div></div>\n";
        echo "<ul class=\"nav_menu_list\">";
        show_navmenu_item("config_site.php", "admin_siteconf");
        show_navmenu_item("archive.php", "admin_archives");
        show_navmenu_item("listreps.php", "admin_reports");
        show_navmenu_item("keywords.php", "admin_keywords");
        echo "</ul>\n";
        echo "</div>\n";
    }
    // Show today's date
    if ($title != _T('title_upgrade_database')) {
        echo "<div class=\"nav_menu_box\">\n";
        echo "<div class=\"nav_column_menu_head\">\n";
        echo "<div class=\"mm_calendar\">" . _T('menu_calendar') . "</div>\n";
        echo "</div>\n";
        // Show calendar
        include_lcm('inc_calendar');
        $now = date('Y-m-d');
        echo "<table border='0' align='center'><tr><td>\n";
        // Temporary? [ML]
        echo http_calendrier_agenda(mois($now), annee($now), jour($now), mois($now), annee($now), false, 'calendar.php');
        echo "</td></tr></table>\n";
        echo "</div>\n";
        // Start agenda box
        echo '<div class="nav_menu_box">' . "\n";
        echo '<div class="nav_column_menu_head">';
        echo '<div class="mm_agenda">' . _T('menu_agenda') . "</div>\n";
        echo "</div>\n";
        $events = false;
        // Show appointments for today
        $q = "SELECT app.id_app, start_time, type, title\n\t\t\tFROM lcm_app as app, lcm_author_app as aut\n\t\t\tWHERE aut.id_author=" . $GLOBALS['author_session']['id_author'] . "\n\t\t\tAND app.id_app = aut.id_app\n\t\t\tAND " . lcm_query_trunc_field('app.start_time', 'day') . "\n\t\t\t= " . lcm_query_trunc_field('NOW()', 'day') . "\n\t\t\tORDER BY app.reminder ASC";
        $result = lcm_query($q);
        if (lcm_num_rows($result) > 0) {
            $events = true;
            $today = getdate(time());
            echo "<p class=\"nav_column_text\">\n" . '<strong><a class="content_link" href="calendar.php?type=jour' . "&amp;jour=" . $today['mday'] . "&amp;mois=" . $today['mon'] . "&amp;annee=" . $today['year'] . '">' . _Th('calendar_button_now') . "</a></strong><br />\n";
            echo "</p>\n";
            echo "<ul class=\"small_agenda\">\n";
            while ($row = lcm_fetch_array($result)) {
                echo "<li><a href=\"app_det.php?app=" . $row['id_app'] . "\">" . heures($row['start_time']) . ':' . minutes($row['start_time']) . " - " . $row['title'] . "</a></li>\n";
            }
            echo "</ul>\n";
            echo "<hr class=\"hair_line\" />\n";
        }
        // Show next appointments
        $q = "SELECT a.id_app, a.start_time, a.type, a.title\n\t\t\tFROM lcm_app as a, lcm_author_app as aa\n\t\t\tWHERE (aa.id_author = " . $GLOBALS['author_session']['id_author'] . "\n\t\t\t\t\tAND a.id_app = aa.id_app\n\t\t\t\t\tAND a.start_time >= '" . date('Y-m-d H:i:s', (int) ceil(time() / 86400) * 86400) . "')\n\t\t\tORDER BY a.reminder ASC\n\t\t\tLIMIT 5";
        $result = lcm_query($q);
        if (lcm_num_rows($result) > 0) {
            $events = true;
            echo "<p class=\"nav_column_text\">\n";
            echo "<strong>" . _T('calendar_button_nextapps') . "</strong><br />\n";
            echo "</p>\n";
            echo "<ul class=\"small_agenda\">\n";
            while ($row = lcm_fetch_array($result)) {
                echo "<li><a href=\"app_det.php?app=" . $row['id_app'] . "\">" . format_date($row['start_time'], 'short') . " - " . $row['title'] . "</a></li>\n";
            }
            echo "</ul>\n";
        }
        if (!$events) {
            echo '<p class="nav_column_text">' . _T('calendar_info_noacts') . "</p>\n";
        }
        // my appointments
        echo '&nbsp;<a href="author_det.php?tab=appointments&amp;author=' . $GLOBALS['author_session']['id_author'] . '" title="' . _T('title_agenda_list') . '">' . '<img src="images/jimmac/stock_show-form-dialog.png" border="0" width="16" height="16" alt="" /></a>';
        // new appointment
        echo '&nbsp;<a href="edit_app.php?app=0" title="' . _T('app_button_new') . '">' . '<img src="images/jimmac/stock_new-16.png" border="0" width="16" height="16" alt="" /></a>';
        // End of nav_menu_box for Agenda
        echo "</div>\n";
    }
    // End of "navigation_menu_column" content
    echo "</div>\n\n\t\t\t\t<!-- The main content will be here - all the data, html forms, search results etc. -->\n\t\t\t\t<div id=\"main_column\">\n\t\t\t\t\n\t\t\t\t\t<!-- Start of 'main_column' content -->\n\t\t\t\t\t<h3 class=\"content_head\">";
    if ($help_code) {
        echo '<span class="help_icon">' . lcm_help($help_code) . "</span> ";
    }
    echo $title;
    echo "</h3>\n\t\t\t\t\t<!-- [KM] Just a small experiment how the future breadcrumb will look like -->\n\t\t\t\t\t<!-- div id=\"breadcrumb\"><a href=\"#\" title=\"Test link\">Home</a> &gt; <a href=\"#\" title=\"Test link\">Page1</a> &gt; <a href=\"#\" title=\"Test link\">Subpage1</a> &gt; Subsubpage1</div -->\n\t";
}
Example #15
0
function cs_date_long($numdate) {
	$date_array = recup_date($numdate);
	if (!$date_array) return '?';
	list($annee, $mois, $jour, $heures, $minutes, $sec) = $date_array;
	if(!defined('_SPIP19300')) list($heures, $minutes) =array(heures($numdate), minutes($numdate));
	return _T('couteau:stats_date', array('jour'=>$jour, 'mois'=>$mois, 'annee'=>substr($annee,2), 'h'=>$heures, 'm'=>$minutes, 's'=>$sec));
}
Example #16
0
function date_ical($date_heure, $minutes = 0)
{
    return date("Ymd\\THis", mktime(heures($date_heure), minutes($date_heure) + $minutes, 0, mois($date_heure), jour($date_heure), annee($date_heure)));
}
Example #17
0
function http_calendrier_rv($messages, $type) {

	$total = $date_rv = '';
	if (!$messages) return $total;
	$connect_quand = $GLOBALS['visiteur_session']['quand'];

	foreach ($messages as $row) {
		$rv = ($row['location'] == 'oui');
		$date = $row['dtstart'];
		$date_fin = $row['dtend'];
		if ($row['category']=="pb") $bouton = "pense-bete";
		else if ($row['category']=="affich") $bouton = "annonce";
		else $bouton = "message";

		if ($rv) {
			$date_jour = affdate_jourcourt($date);
			$total .= "<tr><td colspan='2'>" .
				(($date_jour == $date_rv) ? '' :
				"\n<div  class='calendrier-arial11'><b>$date_jour</b></div>") .
				"</td></tr>";
			$date_rv = $date_jour;
			$rv =
		((affdate($date) == affdate($date_fin)) ?
		 ("\n<div class='calendrier-arial9 fond-agenda'>"
		  . heures($date).":".minutes($date)."<br />"
		  . heures($date_fin).":".minutes($date_fin)."</div>") :
		( "\n<div class='calendrier-arial9 fond-agenda' style='text-align: center;'>"
		  . heures($date).":".minutes($date)."<br />...</div>" ));
		}

		$c = (strtotime($date) <= $connect_quand) ? '' : " color: red;";
		$total .= "<tr><td style='width: 24px' valign='middle'>" .
		  http_href($row['url'],
				     ($rv ?
				      http_img_pack("rv.gif", 'rv',
						    http_style_background($bouton . '.gif', "no-repeat;")) : 
				      http_img_pack($bouton.".gif", $bouton, ""))) .
		"</td>\n" .
		"<td valign='middle'><div style='font-weight: bold;$c'>" .
		$rv .
		http_href($row['url'], typo($row['summary']), '', '', 'calendrier-verdana') .
		"</div></td></tr>";
	}

	if ($type == 'annonces') {
		$titre = _T('info_annonces_generales');
	}
	else if ($type == 'pb') {
		$titre = _T('infos_vos_pense_bete');
	}
	else if ($type == 'rv') {
		$titre = _T('info_vos_rendez_vous');
	}

	return
	  debut_cadre_enfonce("", true, "", $titre) .
	  "\n<table>" .
	  $total .
	  "</table>" .
	  fin_cadre_enfonce(true);
}
function videofeed_shortcode($atts)
{
    //sets the attribute options for the shortcode
    $atts = shortcode_atts(array('header' => '', 'tag' => '', 'tag2' => '', 'tag3' => '', 'maxresults' => '3', 'orderby' => 'viewCount', 'description' => 'yes', 'title' => 'yes', 'imgwidth' => '200', 'imgheight' => '113', 'descriptionlength' => '1000', 'titlelength' => '400', 'classname' => '', 'time' => 'no', 'morelink' => ''), $atts);
    $classname = $atts['classname'];
    //variable takes the description length from the player shortcode
    global $descriptionlength;
    //checks if tags are filled and adds slashes for proper syntax of the url
    if ($atts['tag'] != '') {
        $tag1 = '/-/' . $atts['tag'];
    }
    if ($atts['tag2'] != '') {
        $tag2 = '/' . $atts['tag2'];
    }
    if ($atts['tag3'] != '') {
        $tag3 = '/' . $atts['tag3'];
    }
    //checks to see the orderby attribute contains a valid option, if not viewCount is set
    if ($atts['orderby'] == "viewCount" || $atts['orderby'] == "published" || $atts['orderby'] == "rating") {
    } else {
        $atts['orderby'] = "viewCount";
    }
    //takes the username of the youtube account, filled in on the admin screen
    $username = get_option('youtube_user');
    //new class on the zend framework for the gdata from youtube feed
    $yt = new Zend_Gdata_YouTube();
    $yt->setMajorProtocolVersion(2);
    //builds the url for the gdata feed
    $url = 'http://gdata.youtube.com/feeds/api/users/' . $username . '/uploads' . $tag1 . $tag2 . $tag3 . '?orderby=' . $atts['orderby'] . '&max-results=' . $atts['maxresults'];
    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    //assigns videofeed to the feed from the url built above
    $videoFeed = @$yt->getVideoFeed($url);
    $n = 1;
    //for counting the number of videos in the feed
    //prints out the header and opens a div for the feed
    $contentfeed = '<div class="video_feed" id="' . $classname . '">';
    $contentfeed = $contentfeed . '<div class="video_header ' . $classname . '" id="video_header_' . $atts['header'] . '"><h2>' . $atts['header'] . '</h2></div>';
    //asigns a unique id based on paginateid so more than one feed can be paginated on a page
    $contentfeed = $contentfeed . '<ul id="videofeed_container_' . $atts['paginateid'] . '" >';
    //loop through each video in the feed
    foreach ($videoFeed as $videoEntry) {
        $videosource = 'http://www.youtube.com/embed/' . $videoEntry->getVideoId();
        //defines variable as full url for the embeded video
        $titleplayerlong = $videoEntry->getVideoTitle();
        //defines variable as the video's title
        $videolength = $videoEntry->getVideoDuration();
        //checks the title length and changes it if over X characters long
        if (strlen($titleplayerlong) > $atts['titlelength']) {
            $titleplayer = substr($titleplayerlong, 0, $atts['titlelength']) . '...';
        } else {
            $titleplayer = $videoEntry->getVideoTitle();
        }
        $descriptionlong = $videoEntry->getVideoDescription();
        //checks the description length and changes it if over the desired amount
        if (strlen($descriptionlong) > $atts['descriptionlength']) {
            $description = substr($descriptionlong, 0, $atts['descriptionlength']) . "...";
        } else {
            $description = $videoEntry->getVideoDescription();
        }
        if (strlen($descriptionlong) > $descriptionlength) {
            $descriptionlong = substr($descriptionlong, 0, $descriptionlength) . "...";
        }
        //removes the quotation marks from the descriptions and titles
        $description = str_replace("\"", " ", $description);
        $descriptionlong = str_replace("\"", " ", $descriptionlong);
        $titleplayer = str_replace("\"", " ", $titleplayer);
        $titleplayerlong = str_replace("\"", " ", $titleplayerlong);
        //prints out the html with variables included
        $contentfeed = $contentfeed . '<li>';
        $contentfeed = $contentfeed . '<div class="video_feed_item ' . $classname . '" id="video_feed_item_' . $atts['tag'] . $n . '" onClick="changevideo(\'' . $videosource . '\', \'' . addslashes($descriptionlong) . '\',\'' . addslashes($titleplayerlong) . '\')" >';
        $contentfeed = $contentfeed . '<div class="video_img ' . $classname . '" id="video_img_' . $atts['tag'] . $n . '"><img style="position:relative;z-index:1;" width="' . $atts['imgwidth'] . '" height="' . $atts['imgheight'] . '" src="http://img.youtube.com/vi/' . $videoEntry->getVideoId() . '/hqdefault.jpg"/></div>';
        //if a title is wanted print the title
        if ($atts['title'] == 'yes' || $atts['title'] == 'true') {
            $contentfeed = $contentfeed . '<div class="video_title ' . $classname . '" id="video_title_' . $atts['tag'] . $n . '" ><p>' . $titleplayer . '</p></div>';
        }
        //if a description is wanted print a description
        if ($atts['description'] == 'yes' || $atts['description'] == 'true') {
            $contentfeed = $contentfeed . '<div class="video_description ' . $classname . '"><p >' . $description . '</p></div>';
        }
        //if the duration of the video is wanted add it
        if ($atts['time'] == 'yes' || $atts['time'] == 'true') {
            $contentfeed = $contentfeed . '<div class="video_time ' . $classname . '" id="video_time_' . $atts['tag'] . $n . '"><p>' . minutes($videolength) . '</p></div>';
        }
        //return '</div>';
        $contentfeed = $contentfeed . '</li>';
        $n++;
    }
    $contentfeed = $contentfeed . '<div class="holder' . $atts['paginateid'] . '"></div>';
    //holder for the pagination controls
    if ($atts['morelink'] != '') {
        $contentfeed = $contentfeed . '<div class="more_feed_videos"><a href="' . $atts['morelink'] . '" title="More in ' . $atts['header'] . '" >More in ' . $atts['header'] . '</a>';
    }
    $contentfeed = $contentfeed . '</ul>';
    $contentfeed = $contentfeed . '</div>';
    return $contentfeed;
}
Example #19
0
function heures_minutes($numdate)
{
    return _T('date_fmt_heures_minutes', array('h' => heures($numdate), 'm' => minutes($numdate)));
}
Example #20
0
        if (trim($mp4tags_check) != "Found") {
            die("Could not find mp4tags. Please make sure it’s in your path.'{$mp4tags_check}'\n");
        }
        $mp4info_command = "mp4info";
        $mp4info_check = shell_exec('command -v ' . $mp4info_command . ' >& /dev/null && echo "Found" || echo "Not Found"');
        if (trim($mp4info_check) != "Found") {
            unset($mp4info_check);
            $mp4info_command = $mp4v2_path . "/mp4info";
            $mp4info_check = shell_exec('command -v ' . $mp4info_command . ' >& /dev/null && echo "Found" || echo "Not Found"');
        }
        if (trim($mp4info_check) != "Found") {
            die("Could not find mp4info. Please make sure it’s in your path.\n");
        }
        shell_exec($mp4tags_command . ' -r w -s "' . '#' . $episode . ': ' . $options['title'] . '" -a "' . $options['artist'] . '" -A "' . $options['album'] . '" -y "' . date('Y') . '" -g "' . $options['genre'] . '" -c "' . $options['comments'] . '" -L "' . $options['comments'] . '" -m "' . $options['comments'] . '" -t ' . $episode . ' "' . $track_full_filename . '"');
        $track_playtime_output = shell_exec($mp4info_command . ' "' . $track_full_filename . '" | sed -n "s/^.*audio.*, \\([0-9]*\\)\\.[0-9]* secs,.*$/\\1/p"');
        write_metadata($post_full_filename, $episode, $options['title'], $track_filename, filesize($track_full_filename), minutes(trim($track_playtime_output)), $options['comments'], $comments_suffix);
    }
}
function write_metadata($post_full_filename, $episode, $title, $track_filename, $track_filesize, $track_playtime, $comments, $comments_suffix)
{
    if (file_exists($post_full_filename)) {
        die("Posts file at output folder already exist. Won’t overwrite.\n");
    }
    $post_array = array('title' => 'Episode ' . $episode . ': ' . $title, 'layout' => 'post', 'podcastfilename' => $track_filename, 'podcastlength' => $track_filesize, 'itunesurl' => '#ITUNESURL#', 'length' => $track_playtime . ' min');
    $yaml_output = Spyc::YAMLDump($post_array, 2, 72);
    $yaml_output .= "---\n\n" . $comments . $comments_suffix;
    if (!($handle = fopen($post_full_filename, 'w'))) {
        die("Cannot open file {$post_full_filename}");
    }
    if (fwrite($handle, $yaml_output) === FALSE) {
        die("Cannot write to file {$post_full_filename}");