예제 #1
0
function ciniki_conferences_hooks_uiSettings($ciniki, $business_id, $args)
{
    //
    // Setup the default response
    //
    $rsp = array('stat' => 'ok', 'settings' => array(), 'menu_items' => array(), 'settings_menu_items' => array());
    //
    // Get the settings
    //
    $rc = ciniki_core_dbDetailsQueryDash($ciniki, 'ciniki_conferences_settings', 'business_id', $business_id, 'ciniki.conferences', 'settings', '');
    if ($rc['stat'] == 'ok' && isset($rc['settings'])) {
        $rsp['settings'] = $rc['settings'];
    }
    //
    // Check permissions for what menu items should be available
    //
    if (isset($ciniki['business']['modules']['ciniki.conferences']) && (isset($args['permissions']['owners']) || isset($args['permissions']['employees']) || isset($args['permissions']['resellers']) || ($ciniki['session']['user']['perms'] & 0x1) == 0x1)) {
        $menu_item = array('priority' => 6200, 'label' => 'Conference Manager', 'edit' => array('app' => 'ciniki.conferences.main'));
        $rsp['menu_items'][] = $menu_item;
    }
    if (isset($ciniki['business']['modules']['ciniki.conferences']) && (isset($args['permissions']['owners']) || isset($args['permissions']['resellers']) || ($ciniki['session']['user']['perms'] & 0x1) == 0x1)) {
        $rsp['settings_menu_items'][] = array('priority' => 6200, 'label' => 'Conferences', 'edit' => array('app' => 'ciniki.conferences.settings'));
    }
    return $rsp;
}
예제 #2
0
function ciniki_artistprofiles_web_subMenuItems(&$ciniki, $settings, $business_id, $args)
{
    if (!isset($ciniki['business']['modules']['ciniki.artistprofiles'])) {
        return array('stat' => '404', 'err' => array('pkg' => 'ciniki', 'code' => '3040', 'msg' => "I'm sorry, the file you requested does not exist."));
    }
    //
    // Return nothing if the page format doesn't have a submenu
    //
    if (isset($settings['page-artistprofiles-submenu']) && $settings['page-artistprofiles-submenu'] != 'yes') {
        return array('stat' => 'ok', 'submenu' => array());
    }
    $submenu = array();
    //
    // Check if Categories is enabled
    //
    if (ciniki_core_checkModuleFlags($ciniki, 'ciniki.artistprofiles', 0x100)) {
        //
        // Load the settings for categories
        //
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDetailsQueryDash');
        $rc = ciniki_core_dbDetailsQueryDash($ciniki, 'ciniki_artistprofiles_settings', 'business_id', $business_id, 'ciniki.artistprofiles', 'settings', 'tag-category');
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if (isset($rc['settings'])) {
            $psettings = $rc['settings'];
        } else {
            $psettings = array();
        }
        if (ciniki_core_checkModuleFlags($ciniki, 'ciniki.artistprofiles', 0x200)) {
            $submenu['featured'] = array('sequence' => 1, 'title' => 'Featured', 'sequence' => isset($psettings['tag-category-sequence-featured']) && $psettings['tag-category-sequence-featured'] != '' ? $psettings['tag-category-sequence-featured'] : 1, 'title' => isset($psettings['tag-category-title-featured']) && $psettings['tag-category-title-featured'] != '' ? $psettings['tag-category-title-featured'] : 'Featured', 'image_id' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-image-featured']) ? $psettings['tag-category-image-featured'] : '', 'content' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-content-featured']) ? $psettings['tag-category-content-featured'] : '', 'permalink' => 'featured');
        }
        //
        // Load the list of tags
        //
        $strsql = "SELECT DISTINCT tag_name, permalink " . "FROM ciniki_artistprofiles_tags " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "AND tag_type = 10 " . "";
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.artistprofiles', 'category');
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if (isset($rc['rows'])) {
            $categories = $rc['rows'];
            foreach ($categories as $cat) {
                $submenu[$cat['permalink']] = array('sequence' => isset($psettings['tag-category-sequence-' . $cat['permalink']]) && $psettings['tag-category-sequence-' . $cat['permalink']] != '' ? $psettings['tag-category-sequence-' . $cat['permalink']] : 10, 'title' => isset($psettings['tag-category-title-' . $cat['permalink']]) && $psettings['tag-category-title-' . $cat['permalink']] != '' ? $psettings['tag-category-title-' . $cat['permalink']] : $cat['tag_name'], 'image_id' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-image-' . $cat['permalink']]) ? $psettings['tag-category-image-' . $cat['permalink']] : '', 'content' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-content-' . $cat['permalink']]) ? $psettings['tag-category-content-' . $cat['permalink']] : '', 'permalink' => $cat['permalink']);
            }
        }
        //
        // Sort the submenu
        //
        uasort($submenu, function ($a, $b) {
            if ($a['sequence'] == $b['sequence']) {
                return strcmp($b['title'], $a['title']);
            }
            return $a['sequence'] < $b['sequence'] ? -1 : 1;
        });
    }
    return array('stat' => 'ok', 'submenu' => $submenu);
}
예제 #3
0
function ciniki_artistprofiles_hooks_webOptions(&$ciniki, $business_id, $args)
{
    //
    // Check to make sure the module is enabled
    //
    if (!isset($ciniki['business']['modules']['ciniki.artistprofiles'])) {
        return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3042', 'msg' => "I'm sorry, the page you requested does not exist."));
    }
    //
    // Get the settings from the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDetailsQueryDash');
    $rc = ciniki_core_dbDetailsQueryDash($ciniki, 'ciniki_web_settings', 'business_id', $business_id, 'ciniki.web', 'settings', 'page-artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if (!isset($rc['settings'])) {
        $settings = array();
    } else {
        $settings = $rc['settings'];
    }
    $pages['ciniki.artistprofiles'] = array('name' => 'Artist Profiles', 'options' => array(array('label' => 'Sidebar', 'setting' => 'page-artistprofiles-sidebar', 'type' => 'toggle', 'value' => isset($settings['page-artistprofiles-sidebar']) ? $settings['page-artistprofiles-sidebar'] : 'no', 'toggles' => array(array('value' => 'no', 'label' => 'No'), array('value' => 'yes', 'label' => 'Yes')))));
    return array('stat' => 'ok', 'pages' => $pages);
}
예제 #4
0
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');
}