Example #1
0
function MG_editUser($uid)
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
    $retval = '';
    $active = 0;
    $quota = 0;
    $username = DB_getItem($_TABLES['users'], 'username', "uid=" . $uid);
    $result = DB_query("SELECT active,quota FROM {$_TABLES['mg_userprefs']} WHERE uid=" . $uid);
    $nRows = DB_numRows($result);
    if ($nRows > 0) {
        $row = DB_fetchArray($result);
        $active = $row['active'];
        $quota = $row['quota'] / 1048576;
    } else {
        $active = 1;
        $quota = $_MG_CONF['member_quota'] / 1048576;
    }
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_file('admin', 'useredit.thtml');
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $active_select = '<input type="checkbox" name="active" value="1" ' . ($active ? ' CHECKED' : '') . '/>';
    $T->set_var(array('s_form_action' => $_MG_CONF['admin_url'] . 'edituser.php', 'lang_user_edit' => $LANG_MG01['edit_user'], 'lang_username' => $LANG_MG01['username'], 'lang_active' => $LANG_MG01['active'], 'lang_quota' => $LANG_MG01['quota'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'lang_unlimited' => $LANG_MG01['zero_unlimited'], 'uid' => $uid, 'active' => $active_select, 'quota' => $quota, 'username' => $username));
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #2
0
function polls_upgrade()
{
    global $_TABLES, $_CONF, $_PO_CONF;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='polls'");
    switch ($currentVersion) {
        case '2.0.0':
        case '2.0.1':
        case '2.0.2':
        case '2.0.3':
        case '2.0.4':
        case '2.0.5':
        case '2.0.6':
        case '2.0.7':
        case '2.0.8':
        case '2.0.9':
        case '2.1.0':
            $c = config::get_instance();
            $c->add('displayblocks', 0, 'select', 0, 0, 13, 85, true, 'polls');
        case '2.1.1':
            DB_query("ALTER TABLE {$_TABLES['pollanswers']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL DEFAULT '';", 1);
            DB_query("ALTER TABLE {$_TABLES['pollquestions']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL;", 1);
            DB_query("ALTER TABLE {$_TABLES['polltopics']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL;", 1);
            DB_query("ALTER TABLE {$_TABLES['pollvoters']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL DEFAULT '';", 1);
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_PO_CONF['pi_version'] . "',pi_gl_version='" . $_PO_CONF['gl_version'] . "' WHERE pi_name='polls' LIMIT 1");
            break;
    }
    if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='polls'") == $_PO_CONF['pi_version']) {
        return true;
    } else {
        return false;
    }
}
Example #3
0
function selectHTML_forum($selected = '')
{
    global $_CONF, $_TABLES;
    $selectHTML = '';
    $asql = DB_query("SELECT * FROM {$_TABLES['forum_categories']} ORDER BY cat_order ASC");
    while ($A = DB_fetchArray($asql)) {
        $firstforum = true;
        $bsql = DB_query("SELECT * FROM {$_TABLES['forum_forums']} WHERE forum_cat='{$A['id']}' ORDER BY forum_order ASC");
        while ($B = DB_fetchArray($bsql)) {
            $groupname = DB_getItem($_TABLES['groups'], 'grp_name', "grp_id='{$B['grp_id']}'");
            if (SEC_inGroup($groupname)) {
                if ($firstforum) {
                    $selectHTML .= '<option value="-1">-------------------</option>';
                    $selectHTML .= '<option value="-1">' . $A['cat_name'] . '</option>';
                }
                $firstforum = false;
                if ($B['forum_id'] == $selected) {
                    $selectHTML .= LB . '<option value="' . $B['forum_id'] . '" selected="selected">&nbsp;&#187;&nbsp;&nbsp;' . $B['forum_name'] . '</option>';
                } else {
                    $selectHTML .= LB . '<option value="' . $B['forum_id'] . '">&nbsp;&#187;&nbsp;&nbsp;' . $B['forum_name'] . '</option>';
                }
            }
        }
    }
    return $selectHTML;
}
Example #4
0
function staticpages_upgrade()
{
    global $_TABLES, $_CONF, $_SP_CONF;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='staticpages'");
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    $c = config::get_instance();
    switch ($currentVersion) {
        case '1.5.0':
            $rc = update_150_to_151();
        case '1.5.1':
        case '1.5.2':
        case '1.5.3':
            DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD sp_search tinyint(4) NOT NULL default '1' AFTER postmode", 1);
        case '1.5.4':
            DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD sp_status tinyint(3) NOT NULL DEFAULT '1' AFTER sp_id");
            // static pages configuration options
            $c->add('include_search', 1, 'select', 0, 0, 0, 95, true, 'staticpages');
            $c->add('comment_code', -1, 'select', 0, 0, 17, 97, true, 'staticpages');
            $c->add('status_flag', 1, 'select', 0, 0, 13, 99, true, 'staticpages');
        case '1.6.0':
            DB_query("ALTER TABLE {$_TABLES['staticpage']} CHANGE `sp_tid` `sp_tid` VARCHAR(128) NOT NULL DEFAULT 'none';", 1);
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_SP_CONF['pi_version'] . "',pi_gl_version='" . $_SP_CONF['gl_version'] . "' WHERE pi_name='staticpages' LIMIT 1");
            break;
    }
    if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='staticpages'") == $_SP_CONF['pi_version']) {
        return true;
    } else {
        return false;
    }
}
Example #5
0
function zero_upgrade()
{
    global $_TABLES, $_CONF, $_ZZ_CONF, $_DB_table_prefix;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='zero'");
    switch ($currentVersion) {
        case '0.0.5':
            $_SQL['widgets'] = "CREATE TABLE IF NOT EXISTS {$_TABLES['widgets']} (\n                widget_id mediumint(8) NOT NULL auto_increment,\n                widget_desc varchar(64) NOT NULL default '',\n                PRIMARY KEY (widget_id)\n                ) TYPE=MyISAM;";
            DB_query($_SQL['widgets'], 1);
        case '0.0.6':
            $_SQL['gadgets'] = "CREATE TABLE IF NOT EXISTS {$_TABLES['gadgets']} (\n                gadget_id mediumint(8) NOT NULL auto_increment,\n                gadget_desc varchar(64) NOT NULL default '',\n                PRIMARY KEY (gadget_id)\n                ) TYPE=MyISAM;";
            DB_query($_SQL['gadgets'], 1);
            // you should really list a case for each version you release, however
            // the default case is the catch-all, which just updates pi_version to
            // match the current code version
        // you should really list a case for each version you release, however
        // the default case is the catch-all, which just updates pi_version to
        // match the current code version
        case '1.0.0':
        case '1.1.0':
        case '1.1.1':
        case '1.1.2':
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='{$_ZZ_CONF['pi_version']}',pi_gl_version='{$_ZZ_CONF['pi_gl_version']}' WHERE pi_name='zero' LIMIT 1");
            break;
    }
    // clear the template cache because this plugin may create changes
    CTL_clearCache();
    // if upgrade succeeded, the plugin version in the plugins table will match
    // the version of the currently installed plugin
    return DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='zero'") == $_ZZ_CONF['pi_version'];
}
Example #6
0
function calendar_upgrade()
{
    global $_TABLES, $_CONF, $_CA_CONF;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='calendar'");
    switch ($currentVersion) {
        case '1.0.2':
            // add new configuration option
            $c = config::get_instance();
            $c->add('only_admin_submit', 0, 'select', 0, 0, 0, 15, true, 'calendar');
        case '1.0.3':
        case '1.0.4':
        case '1.0.5':
            DB_query("ALTER TABLE {$_TABLES['eventsubmission']} ADD  owner_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '1' AFTER url");
        case '1.0.6':
            $c = config::get_instance();
            $c->add('displayblocks', 0, 'select', 0, 0, 13, 115, true, 'calendar');
            // allow events to be enabled/disabled
            DB_query("ALTER TABLE {$_TABLES['events']} ADD status tinyint(3) NOT NULL DEFAULT '1' AFTER eid");
            DB_query("ALTER TABLE {$_TABLES['eventsubmission']} ADD status tinyint(3) NOT NULL DEFAULT '1' AFTER eid");
            DB_query("ALTER TABLE {$_TABLES['personal_events']} ADD status tinyint(3) NOT NULL DEFAULT '1' AFTER eid");
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_CA_CONF['pi_version'] . "',pi_gl_version='" . $_CA_CONF['gl_version'] . "' WHERE pi_name='calendar' LIMIT 1");
            break;
    }
    if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='calendar'") == $_CA_CONF['pi_version']) {
        return true;
    } else {
        return false;
    }
}
/**
 * sidに対応する多言語記事が存在する場合はその記事へのリンクを作成し返す関数
 *   $sid : story id
 *   --------------
 *   return : 多言語記事へのリンク
**/
function CUSTOM_multilangstory($sid)
{
    global $_CONF, $_TABLES;
    $retval = '';
    if (empty($_CONF['languages']) || empty($_CONF['language_files']) || count($_CONF['languages']) != count($_CONF['language_files'])) {
        return $retval;
    }
    $work = split('_', $sid);
    $cur_lang = array_pop($work);
    if (empty($cur_lang) || !array_key_exists($cur_lang, $_CONF['languages'])) {
        return $retval;
    }
    $entries = array();
    $mini_sid = implode('_', $work);
    foreach ($_CONF['languages'] as $key => $value) {
        if ($cur_lang != $key) {
            $mul_sid = DB_getItem($_TABLES['stories'], 'sid', 'sid="' . $mini_sid . '_' . $key . '"');
            if (!empty($mul_sid)) {
                $url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $mul_sid);
                $entries[] = '<a href="' . $url . '">' . $value . '</a>';
            }
        }
    }
    if (sizeof($entries) > 0) {
        $retval .= COM_makeList($entries);
    }
    return $retval;
}
 /**
  * Constructor
  *
  * @param $options   array
  */
 public function __construct($options = array())
 {
     global $_TABLES;
     parent::__construct($options);
     $pi_version = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'staticpages'");
     $this->_isSP162 = version_compare($pi_version, '1.6.2') >= 0;
 }
