Beispiel #1
0
    default:
        $rss_channel['title'] = sprintf(__('Posts in %s', 'mywords'), $xoopsConfig['sitename']);
        $rss_channel['link'] = XOOPS_URL . ($config->permalinks ? $config->basepath : '/modules/mywords');
        $rss_channel['description'] = __('All recent published posts', 'mywords');
        $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss');
        $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['category'] = 'Blog';
        $rss_channel['generator'] = 'Common Utilities';
        $rss_channel['language'] = RMCLANG;
        // Get posts
        $posts = MWFunctions::get_posts(0, 10);
        $rss_items = array();
        foreach ($posts as $post) {
            $item = array();
            $item['title'] = $post->getVar('title');
            $item['link'] = $post->permalink();
            $img = new RMImage();
            $img->load_from_params($post->getVar('image', 'e'));
            if (!$img->isNew()) {
                $image = '<img src="' . $img->url() . '" alt="' . $post->getVar('title') . '" /><br />';
            } else {
                $image = '';
            }
            $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($image . $post->content(true), ENT_QUOTES));
            $item['pubdate'] = formatTimestamp($post->getVar('pubdate'), 'rss');
            $item['guid'] = $post->permalink();
            $rss_items[] = $item;
        }
        break;
}
Beispiel #2
0
 /**
  * Muestra los controles para lanzar el administrador de imágenes
  * desde cualqueir punto
  * @param string Element name for inputs
  */
 public function image_manager($name, $default = '')
 {
     if ($default != '') {
         $img = new RMImage();
         $img->load_from_params($default);
     }
     $ret = '<div id="' . $name . '-container" class="rmimage_container">';
     $ret .= '<div class="thumbnail">';
     if ($default != '' && !$img->isNew()) {
         $ret .= '<a href="' . $img->url() . '" target="_blank"><img src="' . $img->get_smallest() . '" /></a>';
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $name . '" value="' . $default . '" />';
         $ret .= '<br /><a href="#" class="removeButton removeButton-' . $name . '">' . __('Remove Image', 'rmcommon') . '</a>';
     } else {
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $name . '" value="" />';
     }
     $ret .= '</div>';
     $ret .= '<span class="image_manager_launcher button buttonGreen">' . __('Image manager...', 'rmcommon') . '</span>';
     $ret .= '</div>';
     $tpl = RMTemplate::get();
     $tpl->add_head_script('var imgmgr_title = "' . __('Image Manager', 'rmcommon') . '"' . "\n" . 'var mgrURL = "' . RMCURL . '/include/tiny-images.php";');
     $tpl->add_local_script('image_mgr_launcher.js', 'rmcommon', 'include');
     return $ret;
 }
