function update_tables() { global $_TABLES; global $_CONF; //マスタのデータ $_SQL = array(); //=====SQL 定義 ココから // 更新が必要なところの条件を変更して使用してください if (1 === 0) { //カテゴリ定義に親カテゴリIDとグループID追加 $_SQL[] = "\n\t\tCREATE TABLE {$_TABLES['DATABOX_def_fieldset']} (\n\t\t`fieldset_id` int(11) NOT NULL,\n\t\t`name` varchar(64) NOT NULL,\n\t\t`description` mediumtext,\n\t\t`udatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t`uuid` mediumint(8) NOT NULL,\n\t\tPRIMARY KEY (`fieldset_id`)\n\t\t) ENGINE=MyISAM\n\t\t"; //属性セット関連 $_SQL[] = "\n\t\tCREATE TABLE {$_TABLES['DATABOX_def_fieldset_assignments']} (\n\t\t`seq` int(11) NOT NULL AUTO_INCREMENT,\n\t\t`fieldset_id` int(11) NOT NULL,\n\t\t`field_id` int(11) NOT NULL,\n\t\tPRIMARY KEY (`seq`),\n\t\tKEY `fieldset_id` (`fieldset_id`)\n\t\t) ENGINE=MyISAM\n\t\t"; $_SQL[] = "\n ALTER TABLE {$_TABLES['DATABOX_base']}\n\t\tADD `fieldset_id` int(11) NOT NULL default 0 AFTER `orderno`,\n "; } //=====SQL 定義 ココまで //------------------------------------------------------------------ for ($i = 1; $i <= count($_SQL); $i++) { $w = current($_SQL); DB_query(current($_SQL)); next($_SQL); } if (DB_error()) { COM_errorLog("error DataBox table update ", 1); return false; } COM_errorLog("Success - DataBox table update", 1); return "end"; }
/** * Disable incompatible plugins to prevent an error which will occur during * the upgrade process. * * @link http://code.google.com/p/geeklog-jp/wiki/manage151 */ function GEEKLOGJP_disablePlugins() { global $_TABLES; /** * Geeklog-1.5.xで動作確認の取れているプラグインのリスト。 * $allowed_plugins['プラグイン英語名'] = '動作する最低バージョン' のフォー * マット。Geeklogに同梱されているプラグインはチェック不要なので、バージョン * は '*' とする。 */ $allowed_plugins = array('staticpages' => '*', 'links' => '*', 'polls' => '*', 'calendar' => '*', 'autotags' => '1.01', 'calendarjp' => '1.1.6', 'captcha' => '3.5.5', 'custommenu' => '0.2.2', 'dataproxy' => '2.0.0', 'dbman' => '0.7.1', 'filemgmt' => '1.6.0.jp3', 'forum' => '2.9.0hg', 'japanize' => '2.1.0', 'mycaljp' => '2.0.5', 'nmoxtopicown' => '1.0.12', 'sitemap' => '1.1.2', 'themedit' => '1.2.1'); $sqls = array(); $sql = "SELECT pi_name, pi_version " . "FROM {$_TABLES['plugins']} " . "WHERE (pi_enabled = '1') "; $result = DB_query($sql); if (!DB_error()) { while (($A = DB_fetchArray($result)) !== false) { $pi_name = $A['pi_name']; $pi_version = $A['pi_version']; if (array_key_exists($pi_name, $allowed_plugins)) { if ($allowed_plugins[$pi_name] == '*' or version_compare($pi_version, $allowed_plugins[$pi_name]) >= 0) { continue; } } $sqls[] = "UPDATE {$_TABLES['plugins']} " . "SET pi_enabled = '0' " . "WHERE (pi_name = '" . addslashes($pi_name) . "') "; } if (count($sqls) > 0) { foreach ($sqls as $sql) { DB_query($sql); } } } }
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; } }
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&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; }
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 db($user, $password) { $_SESSION['UserID'] = $user; $sql = "SELECT userid,\n\t\t\t\t\t\taccesslevel\n\t\t\t\tFROM www_users\n\t\t\t\tWHERE userid='" . DB_escape_string($user) . "'\n\t\t\t\tAND (password='******'\n\t\t\t\tOR password='******')"; $Auth_Result = DB_query($sql, $_SESSION['db']); $myrow = DB_fetch_row($Auth_Result); if (DB_num_rows($Auth_Result) > 0) { $sql = 'SELECT tokenid FROM securitygroups WHERE secroleid = ' . $_SESSION['AccessLevel']; $Sec_Result = DB_query($sql, $db); $_SESSION['AllowedPageSecurityTokens'] = array(); if (DB_num_rows($Sec_Result) == 0) { return NoAuthorisation; } else { $i = 0; while ($myrow = DB_fetch_row($Sec_Result)) { $_SESSION['AllowedPageSecurityTokens'][$i] = $myrow[0]; $i++; } } return $_SESSION['db']; } else { return NoAuthorisation; } }
function MG_adminEXIF() { global $_TABLES, $_MG_CONF, $_CONF, $LANG_MG01, $LANG_MG04; $retval = ''; $T = new Template($_MG_CONF['template_path']); $T->set_file('admin', 'exif_tags.thtml'); $T->set_var('site_url', $_CONF['site_url']); $T->set_var('site_admin_url', $_CONF['site_admin_url']); $T->set_var('xhtml', XHTML); $T->set_block('admin', 'exifRow', 'eRow'); $sql = "SELECT * FROM {$_TABLES['mg_exif_tags']}"; $result = DB_query($sql); $nrows = DB_numRows($result); for ($i = 0; $i < $nrows; $i++) { $row = DB_fetchArray($result); $properties[] = $row['name']; $tag[$row['name']][] = $row['selected']; } $exifKeys = getExifKeys(); $x = 0; foreach ($properties as $property) { $title = $exifKeys[$property][0]; $T->set_var(array('exif_tag' => $title, 'selected' => $tag[$property][0] ? ' checked="checked"' : '', 'tag' => $property, 'rowcounter' => $x % 2)); $T->parse('eRow', 'exifRow', true); $x++; } $T->set_var(array('lang_select' => $LANG_MG01['select'], 'lang_exiftag' => $LANG_MG01['exiftag'], 'lang_exif_admin_help' => $LANG_MG01['exif_admin_help'], 'lang_check_all' => $LANG_MG01['check_all'], 'lang_uncheck_all' => $LANG_MG01['uncheck_all'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 's_form_action' => $_MG_CONF['admin_url'] . 'exif_admin.php')); $retval .= $T->finish($T->parse('output', 'admin')); return $retval; }
function MG_selectUsers($page) { global $glversion, $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01; $retval = ''; $T = new Template($_MG_CONF['template_path']); $T->set_file('admin', 'createmembers.thtml'); $T->set_var(array('site_admin_url' => $_CONF['site_admin_url'], 'site_url' => $_CONF['site_url'], 'xhtml' => XHTML)); $T->set_block('admin', 'UserRow', 'uRow'); $start = $page * 50; $end = 50; $sql = "SELECT COUNT(gl.uid) AS count " . "FROM {$_TABLES['users']} AS gl " . "LEFT JOIN {$_TABLES['mg_userprefs']} AS mg ON gl.uid=mg.uid " . "WHERE gl.status = 3 AND gl.uid > 2 AND (mg.member_gallery IS NULL OR mg.member_gallery < 1)"; $result = DB_query($sql); list($total_records) = DB_fetchArray($result); $sql = "SELECT gl.uid, gl.status, gl.username, gl.fullname, mg.member_gallery " . "FROM {$_TABLES['users']} AS gl " . "LEFT JOIN {$_TABLES['mg_userprefs']} AS mg ON gl.uid=mg.uid " . "WHERE gl.status = 3 AND gl.uid > 2 AND (mg.member_gallery IS NULL OR mg.member_gallery < 1) " . "ORDER BY gl.username ASC LIMIT {$start},{$end}"; $result = DB_query($sql); while ($row = DB_fetchArray($result)) { if ($glversion[1] < 4) { $row['status'] = 3; } $uid = $row['uid']; $remote = SEC_inGroup("Remote Users", $uid) ? '(r)' : ''; $username = $row['username']; $member_gallery = $row['member_gallery']; $T->set_var(array('uid' => $uid, 'username' => $username . ' ' . $remote . ' - ' . $row['fullname'], 'select' => '<input type="checkbox" name="user[]" value="' . $uid . '"' . XHTML . '>')); $T->parse('uRow', 'UserRow', true); } $T->set_var(array('lang_userid' => $LANG_MG01['userid'], 'lang_username' => $LANG_MG01['username'], 'lang_select' => $LANG_MG01['select'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 's_form_action' => $_MG_CONF['admin_url'] . 'createmembers.php', 'pagenav' => COM_printPageNavigation($_MG_CONF['admin_url'] . 'createmembers.php', $page + 1, ceil($total_records / 50)))); $retval .= $T->finish($T->parse('output', 'admin')); return $retval; }
function draw() { global $_TABLES, $_CONF, $LANG_ECOM; $T = new Template($_CONF['path'] . 'plugins/ecommerce/templates/admin'); $T->set_file(array('sales_tax' => 'sales_tax.thtml', 'sales_tax_row' => 'sales_tax_row.thtml')); $T->set_var('msg_112', $LANG_ECOM[112]); $T->set_var('msg_113', $LANG_ECOM[113]); //Get left colunm $res = DB_query("SELECT ecom_tax_code, ecom_tax_id FROM {$_TABLES['ecom_tax']} WHERE ecom_tax_enabled = false"); while ($row = DB_fetchArray($res)) { $T->set_var('tax_code', $row['ecom_tax_code']); $T->set_var('link', 'index.php?op=tax&add='); $T->set_var('tax_id', $row['ecom_tax_id']); $T->set_var('display', 'add'); $T->parse('disabled_tax', 'sales_tax_row', true); } //Get right colunm $T->set_var('msg_114', $LANG_ECOM[114]); $res = DB_query("SELECT ecom_tax_code, ecom_tax_id FROM {$_TABLES['ecom_tax']} WHERE ecom_tax_enabled = true"); while ($row = DB_fetchArray($res)) { $T->set_var('tax_code', $row['ecom_tax_code']); $T->set_var('link', 'index.php?op=tax&remove='); $T->set_var('tax_id', $row['ecom_tax_id']); $T->set_var('display', 'remove'); $T->parse('enabled_tax', 'sales_tax_row', true); } $T->parse('output', 'sales_tax'); echo $T->finish($T->get_var('output')); }
function nexform_importForm($_SQL, $cntr) { global $CONF_FE, $_TABLES; DB_query($_SQL[0], '1'); if (DB_error()) { COM_errorLog("nexform SQL error importing form: {$_SQL[0]}"); } $newformid = DB_insertID(); /* Delete any previous imported form field definition records New field definition records will have a formid of '99999' assigned Insert the new records and then update to match the new form definition */ DB_query("DELETE FROM {$_TABLES['nxform_fields']} WHERE formid='{$cntr}'"); next($_SQL); // Increment to the field definition records for ($i = 1; $i < count($_SQL); $i++) { DB_query(current($_SQL), '1'); if (DB_error()) { COM_errorLog("executing " . current($_SQL)); COM_errorLog("Error executing SQL", 1); exit; } next($_SQL); } DB_query("UPDATE {$_TABLES['nxform_fields']} set formid='{$newformid}' WHERE formid='{$cntr}'"); // Need to cycle thru the fields now and update any fieldnames if auto fieldname used $query = DB_query("SELECT id,type FROM {$_TABLES['nxform_fields']} WHERE formid='{$newformid}' AND field_name LIKE '%_frm%'"); while (list($fieldid, $fieldtype) = DB_fetchArray($query)) { $fieldname = "{$CONF_FE['fieldtypes'][$fieldtype][0]}{$newformid}_{$fieldid}"; DB_query("UPDATE {$_TABLES['nxform_fields']} set field_name='{$fieldname}' WHERE id='{$fieldid}'"); } }
/** * Automatic uninstall function for plugins * * @return array * * This code is automatically uninstalling the plugin. * It passes an array to the core code function that removes * tables, groups, features and php blocks from the tables. * Additionally, this code can perform special actions that cannot be * foreseen by the core code (interactions with other plugins for example) * */ function plugin_autouninstall_nexproject() { global $_PRJCONF, $_TABLES; $out = array('tables' => array('prj_category', 'prj_department', 'prj_location', 'prj_objective', 'prj_permissions', 'prj_users', 'prj_projects', 'prj_sorting', 'prj_task_users', 'prj_tasks', 'prj_statuslog', 'prj_session', 'prj_filters', 'prj_lockcontrol', 'prj_projPerms', 'prj_taskSemaphore', 'prj_config'), 'groups' => array('nexProject Admin'), 'features' => array('nexproject.admin'), 'php_blocks' => array('phpblock_projectFilter'), 'vars' => array()); if (prj_forumExists()) { //using this row's config value, we'll delete all forums with this ID as the parent and then chuck out the category itself... $sql = "SELECT * FROM {$_TABLES['gf_forums']} where forum_cat={$_PRJCONF['forum_parent']}"; $forumres = DB_query($sql); while ($X = DB_fetchArray($forumres)) { forum_deleteForum($X['forum_id']); } DB_query("DELETE FROM {$_TABLES['gf_categories']} where id={$_PRJCONF['forum_parent']}"); } if (prj_nexFileExists()) { PLG_itemDeleted($_PRJCONF['nexfile_parent'], 'nexproject_filefolder'); } DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_locations']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_locations']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_locations']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_departments']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_departments']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_departments']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_category']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_category']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_category']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_objective']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_objective']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_objective']}"); return $out; }
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; } }
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'"); } }
/** * Here we do the work */ public function execute($comment) { global $_CONF, $_TABLES, $_USER, $LANG_SX00; if (isset($_USER['uid']) && $_USER['uid'] > 1) { $uid = $_USER['uid']; } else { $uid = 1; } /** * Include Blacklist Data */ $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name='Personal'", 1); $nrows = DB_numRows($result); // named entities $comment = html_entity_decode($comment); // decimal notation $comment = preg_replace_callback('/&#(\\d+);/m', array($this, 'callbackDecimal'), $comment); // hex notation $comment = preg_replace_callback('/&#x([a-f0-9]+);/mi', array($this, 'callbackHex'), $comment); $ans = 0; for ($i = 1; $i <= $nrows; $i++) { list($val) = DB_fetchArray($result); $val = str_replace('#', '\\#', $val); if (preg_match("#{$val}#i", $comment)) { $ans = 1; // quit on first positive match SPAMX_log($LANG_SX00['foundspam'] . $val . $LANG_SX00['foundspam2'] . $uid . $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']); break; } } return $ans; }
/** * Here we do the work */ public function execute($comment) { global $_CONF, $_TABLES, $LANG_SX00; $uid = $this->getUid(); /** * Check for IP of url in blacklist */ /* * regex to find urls $2 = fqd */ $regx = '(ftp|http|file)://([^/\\s]+)'; $num = preg_match_all("#{$regx}#", html_entity_decode($comment), $urls); $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name='IPofUrl'", 1); $nrows = DB_numRows($result); $ans = PLG_SPAM_NOT_FOUND; for ($j = 1; $j <= $nrows; $j++) { list($val) = DB_fetchArray($result); for ($i = 0; $i < $num; $i++) { $ip = gethostbyname($urls[2][$i]); if ($val == $ip) { $ans = PLG_SPAM_FOUND; // quit on first positive match $this->updateStat('IPofUrl', $val); SPAMX_log($LANG_SX00['foundspam'] . $urls[2][$i] . $LANG_SX00['foundspam2'] . $uid . $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']); break; } } if ($ans == PLG_SPAM_FOUND) { break; } } return $ans; }
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; } }
/** * Here we do the work * * @param string $comment * @return int */ public function execute($comment) { global $_TABLES, $_USER, $LANG_SX00, $LANG28; $uid = COM_isAnonUser() ? 1 : $_USER['uid']; // Get homepage URLs of all banned users $result = DB_query("SELECT DISTINCT homepage FROM {$_TABLES['users']} WHERE status = 0 AND homepage IS NOT NULL AND homepage <> ''"); $numRows = DB_numRows($result); // named entities $comment = html_entity_decode($comment); // decimal notation $comment = preg_replace_callback('/&#(\\d+);/m', array($this, 'callbackDecimal'), $comment); // hex notation $comment = preg_replace_callback('/&#x([a-f0-9]+);/mi', array($this, 'callbackHex'), $comment); $ans = 0; for ($i = 0; $i < $numRows; $i++) { list($val) = DB_fetchArray($result); $val = str_replace('#', '\\#', $val); if (preg_match("#{$val}#i", $comment)) { $ans = 1; // quit on first positive match SPAMX_log($LANG_SX00['foundspam'] . $val . ' (' . $LANG28[42] . ')' . $LANG_SX00['foundspam2'] . $uid . $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']); break; } } $this->result = $ans; return $ans; }
/** * Plugin function to delete a comment * $cid Comment to be deleted * $id Item id to which $cid belongs * */ function _mg_deletecomment($cid, $id) { global $_CONF, $_MG_CONF, $_TABLES, $MG_albums; // find the album that holds this peice of media $sql = "SELECT album_id FROM {$_TABLES['mg_media_albums']} WHERE media_id='" . DB_escapeString($id) . "'"; $result = DB_query($sql); $nRows = DB_numRows($result); if ($nRows > 0) { $row = DB_fetchArray($result); $aid = $row['album_id']; if ($MG_albums[0]->owner_id) { $access = 3; } else { $access = $MG_albums[$aid]->access; } } else { $access = 0; } if ($access == 3 || SEC_hasRights('mediagallery.admin')) { if (CMT_deleteComment($cid, $id, 'mediagallery') == 0) { //reduce count in media table $comments = DB_count($_TABLES['comments'], array('sid', 'type'), array(DB_escapeString($id), 'mediagallery')); DB_change($_TABLES['mg_media'], 'media_comments', $comments, 'media_id', DB_escapeString($id)); // Now redirect the program flow to the view of the file and its comments return COM_refresh($_MG_CONF['site_url'] . "/media.php?s={$id}"); } else { return false; } } else { return false; } }
/** * Here we do the work */ function execute($comment) { global $_CONF, $_USER, $_TABLES, $LANG_SX00; if (isset($_USER['uid']) && $_USER['uid'] > 1) { $uid = $_USER['uid']; } else { $uid = 1; } /** * Include Blacklist Data */ $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist'", 1); $nrows = DB_numRows($result); // named entities $comment = html_entity_decode($comment); // decimal notation $comment = preg_replace('/&#(\\d+);/me', "chr(\\1)", $comment); // hex notation $comment = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment); $ans = 0; // Found Flag for ($i = 1; $i <= $nrows; $i++) { list($val) = DB_fetchArray($result); if (@preg_match("#{$val}#i", $comment)) { $ans = 1; // quit on first positive match SPAMX_log($LANG_SX00['fsc'] . $val . $LANG_SX00['fsc1'] . $uid . $LANG_SX00['fsc2'] . $_SERVER['REMOTE_ADDR']); break; } } return $ans; }
function studentsRegisteredForSubject($subject, $period, $stream, $db) { $sql = "SELECT COUNT(*) FROM registered_students WHERE subject_id='{$subject}' AND period_id='{$period}' AND class_id='{$stream}'"; $result = DB_query($sql, $db); $myrow = DB_fetch_row($result); return $myrow[0]; }
/** * Automatic uninstall function for plugins * * @return array * * This code is automatically uninstalling the plugin. * It passes an array to the core code function that removes * tables, groups, features and php blocks from the tables. * Additionally, this code can perform special actions that cannot be * foreseen by the core code (interactions with other plugins for example) * */ function plugin_autouninstall_nextime() { global $CONF_NEXTIME, $_TABLES; $out = array('tables' => array('nextime_timesheet_entry', 'nextime_extra_user_data', 'nextime_locked_timesheets', 'nextime_vars'), 'groups' => array('NexTime Admin', 'NexTime Finance', 'NexTime Supervisors', 'NexTime USER'), 'features' => array('nextime.admin', 'nextime.user'), 'vars' => array()); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$CONF_NEXTIME['nexlist_timesheet_tasks']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$CONF_NEXTIME['nexlist_timesheet_tasks']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$CONF_NEXTIME['nexlist_timesheet_tasks']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$CONF_NEXTIME['nexlist_nextime_activities']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$CONF_NEXTIME['nexlist_nextime_activities']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$CONF_NEXTIME['nexlist_nextime_activities']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$CONF_NEXTIME['nexlist_nextime_projects']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$CONF_NEXTIME['nexlist_nextime_projects']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$CONF_NEXTIME['nexlist_nextime_projects']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$CONF_NEXTIME['nexlist_employee_to_supervisor']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$CONF_NEXTIME['nexlist_employee_to_supervisor']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$CONF_NEXTIME['nexlist_employee_to_supervisor']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$CONF_NEXTIME['nexlist_user_locations']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$CONF_NEXTIME['nexlist_user_locations']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$CONF_NEXTIME['nexlist_user_locations']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$CONF_NEXTIME['nexlist_manager_to_supervisor']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$CONF_NEXTIME['nexlist_manager_to_supervisor']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$CONF_NEXTIME['nexlist_manager_to_supervisor']}"); DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$CONF_NEXTIME['nexlist_employee_to_delegate']}"); DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$CONF_NEXTIME['nexlist_employee_to_delegate']}"); DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$CONF_NEXTIME['nexlist_employee_to_delegate']}"); return $out; }
function plugin_install_captcha() { global $pi_name, $pi_version, $gl_version, $pi_url, $NEWTABLE, $DEFVALUES, $NEWFEATURE; global $_TABLES, $_CONF, $LANG_CP00, $_DB_dbms; COM_errorLog("Attempting to install the {$pi_name} Plugin", 1); $_SQL['cp_config'] = "CREATE TABLE {$_TABLES['cp_config']} ( " . " `config_name` varchar(255) NOT NULL default '', " . " `config_value` varchar(255) NOT NULL default '', " . " PRIMARY KEY (`config_name`) " . " );"; $_SQL['cp_sessions'] = "CREATE TABLE {$_TABLES['cp_sessions']} ( " . " `session_id` varchar(40) NOT NULL default '', " . " `cptime` INT(11) NOT NULL default 0, " . " `validation` varchar(40) NOT NULL default '', " . " `counter` TINYINT(4) NOT NULL default 0, " . " PRIMARY KEY (`session_id`) " . " );"; foreach ($_SQL as $table => $sql) { COM_errorLog("Creating {$table} table", 1); DB_query($sql, 1); if (DB_error()) { COM_errorLog("Error Creating {$table} table", 1); plugin_uninstall_captcha(); return false; exit; } COM_errorLog("Success - Created {$table} table", 1); } $SQL_DEFAULTS = "INSERT INTO `{$_TABLES['cp_config']}` (`config_name`, `config_value`) VALUES " . " ('anonymous_only', '1'), " . " ('remoteusers','0'), " . " ('debug', '0'), " . " ('enable_comment', '0'), " . " ('enable_contact', '0'), " . " ('enable_emailstory', '0'), " . " ('enable_forum', '0'), " . " ('enable_registration', '0'), " . " ('enable_story', '0'), " . " ('gfxDriver', '2'), " . " ('gfxFormat', 'jpg'), " . " ('gfxPath', '');"; DB_query($SQL_DEFAULTS, 1); // Register the plugin with Geeklog COM_errorLog("Registering {$pi_name} plugin with Geeklog", 1); DB_delete($_TABLES['plugins'], 'pi_name', 'captcha'); DB_query("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) " . "VALUES ('{$pi_name}', '{$pi_version}', '{$gl_version}', '{$pi_url}', 1)"); if (DB_error()) { COM_errorLog("Failure registering plugin with Geeklog"); plugin_uninstall_captcha(); return false; exit; } // Create initial log entry CAPTCHA_errorLog("CAPTCHA Plugin Successfully Installed"); COM_errorLog("Successfully installed the {$pi_name} Plugin!", 1); return true; }
/** * Update array if need be with correct topic. * * @param array $A Array of articles from db * @param string $tid_list List of child topics of current topic */ function fixTopic(&$A, $tid_list) { global $_TABLES, $topic; if (!empty($topic)) { // This case may happen if a article belongs to the current topic but the default topic for the article is a child of the current topic. $sql = "SELECT t.topic, t.imageurl\n FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n WHERE t.tid = ta.tid\n AND ta.type = 'article' AND ta.id = '{$A['sid']}' AND ta.tid = '{$topic}'\n " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't'); $result = DB_query($sql); $nrows = DB_numRows($result); if ($nrows > 0) { $B = DB_fetchArray($result); $A['topic'] = $B['topic']; $A['imageurl'] = $B['imageurl']; } else { // Does not belong to current topic so check inherited // Make sure sort order the same as in TOPIC_getTopic or articles with multiple topics might not display in the right topic when clicked $sql = "SELECT t.topic, t.imageurl\n FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n WHERE t.tid = ta.tid\n AND ta.type = 'article' AND ta.id = '{$A['sid']}'\n AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '{$topic}')))\n " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't') . "\n ORDER BY ta.tdefault DESC, ta.tid ASC"; $result = DB_query($sql); $nrows = DB_numRows($result); if ($nrows > 0) { $B = DB_fetchArray($result); $A['topic'] = $B['topic']; $A['imageurl'] = $B['imageurl']; } } } }
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']; }
function update_addFilemanager() { global $_CONF, $_TABLES; $configAdminId = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Configuration Admin' "); $storyAdminId = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Story Admin' "); // Add Filemanager Admin group DB_query("INSERT INTO {$_TABLES['groups']} (grp_id, grp_name, grp_descr, grp_gl_core) VALUES (null, 'Filemanager Admin', 'Has full access to File Manager', 1);"); $groupId = DB_insertId(); // Add features $featureIds = array(); DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'filemanager.admin', 'Ability to use File Manager', 0)"); $featureIds['filemanager.admin'] = DB_insertId(); DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_general', 'Access to configure Filemanager General Settings', 0)"); $featureIds['config.Filemanager.tab_general'] = DB_insertId(); DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_upload', 'Access to configure Filemanager Upload Settings', 0)"); $featureIds['config.Filemanager.tab_upload'] = DB_insertId(); DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_images', 'Access to configure Filemanager Images Settings', 0)"); $featureIds['config.Filemanager.tab_images'] = DB_insertId(); DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_videos', 'Access to configure Filemanager Videos Settings', 0)"); $featureIds['config.Filemanager.tab_videos'] = DB_insertId(); DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_audios', 'Access to configure Filemanager Audios Settings', 0)"); $featureIds['config.Filemanager.tab_audios'] = DB_insertId(); // Add access rights DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['filemanager.admin']}, {$groupId}) "); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['filemanager.admin']}, {$storyAdminId}) "); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_general']}, {$configAdminId}) "); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_upload']}, {$configAdminId}) "); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_images']}, {$configAdminId}) "); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_videos']}, {$configAdminId}) "); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_audios']}, {$configAdminId}) "); // Add group assignment DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id, ug_uid, ug_grp_id) VALUES ({$groupId}, NULL, 1) "); }
/** * Execute the SQL statement to perform a version upgrade. * An empty SQL parameter will return success. * * @param string $version Version being upgraded to * @param array $sql SQL statement to execute * @return integer Zero on success, One on failure. */ function EXP_upgrade_sql($version = 'Undefined', $sql = '') { global $_TABLES, $_CONF_EXP; // We control this, so it shouldn't happen, but just to be safe... if ($version == 'Undefined') { COM_errorLog("Error updating {$_CONF_EXP['pi_name']} - Undefined Version"); return 1; } // If no sql statements passed in, return success if (!is_array($sql)) { return 0; } // Execute SQL now to perform the upgrade COM_errorLOG("--Updating External Pages to version {$version}"); for ($i = 1; $i <= count($sql); $i++) { COM_errorLOG("External Pages Plugin {$version} update: Executing SQL => " . current($sql)); DB_query(current($sql), '1'); if (DB_error()) { COM_errorLog("SQL Error during External Pages plugin update", 1); return 1; break; } next($sql); } return 0; }
function ckeditor_upgrade() { global $_TABLES, $_CONF, $_CK_CONF; $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='ckeditor'"); switch ($currentVersion) { case "1.0.0": require_once $_CONF['path_system'] . 'classes/config.class.php'; $c = config::get_instance(); $c->add('enable_block', 1, 'select', 0, 1, 0, 130, true, 'ckeditor'); case "1.0.1": require_once $_CONF['path_system'] . 'classes/config.class.php'; $c = config::get_instance(); $c->add('fs_filemanager_general', NULL, 'fieldset', 0, 2, NULL, 0, true, 'ckeditor'); $c->add('filemanager_fileroot', '/images/library/userfiles/', 'text', 0, 2, NULL, 20, true, 'ckeditor'); $c->add('filemanager_per_user_dir', true, 'select', 0, 2, 1, 30, true, 'ckeditor'); $c->add('filemanager_browse_only', false, 'select', 0, 2, 1, 40, true, 'ckeditor'); $c->add('filemanager_default_view_mode', 'grid', 'select', 0, 2, 2, 50, true, 'ckeditor'); $c->add('filemanager_show_confirmation', true, 'select', 0, 2, 1, 60, true, 'ckeditor'); $c->add('filemanager_search_box', true, 'select', 0, 2, 1, 70, true, 'ckeditor'); $c->add('filemanager_file_sorting', 'default', 'select', 0, 2, 3, 80, true, 'ckeditor'); $c->add('filemanager_chars_only_latin', true, 'select', 0, 2, 1, 90, true, 'ckeditor'); $c->add('filemanager_date_format', 'Y-m-d H:i:s', 'text', 0, 2, NULL, 100, true, 'ckeditor'); $c->add('filemanager_show_thumbs', true, 'select', 0, 2, 1, 120, true, 'ckeditor'); $c->add('filemanager_generate_thumbnails', true, 'select', 0, 2, 1, 130, true, 'ckeditor'); $c->add('fs_filemanager_upload', NULL, 'fieldset', 0, 3, NULL, 0, true, 'ckeditor'); $c->add('filemanager_upload_restrictions', 'jpg,jpeg,gif,png,svg,txt,pdf,odp,ods,odt,rtf,doc,docx,xls,xlsx,ppt,pptx,ogv,mp4,webm,ogg,mp3,wav', 'text', 0, 3, NULL, 10, true, 'ckeditor'); $c->add('filemanager_upload_overwrite', false, 'select', 0, 3, 1, 20, true, 'ckeditor'); $c->add('filemanager_upload_images_only', false, 'select', 0, 3, 1, 30, true, 'ckeditor'); $c->add('filemanager_upload_file_size_limit', 16, 'text', 0, 3, NULL, 40, true, 'ckeditor'); $c->add('filemanager_unallowed_files', '.htaccess,web.config', 'text', 0, 3, NULL, 50, true, 'ckeditor'); $c->add('filemanager_unallowed_dirs', '_thumbs,.CDN_ACCESS_LOGS,cloudservers', 'text', 0, 3, NULL, 60, true, 'ckeditor'); $c->add('filemanager_unallowed_files_regexp', '/^\\./uis', 'text', 0, 3, NULL, 70, true, 'ckeditor'); $c->add('filemanager_unallowed_dirs_regexp', '/^\\./uis', 'text', 0, 3, NULL, 80, true, 'ckeditor'); $c->add('fs_filemanager_images', NULL, 'fieldset', 0, 4, NULL, 0, true, 'ckeditor'); $c->add('filemanager_images_ext', 'jpg,jpeg,gif,png,svg', 'text', 0, 4, NULL, 10, true, 'ckeditor'); $c->add('fs_filemanager_videos', NULL, 'fieldset', 0, 5, NULL, 0, true, 'ckeditor'); $c->add('filemanager_show_video_player', true, 'select', 0, 5, 1, 10, true, 'ckeditor'); $c->add('filemanager_videos_ext', 'ogv,mp4,webm', 'text', 0, 5, NULL, 20, true, 'ckeditor'); $c->add('filemanager_videos_player_width', 400, 'text', 0, 5, NULL, 30, true, 'ckeditor'); $c->add('filemanager_videos_player_height', 222, 'text', 0, 5, NULL, 40, true, 'ckeditor'); $c->add('fs_filemanager_audios', NULL, 'fieldset', 0, 6, NULL, 0, true, 'ckeditor'); $c->add('filemanager_show_audio_player', true, 'select', 0, 6, 1, 10, true, 'ckeditor'); $c->add('filemanager_audios_ext', 'ogg,mp3,wav', 'text', 0, 6, NULL, 20, true, 'ckeditor'); $c->add('fs_filemanager_editor', NULL, 'fieldset', 0, 7, NULL, 0, true, 'ckeditor'); $c->add('filemanager_edit_enabled', false, 'select', 0, 7, 1, 10, true, 'ckeditor'); $c->add('filemanager_edit_linenumbers', true, 'select', 0, 7, 1, 20, true, 'ckeditor'); $c->add('filemanager_edit_linewrapping', true, 'select', 0, 7, 1, 30, true, 'ckeditor'); $c->add('filemanager_edit_codehighlight', false, 'select', 0, 7, 1, 40, true, 'ckeditor'); $c->add('filemanager_edit_editext', 'txt,csv', 'text', 0, 7, NULL, 50, true, 'ckeditor'); default: DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_CK_CONF['pi_version'] . "',pi_gl_version='" . $_CK_CONF['gl_version'] . "' WHERE pi_name='ckeditor' LIMIT 1"); break; } if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='ckeditor'") == $_CK_CONF['pi_version']) { return true; } else { return false; } }
function forum_admin_list() { global $_TABLES, $LANG_ADMIN, $LANG_GF00, $LANG_GF91, $LANG_GF06, $_CONF, $_FF_CONF; USES_lib_admin(); $retval = ''; $selected = ''; $menu_arr = array(); $admin_list = new Template($_CONF['path'] . 'plugins/forum/templates/admin/'); $admin_list->set_file('admin-list', 'index.thtml'); $admin_list->set_var('block_start', COM_startBlock($LANG_GF91['gfstats'])); $menu_arr = FF_adminNav($LANG_GF06['1']); $admin_list->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG_GF00['instructions'], $_CONF['site_url'] . '/forum/images/forum.png')); // CATEGORIES $numcats = DB_query("SELECT id FROM {$_TABLES['ff_categories']}"); $totalcats = DB_numRows($numcats); // FORUMS $numforums = DB_query("SELECT forum_id FROM {$_TABLES['ff_forums']}"); $totalforums = DB_numRows($numforums); // TOPICS $numtopics = DB_query("SELECT id FROM {$_TABLES['ff_topic']} WHERE pid = 0"); $totaltopics = DB_numRows($numtopics); // POSTS $numposts = DB_query("SELECT id FROM {$_TABLES['ff_topic']}"); $totalposts = DB_numRows($numposts); // VIEWS $numviews = DB_query("SELECT SUM(views) AS TOTAL FROM {$_TABLES['ff_topic']}"); $totalviews = DB_fetchArray($numviews); // AVERAGE POSTS if ($totalposts != 0) { $avgcposts = $totalposts / $totalcats; $avgcposts = round($avgcposts); $avgfposts = $totalposts / $totalforums; $avgfposts = round($avgfposts); $avgtposts = $totalposts / $totaltopics; $avgtposts = round($avgtposts); } else { $avgcposts = 0; $avgfposts = 0; $avgtposts = 0; } // AVERAGE VIEWS if ($totalviews['TOTAL'] != 0) { $avgcviews = $totalviews['TOTAL'] / $totalcats; $avgcviews = round($avgcviews); $avgfviews = $totalviews['TOTAL'] / $totalforums; $avgfviews = round($avgfviews); $avgtviews = $totalviews['TOTAL'] / $totaltopics; $avgtviews = round($avgtviews); } else { $avgcviews = 0; $avgfviews = 0; $avgtviews = 0; } $admin_list->set_var(array('statsmsg' => $LANG_GF91['statsmsg'], 'totalcatsmsg' => $LANG_GF91['totalcats'], 'totalcats' => $totalcats, 'totalforumsmsg' => $LANG_GF91['totalforums'], 'totalforums' => $totalforums, 'totaltopicsmsg' => $LANG_GF91['totaltopics'], 'totaltopics' => $totaltopics, 'totalpostsmsg' => $LANG_GF91['totalposts'], 'totalposts' => $totalposts, 'totalviewsmsg' => $LANG_GF91['totalviews'], 'totalviews' => $totalviews['TOTAL'], 'category' => $LANG_GF91['category'], 'forum' => $LANG_GF91['forum'], 'topic' => $LANG_GF91['topic'], 'avgpmsg' => $LANG_GF91['avgpmsg'], 'avgcposts' => $avgcposts, 'avgfposts' => $avgfposts, 'avgtposts' => $avgtposts, 'avgvmsg' => $LANG_GF91['avgvmsg'], 'avgcviews' => $avgcviews, 'avgfviews' => $avgfviews, 'avgtviews' => $avgtviews)); $admin_list->set_var('block_end', COM_endBlock()); $admin_list->parse('output', 'admin-list'); $retval .= $admin_list->finish($admin_list->get_var('output')); return $retval; }
function MG_getItems($mode = 'sv') { global $MG_albums, $_TABLES, $_MG_CONF; $retval = ''; $aid = 0; if (isset($_REQUEST['aid'])) { $aid = COM_applyFilter($_REQUEST['aid'], true); } $src = 'disp'; if (isset($_REQUEST['src'])) { $src = COM_applyFilter($_REQUEST['src']); } $type = 'mini'; if (isset($_REQUEST['type'])) { $type = COM_applyFilter($_REQUEST['type']); } if ($src != 'disp' && $src != 'orig') { $src = 'tn'; } if ($type != 'full' || $type != 'mini') { $type = 'mini'; } if (isset($MG_albums[$aid]->id)) { if ($MG_albums[$aid]->access >= 1) { $orderBy = MG_getSortOrder($aid, 0); $sql = "SELECT * FROM {$_TABLES['mg_media_albums']} as ma INNER JOIN " . $_TABLES['mg_media'] . " as m " . " ON ma.media_id=m.media_id WHERE ma.album_id=" . (int) $aid . " AND m.include_ss=1 " . $orderBy; $result = DB_query($sql); $nRows = DB_numRows($result); $mediaRows = 0; if ($nRows > 0) { while ($row = DB_fetchArray($result)) { if ($row['media_type'] == 0) { foreach ($_MG_CONF['validExtensions'] as $ext) { if (file_exists($_MG_CONF['path_mediaobjects'] . $src . '/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext)) { $PhotoURL = $_MG_CONF['mediaobjects_url'] . '/' . $src . '/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext; $PhotoPath = $_MG_CONF['path_mediaobjects'] . $src . '/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext; break; } } if ($row['remote_url'] != '') { $viewURL = $row['remote_url']; } else { $viewURL = $_MG_CONF['site_url'] . "/media.php?s=" . $row['media_id']; } $imgsize = @getimagesize($PhotoPath); if ($imgsize == false && $row['remote_media'] != 1) { continue; } if ($row['remote_media'] == 1) { $PhotoURL = $row['remote_url']; } $retval .= '<slide src="' . $PhotoURL . '" caption="' . htmlentities(strip_tags($row['media_title']), ENT_QUOTES, COM_getEncodingt()) . '"/>' . "\n"; } } } } return $retval; } }
function commentfeeds_upgrade() { global $_TABLES, $_CF_CONF; // Bad Behavior handles its database changes automatically, // so only update the version number DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '" . $_CF_CONF['pi_version'] . "', pi_gl_version = '" . $_CF_CONF['gl_version'] . "', pi_homepage = 'http://www.glfusion.org/' WHERE pi_name = 'commentfeeds'"); return true; }