Example #9
0
function polls_update_ConfValues_2_1_3()
{
    global $_CONF, $_PO_DEFAULT, $_PO_CONF, $_GROUPS, $_TABLES;
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    $c = config::get_instance();
    require_once $_CONF['path'] . 'plugins/polls/install_defaults.php';
    $c->add('tab_poll_block', NULL, 'tab', 0, 20, NULL, 0, true, 'polls', 20);
    $c->add('fs_block_settings', NULL, 'fieldset', 0, 10, NULL, 0, true, 'polls', 20);
    $c->add('block_enable', $_PO_DEFAULT['block_enable'], 'select', 0, 10, 0, 10, true, 'polls', 20);
    $c->add('block_isleft', $_PO_DEFAULT['block_isleft'], 'select', 0, 10, 0, 20, true, 'polls', 20);
    $c->add('block_order', $_PO_DEFAULT['block_order'], 'text', 0, 10, 0, 30, true, 'polls', 20);
    $c->add('block_topic_option', $_PO_DEFAULT['block_topic_option'], 'select', 0, 10, 15, 40, true, 'polls', 20);
    $c->add('block_topic', $_PO_DEFAULT['block_topic'], '%select', 0, 10, NULL, 50, true, 'polls', 20);
    $c->add('fs_block_permissions', NULL, 'fieldset', 0, 20, NULL, 0, true, 'polls', 20);
    $new_group_id = 0;
    if (isset($_GROUPS['Polls Admin'])) {
        $new_group_id = $_GROUPS['Polls Admin'];
    } else {
        $new_group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Polls Admin'");
        if ($new_group_id == 0) {
            if (isset($_GROUPS['Root'])) {
                $new_group_id = $_GROUPS['Root'];
            } else {
                $new_group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Root'");
            }
        }
    }
    $c->add('block_group_id', $new_group_id, 'select', 0, 20, NULL, 10, TRUE, 'polls', 20);
    $c->add('block_permissions', $_PO_DEFAULT['block_permissions'], '@select', 0, 20, 14, 20, true, 'polls', 20);
    return true;
}
Example #10
0
function spamx_upgrade()
{
    global $_TABLES, $_CONF, $_SPX_CONF;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='spamx'");
    switch ($currentVersion) {
        case '1.1.0':
        case '1.1.1':
        case '1.1.2':
        case '1.1.3':
        case '1.1.4':
        case '1.1.5':
        case '1.1.6':
        case '1.1.7':
        case '1.1.8':
        case '1.1.9':
        case '1.2.0':
            $c = config::get_instance();
            $c->add('fs_sfs', NULL, 'fieldset', 0, 1, NULL, 0, true, 'spamx');
            $c->add('sfs_username_check', false, 'select', 0, 1, 1, 10, true, 'spamx');
            $c->add('sfs_email_check', true, 'select', 0, 1, 1, 20, true, 'spamx');
            $c->add('sfs_ip_check', true, 'select', 0, 1, 1, 30, true, 'spamx');
            $c->add('sfs_username_confidence', '99.00', 'text', 0, 1, 1, 40, true, 'spamx');
            $c->add('sfs_email_confidence', '50.00', 'text', 0, 1, 1, 50, true, 'spamx');
            $c->add('sfs_ip_confidence', '25.00', 'text', 0, 1, 1, 60, true, 'spamx');
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_SPX_CONF['pi_version'] . "',pi_gl_version='" . $_SPX_CONF['gl_version'] . "' WHERE pi_name='spamx' LIMIT 1");
            break;
    }
    if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='spamx'") == $_SPX_CONF['pi_version']) {
        return true;
    } else {
        return false;
    }
}
Example #11
0
function nf_check4files($projectid, $taskid, $fieldname)
{
    global $_FILES, $_CONF, $_TABLES, $_USER, $CONF_NF, $LANG_GF00;
    $errmsg = '';
    $uploadfile = $_FILES[$fieldname];
    // Check if there is a request to delete any attachments
    if (isset($_POST['chk_removeattachment'])) {
        foreach ($_POST['chk_removeattachment'] as $id) {
            $filename = DB_getItem($_TABLES['nf_projectattachments'], 'filename', "id={$id}");
            $parts = explode(':', $filename);
            COM_errorLog("{$CONF_NF['uploadpath']}/{$parts[0]}");
            DB_query("DELETE FROM {$_TABLES['nf_projectattachments']} WHERE id={$id}");
            @unlink("{$CONF_NF['uploadpath']}/{$parts[0]}");
        }
    }
    if ($uploadfile['name'] != '') {
        $uploadfilename = ppRandomFilename();
        $pos = strrpos($uploadfile['name'], '.') + 1;
        $ext = strtolower(substr($uploadfile['name'], $pos));
        $filename = "{$uploadfilename}.{$ext}";
        COM_errorlog("Workflow file upload: Original file: {$uploadfile['name']} and new filename: {$filename}");
        $filestore_path = $CONF_NF['uploadpath'];
        if (nf_uploadfile($filename, $uploadfile, $CONF_NF['allowablefiletypes'], $filestore_path)) {
            // Store both the created filename and the real file source filename
            $filename = "{$filename}:{$uploadfile['name']}";
            DB_query("INSERT INTO {$_TABLES['nf_projectattachments']} (project_id,task_id,fieldname,filename)\r\n                    VALUES ({$projectid},{$taskid},'{$fieldname}','{$filename}')");
        } else {
            COM_errorlog("upload error:" . $GLOBALS['nf_errmsg']);
            $errmsg = $GLOBALS['nf_errmsg'];
        }
    }
    return $errmsg;
}
Example #12
0
function MG_displaySessions()
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
    $retval = '';
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_file(array('sessions' => 'sessions.thtml', 'empty' => 'sess_noitems.thtml', 'sessitems' => 'sessitems.thtml'));
    $T->set_var(array('site_url' => $_CONF['site_url'], 'lang_select' => $LANG_MG01['select'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all']));
    $sql = "SELECT * FROM {$_TABLES['mg_sessions']} WHERE session_status=1";
    $result = DB_query($sql);
    $numRows = DB_numRows($result);
    $rowclass = 0;
    if ($numRows == 0) {
        // we have no active sessions
        $T->set_var(array('lang_no_sessions' => $LANG_MG01['no_sessions']));
        $T->parse('noitems', 'empty');
    } else {
        $totalSess = $numRows;
        $T->set_block('sessitems', 'sessRow', 'sRow');
        for ($x = 0; $x < $numRows; $x++) {
            $row = DB_fetchArray($result);
            $res2 = DB_query("SELECT COUNT(id) FROM {$_TABLES['mg_session_items']} WHERE session_id='" . $row['session_id'] . "' AND status=0");
            list($count) = DB_fetchArray($res2);
            $T->set_var(array('row_class' => $rowclass % 2 ? '1' : '2', 'session_id' => $row['session_id'], 'session_owner' => DB_getItem($_TABLES['users'], 'username', "uid={$row['session_uid']}"), 'session_description' => $row['session_description'], 'session_continue' => $_MG_CONF['site_url'] . '/batch.php?mode=continue&amp;sid=' . $row['session_id'], 'count' => $count));
            $T->parse('sRow', 'sessRow', true);
            $rowclass++;
        }
        $T->parse('sessitems', 'sessitems');
    }
    $T->set_var(array('s_form_action' => $_MG_CONF['admin_url'] . 'sessions.php', 'mode' => 'sessions', 'lang_category_manage_help' => $LANG_MG01['category_manage_help'], 'lang_catid' => $LANG_MG01['cat_id'], 'lang_cat_name' => $LANG_MG01['cat_name'], 'lang_cat_description' => $LANG_MG01['cat_description'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_delete' => $LANG_MG01['delete'], 'lang_select' => $LANG_MG01['select'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all'], 'lang_session_id' => $LANG_MG01['cat_id'], 'lang_session_description' => $LANG_MG01['description'], 'lang_session_owner' => $LANG_MG01['owner'], 'lang_session_count' => $LANG_MG01['count'], 'lang_action' => $LANG_MG01['action']));
    $T->parse('output', 'sessions');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #13
0
function links_upgrade()
{
    global $_TABLES, $_CONF, $_LI_CONF;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='links'");
    switch ($currentVersion) {
        case '2.0.0':
        case '2.0.1':
            $c = config::get_instance();
            $c->add('target_blank', FALSE, 'select', 0, 1, 0, 55, true, 'links');
        case '2.0.2':
        case '2.0.3':
        case '2.0.4':
        case '2.0.5':
        case '2.0.6':
        case '2.0.7':
        case '2.0.8':
        case '2.0.9':
        case '2.1.0':
        case '2.1.1':
        case '2.1.2':
            $c = config::get_instance();
            $c->add('displayblocks', 0, 'select', 0, 0, 13, 60, true, 'links');
        case '2.1.3':
        case '2.1.4':
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_LI_CONF['pi_version'] . "',pi_gl_version='" . $_LI_CONF['gl_version'] . "' WHERE pi_name='links' LIMIT 1");
            break;
    }
    if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='links'") == $_LI_CONF['pi_version']) {
        return true;
    } else {
        return false;
    }
}
function upgrade_plugins_141()
{
    global $_TABLES;
    if (DB_count($_TABLES['plugins'], 'pi_name', 'links') == 1) {
        DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.0.1', pi_gl_version = '1.4.1' WHERE pi_name = 'links'");
    }
    // add remarks-field to polls
    if (DB_count($_TABLES['plugins'], 'pi_name', 'polls') == 1) {
        DB_query("ALTER TABLE {$_TABLES['pollanswers']} ADD remark varchar(255) NULL AFTER votes");
        DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'polls'");
    }
    if (DB_count($_TABLES['plugins'], 'pi_name', 'spamx') == 1) {
        // delete MT-Blacklist entries from Spam-X plugin
        DB_query("DELETE FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist'");
        // the count of deleted spams was introduced in 1.4.0 but not added
        // when upgrading from an older database, so add it now if it's missing
        $val = DB_getItem($_TABLES['vars'], 'value', "name = 'spamx.counter'");
        if (empty($val)) {
            DB_save($_TABLES['vars'], 'name,value', "'spamx.counter','0'");
        }
        DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'spamx'");
    }
    // add field to support advanced editor and a help link in staticpages
    if (DB_count($_TABLES['plugins'], 'pi_name', 'staticpages') == 1) {
        DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD postmode varchar(16) DEFAULT 'html' NOT NULL AFTER sp_inblock");
        DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD sp_help varchar(255) default '' AFTER sp_centerblock");
        DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.4.3', pi_gl_version = '1.4.1' WHERE pi_name = 'staticpages'");
    }
}
Example #15
0
/**
*   Loads the configuration records for the Online Config Manager.
*
*   @return boolean     True = proceed with install, false = an error occured
*/
function plugin_load_configuration_classifieds()
{
    global $_CONF, $_CONF_ADVT, $_TABLES;
    require_once CLASSIFIEDS_PI_PATH . '/install_defaults.php';
    // Get the admin group ID that was saved previously.
    $group_id = (int) DB_getItem($_TABLES['groups'], 'grp_id', "grp_name='{$_CONF_ADVT['pi_name']} Admin'");
    return plugin_initconfig_classifieds($group_id);
}
Example #16
0
/**
* Loads the configuration records for the Online Config Manager
* @return   boolean     true = proceed with install, false = an error occured
*/
function plugin_load_configuration_external()
{
    global $_CONF, $_CONF_EXP, $_TABLES;
    COM_errorLog("Loading the configuration for the External plugin", 1);
    require_once $_CONF['path'] . 'plugins/' . $_CONF_EXP['pi_name'] . '/install_defaults.php';
    // Get the admin group ID that was saved previously.
    $group_id = (int) DB_getItem($_TABLES['groups'], 'grp_id', "grp_name='{$_CONF_EXP['pi_name']} Admin'");
    return plugin_initconfig_external($group_id);
}
function upgrade_addFeature()
{
    global $_TABLES;
    $grp_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Story Admin'");
    $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'story.ping'");
    if ($grp_id > 0 && $ft_id > 0) {
        DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id},{$grp_id})");
    }
}
Example #18
0
function plugin_postinstall_flickr($pi_name)
{
    global $_CONF, $_TABLES;
    /* This code is for statistics ONLY */
    $message = 'Completed flickr plugin install: ' . date('m d Y', time()) . "   AT " . date('H:i', time()) . "\n";
    $message .= 'Site: ' . $_CONF['site_url'] . ' and Sitename: ' . $_CONF['site_name'] . "\n";
    $pi_version = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'flickr'");
    COM_mail("*****@*****.**", "{$pi_name} Version:{$pi_version} Install successfull", $message);
    return true;
}
Example #19
0
function nxtime_testuser($username, $password)
{
    global $_TABLES;
    $uid = DB_getItem($_TABLES['users'], 'uid', "username='******' AND passwd='{$password}'");
    if ($uid > 0) {
        return $uid;
    } else {
        return false;
    }
}
Example #20
0
/**
 * Add in new security rights for the Group "Polls Admin"
 *
 */
