function flushedit($cap) { //вывод редактирования (все страницы с edit) $languages = wra_lang::getlist(); // WRA::debug($cap); // WRA::debug($this); ?> <input type="hidden" value="<?php if (isset($_POST['id'])) { WRA::e($_POST['id']); } else { WRA::e($_REQUEST['id']); } ?> " id="curID" name="curID" /> <div class="content_edit content_edit_<?php WRA::e($this->lang); ?> " <?php if ($this->lang != wra_lang::getdefault()) { WRA::e("style=display:none;"); } ?> > <div class="lang_height"> <div class="lang_block_menu"> <?php foreach ($languages as $l0) { ?> <div <?php if (wra_lang::getdefault() != $l0->alias) { ?> style="display:none"<?php } ?> id="spla-text-<?php WRA::e($l0->alias); ?> " class="over_lang spla sptext sp<?php WRA::e($l0->alias); ?> "><?php WRA::e($l0->name); ?> </div> <div <?php if (wra_lang::getdefault() == $l0->alias) { ?> style="display:none"<?php } ?> class="lila li<?php WRA::e($l0->alias); ?> " id="lang-change-<?php WRA::e($l0->alias); ?> "><a href="#" ><?php WRA::e($l0->name); ?> </a></div> <?php } ?> </div> </div> <div class="input_edit"> <table id="<?php WRA::e($this->id); ?> " width="100%" class="adminedittbl table_edit <?php WRA::e($this->classes); ?> " cellpadding="0" cellspacing="0"> <?php //} $rowi = 0; $columni = 0; $columnbonus = 0; while ($columni < count($this->columns)) { //$this->columns[$columni]->uselanguages=false; if ($this->columns[$columni]->type == column_type_nothing) { $columni++; continue; } $columnbonus = 0; // $languages=wra_lang::getnone(); if ($this->columns[$columni]->uselanguages) { // $languages=wra_lang::getlist(); } // wra_langed::loadlangeddict(); // foreach($languages as $l0){ $this->headerrowstyle = str_replace(";display:none;", "", $this->headerrowstyle); // if($l0->alias!=wra_lang::getdefault()&&$l0->alias!=""){ // $this->headerrowstyle.=";display:none;"; // } ?> <tr id="trla-<?php WRA::e($this->columns[$columni]->name); ?> -<?php WRA::e($this->lang); ?> " <?php if ($this->columns[$columni]->uselanguages) { ?> class="trjust tr<?php WRA::e($this->columns[$columni]->name); ?> tr<?php WRA::e($this->lang); ?> "<?php } ?> <?php if ($this->headerrowstyle != "") { WRA::e(' style="' . $this->headerrowstyle . '"'); } ?> ><?php if ($this->columns[$columni]->uselanguages or $this->lang == wra_lang::getdefault()) { ?> <td <?php if ($this->columns[$columni]->headerstyle != "") { WRA::e(' width="150"'); WRA::e(' style="' . $this->columns[$columni]->headerstyle . '"'); } ?> ><?php WRA::e('<label>' . $this->columns[$columni]->header . '</label>'); ?> </td><?php } $tdcontent = ""; $tdcontent = $this->rows[$rowi][$columni]; //получаем языковое значение // if($this->columns[$columni]->uselanguages){ // $temp=wra_langed::getvalue($this->columns[$columni]->table,$this->columns[$columni]->name,$l0->alias,$this->rows[0]['id']); // $temp = wra_dictionary::getword($tdcontent ,$l0->alias); // if($temp!="") // $tdcontent=$temp; // } $curid = "field" . $this->columns[$columni]->name; if ($this->info != "") { $curid = $this->info . "-" . $curid; } // form for all languages now must have lagv-index in all fileds // not olnly for uselanguages fields // if($this->columns[$columni]->uselanguages){ if ($this->columns[$columni]->type != column_type_images && $this->columns[$columni]->type != column_type_dropdown) { $curid .= "-" . $this->lang; } // } if (isset($_POST["id"]) && !$this->dontrepost) { if (isset($_POST[$curid])) { if ($tdcontent == "") { $tdcontent = $_POST[$curid]; } } } ?> <td><?php if (WRA::r('id') == -1) { $tdcontent = ""; } if (is_array($tdcontent)) { $tdcontent = array_map("stripslashes", $tdcontent); } else { $tdcontent = stripslashes($tdcontent); } if ($this->columns[$columni]->uselanguages or $this->lang == wra_lang::getdefault()) { switch ($this->columns[$columni]->type) { case "column_type_groupit": break; case column_type_id: WRA::e($tdcontent); ?> <input type="hidden" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " readonly="readonly" value="<?php WRA::e($tdcontent); ?> "><?php break; case column_type_bigtext: ?> <textarea <?php if ($this->columns[$columni]->classes != "") { WRA::e('class="' . $this->columns[$columni]->classes . '"'); } ?> <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " <?php if ($this->columns[$columni]->itemstyle != "") { WRA::e(' style="' . $this->columns[$columni]->itemstyle . '"'); } ?> ><?php WRA::e($tdcontent); ?> </textarea><br/><?php if ($this->columns[$columni]->classes == "fieldcontent") { ?> <a href="#" class="uploadpic" id="upic-<?php WRA::e($curid); ?> ">Загрузить картинку</a> <div class="uploadedpics" id="upepic-<?php WRA::e($curid); ?> "> <strong >Загруженные картинки</strong><br/> <table> <tr><td>Картинка</td><td>Путь</td></tr> </table> </div> <br/><a href="javascript:toggleEditor('<?php WRA::e($curid); ?> ');">Вкл/Выкл редактор</a><?php } break; case column_type_check: if ($tdcontent == "") { $tdcontent = $this->columns[$columni]->defaultvalue; } ?> <input <?php WRA::e($this->columns[$columni]->inpprop); ?> <?php if ($tdcontent == 1) { WRA::e('checked="checked"'); } ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " type="checkbox" value="ON"/><?php break; case column_type_textsource: $subrowi = 0; ?> <input <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " readonly="readonly" value="<?php WRA::e($tdcontent); ?> " type="hidden"/> <input <?php WRA::e($this->columns[$columni]->inpprop); ?> id="fieldview<?php WRA::e($this->columns[$columni]->name); ?> " name="<?php WRA::e($curid); ?> " readonly="readonly" value="<?php while ($subrowi < count($this->columns[$columni]->items)) { if ($this->columns[$columni]->items[$subrowi]->key == $tdcontent) { WRA::e($this->columns[$columni]->items[$subrowi]->value); } $subrowi++; } ?> "><?php break; case column_type_textsource_label: $subrowi = 0; ?> <input <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " readonly="readonly" value="<?php WRA::e($tdcontent); ?> " type="hidden"/> <label><?php while ($subrowi < count($this->columns[$columni]->items)) { if ($this->columns[$columni]->items[$subrowi]->key == $tdcontent) { WRA::e($this->columns[$columni]->items[$subrowi]->value); } $subrowi++; } ?> </label><?php break; case column_type_customfield: include $this->columns[$columni]->customfieldpage; break; case column_type_multiselect: $subrowi = 0; if ($tdcontent == '' || $tdcontent == 'Array') { $tdcontent = $this->columns[$columni]->defaultvalue; } if (!is_array($tdcontent)) { $tdar = explode(";", $tdcontent); } else { $tdar = $tdcontent; } $size = 10; //print_r($tdar);die(); if (count($tdar) < $size) { $size = count($tdar); } ?> <select style="width:85%" size="<?php WRA::e($size); ?> " multiple="multiple" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> []"> <?php if ($this->columns[$columni]->canbenull) { ?> <option value="0"></option><?php } while ($subrowi < count($this->columns[$columni]->items)) { if ($this->columns[$columni]->isparent && $this->columns[$columni]->items[$subrowi]->key == $this->rows[0]['id']) { $subrowi++; continue; } ?> <option <?php if (in_array($this->columns[$columni]->items[$subrowi]->key, $tdar)) { WRA::e('selected="selected"'); } ?> value="<?php WRA::e($this->columns[$columni]->items[$subrowi]->key); ?> "><?php WRA::e($this->columns[$columni]->items[$subrowi]->value); ?> </option><?php $subrowi++; } ?> </select><?php break; case column_type_dropdown: $subrowi = 0; if ($tdcontent == "") { $tdcontent = $this->columns[$columni]->defaultvalue; } ?> <select <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> "> <?php if ($this->columns[$columni]->canbenull) { ?> <option value="0"></option><?php } while ($subrowi < count($this->columns[$columni]->items)) { if ($this->columns[$columni]->isparent && $this->columns[$columni]->items[$subrowi]->key == $this->rows[0]['id']) { $subrowi++; continue; } ?> <option <?php if ($this->columns[$columni]->items[$subrowi]->key == $tdcontent) { WRA::e('selected="selected"'); } ?> value="<?php WRA::e($this->columns[$columni]->items[$subrowi]->key); ?> "><?php WRA::e($this->columns[$columni]->items[$subrowi]->value); ?> </option><?php $subrowi++; } ?> </select><?php break; case column_type_password: ?> <input type="password" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " value=""><?php break; case column_type_pic: if ($tdcontent != "") { ?> <img src="<?php WRA::e(WRA::base_url() . $tdcontent); ?> " style="max-width:120px" id="img-<?php WRA::e($curid); ?> "/> <br/> <input type="hidden" value="" name="delpicvalue-<?php WRA::e($curid); ?> " id="delpicvalue-<?php WRA::e($curid); ?> "/> <a href="#" class="delpic" id="delpic-<?php WRA::e($curid); ?> " >удалить</a><br/> <?php } ?> <input type="file" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " ><?php break; case column_type_file: if ($tdcontent != "") { WRA::e($tdcontent); ?> <br/> <?php } else { ?> <input type="file" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " ><?php } break; case column_type_doubletext: $splitnames = explode(" ", $this->columns[$columni]->name); $columnbonus = 1; $val0 = $this->rows[$rowi][$splitnames[0]]; $val1 = $this->rows[$rowi][$splitnames[1]]; ?> <input type="text" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="field<?php WRA::e($splitnames[0]); ?> " name="field<?php WRA::e($splitnames[0]); ?> " value="<?php WRA::e($val0); ?> "> <input type="text" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="field<?php WRA::e($splitnames[1]); ?> " name="field<?php WRA::e($splitnames[1]); ?> " value="<?php WRA::e($val1); ?> "><?php break; case column_type_hidden: if ($tdcontent == "") { $tdcontent = $this->columns[$columni]->defaultvalue; } ?> <input type="hidden" <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " value="<?php WRA::e($tdcontent); ?> "><?php break; case column_type_label: ?> <label><?php WRA::e($tdcontent); ?> </label><?php break; case column_type_datetime: $timestamp = strtotime($tdcontent); if ($tdcontent == "") { $timestamp = time(); } ?> <select id="<?php WRA::e($curid); ?> day" name="<?php WRA::e($curid); ?> day"> <?php for ($i = 1; $i <= 31; $i++) { ?> <option <?php if ($i == date("j", $timestamp)) { WRA::e('selected="selected"'); } ?> value="<?php WRA::e($i); ?> "><?php WRA::e($i); ?> </option> <?php } ?> </select> <?php $monthes = wra_time::getmonthesrp("ru"); ?> <select id="<?php WRA::e($curid); ?> month" name="<?php WRA::e($curid); ?> month"> <?php for ($i = 1; $i <= 12; $i++) { ?> <option <?php if ($i == date("m", $timestamp)) { WRA::e('selected="selected"'); } ?> value="<?php WRA::e($i); ?> "><?php WRA::e($monthes[$i]); ?> </option> <?php } ?> </select> <select id="<?php WRA::e($curid); ?> year" name="<?php WRA::e($curid); ?> year"> <?php for ($i = wra_time::$beginyear; $i <= wra_time::$endyear; $i++) { ?> <option <?php if ($i == date("Y", $timestamp)) { WRA::e('selected="selected"'); } ?> value="<?php WRA::e($i); ?> "><?php WRA::e($i); ?> </option> <?php } ?> </select> <select id="<?php WRA::e($curid); ?> hour" name="<?php WRA::e($curid); ?> hour"> <?php for ($i = 0; $i <= 23; $i++) { ?> <option <?php if ($i == date("H", $timestamp)) { WRA::e('selected="selected"'); } ?> value="<?php WRA::e($i); ?> "><?php WRA::e($i); ?> </option> <?php } ?> </select>:<select id="<?php WRA::e($curid); ?> minute" name="<?php WRA::e($curid); ?> minute"> <?php for ($i = 0; $i <= 59; $i++) { ?> <option <?php if ($i == date("i", $timestamp)) { WRA::e('selected="selected"'); } ?> value="<?php WRA::e($i); ?> "><?php WRA::e($i); ?> </option> <?php } ?> </select> <?php break; case column_type_images: // WRA::debug($tdcontent); if ($this->lang == wra_lang::getdefault()) { ?> <div class="linkadd" target="table_<?php WRA::e($curid); ?> _<?php WRA::e($this->lang); ?> " id="linkadd_<?php WRA::e($this->lang); ?> _<?php WRA::e($curid); ?> ">Добавить фотографию</div><br/><br/><?php } ?> <table id="table_<?php WRA::e($curid); ?> _<?php WRA::e($this->lang); ?> " class="imgstable" style="width:100%"> <thead> <tr> <td style="width:120px">Фотография</td> <td style="width:120px">Ссылка</td> <td>Описание</td><td>Порядок</td> <td>Рамочка</td> <td></td> </tr> </thead> <tbody> <?php // WRA::debug($this->columns[$columni]); // empty pic line // $imgcount = count($this->columns[$columni]->items); ?> <tr class="new empty-img-pattern" id="infopic-new-00" style="display:none;"> <td><img src="" width="120px"/></td> <td><input type="text" class="picheader<?php WRA::e($curid); ?> " value=""/> <input type="hidden" class="path00" name="infopic-path-00" value=""/></td> <td class="old trjust trimage tr<?php WRA::e($this->lang); ?> "> <textarea alias="description_<?php WRA::e($this->lang); ?> " id= "description_<?php WRA::e($this->lang); ?> _<?php WRA::e($curid); ?> " name="fielddescription_<?php WRA::e($this->lang); ?> " class="pidescription<?php WRA::e($curid); ?> "></textarea> </td> <td><input type="text" style="width:50px" class="pisortorder<?php WRA::e($curid); ?> " value=""/></td> <td><input type="checkbox" class="pimorevisual<?php WRA::e($curid); ?> " value="1"/></td> </tr> <tr id="infopicsec-new-00" class="empty-img-pattern" style="display:none;"> <td colspan="4" class="old trjust trimage"> <textarea placeholder="HTML" style="width:490px" alias="htmlcontent" class="pihtmlcontent<?php WRA::e($curid); ?> "></textarea> </td> <td><a href="#" class="deleteinfoimage">удалить</a></td> </tr> <?php // end of empty pic line foreach ($this->columns[$columni]->items as $w0) { ?> <tr id="infopic-old-<?php WRA::e($w0->id); ?> -<?php WRA::e($this->lang); ?> " class="old"> <td> <img src="<?php echo WRA::base_url(); WRA::e($w0->tmbpic); ?> " width="120px"/> </td> <td> <input type="text" style="width:120px" class="picheader<?php WRA::e($curid); ?> " value="<?php WRA::e($w0->header); ?> " name="<?php WRA::e($curid); ?> _pichead_<?php WRA::e($w0->id); ?> _<?php WRA::e($this->lang); ?> "/> <input type="hidden" name="<?php WRA::e($curid); ?> _picfilename_<?php WRA::e($w0->id); ?> _<?php WRA::e($this->lang); ?> " value="<?php WRA::e($w0->tmbpic); ?> "/> </td> <td class="old trjust trimage tr<?php WRA::e($this->lang); ?> " > <textarea alias="description_<?php WRA::e($this->lang); ?> " id= "description_<?php WRA::e($this->lang . '_' . $w0->id); ?> " name="<?php WRA::e($curid); ?> _description_<?php WRA::e($w0->id); ?> _<?php WRA::e($this->lang); ?> " class="pidescription<?php WRA::e($curid); ?> "><?php WRA::e($w0->description); ?> </textarea> </td> <td> <input type="text" style="width:50px" class="pisortorder<?php WRA::e($curid); ?> " value="<?php WRA::e($w0->sortorder); ?> " name="<?php WRA::e($curid); ?> _picsortorder_<?php WRA::e($w0->id); ?> _<?php WRA::e($this->lang); ?> " /> </td> <td> <input type="checkbox" class="pimorevisual<?php WRA::e($curid); ?> " value="1" <?php if ($w0->morevisual == 1) { ?> checked="checked"<?php } ?> name="<?php WRA::e($curid); ?> _morevisual_<?php WRA::e($w0->id); ?> _<?php WRA::e($this->lang); ?> " /> </td> </tr> <tr id="infopic-secold-<?php WRA::e($w0->id); ?> -<?php WRA::e($this->lang); ?> " class="old"> <td colspan="4" class="old trjust trimage" > <textarea placeholder="HTML" style="width:490px" alias="htmlcontent_<?php WRA::e($this->lang); ?> " id= "<?php WRA::e($curid); ?> _pichtmlcontent_<?php WRA::e($w0->id); ?> _<?php WRA::e($this->lang); ?> " name="<?php WRA::e($curid); ?> _pichtmlcontent_<?php WRA::e($w0->id); ?> _<?php WRA::e($this->lang); ?> " class="pihtmlcontent<?php WRA::e($curid); ?> "><?php WRA::e($w0->htmlcontent); ?> </textarea> </td> <td> <a href="#" class="deleteinfoimage">удалить</a> </td> </tr> <?php // WRA::debug($item); } // WRA::debug($this); // WRA::debug($cap); ?> </tbody> </table> <input type="hidden" name="delete-<?php WRA::e($curid); ?> " value="" id="delete-<?php WRA::e($curid); ?> "/> <input type="hidden" name="new-<?php WRA::e($curid); ?> " value="" id="new-<?php WRA::e($curid); ?> "/> <?php break; default: ?> <input <?php WRA::e($this->columns[$columni]->inpprop); ?> id="<?php WRA::e($curid); ?> " name="<?php WRA::e($curid); ?> " value="<?php WRA::e(htmlspecialchars($tdcontent)); ?> "><?php } } if ($this->columns[$columni]->description != "") { ?> <br/><span style="color:#cc0000;"><?php WRA::e($this->columns[$columni]->description); ?> </span><?php } ?> </td><td<?php if ($this->columns[$columni]->tdstyle != "") { WRA::e(' style="' . $this->columns[$columni]->tdstyle . '"'); } ?> width="<?php if ($this->emptywidth != "") { WRA::e($this->emptywidth); } else { WRA::e("0"); } ?> "></td></tr> <?php // } $columni = $columni + $columnbonus; $columni++; } if ($this->useendtable) { ?> <tr><td><?php if ($this->rows[0]['id'] != -1 && $this->info == "") { ?> <br/><a href="#" class="link_save" id="link-save">Сохранить</a><?php } else { ?> <br/><a href="#" class="link_save" id="link-save<?php if ($this->info != "") { WRA::e("-" . $this->info); } ?> ">Добавить</a><?php } ?> </td><td></td></tr> </table></div> </div> <?php } ?> <?php }
function flush() { $thisclass_string = wra_adminmenu::getbaseclass(); $saveid = -1; if (WRA::ir('id')) { $saveid = WRA::r('id'); } $pid = -1; if (WRA::ir('pid')) { $pid = WRA::r('pid'); } if ($thisclass_string != '') { if (wra_adminpage::isedit()) { $languages = wra_lang::getlist(); // WRA::debug($languages); // die(); wra_admintable::flusheditHead($this); foreach ($languages as $l0) { $code = '$wt=' . $thisclass_string . '::edittable(' . $saveid . ',' . $pid . ',' . $l0->alias . ');'; eval($code); $wt->flushedit($this); if (count($wt->subtables) > 0) { foreach ($wt->subtables as $st) { if ($st->subtypeedit) { $st->subtable = true; $st->flushedit($this); } else { $st->subtable = true; $st->flush(); } } } } } else { $code = '$wt=' . $thisclass_string . '::admintable(' . $saveid . ',' . $pid . ');'; eval($code); if ($wt->headertext != '') { WRA::e('<h2>' . $wt->headertext); if ($pid != -1 && $pid != 0) { } WRA::e('</h2>'); } $wt->flush(); if (count($wt->subtables) > 0) { foreach ($wt->subtables as $st) { $st->useheader = false; $st->subtable = true; $st->flush(); } } } } }
<script type="text/javascript"> var infoimages=new Array(); </script> <table id="table<?php WRA::e($curid); ?> " style="width:100%"> <thead> <tr> <td style="width:120px">Фотография</td><td style="width:120px">Ссылка</td><td>Описание</td><td>Порядок</td><td>Рамочка</td><td></td> </tr> </thead><tbody> <?php wra_langed::loadlangeddict(); $languages = wra_lang::getlist(); ?> <?php foreach ($waslist as $w0) { ?> <tr id="infopic-old-<?php WRA::e($w0->id); ?> " class="old"> <td><img src="<?php echo WRA::base_url(); WRA::e($w0->tmbpic); ?> " width="120px"/></td> <td><input type="text" style="width:120px" class="picheader<?php WRA::e($curid);
function run() { $act = @$_REQUEST['act']; switch ($act) { case "ui": $savepc = new wra_image(); $savepc->header = ''; $savepc->description = ''; $ismessage = false; $admimessage = ''; $wimage = wra_admintable::getpic($savepc->pic, $savepc->tmbpic, $ismessage, $admimessage, 'gallery/', 340, 'qqfile', false, true); $savepc->keywords = ''; $savepc->galinfoid = 0; $savepc->width = $wimage->imagewidth; $savepc->height = $wimage->imageheight; $languages = wra_lang::getlist(); $savepc->add("_ru"); $ruid = $savepc->id; foreach ($languages as $l0) { if ($l0->alias != 'ru') { $savepc->add('_' . $l0->alias); } } echo '{"success":true,"imgid":"' . $ruid . '","tmb":"' . WRA::base_url() . $savepc->tmbpic . '"}'; break; case 'uploadimage': $savepc = new wra_image(); $savepc->header = ''; $savepc->description = ''; $ismessage = false; $admimessage = ''; require_once WRA_Path . '/modules/admin/admintable.php'; wra_admintable::getpic($savepc->pic, $savepc->tmbpic, $ismessage, $admimessage, 'gallery/', 240, 'qqfile', false, true); $savepc->keywords = ''; $savepc->galinfoid = -1; $savepc->add(); WRA::e(htmlspecialchars(json_encode(array('success' => true, 'picid' => $savepc->id, 'path' => $savepc->tmbpic, 'oldid' => $_REQUEST['id'])), ENT_NOQUOTES)); break; case 'uploadimagepack': if (isset($_FILES['Filedata'])) { $savepc = new wra_image(); $moreinfo = new wra_iteminfo(); $moreinfo->weight = 0; $moreinfo->alt = ''; $moreinfo->keywords = ''; $moreinfo->autoadres = 0; $moreinfo->adres = ''; $moreinfo->commentopt = 2; $moreinfo->mappriority = 0; $moreinfo->authorid = WRA::curuser()->id; $moreinfo->add(); $savepc->header = ''; $savepc->description = ''; //$savepc->pic=$_POST['fieldpic']; $ismessage = false; $admimessage = ''; require_once '../../modules/admin/admintable.php'; wra_admintable::getpic($savepc->pic, $savepc->tmbpic, $ismessage, $admimessage, 'gallery/', 240, 'Filedata', false, true); $savepc->galleryid = WRA::getreq('galid'); $savepc->keywords = ''; $savepc->infoid = $moreinfo->id; $savepc->add(); } WRA::e($savepc->tmbpic . '~@~' . $savepc->id); break; case 'uploadpic': $savepc = new wra_upfile(); if (isset($_FILES['Filedata'])) { if ($_FILES['Filedata']['size'] != 0) { $savepc->original_filename = $_FILES['Filedata']['name']; $wf = new wra_uploadedfile(WRA_Path); $wf->uploaddir .= 'files/'; $wf->addvalidtype('jpg'); $wf->addvalidtype('png'); $wf->addvalidtype('gif'); $wf->addvalidtype('jpeg'); $wf->addvalidtype('jpeg'); $wf->addvalidtype('docx'); $wf->addvalidtype('pdf'); $wf->addvalidtype('doc'); $wf->upload('Filedata', true); WRA::e($wf->error); if ($wf->error == '') { $savepc->path_to_file = 'upload/files/' . $wf->filename; $savepc->description = $_FILES['Filedata']['name'] . ' - загружено загрузчиком редактора'; $savepc->add(); } else { $ismessage = true; switch ($wf->error) { default: $adminmessage = 'Ошибка загрузки файла'; break; } } } } WRA::e(WRA::base_url() . $savepc->path_to_file); break; } }
static function save($saveid = -1, $pid = -1, $adminedit = "") { $savepc = new wra_langed(); if ($saveid != -1) { $savepc->load($saveid); } $savepc->table = wra_admintable::getpost('fieldtable' . wra_lang::getdefault()); $savepc->field = wra_admintable::getpost('fieldfield' . wra_lang::getdefault()); $savepc->lang = wra_admintable::getpost('fieldlang' . wra_lang::getdefault()); $savepc->value = wra_admintable::getpost('fieldvalue' . wra_lang::getdefault()); $savepc->rowid = wra_admintable::getpost('fieldrowid' . wra_lang::getdefault()); $savepc->key = wra_admintable::getpost('fieldkey' . wra_lang::getdefault()); if ($saveid != -1) { // $savepc->update(); } else { // $savepc->add(); } //echo $savepc->id; //die(); $languages = wra_lang::getlist(); foreach ($languages as $l0) { if ($l0->alias != wra_lang::getdefault()) { wra_langed::setvalue('site', 'table', $l0->alias, $savepc->id, WRA::getpost('fieldtable-' . $l0->alias), WRA::getpost('fieldkey-' . $l0->alias)); wra_langed::setvalue('site', 'field', $l0->alias, $savepc->id, WRA::getpost('fieldfield-' . $l0->alias), WRA::getpost('fieldkey-' . $l0->alias)); wra_langed::setvalue('site', 'lang', $l0->alias, $savepc->id, WRA::getpost('fieldlang-' . $l0->alias), WRA::getpost('fieldkey-' . $l0->alias)); wra_langed::setvalue('site', 'value', $l0->alias, $savepc->id, WRA::getpost('fieldvalue-' . $l0->alias), WRA::getpost('fieldkey-' . $l0->alias)); wra_langed::setvalue('site', 'rowid', $l0->alias, $savepc->id, WRA::getpost('fieldrowid-' . $l0->alias), WRA::getpost('fieldkey-' . $l0->alias)); wra_langed::setvalue('site', 'key', $l0->alias, $savepc->id, WRA::getpost('fieldkey-' . $l0->alias), WRA::getpost('fieldkey-' . $l0->alias)); } } return $savepc->id; }
function delete($lang = "ru") { $wd = new wra_db(); $languages = wra_lang::getlist(); foreach ($languages as $l0) { $wd->query = 'DELETE FROM `' . WRA_CONF::$db_prefix . "image_" . $l0->alias . "` where `id`='{$this->id}'"; // print_r($wd->query); $wd->execute(); } $wd->close(); // wra_objects::deleteobj($this->currentobjid); unset($wd); return true; }
function create($path) { $path = str_replace("-1/", "", $path); if (wra_dir::isystems(WRA_Path . wra_dir::slash() . $path)) { return false; } if (!file_exists(WRA_Path . wra_dir::slash() . $path)) { mkdir(WRA_Path . wra_dir::slash() . $path); } $languages = wra_lang::getlist(); foreach ($languages as $l0) { $l0->createdir(); if (!file_exists(WRA_Path . wra_dir::slash() . "_lang" . wra_dir::slash() . $l0->alias . wra_dir::slash() . $path)) { mkdir(WRA_Path . wra_dir::slash() . "_lang" . wra_dir::slash() . $l0->alias . wra_dir::slash() . $path); } } return true; }