Exemple #1
0
 function editsettings()
 {
     cHeader($this->name, 'editsettings');
     $id = $GLOBALS['_GET']['id'];
     echo "\n        <script src='ce.js'></script>\n        <script src='content.js'></script>\n        <script>" . GetTemplFunc() . "</script>\n        ";
     if ($id) {
         $row = $this->getRow("SELECT * FROM `{$this->table_settings}` WHERE `id`='{$id}'");
     }
     $form = $this->form->AddForm($this, $id, 'savesettings');
     $this->form->addHiddenFields(array('ref' => '?page=dead_links&do=settings', 'type' => '0', 'do' => 'savesettings'));
     $tab_main_html = forms_get_dev_fields(@$row, $this->name) . "\n        <label class='float'>" . $this->str('title') . "<span>*</span>:</label><input class='text' type='text' name='fld[title]' value='" . @$row['title'] . "' maxlength='255' /><br />\n        <label class='float'>" . $this->str('table') . "<span>*</span>:</label><input class='text' type='text' name='fld[table]' value='" . @$row['table'] . "' maxlength='255' /><br />\n        <label class='float'>" . $this->str('url_format') . "<span>*</span>:</label><input class='text' type='text' name='fld[url_format]' value='" . @$row['url_format'] . "' maxlength='255' /><br />";
     $tab_main = $this->form->AddTab($tab_main_html, 'main', $this->str('main'));
     echo $this->form->draw();
     cFooter();
 }