function polls_update_ConfigSecurity_2_1_3()
{
    global $_TABLES;
    // Add in security rights for Polls Admin
    $group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Polls Admin'");
    if ($group_id > 0) {
        $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'config.polls.tab_poll_block'");
        $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$group_id})";
        DB_query($sql);
    }
}
Example #21
0
function bad_behavior2_upgrade()
{
    global $_TABLES, $_CONF, $_BB2_CONF;
    $sql = '';
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='bad_behavior2'");
    switch ($currentVersion) {
        case '2.0.13':
        case '2.0.13a':
        case '2.0.24':
        case '2.0.26':
        case '2.0.27':
        case '2.0.28':
        case '2.0.29':
        case '2.0.35':
        case '2.0.36':
        case '2.0.37':
        case '2.0.38':
        case '2.0.39':
        case '2.0.40':
        case '2.0.41':
        case '2.0.42':
        case '2.0.43':
        case '2.0.44':
        case '2.0.45':
        case '2.0.46':
        case '2.0.47':
        case '2.0.48':
        case '2.0.49':
            $sql .= "CREATE TABLE IF NOT EXISTS {$_TABLES['bad_behavior2_ban']} (\n                `id` smallint(5) unsigned NOT NULL auto_increment,\n                `ip` varbinary(16) NOT NULL,\n                `type` tinyint(3) unsigned NOT NULL,\n                `timestamp` int(8) NOT NULL DEFAULT '0',\n                `reason` VARCHAR(255) NULL DEFAULT NULL,\n                PRIMARY KEY  (id),\n                UNIQUE ip (ip),\n                INDEX type (type),\n                INDEX timestamp (timestamp) ) ENGINE=MyISAM;";
            DB_query($sql, 1);
            require_once $_CONF['path_system'] . 'classes/config.class.php';
            $c = config::get_instance();
            // Subgroup: Spam / Bot Protection
            $c->add('sg_spam', NULL, 'subgroup', 8, 0, NULL, 0, TRUE);
            $c->add('fs_spam_config', NULL, 'fieldset', 8, 1, NULL, 0, TRUE);
            $c->add('bb2_enabled', 1, 'select', 8, 1, 0, 10, TRUE);
            $c->add('bb2_ban_enabled', 0, 'select', 8, 1, 0, 20, TRUE);
            $c->add('bb2_ban_timeout', 24, 'text', 8, 1, 0, 30, TRUE);
            $c->add('bb2_display_stats', 0, 'select', 8, 1, 0, 40, TRUE);
            $c->add('bb2_strict', 0, 'select', 8, 1, 0, 50, TRUE);
            $c->add('bb2_verbose', 0, 'select', 8, 1, 0, 60, TRUE);
            $c->add('bb2_logging', 1, 'select', 8, 1, 0, 70, TRUE);
            $c->add('bb2_httpbl_key', '', 'text', 8, 1, NULL, 80, TRUE);
            $c->add('bb2_httpbl_threat', 25, 'text', 8, 1, NULL, 90, TRUE);
            $c->add('bb2_httpbl_maxage', 30, 'text', 8, 1, NULL, 100, TRUE);
            $c->add('bb2_offsite_forms', 0, 'select', 8, 1, 0, 110, TRUE);
            $c->add('bb2_eu_cookie', 0, 'select', 8, 1, 0, 120, TRUE);
            break;
        default:
            break;
    }
    DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '" . $_BB2_CONF['pi_version'] . "', pi_gl_version = '" . $_BB2_CONF['gl_version'] . "', pi_homepage = 'https://www.glfusion.org' WHERE pi_name = 'bad_behavior2'");
    return true;
}
Example #22
0
/**
 * Add in new security rights for the Group "Calendarjp Admin"
 *
 */
