当前位置: 首页>>代码示例>>PHP>>正文


PHP TextCleaner类代码示例

本文整理汇总了PHP中TextCleaner的典型用法代码示例。如果您正苦于以下问题:PHP TextCleaner类的具体用法?PHP TextCleaner怎么用?PHP TextCleaner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TextCleaner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search_resources

function search_resources()
{
    global $xoopsConfig, $xoopsUser, $page, $xoopsTpl;
    $keyword = rmc_server_var($_GET, 'keyword', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1";
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url(RDFunctions::make_link('search') . '?keyword=' . $keyword . '&amp;page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1 LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $resources = array();
    while ($row = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($row);
        $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => TextCleaner::truncate($res->getVar('description'), 100), 'link' => $res->permalink(), 'created' => $res->getVar('created'), 'owner' => $res->getVar('owner'), 'uname' => $res->getVar('owname'), 'reads' => $res->getVar('reads'));
    }
    RDFunctions::breadcrumb();
    RMBreadCrumb::get()->add_crumb(__('Browsing recent Documents', 'docs'));
    RMTemplate::get()->add_style('docs.css', 'docs');
    include 'header.php';
    $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Search results for "%s"', 'docs'), $keyword));
    include RMEvents::get()->run_event('docs.template.search', RMTemplate::get()->get_template('rd_search.php', 'module', 'docs'));
    include 'footer.php';
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:30,代码来源:search.php

示例2: rd_block_resources

/**
* Este archivo permite controlar el bloque o los bloques
* Bloques Existentes:
* 
* 1. Publicaciones Recientes
* 2. Publicaciones Populares (Mas Leídas)
* 3. Publicaciones Mejor Votadas
*/
function rd_block_resources($options)
{
    global $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/modules/docs/class/rdresource.class.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $mc = RMUtilities::module_config('docs');
    $sql = "SELECT * FROM " . $db->prefix("rd_resources") . ' WHERE public=1 AND approved=1';
    switch ($options[0]) {
        case 'recents':
            $sql .= " ORDER BY created DESC";
            break;
        case 'popular':
            $sql .= " ORDER BY `reads` DESC";
            break;
    }
    $sql .= " LIMIT 0, " . ($options[1] > 0 ? $options[1] : 5);
    $result = $db->query($sql);
    $block = array();
    while ($row = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($row);
        $ret = array();
        $ret['id'] = $res->id();
        $ret['title'] = $res->getVar('title');
        if ($options[2]) {
            $ret['desc'] = $options[3] == 0 ? $res->getVar('description') : TextCleaner::truncate($res->getVar('description'), $options[3]);
        }
        $ret['link'] = $res->permalink();
        $ret['author'] = sprintf(__('Created by %s', 'docs'), '<strong>' . $res->getVar('owname') . '</strong>');
        $ret['reads'] = sprintf(__('Viewed %s times', 'docs'), '<strong>' . $res->getVar('reads') . '</strong>');
        $block['resources'][] = $ret;
    }
    RMTemplate::get()->add_style('blocks.css', 'docs');
    return $block;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:43,代码来源:rd_resources.php

示例3: eventCoreIncludeCommonLanguage

 /**
  * To prevent errors when upload images with closed site
  */
 public function eventCoreIncludeCommonLanguage()
 {
     global $xoopsConfig;
     if ($xoopsConfig['cpanel'] != 'redmexico') {
         $db = XoopsDatabaseFactory::getDatabaseConnection();
         $db->queryF("UPDATE " . $db->prefix("config") . " SET conf_value='redmexico' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='cpanel'");
     }
     /**
      * Check before to a rmcommon native module be installed
      */
     $fct = RMHttpRequest::get('fct', 'string', '');
     $op = RMHttpRequest::get('op', 'string', '');
     if ('modulesadmin' == $fct && 'install' == $op) {
         $dirname = RMHttpRequest::get('module', 'string', '');
         if ('' != $dirname) {
             $module = new XoopsModule();
             $module->loadInfoAsVar($dirname);
             if ($module->getInfo('rmnative')) {
                 RMUris::redirect_with_message(__('Please install %s using the modules manager from Common Utilities to prevent errors during install.', 'rmcommon'), RMCURL . '/modules.php?action=install&amp;dir=' . $dirname, RMMSG_WARN);
             }
         }
     }
     if (RMUris::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) {
         $security = rmc_server_var($_POST, 'rmsecurity', 0);
         $data = TextCleaner::getInstance()->decrypt($security, true);
         $data = explode("|", $data);
         // [0] = referer, [1] = session_id(), [2] = user, [3] = token
         $xoopsUser = new XoopsUser($data[0]);
         if ($xoopsUser->isAdmin()) {
             $xoopsConfig['closesite'] = 0;
         }
     }
     RMEvents::get()->run_event('rmcommon.include.common.language');
 }
开发者ID:txmodxoops,项目名称:rmcommon,代码行数:37,代码来源:core.php

示例4: showLogs

/**
* @desc Visualiza todos los logs existentes para un determinado software
**/
function showLogs()
{
    global $tpl, $xoopsConfig, $xoopsModule, $functions, $xoopsSecurity;
    define('RMCSUBLOCATION', 'itemlogs');
    $item = isset($_REQUEST['item']) ? intval($_REQUEST['item']) : 0;
    $sw = new DTSoftware($item);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tc = TextCleaner::getInstance();
    $tf = new RMTimeFormatter(0, __('%m%-%d%-%Y%', 'dtransport'));
    $sql = "SELECT * FROM " . $db->prefix('dtrans_logs') . " WHERE id_soft={$item}";
    $result = $db->queryF($sql);
    while ($rows = $db->fetchArray($result)) {
        $log = new DTLog();
        $log->assignVars($rows);
        $logs[] = array('id' => $log->id(), 'title' => $log->title(), 'log' => $tc->truncate($tc->clean_disabled_tags($log->log()), 80), 'date' => $tf->format($log->date()));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./items.php'>" . sprintf(_AS_DT_SW, $sw->getVar('name')) . "</a> &raquo; " . _AS_DT_LOGS);
    $functions->toolbar();
    $tpl->add_style('admin.css', 'dtransport');
    $tpl->add_local_script('admin.js', 'dtransport');
    $tpl->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    include DT_PATH . '/include/js_strings.php';
    xoops_cp_header();
    include $tpl->get_template('admin/dtrans_logs.php', 'module', 'dtransport');
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:29,代码来源:logs.php

示例5: get

 /**
  * Gets news with some Id
  *
  * @param int $id Id of news
  * @return mixed Associated array with news data
  * @throws APIException
  */
 public function get($id)
 {
     $element = umiHierarchy::getInstance()->getElement($id);
     if (!$element) {
         throw new APIException("Can't find news with id " . $id);
     }
     $images = array();
     $mainImage = $element->getValue("anons_pic");
     if ($mainImage) {
         $mainImage = "http://" . $_SERVER['HTTP_HOST'] . $mainImage;
         $images[] = $mainImage;
     }
     $cleaner = new TextCleaner();
     $text = $element->getValue("content");
     $text = $cleaner->clearText($text);
     $imagesFromText = $cleaner->getPhotos($text);
     $images = array_merge($images, $imagesFromText);
     $item = array("id" => $id, "header" => $element->getValue("h1"), "text" => $text, "images" => $images, "date" => $element->getValue("publish_time")->getFormattedDate("d.m.Y"), "original_link" => "http://" . $_SERVER['HTTP_HOST'] . umiHierarchy::getInstance()->getPathById($id));
     return $item;
 }
开发者ID:kei-sidorov,项目名称:yugs-news-api,代码行数:27,代码来源:NewsCollectionUMI.php

示例6: bxpress_recents_show

function bxpress_recents_show($options)
{
    $util = RMUtilities::get();
    $tc = TextCleaner::getInstance();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $xoopsModuleConfig = $util->module_config('exmbb');
    $mc = RMUtilities::module_config('bxpress');
    $tbl1 = $db->prefix('bxpress_posts');
    $tbl2 = $db->prefix('bxpress_topics');
    $tbl3 = $db->prefix('bxpress_posts_text');
    $tbl4 = $db->prefix('bxpress_forums');
    $sql = "SELECT MAX(id_post) AS id FROM {$tbl1} WHERE approved=1 GROUP BY id_topic ORDER BY MAX(id_post) DESC LIMIT 0,{$options['0']}";
    $result = $db->queryF($sql);
    $topics = array();
    $block = array();
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $post = new bXPost();
    $forum = new bXForum();
    $tf = new RMTimeFormatter(0, '%T%-%d%-%Y% at %h%:%i%');
    while ($row = $db->fetchArray($result)) {
        $post = new bXPost($row['id']);
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        $ret = array();
        $ret['id'] = $topic->id();
        $ret['post'] = $post->id();
        $ret['link'] = $post->permalink();
        if ($options[2]) {
            $ret['date'] = $tf->format($post->date());
        }
        if ($options[3]) {
            $ret['poster'] = sprintf(__('Posted by: %s', 'bxpress'), "<a href='" . $post->permalink() . "'>" . $post->uname() . "</a>");
        }
        $ret['title'] = $topic->title();
        if ($options[4]) {
            $ret['text'] = $tc->clean_disabled_tags($post->text());
        }
        $ret['forum'] = array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink());
        $topics[] = $ret;
    }
    // Opciones
    $block['showdates'] = $options[2];
    $block['showuname'] = $options[3];
    $block['showtext'] = $options[4];
    $block['topics'] = $topics;
    $block['lang_topic'] = __('Topic', 'bxpress');
    $block['lang_date'] = __('Date', 'bxpress');
    $block['lang_poster'] = __('Poster', 'bxpress');
    return $block;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:53,代码来源:bxpress_recents.php

示例7: savePlatforms

/**
* @desc Almacena la información de las plataformas
**/
function savePlatforms($edit = 0)
{
    global $xoopsSecurity;
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('Session token expired!', 'dtransport');
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tc = TextCleaner::getInstance();
    $nameid = $tc->sweetstring($name);
    if ($edit) {
        //Verificamos si plataforma es válida
        if ($id <= 0) {
            redirectMsg('platforms.php', __('You must specify a valid platform ID!', 'dtrasnport'), 1);
            die;
        }
        //Verificamos si plataforma existe
        $plat = new DTPlatform($id);
        if ($plat->isNew()) {
            redirectMsg('platforms.php', __('Specified platform does not exists!', 'dtransport'), 1);
            die;
        }
        //Comprueba que la plataforma no exista
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('dtrans_platforms') . " WHERE (name='{$name}' OR nameid='{$nameid}') AND id_platform<>" . $plat->id();
        list($num) = $db->fetchRow($db->queryF($sql));
        if ($num > 0) {
            redirectMsg('platforms.php', __('Another platform with same name already exists!', 'dtransport'), 1);
            die;
        }
    } else {
        //Comprueba que la plataforma no exista
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('dtrans_platforms') . " WHERE name='{$name}' OR nameid='{$nameid}'";
        list($num) = $db->fetchRow($db->queryF($sql));
        if ($num > 0) {
            redirectMsg('platforms.php', __('Another platform with same name already exists!', 'dtransport'), 1);
            die;
        }
        $plat = new DTPlatform();
    }
    $plat->setName($name);
    $plat->setNameId($nameid);
    if (!$plat->save()) {
        redirectMsg('platforms.php', __('Database could not be updated!', 'dtransport') . '<br />' . $plat->errors(), 1);
        die;
    } else {
        redirectMsg('./platforms.php', __('Platform saved successfully!', 'dtransport'), 0);
        die;
    }
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:54,代码来源:platforms.php

示例8: __construct

 /**
  * @param string $caption Texto del campo
  * @param string $name Nombre de este campo
  * @param string $width Ancho del campo. Puede ser el valor en formato pixels (300px) o en porcentaje (100%)
  * @param string $height Alto de campo. El valor debe ser pasado en formato pixels (300px).
  * @param string $default Texto incial al cargar el campo. POr defecto se muestra vaco.
  * @param string $type Tipo de Editor. Posibles valores: FCKeditor, DHTML
  */
 function __construct($caption, $name, $width = '100%', $height = '300px', $default = '', $type = '', $change = 1, $ele = array('op'))
 {
     $rmc_config = RMFunctions::get()->configs();
     $tcleaner = TextCleaner::getInstance();
     $this->setCaption($caption);
     $this->setName($name);
     $this->_width = $width;
     $this->_height = $height;
     $this->_default = isset($_REQUEST[$name]) ? $tcleaner->stripslashes($_REQUEST[$name]) : $tcleaner->stripslashes($default);
     $this->_type = $type == '' ? $rmc_config['editor_type'] : $type;
     $this->_type = strtolower($this->_type);
     $this->_change = $change;
     $this->_eles = $ele;
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:22,代码来源:editor.class.php

示例9: eventCoreIncludeCommonLanguage

 /**
  * To prevent errors when upload images with closed site 
  */
 public function eventCoreIncludeCommonLanguage()
 {
     global $xoopsConfig;
     if (RMFunctions::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) {
         $security = rmc_server_var($_POST, 'rmsecurity', 0);
         $data = TextCleaner::getInstance()->decrypt($security, true);
         $data = explode("|", $data);
         // [0] = referer, [1] = session_id(), [2] = user, [3] = token
         $xoopsUser = new XoopsUser($data[0]);
         if ($xoopsUser->isAdmin()) {
             $xoopsConfig['closesite'] = 0;
         }
     }
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:17,代码来源:core.php

示例10: rd_show_page

function rd_show_page()
{
    RMTemplate::get()->assign('xoops_pagetitle', __('Home Page', 'docs'));
    xoops_cp_header();
    include_once RMCPATH . '/class/form.class.php';
    $content = @file_get_contents(XOOPS_CACHE_PATH . '/rd_homepage.html');
    $content = TextCleaner::getInstance()->to_display($content);
    $editor = new RMFormEditor('', 'homepage', '100%', '450px', $content);
    $rmc_config = RMFunctions::configs();
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->add_config('theme_advanced_buttons1', 'res_index');
    }
    include RMEvents::get()->run_event('docs.get.homepage.template', RMTemplate::get()->get_template('admin/rd_homepage.php', 'module', 'docs'));
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:16,代码来源:hpage.php

示例11: mywordsBlockRecent

function mywordsBlockRecent($options)
{
    global $xoopsModuleConfig, $xoopsModule, $xoopsUser;
    $mc = RMSettings::module_settings('mywords');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $by = '';
    switch ($options[1]) {
        case 'recent':
            $by = 'pubdate';
            break;
        case 'popular':
            $by = "`reads`";
            break;
        case 'comm':
            $by = "`comments`";
            break;
    }
    $posts = MWFunctions::get_posts_by_cat($options[5], 0, $options[0], $by, 'DESC');
    $block = array();
    foreach ($posts as $post) {
        $ret = array();
        $ret['id'] = $post->id();
        $ret['title'] = $post->getVar('title');
        $ret['link'] = $post->permalink();
        // Content
        if ($options[2]) {
            $ret['content'] = TextCleaner::getInstance()->truncate($post->content(true), $options[3]);
        }
        // Pubdate
        if ($options[4]) {
            $ret['date'] = formatTimestamp($post->getVar('pubdate'), 'c');
        }
        // Show reads
        if ($options[1] == 'popular') {
            $ret['hits'] = sprintf(__('%u Reads', 'mywords'), $post->getVar('reads'));
        } elseif ($options[1] == 'comm') {
            $ret['comments'] = sprintf(__('%u Comments', 'mywords'), $post->getVar('comments'));
        }
        $ret['time'] = $post->getVar('pubdate');
        $ret['image'] = RMIMage::get()->load_from_params($post->image);
        $block['posts'][] = $ret;
    }
    RMTemplate::get()->add_style('mwblocks.css', 'mywords');
    return $block;
}
开发者ID:JustineBABY,项目名称:mywords,代码行数:45,代码来源:block.recent.php

示例12: bxpressSearch

/**
* @desc Realiza una búsqueda en el módulo desde EXM
*/
function bxpressSearch($queryarray, $andor, $limit, $offset, $userid = 0)
{
    global $myts, $module;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tbl1 = $db->prefix("mod_bxpress_topics");
    $tbl2 = $db->prefix("mod_bxpress_posts_text");
    $tbl3 = $db->prefix("mod_bxpress_posts");
    if ($userid <= 0) {
        $sql = "SELECT a.*,b.*,c.* FROM {$tbl1} a, {$tbl2} b, {$tbl3} c ";
        $sql1 = '';
        foreach ($queryarray as $k) {
            $sql1 .= ($sql1 == '' ? '' : " {$andor} ") . " (\n        \t    (a.title LIKE '%{$k}%' AND a.id_topic=c.id_topic) OR \n        \t     (b.post_text LIKE '%{$k}%' AND b.post_id=c.id_post))";
        }
        $sql .= $sql1 != '' ? "WHERE {$sql1}" : '';
        $sql .= $userid > 0 ? "GROUP BY c.id_topic" : " GROUP BY c.id_topic";
        $sql .= " ORDER BY c.post_time DESC LIMIT {$offset}, {$limit}";
        $result = $db->queryF($sql);
    } else {
        $sql = "SELECT a.*, b.*, c.post_text FROM {$tbl3} a, {$tbl1} b, {$tbl2} c WHERE a.uid='{$userid}' AND b.id_topic=a.id_topic \n                AND c.post_id=a.id_post ";
        $sql1 = '';
        foreach ($queryarray as $k) {
            $sql1 .= ($sql1 == '' ? 'AND ' : " {$andor} ") . "\n                b.title LIKE '%{$k}%' AND c.post_text LIKE '%{$k}%'";
        }
        $sql .= $sql1;
        $sql .= "ORDER BY a.post_time DESC\n                LIMIT {$offset}, {$limit}";
        $result = $db->query($sql);
    }
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $tc = TextCleaner::getInstance();
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $post = new bXPost();
        $post->assignVars($row);
        $rtn = array();
        $rtn['image'] = 'images/forum16.png';
        $rtn['link'] = $post->permalink();
        $rtn['title'] = $row['title'];
        $rtn['time'] = $row['post_time'];
        $rtn['uid'] = $row['uid'];
        $rtn['desc'] = substr($tc->clean_disabled_tags($row['post_text']), 0, 150) . '...';
        $ret[] = $rtn;
    }
    return $ret;
}
开发者ID:petitours,项目名称:bxpress,代码行数:48,代码来源:search.php

示例13: eventMywordsViewPost

 /**
  * This method is designed specially for MyWords
  */
 public function eventMywordsViewPost($post_data, MWPost $post)
 {
     $config = RMFunctions::get()->plugin_settings('metaseo', true);
     if (!$config['meta']) {
         $metas = '<meta name="description" content="' . TextCleaner::truncate($post->content(true), $config['len']) . '" />';
         $tags = array();
         foreach ($post->tags() as $tag) {
             $tags[] = $tag['tag'];
         }
         $tags = implode(',', $tags);
         $metas .= '<meta name="keywords" content="' . $tags . '" />';
     } else {
         $metas = '<meta name="description" content="' . $post->get_meta($config['meta_name'], false) . '" />';
         $metas = '<meta name="description" content="' . $post->get_meta($config['meta_keys'], false) . '" />';
     }
     RMTemplate::get()->add_head($metas);
     return $post_data;
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:21,代码来源:mywords.php

示例14: _copyFile

 function _copyFile($chmod)
 {
     $matched = array();
     if (!preg_match("/\\.([a-zA-Z0-9]+)\$/", $this->mediaName, $matched)) {
         $this->setErrors(_ER_UP_INVALIDFILENAME);
         return false;
     }
     if (isset($this->targetFileName)) {
         $this->savedFileName = $this->targetFileName;
     } else {
         if (isset($this->prefix)) {
             $this->savedFileName = uniqid($this->prefix) . '.' . strtolower($matched[1]);
         } else {
             $this->savedFileName = strtolower($this->mediaName);
         }
     }
     $fdata = pathinfo($this->savedFileName);
     $this->savedFileName = TextCleaner::sweetstring($fdata['filename']) . ($fdata['extension'] != '' ? '.' . $fdata['extension'] : '');
     $fdata = pathinfo($this->savedFileName);
     if (file_exists($this->uploadDir . '/' . $this->savedFileName)) {
         $num = 1;
         while (file_exists($this->uploadDir . '/' . $this->savedFileName)) {
             $this->savedFileName = $fdata['filename'] . '-' . $num . ($fdata['extension'] != '' ? '.' . $fdata['extension'] : '');
             $num++;
         }
     }
     $this->savedDestination = $this->uploadDir . '/' . $this->savedFileName;
     if (!move_uploaded_file($this->mediaTmpName, $this->savedDestination)) {
         $this->setErrors(sprintf(_ER_UP_FAILEDSAVEFILE, $this->savedDestination));
         return false;
     }
     // Check IE XSS before returning success
     $ext = strtolower(substr(strrchr($this->savedDestination, '.'), 1));
     if (in_array($ext, $this->imageExtensions)) {
         $info = @getimagesize($this->savedDestination);
         if ($info === false || $this->imageExtensions[(int) $info[2]] != $ext) {
             $this->setErrors(_ER_UP_SUSPICIOUSREFUSED);
             @unlink($this->savedDestination);
             return false;
         }
     }
     @chmod($this->savedDestination, $chmod);
     return true;
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:44,代码来源:uploader.php

示例15: showScreens

/**
* @des Visualiza todas las pantallas existentes
**/
function showScreens()
{
    global $xoopsModule, $xoopsSecurity, $tpl, $functions, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsConfig;
    define('RMCSUBLOCATION', 'screenshots');
    if ($xoopsConfig['closesite']) {
        showMessage(__('Screenshop uploader does not work when site is closed. Before to start uploding, please change this configuration.', 'rmcommon'), RMMSG_WARN);
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tc = TextCleaner::getInstance();
    $item = rmc_server_var($_REQUEST, 'item', 0);
    if ($item <= 0) {
        redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN);
    }
    $sw = new DTSoftware($item);
    $sql = "SELECT * FROM " . $db->prefix('dtrans_screens') . " WHERE id_soft={$item}";
    $result = $db->queryF($sql);
    while ($rows = $db->fetchArray($result)) {
        $sc = new DTScreenshot();
        $sc->assignVars($rows);
        $screens[] = array('id' => $sc->id(), 'title' => $sc->title(), 'desc' => substr($tc->clean_disabled_tags($sc->desc()), 0, 80) . "...", 'image' => XOOPS_UPLOAD_URL . '/screenshots/' . date('Y', $sc->date()) . '/' . date('m', $sc->date()) . '/ths/' . $sc->image());
    }
    // CSS Styles
    $tpl->add_style('admin.css', 'dtransport');
    $tpl->add_style('screens.css', 'dtransport');
    $tpl->add_style('uploadify.css', 'rmcommon');
    // Javascripts
    $tpl->add_local_script('swfobject.js', 'rmcommon', 'include');
    $tpl->add_local_script('jquery.uploadify.js', 'rmcommon', 'include');
    $tpl->add_local_script('screens.js', 'dtransport');
    $tc = TextCleaner::getInstance();
    $rmf = RMFunctions::get();
    ob_start();
    include DT_PATH . '/js/screenshots.js';
    $script = ob_get_clean();
    $tpl->add_head_script($script);
    $functions->toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='items.php'>" . __('Downloads', 'dtransport') . "</a> &raquo; " . __('Screenshots Management', 'dtransport'));
    $tpl->assign('xoops_pagetitle', sprintf(__("%s Screenshots", 'dtransport'), $sw->getVar('name')));
    include DT_PATH . '/include/js_strings.php';
    xoops_cp_header();
    include $tpl->get_template('admin/dtrans_screens.php', 'module', 'dtransport');
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:46,代码来源:screens.php


注:本文中的TextCleaner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。