function modify_index($iname) { global $dbhandle, $indices, $ib_error, $lsql; // alter the active/inactive status if the change was selected if (isset($_POST['def_index_activ']) && $indices[$iname]['active'] == FALSE) { if (alter_index($iname, 'ACTIVE')) { $indices[$iname]['active'] = TRUE; } else { return FALSE; } } elseif (!isset($_POST['def_index_activ']) && $indices[$iname]['active'] == TRUE) { if (alter_index($iname, 'INACTIVE')) { $indices[$iname]['active'] = FALSE; } else { return FALSE; } } // check if the index properties are modified $uniq_flag = isset($_POST['def_index_uniq']) ? TRUE : FALSE; $acti_flag = isset($_POST['def_index_activ']) ? TRUE : FALSE; if ($indices[$iname]['table'] != $_POST['def_index_table'] || $iname != $_POST['def_index_name'] || $indices[$iname]['dir'] != $_POST['def_index_dir'] || $indices[$iname]['uniq'] != $uniq_flag || $indices[$iname]['active'] != $acti_flag || implode(',', $indices[$iname]['seg']) != strtoupper($_POST['def_index_segs'])) { // drop the old index $lsql = 'DROP INDEX ' . $iname; if (DEBUG) { add_debug('lsql', __FILE__, __LINE__); } if (!@fbird_query($dbhandle, $lsql)) { $ib_error = fbird_errmsg(); return FALSE; } // try to recreate with the new properties if (create_index()) { return TRUE; } else { $lsql = 'CREATE '; if (isset($indices[$iname]['uniq'])) { $lsql .= 'UNIQUE '; } $lsql .= $indices[$iname]['dir'] . " INDEX {$iname} ON " . $indices[$iname]['table'] . ' (' . implode(',', $indices[$iname]['seg']) . ')'; if (DEBUG) { add_debug('lsql', __FILE__, __LINE__); } if (!@fbird_query($trans, $lsql)) { fbird_rollback($trans); $ib_error = fbird_errmsg(); } return FALSE; } } return TRUE; }
$message = sprintf($MESSAGES['HAVE_DEPENDENCIES'], $acc_strings['Index'], $dname, dependencies_string($deps)); } else { if ($s_cust['askdel'] == TRUE) { $s_confirmations['index'] = array('msg' => sprintf($MESSAGES['CONFIRM_INDEX_DELETE'], $dname), 'obj' => $dname); } else { drop_index($dname); } } } // the Create button on the Index panel was pushed if (isset($_POST['acc_index_create'])) { $index_add_flag = TRUE; } // create the index from the form values if (isset($_POST['acc_ind_create_doit'])) { if (!create_index()) { // show the create index form again $index_add_flag = TRUE; } } // the Modify button on the Index panel was pushed if (isset($_POST['acc_index_mod']) && !empty($_POST['acc_index_mname'])) { $s_mod_index = $_POST['acc_index_mname']; } // modify the index from the form values if (isset($_POST['acc_modind_doit'])) { if (modify_index($s_mod_index)) { // on success don't show the modify index form again unset($s_mod_index); } }
function extract_matrix($text, $stop_words) { global $CONFIG; set_time_limit(0); //this avoids timeouts include $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/config.php"; //given the text of the document (with this configuration it is only 1), for each word (excluding stop words) calculates statistics (position in the text) and saves them in the D object $text_info = create_index($text, $stop_words); $keywords = extract_keywords($text_info["positions"]); //most present keywords are extracted from the text, till the limit established by the variable keywords_limit $response = array(); if ($context_limit == 0) { foreach ($keywords as $keyword => $recurrence) { $response[$keyword][$keyword] = $recurrence; } } else { $response = sliding_window_ri($keywords, $width_sliding_window, $text_info["text"]); } //it applies the sliding window algorithm to each keyword to extract the contexts return $response; }
function create_table($dbh, $table_name, $table_schema) { $db_type = get_database_type($dbh); // FIXME ned to traverse schema.php to generate table. $create = "CREATE TABLE {$table_name} ("; foreach ($table_schema['tabledef'] as $name => $def) { $row = $name . " "; switch ($db_type) { case "mysql": case "mysqli": switch ($def['type']) { case "int": $row .= " INT"; break; case "bigint": $row .= " BIGINT"; break; case "uint": $row .= " INT UNSIGNED"; break; case "ubigint": $row .= " BIGINT UNSIGNED"; break; case "char": $row .= " CHAR(" . $def['size'] . ")"; break; case "varchar": $row .= " VARCHAR(" . $def['size'] . ")"; break; case "float": $row .= " FLOAT"; break; case "timestamp": $row .= " DATETIME"; break; case "text": $row .= " TEXT"; break; case "ltext": $row .= " LONGTEXT"; break; case "mtext": $row .= " MEDIUMTEXT"; break; } break; case "pgsql": switch ($def['type']) { case "int": case "uint": $row .= " INTEGER"; break; case "bigint": case "ubigint": $row .= " BIGINT"; break; case "char": $row .= " CHAR(" . $def['size'] . ")"; break; case "varchar": $row .= " VARCHAR(" . $def['size'] . ")"; break; case "float": $row .= " NUMERIC(" . $def['size'] . ")"; break; case "timestamp": $row .= " TIMESTAMP"; break; case "text": case "ltext": case "mtext": $row .= " TEXT"; break; } break; } if (!empty($def['default'])) { $row .= " DEFAULT '" . $def['default'] . "'"; } if (!$def['null']) { $row .= " NOT NULL"; } $select_cols[] = $row; } $create .= join(', ', $select_cols); $create .= ") TYPE=INNODB"; //print $create; $db_result = $dbh->query($create); if (DB::isError($db_result)) { $msg .= "error on create: {$table_name} " . $db_result->getMessage() . "<br>"; } else { $msg .= "Added table: {$table_name}<br>"; } foreach ($table_schema['indexes'] as $index => $def) { $db_result = create_index($dbh, $table_name, $def['rows'], $def['type']); if (DB::isError($db_result)) { $msg .= "error on index: {$index} " . $db_result->getMessage() . "<br>"; } else { $msg .= "Added index: {$index}<br>"; } } // add initial data foreach ($table_schema['alterations'] as $index => $actions) { foreach ($actions as $action) { //print_r($action); if ($action['action'] == "add_data") { $insert = "INSERT INTO " . $action['params']['table'] . " SET "; $cols = array(); foreach ($action['params']['params'] as $col => $value) { $cols[] = $col . "='" . $value . "'"; } $insert .= join(", ", $cols); $db_result = $dbh->query($insert); if (DB::isError($db_result)) { $msg .= "error on insert: {$index} " . $db_result->getMessage() . "<br>"; } else { $msg .= "inserted default data: {$insert}<br>"; } } } } return $msg; }
function extract_matrix($text, $stop_words) { global $width_sliding_window, $IndexingClassificationPath, $context_limit, $IOdir; //given the text of the document (with this configuration it is only 1), for each word (excluding stop words) calculates statistics (position in the text) and saves them in the D object $text_info = create_index($text, $stop_words); $keywords = extract_keywords($text_info["positions"]); //most present keywords are extracted from the text, till the limit established by the variable keywords_limit $response = array(); if ($context_limit == 0) { foreach ($keywords as $keyword => $recurrence) { $response[$keyword][$keyword] = $recurrence; } } else { $response = sliding_window_ri($keywords, $width_sliding_window, $text_info["text"]); } //it applies the sliding window algorithm to each keyword to extract the contexts return $response; }
$xmlDoc = new SimpleXMLElement($xml); //get 5000 latest items $lastId = 0; for ($page = 1; $page <= 50; $page++) { if ($page == 1) { $rows = \com\indigloo\sc\mysql\Post::getLatest(100, array()); } else { $start = $lastId; $direction = 'after'; $rows = \com\indigloo\sc\mysql\Post::getPaged($start, $direction, 100, array()); } foreach ($rows as $row) { $loc = "http://www.3mik.com/item/%s"; $loc = sprintf($loc, $row['pseudo_id']); $urlNode = $xmlDoc->addChild('url'); $urlNode->addChild('loc', $loc); $urlNode->addChild('lastmod', date('Y-m-d')); $lastId = $row['id']; } } $xmlString = $xmlDoc->asXML(); //write to file write_on_disk('sitemap_items.xml', $xmlString); } $mysqli = MySQL\Connection::getInstance()->getHandle(); create_index(); sleep(2); create_groups_map($mysqli); sleep(2); create_items_map($mysqli); $mysqli->close();
set_kvp($r, D_POSTCONTENT, $_POST[D_POSTCONTENT]); create_index(D_POSTDATE, D_POSTDATE); } if (isset($_POST['delete'])) { record_delete($_POST['postid']); create_index(D_POSTDATE, D_POSTDATE); } if (isset($_GET['dc'])) { if (!record_exists($cfl)) { fail(); } delete_kvp($cfl, $_GET['cid'] . '_' . D_NAME); delete_kvp($cfl, $_GET['cid'] . '_' . D_POSTDATE); } if (isset($_POST['rbindex'])) { create_index(D_POSTDATE, D_POSTDATE); } // Edit posts if (isset($_GET['edit'])) { $e = $_GET['edit']; if (!record_exists($e)) { fail(); } echo tpl(T_ADMIN, 'POSTTITLE', get_kvp($e, D_POSTTITLE), 'POSTCONTENT', get_kvp($e, D_POSTCONTENT), 'POSTID', $e, 'SELF', $_SERVER['PHP_SELF']); } else { echo tpl(T_ADMIN, 'POSTTITLE', '', 'POSTCONTENT', '', 'POSTID', '', 'SELF', $_SERVER['PHP_SELF']); } } // Logout if (isset($_POST['logout'])) { session_destroy();