/**
 * Ossn Add Relations
 *
 * @params $from => relation from guid
 *         $to => relation to guid
 *         $type => relation type
 * @param string $type
 *
 * @return bool
 */
function ossn_add_relation($from, $to, $type)
{
    if ($from > 0 && $to > 0 && !empty($type) && $type !== 0) {
        $add = new OssnDatabase();
        $params['into'] = 'ossn_relationships';
        $params['names'] = array('relation_from', 'relation_to', 'type', 'time');
        $params['values'] = array($from, $to, $type, time());
        if ($add->insert($params)) {
            return true;
        }
    }
    return false;
}
예제 #2
0
 *
 * @access private
 */
$fetch['from'] = 'ossn_site_settings';
$fetch['wheres'] = array("name='upgrades'");
$upgrade_settings = $database->select($fetch);
/**
 * If settings didn't exist then create settings
 *
 * @access private
 */
if (empty($upgrade_settings->setting_id)) {
    $insert['into'] = 'ossn_site_settings';
    $insert['names'] = array('name', 'value');
    $insert['values'] = array('upgrades', '');
    $database->insert($insert);
}
/**
 * Fixed the relationship table type from int to varchat
 *
 * @access private
 */
$database->statement("ALTER TABLE  `ossn_relationships`\n                      CHANGE  `type`  `type` VARCHAR( 20 ) \n\t\t\t\t\t  CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;");
$database->execute();
/**
 * Fix character settings for settings table
 *
 * @access private
 */
$database->statement("ALTER TABLE  `ossn_site_settings` \n                      DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;");
$database->execute();