コード例 #1
0
ファイル: data_edit.php プロジェクト: nqv/eposys
 function tmp_data($d_file, $var)
 {
     require $d_file;
     $d_content = '';
     if (!isset(${$var})) {
         return '';
     }
     eval('foreach ($' . $var . ' as $k => $v) $d_content .= $k." | ".$v."\\n";');
     $this->d_content = html_clean($d_content);
 }
コード例 #2
0
ファイル: index.php プロジェクト: nqv/eposys
/*
--------------------------------------------------------------------------------
     File:  index.php

     Unit:  INDEX
   Author:  Quoc Viet [aFeLiOn]
    Begin:  2005-12-29

  Comment:  EPS wrap

--------------------------------------------------------------------------------
*/
define('EPS_ROOT', './');
require EPS_ROOT . 'include/common.php';
$eps_title = html_clean($eps_config['title']);
require EPS_ROOT . 'header.php';
if (@$_GET['mode'] == 'show') {
    require EPS_ROOT . 'show.php';
} else {
    // Extra
    ?>
<div id="eps_header"><h1><?php 
    echo $eps_title;
    ?>
</h1><span><?php 
    echo $eps_config['desc'];
    ?>
</span></div>
<?php 
    require EPS_ROOT . 'eps_left.php';
コード例 #3
0
ファイル: gallery.php プロジェクト: nqv/eposys
        if ($epsclass->validate->chk_empty($description, $eps_lang['Description'])) {
            $epsclass->load_class('class_upload', EPS_GALLERY_DIR, array('jpg', 'gif', 'png'), 1512000);
            if ($epsclass->upload->up('req_file')) {
                $epsclass->load_class('class_image');
                $epsclass->image->create_thumb(EPS_GALLERY_DIR . $epsclass->upload->uploaded_infos['name']);
                $inserts = array('filename' => $epsclass->upload->uploaded_infos['name'], 'filesize' => $epsclass->upload->uploaded_infos['size'], 'description' => $description, 'poster_id' => $eps_user['id'], 'posted' => time());
                $epsclass->db->vinsert(TBL_GALLERY, $inserts);
                // 					redirect('index.php?eps=share', $eps_lang['Redirect_share_post']);
                return;
            } else {
                $errors = $epsclass->upload->errors;
            }
        } else {
            $errors = $epsclass->validate->errors;
        }
    }
    $epsclass->load_class('class_paginate');
    $sqls = array("SELECT COUNT(*) FROM " . TBL_GALLERY, "SELECT u.username,g.* FROM " . TBL_GALLERY . " g LEFT JOIN " . TBL_USER . " u ON g.poster_id=u.id ORDER BY g.posted DESC");
    $result = $epsclass->paginate->get_result($sqls, $module_path, $p);
    $gallery_shows = array();
    while ($cur_gallery = $epsclass->db->fetch_assoc($result)) {
        $gallery_shows[] = auto_gen_link($module_path . '&amp;gid=' . $cur_gallery['id'], '<img src="' . EPS_GALLERY_DIR . pic2thumb($cur_gallery['filename']) . '" />', '<b>' . html_clean($cur_gallery['username']) . '</b> - <i>' . format_time($cur_gallery['posted']) . ' (' . floor($cur_gallery['filesize'] / 1024) . ' KB)</i><br />' . html_clean($cur_gallery['description']), true, true, true);
    }
    $smarty->assign('error_show', !empty($errors) ? gen_alert($errors) : '');
    $smarty->assign('description', isset($description) ? html_clean($description) : '');
    $smarty->assign('p', $p);
    $smarty->assign('gallery_dir', EPS_GALLERY_DIR);
    $smarty->assign('gallery_shows', $gallery_shows);
    $smarty->assign('pagination', $epsclass->paginate->gen_page_link());
}
$smarty->display('module/gallery.tpl');
コード例 #4
0
ファイル: 2009mssql.php プロジェクト: mcanv/webshell
         $where = $tmp = $b1 = '';
         //选取条件字段用
         foreach ($mn as $key => $inside) {
             if ($inside) {
                 //查找主键、唯一属性、自动增加的字段,找到就停止,否则组合所有字段作为条件。
                 if ($rowdb[$key]['Key'] == 1 || $rowdb[$key]['Auto'] == 1) {
                     $where = $key . "='" . addslashes($inside) . "'";
                     break;
                 }
                 $where .= $tmp . $key . "='" . addslashes($inside) . "'";
                 $tmp = ' AND ';
             }
         }
         //读取记录用
         foreach ($mn as $key => $inside) {
             $b1 .= '<td nowrap>' . html_clean($inside) . '&nbsp;</td>';
         }
         $where = base64_encode($where);
         if ($allowedit) {
             p('<td nowrap><a href="javascript:editrecord(\'edit\', \'' . $where . '\', \'' . $tablename . '\');">Edit</a> | <a href="javascript:editrecord(\'del\', \'' . $where . '\', \'' . $tablename . '\');">Del</a></td>');
         }
         p($b1);
         p('</tr>');
         $index++;
         unset($b1);
     }
     tbfoot();
     p($multipage);
     break;
 case 2:
     $ar = mssql_affected_rows();
コード例 #5
0
ファイル: poll.php プロジェクト: nqv/eposys
$num_poll = 0;
if (is_file(FILE_POLL_DATA)) {
    $polls = file(FILE_POLL_DATA);
    if (!empty($polls)) {
        $poll_ques = html_clean(trim($polls[0]));
        for ($cur_id = 0; $cur_id + 1 < count($polls); $cur_id++) {
            $cur_line = trim($polls[$cur_id + 1]);
            if (empty($cur_line)) {
                continue;
            }
            if (strpos($cur_line, '|') !== false) {
                $tmp = explode('|', $cur_line);
                $cur_ans = html_clean(trim($tmp[0]));
                $cur_vote = intval(trim($tmp[1]));
            } else {
                $cur_ans = html_clean($cur_line);
                $cur_vote = 0;
            }
            $poll_ans[$cur_id] = array('ans' => $cur_ans, 'vote' => $cur_vote);
            $poll_radios[$cur_id] = $cur_ans;
            $num_poll += $cur_vote;
        }
    }
}
$polled_ids = is_file(FILE_POLL_ID) ? explode("\n", file_get_contents(FILE_POLL_ID)) : array();
$polled_ips = is_file(FILE_POLL_IP) ? explode("\n", file_get_contents(FILE_POLL_IP)) : array();
if (empty($poll_ques) || empty($poll_ans)) {
    return;
}
$show_result = $show || !$eps_user['is_guest'] && in_array($eps_user['id'], $polled_ids) || in_array($eps_user['ip_address'], $polled_ips) ? true : false;
if ($show_result || IS_ADMIN) {
コード例 #6
0
<ul class="links adb_list">
    <?php 
foreach ($items as $item) {
    ?>
        <li>
            <a href="<?php 
    echo href_to($item['target_url']) . "#comment_{$item['id']}";
    ?>
"><?php 
    echo html_strip($item['target_title'], 50);
    ?>
</a>
            <div><?php 
    echo html_clean($item['content_html'], 100);
    ?>
</div>
            <div class="date"><?php 
    echo string_date_age_max($item['date_pub'], true);
    ?>
</div>
        </li>
    <?php 
}
?>
</ul>
<?php 
if ($show_count < $total) {
    ?>
<a class="view_all_link" href="<?php 
    echo href_to('admin', 'controllers', array('edit', 'comments', 'comments_list'));
    ?>
コード例 #7
0
ファイル: post.php プロジェクト: nqv/eposys
            $errors = $epsclass->validate->errors;
            $epsclass->validate->data_reset();
        }
    }
}
// For Select Box
$news['type'] = isset($type) ? $type : $news['type'];
$news['no_smiley'] = isset($no_smiley) ? $no_smiley : $news['no_smiley'];
if ($action == 'edit') {
    $page_title = $eps_lang['Page_post_edit'];
} else {
    if ($action == 'delete') {
        $page_title = $eps_lang['Page_post_delete'];
    } else {
        $page_title = $eps_lang['Page_post'];
    }
}
$req_fields = array('title' => $eps_lang['Title'], 'content' => $eps_lang['Content']);
$smarty->assign('js_lang', gen_jslang($req_fields));
$smarty->assign('emoticons', $epsclass->bbcode->emoticons);
$smarty->assign('action', $action);
$smarty->assign('page_title', $page_title);
$smarty->assign('error_show', !empty($errors) ? gen_alert($errors) : '');
$smarty->assign('form_tag', auto_gen_form('index.php?eps=post&amp;action=' . $action . (($action == 'edit' || $action == 'delete') && $nid >= 1 ? '&amp;nid=' . $nid : ''), 'postnews', true));
$smarty->assign('title', html_clean(isset($title) ? $title : $news['title']));
$smarty->assign('content', html_clean(isset($content) ? $content : $news['content']));
$smarty->assign('imgurl', html_clean(isset($imgurl) ? $imgurl : $news['imgurl']));
$smarty->assign('type', isset($type) ? $type : $news['type']);
$smarty->assign('no_smiley', isset($no_smiley) ? $no_smiley : $news['no_smiley']);
unset($nid, $action, $news, $errors, $title, $content, $imgurl, $type, $no_smiley, $page_title, $req_fields);
$smarty->display('module/post.tpl');
コード例 #8
0
ファイル: imdb.php プロジェクト: Boris-de/videodb
/**
 * Fetches the data for a given IMDB-ID
 *
 * @author  Tiago Fonseca <*****@*****.**>
 * @author  Victor La <*****@*****.**>
 * @author  Roland Obermayer <*****@*****.**>
 * @param   int   IMDB-ID
 * @return  array Result data
 */
