本文整理汇总了PHP中get_entry函数的典型用法代码示例。如果您正苦于以下问题:PHP get_entry函数的具体用法?PHP get_entry怎么用?PHP get_entry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_entry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($argc, $argv)
{
$p = new Player();
if (get_entry($argc, $argv, $p) == FALSE) {
aff_help();
return;
}
enter_the_game($p);
}
示例2: restore
function restore($db_a, $dir, $type = false)
{
global $sag;
if ($handle = opendir($dir)) {
try {
$sag->createDatabase($db_a);
} catch (Exception $e) {
echo $e->getMessage() . "DB:" . $db_a . "\n";
}
$sag->setDatabase($db_a);
while (false !== ($entry = readdir($handle))) {
if (".." == $entry || "." == $entry) {
continue;
}
$obj1 = get_entry($db_a, "/" . $entry);
$temp_rev = $obj1['res']->_rev;
$obj2 = json_decode(file_get_contents($dir . $entry . '/' . $entry . '.json'));
if (is_object($obj1)) {
$obj = update_together($obj1['res'], $obj2, 'object');
} else {
$obj = $obj2;
}
$obj = object2array($obj);
unset($obj['err']);
unset($obj['_rev']);
try {
if (preg_match("/^_/", urldecode($entry))) {
echo $sag->put(urldecode($entry), $obj)->body->ok;
} else {
echo $sag->put($entry, $obj)->body->ok;
}
} catch (Exception $e) {
if ($type == 'update') {
$obj['_rev'] = $temp_rev;
$obj['views'] = $obj['views'] + 1;
}
try {
if (preg_match("/^_/", urldecode($entry))) {
echo $sag->put(urldecode($entry), $obj)->body->ok;
} else {
echo $sag->put($entry, $obj)->body->ok;
}
} catch (Exception $e) {
echo $e->getMessage() . "DB:" . $db_a . " file:" . urlencode($entry) . "\n";
}
}
}
}
return "restore file->db finished\n";
}
示例3: header
//сортировка идет по дате последней правки
//Разбираем полученный массив. Подробнее в functions.php
$entries = $entries_arr[0];
$page = $entries_arr[1];
//текущая страница
$total = $entries_arr[2];
//всего страниц
//Если массив $_GET не пустой, то обработка правки и удаления записей
if ($_GET['action'] == 'edit') {
//правка записи
//если нет прав - редирект на главную
if (!$canDoEdit) {
header('Location: index.php');
die;
}
$entry = get_entry($link, $_GET['id_entry']);
//вытаскиваем конкретную запись из БД
//Разбираем массив в переменные
$id_entry = $entry['id_entry'];
$numOrder = $entry['numOrder'];
$customer = $entry['customer'];
$tarif = $entry['tarif'];
$ip_address = $entry['ip_address'];
$netmask = $entry['netmask'];
$gateway = $entry['gateway'];
$vlan_id = $entry['vlan_id'];
$customer_port = $entry['customer_port'];
$termination_point = $entry['termination_point'];
$commentary = $entry['commentary'];
//Выводим в шаблоны
include_once 'views/v-header.php';
示例4: afficher_form_billet
function afficher_form_billet($article, $erreurs)
{
function s_color($color)
{
return '<button type="button" onclick="insertTag(\'[color=' . $color . ']\',\'[/color]\',\'contenu\');"><span style="background:' . $color . ';"></span></button>';
}
function s_size($size)
{
return '<button type="button" onclick="insertTag(\'[size=' . $size . ']\',\'[/size]\',\'contenu\');"><span style="font-size:' . $size . 'pt;">' . $size . '. Ipsum</span></button>';
}
function s_u($char)
{
return '<button type="button" onclick="insertChar(\'' . $char . '\', \'contenu\');"><span>' . $char . '</span></button>';
}
if ($article != '') {
$defaut_jour = $article['jour'];
$defaut_mois = $article['mois'];
$defaut_annee = $article['annee'];
$defaut_heure = $article['heure'];
$defaut_minutes = $article['minutes'];
$defaut_secondes = $article['secondes'];
$titredefaut = $article['bt_title'];
// abstract : s’il est vide, il est regénéré à l’affichage, mais reste vide dans la BDD)
$chapodefaut = get_entry($GLOBALS['db_handle'], 'articles', 'bt_abstract', $article['bt_id'], 'return');
$notesdefaut = $article['bt_notes'];
$categoriesdefaut = $article['bt_categories'];
$contenudefaut = htmlspecialchars($article['bt_wiki_content']);
$motsclesdefaut = $article['bt_keywords'];
$statutdefaut = $article['bt_statut'];
$allowcommentdefaut = $article['bt_allow_comments'];
} else {
$defaut_jour = date('d');
$defaut_mois = date('m');
$defaut_annee = date('Y');
$defaut_heure = date('H');
$defaut_minutes = date('i');
$defaut_secondes = date('s');
$chapodefaut = '';
$contenudefaut = '';
$motsclesdefaut = '';
$categoriesdefaut = '';
$titredefaut = '';
$notesdefaut = '';
$statutdefaut = '1';
$allowcommentdefaut = '1';
}
if ($erreurs) {
echo erreurs($erreurs);
}
if (isset($article['bt_id'])) {
echo '<form id="form-ecrire" method="post" onsubmit="return moveTag();" action="' . $_SERVER['PHP_SELF'] . '?post_id=' . $article['bt_id'] . '" >' . "\n";
} else {
echo '<form id="form-ecrire" method="post" onsubmit="return moveTag();" action="' . $_SERVER['PHP_SELF'] . '" >' . "\n";
}
echo '<input id="titre" name="titre" type="text" size="50" value="' . $titredefaut . '" required="" placeholder="' . ucfirst($GLOBALS['lang']['placeholder_titre']) . '" tabindex="30" class="text" spellcheck="true" />' . "\n";
echo '<div id="chapo_note">' . "\n";
echo '<div id="blocchapo">' . "\n";
echo '<textarea id="chapo" name="chapo" rows="5" cols="60" placeholder="' . ucfirst($GLOBALS['lang']['placeholder_chapo']) . '" tabindex="35" class="text" >' . $chapodefaut . '</textarea>' . "\n";
echo '</div>' . "\n";
echo '<div id="blocnote">' . "\n";
echo '<textarea id="notes" name="notes" rows="5" cols="30" placeholder="' . ucfirst($GLOBALS['lang']['placeholder_notes']) . '" tabindex="40" class="text" >' . $notesdefaut . '</textarea>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
echo '<p class="formatbut">' . "\n";
echo "\t" . '<button id="button01" class="but" type="button" title="' . $GLOBALS['lang']['bouton-gras'] . '" onclick="insertTag(\'[b]\',\'[/b]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button02" class="but" type="button" title="' . $GLOBALS['lang']['bouton-ital'] . '" onclick="insertTag(\'[i]\',\'[/i]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button03" class="but" type="button" title="' . $GLOBALS['lang']['bouton-soul'] . '" onclick="insertTag(\'[u]\',\'[/u]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button04" class="but" type="button" title="' . $GLOBALS['lang']['bouton-barr'] . '" onclick="insertTag(\'[s]\',\'[/s]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<span class="spacer"></span>' . "\n";
// bouton des couleurs
echo "\t" . '<span id="button13" class="but but-dropdown" title=""><span></span><span class="list list-color">' . s_color('black') . s_color('gray') . s_color('silver') . s_color('white') . s_color('blue') . s_color('green') . s_color('red') . s_color('yellow') . s_color('fuchsia') . s_color('lime') . s_color('aqua') . s_color('maroon') . s_color('purple') . s_color('navy') . s_color('teal') . s_color('olive') . s_color('#ff7000') . s_color('#ff9aff') . s_color('#a0f7ff') . s_color('#ffd700') . '</span></span>' . "\n";
// boutons de la taille de caractère
echo "\t" . '<span id="button14" class="but but-dropdown" title=""><span></span><span class="list list-size">' . s_size('9') . s_size('12') . s_size('16') . s_size('20') . '</span></span>' . "\n";
// quelques caractères unicode
echo "\t" . '<span id="button15" class="but but-dropdown" title=""><span></span><span class="list list-spechr">' . s_u('æ') . s_u('Æ') . s_u('œ') . s_u('Œ') . s_u('é') . s_u('É') . s_u('è') . s_u('È') . s_u('ç') . s_u('Ç') . s_u('ù') . s_u('Ù') . s_u('à') . s_u('À') . s_u('ö') . s_u('Ö') . s_u('…') . s_u('«') . s_u('»') . s_u('±') . s_u('≠') . s_u('×') . s_u('÷') . s_u('ß') . s_u('®') . s_u('©') . s_u('↓') . s_u('↑') . s_u('←') . s_u('→') . s_u('ø') . s_u('Ø') . s_u('☠') . s_u('☣') . s_u('☢') . s_u('☮') . s_u('★') . s_u('☯') . s_u('☑') . s_u('☒') . s_u('☐') . s_u('♫') . s_u('♬') . s_u('♪') . s_u('♣') . s_u('♠') . s_u('♦') . s_u('❤') . s_u('♂') . s_u('♀') . s_u('☹') . s_u('☺') . s_u('☻') . s_u('♲') . s_u('⚐') . s_u('⚠') . s_u('☂') . s_u('√') . s_u('∑') . s_u('λ') . s_u('π') . s_u('Ω') . s_u('№') . s_u('∞') . '</span></span>' . "\n";
echo "\t" . '<span class="spacer"></span>' . "\n";
echo "\t" . '<button id="button05" class="but" type="button" title="' . $GLOBALS['lang']['bouton-left'] . '" onclick="insertTag(\'[left]\',\'[/left]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button06" class="but" type="button" title="' . $GLOBALS['lang']['bouton-center'] . '" onclick="insertTag(\'[center]\',\'[/center]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button07" class="but" type="button" title="' . $GLOBALS['lang']['bouton-right'] . '" onclick="insertTag(\'[right]\',\'[/right]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button08" class="but" type="button" title="' . $GLOBALS['lang']['bouton-justify'] . '" onclick="insertTag(\'[justify]\',\'[/justify]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<span class="spacer"></span>' . "\n";
echo "\t" . '<button id="button09" class="but" type="button" title="' . $GLOBALS['lang']['bouton-lien'] . '" onclick="insertTag(\'[\',\'|http://]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button10" class="but" type="button" title="' . $GLOBALS['lang']['bouton-cita'] . '" onclick="insertTag(\'[quote]\',\'[/quote]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button11" class="but" type="button" title="' . $GLOBALS['lang']['bouton-imag'] . '" onclick="insertTag(\'[img]\',\'|alt[/img]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button12" class="but" type="button" title="' . $GLOBALS['lang']['bouton-code'] . '" onclick="insertTag(\'[code]\',\'[/code]\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<span class="spacer"></span>' . "\n";
echo "\t" . '<button id="button16" class="but" type="button" title="' . $GLOBALS['lang']['bouton-liul'] . '" onclick="insertChar(\'\\n\\n** element 1\\n** element 2\\n\',\'contenu\');"><span></span></button>' . "\n";
echo "\t" . '<button id="button17" class="but" type="button" title="' . $GLOBALS['lang']['bouton-liol'] . '" onclick="insertChar(\'\\n\\n## element 1\\n## element 2\\n\',\'contenu\');"><span></span></button>' . "\n";
echo '</p>';
echo '<textarea id="contenu" name="contenu" rows="20" cols="60" required="" placeholder="' . ucfirst($GLOBALS['lang']['placeholder_contenu']) . '" tabindex="55" class="text">' . $contenudefaut . '</textarea>' . "\n";
echo form_categories_links('articles', $categoriesdefaut);
echo "\t" . '<input list="htmlListTags" type="text" class="text" id="type_tags" name="tags" onkeydown="chkHit(event);" placeholder="' . ucfirst($GLOBALS['lang']['placeholder_tags']) . '" tabindex="65"/>' . "\n";
echo "\t" . '<input type="hidden" id="categories" name="categories" value="" />' . "\n";
if ($GLOBALS['automatic_keywords'] == '0') {
echo '<div><input id="mots_cles" name="mots_cles" type="text" size="50" value="' . $motsclesdefaut . '" placeholder="' . ucfirst($GLOBALS['lang']['placeholder_motscle']) . '" tabindex="67" class="text" /></div>' . "\n";
}
echo '<div id="date-and-opts">' . "\n";
echo '<div id="date">' . "\n";
echo '<span id="formdate">' . "\n";
form_annee($defaut_annee);
//.........这里部分代码省略.........
示例5: receiveFileFragments
function receiveFileFragments($F)
{
extract($F);
$filekey_valid = check_filekey_validity($filekey, $db);
if ($filekey_valid) {
#Get the information about the file from the table
$file_id = get_entry("file_transfer", "file_id", "filekey", $filekey, $db);
$filesize = get_entry("file_transfer", "filesize", "filekey", $filekey, $db);
$originalname = get_entry("file_transfer", "filename", "filekey", $filekey, $db);
#list($name, $extension) = explode('.', $originalname);
ereg('([A-Za-z0-9]+)\\.*([A-Za-z0-9]*)$', $originalname, $tokens);
$name = $tokens[1];
$extension = $tokens[2];
#$name = ereg_replace('.([A-Za-z0-9]*)$', '', $originalname);
if ($fragNr == '') {
$fragNr = $_REQUEST['fragNr'];
}
list($thisfrag, $totalfrag) = explode('/', $fragNr);
#Define the folder where these files will be stored
$folder = $GLOBALS['s3db_info']['server']['db']['uploads_folder'] . $GLOBALS['s3db_info']['server']['db']['uploads_file'] . '/tmps3db/';
$filename = $folder . $file_id . '_' . $thisfrag . '.tmp';
$final = $folder . $file_id . '.' . $extension;
if ($fileStr == '') {
$fileStr = $_REQUEST['fileStr'];
}
#decode the fragment right after receiving them if they were encoded one at a time
if ($_REQUEST['encode'] == '2') {
$fileStr = base64_decode($fileStr);
}
$indname = $folder . 'ind' . $file_id . '.txt';
$fid = fopen($filename, 'a+');
chmod($filename, 0777);
if ($fragNr == '' || $fileStr == '') {
echo "<report>Syntax: <BR>";
echo "<filekey>...</filekey><BR>";
echo "<fragNr>[this frag]/[total nr of frags]</fragNr><BR>";
echo "<fileStr>(hexadecimal encoded fragment string)</fileStr><BR>";
echo "</report>";
} else {
if ($filesize != '' && filesize($filename) == $filesize) {
echo "<report>This file was already uploaded</report>";
} elseif ($thisfrag > $totalfrag) {
echo "<report>Too many fragments</report>";
} else {
$F = compact('thisfrag', 'fileStr', 'totalfrag', 'fid', 'filename', 'indname', 'final');
#echo '<pre>';print_r($F);
echo put_the_frag_on_file($F);
#echo $thisfrag.' out of'.$totalfrag;
#When the last fragment is in, decode the entire file
if ($thisfrag == $totalfrag) {
#find all the fragment files in the folder, write them in the final file
for ($i = 1; $i <= $totalfrag; $i++) {
$fragment_file_name = $folder . $file_id . '_' . $i . '.tmp';
if (is_file($fragment_file_name)) {
if (file_put_contents($folder . $file_id . '.tmp', file_get_contents($fragment_file_name), FILE_APPEND)) {
unlink($fragment_file_name);
}
} else {
return "Fragment " . $i . " is missing, please upload it again.";
exit;
}
}
#decode the file in the end, if the user requested it
if ($_REQUEST['encode'] != '2') {
$fullStr = file_get_contents($folder . $file_id . '.tmp');
$decodedStr = base64_decode($fullStr);
if (!file_put_contents($folder . $file_id . '.tmp', $decodedStr)) {
echo "Failed accepting the file. Please try again or encode file one fragment at a time before sending.";
exit;
}
}
copy($folder . $file_id . '.tmp', $final);
chmod($final, 0777);
if (is_file($folder . $file_id . '.tmp')) {
unlink($folder . $file_id . '.tmp');
}
return "<report>Upload Complete</report>";
} else {
fclose($fid);
}
}
}
}
}
示例6: afficher_form_commentaire
//.........这里部分代码省略.........
$rand = substr(md5(rand(100, 999)), 0, 5);
// begin with some additional stuff on comment "edit".
if (isset($actual_comment)) {
// edit
$form = "\n" . '<form id="form-commentaire-' . $actual_comment['bt_id'] . '" class="form-commentaire" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '#erreurs">' . "\n";
$form .= "\t" . '<div class="comm-edit-hidden-bloc">' . "\n";
$form .= "\t" . '<fieldset class="syst">' . "\n";
$form .= "\t\t" . hidden_input('is_it_edit', 'yes');
$form .= "\t\t" . hidden_input('comment_id', $actual_comment['bt_id']);
$form .= "\t\t" . hidden_input('status', $actual_comment['bt_statut']);
$form .= "\t\t" . hidden_input('ID', $actual_comment['ID']);
$form .= "\t\t" . hidden_input('token', $actual_comment['comm-token']);
$form .= "\t" . '</fieldset><!--end syst-->' . "\n";
} else {
$form = "\n" . '<form id="form-commentaire" class="form-commentaire" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '#erreurs" >' . "\n";
}
$form .= "\t" . '<fieldset class="field">' . "\n";
$form .= "\t\t" . hidden_input('comment_article_id', $article_id);
$form .= "\t" . '<p class="formatbut">' . "\n";
$form .= "\t\t" . '<button id="button01" class="but" type="button" title="' . $GLOBALS['lang']['bouton-gras'] . '" onclick="insertTag(\'[b]\',\'[/b]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button02" class="but" type="button" title="' . $GLOBALS['lang']['bouton-ital'] . '" onclick="insertTag(\'[i]\',\'[/i]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button03" class="but" type="button" title="' . $GLOBALS['lang']['bouton-soul'] . '" onclick="insertTag(\'[u]\',\'[/u]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button04" class="but" type="button" title="' . $GLOBALS['lang']['bouton-barr'] . '" onclick="insertTag(\'[s]\',\'[/s]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<span class="spacer"></span>' . "\n";
$form .= "\t\t" . '<button id="button09" class="but" type="button" title="' . $GLOBALS['lang']['bouton-lien'] . '" onclick="insertTag(\'[\',\'|http://]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button10" class="but" type="button" title="' . $GLOBALS['lang']['bouton-cita'] . '" onclick="insertTag(\'[quote]\',\'[/quote]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button12" class="but" type="button" title="' . $GLOBALS['lang']['bouton-code'] . '" onclick="insertTag(\'[code]\',\'[/code]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
$form .= "\t" . '</p><!--end formatbut-->' . "\n";
$form .= "\t\t" . '<textarea class="commentaire text" name="commentaire" required="" placeholder="Lorem Ipsum" id="commentaire' . $rand . '" cols="50" rows="10">' . $defaut['commentaire'] . '</textarea>' . "\n";
$form .= "\t" . '</fieldset>' . "\n";
$form .= "\t" . '<fieldset class="infos">' . "\n";
$form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_pseudo'] . '<input type="text" name="auteur" placeholder="John Doe" required="" value="' . $defaut['auteur'] . '" size="25" class="text" /></label>' . "\n";
$form .= "\t\t" . '<label>' . ($GLOBALS['require_email'] == 1 ? $GLOBALS['lang']['label_dp_email_required'] : $GLOBALS['lang']['label_dp_email']) . '<input type="email" name="email" placeholder="mail@example.com" ' . $required . ' value="' . $defaut['email'] . '" size="25" class="text" /></label>' . "\n";
$form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_webpage'] . '<input type="url" name="webpage" placeholder="http://www.example.com" value="' . $defaut['webpage'] . '" size="25" class="text" /></label>' . "\n";
$form .= "\t\t" . hidden_input('_verif_envoi', '1');
$form .= "\t\t" . hidden_input('token', new_token());
if (isset($actual_comment)) {
// edit
$checked = $actual_comment['bt_statut'] == '0' ? 'checked ' : '';
$form .= "\t" . '<label>' . $GLOBALS['lang']['label_comm_priv'] . '<input type="checkbox" name="activer_comm" ' . $checked . '/></label>' . "\n";
$form .= "\t" . '</fieldset><!--end info-->' . "\n";
$form .= "\t" . '<fieldset class="buttons">' . "\n";
$form .= "\t\t" . hidden_input('ID', $actual_comment['ID']);
$form .= "\t\t" . '<p class="centrer"><input class="submit blue-square" type="submit" name="enregistrer" value="' . $GLOBALS['lang']['envoyer'] . '" /></p>' . "\n";
} else {
$form .= "\t" . '</fieldset><!--end info-->' . "\n";
$form .= "\t" . '<fieldset class="buttons">' . "\n";
$form .= "\t\t" . '<p class="centrer"><input class="submit blue-square" type="submit" name="enregistrer" value="' . $GLOBALS['lang']['envoyer'] . '" /></p>' . "\n";
}
$form .= "\t" . '</fieldset><!--end buttons-->' . "\n";
$GLOBALS['form_commentaire'] .= $form;
$GLOBALS['form_commentaire'] .= (isset($actual_comment) ? "\t" . '</div>' . "\n" : '') . '</form>' . "\n";
// COMMENT ON PUBLIC SIDE
} else {
// Formulaire commun
$form = "\n" . '<form id="form-commentaire" class="form-commentaire" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '#erreurs" >' . "\n";
$form .= "\t" . '<fieldset class="field">' . "\n";
$form .= "\t" . '<p class="formatbut">' . "\n";
$form .= "\t\t" . '<button id="button01" type="button" title="' . $GLOBALS['lang']['bouton-gras'] . '" onclick="insertTag(\'[b]\',\'[/b]\',\'commentaire\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button02" type="button" title="' . $GLOBALS['lang']['bouton-ital'] . '" onclick="insertTag(\'[i]\',\'[/i]\',\'commentaire\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button03" type="button" title="' . $GLOBALS['lang']['bouton-soul'] . '" onclick="insertTag(\'[u]\',\'[/u]\',\'commentaire\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button04" type="button" title="' . $GLOBALS['lang']['bouton-barr'] . '" onclick="insertTag(\'[s]\',\'[/s]\',\'commentaire\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<span class="spacer"></span>' . "\n";
$form .= "\t\t" . '<button id="button09" type="button" title="' . $GLOBALS['lang']['bouton-lien'] . '" onclick="insertTag(\'[\',\'|http://]\',\'commentaire\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button10" type="button" title="' . $GLOBALS['lang']['bouton-cita'] . '" onclick="insertTag(\'[quote]\',\'[/quote]\',\'commentaire\');"><span></span></button>' . "\n";
$form .= "\t\t" . '<button id="button12" type="button" title="' . $GLOBALS['lang']['bouton-code'] . '" onclick="insertTag(\'[code]\',\'[/code]\',\'commentaire\');"><span></span></button>' . "\n";
$form .= "\t" . '</p><!--end formatbut-->' . "\n";
$form .= "\t\t" . '<textarea class="commentaire" name="commentaire" required="" placeholder="' . $GLOBALS['lang']['label_commentaire'] . '" id="commentaire" cols="50" rows="10">' . $defaut['commentaire'] . '</textarea>' . "\n";
$form .= "\t" . '</fieldset>' . "\n";
$form .= "\t" . '<fieldset class="infos">' . "\n";
$form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_pseudo'] . '<input type="text" name="auteur" placeholder="John Doe" required="" value="' . $defaut['auteur'] . '" size="25" class="text" /></label>' . "\n";
$form .= "\t\t" . '<label>' . ($GLOBALS['require_email'] == 1 ? $GLOBALS['lang']['label_dp_email_required'] : $GLOBALS['lang']['label_dp_email']) . '<input type="email" name="email" placeholder="mail@example.com" ' . $required . ' value="' . $defaut['email'] . '" size="25" /></label>' . "\n";
$form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_webpage'] . '<input type="url" name="webpage" placeholder="http://www.example.com" value="' . $defaut['webpage'] . '" size="25" /></label>' . "\n";
$form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_captcha'] . '<b>' . en_lettres($GLOBALS['captcha']['x']) . '</b> + <b>' . en_lettres($GLOBALS['captcha']['y']) . '</b> <input type="number" name="captcha" autocomplete="off" value="" class="text" /></label>' . "\n";
$form .= "\t\t" . hidden_input('_token', $GLOBALS['captcha']['hash']);
$form .= "\t\t" . hidden_input('_verif_envoi', '1');
$form .= "\t" . '</fieldset><!--end info-->' . "\n";
$form .= "\t" . '<fieldset class="cookie"><!--begin cookie asking -->' . "\n";
$form .= "\t\t" . '<input class="check" type="checkbox" id="allowcookie" name="allowcookie"' . $cookie_checked . ' />' . label('allowcookie', $GLOBALS['lang']['comment_cookie']) . '<br/>' . "\n";
$form .= "\t\t" . '<input class="check" type="checkbox" id="subscribe" name="subscribe"' . $subscribe_checked . ' />' . label('subscribe', $GLOBALS['lang']['comment_subscribe']) . "\n";
$form .= "\t" . '</fieldset><!--end cookie asking-->' . "\n";
$form .= "\t" . '<fieldset class="buttons">' . "\n";
$form .= "\t\t" . '<input class="submit" type="submit" name="enregistrer" value="' . $GLOBALS['lang']['envoyer'] . '" />' . "\n";
$form .= "\t\t" . '<input class="submit" type="submit" name="previsualiser" value="' . $GLOBALS['lang']['preview'] . '" />' . "\n";
$form .= "\t" . '</fieldset><!--end buttons-->' . "\n";
// ALLOW COMMENTS : ON
if (get_entry($GLOBALS['db_handle'], 'articles', 'bt_allow_comments', $article_id, 'return') == '1' and $GLOBALS['global_com_rule'] == '0') {
$GLOBALS['form_commentaire'] .= $form;
if ($GLOBALS['comm_defaut_status'] == '0') {
// petit message en cas de moderation a-priori
$GLOBALS['form_commentaire'] .= "\t\t" . '<div class="need-validation">' . $GLOBALS['lang']['remarque'] . ' :' . "\n";
$GLOBALS['form_commentaire'] .= "\t\t\t" . $GLOBALS['lang']['comment_need_validation'] . "\n";
$GLOBALS['form_commentaire'] .= "\t\t" . '</div>' . "\n";
}
$GLOBALS['form_commentaire'] .= '</form>' . "\n";
} else {
$GLOBALS['form_commentaire'] .= '<p>' . $GLOBALS['lang']['comment_not_allowed'] . '</p>' . "\n";
}
}
}
示例7: unset
unset($local_entries[$id]);
} else {
// Local entry is newer, send it back
$remote_index[$id] = $local_index[$id];
$remote_entries[$id] = get_entry($id);
}
} else {
$local_index[$id] = $remote_index[$id];
store_entry($id, $_POST[$id]);
unset($remote_entries[$id]);
}
}
foreach ($diff_index as $id => $data) {
//echo $data['timestamp'];
if ($local_index[$id]['timestamp'] !== 0) {
$remote_entries[$id] = get_entry($id);
$remote_index[$id] = $local_index[$id];
} else {
unset($remote_entries[$id]);
unset($remote_index[$id]);
}
}
store_entry('_index', $local_index);
$return = array('index' => $remote_index, 'entries' => $remote_entries, 'debug' => $debug);
echo json_encode($return);
// Helpers
function get_entry($id)
{
$file = DATA_DIR . '/' . $id;
if (file_exists($file)) {
if ($le = json_decode(file_get_contents($file), true)) {
示例8: S3QLaction
//.........这里部分代码省略.........
add_entry('access_keys', $I['inputs'], $db);
$output = formatReturn($GLOBALS['error_codes']['success'], 'Key created.', $s3ql['format'], array('key_id' => $s3ql['where']['key_id']));
return $output;
}
break;
case 'file':
$resource_id = $s3ql['where']['item_id'] != '' ? $s3ql['where']['item_id'] : $s3ql['where']['instance_id'];
$rule_id = $s3ql['where']['rule_id'];
$filekey = $s3ql['where']['filekey'];
$notes = $s3ql['where']['notes'];
if ($resource_id == '' || $rule_id == '' || $filekey == '') {
return formatReturn($GLOBALS['error_codes']['something_missing'], 'Please provide all the necessary inputs: rule_id, item_id, filekey', $format, '');
#return ($GLOBALS['messages']['something_missing'].'<message>Please provide all the necessary inputs: rule_id, item_id, filekey</message>');
}
#Check permission on inserting statements for specific projects
#Check permission on inserting statements for specific projects
$rule_info = $info['R' . $rule_id];
$instance_info = $info['I' . $resource_id];
#$instance_info = URIinfo('I'.$resource_id, $user_id, $key, $db);
if ($rule_info['object'] == 'UID') {
return formatReturn($GLOBALS['error_codes']['wrong_input'], 'Please use this query only for rules that do NOT enumerate classes. For inserting on other rules, use the query for insert instance', $format, '');
#return $wrong_input."<message>Please use this query only for rules that do NOT enumerate classes. For inserting on other rules, use the query for insert instance</message>";
} elseif (!is_array($instance_info)) {
return formatReturn($GLOBALS['error_codes']['no_results'], 'Item ' . $resource_id . ' was not found', $format, '');
#return ($something_does_not_exist.'<message>Instance '.$resource_id.' was not found</message>');
} elseif ($instance_info['resource_class_id'] != $rule_info['subject_id']) {
return formatReturn($GLOBALS['error_codes']['wrong_input'], 'Subject of rule does match Class of instance', $format, '');
#return $wrong_input."<message>Subject of rule does match Class of instance</message>";
} elseif ($filekey == '') {
return formatReturn($GLOBALS['error_codes']['something_missing'], 'Please indicate a filekey for this file', $format, '');
}
#return $wrong_input."<message>Please indicate a filekey for this file</message>";
#Find out if the file already exists in the tmp directory
$fileFinalName = get_entry('file_transfer', 'filename', 'filekey', $filekey, $db);
$file_id = get_entry('file_transfer', 'file_id', 'filekey', $filekey, $db);
ereg('([A-Za-z0-9]+)\\.*([A-Za-z0-9]*)$', $fileFinalName, $tokens);
$name = $tokens[1];
$extension = $tokens[2];
#list($name, $extension) = explode('.', $fileFinalName);
$maindir = $GLOBALS['s3db_info']['server']['db']['uploads_folder'] . $GLOBALS['s3db_info']['server']['db']['uploads_file'] . '/tmps3db';
$old_file = $maindir . '/' . $file_id . '.' . $extension;
if (!is_file($old_file)) {
return formatReturn($GLOBALS['error_codes']['something_does_not_exist'], 'File not found, please upload file first.', $format, '');
} else {
#project_id will be that of the rule, except if user does not have permission on it.
$project_info = URI('P' . $rule_info['project_id'], $user_id, $db);
$project_id = $s3ql['where']['project_id'] != '' ? $s3ql['where']['project_id'] : ($project_info['add_data'] ? $class_info['project_id'] : '');
if ($project_id == '') {
$project_id = $rule_info['project_id'];
#$user_projects = findUserProjects($user_id, $db);
// $user_projects = array_map('grab_project_id', $user_projects);
//
//
// #find the projects that can access the rule
// $allowed_projects = array_filter(explode('_', $rule_info['permission']));
//
// $both = array_intersect($allowed_projects, $user_projects);
//
// if (is_array($both)) {
// foreach ($both as $key=>$allowed_project_id) {
// if(substr(has_permission(array('uid'=>'R'.$rule_id, 'shared_with'=>'P'.$allowed_project_id), $db), 2,1))
// $project_id = $allowed_project_id;
// }
// }
}
if ($project_id == '') {
示例9: do_log
do_log("Nodes possible to register:" . $fs, 'v', __FILE__, __FUNCTION__, __LINE__);
$myip4 = get_ip(4);
$conti = false;
foreach ($dbconfig['ecallmgr']->default->fs_nodes as $key => $nam) {
$name = explode("@", $nam);
if (gethostbyname($name[1]) == $myip4) {
$conti = 1;
$match = $key;
}
}
if ($conti) {
do_log("Our part of {$fs} is " . $dbconfig['ecallmgr']->default->fs_nodes[$match], 'v', __FILE__, __FUNCTION__, __LINE__);
$ret = get_all_dbs($host);
foreach ($ret['res'] as $key => $value) {
if (stristr($value, 'numbers/')) {
$res = get_entry($value, '/_design/numbers/_view/regexternal_modified');
if ($res['err']) {
do_log("Get regexternal_view Error:" . $res['err']);
continue;
} else {
foreach ($res['res']->rows as $num) {
$num->value->db = $value;
$result[$num->id] = $num->value;
}
}
}
}
foreach ($result as $value) {
try {
if (@$value->regextern->pvt_changed == false) {
$value->regextern->pvt_changed = 0;
示例10: S3QLquery2
function S3QLquery2($s3ql)
{
#Function S3QLSyntax builds the S3QL query for any remote uri
#INPUT: $s3ql is an array with at least key
#OUTPUT: a string, containing the URI with the information on the input element UID
if ($s3ql['url'] == '') {
if ($_SERVER['HTTP_X_FORWARDED_HOST'] != '') {
$s3ql['url'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
} else {
$s3ql['url'] = $_SERVER['HTTP_HOST'];
}
}
#when a key is not provided, then assume the user has a remote key that corresponds to the local key
if ($s3ql['key'] == '') {
$s3ql['key'] = get_entry('access_keys', 'key_id', 'account_id', $s3ql['user_id'], $s3ql['db']);
}
$wrap .= $s3ql['url'] . '/S3QL.php?query=';
$wrap .= '<S3QL>';
$wrap .= '<key>' . $s3ql['key'] . '</key>';
#remove the elements already used to build the query, keep the rest
$s3ql = array_diff_key($s3ql, array('url' => '', 'key' => '', 'user_id' => '', 'db' => ''));
foreach ($s3ql as $field => $value) {
if (!is_array($s3ql[$field])) {
#if is not an array, just build the simple xml
$wrap .= '<' . $field . '>' . $s3ql[$field] . '</' . $field . '>';
} else {
$wrap .= '<' . $field . '>';
foreach ($value as $subfield => $subvalue) {
$wrap .= '<' . $subfield . '>' . $subvalue . '</' . $subfield . '>';
}
$wrap .= '</' . $field . '>';
}
}
$wrap .= '</S3QL>';
return $wrap;
}
示例11: backup
function backup($db_a, $dir)
{
// get_all_docs
$dbs = get_entry($db_a, '/_all_docs');
$dbs = json_decode(json_encode($dbs['res']->rows), true);
foreach ($dbs as $k => $db) {
$data = get_entry($db_a, "/" . urlencode($db['id']));
file_put_contents($dir . urlencode($db['id']), json_encode($data['res']));
}
return "backup db->file finished\n";
}
示例12: access_key_exists
function access_key_exists($input_key, $db)
{
#$found_request = find_entry('access_keys', '*', 'key_id', array('key_id'=>$input_key, 'db'=>$db));
$found_request = get_entry('access_keys', 'account_id', 'key_id', $input_key, $db);
if ($found_request != '') {
return True;
} else {
return False;
}
}
示例13: count
// min seconds for core reload (because don't to quickly reload the core)
$fs = count($dbconfig->default->fs_nodes);
do_log("Nodes possible to register:" . $fs, 'v', __FILE__, __FUNCTION__, __LINE__);
$myip4 = get_ip(4);
$conti = false;
foreach ($dbconfig->default->fs_nodes as $key => $nam) {
$name = explode("@", $nam);
if (gethostbyname($name[1]) == $myip4) {
$conti = 1;
$match = $key;
}
}
if ($conti) {
do_log("Our part of {$fs} is " . $dbconfig->default->fs_nodes[$match], 'v', __FILE__, __FUNCTION__, __LINE__);
// get all reged nodes in this cluster
$res = get_entry('servers', '/_design/servers/_view/cluster_healthy');
if ($res['err']) {
do_log("Get cluster_healthy_view Error:" . $res['err']);
continue;
} else {
foreach ($res['res']->rows as $num) {
$num->value->db = $value;
$result[$num->id] = $num->value;
}
}
foreach ($result as $value) {
do_log("Extension:" . $value->regextern->extension . " (" . $value->regextern->pvt_modified . " >= " . $value->regextern->pvt_changed . " && " . $value->active . " == true && " . $value->state . " == 'in_service')", 'd', __FILE__, __FUNCTION__, __LINE__);
if ($value->regextern->pvt_modified >= $value->regextern->pvt_changed && $value->active == true && $value->state == 'in_service') {
write_xml($value);
$reload = true;
} elseif ($value->modified >= $value->changed && $value->active == false) {
示例14: get_entry_by_code
function get_entry_by_code($code)
{
global $index_count, $entry;
$index_count = 0;
do {
$ok = get_entry();
echo ".";
if ($entry['code'] == $code) {
return true;
}
} while ($ok);
return false;
}
示例15: send_emails
function send_emails($id_comment)
{
// disposant de l'email d'un commentaire, on détermine l'article associé, le titre, l’auteur du comm et l’email de l’auteur du com.
$article = get_entry($GLOBALS['db_handle'], 'commentaires', 'bt_article_id', $id_comment, 'return');
$article_title = get_entry($GLOBALS['db_handle'], 'articles', 'bt_title', $article, 'return');
$comm_author = get_entry($GLOBALS['db_handle'], 'commentaires', 'bt_author', $id_comment, 'return');
$comm_author_email = get_entry($GLOBALS['db_handle'], 'commentaires', 'bt_email', $id_comment, 'return');
// puis la liste de tous les commentaires de cet article
$liste_commentaires = array();
try {
$query = "SELECT bt_email,bt_subscribe,bt_id FROM commentaires WHERE bt_statut=1 AND bt_article_id=? ORDER BY bt_id";
$req = $GLOBALS['db_handle']->prepare($query);
$req->execute(array($article));
$liste_commentaires = $req->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {
die('Erreur : ' . $e->getMessage());
}
// Récupérre la liste (sans doublons) des emails des commentateurs, ainsi que leurs souscription à la notification d'email.
// si plusieurs comm avec la même email, alors seul le dernier est pris en compte.
// si l’auteur même du commentaire est souscrit, il ne recoit pas l’email de son propre commentaire.
$emails = array();
foreach ($liste_commentaires as $i => $comment) {
if (!empty($comment['bt_email']) and $comm_author_email != $comment['bt_email']) {
$emails[$comment['bt_email']] = $comment['bt_subscribe'] . '-' . get_id($comment['bt_id']);
}
}
// ne conserve que la liste des mails dont la souscription est demandée (= 1)
$to_send_mail = array();
foreach ($emails as $mail => $is_subscriben) {
if ($is_subscriben[0] == '1') {
// $is_subscriben is seen as a array of chars here, first char is 0 or 1 for subscription.
$to_send_mail[$mail] = substr($is_subscriben, -14);
}
}
$subject = 'New comment on "' . $article_title . '" - ' . $GLOBALS['nom_du_site'];
$headers = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset="UTF-8"' . "\r\n";
$headers .= 'From: no.reply_' . $GLOBALS['email'] . "\r\n" . 'X-Mailer: BlogoText - PHP/' . phpversion();
// for debug
//header('Content-type: text/html; charset=UTF-8');
//die(($to. $subject. $message. $headers));
//echo '<pre>';print_r($emails);
//echo '<pre>';print_r($to_send_mail);
//die();
// envoi les emails.
foreach ($to_send_mail as $mail => $is_subscriben) {
$comment = substr($is_subscriben, -14);
$unsublink = get_blogpath($article, '') . '&unsub=1&comment=' . $comment . '&mail=' . sha1($mail);
$message = '<html>';
$message .= '<head><title>' . $subject . '</title></head>';
$message .= '<body><p>A new comment by <b>' . $comm_author . '</b> has been posted on <b>' . $article_title . '</b> form ' . $GLOBALS['nom_du_site'] . '.<br/>';
$message .= 'You can see it by following <a href="' . get_blogpath($article, '') . '#' . article_anchor($id_comment) . '">this link</a>.</p>';
$message .= '<p>To unsubscribe from the comments on that post, you can follow this link: <a href="' . $unsublink . '">' . $unsublink . '</a>.</p>';
$message .= '<p>To unsubscribe from the comments on all the posts, follow this link: <a href="' . $unsublink . '&all=1">' . $unsublink . '&all=1</a>.</p>';
$message .= '<p>Also, do not reply to this email, since it is an automatic generated email.</p><p>Regards.</p></body>';
$message .= '</html>';
mail($mail, $subject, $message, $headers);
}
return TRUE;
}