Esempio n. 1
0
 function replace_post()
 {
     $id = assert_int(gps('id'));
     $rs = safe_row("*", "txp_image", "id = {$id}");
     if ($rs) {
         $meta = array('category' => $rs['category'], 'caption' => $rs['caption'], 'alt' => $rs['alt']);
     } else {
         $meta = '';
     }
     $img_result = image_data($_FILES['thefile'], $meta, $id);
     if (is_array($img_result)) {
         list($message, $id) = $img_result;
         $this->_message($message);
     } else {
         $this->_error($img_result);
     }
     $this->_set_view('edit', $id);
 }
Esempio n. 2
0
function image_replace()
{
    global $txpcfg, $extensions, $txp_user;
    extract($txpcfg);
    $id = assert_int(gps('id'));
    $rs = safe_row("*", "txp_image", "id = {$id}");
    if (!has_privs('image.edit') && !($rs['author'] === $txp_user && has_privs('image.edit.own'))) {
        image_list(gTxt('restricted_area'));
        return;
    }
    if ($rs) {
        $meta = array('category' => $rs['category'], 'caption' => $rs['caption'], 'alt' => $rs['alt']);
    } else {
        $meta = '';
    }
    $img_result = image_data($_FILES['thefile'], $meta, $id);
    if (is_array($img_result)) {
        list($message, $id) = $img_result;
        return image_edit($message, $id);
    } else {
        return image_edit(array($img_result, E_ERROR), $id);
    }
}
 /**
  * Insert Image and create thumbnail
  * @param  array $file 	$_FILES['Filedata']
  * @param  array  $meta Meta data for image
  * @return mixed       	image dat (array) on success, error message (string) on failure
  */
 private function create_image($file, $meta = array('category' => '', 'caption' => '', 'alt' => ''))
 {
     global $path_to_site, $img_dir, $txp_user;
     $txp_user = empty($txp_user) ? gps('_jbx_user') : $txp_user;
     $event = '';
     // satisfies txp_image use of $event global
     include_once txpath . '/include/txp_image.php';
     return image_data($file, $meta);
 }
Esempio n. 4
0
function image_replace()
{
    global $txpcfg, $extensions, $txp_user;
    extract($txpcfg);
    $id = gps('id');
    $img_result = image_data($_FILES['thefile'], '', $id);
    if (is_array($img_result)) {
        list($message, $id) = $img_result;
        return image_edit($message, $id);
    } else {
        return image_list($img_result);
    }
}
Esempio n. 5
0
function image_replace()
{
    global $txpcfg, $extensions, $txp_user;
    extract($txpcfg);
    $id = assert_int(gps('id'));
    $rs = safe_row("*", "txp_image", "id = {$id}");
    if ($rs) {
        $meta = array('category' => $rs['category'], 'caption' => $rs['caption'], 'alt' => $rs['alt']);
    } else {
        $meta = '';
    }
    $img_result = image_data($_FILES['thefile'], $meta, $id);
    if (is_array($img_result)) {
        list($message, $id) = $img_result;
        return image_edit($message, $id);
    } else {
        return image_list($img_result);
    }
}