function ciniki_conferences_roomUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'room_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Conference Room'), 'conference_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Conference'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'sequence' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Order'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess'); $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.roomUpdate'); if ($rc['stat'] != 'ok') { return $rc; } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Conference Room in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.room', $args['room_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences'); // // Update the web index if enabled // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec'); ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.conferences.room', 'object_id' => $args['room_id'])); return array('stat' => 'ok'); }
function ciniki_conferences_presentationReviewUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'review_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Presentation Review'), 'conference_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Conference'), 'presentation_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Presentation'), 'customer_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Reviewer'), 'vote' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Vote'), 'notes' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Notes'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess'); $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.presentationReviewUpdate'); if ($rc['stat'] != 'ok') { return $rc; } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Presentation Review in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.presentationreview', $args['review_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences'); return array('stat' => 'ok'); }
function ciniki_library_itemUpdateReviews($ciniki, $business_id, $item_id) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryIDTree'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); // // Get the existing ratings and employees // $strsql = "SELECT ciniki_business_users.user_id, " . "IFNULL(ciniki_library_reviews.id, 0) AS review_id, " . "IFNULL(ciniki_library_reviews.rating, 0) AS rating " . "FROM ciniki_business_users " . "LEFT JOIN ciniki_library_reviews ON (" . "ciniki_business_users.user_id = ciniki_library_reviews.user_id " . "AND ciniki_library_reviews.item_id = '" . ciniki_core_dbQuote($ciniki, $item_id) . "' " . "AND ciniki_library_reviews.business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . ") " . "WHERE ciniki_business_users.business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "AND ciniki_business_users.status = 10 " . ""; $rc = ciniki_core_dbHashQueryIDTree($ciniki, $strsql, 'ciniki.customers', array(array('container' => 'employees', 'fname' => 'user_id', 'fields' => array('user_id', 'review_id', 'rating')))); if ($rc['stat'] != 'ok') { return $rc; } if (!isset($rc['employees'])) { return array('stat' => 'ok'); } $employees = $rc['employees']; // // Check the args for each employee rating // foreach ($employees as $user_id => $user) { $args = array(); if (isset($ciniki['request']['args']['user-' . $user_id . '-rating'])) { if ($ciniki['request']['args']['user-' . $user_id . '-rating'] != $user['rating']) { $args['rating'] = $ciniki['request']['args']['user-' . $user_id . '-rating']; } } if (count($args) > 0) { // // Update the review member // if ($user['review_id'] > 0) { $rc = ciniki_core_objectUpdate($ciniki, $business_id, 'ciniki.library.review', $user['review_id'], $args, 0x4); if ($rc['stat'] != 'ok') { return $rc; } } else { $args['item_id'] = $item_id; $args['user_id'] = $user_id; if (!isset($args['review'])) { $args['review'] = ''; } $rc = ciniki_core_objectAdd($ciniki, $business_id, 'ciniki.library.review', $args, 0x4); if ($rc['stat'] != 'ok') { return $rc; } } } } return array('stat' => 'ok'); }
function ciniki_library_itemUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'item_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Item'), 'item_type' => array('required' => 'no', 'blank' => 'no', 'name' => 'Item Type'), 'item_format' => array('required' => 'no', 'blank' => 'no', 'name' => 'Format'), 'title' => array('required' => 'no', 'blank' => 'no', 'name' => 'Title'), 'permalink' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Permalink'), 'author_display' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Author Display'), 'author_sort' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Author Sort'), 'flags' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Options'), 'isbn' => array('required' => 'no', 'blank' => 'yes', 'name' => 'ISBN'), 'year' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Year'), 'location' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Location'), 'synopsis' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Synopsis'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'primary_image_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Image'), 'primary_image_caption' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Image Caption'), 'notes' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Notes'), 'purchased_date' => array('required' => 'no', 'blank' => 'yes', 'type' => 'date', 'name' => 'Purchased Date'), 'purchased_price' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Purchased Price'), 'purchased_place' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Purchased Place'), 'genres' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Genres'), 'tags' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Tags'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'library', 'private', 'checkAccess'); $rc = ciniki_library_checkAccess($ciniki, $args['business_id'], 'ciniki.library.itemUpdate'); if ($rc['stat'] != 'ok') { return $rc; } $strsql = "SELECT id, item_type, title, author_display " . "FROM ciniki_library_items " . "WHERE id = '" . ciniki_core_dbQuote($ciniki, $args['item_id']) . "' " . "AND business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.library', 'item'); if ($rc['stat'] != 'ok') { return $rc; } if (!isset($rc['item'])) { return array('stat' => 'fail', 'err' => array('code' => 'ciniki.library.7', 'msg' => 'Item not found')); } $item = $rc['item']; if (isset($args['title']) || isset($args['author_display'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); if (isset($args['author_display']) && isset($args['title'])) { $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['author_display'] . '-' . $args['title']); } elseif (isset($args['author_display'])) { $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['author_display'] . '-' . $item['title']); } elseif (isset($args['title'])) { $args['permalink'] = ciniki_core_makePermalink($ciniki, $item['author_display'] . '-' . $args['title']); } else { return array('stat' => 'fail', 'err' => array('code' => 'ciniki.library.8', 'msg' => 'Unable to determine permalink.')); } // // Make sure the permalink is unique // $strsql = "SELECT id, title, permalink FROM ciniki_library_items " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND item_type = '" . ciniki_core_dbQuote($ciniki, $item['item_type']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['item_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.library', 'item'); if ($rc['stat'] != 'ok') { return $rc; } if ($rc['num_rows'] > 0) { return array('stat' => 'fail', 'err' => array('code' => 'ciniki.library.9', 'msg' => 'You already have a item with this name, please choose another name')); } } // // Turn off autocommit // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.library'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the item // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.library.item', $args['item_id'], $args); if ($rc['stat'] != 'ok') { return $rc; } // // Update the genres // if (isset($args['genres'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate'); $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.library', 'tag', $args['business_id'], 'ciniki_library_tags', 'ciniki_library_history', 'item_id', $args['item_id'], 20, $args['genres']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.library'); return $rc; } } // // Update the tags // if (isset($args['tags'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate'); $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.library', 'tag', $args['business_id'], 'ciniki_library_tags', 'ciniki_library_history', 'item_id', $args['item_id'], 40, $args['tags']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.library'); return $rc; } } // // Update the reviews/ratings // if (($ciniki['business']['modules']['ciniki.library']['flags'] & 0x8) > 0) { ciniki_core_loadMethod($ciniki, 'ciniki', 'library', 'private', 'itemUpdateReviews'); $rc = ciniki_library_itemUpdateReviews($ciniki, $args['business_id'], $args['item_id']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.library'); return $rc; } } // // Commit the database changes // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.library'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'library'); return array('stat' => 'ok'); }
function ciniki_artistprofiles_linkUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'link_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Link'), 'artist_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Artist'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'url' => array('required' => 'no', 'blank' => 'no', 'name' => 'URL'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'checkAccess'); $rc = ciniki_artistprofiles_checkAccess($ciniki, $args['business_id'], 'ciniki.artistprofiles.linkUpdate'); if ($rc['stat'] != 'ok') { return $rc; } // // Check for link type // if (isset($args['url'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'linkType'); $rc = ciniki_artistprofiles_linkType($ciniki, $args['business_id'], $args['url']); if ($rc['stat'] != 'ok') { return $rc; } $args['link_type'] = $rc['link_type']; } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.artistprofiles'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Link in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.artistprofiles.link', $args['link_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.artistprofiles'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'artistprofiles'); return array('stat' => 'ok'); }
function ciniki_artistprofiles_artistUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'artist_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Artist'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'subname' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Sub Name'), 'sort_name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Sort Name'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'status' => array('required' => 'no', 'blank' => 'no', 'name' => 'Status'), 'flags' => array('required' => 'no', 'blank' => 'no', 'name' => 'Options'), 'primary_image_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Primary Image'), 'primary_image_caption' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Primary Image Caption'), 'synopsis' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Synopsis'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'setup_image_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Setup Image'), 'setup_image_caption' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Setup Image Caption'), 'setup_description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'categories' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Categories'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'checkAccess'); $rc = ciniki_artistprofiles_checkAccess($ciniki, $args['business_id'], 'ciniki.artistprofiles.artistUpdate'); if ($rc['stat'] != 'ok') { return $rc; } if (isset($args['name'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['name']); // // Make sure the permalink is unique // $strsql = "SELECT id, name, permalink " . "FROM ciniki_artistprofiles " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['artist_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.events', 'event'); if ($rc['stat'] != 'ok') { return $rc; } if ($rc['num_rows'] > 0) { return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2889', 'msg' => 'You already have an artist with this name, please choose another name')); } } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.artistprofiles'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Artist in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.artistprofiles.artist', $args['artist_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } // // Update the categories // if (isset($args['categories'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate'); $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.artistprofiles', 'tag', $args['business_id'], 'ciniki_artistprofiles_tags', 'ciniki_artistprofiles_history', 'artist_id', $args['artist_id'], 10, $args['categories']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.artistprofiles'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'artistprofiles'); // // Update the web index if enabled // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec'); ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.artistprofiles.artist', 'object_id' => $args['artist_id'])); return array('stat' => 'ok'); }
function ciniki_merchandise_imageUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'productimage_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Image'), 'product_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Product'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'sequence' => array('required' => 'no', 'blank' => 'no', 'name' => 'Sequence'), 'flags' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Options'), 'image_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Image'), 'description' => array('required' => 'no', 'blank' => 'no', 'name' => 'Description'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'merchandise', 'private', 'checkAccess'); $rc = ciniki_merchandise_checkAccess($ciniki, $args['business_id'], 'ciniki.merchandise.imageUpdate'); if ($rc['stat'] != 'ok') { return $rc; } if (isset($args['name'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['name']); // // Make sure the permalink is unique // $strsql = "SELECT id, name, permalink " . "FROM ciniki_merchandise_images " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['productimage_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'item'); if ($rc['stat'] != 'ok') { return $rc; } if ($rc['num_rows'] > 0) { return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.9', 'msg' => 'You already have an image with this name, please choose another.')); } } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.merchandise'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Image in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.merchandise.image', $args['productimage_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.merchandise'); return $rc; } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.merchandise'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'merchandise'); // // Update the web index if enabled // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec'); ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.merchandise.image', 'object_id' => $args['productimage_id'])); return array('stat' => 'ok'); }
function ciniki_conferences_conferenceUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'conference_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Conference'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'permalink' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Permalink'), 'status' => array('required' => 'no', 'blank' => 'no', 'name' => 'Status'), 'flags' => array('required' => 'no', 'blank' => 'no', 'name' => 'Flags'), 'start_date' => array('required' => 'no', 'blank' => 'no', 'type' => 'date', 'name' => 'Start Date'), 'end_date' => array('required' => 'no', 'blank' => 'no', 'type' => 'date', 'name' => 'End Date'), 'synopsis' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Synopsis'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'imap_mailbox' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Mailbox'), 'imap_username' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Username'), 'imap_password' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Password'), 'imap_subject' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Subject'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess'); $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.conferenceUpdate'); if ($rc['stat'] != 'ok') { return $rc; } // // Setup permalink // if (isset($args['name'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['name']); // // Check the permalink doesn't already exist // $strsql = "SELECT id " . "FROM ciniki_conferences " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['conference_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'conference'); if ($rc['stat'] != 'ok') { return $rc; } if ($rc['num_rows'] > 0) { return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2838', 'msg' => 'You already have a conference with this name, please choose another name.')); } } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Conference in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.conference', $args['conference_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences'); return array('stat' => 'ok'); }
function ciniki_merchandise_productUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'product_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Merchandise Product'), 'code' => array('required' => 'no', 'blank' => 'yes', 'trimblanks' => 'yes', 'name' => 'Product Code'), 'name' => array('required' => 'no', 'blank' => 'no', 'trimblanks' => 'yes', 'name' => 'Product Name'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'status' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Status'), 'sequence' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Sequence'), 'flags' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Options'), 'unit_amount' => array('required' => 'no', 'blank' => 'no', 'type' => 'currency', 'name' => 'Price'), 'unit_discount_amount' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Discount Amount'), 'unit_discount_percentage' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Discount Percentage'), 'taxtype_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Tax Type'), 'inventory' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Inventory'), 'shipping_other' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Shipping Cost Other'), 'shipping_CA' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Shipping Canada'), 'shipping_US' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Shipping USA'), 'primary_image_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Image'), 'synopsis' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Synopsis'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'categories' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Categories'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'merchandise', 'private', 'checkAccess'); $rc = ciniki_merchandise_checkAccess($ciniki, $args['business_id'], 'ciniki.merchandise.productUpdate'); if ($rc['stat'] != 'ok') { return $rc; } // // Check if product already exists // $strsql = "SELECT id, code, name " . "FROM ciniki_merchandise " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND id = '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'product'); if ($rc['stat'] != 'ok') { return $rc; } if (!isset($rc['product'])) { return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.20', 'msg' => 'That product does not exist.')); } $product = $rc['product']; // // Check to make sure code is unique // if (isset($args['code'])) { $strsql = "SELECT id, code, permalink " . "FROM ciniki_merchandise " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND code = '" . ciniki_core_dbQuote($ciniki, $args['code']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'item'); if ($rc['stat'] != 'ok') { return $rc; } if ($rc['num_rows'] > 0) { return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.21', 'msg' => 'You already have a product with that code, please choose another.')); } } if (isset($args['name']) || isset($args['code'])) { if (ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x1)) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); $args['permalink'] = ciniki_core_makePermalink($ciniki, (isset($args['code']) ? $args['code'] : $product['code']) . '-' . isset($args['name']) ? $args['name'] : $product['name']); } else { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); $args['permalink'] = ciniki_core_makePermalink($ciniki, isset($args['name']) ? $args['name'] : $product['name']); } // // Make sure the permalink is unique // $strsql = "SELECT id, code, name, permalink " . "FROM ciniki_merchandise " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'item'); if ($rc['stat'] != 'ok') { return $rc; } if ($rc['num_rows'] > 0) { return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.22', 'msg' => 'You already have an merchandise product with this name, please choose another.')); } } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.merchandise'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Merchandise Product in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.merchandise.product', $args['product_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.merchandise'); return $rc; } // // Update the categories // if (isset($args['categories'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate'); $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.merchandise', 'tag', $args['business_id'], 'ciniki_merchandise_tags', 'ciniki_merchandise_history', 'product_id', $args['product_id'], 10, $args['categories']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.merchandise'); return $rc; } } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.merchandise'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'merchandise'); // // Update the web index if enabled // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec'); ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.merchandise.product', 'object_id' => $args['product_id'])); return array('stat' => 'ok'); }
function ciniki_conferences_CFPLogUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'cfplog_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'CFP Log'), 'conference_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Conference'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'url' => array('required' => 'no', 'blank' => 'yes', 'name' => 'URL'), 'email' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Email'), 'sent_date' => array('required' => 'no', 'blank' => 'yes', 'type' => 'date', 'name' => 'Date'), 'notes' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Notes'), 'categories' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Categories'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess'); $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.CFPLogUpdate'); if ($rc['stat'] != 'ok') { return $rc; } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the CFP Log in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.cfplog', $args['cfplog_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } // // Update the categories // if (isset($args['categories'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate'); $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.conferences', 'cfplogtag', $args['business_id'], 'ciniki_conferences_cfplog_tags', 'ciniki_conferences_history', 'cfplog_id', $args['cfplog_id'], 10, $args['categories']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences'); return array('stat' => 'ok'); }
function ciniki_artistprofiles_dropboxDownloadLinks(&$ciniki, $business_id, $client, $artist, $details) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dropboxOpenWebloc'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'linkType'); foreach ($details as $link) { $name = ''; $url = ''; $description = ''; if (preg_match('/^.*\\/([^\\/]*)\\.webloc$/', $link['filename'], $matches)) { $name = $matches[1]; $rc = ciniki_core_dropboxOpenWebloc($ciniki, $business_id, $client, $link['path']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } $url = $rc['url']; } if ($url != '') { $found = 'no'; $found_link = null; $link_type = 1000; $rc = ciniki_artistprofiles_linkType($ciniki, $business_id, $url); if ($rc['stat'] != 'ok') { return $rc; } $link_type = $rc['link_type']; foreach ($artist['links'] as $artist_link) { if ($artist_link['url'] == $url && $artist_link['link_type'] == $link_type) { $found = 'yes'; $found_link = $artist_link; break; } } if (isset($artist['videos'])) { foreach ($artist['videos'] as $artist_link) { if ($artist_link['url'] == $url && $artist_link['link_type'] == $link_type) { $found = 'yes'; $found_link = $artist_link; break; } } } if ($found == 'no') { $rc = ciniki_core_objectAdd($ciniki, $business_id, 'ciniki.artistprofiles.link', array('artist_id' => $artist['id'], 'name' => $name, 'link_type' => $link_type, 'url' => $url, 'description' => $description), 0x4); if ($rc['stat'] != 'ok' && $rc['stat'] != 'exists') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } } elseif ($found == 'yes') { $update_args = array(); if ($found_link['url'] != $url) { $update_args['url'] = $url; } if ($found_link['name'] != $name) { $update_args['name'] = $name; } if (count($update_args) > 0) { $rc = ciniki_core_objectUpdate($ciniki, $business_id, 'ciniki.artistprofiles.link', $found_link['id'], $update_args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } } } } } return array('stat' => 'ok'); }
function ciniki_artistprofiles_dropboxDownload(&$ciniki, $business_id) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUUID'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbInsert'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'images', 'private', 'insertFromDropbox'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dropboxParseRTFToText'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dropboxOpenTXT'); ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'artistLoad'); ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'dropboxDownloadImages'); ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'dropboxDownloadLinks'); // // Check to make sure the dropbox flag is enabled for this business // if (!isset($ciniki['business']['modules']['ciniki.artistprofiles']['flags']) || ($ciniki['business']['modules']['ciniki.artistprofiles']['flags'] & 0x1) == 0) { return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2857', 'msg' => 'Dropbox integration not enabled')); } // // Get the settings for artistprofiles // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDetailsQueryDash'); $rc = ciniki_core_dbDetailsQueryDash($ciniki, 'ciniki_artistprofiles_settings', 'business_id', $business_id, 'ciniki.artistprofiles', 'settings', ''); if ($rc['stat'] != 'ok') { return $rc; } if (!isset($rc['settings']['dropbox-artistprofiles']) || $rc['settings']['dropbox-artistprofiles'] == '') { return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2853', 'msg' => 'Dropbox artistprofiles not setup.')); } $artistprofiles = $rc['settings']['dropbox-artistprofiles']; if ($artistprofiles[0] != '/') { $artistprofiles = '/' . $artistprofiles; } rtrim($artistprofiles, '/'); $dropbox_cursor = null; if (isset($rc['settings']['dropbox-cursor']) && $rc['settings']['dropbox-cursor'] != '') { $dropbox_cursor = $rc['settings']['dropbox-cursor']; } // // Check if we should ignore the old cursor and start from scratch // if (isset($ciniki['config']['ciniki.artistprofiles']['ignore.cursor']) && ($ciniki['config']['ciniki.artistprofiles']['ignore.cursor'] == 1 || $ciniki['config']['ciniki.artistprofiles']['ignore.cursor'] == 'yes')) { $dropbox_cursor = null; } // // Get the settings for dropbox // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDetailsQueryDash'); $rc = ciniki_core_dbDetailsQueryDash($ciniki, 'ciniki_business_details', 'business_id', $business_id, 'ciniki.businesses', 'settings', 'apis'); if ($rc['stat'] != 'ok') { return $rc; } if (!isset($rc['settings']['apis-dropbox-access-token']) || $rc['settings']['apis-dropbox-access-token'] == '') { return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2854', 'msg' => 'Dropbox not configured.')); } $access_token = $rc['settings']['apis-dropbox-access-token']; $client = new dbx\Client($access_token, 'Ciniki'); // // Get the latest changes from Dropbox // $rc = $client->getDelta($dropbox_cursor, $artistprofiles); if (!isset($rc['entries'])) { // Nothing to update, return return array('stat' => 'ok'); } // If there is more $dropbox_cursor = $rc['cursor']; if (count($rc['entries']) == 0 && $rc['has_more'] == 1) { error_log('delta again'); $rc = $client->getDelta($dropbox_cursor, $artistprofiles); if (!isset($rc['entries'])) { // Nothing to update, return return array('stat' => 'ok'); } } $updates = array(); $new_dropbox_cursor = $rc['cursor']; $entries = $rc['entries']; foreach ($entries as $entry) { print_r($entry); if (!isset($entry[1]) || count($entry[1]) == 0) { print "skipping"; continue; } // // Entries look like: // [0] => /website/artists/canada/rivett-andrew/primary_image/img_0610.jpg // [1] => Array // ( // [rev] => 230d1f249e // [thumb_exists] => 1 // [path] => /website/artists/canada/rivett-andrew/primary_image/IMG_0610.jpg // [is_dir] => // [client_mtime] => Wed, 15 Jan 2014 13:37:06 +0000 // [icon] => page_white_picture // [read_only] => // [modifier] => // [bytes] => 114219 // [modified] => Sat, 14 Mar 2015 19:23:45 +0000 // [size] => 111.5 KB // [root] => dropbox // [mime_type] => image/jpeg // [revision] => 35 // ) // // Check for a match in the specified directory and path matches valid path list information // if (preg_match("#^({$artistprofiles})/([^/]+)/([^/]+)/(info.rtf|info.txt|(primary_image|synopsis|description|audio|images|links)/(.*))\$#", $entry[0], $matches)) { $sort_name = $matches[3]; if (!isset($updates[$sort_name])) { // Create an artist in updates, with the category permalink $updates[$sort_name] = array('category' => $matches[2]); } if (isset($matches[5])) { switch ($matches[5]) { case 'primary_image': if ($entry[1]['mime_type'] == 'image/jpeg') { $updates[$sort_name][$matches[5]] = array('path' => $entry[1]['path'], 'modified' => $entry[1]['modified'], 'mime_type' => $entry[1]['mime_type']); break; } elseif ($entry[1]['mime_type'] == 'text/plain') { $updates[$sort_name][$matches[5] . '_caption'] = array('path' => $entry[1]['path'], 'modified' => $entry[1]['modified'], 'mime_type' => $entry[1]['mime_type']); break; } case 'synopsis': case 'description': $updates[$sort_name][$matches[5]] = array('path' => $entry[1]['path'], 'modified' => $entry[1]['modified'], 'mime_type' => $entry[1]['mime_type']); break; case 'images': case 'audio': case 'links': if (!isset($updates[$sort_name][$matches[5]])) { $updates[$sort_name][$matches[5]] = array(); } $updates[$sort_name][$matches[5]][] = array('path' => $entry[0], 'filename' => $entry[1]['path'], 'modified' => $entry[1]['modified'], 'mime_type' => $entry[1]['mime_type']); break; } } elseif (isset($matches[4]) && $matches[4] == 'info.txt') { $updates[$sort_name]['info'] = array('path' => $entry[1]['path'], 'modified' => $entry[1]['modified'], 'mime_type' => $entry[1]['mime_type']); } } } // // Update Ciniki // foreach ($updates as $sort_name => $artist) { error_log("Updating: " . $sort_name); print_r($artist); // // Turn off autocommit // $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.artistprofiles'); if ($rc['stat'] != 'ok') { return $rc; } // // Lookup the artist in the artistprofiles // $permalink = ciniki_core_makePermalink($ciniki, $sort_name); $strsql = "SELECT id " . "FROM ciniki_artistprofiles " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $permalink) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.artistprofiles', 'artist'); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } // // Add artist // if (!isset($rc['artist']) && $rc['num_rows'] == 0) { // // Check permalink doesn't already exist // $strsql = "SELECT id, name " . "FROM ciniki_artistprofiles " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $permalink) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.artistprofiles', 'item'); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } if (isset($rc['num_rows']) && $rc['num_rows'] > 0) { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2855', 'msg' => 'Directory artist already exists for ' . $sort_name)); } // // Add the artist // $rc = ciniki_core_objectAdd($ciniki, $business_id, 'ciniki.artistprofiles.artist', array('name' => $sort_name, 'sort_name' => $sort_name, 'permalink' => $permalink, 'status' => '10', 'flags' => '0'), 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } $artist_id = $rc['id']; $ciniki_artist = array('id' => $artist_id, 'name' => $sort_name, 'subname' => '', 'sort_name' => $sort_name, 'permalink' => $permalink, 'status' => 10, 'flags' => 0, 'primary_image_id' => 0, 'primary_image_caption' => '', 'synopsis' => '', 'description' => '', 'setup_image_id' => 0, 'setup_image_caption' => '', 'setup_description' => '', 'audio' => array(), 'images' => array(), 'links' => array(), 'categories' => array()); } else { $artist_id = $rc['artist']['id']; ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'artistLoad'); $rc = ciniki_artistprofiles_artistLoad($ciniki, $business_id, $artist_id, array('images' => 'yes', 'audio' => 'yes', 'links' => 'yes', 'videos' => 'yes')); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } $ciniki_artist = $rc['artist']; } // // Decide what needs to be updated // $update_args = array(); // // Go through the updated items // foreach ($artist as $field => $details) { if ($field == 'info') { $content = ''; if ($details['mime_type'] == 'text/plain') { $rc = ciniki_core_dropboxOpenTXT($ciniki, $business_id, $client, $details['path']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } $content = $rc['content']; } elseif ($details['mime_type'] == 'application/rtf') { $rc = ciniki_core_dropboxParseRTFToText($ciniki, $business_id, $client, $details['path']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } $content = $rc['content']; } $lines = explode("\n", $content); foreach ($lines as $line) { $pieces = explode(":", $line); if (isset($pieces[1]) && stristr($pieces[0], 'subname') !== FALSE) { $subname = rtrim(ltrim($pieces[1])); if ($subname != $ciniki_artist['subname']) { $update_args['subname'] = $subname; } } elseif (isset($pieces[1]) && stristr($pieces[0], 'name') !== FALSE) { $name = rtrim(ltrim($pieces[1])); if ($name != $ciniki_artist['name']) { $update_args['name'] = $name; } } } } elseif ($field == 'primary_image' && $details['mime_type'] == 'image/jpeg') { print "image: " . $details['path'] . "\n"; $rc = ciniki_images_insertFromDropbox($ciniki, $business_id, $ciniki['session']['user']['id'], $client, $details['path'], 1, '', '', 'no'); if ($rc['stat'] != 'ok' && $rc['stat'] != 'exists') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } if ($rc['id'] != $ciniki_artist['primary_image_id']) { $update_args['primary_image_id'] = $rc['id']; } } elseif ($field == 'primary_image_caption' && $details['mime_type'] == 'text/plain') { print "image_caption: " . $details['path'] . "\n"; $rc = ciniki_core_dropboxOpenTXT($ciniki, $business_id, $client, $details['path']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } $content = $rc['content']; $lines = explode("\n", $content); foreach ($lines as $line) { $pieces = explode(":", $line); if (isset($pieces[1]) && stristr($pieces[0], 'caption') !== FALSE) { $name = rtrim(ltrim($pieces[1])); if ($name != $ciniki_artist['name']) { $update_args['primary_image_caption'] = $name; } } } } elseif ($field == 'setup_image' && $details['mime_type'] == 'image/jpeg') { $rc = ciniki_images_insertFromDropbox($ciniki, $business_id, $ciniki['session']['user']['id'], $client, $details['path'], 1, '', '', 'no'); if ($rc['stat'] != 'ok' && $rc['stat'] != 'exists') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } if ($rc['id'] != $ciniki_artist['setup_image_id']) { $update_args['setup_image_id'] = $rc['id']; } } elseif (($field == 'synopsis' || $field == 'description' || $field == 'setup_description') && $details['mime_type'] == 'application/rtf') { $rc = ciniki_core_dropboxParseRTFToText($ciniki, $business_id, $client, $details['path']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } if ($rc['content'] != $ciniki_artist[$field]) { $update_args[$field] = $rc['content']; } } elseif (($field == 'synopsis' || $field == 'description' || $field == 'setup_description') && $details['mime_type'] == 'text/plain') { $rc = ciniki_core_dropboxOpenTXT($ciniki, $business_id, $client, $details['path']); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } if ($rc['content'] != $ciniki_artist[$field]) { $update_args[$field] = $rc['content']; } } elseif ($field == 'images' || $field == 'setupimages') { $rc = ciniki_artistprofiles_dropboxDownloadImages($ciniki, $business_id, $client, $ciniki_artist, $details); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } } elseif ($field == 'links') { $rc = ciniki_artistprofiles_dropboxDownloadLinks($ciniki, $business_id, $client, $ciniki_artist, $details); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } } } // // Check categories // if (!in_array($artist['category'], $ciniki_artist['categories'])) { $permalink = ciniki_core_makePermalink($ciniki, $artist['category']); $rc = ciniki_core_objectAdd($ciniki, $business_id, 'ciniki.artistprofiles.tag', array('artist_id' => $artist_id, 'tag_type' => 10, 'tag_name' => $artist['category'], 'permalink' => $permalink), 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } } // // Update the artist // if (count($update_args) > 0) { $rc = ciniki_core_objectUpdate($ciniki, $business_id, 'ciniki.artistprofiles.artist', $artist_id, $update_args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } } // // Commit the changes // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.artistprofiles'); if ($rc['stat'] != 'ok') { return $rc; } } // // Update the dropbox cursor // $strsql = "INSERT INTO ciniki_artistprofiles_settings (business_id, detail_key, detail_value, date_added, last_updated) " . "VALUES ('" . ciniki_core_dbQuote($ciniki, $business_id) . "'" . ", '" . ciniki_core_dbQuote($ciniki, 'dropbox-cursor') . "'" . ", '" . ciniki_core_dbQuote($ciniki, $new_dropbox_cursor) . "'" . ", UTC_TIMESTAMP(), UTC_TIMESTAMP()) " . "ON DUPLICATE KEY UPDATE detail_value = '" . ciniki_core_dbQuote($ciniki, $new_dropbox_cursor) . "' " . ", last_updated = UTC_TIMESTAMP() " . ""; $rc = ciniki_core_dbInsert($ciniki, $strsql, 'ciniki.artistprofiles'); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles'); return $rc; } ciniki_core_dbAddModuleHistory($ciniki, 'ciniki.artistprofiles', 'ciniki_artistprofiles_history', $business_id, 2, 'ciniki_artistprofiles_settings', 'dropbox-cursor', 'detail_value', $new_dropbox_cursor); $ciniki['syncqueue'][] = array('push' => 'ciniki.artistprofiles.setting', 'args' => array('id' => 'dropbox-cursor')); return array('stat' => 'ok'); }
function ciniki_conferences_presentationUpdate(&$ciniki) { // // Find all the required and optional arguments // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs'); $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'presentation_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Presentation'), 'conference_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Conference'), 'customer_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Customer'), 'presentation_type' => array('required' => 'no', 'blank' => 'no', 'name' => 'Type'), 'status' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Status'), 'session_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Session'), 'registration' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Registration'), 'submission_date' => array('required' => 'no', 'blank' => 'no', 'type' => 'datetimetoutc', 'name' => 'Submission Date'), 'field' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Field of Study'), 'title' => array('required' => 'no', 'blank' => 'no', 'name' => 'Title'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'))); if ($rc['stat'] != 'ok') { return $rc; } $args = $rc['args']; // // Make sure this module is activated, and // check permission to run this function for this business // ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess'); $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.presentationUpdate'); if ($rc['stat'] != 'ok') { return $rc; } // // Check if item exists // $strsql = "SELECT id, customer_id, conference_id " . "FROM ciniki_conferences_presentations " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND id = '" . ciniki_core_dbQuote($ciniki, $args['presentation_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'item'); if ($rc['stat'] != 'ok') { return $rc; } if (!isset($rc['item'])) { return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3093', 'msg' => 'Presentation does not exist')); } $item = $rc['item']; // // Check permalink if title is updated // if (isset($args['title'])) { ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink'); $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['title']); // // Make sure the permalink is unique // $strsql = "SELECT id, title, permalink " . "FROM ciniki_conferences_presentations " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND conference_id = '" . ciniki_core_dbQuote($ciniki, isset($args['conference_id']) ? $args['conference_id'] : $item['conference_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['presentation_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'presentation'); if ($rc['stat'] != 'ok') { return $rc; } if ($rc['num_rows'] > 0) { return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3077', 'msg' => 'You already have a presentation with this title, please choose another title.')); } } // // Start transaction // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit'); ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory'); $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the Presentation in the database // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate'); $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.presentation', $args['presentation_id'], $args, 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } // // Check if registration set // if (isset($args['registration']) && $args['registration'] != '') { // // Check if customer already exists in attendees // $strsql = "SELECT id, conference_id, customer_id, status " . "FROM ciniki_conferences_attendees " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND conference_id = '" . ciniki_core_dbQuote($ciniki, $item['conference_id']) . "' " . "AND customer_id = '" . ciniki_core_dbQuote($ciniki, isset($args['customer_id']) ? $args['customer_id'] : $item['customer_id']) . "' " . ""; $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'item'); if ($rc['stat'] != 'ok') { return $rc; } $attendee = $rc['item']; if (!isset($rc['item'])) { // // Add the attendee // ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd'); $rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.conferences.attendee', array('conference_id' => $item['conference_id'], 'customer_id' => isset($args['customer_id']) ? $args['customer_id'] : $item['customer_id'], 'status' => $args['registration']), 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } $attendee_id = $rc['id']; } elseif ($attendee['status'] != $args['registration']) { // // Update the attendee // $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.attendee', $attendee['id'], array('status' => $args['registration']), 0x4); if ($rc['stat'] != 'ok') { ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences'); return $rc; } } } // // Commit the transaction // $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences'); if ($rc['stat'] != 'ok') { return $rc; } // // Update the last_change date in the business modules // Ignore the result, as we don't want to stop user updates if this fails. // ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate'); ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences'); return array('stat' => 'ok'); }