Beispiel #3
0
/**
* Delete an image
*/
function delete_image()
{
    $ids = rmc_server_var($_REQUEST, 'imgs', array());
    $page = rmc_server_var($_REQUEST, 'page', 0);
    $category = rmc_server_var($_REQUEST, 'category', 0);
    if (count($ids) <= 0) {
        redirectMsg('images.php?category=' . $category . '&page=' . $page, __('Please, speciy an image at least!', 'rmcommon'), 1);
        die;
    }
    $errors = '';
    foreach ($ids as $id) {
        $image = new RMImage($id);
        if ($image->isNew()) {
            redirectMsg('images.php', __('Image not exists!', 'rmcommon'), 1);
            die;
        }
        $cat = new RMImageCategory($image->getVar('cat'));
        $fd = pathinfo($image->getVar('file'));
        $updir = XOOPS_UPLOAD_PATH . '/' . date('Y', $image->getVar('date')) . '/' . date('m', time());
        // Delete current image files
        foreach ($cat->getVar('sizes') as $size) {
            if ($size['width'] <= 0) {
                continue;
            }
            $file = $updir . '/sizes/' . $fd['filename'] . '_' . $size['width'] . 'x' . $size['height'] . '.' . $fd['extension'];
            @unlink($file);
        }
        $file = $updir . '/' . $image->getVar('file');
        @unlink($file);
        if (!$image->delete()) {
            $errors .= $image->errors();
        }
    }
    if ($errors != '') {
        redirectMsg('images.php?category=' . $cat->id() . '&page=' . $page, __('Errors ocurred during images deletion!', 'rmcommon') . '<br />' . $errors, 0);
    } else {
        redirectMsg('images.php?category=' . $cat->id() . '&page=' . $page, __('Images deleted successfully!', 'rmcommon'), 0);
    }
}
Beispiel #4
0
 /**
  * Muestra los controles para lanzar el administrador de imágenes
  * desde cualqueir punto
  * @param string $name Element name for inputs
  * @param string $id ID for this element
  * @param string $default Default value for field
  * @param array $data Array of data that will be inserted as data-{key} in HTML code
  * @return string
  */
 public function image_manager($name, $id = '', $default = '', $data = array())
 {
     $id = $id == '' ? $name : $id;
     if ($default != '') {
         $img = new RMImage();
         $img->load_from_params($default);
     }
     $ret = '<div id="' . $id . '-container" class="rmimage_container"';
     foreach ($data as $key => $value) {
         $ret .= ' data-' . $key . '="' . $value . '"';
     }
     $ret .= '>';
     $ret .= '<div class="thumbnail">';
     if ($default != '' && !$img->isNew()) {
         $ret .= '<a href="' . $img->url() . '" target="_blank"><img src="' . $img->get_by_size(300) . '" /></a>';
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . $default . '" />';
         $ret .= '<br /><a href="#" class="removeButton removeButton-' . $id . '">' . __('Remove Image', 'rmcommon') . '</a>';
     } else {
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value="" />';
     }
     $ret .= '</div>';
     $ret .= '<span class="image_manager_launcher btn btn-success">' . __('Image manager...', 'rmcommon') . '</span>';
     $ret .= '</div>';
     $tpl = RMTemplate::get();
     $tpl->add_head_script('var imgmgr_title = "' . __('Image Manager', 'rmcommon') . '"' . "\n" . 'var mgrURL = "' . RMCURL . '/include/tiny-images.php";');
     $tpl->add_script('cu-image-mgr.js', 'rmcommon');
     return $ret;
 }
Beispiel #5
0
 {
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     header('Content-type: application/json');
     echo json_encode($data);
     die;
 }
 if (!$xoopsSecurity->check()) {
     images_send_json(array('message' => _e('Sorry, unauthorized operation!', 'rmcommon'), 'error' => 1));
 }
 $id = RMHttpRequest::post('id', 'integer', 0);
 if ($id <= 0) {
     images_send_json(array('message' => __('No image specified', 'rmcommon'), 'error' => 1, 'token' => $xoopsSecurity->createToken()));
 }
 $image = new RMImage($id);
 if ($image->isNew()) {
     images_send_json(array('message' => __('Specified image does not exists', 'rmcommon'), 'error' => 1, 'token' => $xoopsSecurity->createToken()));
 }
 $author = new RMUser($image->uid);
 $original = pathinfo($image->get_files_path() . '/' . $image->file);
 $dimensions = getimagesize($image->get_files_path() . '/' . $image->file);
 $mimes = (include XOOPS_ROOT_PATH . '/include/mimetypes.inc.php');
 $category_sizes = $cat->getVar('sizes');
 $sizes = array();
 foreach ($category_sizes as $i => $size) {
     if ($size['width'] <= 0) {
         continue;
     }
     $tfile = $image->get_files_path() . '/sizes/' . $original['filename'] . '-' . $size['name'] . '.' . $original['extension'];
     if (!is_file($tfile)) {
         continue;
Beispiel #6
0
 /**
  * Get an image from image manager
  * @param $id int Image id
  * @param string Size name from category
  */
 function get_image($id, $size = '')
 {
     if ($id <= 0) {
         return false;
     }
     $img = new RMImage($id);
     if ($img->isNew()) {
         return false;
     }
     $cat = new RMImageCategory($img->getVar('cat'));
     $sizes = $cat->getVar('sizes');
     foreach ($sizes as $s) {
         if ($s['name'] == $size) {
             break;
         }
     }
     $date = explode('-', date('d-m-Y', $img->getVar('date')));
     $file = XOOPS_UPLOAD_URL . '/' . $date[2] . '/' . $date[1] . '/';
     if ($size == '') {
         $file .= $img->getVar('file');
         return $file;
     }
     $file .= 'sizes/' . substr($img->getVar('file'), 0, -4) . '_' . $s['width'] . 'x' . $s['height'] . substr($img->getVar('file'), -4);
     if (!is_file(str_replace(XOOPS_URL, XOOPS_ROOT_PATH, $file))) {
         return $img->getOriginal();
     }
     return $file;
 }