function imdbData($imdbID)
{
    global $imdbServer;
    global $imdbIdPrefix;
    global $CLIENTERROR;
    global $cache;
    $imdbID = preg_replace('/^' . $imdbIdPrefix . '/', '', $imdbID);
    $data = array();
    // result
    $ary = array();
    // temp
    // fetch mainpage
    $resp = httpClient($imdbServer . '/title/tt' . $imdbID . '/', $cache);
    // added trailing / to avoid redirect
    if (!$resp['success']) {
        $CLIENTERROR .= $resp['error'] . "\n";
    }
    // add encoding
    $data['encoding'] = get_response_encoding($resp);
    // Check if it is a TV series episode
    if (preg_match('/<div id="titleTVEpisodes"/i', $resp['data'])) {
        #if (preg_match('/<div id="titleTVSeries"/i', $resp['data'])) {
        $data['istv'] = 1;
        # find id of Series
        preg_match('/<a href="\\/title\\/tt(\\d+)\\/episodes.*?" title="Full Episode List.*"/i', $resp['data'], $ary);
        $data['tvseries_id'] = trim($ary[1]);
    }
    // Titles and Year
    if ($data['istv']) {
        preg_match('/<meta name="title" content="&quot;(.*?)&quot;\\s+(.*?)(.TV episode .*?)?( - IMDB)?"/si', $resp['data'], $ary);
        $data['title'] = trim($ary[1]);
        $data['subtitle'] = trim($ary[2]);
        #dlog($ary);
        if (preg_match('/<h1 class="header".*?>.*?<span class="nobr">\\(.*?(\\d\\d\\d\\d)\\)</si', $resp['data'], $ary)) {
            $data['year'] = $ary[1];
        }
    } else {
        preg_match('/<meta name="title" content="(IMDb - )?(.*?) \\(.*?(\\d\\d\\d\\d).*?\\)( - IMDb)?" \\/>/si', $resp['data'], $ary);
        #dlog($ary);
        $data['year'] = trim($ary[3]);
        # split title - subtitle
        list($t, $s) = explode(' - ', trim($ary[2]), 2);
        $data['title'] = trim($t);
        $data['subtitle'] = trim($s);
    }
    # orig. title
    preg_match('/<span class="title-extra".+?>\\s*"?(.*?)"?\\s*<i>\\(original title\\)<\\/i>\\s*</si', $resp['data'], $ary);
    $data['origtitle'] = trim($ary[1]);
    // Cover URL
    $data['coverurl'] = imdbGetCoverURL($resp['data']);
    // MPAA Rating
    preg_match('/<span\\s?itemprop="contentRating">(.*?)</is', $resp['data'], $ary);
    $data['mpaa'] = trim($ary[1]);
    // UK BBFC Rating
    # no longer appears on main page
    #preg_match('/>\s*UK:(.*?)<\/a>\s+/s', $resp['data'], $ary);
    #$data['bbfc'] = trim($ary[1]);
    // Runtime
    // many but not all yet have new <time itemprop="duration"> tag
    preg_match('/itemprop="duration".*?>(\\d+)\\s+min<\\//si', $sresp['data'], $ary);
    if (!$ary) {
        preg_match('/Runtime:?<\\/h4>.*?>(\\d+)\\s+min/si', $resp['data'], $ary);
    }
    $data['runtime'] = preg_replace('/,/', '', trim($ary[1]));
    // Director
    preg_match('/Directors?:\\s*<\\/h4>(.+?)<\\/div>/si', $resp['data'], $ary);
    preg_match_all('/<a.*?href="\\/name\\/nm.+?".*?>(.+?)<\\/a>/si', $ary[1], $ary, PREG_PATTERN_ORDER);
    // TODO: Update templates to use multiple directors
    $data['director'] = trim(join(', ', $ary[1]));
    // Rating
    preg_match('/<span .*? itemprop="ratingValue">([\\d\\.]+)<\\/span>/si', $resp['data'], $ary);
    $data['rating'] = trim($ary[1]);
    // Countries
    preg_match('/Country:\\s*<\\/h4>(.+?)<\\/div>/si', $resp['data'], $ary);
    preg_match_all('/<a.*?href="\\/country\\/.+?".*?>(.+?)<\\/a>/si', $ary[1], $ary, PREG_PATTERN_ORDER);
    $data['country'] = trim(join(', ', $ary[1]));
    // Languages
    preg_match('/Languages?:\\s*<\\/h4>(.+?)<\\/div>/si', $resp['data'], $ary);
    preg_match_all('/<a.*?href="\\/language\\/.+?".*?>(.+?)<\\/a>/si', $ary[1], $ary, PREG_PATTERN_ORDER);
    $data['language'] = trim(strtolower(join(', ', $ary[1])));
    // Genres (as Array)
    preg_match('/Genres:\\s*<\\/h4>(.+?)<\\/div>/si', $resp['data'], $ary);
    preg_match_all('/<a.*?href="\\/genres?\\/.+?".*?>(.+?)<\\/a>/si', $ary[1], $ary, PREG_PATTERN_ORDER);
    foreach ($ary[1] as $genre) {
        $data['genres'][] = trim($genre);
    }
    // for Episodes - try to get some missing stuff from the main series page
    if ($data['istv'] and (!$data['runtime'] or !$data['country'] or !$data['language'] or !$data['coverurl'])) {
        $sresp = httpClient($imdbServer . '/title/tt' . $data['tvseries_id'] . '/', $cache);
        if (!$sresp['success']) {
            $CLIENTERROR .= $resp['error'] . "\n";
        }
        # runtime
        if (!$data['runtime']) {
            preg_match('/itemprop="duration".*?>(\\d+)\\s+min<\\//si', $sresp['data'], $ary);
            if (!$ary) {
                preg_match('/Runtime:?<\\/h4>.*?>(\\d+)\\s+min/si', $resp['data'], $ary);
            }
            $data['runtime'] = preg_replace('/,/', '', trim($ary[1]));
        }
        # country
        if (!$data['country']) {
            preg_match('/Country:\\s*<\\/h4>(.+?)<\\/div>/si', $sresp['data'], $ary);
            preg_match_all('/<a.*?href="\\/country\\/.+?".*?>(.+?)<\\/a>/si', $ary[1], $ary, PREG_PATTERN_ORDER);
            $data['country'] = trim(join(', ', $ary[1]));
        }
        # language
        if (!$data['language']) {
            preg_match('/Languages?:\\s*<\\/h4>(.+?)<\\/div>/si', $sresp['data'], $ary);
            preg_match_all('/<a.*?href="\\/language\\/.+?".*?>(.+?)<\\/a>/si', $ary[1], $ary, PREG_PATTERN_ORDER);
            $data['language'] = trim(strtolower(join(', ', $ary[1])));
        }
        # cover
        if (!$data['coverurl']) {
            $data['coverurl'] = imdbGetCoverURL($sresp['data']);
        }
    }
    // Plot
    preg_match('/<h2>Storyline<\\/h2>.*?<p>(.*?)</si', $resp['data'], $ary);
    $data['plot'] = $ary[1];
    // Fetch credits
    $resp = imdbFixEncoding($data, httpClient($imdbServer . '/title/tt' . $imdbID . '/fullcredits', $cache));
    if (!$resp['success']) {
        $CLIENTERROR .= $resp['error'] . "\n";
    }
    // Cast
    if (preg_match('#<table class="cast_list">(.*)#si', $resp['data'], $match)) {
        // no idea why it does not always work with (.*?)</table
        // could be some maximum length of .*?
        // anyways, I'm cutting it here
        $casthtml = substr($match[1], 0, strpos($match[1], '</table'));
        if (preg_match_all('#<td .*? itemprop="actor".*?>\\s+<a href="/name/(nm\\d+)/?.*?".*?>(.*?)</a>.*?<td class="character">(.*?)</td>#si', $casthtml, $ary, PREG_PATTERN_ORDER)) {
            for ($i = 0; $i < sizeof($ary[0]); $i++) {
                $actorid = trim(strip_tags($ary[1][$i]));
                $actor = trim(strip_tags($ary[2][$i]));
                $character = trim(preg_replace('/\\s+/', ' ', strip_tags(preg_replace('/&nbsp;/', ' ', $ary[3][$i]))));
                $cast .= "{$actor}::{$character}::{$imdbIdPrefix}{$actorid}\n";
            }
        }
        // remove html entities and replace &nbsp; with simple space
        $data['cast'] = html_clean_utf8($cast);
        // sometimes appearing in series (e.g. Scrubs)
        $data['cast'] = preg_replace('#/ ... #', '', $data['cast']);
    }
    // Fetch plot
    $resp = $resp = imdbFixEncoding($data, httpClient($imdbServer . '/title/tt' . $imdbID . '/plotsummary', $cache));
    if (!$resp['success']) {
        $CLIENTERROR .= $resp['error'] . "\n";
    }
    // Plot
    preg_match('/<P CLASS="plotSummary">(.+?)<\\/P>/is', $resp['data'], $ary);
    if ($ary[1]) {
        $data['plot'] = trim($ary[1]);
        $data['plot'] = preg_replace('/&#34;/', '"', $data['plot']);
        //Replace HTML " with "
        //Begin removal of 'Written by' section
        $data['plot'] = preg_replace('/<a href="\\/SearchPlotWriters.*?<\\/a>/', '', $data['plot']);
        $data['plot'] = preg_replace('/Written by/', '', $data['plot']);
        $data['plot'] = preg_replace('/<i>\\s+<\\/i>/', ' ', $data['plot']);
        //End of removal of 'Written by' section
        $data['plot'] = preg_replace('/\\s+/s', ' ', $data['plot']);
    }
    $data['plot'] = html_clean($data['plot']);
    #dump($data['plot']);
    return $data;
}
コード例 #9
0
ファイル: yandex_feed.tpl.php プロジェクト: pin-git/icms2
                    <?php 
        }
        ?>
                    <link><?php 
        echo href_to_abs($feed['ctype_name'], $item['slug'] . '.html');
        ?>
