/**
 * Get entities of object
 *
 * @param object $object Must be valid object
 * @param array $params Options
 *
 * @return object
 */
function ossn_get_object_entities($object, $params = array())
{
    if (isset($object->guid)) {
        $vars['owner_guid'] = $object->guid;
        $vars['type'] = 'object';
        $vars = array_merge($vars, $params);
        return ossn_get_entities($vars);
    }
    return false;
}
/**
 * Get entities of annotation
 *
 * @param object $annotation Must be valid annotation object
 * @param array $params Options
 *
 * @return object
 */
function ossn_get_annotation_entities($annotation, $params = array())
{
    if (isset($annotation->id)) {
        $vars['owner_guid'] = $annotation->id;
        $vars['type'] = 'annotation';
        $vars = array_merge($vars, $params);
        return ossn_get_entities($vars);
    }
    return false;
}
Esempio n. 3
0
/**
 * Wall template view 
 * Depends on wall post type
 *
 * @param string $callback Name of callback
 * @param string $type Callback type
 * @param array $params Arrays or Objects
 *
 * @return mixed data
 * @access private
 */
function ossn_get_homepage_wall_access()
{
    $data = ossn_get_entities(array('type' => 'component', 'subtype' => 'ossnwall_defaultwall', 'owner_guid' => 2));
    if ($data) {
        return $data[0]->value;
    } else {
        return 'public';
    }
}
Esempio n. 4
0
$database->delete($vars);
//add new column to users table
//3.) Add time_created to ossn_users table
$database->statement("ALTER TABLE `ossn_users` ADD `time_created` INT(11) NOT NULL AFTER `activation`;");
$database->execute();
//ossn_object description text to longtext and title to text #459
//5.) ossn_object description text to longtext and title to text #459
$database->statement("ALTER TABLE `ossn_object` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, \n\t\t\t\t\t CHANGE `description` `description` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;");
$database->execute();
//add last_cache and site_version in settings
$database->statement("INSERT INTO `ossn_site_settings` (`name`) VALUES ('last_cache')");
$database->execute();
$database->statement("INSERT INTO `ossn_site_settings` (`name`) VALUES ('site_version')");
$database->execute();
//update user time_created cloumn from user entites
$users = ossn_get_entities(array('type' => 'user', 'subtype' => 'gender', 'page_limit' => false));
if ($users) {
    unset($vars);
    foreach ($users as $user) {
        if (isset($user->owner_guid) && empty($user->owner_guid)) {
            continue;
        }
        $vars = array();
        $vars['table'] = 'ossn_users';
        $vars['names'] = array('time_created');
        $vars['values'] = array($user->time_created);
        $vars['wheres'] = array("guid={$user->owner_guid}");
        $database->update($vars);
    }
}
//regenerate .htaccess file