*
 *    "PCPIN Chat 6" is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    "PCPIN Chat 6" is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
_pcpin_loadClass('smilie');
$smilie = new PCPIN_Smilie($session);
_pcpin_loadClass('tmpdata');
$tmpdata = new PCPIN_TmpData($session);
_pcpin_loadClass('binaryfile');
$binaryfile = new PCPIN_BinaryFile($session);
$errortext = array();
if (!isset($code)) {
    $code = '';
}
if (!isset($description)) {
    $description = '';
}
if (!empty($current_user->id) && $current_user->is_admin === 'y') {
    $xmlwriter->setHeaderStatus(1);
    if ($code == '') {
        $errortext[] = $l->g('smilie_code_empty_error');
Exemplo n.º 2
0
foreach ($global_tpl_vars as $key => $val) {
    $tpl->addGlobalVar($key, htmlspecialchars($val));
}
// Add language expressions to template
foreach ($tpl->tpl_vars_plain as $var) {
    if (0 === strpos($var, 'LNG_')) {
        $var = strtolower($var);
        $tpl->addGlobalVar($var, htmlspecialchars($l->g(substr($var, 4))));
    }
}
// Display fonts
$tpl->addVar('fonts', 'fonts', htmlspecialchars($session->_conf_all['font_families']));
$tpl->addVar('fonts', 'font_sizes', htmlspecialchars($session->_conf_all['font_sizes']));
// Add smilies to the main template
_pcpin_loadClass('smilie');
$smilie = new PCPIN_Smilie($session);
$smilies = $smilie->getSmilies();
if (!empty($smilies)) {
    // Append empty elements to smilies array
    $smilies_append = $session->_conf_all['smilies_per_row'] - count($smilies) % $session->_conf_all['smilies_per_row'];
    if ($smilies_append != $session->_conf_all['smilies_per_row'] && $smilies_append > 0) {
        for ($i = 0; $i < $smilies_append; $i++) {
            array_push($smilies, array('id' => '', 'binaryfile_id' => '', 'code' => '', 'description' => ''));
        }
    }
    $col = 1;
    $maxcol = 0;
    foreach ($smilies as $smilie_data) {
        $template->addVars('smiliebox_col', array('id' => htmlspecialchars($smilie_data['id']), 'binaryfile_id' => htmlspecialchars($smilie_data['binaryfile_id']), 'code' => htmlspecialchars($smilie_data['code']), 'description' => htmlspecialchars($smilie_data['description']), 's_id' => htmlspecialchars($session->_s_id), 'padding_top' => htmlspecialchars($inc == 'pm_box' || $session->_conf_all['smilies_position'] != 0 ? 8 : 0), 'padding_bottom' => htmlspecialchars($inc == 'pm_box' || $session->_conf_all['smilies_position'] != 0 ? 8 : 0), 'padding_left' => htmlspecialchars($inc == 'pm_box' || $session->_conf_all['smilies_position'] != 0 ? 8 : 0), 'padding_right' => htmlspecialchars(8)));
        $template->parseTemplate('smiliebox_col', 'a');
        if ($col > $maxcol) {
 *    "PCPIN Chat 6" is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Update smilie
 * @param   int     $smilie_id      Smilie ID
 * @param   string  $code           New smilie code
 * @param   string  $description    New smilie description
 */
_pcpin_loadClass('smilie');
$smilie = new PCPIN_Smilie($session);
if (!isset($smilie_id) || !pcpin_ctype_digit($smilie_id)) {
    $smilie_id = 0;
}
if (!isset($code) || !is_scalar($code)) {
    $code = '';
}
if (!isset($description) || !is_scalar($description)) {
    $description = '';
}
// Get client session
if (is_object($session) && !empty($current_user->id) && $session->_s_user_id == $current_user->id && $current_user->is_admin === 'y') {
    $xmlwriter->setHeaderMessage($l->g('changes_saved'));
    $xmlwriter->setHeaderStatus(0);
    if (!empty($smilie_id)) {
        $smilie->updateSmilie($smilie_id, $code, $description);
 *
 *    "PCPIN Chat 6" is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    "PCPIN Chat 6" is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
_pcpin_loadClass('smilie');
$smilie = new PCPIN_Smilie($session);
_pcpin_loadClass('tmpdata');
$tmpdata = new PCPIN_TmpData($session);
_pcpin_loadClass('binaryfile');
$binaryfile = new PCPIN_BinaryFile($session);
$errortext = array();
if (!empty($current_user->id) && $current_user->is_admin === 'y') {
    // Delete smilie
    if (!empty($smilie_id) && pcpin_ctype_digit($smilie_id) && $smilie->deleteSmilie($smilie_id)) {
        $xmlwriter->setHeaderStatus(0);
        $xmlwriter->setHeaderMessage($l->g('smilie_deleted'));
    } else {
        $xmlwriter->setHeaderStatus(1);
        $xmlwriter->setHeaderMessage($l->g('error'));
    }
}