</link>
                    <?php 
        if (!empty($feed['mapping']['description'])) {
            ?>
                        <description><?php 
            html(html_clean($item[$feed['mapping']['description']], 150));
            ?>
</description>
                        <yandex:full-text><?php 
            html(html_clean($item[$feed['mapping']['description']]));
            ?>
</yandex:full-text>
                    <?php 
        }
        ?>
                    <?php 
        if (!empty($feed['mapping']['image'])) {
            ?>
                        <?php 
            $image = cmsModel::yamlToArray($item[$feed['mapping']['image']]);
            ?>
                        <?php 
            if (!empty($image[$feed['mapping']['image_size']])) {
                ?>
                            <?php 
コード例 #10
0
/**
 * Clean display value for sylk export
 *
 * @param $value string value
 *
 * @return clean value
**/
function sylk_clean($value)
{
    if (get_magic_quotes_runtime()) {
        $value = stripslashes($value);
    }
    $value = preg_replace('/\\x0A/', ' ', $value);
    $value = preg_replace('/\\x0D/', NULL, $value);
    $value = str_replace("\"", "''", $value);
    $value = str_replace(';', ';;', $value);
    $value = html_clean($value);
    return $value;
}
コード例 #11
0
ファイル: list.php プロジェクト: nqv/eposys
    while ($cur_user = $epsclass->db->fetch_assoc($result)) {
        $tmp = array();
        $cur_detail = '';
        if (!$eps_user['is_guest']) {
            $cur_details = array();
            foreach ($details as $key => $value) {
                $cur_details[] = '<li><strong>' . $value . ': </strong>' . $cur_user[$key];
            }
            $cur_detail = '<ul>' . implode('</li>', $cur_details) . '</li></ul>';
        }
        if ($list_type == 2) {
            $tmp[1] = $eps_user['is_guest'] ? html_clean($cur_user['name']) : gen_link('#', html_clean($cur_user['name']), $cur_detail, false, true);
            $tmp[2] = $cur_user['birth'];
            $tmp[3] = !empty($eps_lang[$cur_user['course']]) ? $eps_lang[$cur_user['course']] : html_clean($cur_user['course']);
        } else {
            $link_edit = IS_MODADMIN ? 'index.php?eps=profile&amp;uid=' . $cur_user['id'] : '#';
            $tmp[1] = $eps_user['is_guest'] ? html_clean($cur_user['username']) : auto_gen_link($link_edit, $cur_user['username'], $cur_detail, true, true, true);
            $tmp[2] = format_time($cur_user['reg_time']);
            $tmp[3] = html_clean($cur_user['g_title']);
        }
        $tmp[0] = $start++;
        $list_shows[] = $tmp;
    }
    $smarty->assign('list_type', $list_type);
    $smarty->assign('list_shows', $list_shows);
    $smarty->assign('pagination', $epsclass->paginate->gen_page_link());
    $smarty->display('module/list.tpl');
} else {
    $smarty->display('empty.tpl');
}
unset($list, $search, $uid, $where_sql, $list_type, $sqls, $page_link, $list_shows, $empty, $start, $prefix, $tpl_jump);
コード例 #12
0
ファイル: profile.php プロジェクト: nqv/eposys
        // Parse
        $user['reg_time'] = format_time($user['reg_time']);
        $user['name'] = html_clean($user['name']);
        $user['birth'] = html_clean($user['birth']);
        $user['course'] = !empty($eps_lang[$user['course']]) ? $eps_lang[$user['course']] : html_clean($user['course']);
        $user['phone'] = html_clean(isset($phone) ? $phone : $user['phone']);
        $user['yahoo'] = html_clean(isset($yahoo) ? $yahoo : $user['yahoo']);
        $smarty->assign('yesno_radios', array(1 => $eps_lang['Yes'], 0 => $eps_lang['No']));
        $smarty->assign('is_admin', IS_ADMIN);
        $smarty->assign('is_modadmin', IS_MODADMIN);
        $smarty->assign('user', $user);
        $smarty->assign('js_lang', gen_jslang($req_fields));
        $smarty->assign('error_show', !empty($errors) ? gen_alert($errors) : '');
        $smarty->assign('form_tag1', auto_gen_form('index.php?eps=profile&amp;uid=' . $uid, 'profile', true));
        $smarty->assign('username', html_clean(isset($username) ? $username : $user['username']));
        $smarty->assign('changepass_link', auto_gen_link('index.php?eps=profile&amp;action=changepass&amp;uid=' . $uid, $eps_lang['Change_password']));
        $smarty->assign('email', html_clean(isset($email) ? $email : $user['email']));
        $smarty->assign('s_id', html_clean(isset($s_id) ? $s_id : $user['s_id']));
        $smarty->assign('groups', $groups);
        $smarty->assign('use_ajax', isset($_POST['use_ajax']) || $user['ajax'] ? true : false);
        $smarty->assign('styles', get_stuff('style'));
        $smarty->assign('languages', get_stuff('language'));
        $smarty->assign('form_tag2', auto_gen_form('index.php?eps=profile&amp;uid=' . $uid, 'another', true));
        $smarty->assign('native', html_clean(isset($native) ? $native : $user['native']));
        $smarty->assign('address', html_clean(isset($address) ? $address : $user['address']));
        $smarty->assign('phone', html_clean(isset($phone) ? $phone : $user['phone']));
        $smarty->assign('yahoo', html_clean(isset($yahoo) ? $yahoo : $user['yahoo']));
        $smarty->display('module/profile.tpl');
    }
}
unset($errors, $need_old_pass, $action, $uid, $secr_key, $old_password, $new_password1, $new_password2, $req_fields, $user, $groups, $allow_group_id, $username, $email, $s_id);
コード例 #13
0
ファイル: share.php プロジェクト: nqv/eposys
                $epsclass->db->vinsert(TBL_SHARE, $inserts);
                redirect('index.php?eps=share', $eps_lang['Redirect_share_post']);
                return;
            } else {
                $errors = $epsclass->upload->errors;
            }
        } else {
            $errors = $epsclass->validate->errors;
        }
    }
    // Paginate
    $epsclass->load_class('class_paginate');
    $sqls = array("SELECT COUNT(id) FROM " . TBL_SHARE, "SELECT u.username,s.* FROM " . TBL_SHARE . " s LEFT JOIN " . TBL_USER . " u ON s.poster_id=u.id ORDER BY s.post_time DESC");
    $result = $epsclass->paginate->get_result($sqls, 'index.php?eps=share', $p);
    $shares = array();
    if ($epsclass->paginate->num_result()) {
        while ($cur_share = $epsclass->db->fetch_assoc($result)) {
            $tmp = array('link' => gen_link('download.php?down=share&amp;id=' . $cur_share['id'], html_clean($cur_share['url']), '', true), 'comment' => html_clean($cur_share['comment']), 'poster' => auto_gen_link('index.php?eps=list&amp;list=user&amp;uid=' . $cur_share['poster_id'], html_clean($cur_share['username']), '', true), 'post_time' => format_time($cur_share['post_time']));
            if ($cur_share['poster_id'] == $eps_user['id'] || IS_MODADMIN) {
                $tmp['editlink'] = gen_editlink('index.php?eps=share&amp;shid=' . $cur_share['id']);
            }
            $shares[] = $tmp;
        }
        $smarty->assign('pagination', $epsclass->paginate->gen_page_link());
    }
    $smarty->assign('error_show', !empty($errors) ? gen_alert($errors) : '');
    $smarty->assign('shares', $shares);
    $smarty->assign('comment', isset($comment) ? html_clean($comment) : '');
    $smarty->display('module/share.tpl');
}
unset($p, $shid, $action, $errors, $req_fields, $this_share, $comment, $updates, $inserts, $sqls, $shares);
コード例 #14
0
 /**
  * Print generic normal Item Cell
  *
  * @param $type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
  * @param $value value to display
  * @param $num column number
  * @param $row  row number
  * @param $extraparam extra parameters for display
  *
  *@return string to display
  **/
 static function showItem($type, $value, &$num, $row, $extraparam = '')
 {
     $out = "";
     switch ($type) {
         case PDF_OUTPUT_LANDSCAPE:
             //pdf
         //pdf
         case PDF_OUTPUT_PORTRAIT:
             global $PDF_ARRAY, $PDF_HEADER;
             $value = weblink_extract($value);
             $PDF_ARRAY[$row][$num] = decodeFromUtf8(html_clean($value), 'windows-1252');
             break;
         case SYLK_OUTPUT:
             //sylk
             global $SYLK_ARRAY, $SYLK_HEADER, $SYLK_SIZE;
             $value = weblink_extract($value);
             $SYLK_ARRAY[$row][$num] = sylk_clean($value);
             $SYLK_SIZE[$num] = max($SYLK_SIZE[$num], utf8_strlen($SYLK_ARRAY[$row][$num]));
             break;
         case CSV_OUTPUT:
             //csv
             $value = weblink_extract($value);
             $out = "\"" . csv_clean($value) . "\"" . $_SESSION["glpicsv_delimiter"];
             break;
         default:
             //TODO supprimer valign pour mettre class mais conflit avec $extraparam
             $out = "<td {$extraparam} valign='top'>";
             /*            if (!preg_match('/<hr>/',$value)) {
                            $values = preg_split("/<br>/i",$value);
                            $line_delimiter = '<br>';
                         } else {
                            $values = preg_split("/<hr>/i",$value);
                            $line_delimiter = '<hr>';
                         }
             
                         $limitto = 20;
                         if (count($values) > $limitto) {
                            for ( $i=0 ; $i<$limitto ; $i++) {
                               $out .= $values[$i].$line_delimiter;
                            }
                            $rand=mt_rand();
                            $out .= "...&nbsp;";
                            $out .= showToolTip($value,array('display'   => false,
                                                             'autoclose' => false));
             
                         } else {*/
             $out .= $value;
             //             }
             $out .= "</td>\n";
     }
     $num++;
     return $out;
 }
コード例 #15
0
ファイル: w_o_t_d.php プロジェクト: nqv/eposys
<?php