Exemple #2
0
 function SelectThumb()
 {
     define('NO_MENU', true);
     $GLOBALS['limit'] = 10;
     $GLOBALS['_SESSION']['ref'] = "?page=" . $this->name . "&do=selectthumb";
     function fmt_link($val)
     {
         return "<a href='" . FILES_DIR . "/" . $val . "' target=_blank><img src='images/icons/view.png' width=16 height=16 border=0 hspace=0></a>";
     }
     if (!isset($_GET['dir']) && $_SESSION['dir']) {
         $dir = $_SESSION['dir'];
     } else {
         $dir = $_GET['dir'];
         $_SESSION['dir'] = $dir;
     }
     echo "\n\t\t<script>\n\t\tvar smallSetted = false;\n\t\tvar bigSetted = false;\n\t\tfunction SelectPic(name) {\n\t\t    if (name!='') document.getElementById('pic').src = '" . FILES_DIR . "/'+name;\n\t\t    document.forms.pasteform.small_pic.value = name;\n\t\t    document.cookie = \"image_small = \"+name;\n\t\t}\n\t\tfunction ViewPic(name) {\n\t\t    if (!name) return;\n\t\t    document.getElementById('pic').src = '" . FILES_DIR . "/'+name;\n\t\t}\n\t\tfunction SmallPic(name) {\n\t\t    document.all.smallname.innerText = name;\n\t\t    document.all.smallname.title = name;\n\t\t    document.all.smalltd.background = '" . FILES_DIR . "/'+name;\n\t\t    document.all.smalltab.bgColor = 'blue';\n\t\t    smallSetted = true;\n\t\t    if (bigSetted) document.all.thumb.disabled = false;\n\t\t}\n\t\tfunction BigPic(name) {\n\t\t    document.forms.pasteform.big_pic.value = name;\n\t\t    document.cookie = \"image_big = \"+name;\n\t\t}\n\t\tfunction SetPic() {\n\t\t    if (opener) {\n\t\t        if (document.forms.pasteform.small_pic.value && document.forms.pasteform.big_pic.value) {\n\t\t            opener.InsertTemplate('', '<a href=\"" . CFILES_DIR . "/'+\n\t\t            document.forms.pasteform.big_pic.value+\n\t\t            '\" onclick=\"openImage(this.href); return false;\" target=_blank><img src=\"" . CFILES_DIR . "/'+\n\t\t            document.forms.pasteform.small_pic.value+\n\t\t            '\" border=0></a>');\n\t\t            SelectPic('');\n\t\t            BigPic('');\n\t\t            opener.focus();\n\t\t        } else if (document.forms.pasteform.small_pic.value) {\n\t\t            opener.InsertTemplate('', '<img class=border src=\"" . CFILES_DIR . "/'+\n\t\t            document.forms.pasteform.small_pic.value+\n\t\t            '\" border=0>');\n\t\t            SelectPic('');\n\t\t            BigPic('');\n\t\t            opener.focus();\n\t\t        } else alert('" . $this->str('e_no_pic') . "');\n\t\t    } else alert('No opener window');\n\t\t}\n\t\tfunction startProc(item) {\n\t\t    if (!item.file.value) {\n\t\t        alert('" . $this->str('e_no_file') . "');\n\t\t        return false;\n\t\t    }\n\t\t    item.sbm.disabled = true;\n\t\t    if (item.file.value) item.sbm.value = '" . $this->str('wait') . "';\n\t\t    return true;\n\t\t}\n\t\tfunction mkdir() {\n\t\t    dirname = document.getElementById('createfolder').value;\n\t\t    if (!dirname) {\n\t\t        alert('" . $this->str('e_no_dirname') . "');\n\t\t        return false;\n\t\t    }\n\t\t    location.href = '" . $_SERVER["PHP_SELF"] . "?page=" . $this->name . "&do=makedir&select=SelectThumb&newdir=' + dirname + '&dir=" . $dir . "&image={$image}&aimage={$aimage}';\n\t\t}\n\t\t</script>\n\t\t";
     cHeader($this->name);
     # Блок выбранных картинок
     echo "\n\t\t<table cellpadding=4 cellspacing=0 width=100% height=100%><tr><td valign=top nowrap>\n\t\t";
     function fmt_name($val)
     {
         global $row;
         $href = $row['dimensions'] != 'n/a' ? "SelectPic(\"" . $row['name'] . "\")" : "";
         return "<a href='javascript:" . $href . "' title='" . str('setpic', 'images') . "'>" . $row['name'] . "</a>";
     }
     function fmt_big($val)
     {
         global $row;
         $href = $row['dimensions'] != 'n/a' ? "BigPic(\"" . $row['name'] . "\")" : "";
         return "<a href='javascript:" . $href . "' title='" . str('set_big', 'images') . "'><img src='" . BASE . "images/icons/big.gif' width=16 height=16 border=0></a>";
     }
     #Блок отображения файлов
     $this->ListFiles('selectthumb');
     # Блок отправки в редактор
     echo "\n\t\t<h5>" . $this->str('paste_head') . "</h5>\n\t\t<form name=pasteform>\n\t\t<table cellpadding=0 cellspacing=0>\n\t\t<tr><td>" . $this->str('small_pic') . ":&nbsp;</td><td><input class=disabled type=text name=small_pic READONLY value=\"" . $_COOKIE['image_small'] . "\"> <a href='javascript:ViewPic(document.forms.pasteform.small_pic.value)'><img src='" . BASE . "images/icons/green_arrow.gif' width=16 height=16 border=0 alt='" . $this->str('setpic') . "'></a></td></tr>\n\t\t<tr><td nowrap>" . $this->str('big_pic') . "<img align=absmiddle src='" . BASE . "images/icons/big.gif' width=16 height=16 border=0 hspace=4>:&nbsp;</td><td nowrap><input class=disabled type=text name=big_pic READONLY value=\"" . $_COOKIE['image_big'] . "\"> <a href='javascript:ViewPic(document.forms.pasteform.big_pic.value)'><img src='" . BASE . "images/icons/green_arrow.gif' width=16 height=16 border=0 alt='" . $this->str('setpic') . "'></a></td></tr>\n\t\t</table>\n\t\t<br>\n\t\t<input type=button value='" . $this->str('paste') . "' onclick='SetPic()'>\n\t\t<input type=button value='" . $this->str('reset') . "' onClick=\"SelectPic(''); BigPic('');\">\n\t\t</form>\n\t\t";
     # Блок закачки
     echo "\n\t\t</td><td valign=top width=100%>\n\t\t\t<div align=left><b>" . $this->str('picture') . "</b></div>\n\t\t\t<br>\n\t\t\t<div align=left style='border: 1px solid silver; width: 100%; height: 90%; overflow-y: scroll; overflow-x: scroll;'>\n\t\t\t<img id=pic src=images/s.gif>\n\t\t\t</div>\n\t\t</td></tr>\n\t\t<tr><td colspan=2>\n\t\t\t<hr size=1>\n\n\t\t\t<h5>" . $this->str('createfolder') . "</h5>\n\t\t\t<input type=text name=createfolder size=20 id=createfolder>\n\t\t\t&nbsp;<button onclick='mkdir();' title='" . $this->str('createfolder') . "'>" . $this->str('createfolder') . "</button>\n\n\t\t\t<h5>" . $this->str('upload') . "</h5>\n\t\t\t<form method=post name=edit onsubmit='return startProc(this)' enctype='multipart/form-data'>\n\t\t\t<input type=file name=file size=20>\n\t\t\t<input type=submit name=sbm value='" . $this->str('submit') . "'>\n\t\t\t<input type=hidden name=do value=edit>\n\t\t\t<input type=hidden name=page value=" . $this->name . ">\n\t\t\t<input type=hidden name=dir value=" . $dir . ">";
     if ($GLOBALS['resamle_options']) {
         echo "\n\t\t\t\t<br>" . $this->str('resample') . ": <select name=resample><option value=0>" . $this->str('no') . " " . $this->GetArrayOption($GLOBALS['resamle_options'], '') . "</select> <span class=note>" . $this->str('_resample') . "</span>";
     }
     echo "\n\t\t\t</form>\n\t\t</td></tr>\n\t\t</table>\n\t\t";
     cFooter();
 }
Exemple #3
0
function Lock($table, $id)
{
    if (!$id) {
        return false;
    }
    # check locked
    $check = GetLock($table, $id);
    if ($check) {
        cHeader('', '', str('locked_head'));
        echo '<br /><span class="check">' . $check . '</span><br /><br /><br /><br />' . "\n";
        cFooter();
        return true;
    }
    session_start();
    $_SESSION['lock_table'] = $table;
    $_SESSION['lock_id'] = $id;
    session_write_close();
    # lock
    mysql_unbuffered_query("update " . $table . " set locked_till=unix_timestamp(date_add(now(), interval " . $GLOBALS['params']->Get('lock_time') . " minute)), locked_by='" . $GLOBALS['user']['id'] . "' where id=" . $id) or die(mysql_error());
    return false;
}