Exemple #1
0
function b_yogurt_lastpictures_show($options)
{
    global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    /**
     * Filter for fetch votes ishot and isnothot
     */
    $criteria = new criteria('cod_img', 0, ">");
    $criteria->setSort("cod_img");
    $criteria->setOrder("DESC");
    $criteria->setLimit($options[0]);
    /**
     * Creating factories of pictures and votes
     */
    //$album_factory      = new Xoopsyogurt_imagesHandler($xoopsDB);
    $pictures_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
    $block = $pictures_factory->getLastPicturesForBlock($options[0]);
    return $block;
}
Exemple #2
0
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
/**
 * Xoops header ...
 */
include_once "../../mainfile.php";
$xoopsOption['template_main'] = 'yogurt_index.html';
include_once "../../header.php";
/**
 * Modules class includes  
 */
include_once "class/yogurt_images.php";
/**
 * Factory of pictures created  
 */
$album_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
/**
 * Getting the title 
 */
$title = $_POST['caption'];
/**
 * Getting parameters defined in admin side  
 */
$path_upload = XOOPS_ROOT_PATH . "/uploads";
$pictwidth = $xoopsModuleConfig['resized_width'];
$pictheight = $xoopsModuleConfig['resized_height'];
$thumbwidth = $xoopsModuleConfig['thumb_width'];
$thumbheight = $xoopsModuleConfig['thumb_height'];
$maxfilebytes = $xoopsModuleConfig['maxfilesize'];
$maxfileheight = $xoopsModuleConfig['max_original_height'];
$maxfilewidth = $xoopsModuleConfig['max_original_width'];
Exemple #3
0
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once '../../mainfile.php';
include_once '../../header.php';
include_once '../../class/criteria.php';
include_once 'class/yogurt_images.php';
if (!$GLOBALS['xoopsSecurity']->check()) {
    redirect_header('index.php', 3, _MD_YOGURT_TOKENEXPIRED);
}
/**
* Creating the factory  loading the picture changing its caption
*/
$picture_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
$picture = $picture_factory->create(false);
$picture->load($_POST['cod_img']);
$uid = intval($xoopsUser->getVar('uid'));
$image = XOOPS_ROOT_PATH . '/uploads/' . 'thumb_' . $picture->getVar('url');
$avatar = 'av' . $uid . '_' . time() . '.jpg';
$imageavatar = XOOPS_ROOT_PATH . '/uploads/' . $avatar;
if (!copy($image, $imageavatar)) {
    echo 'failed to copy $file...\\n';
}
$xoopsUser->setVar('user_avatar', $avatar);
$userHandler = new XoopsUserHandler($xoopsDB);
/**
* Verifying who's the owner to allow changes
*/
if ($uid == $picture->getVar('uid_owner')) {
Exemple #4
0
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once '../../mainfile.php';
include_once '../../header.php';
include_once '../../class/criteria.php';
include_once 'class/yogurt_images.php';
if (!$GLOBALS['xoopsSecurity']->check()) {
    redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED);
}
$cod_img = $_POST['cod_img'];
/**
* Creating the factory  loading the picture changing its caption
*/
$picture_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
$picture = $picture_factory->create(false);
$picture->load($cod_img);
$picture->setVar('private', intval($_POST['private']));
/**
* Verifying who's the owner to allow changes
*/
$uid = intval($xoopsUser->getVar('uid'));
if ($uid == $picture->getVar('uid_owner')) {
    if ($picture_factory->insert($picture)) {
        if ($_POST['private'] == 1) {
            redirect_header('album.php', 2, _MD_YOGURT_PRIVATIZED);
        } else {
            redirect_header('album.php', 2, _MD_YOGURT_UNPRIVATIZED);
        }
    } else {
Exemple #5
0
include_once '../../mainfile.php';
include_once '../../header.php';
include_once '../../class/criteria.php';
include_once 'class/yogurt_images.php';
if (!$GLOBALS['xoopsSecurity']->check()) {
    redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED);
}
$cod_img = $_POST['cod_img'];
if (!isset($_POST['confirm']) || $_POST['confirm'] != 1) {
    xoops_confirm(array('cod_img' => $cod_img, 'confirm' => 1), 'delpicture.php', _MD_YOGURT_ASKCONFIRMDELETION, _MD_YOGURT_CONFIRMDELETION);
} else {
    /**
     * Creating the factory  and the criteria to delete the picture
     * The user must be the owner
     */
    $album_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
    $criteria_img = new Criteria('cod_img', $cod_img);
    $uid = intval($xoopsUser->getVar('uid'));
    $criteria_uid = new Criteria('uid_owner', $uid);
    $criteria = new CriteriaCompo($criteria_img);
    $criteria->add($criteria_uid);
    $objects_array = $album_factory->getObjects($criteria);
    $image_name = $objects_array[0]->getVar('url');
    $avatar_image = $xoopsUser->getVar('user_avatar');
    /**
     * Try to delete  
     */
    if ($album_factory->deleteAll($criteria)) {
        if ($xoopsModuleConfig['physical_delete'] == 1) {
            //unlink($xoopsModuleConfig['path_upload']."\/".$image_name);
            unlink(XOOPS_ROOT_PATH . '/uploads' . '/' . $image_name);
Exemple #6
0
    /**
     * Verifying who's the owner to allow changes
     */
    if ($uid == $picture->getVar('uid_owner')) {
        if ($picture_factory->insert($picture)) {
            redirect_header('album.php', 2, _MD_YOGURT_DESC_EDITED);
        } else {
            redirect_header('album.php', 2, _MD_YOGURT_NOCACHACA);
        }
    }
}
/**
* Creating the factory  and the criteria to edit the desc of the picture
* The user must be the owner
*/
$album_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
$criteria_img = new Criteria('cod_img', $cod_img);
$criteria_uid = new Criteria('uid_owner', $uid);
$criteria = new CriteriaCompo($criteria_img);
$criteria->add($criteria_uid);
/**
* Lets fetch the info of the pictures to be able to render the form
* The user must be the owner
*/
if ($array_pict = $album_factory->getObjects($criteria)) {
    $caption = $array_pict[0]->getVar('title');
    $url = $array_pict[0]->getVar('url');
}
//$url = $xoopsModuleConfig['link_path_upload']."/thumb_".$url;
$url = XOOPS_URL . '/uploads/thumb_' . $url;
$album_factory->renderFormEdit($caption, $cod_img, $url);