/*
--------------------------------------------------------------------------------
     File:  w_o_t_d.php

   Module:  WORD OF THE DAY
   Author:  Quoc Viet [aFeLiOn]
    Begin:  2006-03-11

  Comment:  Get From dictionary.com
--------------------------------------------------------------------------------
*/
if (!defined('IN_EPS')) {
    exit;
}
$wotd_link = 'http://dictionary.reference.com/wordoftheday/wotd.rss';
$wotd_diff = -36000;
@(include EPS_CACHE_DIR . 'cache_wotd.php');
$now_string = date_string(time() + $wotd_diff);
if (!isset($wotd) || empty($wotd['desc']) || $wotd['date'] != $now_string) {
    $epsclass->load_class('class_xml');
    $epsclass->xml->load_file($wotd_link);
    $wotd_rss = $epsclass->xml->get_rss();
    $wotd = empty($wotd_rss) ? array() : array('date' => $now_string, 'link' => $wotd_rss['item']['link'], 'title' => html_clean($wotd_rss['item']['title']), 'desc' => preg_replace('#^(.+?):#i', '<strong>$1</strong>:', html_clean($wotd_rss['item']['description'])));
    create_file('<?php' . "\n" . '$wotd = ' . var_export($wotd, true) . ';' . "\n" . '?>', 'cache_wotd.php', EPS_CACHE_DIR);
}
$smarty->assign('wotd', $wotd);
$smarty->display('module/w_o_t_d.tpl');
unset($wotd_link, $wotd_diff, $now_string, $wotd_rss, $wotd);
コード例 #16
0
ファイル: album.php プロジェクト: nqv/eposys
    }
    $smarty->assign('album_shows', $album_shows);
} else {
    if (!is_dir(EPS_ALBUM_DIR . $album)) {
        return;
    }
    // In Album-Directory
    $thumbs = get_stuff('thumb', $album);
    // No Thumbs
    if (empty($thumbs)) {
        ?>
		<div class="showalbum">
			<img src="./image/noimg.png" />
		</div>
<?php 
        return;
    } else {
        $prefix = 'index.php?eps=album&amp;album=';
        $album_values = array();
        foreach ($albums as $v) {
            $album_values[$prefix . urlencode($v)] = !empty($album_infos[$v]) ? $album_infos[$v]['name'] : $v;
        }
        $tpl_jump = array('name' => $eps_lang['Album'], 'onchange' => eps_use_ajax() ? 'vQ(this.options[this.selectedIndex].value)' : 'window.location=this.options[this.selectedIndex].value', 'value' => $album_values, 'selected' => $prefix . $album);
        $smarty->assign('tpl_jump', $tpl_jump);
        $smarty->assign('album_name', html_clean(!empty($album_infos[$album]) ? $album_infos[$album]['name'] : $album));
        $smarty->assign('album_pics', thumb2pic($thumbs));
        $smarty->assign('album_dir', EPS_ALBUM_DIR . html_clean($album) . '/');
    }
}
$smarty->assign('album', $album);
$smarty->display('module/album.tpl');
コード例 #17
0
                     p('<table border="0" cellpadding="3" cellspacing="0">');
                     p('<tr class="head">');
                     $fieldnum = @mysql_num_fields($result);
                     for ($i = 0; $i < $fieldnum; $i++) {
                         p('<td nowrap>' . @mysql_field_name($result, $i) . '</td>');
                     }
                     p('</tr>');
                     if (!$tatol) {
                         p('<tr class="alt2" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'alt2\';"><td nowrap colspan="' . $fieldnum . '" class="red b">No records</td></tr>');
                     } else {
                         while ($mn = $DB->fetch($result)) {
                             $thisbg = bg();
                             p('<tr class="' . $thisbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $thisbg . '\';">');
                             //读取记录用
                             foreach ($mn as $key => $inside) {
                                 p('<td nowrap>' . ($inside == null ? '<i>null</i>' : html_clean($inside)) . '</td>');
                             }
                             p('</tr>');
                             unset($b1);
                         }
                     }
                     p('</table>');
                     break;
                 case 2:
                     p('<h2>Affected Rows : ' . $DB->affected_rows() . '</h2>');
                     break;
             }
         }
     }
 } else {
     $query = $DB->query("SHOW TABLE STATUS");
コード例 #18
0
 static function cleanContentHtml($input)
 {
     if (!$input['content_text']) {
         $input['content_text'] = html_clean(unclean_cross_side_scripting_deep($input['content_html']));
     }
     return $input;
 }
コード例 #19
0
 /** function buildTicket - Builds,and returns, the major structure of the ticket to be entered.
  *
  * @param $i mail ID
  * @param $options array options
  *
  * @return ticket fields array
  */
 function buildTicket($i, $options = array())
 {
     $play_rules = isset($options['play_rules']) && $options['play_rules'];
     $head = $this->getHeaders($i);
     // Get Header Info Return Array Of Headers
     // **Key Are (subject,to,toOth,toNameOth,from,fromName)
     $tkt = array();
     $tkt['_blacklisted'] = false;
     // Detect if it is a mail reply
     $glpi_message_match = "/GLPI-([0-9]+)\\.[0-9]+\\.[0-9]+@\\w*/";
     // Check if email not send by GLPI : if yes -> blacklist
     if (preg_match($glpi_message_match, $head['message_id'], $match)) {
         $tkt['_blacklisted'] = true;
         return $tkt;
     }
     // max size = 0 : no import attachments
     if ($this->fields['filesize_max'] > 0) {
         if (is_writable(GLPI_DOC_DIR . "/_tmp/")) {
             $_FILES = $this->getAttached($i, GLPI_DOC_DIR . "/_tmp/", $this->fields['filesize_max']);
         } else {
             logInFile('mailgate', GLPI_DOC_DIR . "/_tmp/ is not writable");
         }
     }
     //  Who is the user ?
     $tkt['_users_id_requester'] = User::getOrImportByEmail($head['from']);
     $tkt["_users_id_requester_notif"]['use_notification'] = 1;
     if (!$tkt['_users_id_requester']) {
         $tkt["_users_id_requester_notif"]['alternative_email'] = $head['from'];
     }
     // Add to and cc as additional observer if user found
     if (count($head['ccs'])) {
         foreach ($head['ccs'] as $cc) {
             if ($cc != $head['from'] && strcasecmp($cc, $this->fields['name']) && ($tmp = User::getOrImportByEmail($cc)) > 0) {
                 $tkt['_additional_observers'][] = array('users_id' => $tmp, 'use_notification' => 1);
             }
         }
     }
     if (count($head['tos'])) {
         foreach ($head['tos'] as $to) {
             if ($to != $head['from'] && strcasecmp($to, $this->fields['name']) && ($tmp = User::getOrImportByEmail($to, false)) > 0) {
                 $tkt['_additional_observers'][] = array('users_id' => $tmp, 'use_notification' => 1);
             }
         }
     }
     // Auto_import
     $tkt['_auto_import'] = 1;
     // For followup : do not check users_id = login user
     $tkt['_do_not_check_users_id'] = 1;
     $body = $this->getBody($i);
     // Do it before using charset variable
     $head['subject'] = $this->decodeMimeString($head['subject']);
     $tkt['_head'] = $head;
     if (!empty($this->charset) && !$this->body_converted) {
         $body = encodeInUtf8($body, $this->charset);
         $this->body_converted = true;
     }
     if (!seems_utf8($body)) {
         $tkt['content'] = encodeInUtf8($body);
     } else {
         $tkt['content'] = $body;
     }
     // Add message from getAttached
     if ($this->addtobody) {
         $tkt['content'] .= $this->addtobody;
     }
     // See In-Reply-To field
     if (isset($head['in_reply_to'])) {
         if (preg_match($glpi_message_match, $head['in_reply_to'], $match)) {
             $tkt['tickets_id'] = intval($match[1]);
         }
     }
     // See in References
     if (!isset($tkt['tickets_id']) && isset($head['references'])) {
         if (preg_match($glpi_message_match, $head['references'], $match)) {
             $tkt['tickets_id'] = intval($match[1]);
         }
     }
     // See in title
     if (!isset($tkt['tickets_id']) && preg_match('/\\[GLPI #(\\d+)\\]/', $head['subject'], $match)) {
         $tkt['tickets_id'] = intval($match[1]);
     }
     // Found ticket link
     if (isset($tkt['tickets_id'])) {
         // it's a reply to a previous ticket
         $job = new Ticket();
         // Check if ticket  exists and users_id exists in GLPI
         /// TODO check if users_id have right to add a followup to the ticket
         if ($job->getFromDB($tkt['tickets_id']) && $job->fields['status'] != 'closed' && ($tkt['_users_id_requester'] > 0 || Ticket_User::isAlternateEmailForTicket($tkt['tickets_id'], $head['from']))) {
             $content = explode("\n", $tkt['content']);
             $tkt['content'] = "";
             $first_comment = true;
             $to_keep = array();
             foreach ($content as $ID => $val) {
                 if (isset($val[0]) && $val[0] == '>') {
                     // Delete line at the top of the first comment
                     if ($first_comment) {
                         $first_comment = false;
                         if (isset($to_keep[$ID - 1])) {
                             unset($to_keep[$ID - 1]);
                         }
                     }
                 } else {
                     $to_keep[$ID] = $ID;
                 }
             }
             foreach ($to_keep as $ID) {
                 $tkt['content'] .= $content[$ID] . "\n";
             }
             // Do not play rules for followups : WRONG : play rules only for refuse options
             //$play_rules = false;
         } else {
             // => to handle link in Ticket->post_addItem()
             $tkt['_linkedto'] = $tkt['tickets_id'];
             unset($tkt['tickets_id']);
         }
     }
     $tkt['name'] = $this->textCleaner($head['subject']);
     if (!isset($tkt['tickets_id'])) {
         // Which entity ?
         //$tkt['entities_id']=$this->fields['entities_id'];
         //$tkt['Subject']= $head['subject'];   // not use for the moment
         // Medium
         $tkt['urgency'] = "3";
         // No hardware associated
         $tkt['itemtype'] = "";
         // Mail request type
     } else {
         // Reopen if needed
         $tkt['add_reopen'] = 1;
     }
     $tkt['requesttypes_id'] = RequestType::getDefault('mail');
     $tkt['content'] = clean_cross_side_scripting_deep(html_clean($tkt['content']));
     if ($play_rules) {
         $rule_options['ticket'] = $tkt;
         $rule_options['headers'] = $head;
         $rule_options['mailcollector'] = $options['mailgates_id'];
         $rule_options['_users_id_requester'] = $tkt['_users_id_requester'];
         $rulecollection = new RuleMailCollectorCollection();
         $output = $rulecollection->processAllRules(array(), array(), $rule_options);
         // New ticket : compute all
         if (!isset($tkt['tickets_id'])) {
             foreach ($output as $key => $value) {
                 $tkt[$key] = $value;
             }
         } else {
             // Followup only copy refuse data
             $tobecopied = array('_refuse_email_no_response', '_refuse_email_with_response');
             foreach ($tobecopied as $val) {
                 if (isset($output[$val])) {
                     $tkt[$val] = $output[$val];
                 }
             }
         }
     }
     $tkt = addslashes_deep($tkt);
     return $tkt;
 }
コード例 #20
0
ファイル: login.php プロジェクト: nqv/eposys
                    }
                }
            } else {
                $errors[] = $eps_lang['Username_wrong'];
            }
        } else {
            $errors = $epsclass->validate->errors;
            $epsclass->validate->data_reset();
        }
    }
    $_SESSION['visual'] = eps_random(9);
    $req_fields = array('username' => $eps_lang['Username'], 'password' => $eps_lang['Password'], 'confirmcode' => $eps_lang['Visual_confirm']);
    $smarty->assign('js_lang', gen_jslang($req_fields));
    $smarty->assign('error_show', !empty($errors) ? gen_alert($errors) : '');
    $smarty->assign('form_tag', auto_gen_form('index.php?eps=login', 'login', true));
    $smarty->assign('username', isset($_POST['req_username']) ? html_clean($username) : '');
    $smarty->assign('show_title', empty($tiny_method) ? true : false);
    $smarty->assign('size', empty($tiny_method) ? '30' : '15');
    $smarty->assign('antiflood_allow', $epsclass->antiflood->try_allow);
    $smarty->assign('visual', gen_visual($_SESSION['visual'], 6));
    $smarty->assign('auto', isset($auto) ? $auto : false);
    $smarty->assign('forgotpass_link', auto_gen_link('index.php?eps=login&amp;action=fgpass', $eps_lang['Forgot_password'], '', true));
    unset($username, $password, $confirm_code, $username_tmp, $user_id, $db_password, $group_id, $active, $errors, $auto);
    $smarty->display('module/login.tpl');
} else {
    if ($action == 'fgpass') {
        if (isset($_POST['form_sent'])) {
            // Validate
            $email = strtolower(trim($_POST['req_email']));
            $confirm_code = trim($_POST['req_confirmcode']);
            $epsclass->validate->chk_email($email, 0, true);
コード例 #21
0
 /**
  *  Generate ical file content
  *
  * @param $who user ID
  * @param $who_group group ID
  *
  * @return icalendar string
  **/
 static function generateIcal($who, $who_group)
 {
     global $CFG_GLPI, $LANG;
     if ($who == 0 && $who_group == 0) {
         return false;
     }
     include_once GLPI_ROOT . "/lib/icalcreator/iCalcreator.class.php";
     $v = new vcalendar();
     if (!empty($CFG_GLPI["version"])) {
         $v->setConfig('unique_id', "GLPI-Planning-" . trim($CFG_GLPI["version"]));
     } else {
         $v->setConfig('unique_id', "GLPI-Planning-UnknownVersion");
     }
     $v->setConfig('filename', "glpi.ics");
     $v->setProperty("method", "PUBLISH");
     $v->setProperty("version", "2.0");
     $v->setProperty("x-wr-calname", "GLPI-" . $who . "-" . $who_group);
     $v->setProperty("calscale", "GREGORIAN");
     $interv = array();
     $begin = time() - MONTH_TIMESTAMP * 12;
     $end = time() + MONTH_TIMESTAMP * 12;
     $begin = date("Y-m-d H:i:s", $begin);
     $end = date("Y-m-d H:i:s", $end);
     // ---------------Tracking
     $interv = TicketPlanning::populatePlanning(array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end));
     // ---------------Reminder
     $data = Reminder::populatePlanning(array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end));
     $interv = array_merge($interv, $data);
     // ---------------Plugin
     $data = doHookFunction("planning_populate", array("begin" => $begin, "end" => $end, "who" => $who, "who_group" => $who_group));
     if (isset($data["items"]) && count($data["items"])) {
         $interv = array_merge($data["items"], $interv);
     }
     if (count($interv) > 0) {
         foreach ($interv as $key => $val) {
             $vevent = new vevent();
             //initiate EVENT
             if (isset($val["tickettasks_id"])) {
                 $vevent->setProperty("uid", "Job#" . $val["tickettasks_id"]);
             } else {
                 if (isset($val["reminders_id"])) {
                     $vevent->setProperty("uid", "Event#" . $val["reminders_id"]);
                 } else {
                     if (isset($val['planningID'])) {
                         // Specify the ID (for plugins)
                         $vevent->setProperty("uid", "Plugin#" . $val['planningID']);
                     } else {
                         $vevent->setProperty("uid", "Plugin#" . $key);
                     }
                 }
             }
             $vevent->setProperty("dstamp", $val["begin"]);
             $vevent->setProperty("dtstart", $val["begin"]);
             $vevent->setProperty("dtend", $val["end"]);
             if (isset($val["tickets_id"])) {
                 $vevent->setProperty("summary", $LANG['planning'][8] . " # " . $val["tickets_id"] . " " . $LANG['document'][14] . " # " . $val["device"]);
             } else {
                 if (isset($val["name"])) {
                     $vevent->setProperty("summary", $val["name"]);
                 }
             }
             if (isset($val["content"])) {
                 $vevent->setProperty("description", html_clean($val["content"]));
             } else {
                 if (isset($val["name"])) {
                     $vevent->setProperty("description", $val["name"]);
                 }
             }
             if (isset($val["tickets_id"])) {
                 $vevent->setProperty("url", $CFG_GLPI["url_base"] . "/index.php?redirect=tracking_" . $val["tickets_id"]);
             }
             $v->setComponent($vevent);
         }
     }
     $v->sort();
     //$v->parse();
     return $v->returnCalendar();
 }
コード例 #22
0
ファイル: list.tpl.php プロジェクト: asphix/icms2
        if ($item['is_private']) {
            ?>
                            <span class="is_private" title="<?php 
            html(LANG_PRIVACY_PRIVATE);
            ?>
"></span>
                        <?php 
        }
        ?>
                    </div>
                    <?php 
        if ($show_text) {
            ?>
                        <div class="text">
                            <?php 
            echo html_clean($item['content'], 50);
            ?>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </div>

        <?php 
    }
    ?>
    </div>

<?php 
}
コード例 #23
0
ファイル: news.php プロジェクト: nqv/eposys
            // Truncate
            if (eps_strlen($cur_news['content']) > $max_length && $nid < 1) {
                $cur_news['content'] = eps_truncate($cur_news['content'], $max_length);
                $cur_news['title'] = auto_gen_link('index.php?nid=' . $cur_news['id'], html_clean($cur_news['title']));
            } else {
                $cur_news['title'] = html_clean($cur_news['title']);
            }
            // BBCode
            $cur_news['content'] = $epsclass->bbcode->format($cur_news['content'], $cur_news['no_smiley']);
            // Author Or MODADMIN
            if (!empty($eps_user['id']) && ($cur_news['poster_id'] == $eps_user['id'] || IS_MODADMIN)) {
                // Edit, Delete Link
                $cur_news['action'] = gen_editlink('index.php?eps=post&amp;nid=' . $cur_news['id']);
                // Last edit by
                if (!empty($cur_news['edit_by'])) {
                    $cur_news['content'] .= '<p class="postedit">' . $eps_lang['Last_edit_by'] . ': ' . html_clean($cur_news['editor']) . ' &raquo; ' . format_time($cur_news['edit_time']) . '</p>';
                }
            }
            $cur_news['desc'] = auto_gen_link('index.php?eps=list&amp;list=user&amp;uid=' . $cur_news['poster_id'], html_clean($cur_news['poster']), '', true) . ' &raquo; ' . format_time($cur_news['post_time']);
            $news[] = $cur_news;
        }
        $smarty->assign('news_shows', $news);
        $smarty->assign('nid', $nid);
        $smarty->assign('pagination', $epsclass->paginate->gen_page_link());
        $smarty->display('module/news.tpl');
    } else {
        $smarty->display('empty.tpl');
    }
    $epsclass->db->free_result($result);
}
unset($sql, $news, $nid, $type, $max_length);
コード例 #24
0
 /**
  * Display a HTML report about systeme information / configuration
  *
  **/
 function showSystemInformations()
 {
     global $DB, $LANG, $CFG_GLPI;
     echo "<div class='center' id='tabsbody'>";
     echo "<form name='form' action=\"" . getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     echo "<input type='hidden' name='id' value='" . $CFG_GLPI["id"] . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . $LANG['setup'][70] . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['setup'][102] . " &nbsp;:</td><td>";
     $values[1] = $LANG['setup'][103];
     $values[2] = $LANG['setup'][104];
     $values[3] = $LANG['setup'][105];
     $values[4] = $LANG['setup'][106];
     $values[5] = $LANG['setup'][107];
     Dropdown::showFromArray('event_loglevel', $values, array('value' => $CFG_GLPI["event_loglevel"]));
     echo "</td><td>" . $LANG['setup'][101] . "&nbsp;:</td><td>";
     Dropdown::showInteger('cron_limit', $CFG_GLPI["cron_limit"], 1, 30);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . $LANG['setup'][185] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("use_log_in_files", $CFG_GLPI["use_log_in_files"]);
     echo "</td><td> " . $LANG['setup'][801] . "&nbsp;:</td><td>";
     $active = DBConnection::isDBSlaveActive();
     Dropdown::showYesNo("_dbslave_status", $active);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' class='center b'>" . $LANG['setup'][306] . ' - ' . $LANG['setup'][400] . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['common'][52] . "&nbsp;:</td>";
     echo "<td><input type='text' name='proxy_name' value='" . $CFG_GLPI["proxy_name"] . "'></td>";
     echo "<td>" . $LANG['setup'][175] . "&nbsp;:</td>";
     echo "<td><input type='text' name='proxy_port' value='" . $CFG_GLPI["proxy_port"] . "'></td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['login'][6] . "&nbsp;:</td>";
     echo "<td><input type='text' name='proxy_user' value='" . $CFG_GLPI["proxy_user"] . "'></td>";
     echo "<td>" . $LANG['login'][7] . "&nbsp;:</td>";
     echo "<td><input type='password' name='proxy_passwd' value='' autocomplete='off'></td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . $LANG['buttons'][2] . "\"></td>";
     echo "</tr>";
     echo "</table>";
     echo "</form>";
     $width = 128;
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th>" . $LANG['setup'][721] . "</th></tr>";
     echo "<tr class='tab_bg_1'><td><pre>[code]\n&nbsp;\n";
     $oldlang = $_SESSION['glpilanguage'];
     loadLanguage('en_GB');
     echo "GLPI " . $CFG_GLPI['version'] . " (" . $CFG_GLPI['root_doc'] . " => " . dirname(dirname($_SERVER["SCRIPT_FILENAME"])) . ")\n";
     echo "\n</pre></td></tr>";
     echo "<tr><th>" . $LANG['common'][52] . "</th></tr>\n";
     echo "<tr class='tab_bg_1'><td><pre>\n&nbsp;\n";
     echo wordwrap($LANG['setup'][5] . "&nbsp;: " . php_uname() . "\n", $width, "\n\t");
     $exts = get_loaded_extensions();
     sort($exts);
     echo wordwrap("PHP " . phpversion() . " (" . implode(', ', $exts) . ")\n", $width, "\n\t");
     $msg = $LANG['common'][12] . ": ";
     foreach (array('memory_limit', 'max_execution_time', 'safe_mode', 'session.save_handler', 'post_max_size', 'upload_max_filesize') as $key) {
         $msg .= $key . '="' . ini_get($key) . '" ';
     }
     echo wordwrap($msg . "\n", $width, "\n\t");
     $msg = $LANG['Menu'][4] . ": ";
     if (isset($_SERVER["SERVER_SOFTWARE"])) {
         $msg .= $_SERVER["SERVER_SOFTWARE"];
     }
     if (isset($_SERVER["SERVER_SIGNATURE"])) {
         $msg .= ' (' . html_clean($_SERVER["SERVER_SIGNATURE"]) . ')';
     }
     echo wordwrap($msg . "\n", $width, "\n\t");
     if (isset($_SERVER["HTTP_USER_AGENT"])) {
         echo "\t" . $_SERVER["HTTP_USER_AGENT"] . "\n";
     }
     $version = "???";
     foreach ($DB->request('SELECT VERSION() as ver') as $data) {
         $version = $data['ver'];
     }
     echo "MySQL: {$version} (" . $DB->dbuser . "@" . $DB->dbhost . "/" . $DB->dbdefault . ")\n\n";
     checkWriteAccessToDirs(true);
     foreach ($CFG_GLPI["systeminformations_types"] as $type) {
         $tmp = new $type();
         $tmp->showSystemInformations($width);
     }
     loadLanguage($oldlang);
     echo "\n</pre></td></tr>";
     echo "<tr class='tab_bg_1'><td>[/code]\n</td></tr>";
     echo "<tr class='tab_bg_2'><th>" . $LANG['setup'][722] . "</th></tr>\n";
     echo "</table></div>\n";
 }