function calendarjp_update_ConfigSecurity_1_1_5()
{
    global $_TABLES;
    // Add in security rights for Calendarjp Admin
    $group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Calendarjp Admin'");
    if ($group_id > 0) {
        $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'config.calendarjp.tab_events_block'");
        $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$group_id})";
        DB_query($sql);
    }
}
Example #23
0
function DLM_check_001()
{
    global $_CONF, $_TABLES, $_LANG_UPDATE;
    $retval = '';
    if (version_compare(VERSION, '1.8.0') >= 0) {
        $n = DB_getItem($_TABLES['conf_values'], 'COUNT(name)', "group_name = 'downloads' AND type = 'tab'");
        if ($n == 0) {
            $retval .= $_LANG_UPDATE['description_001'];
        }
    }
    return $retval;
}
Example #24
0
 private function _renderHeaderMenu()
 {
     global $_TABLES, $_CONF;
     $headerbg = DB_getItem($_TABLES['nexmenu_config'], 'headerbg', "theme='{$this->_theme}'");
     $t = new Template($_CONF['path_layout'] . 'nexmenu/procssmenu');
     $t->set_file('menu', 'headermenu.thtml');
     $t->set_file('menuitem', 'headermenu_item.thtml');
     $t->set_var('background-color', $headerbg);
     $t->set_var('menuitems', $this->_renderMenuItems());
     $t->parse('output', 'menu');
     return $t->finish($t->get_var('output'));
 }
