if ($job == 'autoaddmodule') { acceptrequest('newmodfile'); $newmodfile = basename($newmodfile); $ext = strtolower(strrchr($newmodfile, '.')); if ($ext != '.blog' && $ext != '.txt') { catcherror($lna[129]); } $filecontent = readfromfile("{$db_tmpdir}/" . $newmodfile); eval($filecontent); $maxmodid = $blog->countbyquery("SELECT MAX(`modorder`) FROM `{$db_prefix}mods`"); $maxmodid += 1; $blog->query("INSERT INTO `{$db_prefix}mods` VALUES ('{$info['newitemposition']}', '{$info['name']}', '{$info['intro']}', '{$info['newitemactive']}', '{$maxmodid}', 'custom')"); if ($info['newitemactive'] == 1) { recache_mods(); } mod_append($info['content']); @unlink("{$db_tmpdir}/{$newmodfile}"); catchsuccess($finishok2, $backtomodule); } if ($job == 'ordermodule') { acceptrequest('section'); if (!$section) { catcherror($lna[126]); } $mod_array = $blog->getgroupbyquery("SELECT * FROM `{$db_prefix}mods` WHERE `position`='{$section}' AND `active`=1 ORDER BY `modorder`"); for ($i = 0; $i < count($mod_array); $i++) { $mod_array[$i]['desc'] = msubstr($mod_array[$i]['desc'], 0, 15); $puttingcates .= "<option value='" . urlencode($mod_array[$i]['name']) . "'>{$mod_array[$i]['name']} ({$mod_array[$i]['desc']})</option>"; } $realname = array('header' => $lna[71], 'sidebar' => $lna[72], 'footer' => $lna[73], 'prebody' => $lna[1055]); $display_overall .= highlightadminitems('module', 'main');
$finaltime = time(); if ($job == 'store') { $query = "INSERT INTO `{$db_prefix}pages` (pageid,pagetitle,pagecontent,pageauthor,pagetime,pageedittime,closesidebar,htmlstat,ubbstat,emotstat,pagealias) VALUES (null, '{$pagetitle}','{$content}','{$currentuserid}','{$finaltime}', 0, '{$closesidebar}','{$htmlstat}', '{$ubbstat}', '{$emotstat}', '{$pagealias}')"; $blog->query($query); $currentid = db_insert_id(); //Add shortcuts on the top ,shortcuttext,shortcuttarget if ($addshortcut == 1) { $shortcuttext = $shortcutname; $shortcuttarget = $shortcuttarget == '' ? '' : ", 'target'=>'" . admin_convert($shortcuttarget) . "'"; $infotoadd = "\$blogitem['pageshortcut{$currentid}']=array('type'=>'link', 'name'=>'pageshortcut{$currentid}', 'url'=>'" . getlink_pages($currentid, $pagealias) . "', 'text'=>'{$shortcuttext}' {$shortcuttarget});"; $maxmodid = $blog->countbyquery("SELECT MAX(`modorder`) FROM `{$db_prefix}mods`"); $maxmodid += 1; $intro = "{$lna[1128]}{$shortcuttext}"; $blog->query("INSERT INTO `{$db_prefix}mods` VALUES ('header', 'pageshortcut{$currentid}', '{$intro}', '1', '{$maxmodid}', 'custom')"); recache_mods(); mod_append($infotoadd); } } else { $currentid = $itemid; $query = "UPDATE `{$db_prefix}pages` SET pagetitle='{$pagetitle}', pageedittime='{$finaltime}', closesidebar='{$closesidebar}', htmlstat='{$htmlstat}', ubbstat='{$ubbstat}', emotstat='{$emotstat}', pagecontent='{$content}', pagealias='{$pagealias}' WHERE `pageid`='{$id}'"; $blog->query($query); } catchsuccess($finishok, array($backtoaddnew, $backtomanage)); } function autoselect($name, $arrayoption, $arrayvalue, $selectedid = 0, $disabled = 0) { if (empty($selectedid)) { $selectedid = 0; } if ($disabled == 1) { $wdisabled = " disabled='disabled' ";
function add_module($filename) { global $activate, $newplugindir, $blog, $db_prefix; if (is_file("plugin/{$newplugindir}/{$filename}")) { $filecontent = readfromfile("plugin/{$newplugindir}/{$filename}"); eval($filecontent); $maxmodid = $blog->countbyquery("SELECT MAX(`modorder`) FROM `{$db_prefix}mods`"); $maxmodid += 1; $blog->query("INSERT INTO `{$db_prefix}mods` VALUES ('{$info['newitemposition']}', '{$info['name']}', '{$info['intro']}', '{$info['newitemactive']}', '{$maxmodid}', 'custom')"); if ($activate == 1) { recache_mods(); } mod_append($info['content']); } }