コード例 #25
0
ファイル: godshell.php プロジェクト: huntergregal/tools
         $name = @mysql_field_name($result, $i);
         $type = @mysql_field_type($result, $i);
         $len = @mysql_field_len($result, $i);
         p("<td class=\"nw\">{$name}<br /><span>{$type}({$len})</span></td>");
     }
     p('</tr>');
     while ($mn = @mysql_fetch_assoc($result)) {
         $tbg = bg();
         p('<tr class="' . $tbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $tbg . '\';">');
         $where = $tmp = $b1 = '';
         foreach ($mn as $key => $inside) {
             if ($inside) {
                 $where .= $tmp . $key . "='" . addslashes($inside) . "'";
                 $tmp = ' AND ';
             }
             $b1 .= '<td class="nw">' . html_clean($inside) . '&nbsp;</td>';
         }
         $where = base64_encode($where);
         if ($allowedit) {
             p('<td class="nw"><a href="javascript:editrecord(\'edit\', \'' . $where . '\', \'' . $tablename . '\');">Edit</a> | <a href="javascript:editrecord(\'del\', \'' . $where . '\', \'' . $tablename . '\');">Del</a></td>');
         }
         p($b1);
         p('</tr>');
         unset($b1);
     }
     tbfoot();
     p($multipage);
     break;
 case 2:
     $ar = mysql_affected_rows();
     p('<h2>affected rows : <b>' . $ar . '</b></h2>');