Example #25
0
 public function getChildCategories($pid = FALSE, $all_langs = FALSE)
 {
     global $_CONF, $_TABLES;
     $retval = array();
     if ($pid !== FALSE) {
         return $retval;
     }
     $where = array();
     $sql = "SELECT tid, topic, imageurl " . "FROM {$_TABLES['topics']} ";
     if (Dataproxy::uid() > 1) {
         $tids = DB_getItem($_TABLES['userindex'], 'tids', "uid = " . Dataproxy::uid());
         if (!empty($tids)) {
             $where[] = "(tid NOT IN ('" . str_replace(' ', "','", addslashes($tids)) . "'))";
         }
     }
     // Adds permission check.  When uid is 0, then it means access as Root
     if (!Dataproxy::isRoot()) {
         $temp = COM_getPermSQL('', Dataproxy::uid());
         if (!empty($temp)) {
             $where[] = $temp;
         }
     }
     // Adds lang id.  When uid is 0, then it means access as Root
     if (!Dataproxy::isRoot() and function_exists('COM_getLangSQL') and $all_langs === FALSE) {
         $temp = COM_getLangSQL('tid', '');
         if (!empty($temp)) {
             $where[] = $temp;
         }
     }
     if (count($where) > 0) {
         $sql .= " WHERE " . implode(" AND ", $where);
     }
     if ($_CONF['sortmethod'] == 'alpha') {
         $sql .= ' ORDER BY topic ASC';
     } else {
         $sql .= ' ORDER BY sortnum';
     }
     $result = DB_query($sql);
     if (DB_error()) {
         return $retval;
     }
     while (($A = DB_fetchArray($result, FALSE)) !== FALSE) {
         $entry = array();
         $entry['id'] = stripslashes($A['tid']);
         $entry['title'] = stripslashes($A['topic']);
         $entry['uri'] = $_CONF['site_url'] . '/index.php?topic=' . $entry['id'];
         $entry['date'] = FALSE;
         $entry['image_uri'] = stripslashes($A['imageurl']);
         $retval[] = $entry;
     }
     return $retval;
 }
