Example #1
0
     $array['from'] = userid();
     $cbpm->send_pm($array);
     if (error()) {
         $errors = error_list();
         $response = array('error' => $errors[0]);
     }
     if (msg()) {
         $success = msg_list();
         $response = array('success' => $success[0]);
     }
     echo json_encode($response);
     break;
 case 'delete_photo':
     $id = mysql_clean($_POST['id']);
     $photo = $cbphoto->get_photo($id);
     $item = get_collection_item($photo['collection_id'], $photo['photo_id']);
     $redirect_to = $cbcollection->get_next_prev_item($item['ci_id'], $item['collection_id'], 'next');
     $response = array('success' => true, 'redirect_to' => $cbphoto->photo_links($redirect_to[0], 'view_photo'));
     /* Delete photo */
     $cbphoto->delete_photo($id);
     if (error()) {
         $response = array('error' => error());
     }
     echo json_encode($response);
     break;
 case "inline_exif_setting":
     $pid = mysql_clean($_POST['pid']);
     $val = $_POST['exif'];
     if (empty($pid) || !$cbphoto->photo_exists($pid)) {
         $response = array('error' => lang('Photo does not exist'));
     }
/**
 * Output a collection item
 *
 * This will output the item requested. 
 * items are parsed for PHP within them if not $raw
 * Will only return the first component matching $id
 *
 * @since 3.4
 *
 * @param string $id This is the ID of the component you want to display
 * @param bool $force Force return of inactive components
 * @param bool $raw do not process php
 */
function output_collection_item($id, $collection, $force = false, $raw = false)
{
    $item = get_collection_item($id, $collection);
    if (!$item) {
        return;
    }
    $disabled = (bool) (string) $item->disabled;
    if ($disabled && !$force) {
        return;
    }
    if (!$raw) {
        eval("?>" . strip_decode($item->value) . "<?php ");
    } else {
        echo strip_decode($item->value);
    }
}