コード例 #26
0
 /**
  * Check field unicity before insert or update
  *
  * @param add true for insert, false for update
  * @param $options array
  *
  * @return true if item can be written in DB, false if not
  **/
 function checkUnicity($add = false, $options = array())
 {
     global $LANG, $DB, $CFG_GLPI;
     $p['unicity_error_message'] = true;
     $p['add_event_on_duplicate'] = true;
     $p['disable_unicity_check'] = false;
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $value) {
             $p[$key] = $value;
         }
     }
     $result = true;
     //Do not check unicity when creating infocoms or if checking is expliclty disabled
     if ($p['disable_unicity_check']) {
         return $result;
     }
     //Get all checks for this itemtype and this entity
     if (in_array(get_class($this), $CFG_GLPI["unicity_types"])) {
         // Get input entities if set / else get object one
         if (isset($this->input['entities_id'])) {
             $entities_id = $this->input['entities_id'];
         } else {
             $entities_id = $this->fields['entities_id'];
         }
         $all_fields = FieldUnicity::getUnicityFieldsConfig(get_class($this), $entities_id);
         foreach ($all_fields as $key => $fields) {
             //If there's fields to check
             if (!empty($fields) && !empty($fields['fields'])) {
                 $where = "";
                 $continue = true;
                 foreach (explode(',', $fields['fields']) as $field) {
                     if (isset($this->input[$field]) && (getTableNameForForeignKeyField($field) == '' && $this->input[$field] != '' || getTableNameForForeignKeyField($field) != '' && $this->input[$field] > 0) && !Fieldblacklist::isFieldBlacklisted(get_class($this), $entities_id, $field, $this->input[$field])) {
                         $where .= " AND `" . $this->getTable() . "`.`{$field}` = '" . $this->input[$field] . "'";
                     } else {
                         $continue = false;
                     }
                 }
                 if ($continue && $where != '') {
                     $entities = $fields['entities_id'];
                     if ($fields['is_recursive']) {
                         $entities = getSonsOf('glpi_entities', $fields['entities_id']);
                     }
                     $where_global = getEntitiesRestrictRequest(" AND", $this->getTable(), '', $entities);
                     //If update, exclude ID of the current object
                     if (!$add) {
                         $where .= " AND `" . $this->getTable() . "`.`id` NOT IN (" . $this->input['id'] . ") ";
                     }
                     if (countElementsInTable($this->table, "1 {$where} {$where_global}") > 0) {
                         if ($p['unicity_error_message'] || $p['add_event_on_duplicate']) {
                             $message = array();
                             foreach (explode(',', $fields['fields']) as $field) {
                                 $table = getTableNameForForeignKeyField($field);
                                 if ($table != '') {
                                     $searchOption = $this->getSearchOptionByField('field', 'name', $table);
                                 } else {
                                     $searchOption = $this->getSearchOptionByField('field', $field);
                                 }
                                 $message[] = $searchOption['name'] . '=' . $this->input[$field];
                             }
                             $doubles = getAllDatasFromTable($this->table, "1 {$where} {$where_global}");
                             $message_text = $this->getUncityErrorMessage($message, $fields, $doubles);
                             if ($p['unicity_error_message']) {
                                 if (!$fields['action_refuse']) {
                                     $show_other_messages = $fields['action_refuse'] ? true : false;
                                 } else {
                                     $show_other_messages = true;
                                 }
                                 addMessageAfterRedirect($message_text, true, $show_other_messages, $show_other_messages);
                             }
                             if ($p['add_event_on_duplicate']) {
                                 Event::log(!$add ? $this->fields['id'] : 0, get_class($this), 4, 'inventory', $_SESSION["glpiname"] . " " . $LANG['log'][123] . ' : ' . $message_text);
                             }
                         }
                         if ($fields['action_refuse']) {
                             $result = false;
                         }
                         if ($fields['action_notify']) {
                             $params = array('message' => html_clean($message_text), 'action_type' => $add, 'action_user' => getUserName(getLoginUserID()), 'entities_id' => $entities_id, 'itemtype' => get_class($this), 'date' => $_SESSION['glpi_currenttime'], 'refuse' => $fields['action_refuse']);
                             NotificationEvent::raiseEvent('refuse', new FieldUnicity(), $params);
                         }
                     }
                 }
             }
         }
     }
     return $result;
 }
コード例 #27
0
    $type = "comp_champ";
    $val = Stat::getItems($itemtype, $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST["dropdown"]);
    $params = array('type' => $type, 'dropdown' => $_REQUEST["dropdown"], 'date1' => $_REQUEST["date1"], 'date2' => $_REQUEST["date2"], 'start' => $_REQUEST["start"]);
} else {
    //   echo "Device";
    $type = "device";
    $field = $_REQUEST["dropdown"];
    $val = Stat::getItems($itemtype, $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST["dropdown"]);
    $params = array('type' => $type, 'dropdown' => $_REQUEST["dropdown"], 'date1' => $_REQUEST["date1"], 'date2' => $_REQUEST["date2"], 'start' => $_REQUEST["start"]);
}
/*printPager($_REQUEST['start'],count($val),$CFG_GLPI['root_doc'].'/front/stat.location.php',
  "date1=".$_REQUEST["date1"]."&amp;date2=".$_REQUEST["date2"]."&amp;dropdown=".$_REQUEST["dropdown"],
  'Stat',$params);*/