Example #26
0
/**
 * used for the list of users in admin/user.php
 *
 */
function ADMIN_getListField_ratings($fieldname, $fieldvalue, $A, $icon_arr)
{
    global $_CONF, $_TABLES, $LANG_ADMIN, $LANG04, $LANG28, $LANG_GF98, $_FF_CONF;
    $retval = '';
    switch ($fieldname) {
        case 'grade':
            $retval = intval($fieldvalue);
            break;
        case 'rating':
            $retval = '<input type="text" name="new_rating-' . $A['uid'] . '" value="' . intval($A['rating']) . '" size="5" />';
            break;
        case 'voter_id':
            $uname = DB_getItem($_TABLES['users'], 'username', 'uid=' . $A['voter_id']);
            $retval = COM_createLink($uname, $_CONF['site_admin_url'] . '/plugins/forum/userrating_detail.php?vid=' . $A['voter_id']);
            break;
        case 'user_id':
            $uname = DB_getItem($_TABLES['users'], 'username', 'uid=' . $A['user_id']);
            if ($uname == '') {
                $retval = COM_createLink($A['user_id'], $_CONF['site_admin_url'] . '/plugins/forum/userrating_detail.php?uid=' . $A['user_id']);
            } else {
                $retval = COM_createLink($uname, $_CONF['site_admin_url'] . '/plugins/forum/userrating_detail.php?uid=' . $A['user_id']);
            }
            break;
        case 'topic_id':
            if (intval($A['topic_id']) > 0) {
                $res = DB_query("SELECT id,pid,forum,subject,comment,status FROM {$_TABLES['ff_topic']} WHERE id=" . $A['topic_id']);
                list($id, $pid, $forum, $subject, $comment, $status) = DB_fetchArray($res);
                $testText = FF_formatTextBlock($comment, 'text', 'text', $status);
                $testText = strip_tags($testText);
                $lastpostinfogll = htmlspecialchars(preg_replace('#\\r?\\n#', '<br>', strip_tags(substr($testText, 0, $_FF_CONF['contentinfo_numchars']) . '...')), ENT_QUOTES, COM_getEncodingt());
                if ($subject == '') {
                    $subject = '<em>' . $LANG_GF98['no_subject_defined'] . '</em>';
                }
                $retval = '<a class="' . COM_getTooltipStyle() . '" style="text-decoration:none;" href="' . $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . ($pid == 0 ? $id : $pid) . '&amp;topic=' . $id . '#' . $id . '" title="' . $subject . '::' . $lastpostinfogll . '" rel="nofollow">' . $subject . '</a>';
            } elseif ($A['topic_id'] == -1) {
                $retval = $LANG_GF98['admin_set_value'];
            } else {
                $retval = $LANG_GF98['no_topic_defined'];
            }
            break;
        case 'username':
            $retval = COM_createLink($fieldvalue, $_CONF['site_admin_url'] . '/plugins/forum/userrating_detail.php?uid=' . $A['uid']);
            break;
        case $_TABLES['users'] . '.uid':
            $retval = $A['uid'];
            break;
        default:
            $retval = $fieldvalue;
            break;
    }
    return $retval;
}
Example #27
0
/**
* Display a reminder to execute the security check script
*
* @return   string      HTML for security reminder (or empty string)
*/
function security_check_reminder()
{
    global $_CONF, $_TABLES, $_IMAGE_TYPE, $MESSAGE;
    $retval = '';
    if (!SEC_inGroup('Root')) {
        return $retval;
    }
    $done = DB_getItem($_TABLES['vars'], 'value', "name = 'security_check'");
    if ($done != 1) {
        $retval .= COM_showMessage(92);
    }
    return $retval;
}
Example #28
0
function MG_approveSubmission($media_id)
{
    global $_CONF, $_TABLES, $LANG_MG01;
    $mid = addslashes($media_id);
    $owner_uid = DB_getItem($_TABLES['mg_mediaqueue'], 'media_user_id', "media_id='" . $mid . "'");
    DB_delete($_TABLES['mg_mediaqueue'], 'media_id', $mid);
    $album_id = DB_getItem($_TABLES['mg_media_album_queue'], 'album_id', "media_id='" . $mid . "'");
    DB_save($_TABLES['mg_media_albums'], 'album_id, media_id, media_order', "{$album_id}, '{$mid}', 0");
    require_once $_CONF['path'] . 'plugins/mediagallery/include/sort.php';
    MG_SortMedia($album_id);
    DB_delete($_TABLES['mg_media_album_queue'], 'media_id', $mid);
    $sql = "SELECT media_filename, media_type " . "FROM {$_TABLES['mg_media']} WHERE media_id='" . $mid . "'";
    $result = DB_query($sql);
    list($media_filename, $media_type) = DB_fetchArray($result);
    $media_count = DB_getItem($_TABLES['mg_albums'], 'media_count', 'album_id=' . $album_id);
    $media_count++;
    DB_change($_TABLES['mg_albums'], 'media_count', $media_count, 'album_id', $album_id);
    MG_updateAlbumLastUpdate($album_id);
    $album_cover = DB_getItem($_TABLES['mg_albums'], 'album_cover', 'album_id=' . $album_id);
    if ($album_cover == -1 && $media_type == 0) {
        DB_change($_TABLES['mg_albums'], 'album_cover_filename', $media_filename, 'album_id', $album_id);
    }
    // email the owner / uploader that the item has been approved.
    COM_clearSpeedlimit(600, 'mgapprove');
    $last = COM_checkSpeedlimit('mgapprove');
    if ($last == 0) {
        $result2 = DB_query("SELECT username, fullname, email FROM {$_TABLES['users']} WHERE uid='" . $owner_uid . "'");
        list($username, $fullname, $email) = DB_fetchArray($result2);
        if ($email != '') {
            $subject = $LANG_MG01['upload_approved'];
            $body = $LANG_MG01['upload_approved'];
            $body .= '<br' . XHTML . '><br' . XHTML . '>';
            $body .= $LANG_MG01['thanks_submit'];
            $body .= '<br' . XHTML . '><br' . XHTML . '>';
            $body .= $_CONF['site_name'] . '<br' . XHTML . '>';
            $body .= $_CONF['site_url'] . '<br' . XHTML . '>';
            $to = array();
            $from = array();
            $to = COM_formatEmailAddress($username, $email);
            $from = COM_formatEmailAddress($_CONF['site_name'], $_CONF['site_mail']);
            if (!COM_mail($to, $subject, $body, $from, true)) {
                COM_errorLog("Media Gallery Error - Unable to send queue notification email");
            }
            COM_updateSpeedlimit('mgapprove');
        }
    }
    // PLG_itemSaved($media_id, 'mediagallery');
    // COM_rdfUpToDateCheck();
    // COM_olderStuff();
    return;
}
Example #29
0
 function parse($p1, $p2, $fulltag)
 {
     global $_TABLES, $_CONF;
     $topic = DB_getItem($_TABLES['topics'], 'topic', "tid = '" . DB_escapeString($p1) . "'" . COM_getTopicSQL('AND'));
     if (empty($topic)) {
         return "<b>Unknown Topic</b>";
     }
     if (!empty($p2) && $p2 != $p1) {
         $topic = $p2;
     } else {
         $topic = $topic;
     }
     return '<a href="' . $_CONF['site_url'] . '/index.php?topic=' . urlencode($p1) . '">' . htmlspecialchars($topic) . '</a>';
 }
Example #30
0
/**
 * Add in new security rights for the Group "Spamx Admin"
 *
 */
function spamx_update_ConfigSecurity_1_2_2()
{
    global $_TABLES;
    // Add in security rights for Spam-x Admin
    $group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Spamx Admin'");
    if ($group_id > 0) {
        $ft_names[] = 'config.spamx.tab_modules';
        foreach ($ft_names as $name) {
            $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = '{$name}'");
            if ($ft_id > 0) {
                $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$group_id})";
                DB_query($sql);
            }
        }
    }
}