Esempio n. 1
1
 function set_cover_photo($pid, $cid, $myaccount = false)
 {
     global $db, $userquery, $cbphoto;
     if (!$this->collection_exists($cid)) {
         e(lang('collection_not_exists'));
         return false;
     }
     if (!$this->object_exists($pid)) {
         e(lang(sprintf('%s does not exist', $this->objType)));
         return false;
     }
     if (!$this->object_in_collection($pid, $cid)) {
         e(sprintf(lang("object_not_in_collect"), $this->objName));
         return false;
     }
     if (!$this->is_collection_owner($cid) || userid() != $cbphoto->get_photo_owner($pid)) {
         e(lang('cant_perform_action_collect'));
         return false;
     }
     $fields = tbl_fields(array('p' => get_photo_fields(), 'c' => get_collection_fields()));
     $query = ' SELECT ' . $fields . ' FROM ' . tbl('collections') . ' as c';
     $query .= " LEFT JOIN " . tbl('photos') . " as p ON c.collection_id = p.collection_id ";
     start_where();
     add_where(" c.collection_id = '{$cid}' ");
     add_where(" p.photo_id = '{$pid}' ");
     if (get_where()) {
         $query .= ' WHERE ' . get_where();
     }
     end_where();
     $result = db_select($query);
     if ($myaccount) {
         if ($result['is_avatar'] == 'yes' || $result['is_avatar_collection'] == 'yes') {
             return false;
         }
     }
     $cover_photo = json_decode($result['cover_photo'], true);
     if ($pid == $cover_photo['photo_id']) {
         $update = true;
     } else {
         //Create array so we can reduce one query per collection YOSH !!!
         $result = $result[0];
         $cover_photo['photo_id'] = $result['photo_id'];
         $cover_photo['photo_key'] = $result['photo_key'];
         $cover_photo['filename'] = $result['filename'];
         $cover_photo['ext'] = $result['ext'];
         $cover_photo['is_collection_cover'] = true;
         // This flag will help us make a query to get is_mature for cover photo while displaying
         $jecp = json_encode($cover_photo);
         $field = array('cover_photo' => $jecp);
         $update = db_update(tbl('collections'), $field, " collection_id = '" . $result['collection_id'] . "' ");
     }
     if ($update) {
         return $cover_photo;
     } else {
         return false;
     }
 }
 function update($id_detail)
 {
     $data = array('id_detail' => $this->input->post('id_detail', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'id_barang' => $this->input->post('id_barang', TRUE), 'id_satuan' => $this->input->post('id_satuan', TRUE), 'jumlah' => $this->input->post('jumlah', TRUE), 'jumlah_baru' => $this->input->post('jumlah_baru', TRUE), 'id_mitra' => $this->input->post('id_mitra', TRUE), 'id_kandang' => $this->input->post('id_kandang', TRUE), 'user_id' => userid(), 'datetime' => now());
     $this->db->where('id_detail', $id_detail);
     $this->db->update('penyesuaian_detail', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
 function update($id)
 {
     $data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'tgl' => $this->input->post('tgl', TRUE), 'tgl_kedaluarsa' => $this->input->post('tgl_kedaluarsa', TRUE), 'tgl_terima' => $this->input->post('tgl_terima', TRUE), 'id_customer' => $this->input->post('id_customer', TRUE), 'id_sales' => $this->input->post('id_sales', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'ref' => $this->input->post('ref', TRUE), 'id_bayar' => $this->input->post('id_bayar', TRUE), 'totalbayar' => $this->input->post('total', TRUE), 'pajak' => $this->input->post('pajak', TRUE), 'total_pajak' => $this->input->post('total_pajak', TRUE), 'grandtotal' => $this->input->post('grandtotal', TRUE), 'uangmuka' => $this->input->post('uangmuka', TRUE), 'sisa' => $this->input->post('sisa', TRUE), 'biaya_lain' => $this->input->post('biayakirim', TRUE), 'status' => $this->input->post('status', TRUE), 'id_user' => userid(), 'datetime' => now());
     $this->db->where('id', $id);
     $this->db->update('sales_order', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
 function update($id)
 {
     $data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'faktur_reff' => $this->input->post('faktur_reff', TRUE), 'faktur_po' => $this->input->post('faktur_po', TRUE), 'id_customer' => $this->input->post('id_customer', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'tanggal_kirim' => $this->input->post('tanggal_kirim', TRUE), 'kirim_via' => $this->input->post('kirim_via', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'alamat_kirim' => $this->input->post('alamat_kirim', TRUE), 'alamat_tagihan' => $this->input->post('alamat_tagihan', TRUE), 'biaya_id' => $this->input->post('biaya_id', TRUE), 'biaya_kirim' => $this->input->post('biaya_kirim', TRUE), 'armada_id' => $this->input->post('armada_id', TRUE), 'is_approved' => $this->input->post('is_approved', TRUE), 'user_id' => userid(), 'datetime' => now());
     $this->db->where('id', $id);
     $this->db->update('delivery_order', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
function confirm_collection_type($type)
{
    global $cbcollection;
    if (empty($type)) {
        $type = 'photos';
    }
    if ($type != $cbcollection->types) {
        if (VERSION < '3.0') {
            // Get Deprecated Types;
            $dep_types = $cbcollection->deprecated_types;
            $message = 'Collections feature now only support photos';
            if (array_key_exists($type, $dep_types)) {
                $message .= '. ' . $cbcollection->deprecated_types[$type] . ' support has been dropped since 2.6';
                $dep_type = $cbcollection->deprecated_types[$type] . ' ';
            }
            if (userid() && has_access('admin_access', true)) {
                $message .= '. Please upgrade your Clipbucket to <a href="http://clip-bucket.com" target="_blank">latest version</a>';
            } else {
                $message .= '. Please contact Site Administrator about this.';
            }
            e(lang($message));
            cb_show_page();
        }
        return $cbcollection->types;
    }
    return $cbcollection->types;
}
 function update($id)
 {
     $data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'faktur_reff' => $this->input->post('faktur_reff', TRUE), 'faktur_do' => $this->input->post('faktur_do', TRUE), 'id_supplier' => $this->input->post('id_supplier', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'tanggal_terima' => $this->input->post('tanggal_terima', TRUE), 'kirim_via' => $this->input->post('kirim_via', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'alamat_terima' => $this->input->post('alamat_terima', TRUE), 'id_cabang' => $this->input->post('id_cabang', TRUE), 'id_mitra' => $this->input->post('id_mitra', TRUE), 'id_kandang' => $this->input->post('id_kandang', TRUE), 'id_gudang' => $this->input->post('id_gudang', TRUE), 'nopol_pengirim' => $this->input->post('nopol_pengirim', TRUE), 'nama_pengirim' => $this->input->post('nama_pengirim', TRUE), 'is_approved' => $this->input->post('is_approved', TRUE), 'user_id' => userid(), 'datetime' => now());
     $this->db->where('id', $id);
     $this->db->update('receive_item', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
Esempio n. 7
0
/**
 * Scale & crops a screen image
 * @param id - screen id
 * @param viewport - dimension (width, height) and position (x,y) of the viewport
 * @param dimension - target dimension (width, height)
 * @param path - target path
 * @return void
 */
function cropScreen($id, $viewport, $dimension, $path)
{
    global $db;
    $w = $dimension['width'];
    $h = $dimension['height'];
    $screen = $db->single("SELECT id, project, type, ext FROM screen WHERE id = '" . $id . "' AND (embeddable = 'TRUE' or creator = '" . userid() . "') LIMIT 1");
    if (!$screen) {
        die;
    }
    $filename = UPLOAD . 'screens/' . $screen['project'] . '/' . md5($screen['id'] . config('security.general.hash')) . '.' . $screen['ext'];
    $target = TERRIFIC . $path;
    if (!is_file($target)) {
        if (!is_dir(dirname($target))) {
            @mkdir(dirname($target), 0777, true);
        }
        $width = $viewport['width'];
        $height = $viewport['height'];
        $r = $width / $height;
        $newheight = $w / $r;
        $newwidth = $w;
        switch ($screen['type']) {
            case 'image/jpeg':
            case 'image/jpg':
                $src = imagecreatefromjpeg($filename);
                break;
            case 'image/png':
                $src = imagecreatefrompng($filename);
                break;
        }
        $dst = imagecreatetruecolor($newwidth, $newheight);
        imagecopyresampled($dst, $src, 0, 0, $viewport['x'], $viewport['y'], $newwidth, $newheight, $width, $height);
        imagepng($dst, $target);
    }
}
 function update($id)
 {
     $data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'faktur_reff' => $this->input->post('faktur_reff', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'id_gudang' => $this->input->post('id_gudang', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'akun' => $this->input->post('akun', TRUE), 'total_nilai' => $this->input->post('total_nilai', TRUE), 'user_id' => userid(), 'datetime' => now());
     $this->db->where('id', $id);
     $this->db->update('penyesuaian', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
 function update($id_detail)
 {
     $data = array('id_detail' => $this->input->post('id_detail', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'id_so' => $this->input->post('id_so', TRUE), 'id_barang' => $this->input->post('id_barang', TRUE), 'jumlah' => $this->input->post('jumlah', TRUE), 'id_satuan' => $this->input->post('id_satuan', TRUE), 'harga_jual' => $this->input->post('harga_jual', TRUE), 'diskon1' => $this->input->post('diskon1', TRUE), 'diskon2' => $this->input->post('diskon2', TRUE), 'diskon3' => $this->input->post('diskon3', TRUE), 'id_user' => userid(), 'datetime' => now());
     $this->db->where('id_detail', $id_detail);
     $this->db->update('sales_order_detail', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
 function update($id)
 {
     $data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'tanggal_tempo' => $this->input->post('tanggal_tempo', TRUE), 'id_mitra' => $this->input->post('id_mitra', TRUE), 'id_gudang' => $this->input->post('id_gudang', TRUE), 'id_kandang' => $this->input->post('id_kandang', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'catatan' => $this->input->post('catatan', TRUE), 'user_id' => userid(), 'is_approved' => $this->input->post('is_approved', TRUE), 'datetime' => now());
     $this->db->where('id', $id);
     $this->db->update('purchase_request', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
Esempio n. 11
0
function login()
{
    global $db;
    // load project permissions
    $owned_projects = $db->data("SELECT id FROM project WHERE creator = '" . userid() . "'");
    $projects = array();
    foreach ($owned_projects as $project) {
        $projects[$project['id']] = 'ADMIN';
    }
    $collaboration_projects = $db->data("SELECT project, permission FROM project_permission WHERE user = '******'");
    foreach ($collaboration_projects as $project) {
        $projects[$project['project']] = $project['permission'];
    }
    $_SESSION['user']['permissions']['project'] = $projects;
}
Esempio n. 12
0
 /**
  * Function used to replace content
  * of email template with variables
  * it can either be email subject or message content
  * @param : Content STRING 
  * @param : array ARRAY => array({somevar}=>$isvar)
  */
 function replace($content, $array)
 {
     //Common Varialbs
     $com_array = array('{website_title}' => TITLE, '{baseurl}' => BASEURL, '{website_url}' => BASEURL, '{date_format}' => cbdate(DATE_FORMAT), '{date}' => cbdate(), '{username}' => username(), '{userid}' => userid(), '{date_year}' => cbdate("Y"), '{date_month}' => cbdate("m"), '{date_day}' => cbdate("d"), '{signup_link}' => cblink(array('name' => 'signup')), '{login_link}' => cblink(array('name' => 'login')));
     if (is_array($array) && count($array) > 0) {
         $array = array_merge($com_array, $array);
     } else {
         $array = $com_array;
     }
     foreach ($array as $key => $val) {
         $var_array[] = '/' . $key . '/';
         $val_array[] = $val;
     }
     return preg_replace($var_array, $val_array, $content);
 }
Esempio n. 13
0
/**
 * Log activity.
 *
 * @param $title Activity title
 * @param $actor Actor ID
 * @param $actor_type Actor type
 * @param $verb Verb
 * @param $object Object ID
 * @param $object_type Object type
 * @param $target Target ID
 * @param $target_type Target type
 */
function activity_add($title, $actor, $actor_type, $actor_title, $verb, $object, $object_type, $object_title, $target = null, $target_type = null, $target_title = null)
{
    global $db;
    global $cache;
    // create activity object
    $activity = array('created' => date('Y-m-d H:i:s'), 'creator' => userid(), 'actor' => $actor, 'actor_type' => $actor_type, 'actor_title' => $actor_title, 'verb' => $verb, 'object' => $object, 'object_type' => $object_type, 'object_title' => $object_title, 'target' => $target, 'target_type' => $target_type, 'target_title' => $target_title, 'title' => $title);
    // log activity into database
    $id = $db->insert('activity', $activity);
    // cache activity in memcache
    $cache->set('activity.' . $id, $activity);
    // push activity into streams
    stream_activity_add($actor_type, $actor, $id);
    stream_activity_add($object_type, $object, $id);
    if ($target > 0) {
        stream_activity_add($target_type, $target, $id);
    }
}
Esempio n. 14
0
/**
 * Funcion used to call functions
 * when video is going to dwnload
 * ie in download.php
 */
function call_download_video_function($vdo)
{
    global $db;
    $funcs = get_functions('download_video_functions');
    if (is_array($funcs) && count($funcs) > 0) {
        foreach ($funcs as $func) {
            if (function_exists($func)) {
                $func($vdo);
            }
        }
    }
    //Updating Video Downloads
    $db->update(tbl("video"), array("downloads"), array("|f|downloads+1"), "videoid = '" . $vdo['videoid'] . "'");
    //Updating User Download
    if (userid()) {
        $db->update(tbl("users"), array("total_downloads"), array("|f|total_downloads+1"), "userid = '" . userid() . "'");
    }
}
Esempio n. 15
0
function is_playlist_viewable($list_id)
{
    if (is_array($list_id)) {
        $playlist = $list_id;
    } else {
        $playlist = get_playlist($list_id);
    }
    if (isset($playlist['playlist_id'])) {
        if ($playlist['privacy'] == 'private' and $playlist['userid'] != userid()) {
            e(lang('User has made this playlist private.'));
            return false;
        }
        $data = cb_do_action('is_playlist_viewable', array('playlist' => $playlist));
        if ($data) {
            return $data;
        }
        return true;
    }
    return true;
}
Esempio n. 16
0
 /**
  * Function used to create new page
  * @param ARRAY
  */
 function create_page($param)
 {
     global $db;
     $name = mysql_clean($param['page_name']);
     $title = mysql_clean($param['page_title']);
     $content = addslashes($param['page_content']);
     if (empty($name)) {
         e(lang("page_name_empty"));
     }
     if (empty($title)) {
         e(lang("page_title_empty"));
     }
     if (empty($content)) {
         e(lang("page_content_empty"));
     }
     if (!error()) {
         $db->insert(tbl($this->page_tbl), array("page_name", "page_title", "page_content", "userid", "date_added", "active"), array($name, $title, "|no_mc|" . $content, userid(), now(), "yes"));
         e(lang("new_page_added_successfully"), "m");
         return false;
     }
     return false;
 }
Esempio n. 17
0
<?php

/* 
 ***************************************************************
 | Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.						
 | @ Author : ArslanHassan													
 | @ Software : ClipBucket , © PHPBucket.com								
 ***************************************************************
*/
define("THIS_PAGE", "invite_group");
define("PARENT_PAGE", "groups");
require 'includes/config.inc.php';
$pages->page_redir();
$url = mysql_clean($_GET['url']);
$details = $cbgroup->group_details_url($url);
assign('group', $details);
if (!$cbgroup->is_owner($details)) {
    e(lang("you_cant_invite_mems"));
} else {
    if ($details) {
        assign('friends', $userquery->get_contacts(userid(), 0));
    }
    //Inviting Friends
    if (isset($_POST['invite_friends'])) {
        $cbgroup->invite_members($_POST['friend'], $details['group_id']);
    }
    assign('mode', "invite_group");
    template_files('view_group.html');
    subtitle(lang("grp_invite_msg"));
    display_it();
}
Esempio n. 18
0
<?php

if (userid() || $old_version < 2.3) {
    ?>

</div>
<div class="nav_des clearfix">
    <div class="cb_container">
    <h4 style="color:#fff;">Upgrading</h4>
    <p style="color:#fff; font-size:13px;">You are now going to upgrade from <?php 
    echo $old_version;
    ?>
 to <?php 
    echo VERSION;
    ?>
, please read <strong>
    <a href="http://docs.clip-bucket.com/clipbucket-docs/clipbucket-installation" style="color:#fff;text-decoration:underline;">this documentation</a></strong> for further info and help, please click continue upgrade
</p>



</div><!--cb_container-->
</div><!--nav_des-->


<div id="sub_container" >
<form name="installation" method="post" id="installation">
	<input type="hidden" name="mode" value="permission" />
    <div style="padding:10px 0px" align="right"><?php 
    echo button('Continue to upgrade!', ' onclick="$(\'#installation\').submit()" ');
    ?>
Esempio n. 19
0
         $userDetails = array();
         foreach ($uDetails as $ud) {
             $userDetails[$ud] = $userquery->udetails[$ud];
         }
         $userDetails['sess_id'] = $_COOKIE['PHPSESSID'];
         $userDetails['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($userDetails);
         exit(json_encode(array('status' => 'ok', 'userid' => $userquery->userid, 'sess_id' => $_COOKIE['PHPSESSID'], 'details' => $userDetails)));
     }
     break;
 case "getuser":
 case "check_auth":
 case "is_logged_in":
 case "checkauth":
 case "isloggedin":
     $userid = userid();
     if (!userid()) {
         exit(json_encode(array('status' => 'failed', 'msg' => 'User is not logged in', 'session' => $_COOKIE['PHPSESSID'])));
     } else {
         $uDetails = array('username', 'userid', 'email', 'total_videos', 'total_photos', 'total_collections', 'total_groups');
         $userDetails = array();
         foreach ($uDetails as $ud) {
             $userDetails[$ud] = $userquery->udetails[$ud];
         }
         $userDetails['sess_id'] = $_COOKIE['PHPSESSID'];
         $userDetails['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($userDetails);
         exit(json_encode($userDetails));
     }
     break;
 case "logout":
     $userquery->logout();
     if (cb_get_functions('logout')) {
Esempio n. 20
0
 * @author Arslan Hassan
 * @license AAL
 * @since 3.0 
 */
include '../includes/config.inc.php';
//Getting mode..
$mode = post('mode');
if (!$mode) {
    $mode = get('mode');
}
$mode = mysql_clean($mode);
switch ($mode) {
    case 'send_photo_pm':
        $array = $_POST;
        $array['is_pm'] = true;
        $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']);
Esempio n. 21
0
 /**
  * Function used to load head menu
  */
 function foot_menu($params = NULL)
 {
     global $cbpage;
     $this->foot_menu[] = array('name' => lang("menu_home"), 'link' => BASEURL, "this" => "home");
     $this->foot_menu[] = array('name' => lang("contact_us"), 'link' => cblink(array('name' => 'contact_us')), "this" => "home");
     if (userid()) {
         //$this->foot_menu[] = array('name' => lang("my_account"), 'link' => cblink(array('name' => 'my_account')), "this" => "home");
         $pages = $cbpage->get_pages(array('active' => 'yes', 'display_only' => 'yes', 'order' => 'page_order ASC'));
     }
     if ($pages) {
         foreach ($pages as $p) {
             $this->foot_menu[] = array('name' => $p['page_name'], 'link' => $cbpage->page_link($p), "this" => "home");
         }
     }
     //		if($cbpage->is_active(2))
     //			$this->foot_menu[] = array('name'=>lang("privacy_policy"),'link'=>$cbpage->get_page_link(2),"this"=>"home");
     //
     //		if($cbpage->is_active(3))
     //			$this->foot_menu[] = array('name'=>lang("terms_of_serivce"),'link'=>$cbpage->get_page_link(3),"this"=>"home");
     //
     //		if($cbpage->is_active(4))
     //			$this->foot_menu[] = array('name'=>lang("help"),'link'=>$cbpage->get_page_link(4),"this"=>"groups");
     //
     if ($params['assign']) {
         assign($params['assign'], $this->foot_menu);
     } else {
         return $this->foot_menu;
     }
 }
Esempio n. 22
0
/* 
 ***************************************************************
 | Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
 | @ Author	   : ArslanHassan									
 | @ Software  : ClipBucket , © PHPBucket.com					
 ***************************************************************
*/
define("THIS_PAGE", 'myaccount');
define("PARENT_PAGE", 'home');
require 'includes/config.inc.php';
$userquery->logincheck();
subtitle(lang("my_account"));
assign('user', $userquery->get_user_details(userid()));
global $db, $cbvid;
$videos = $cbvid->get_videos(array("userid" => userid(), "order" => "date_added DESC", "limit" => 15));
assign('videos', $videos);
$result_array['limit'] = $get_limit;
$result_array['user'] = $udetails["userid"];
$get_limit = create_query_limit($page, 5);
$videos = $cbvid->action->get_flagged_objects($get_limit);
Assign('flagedVideos', $videos);
$result_array['limit'] = $get_limit;
$result_array['user'] = $udetails["userid"];
$get_limit = create_query_limit($page, 5);
$photos = $cbphoto->action->get_flagged_objects($get_limit);
assign('flagedPhotos', $photos);
if (isset($_GET['delete_video'])) {
    $video = mysql_clean($_GET['delete_video']);
    $cbvideo->delete_video($video);
}
Esempio n. 23
0
 /**
  * Function used to get new messages
  */
 function get_new_messages($uid = NULL, $type = 'pm')
 {
     if (!$uid) {
         $uid = userid();
     }
     global $db;
     switch ($type) {
         case 'pm':
         default:
             $count = $db->count(tbl($this->tbl), "message_id", " message_to LIKE '%#{$uid}#%' AND message_box='in' AND message_type='pm' AND \tmessage_status='unread'");
             break;
         case 'notification':
         default:
             $count = $db->count(tbl($this->tbl), "message_id", " message_to LIKE '%#{$uid}#%' AND message_box='in' AND message_type='notification' AND message_status='unread'");
             break;
     }
     if ($count > 0) {
         return $count;
     } else {
         return "0";
     }
 }
Esempio n. 24
0
         if ($object_type) {
             $template = get_template('single_feed_' . $object_type);
         }
         if (!$template) {
             $template = get_template('single_feed');
         }
         $array = array('success' => 'ok', 'template' => $template, 'fid' => $fid);
         echo json_encode($array);
     } catch (Exception $e) {
         exit(json_encode(array('err' => array($e->getMessage()))));
     }
     break;
 case "get_notifications":
     $uid = mysql_clean(post('userid'));
     if (!$uid) {
         $uid = userid();
     }
     $notifications = $cbfeeds->get_notifications('unread');
     $updates = array();
     if ($notifications) {
         $total_new = 0;
         $the_notifications = array();
         $notification_template = '';
         foreach ($notifications as $notification) {
             $the_notifications['ids'][] = $notification['notification_id'];
             //Lets create a template and append to it..
             assign('notification', $notification);
             $notification_template .= get_template('notification_block');
             $total_new++;
         }
         $the_notifications['template'] = $notification_template;
Esempio n. 25
0
                $sql = sprintf("DELETE from point2 WHERE id=%d and owner=%d", $inp['id'], $owner_uid);
            } else {
                $sql = sprintf("DELETE from point2 WHERE id=%d", $inp['id']);
            }
            if (($rs = $db->Execute($sql)) === false) {
                $errmsg[] = "fail sql: {$sql}";
            }
            break;
    }
    if (count($errmsg) > 0) {
        $jTableResult = array();
        $jTableResult['Result'] = "ERROR";
        $jTableResult['Message'] = implode("|", $errmsg);
        print json_encode($jTableResult);
        return;
    }
    $jTableResult = array();
    $jTableResult['Result'] = "OK";
    if ($inp['action'] == 'create' || $inp['action'] == 'update') {
        $jTableResult['Record'] = $rs[0];
    } else {
        $jTableResult['Records'] = $rs;
    }
    print json_encode($jTableResult);
}
list($st, $uid) = userid();
if ($st === true) {
    pointcrud($_REQUEST, $uid, is_admin());
} else {
    header("Location: " . $site_html_root . "/login.php");
}
Esempio n. 26
0
/**
 * Get profile item of provided $uid, if null
 * current loggedin userid is used
 * 
 * @author Fawaz Tahir <*****@*****.**>
 * @param int $uid
 * @return array|boolean
 */
function get_profile_item($uid = null)
{
    if (is_null($uid)) {
        $uid = userid();
    }
    $query = "SELECT pro.profile_item FROM " . cb_sql_table('user_profile', 'pro');
    $query .= " WHERE pro.userid = '" . mysql_clean($uid) . "' ";
    $result = db_select($query);
    if ($result) {
        return $result[0];
    } else {
        return false;
    }
}
Esempio n. 27
0
 | Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
 | @ Author	   : ArslanHassan									
 | @ Software  : ClipBucket , © PHPBucket.com					
 *************************************************************
*/
define("THIS_PAGE", 'edit_group');
define("PARENT_PAGE", 'groups');
require 'includes/config.inc.php';
$userquery->logincheck();
$udetails = $userquery->get_user_details(userid());
assign('user', $udetails);
assign('p', $userquery->get_user_profile($udetails['userid']));
$gid = mysql_clean($_GET['group_id']);
//get group details
$gdetails = $cbgroup->get_group_details($gid);
$gArray = array('group' => $gdetails, 'groupid' => $gid, 'uid' => userid(), 'user' => $userquery->udetails, 'checkowner' => 'yes');
if (!$cbgroup->is_admin($gArray) && !has_access('admin_access', true)) {
    e(lang("you_cant_edit_group"));
    $Cbucket->show_page = false;
} else {
    //Updating Video Details
    if (isset($_POST['update_group'])) {
        $_POST['group_id'] = $gid;
        $cbgroup->update_group();
        $gdetails = $cbgroup->get_group_details($gid);
    }
    assign('group', $gdetails);
}
subtitle(lang("grp_edit_grp_title"));
template_files('edit_group.html');
display_it();
Esempio n. 28
0
 /**
  * update video broadcast option
  * 
  * @param INT videoid
  * @param STRING broadcast
  * 
  * @return BOOLEAN
  */
 function update_broadcast($vid, $brd)
 {
     if (!is_valid_broadcast($brd)) {
         e(lang('Invalid broadcast option'));
     } else {
         if ($this->is_video_owner($vid, userid()) || has_access('admin_access', TRUE)) {
             db_update(tbl('video'), array('broadcast' => mysql_clean($brd)), " videoid='{$vid}' ");
         } else {
             e(lang('You cannot update this video'), true);
         }
     }
 }
Esempio n. 29
0
        $font = array('created' => date('Y-m-d H:i:s'), 'creator' => userid(), 'screen' => $screen, 'x' => $x, 'y' => $y, 'size' => $font_size, 'family' => $font_family, 'color' => 1);
        $id = $db->insert('font', $font);
        $font['id'] = $id;
        header('Content-Type: application/json');
        echo json_encode($font);
        break;
    case API_FONT_GET:
        header('Content-Type: application/json');
        echo json_encode($result);
        break;
    case API_FONT_REMOVE:
        $id = intval($route[4]);
        if ($id < 1) {
            die('Please provide a color instance id');
        }
        $color = $db->single("\n            SELECT c.screen, c.color, s.project, pc.id \n            FROM color c \n                LEFT JOIN project_color pc ON pc.id = c.color \n                LEFT JOIN screen s ON s.id = c.screen \n            WHERE c.id = '" . $id . "' AND c.creator = '" . userid() . "'\n            LIMIT 1\n        ");
        if (!$color) {
            die;
        }
        $result = array();
        $db->delete('color', array('id' => $id));
        $count = $db->exists('color', array('color' => $color['color']));
        if ($count < 1) {
            $db->delete('project_color', array('id' => $color['id'], 'creator' => userid()));
            $result['remove'] = $color['id'];
        }
        $db->query("UPDATE screen SET count_color = count_color - 1 WHERE id = " . $color['screen'] . "");
        header('Content-Type: application/json');
        echo json_encode($result);
        break;
}
Esempio n. 30
0
<?php

/* 
 ***************************************************************
 | Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
 | @ Author   : ArslanHassan									
 | @ Software : ClipBucket , © PHPBucket.com					
 ***************************************************************
*/
define("THIS_PAGE", "create_group");
define("PARENT_PAGE", "groups");
require 'includes/config.inc.php';
$userquery->logincheck();
$pages->page_redir();
// Creating Group if button is pressed
if (isset($_POST['create_group'])) {
    $cbgroup->create_group($_POST, userid(), true);
}
subtitle(lang('grp_crt_grp'));
template_files('create_group.html');
display_it();