if (!$_REQUEST['showgraph']) {
    PluginMobileStat::show($type, $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST['start'], $val, $_REQUEST["dropdown"]);
} else {
    $data = Stat::getDatas($type, $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST['start'], $val, $_REQUEST["dropdown"]);
    if (isset($data['opened']) && is_array($data['opened'])) {
        foreach ($data['opened'] as $key => $val) {
            $cleandata[html_clean($key)] = $val;
        }
        PluginMobileStat::showGraph(array($LANG['stats'][5] => $cleandata), array('title' => $LANG['stats'][5], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
    if (isset($data['solved']) && is_array($data['solved'])) {
        foreach ($data['solved'] as $key => $val) {
            $cleandata[html_clean($key)] = $val;
        }
        PluginMobileStat::showGraph(array($LANG['stats'][11] => $cleandata), array('title' => $LANG['stats'][11], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
}
$common->displayFooter();
コード例 #28
0
    $pagenum = 15;
    if ($page) {
        $start_limit = ($page - 1) * $pagenum;
    } else {
        $start_limit = 0;
        $page = 1;
    }
    $total = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments c {$sql_query}"), 0);
    if ($total) {
        $multipage = multi($total, $pagenum, $page, 'cp.php?job=comment&amp;action=list' . $pagelink);
        $query = $DB->query("SELECT c.*,a.title\r\n\t\t\tFROM {$db_prefix}comments c\r\n\t\t\tLEFT JOIN {$db_prefix}articles a ON a.articleid = c.articleid\r\n\t\t\t{$sql_query}\r\n\t\t\tORDER BY c.commentid DESC LIMIT {$start_limit}, {$pagenum}");
        $commentdb = array();
        while ($comment = $DB->fetch_array($query)) {
            $comment['content'] = preg_replace("/\\[quote=(.*?)\\]\\s*(.+?)\\s*\\[\\/quote\\]/is", "", $comment['content']);
            if (empty($comment['content'])) {
                $comment['content'] = '......';
            }
            $comment['content'] = str_replace(array("\r\n\r\n", "\n\n", "\r\r"), array("\r\n", "\n", "\r"), $comment['content']);
            $comment['avatardb'] = get_avatar($comment['email'], 32);
            $comment['dateline'] = sadate('Y-m-d H:i', $comment['dateline'], 1);
            $comment['content'] = html_clean($comment['content']);
            $commentdb[$comment['commentid']] = $comment;
        }
        unset($comment);
        $DB->free_result($query);
    }
}
//end list
$navlink_L = $subnav ? ' &raquo; <span>' . $subnav . '</span>' : '';
cpheader($subnav);
include template('comment');
コード例 #29
0
    }
    if (isset($data['solved']) && is_array($data['solved'])) {
        foreach ($data['solved'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][11] => $cleandata), array('title' => $LANG['stats'][11], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
    if (isset($data['late']) && is_array($data['late'])) {
        foreach ($data['late'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][19] => $cleandata), array('title' => $LANG['stats'][19], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
    if (isset($data['closed']) && is_array($data['closed'])) {
        foreach ($data['closed'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][11] => $cleandata), array('title' => $LANG['stats'][17], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
    if (isset($data['opensatisfaction']) && is_array($data['opensatisfaction'])) {
        foreach ($data['opensatisfaction'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][11] => $cleandata), array('title' => $LANG['satisfaction'][3], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
}
commonFooter();
コード例 #30
0
 /**
  * Get all data needed for template processing
  **/
 function getDatasForTemplate($event, $options = array())
 {
     global $LANG, $CFG_GLPI;
     //----------- Ticket infos -------------- //
     if ($event != 'alertnotclosed') {
         $fields = array('ticket.title' => 'name', 'ticket.content' => 'content', 'ticket.description' => 'content', 'ticket.costfixed' => 'cost_fixed', 'ticket.costmaterial' => 'cost_material');
         foreach ($fields as $tag => $table_field) {
             $this->datas['##' . $tag . '##'] = $this->obj->getField($table_field);
         }
         $this->datas['##ticket.id##'] = sprintf("%07d", $this->obj->getField("id"));
         $this->datas['##ticket.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id"));
         $this->datas['##ticket.urlapprove##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id") . "_4");
         $this->datas['##ticket.urlvalidation##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id") . "_7");
         $this->datas['##ticket.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->getEntity());
         $events = $this->getAllEvents();
         if ($event == 'validation' && isset($options['validation_status'])) {
             $this->datas['##ticket.action##'] = $LANG['validation'][0] . ' - ' . TicketValidation::getStatus($options['validation_status']);
         } else {
             $this->datas['##ticket.action##'] = $events[$event];
         }
         $this->datas['##ticket.storestatus##'] = $this->obj->getField('status');
         $this->datas['##ticket.status##'] = Ticket::getStatus($this->obj->getField('status'));
         $this->datas['##ticket.globalvalidation##'] = TicketValidation::getStatus($this->obj->getField('global_validation'));
         $this->datas['##ticket.type##'] = Ticket::getTicketTypeName($this->obj->getField('type'));
         $this->datas['##ticket.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $this->obj->getField('requesttypes_id'));
         $this->datas['##ticket.urgency##'] = Ticket::getUrgencyName($this->obj->getField('urgency'));
         $this->datas['##ticket.impact##'] = Ticket::getImpactName($this->obj->getField('impact'));
         $this->datas['##ticket.priority##'] = Ticket::getPriorityName($this->obj->getField('priority'));
         $this->datas['##ticket.time##'] = Ticket::getActionTime($this->obj->getField('actiontime'));
         $this->datas['##ticket.costtime##'] = $this->obj->getField('cost_time');
         $this->datas['##ticket.creationdate##'] = convDateTime($this->obj->getField('date'));
         $this->datas['##ticket.closedate##'] = convDateTime($this->obj->getField('closedate'));
         $this->datas['##ticket.solvedate##'] = convDateTime($this->obj->getField('solvedate'));
         $this->datas['##ticket.duedate##'] = convDateTime($this->obj->getField('due_date'));
         $entitydata = new EntityData();
         $autoclose_value = $CFG_GLPI['autoclose_delay'];
         if ($entitydata->getFromDB($this->getEntity())) {
             $autoclose_value = $entitydata->getField('autoclose_delay');
             // Set global config value
             if ($autoclose_value == -1) {
                 $autoclose_value = $CFG_GLPI['autoclose_delay'];
             }
         }
         if ($autoclose_value > 0) {
             $this->datas['##ticket.autoclose##'] = $autoclose_value;
             $this->datas['##lang.ticket.autoclosewarning##'] = $LANG['job'][54] . " " . $autoclose_value . " " . $LANG['stats'][31];
         } else {
             $this->datas['##ticket.autoclose##'] = $LANG['setup'][307];
             $this->datas['##lang.ticket.autoclosewarning##'] = "";
         }
         if ($this->obj->getField('ticketcategories_id')) {
             $this->datas['##ticket.category##'] = Dropdown::getDropdownName('glpi_ticketcategories', $this->obj->getField('ticketcategories_id'));
         } else {
             $this->datas['##ticket.category##'] = '';
         }
         if ($this->obj->getField('slas_id')) {
             $this->datas['##ticket.sla##'] = Dropdown::getDropdownName('glpi_slas', $this->obj->getField('slas_id'));
         } else {
             $this->datas['##ticket.sla##'] = '';
         }
         if ($this->obj->countUsers(Ticket::REQUESTER)) {
             $users = array();
             foreach ($this->obj->getUsers(Ticket::REQUESTER) as $uid => $tmp) {
                 $user_tmp = new User();
                 $user_tmp->getFromDB($uid);
                 $users[$uid] = $user_tmp->getName();
                 $tmp = array();
                 $tmp['##author.id##'] = $uid;
                 $tmp['##author.name##'] = $user_tmp->getName();
                 if ($user_tmp->getField('locations_id')) {
                     $tmp['##author.location##'] = Dropdown::getDropdownName('glpi_locations', $user_tmp->getField('locations_id'));
                 } else {
                     $tmp['##author.location##'] = '';
                 }
                 $tmp['##author.phone##'] = $user_tmp->getField('phone');
                 $tmp['##author.phone2##'] = $user_tmp->getField('phone2');
                 $this->datas['authors'][] = $tmp;
             }
             $this->datas['##ticket.authors##'] = implode(', ', $users);
         } else {
             $this->datas['##ticket.authors##'] = '';
         }
         if ($this->obj->getField('users_id_recipient')) {
             $user_tmp = new User();
             $user_tmp->getFromDB($this->obj->getField('users_id_recipient'));
             $this->datas['##ticket.openbyuser##'] = $user_tmp->getName();
         } else {
             $this->datas['##ticket.openbyuser##'] = '';
         }
         if ($this->obj->countUsers(Ticket::ASSIGN)) {
             $users = array();
             foreach ($this->obj->getUsers(Ticket::ASSIGN) as $uid => $tmp) {
                 $user_tmp = new User();
                 $user_tmp->getFromDB($uid);
                 $users[$uid] = $user_tmp->getName();
             }
             $this->datas['##ticket.assigntousers##'] = implode(', ', $users);
         } else {
             $this->datas['##ticket.assigntousers##'] = '';
         }
         if ($this->obj->countUsers(Ticket::OBSERVER)) {
             $users = array();
             foreach ($this->obj->getUsers(Ticket::OBSERVER) as $uid => $tmp) {
                 $user_tmp = new User();
                 $user_tmp->getFromDB($uid);
                 $users[$uid] = $user_tmp->getName();
             }
             $this->datas['##ticket.observerusers##'] = implode(', ', $users);
         } else {
             $this->datas['##ticket.observerusers##'] = '';
         }
         if ($this->obj->getField('suppliers_id_assign')) {
             $this->datas['##ticket.assigntosupplier##'] = Dropdown::getDropdownName('glpi_suppliers', $this->obj->getField('suppliers_id_assign'));
         } else {
             $this->datas['##ticket.assigntosupplier##'] = '';
         }
         if ($this->obj->countGroups(Ticket::REQUESTER)) {
             $groups = array();
             foreach ($this->obj->getUsers(Ticket::REQUESTER) as $gid => $tmp) {
                 $groups[$gid] = Dropdown::getDropdownName('glpi_groups', $gid);
             }
             $this->datas['##ticket.groups##'] = implode(', ', $groups);
         } else {
             $this->datas['##ticket.groups##'] = '';
         }
         if ($this->obj->countGroups(Ticket::OBSERVER)) {
             $groups = array();
             foreach ($this->obj->getGroups(Ticket::OBSERVER) as $gid => $tmp) {
                 $groups[$gid] = Dropdown::getDropdownName('glpi_groups', $gid);
             }
             $this->datas['##ticket.observergroups##'] = implode(', ', $groups);
         } else {
             $this->datas['##ticket.observergroups##'] = '';
         }
         if ($this->obj->countGroups(Ticket::ASSIGN)) {
             $groups = array();
             foreach ($this->obj->getGroups(Ticket::ASSIGN) as $gid => $tmp) {
                 $groups[$gid] = Dropdown::getDropdownName('glpi_groups', $gid);
             }
             $this->datas['##ticket.assigntogroups##'] = implode(', ', $groups);
         } else {
             $this->datas['##ticket.assigntogroups##'] = '';
         }
         //Tags associated with the object linked to the ticket
         if ($this->target_object != null) {
             //Object type
             $this->datas['##ticket.itemtype##'] = $this->target_object->getTypeName();
             //Object name
             $this->datas['##ticket.item.name##'] = $this->target_object->getField('name');
             //Object serial
             if ($this->target_object->isField('serial')) {
                 $this->datas['##ticket.item.serial##'] = $this->target_object->getField('serial');
             } else {
                 $this->datas['##ticket.item.serial##'] = '';
             }
             //Object contact
             if ($this->target_object->isField('contact')) {
                 $this->datas['##ticket.item.contact##'] = $this->target_object->getField('contact');
             } else {
                 $this->datas['##ticket.item.contact##'] = '';
             }
             //Object contact num
             if ($this->target_object->isField('contact_num')) {
                 $this->datas['##ticket.item.contactnumber##'] = $this->target_object->getField('contact_num');
             } else {
                 $this->datas['##ticket.item.contactnumber##'] = '';
             }
             //Object otherserial
             if ($this->target_object->isField('otherserial')) {
                 $this->datas['##ticket.item.otherserial##'] = $this->target_object->getField('otherserial');
             } else {
                 $this->datas['##ticket.item.otherserial##'] = '';
             }
             //Object location
             if ($this->target_object->isField('locations_id')) {
                 $this->datas['##ticket.item.location##'] = Dropdown::getDropdownName('glpi_locations', $this->target_object->getField('locations_id'));
             } else {
                 $this->datas['##ticket.item.location##'] = '';
             }
             //Object user
             $this->datas['##ticket.item.user##'] = '';
             if ($this->obj->getField('users_id')) {
                 $user_tmp = new User();
                 if ($user_tmp->getFromDB($this->target_object->getField('users_id'))) {
                     $this->datas['##ticket.item.user##'] = $user_tmp->getName();
                 }
             }
             //Object group
             if ($this->obj->getField('groups_id')) {
                 $this->datas['##ticket.item.group##'] = Dropdown::getDropdownName('glpi_groups', $this->target_object->getField('groups_id'));
             } else {
                 $this->datas['##ticket.item.group##'] = '';
             }
             $modeltable = getSingular($this->getTable()) . "models";
             $modelfield = getForeignKeyFieldForTable($modeltable);
             if ($this->target_object->isField($modelfield)) {
                 $this->datas['##ticket.item.model##'] = $this->target_object->getField($modelfield);
             } else {
                 $this->datas['##ticket.item.model##'] = '';
             }
         } else {
             $this->datas['##ticket.itemtype##'] = '';
             $this->datas['##ticket.item.name##'] = '';
             $this->datas['##ticket.item.serial##'] = '';
             $this->datas['##ticket.item.otherserial##'] = '';
             $this->datas['##ticket.item.location##'] = '';
         }
         if ($this->obj->getField('ticketsolutiontypes_id')) {
             $this->datas['##ticket.solution.type##'] = Dropdown::getDropdownName('glpi_ticketsolutiontypes', $this->obj->getField('ticketsolutiontypes_id'));
         } else {
             $this->datas['##ticket.solution.type##'] = '';
         }
         $this->datas['##ticket.solution.description##'] = unclean_cross_side_scripting_deep($this->obj->getField('solution'));
         // Linked tickets
         $linked_tickets = Ticket_Ticket::getLinkedTicketsTo($this->obj->getField('id'));
         if (count($linked_tickets)) {
             $linkedticket = new Ticket();
             foreach ($linked_tickets as $data) {
                 if ($linkedticket->getFromDB($data['tickets_id'])) {
                     $tmp = array();
                     $tmp['##linkedticket.id##'] = $data['tickets_id'];
                     $tmp['##linkedticket.link##'] = Ticket_Ticket::getLinkName($data['link']);
                     $tmp['##linkedticket.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php" . "?redirect=ticket_" . $data['tickets_id']);
                     $tmp['##linkedticket.title##'] = $linkedticket->getField('name');
                     $tmp['##linkedticket.content##'] = $linkedticket->getField('content');
                     $this->datas['linkedtickets'][] = $tmp;
                 }
             }
         }
         if (!empty($this->datas['linkedtickets'])) {
             $this->datas['##ticket.numberoflinkedtickets##'] = count($this->datas['linkedtickets']);
         } else {
             $this->datas['##ticket.numberoflinkedtickets##'] = 0;
         }
         $restrict = "`tickets_id`='" . $this->obj->getField('id') . "'";
         if (!isset($options['additionnaloption']) || !$options['additionnaloption']) {
             $restrict .= " AND `is_private` = '0'";
         }
         $restrict .= " ORDER BY `date` DESC, `id` ASC";
         //Task infos
         $tasks = getAllDatasFromTable('glpi_tickettasks', $restrict);
         foreach ($tasks as $task) {
             $tmp = array();
             $tmp['##task.isprivate##'] = Dropdown::getYesNo($task['is_private']);
             $tmp['##task.author##'] = html_clean(getUserName($task['users_id']));
             $tmp['##task.category##'] = Dropdown::getDropdownName('glpi_taskcategories', $task['taskcategories_id']);
             $tmp['##task.date##'] = convDateTime($task['date']);
             $tmp['##task.description##'] = $task['content'];
             $tmp['##task.time##'] = Ticket::getActionTime($task['actiontime']);
             $plan = new TicketPlanning();
             if ($plan->getFromDBbyTask($task['id'])) {
                 $tmp['##task.planning.user##'] = html_clean(getUserName($plan->fields['users_id']));
                 $tmp['##task.planning.begin##'] = convDateTime($plan->fields['begin']);
                 $tmp['##task.planning.end##'] = convDateTime($plan->fields['end']);
                 $tmp['##task.planning.status##'] = Planning::getState($plan->fields['state']);
             } else {
                 $tmp['##task.planning.user##'] = "";
                 $tmp['##task.planning.begin##'] = "";
                 $tmp['##task.planning.end##'] = "";
                 $tmp['##task.planning.status##'] = "";
             }
             $this->datas['tasks'][] = $tmp;
         }
         if (!empty($this->datas['tasks'])) {
             $this->datas['##ticket.numberoftasks##'] = count($this->datas['tasks']);
         } else {
             $this->datas['##ticket.numberoftasks##'] = 0;
         }
         //Followup infos
         $followups = getAllDatasFromTable('glpi_ticketfollowups', $restrict);
         foreach ($followups as $followup) {
             $tmp = array();
             $tmp['##followup.isprivate##'] = Dropdown::getYesNo($followup['is_private']);
             $tmp['##followup.author##'] = html_clean(getUserName($followup['users_id']));
             $tmp['##followup.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $followup['requesttypes_id']);
             $tmp['##followup.date##'] = convDateTime($followup['date']);
             $tmp['##followup.description##'] = $followup['content'];
             $this->datas['followups'][] = $tmp;
         }
         if (isset($this->datas['followups'])) {
             $this->datas['##ticket.numberoffollowups##'] = count($this->datas['followups']);
         } else {
             $this->datas['##ticket.numberoffollowups##'] = 0;
         }
         //Validation infos
         $restrict = "`tickets_id`='" . $this->obj->getField('id') . "'";
         if (isset($options['validation_id']) && $options['validation_id']) {
             $restrict .= " AND `glpi_ticketvalidations`.`id` = '" . $options['validation_id'] . "'";
         }
         $restrict .= " ORDER BY `submission_date` DESC, `id` ASC";
         $validations = getAllDatasFromTable('glpi_ticketvalidations', $restrict);
         foreach ($validations as $validation) {
             $tmp = array();
             $tmp['##validation.submission.title##'] = $LANG['validation'][27] . " (" . $LANG['job'][4] . " " . html_clean(getUserName($validation['users_id'])) . ")";
             $tmp['##validation.answer.title##'] = $LANG['validation'][32] . " (" . $LANG['validation'][21] . " " . html_clean(getUserName($validation['users_id_validate'])) . ")";
             $tmp['##validation.author##'] = html_clean(getUserName($validation['users_id']));
             $tmp['##validation.status##'] = TicketValidation::getStatus($validation['status']);
             $tmp['##validation.storestatus##'] = $validation['status'];
             $tmp['##validation.submissiondate##'] = convDateTime($validation['submission_date']);
             $tmp['##validation.commentsubmission##'] = $validation['comment_submission'];
             $tmp['##validation.validationdate##'] = convDateTime($validation['validation_date']);
             $tmp['##validation.validator##'] = html_clean(getUserName($validation['users_id_validate']));
             $tmp['##validation.commentvalidation##'] = $validation['comment_validation'];
             $this->datas['validations'][] = $tmp;
         }
         // Ticket Satisfaction
         $inquest = new TicketSatisfaction();
         if ($inquest->getFromDB($this->obj->getField('id'))) {
             // internal inquest
             if ($inquest->fields['type'] == 1) {
                 $this->datas['##ticket.urlsatisfaction##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id") . "_10");
                 // external inquest
             } else {
                 if ($inquest->fields['type'] == 2) {
                     $this->datas['##ticket.urlsatisfaction##'] = EntityData::generateLinkSatisfaction($this->obj);
                 }
             }
             $this->datas['##satisfaction.type##'] = $inquest->getTypeInquestName($inquest->getfield('type'));
             $this->datas['##satisfaction.datebegin##'] = convDateTime($inquest->fields['date_begin']);
             $this->datas['##satisfaction.dateanswered##'] = convDateTime($inquest->fields['date_answered']);
             $this->datas['##satisfaction.satisfaction##'] = $inquest->fields['satisfaction'];
             $this->datas['##satisfaction.description##'] = $inquest->fields['comment'];
         } else {
             $this->datas['##satisfaction.type##'] = '';
             $this->datas['##satisfaction.datebegin##'] = '';
             $this->datas['##satisfaction.dateanswered##'] = '';
             $this->datas['##satisfaction.satisfaction##'] = '';
             $this->datas['##satisfaction.description##'] = '';
         }
         // Use list_limit_max or load the full history ?
         foreach (Log::getHistoryData($this->obj, 0, $CFG_GLPI['list_limit_max']) as $data) {
             $tmp = array();
             $tmp['##ticket.log.date##'] = $data['date_mod'];
             $tmp['##ticket.log.user##'] = $data['user_name'];
             $tmp['##ticket.log.field##'] = $data['field'];
             $tmp['##ticket.log.content##'] = $data['change'];
             $this->datas['log'][] = $tmp;
         }
         if (isset($this->datas['log'])) {
             $this->datas['##ticket.numberoflogs##'] = count($this->datas['log']);
         } else {
             $this->datas['##ticket.numberoflogs##'] = 0;
         }
     } else {
         if (isset($options['entities_id']) && isset($options['tickets'])) {
             $this->datas['##ticket.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
             $this->datas['##ticket.action##'] = $LANG['crontask'][15];
             $t = new Ticket();
             foreach ($options['tickets'] as $ticket) {
                 $tmp = array();
                 $t->getFromDB($ticket['id']);
                 $tmp['##ticket.id##'] = sprintf("%07d", $ticket['id']);
                 $tmp['##ticket.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $ticket['id']);
                 $tmp['##ticket.title##'] = $ticket['name'];
                 $tmp['##ticket.status##'] = Ticket::getStatus($ticket['status']);
                 $tmp['##ticket.globalvalidation##'] = TicketValidation::getStatus($ticket['global_validation']);
                 $tmp['##ticket.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $ticket['requesttypes_id']);
                 $tmp['##ticket.urgency##'] = Ticket::getUrgencyName($ticket['urgency']);
                 $tmp['##ticket.impact##'] = Ticket::getImpactName($ticket['impact']);
                 $tmp['##ticket.priority##'] = Ticket::getPriorityName($ticket['priority']);
                 $tmp['##ticket.time##'] = Ticket::getActionTime($ticket['actiontime']);
                 $tmp['##ticket.costtime##'] = $ticket['cost_time'];
                 $tmp['##ticket.creationdate##'] = convDateTime($ticket['date']);
                 $tmp['##ticket.content##'] = $ticket['content'];
                 if ($t->getField('ticketsolutiontypes_id')) {
                     $tmp['##ticket.solution.type##'] = Dropdown::getDropdownName('glpi_ticketsolutiontypes', $t->getField('ticketsolutiontypes_id'));
                 } else {
                     $this->datas['##ticket.solution.type##'] = '';
                 }
                 $tmp['##ticket.solution.description##'] = unclean_cross_side_scripting_deep($t->getField('solution'));
                 if ($t->countUsers(Ticket::REQUESTER)) {
                     $users = array();
                     foreach ($t->getUsers(Ticket::REQUESTER) as $uid => $val) {
                         $user_tmp = new User();
                         $user_tmp->getFromDB($uid);
                         $users[$uid] = $user_tmp->getName();
                         $tmp2 = array();
                         $tmp2['##author.id##'] = $uid;
                         $tmp2['##author.name##'] = $user_tmp->getName();
                         if ($user_tmp->getField('locations_id')) {
                             $tmp2['##author.location##'] = Dropdown::getDropdownName('glpi_locations', $user_tmp->getField('locations_id'));
                         } else {
                             $tmp2['##author.location##'] = '';
                         }
                         $tmp2['##author.phone##'] = $user_tmp->getField('phone');
                         $tmp2['##author.phone2##'] = $user_tmp->getField('phone2');
                         $tmp['authors'][] = $tmp2;
                     }
                     $tmp['##ticket.authors##'] = implode(', ', $users);
                 } else {
                     $tmp['##ticket.authors##'] = '';
                 }
                 if ($t->countUsers(Ticket::ASSIGN)) {
                     $users = array();
                     foreach ($t->getUsers(Ticket::ASSIGN) as $uid => $val) {
                         $user_tmp = new User();
                         $user_tmp->getFromDB($uid);
                         $users[$uid] = $user_tmp->getName();
                     }
                     $tmp['##ticket.assigntousers##'] = implode(', ', $users);
                 } else {
                     $tmp['##ticket.assigntousers##'] = '';
                 }
                 if ($t->countGroups(Ticket::ASSIGN)) {
                     $groups = array();
                     foreach ($t->getGroups(Ticket::ASSIGN) as $gid => $val) {
                         $groups[$gid] = Dropdown::getDropdownName('glpi_groups', $gid);
                     }
                     $tmp['##ticket.assigntogroups##'] = implode(', ', $groups);
                 } else {
                     $tmp['##ticket.assigntogroups##'] = '';
                 }
                 if ($t->countGroups(Ticket::REQUESTER)) {
                     $groups = array();
                     foreach ($t->getGroups(Ticket::REQUESTER) as $gid => $val) {
                         $groups[$gid] = Dropdown::getDropdownName('glpi_groups', $gid);
                     }
                     $tmp['##ticket.groups##'] = implode(', ', $groups);
                 } else {
                     $tmp['##ticket.groups##'] = '';
                 }
                 if ($t->countUsers(Ticket::OBSERVER)) {
                     $users = array();
                     foreach ($t->getUsers(Ticket::OBSERVER) as $uid => $tmp) {
                         $user_tmp = new User();
                         $user_tmp->getFromDB($uid);
                         $users[$uid] = $user_tmp->getName();
                     }
                     $tmp['##ticket.observerusers##'] = implode(', ', $users);
                 } else {
                     $tmp['##ticket.observerusers##'] = '';
                 }
                 if ($t->countGroups(Ticket::OBSERVER)) {
                     $groups = array();
                     foreach ($t->getGroups(Ticket::OBSERVER) as $gid => $tmp) {
                         $groups[$gid] = Dropdown::getDropdownName('glpi_groups', $gid);
                     }
                     $tmp['##ticket.observergroups##'] = implode(', ', $groups);
                 } else {
                     $tmp['##ticket.observergroups##'] = '';
                 }
                 if ($ticket['suppliers_id_assign']) {
                     $tmp['##ticket.assigntosupplier##'] = Dropdown::getDropdownName('glpi_suppliers', $ticket['suppliers_id_assign']);
                 } else {
                     $tmp['##ticket.assigntosupplier##'] = '';
                 }
                 $this->datas['tickets'][] = $tmp;
             }
         }
     }
     $this->getTags();
     foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
             $this->datas[$tag] = $values['label'];
         }
     }
 }