Example #1
0
        $sql = '1';
    } else {
        $sql = $hidefid ? "fid NOT IN({$hidefid})" : '1';
    }
}
if (empty($action)) {
    S::gp(array('fid', 'username', 'uid', 'filename', 'hits', 'ifmore', 'filesize', 'ifless', 'postdate1', 'postdate2', 'orderway', 'asc', 'pernum', 'page'));
    $forumcache = str_replace("<option value=\"{$fid}\">", "<option value=\"{$fid}\" selected>", $forumcache);
    $hitsMoreThan = '0' == $ifmore ? 'checked' : '';
    $hitsLessThan = !$hitsMoreThan ? 'checked' : '';
    $downloadMoreThan = '0' == $ifless ? 'checked' : '';
    $downloadLessThan = !$downloadMoreThan ? 'checked' : '';
    $ascChecked = 'ASC' == $asc ? 'checked' : '';
    $descChecked = !$ascChecked ? 'checked' : '';
    $orderwaySelection = array('uploadtime' => '上传时间', 'size' => '附件大小', 'needrvrc' => '所需威望', 'name' => '附件名', 'hits' => '下载次数');
    $orderwaySelection = formSelect('orderway', $orderway, $orderwaySelection, 'class="select_wa mr20 fl"');
    '' == $postdate2 && ($postdate2 = get_date($timestamp + 86400, 'Y-m-d'));
    '' == $postdate1 && ($postdate1 = get_date($timestamp - 90 * 86400, 'Y-m-d'));
    if (is_numeric($fid)) {
        $sql .= " AND fid=" . S::sqlEscape($fid);
    }
    $username = trim($username);
    if ($username) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $uid = $userService->getUserIdByUserName($username);
    }
    is_numeric($uid) && ($sql .= " AND uid=" . S::sqlEscape($uid, false));
    $filename = trim($filename);
    if ($filename != '') {
        $filename = str_replace('*', '%', $filename);
Example #2
0
 } elseif ('edit' == $action) {
     S::gp(array('nid'));
     !isset($nid) && adminmsg("undefine_action");
     $nav = $navConfigService->get($nid);
     if (!$nav) {
         adminmsg('找不到导航链接配置');
     }
     $navType = $nav['type'];
     tmpResetNavPostions($navType);
     $baseNavList = $navConfigService->findSubNavListByType($navType);
     $navSelection = array();
     foreach ($baseNavList as $tmpNav) {
         $navSelection[$tmpNav['nid']] = '--' . $tmpNav['title'];
     }
     unset($navSelection[$nid]);
     $navSelection = formSelect('parentid', $nav['upid'], array('0' => '-顶级导航') + $navSelection, 'id="parentNavId" class="select_wa"');
     $fontstyle = tmpGetNavTitleStyle($nav['style']);
     if ($nav['style']['b']) {
         $bChecked = "checked";
     }
     if ($nav['style']['i']) {
         $iChecked = "checked";
     }
     if ($nav['style']['u']) {
         $uChecked = "checked";
     }
     $isshowChecked = $nav['isshow'] ? 'checked' : '';
     $nav['target'] == 1 ? $blankChecked = "checked" : ($selfChecked = "checked");
     $listOneChecked = $nav['listtype'] == 'onecol' ? 'checked' : '';
     $listTwoChecked = $nav['listtype'] == 'twocol' ? 'checked' : '';
     require PrintEOT("customnav");
Example #3
0
$position = isset($data) ? recoverPOST("position", $data[0]["Position"]) : recoverPOST("position");
$code = isset($data) ? recoverPOST("code", $data[0]["Code"]) : recoverPOST("code");
$time = isset($data) ? recoverPOST("time", $data[0]["Time"]) : recoverPOST("time");
$situation = isset($data) ? recoverPOST("situation", $data[0]["Situation"]) : recoverPOST("situation");
$principal = isset($data) ? recoverPOST("principal", $data[0]["Principal"]) : recoverPOST("principal");
$edit = isset($data) ? TRUE : FALSE;
$action = isset($data) ? "edit" : "save";
$href = isset($data) ? path(whichApplication() . "cpanel/{$action}/{$ID}/") : path(whichApplication() . "cpanel/add/");
print div("add-form", "class");
print formOpen($href, "form-add", "form-add");
print p(__(_(ucfirst(whichApplication()))), "resalt");
print isset($alert) ? $alert : NULL;
print formInput(array("name" => "title", "class" => "span10 required", "field" => __(_("Title")), "p" => TRUE, "value" => $title));
if (isset($banner)) {
    print __(_("If you change the banner image, this image will be deleted")) . "<br />";
    print img(path($banner, TRUE), array("alt" => "Banner", "class" => "no-border", "style" => "max-width: 780px;"));
    print formInput(array("name" => "banner", "type" => "hidden", "value" => $banner));
}
print formInput(array("type" => "file", "name" => "image", "class" => "required", "field" => __(_("Image")), "p" => TRUE));
$options = array(0 => array("value" => "Top", "option" => __(_("Top")) . " (960x100px)", "selected" => $position === "Top" ? TRUE : FALSE), 1 => array("value" => "Left", "option" => __(_("Left")) . " (120x600px, 250x250px)", "selected" => $position === "Left" ? TRUE : FALSE), 2 => array("value" => "Right", "option" => __(_("Right")) . " (120x600px, 250x250px)", "selected" => $position === "Right" ? TRUE : FALSE), 3 => array("value" => "Bottom", "option" => __(_("Bottom")) . " (960x100px)", "selected" => $position === "Bottom" ? TRUE : FALSE), 4 => array("value" => "Center", "option" => __(_("Center")) . " (600x100px)", "selected" => $position === "Center" ? TRUE : FALSE));
print formSelect(array("name" => "position", "class" => "required", "p" => TRUE, "field" => __(_("Position"))), $options);
print formInput(array("name" => "URL", "class" => "span10 required", "field" => __(_("URL")), "p" => TRUE, "value" => $URL));
print formTextarea(array("name" => "code", "class" => "span10 required", "style" => "height: 150px;", "field" => __(_("Code")), "p" => TRUE, "value" => $code));
$options = array(0 => array("value" => 1, "option" => __(_("Yes")), "selected" => (int) $principal === 1 ? TRUE : FALSE), 1 => array("value" => 0, "option" => __(_("No")), "selected" => (int) $principal === 0 ? TRUE : FALSE));
print formSelect(array("name" => "principal", "class" => "required", "p" => TRUE, "field" => __(_("Principal"))), $options);
$options = array(0 => array("value" => "Active", "option" => __(_("Active")), "selected" => $situation === "Active" ? TRUE : FALSE), 1 => array("value" => "Inactive", "option" => __(_("Inactive")), "selected" => $situation === "Inactive" ? TRUE : FALSE));
print formSelect(array("name" => "situation", "class" => "required", "p" => TRUE, "field" => __(_("Situation"))), $options);
print formSave($action);
print formInput(array("name" => "ID", "type" => "hidden", "value" => $ID));
print formClose();
print div(FALSE);
Example #4
0
         pwDelatt($photo['path'], $db_ifftp);
         $lastpos = strrpos($photo['path'], '/') + 1;
         pwDelatt(substr($photo['path'], 0, $lastpos) . 's_' . substr($photo['path'], $lastpos), $db_ifftp);
         pwFtpClose($ftp);
         $affected_rows = delAppAction('photo', $pid) + 1;
         countPosts("-{$affected_rows}");
     }
     $uids = array_unique($uids);
     updateUserAppNum($uids, 'photo', 'recount');
     adminmsg('operate_success', "{$basename}&action=photos&job=list&aid={$aid}&aname=" . rawurlencode($aname) . "&uploader=" . rawurlencode($uploader) . "&pintro=" . rawurlencode($pintro) . "&uptime_s={$uptime_s}&uptime_e={$uptime_e}&orderway={$orderway}&ordertype={$ordertype}&lines={$lines}&page={$page}&");
 } else {
     require_once R_P . 'u/require/core.php';
     S::gp(array('aid', 'aname', 'uploader', 'pintro', 'uptime_s', 'uptime_e', 'orderway', 'ordertype', 'lines', 'page'));
     $cnpho = array();
     $orderBySelection = array('default' => '默认排序', 'uptime' => '上传日期', 'hits' => '浏览数', 'c_num' => '评论数');
     $orderBySelection = formSelect('orderway', $orderway, $orderBySelection, 'class="select_wa fl mr20"');
     $uptimeStartString = $uptime_s && is_numeric($uptime_s) ? get_date($uptime_s, 'Y-m-d') : $uptime_s;
     $uptimeEndString = $uptime_e && is_numeric($uptime_e) ? get_date($uptime_e, 'Y-m-d') : $uptime_e;
     !is_numeric($lines) && ($lines = 30);
     if (empty($aid) && empty($aname) && empty($uploader) && empty($pintro) && empty($uptime_s) && empty($uptime_e)) {
         $noticeMessage = getLangInfo('cpmsg', 'noenough_condition');
     } else {
         $uptime_s = $uptime_s && !is_numeric($uptime_s) ? PwStrtoTime($uptime_s) : $uptime_s;
         $uptime_e = $uptime_e && !is_numeric($uptime_e) ? PwStrtoTime($uptime_e) : $uptime_e;
         $uptime_e && ($sqluptime_e = $uptime_e + 86400);
         $urladd = '';
         $sql = "ca.atype='0'";
         if ($aid) {
             $sql .= ' AND ca.aid =' . S::sqlEscape($aid);
             $urladd .= '&aid=' . $aid;
         }
Example #5
0
 $pstart = $pstart ? (int) $pstart : '';
 $pend = $pend ? (int) $pend : '';
 $tcounts = $tcounts ? (int) $tcounts : '';
 $counts = $counts ? (int) $counts : '';
 $fid = $fid ? (int) $fid : '-1';
 $sphinxChecked = $sphinx ? 'checked' : '';
 $nums = intval($nums) && intval($nums) > 0 ? (int) $nums : $db_perpage;
 $searchDisplay === null && ($searchDisplay = 'none');
 $postTableList = array();
 if ($db_plist) {
     foreach ($db_plist as $key => $val) {
         $name = $val ? $val : ($key != 0 ? getLangInfo('other', 'posttable') . $key : getLangInfo('other', 'posttable'));
         $postTableList[$key] = $name;
     }
 }
 $postTableSelections = $postTableList ? formSelect('ptable', $ptable, $postTableList, 'class="select_wa"') : '';
 if (!$counts && !$tcounts && $fid == '-1' && !$keyword && !$tid && !$author && !$authorid && !$userip && !$pstart && !$pend) {
     $noticeMessage = getLangInfo('cpmsg', 'noenough_condition');
     include PrintEot('thread');
     exit;
 }
 is_numeric($fid) && $fid > 0 && ($sql .= " AND fid=" . S::sqlEscape($fid));
 if ($tid) {
     $tids = array();
     $tid_array = explode(",", $tid);
     foreach ($tid_array as $value) {
         is_numeric($value) && ($tids[] = (int) $value);
     }
     $tids && ($sql .= " AND tid IN(" . S::sqlImplode($tids) . ")");
 }
 $pstart && ($sql .= " AND pid>" . S::sqlEscape($pstart));
Example #6
0
         $db->update("DELETE FROM pw_cwritedata WHERE id=" . S::sqlEscape($id));
         $colony = $newColony->getColonyById($writedb['cyid']);
         $colony['writenum']--;
         updateGroupLevel($colony['id'], $colony);
         //* $db->update("UPDATE pw_colonys SET writenum=writenum-1 WHERE id=". S::sqlEscape($writedb['cyid']));
         $db->update(pwQuery::buildClause("UPDATE :pw_table SET writenum=writenum-1 WHERE id=:id", array('pw_colonys', $writedb['cyid'])));
         $affected_rows = delAppAction('write', $id) + 1;
         countPosts("-{$affected_rows}");
     }
     $uids = array_unique($uids);
     updateUserAppNum($uids, 'owrite', 'recount');
     adminmsg('operate_success', "{$basename}&action=write&job=list&content=" . rawurlencode($content) . "&username="******"&postdate_s={$postdate_s}&postdate_e={$postdate_e}&ordertype={$ordertype}&lines={$lines}&page={$page}&");
 } else {
     S::gp(array('content', 'username', 'cid', 'cname', 'postdate_s', 'postdate_e', 'ordertype', 'page', 'lines'));
     empty($o_classdb) && ($o_classdb = array());
     $colonySelection = formSelect('cid', $cid, array('-1' => '不限制') + $o_classdb, 'class="select_wa"');
     $postdateStartString = $postdate_s && is_numeric($postdate_s) ? get_date($postdate_s, 'Y-m-d') : $postdate_s;
     $postdateEndString = $postdate_e && is_numeric($postdate_e) ? get_date($postdate_e, 'Y-m-d') : $postdate_e;
     $ascChecked = $ordertype == 'asc' ? 'checked' : '';
     $descChecked = !$ascChecked ? 'checked' : '';
     $postdate_s && !is_numeric($postdate_s) && ($postdate_s = PwStrtoTime($postdate_s));
     $postdate_e && !is_numeric($postdate_e) && ($postdate_e = PwStrtoTime($postdate_e));
     $sql = $urladd = '';
     if ($content) {
         $content = str_replace('*', '%', $content);
         $sql .= $sql ? ' AND' : '';
         $sql .= ' w.content LIKE ' . S::sqlEscape($content);
         $urladd .= '&content=' . rawurlencode($content);
     }
     if ($username) {
         $username = str_replace('*', '%', $username);
Example #7
0
         $updatenum += $db->affected_rows();
         list($app_table, $app_filed) = getCommTypeTable($thiscomm['type']);
         if ($updatenum && $app_table && $thiscomm['typeid']) {
             $db->update("UPDATE {$app_table} SET c_num=c_num-" . S::sqlEscape($updatenum) . " WHERE {$app_filed}=" . S::sqlEscape($thiscomm['typeid']));
         }
         countPosts("-{$updatenum}");
     }
     adminmsg('operate_success', "{$basename}&job=list&title=" . rawurlencode($title) . "&username="******"&type={$type}&typeid={$typeid}&postdate_s={$postdate_s}&postdate_e={$postdate_e}&ordertype={$ordertype}&lines={$lines}&page={$page}&");
 } else {
     S::gp(array('type', 'typeid', 'title', 'username', 'postdate_s', 'postdate_e', 'ordertype', 'page', 'lines'));
     $lines = $lines ? $lines : $db_perpage;
     $ascChecked = $ordertype == 'asc' ? 'checked' : '';
     $descChecked = !$ascChecked ? 'checked' : '';
     $postdateStartString = $postdate_s && is_numeric($postdate_s) ? get_date($postdate_s, 'Y-m-d') : $postdate_s;
     $postdateEndString = $postdate_e && is_numeric($postdate_e) ? get_date($postdate_e, 'Y-m-d') : $postdate_e;
     $commentTypeSelections = formSelect('type', $type, array('diary' => 'ÈÕÖ¾', 'photo' => 'ÕÕƬ', 'board' => 'ÁôÑÔ'), 'class="select_wa"', '--ÇëÑ¡Ôñ--');
     if (empty($type) && empty($title) && empty($username) && empty($postdate_s) && empty($postdate_e)) {
         $noticeMessage = getLangInfo('cpmsg', 'noenough_condition');
     } else {
         $postdate_s && !is_numeric($postdate_s) && ($postdate_s = PwStrtoTime($postdate_s));
         $postdate_e && !is_numeric($postdate_e) && ($postdate_e = PwStrtoTime($postdate_e));
         $postdate_e && ($sqlpostdate_e = $postdate_e + 86400);
         $sql = $urladd = '';
         if ($type) {
             $sql .= $sql ? ' AND' : '';
             $sql .= ' type=' . S::sqlEscape($type);
             $urladd .= '&type=' . $type;
         }
         if ($typeid) {
             $sql .= $sql ? ' AND' : '';
             $sql .= ' typeid=' . S::sqlEscape($typeid);
Example #8
0
function getSearch()
{
    global $Load;
    $Load->helper(array("forms", "html"));
    $application = whichApplication();
    if ($application === "users") {
        $field = "username";
        $name = __(_("Username"));
    } else {
        $field = "title";
        $name = __(_("Title"));
    }
    $fields = array(0 => array("field" => "ID", "name" => "ID", "selected" => FALSE), 1 => array("field" => $field, "name" => $name, "selected" => TRUE));
    $trash = NULL;
    if (segment(3, isLang()) === "trash") {
        $trash = "trash";
    }
    $HTML = formOpen(path($application . "/cpanel/results/{$trash}"), "form-results-search");
    $HTML .= br();
    $HTML .= bold("&nbsp" . __(_("Search")) . ":", FALSE);
    $attributes = array("p" => FALSE, "name" => "search", "class" => "span 1 required");
    $HTML .= formInput($attributes);
    $HTML .= bold(" " . __(_("Field")) . ":", FALSE);
    $i = 0;
    foreach ($fields as $field) {
        $fields[$i]["value"] = $field["field"];
        $fields[$i]["option"] = $field["name"];
        $fields[$i]["selected"] = $field["selected"];
        $i++;
    }
    $HTML .= formSelect(array("name" => "field", "class" => "span2 required"), $fields);
    $HTML .= bold(__(_("Order")) . ":", FALSE);
    $options[0]["value"] = "ASC";
    $options[0]["option"] = __(_("Ascending"));
    $options[0]["selected"] = TRUE;
    $options[1]["value"] = "DESC";
    $options[1]["option"] = __(_("Descending"));
    $options[1]["selected"] = FALSE;
    $HTML .= formSelect(array("name" => "order", "class" => "span2 required"), $options);
    $HTML .= formInput(array("name" => "seek", "type" => "submit", "class" => "btn btn-info", "value" => __(_("Seek"))));
    return $HTML;
}
Example #9
0
 public function getLibrary($type)
 {
     $this->type = $type;
     $action = NULL;
     if (POST("iDelete") and POST("iLibrary")) {
         $this->getAction("iDelete", POST("iLibrary"));
     } elseif (POST("dDelete") and POST("dLibrary")) {
         $this->getAction("dDelete", POST("dLibrary"));
     } elseif (POST("iMake")) {
         $this->getAction("make", FALSE, POST("iDir", "clean"), POST("iDirname", "clean"));
     } elseif (POST("dMake")) {
         $this->getAction("make", FALSE, POST("dDir", "clean"), POST("dDirname", "clean"));
     }
     if ($type === "images") {
         $this->px = "i";
         $this->path = "www/lib/files/images/uploaded/";
         $text = __(_("Images library"));
     } elseif ($type === "documents") {
         $this->px = "d";
         $this->path = "www/lib/files/documents/uploaded/";
         $text = __(_("Documents library"));
     }
     $action = segment(0, isLang()) . _sh . segment(1, isLang()) . _sh . segment(2, isLang());
     $href = segment(0, isLang()) . _sh . segment(1, isLang());
     $URL = path();
     $alert = "onclick=\"document.getElementById('form-add').target='';";
     $alert .= "document.getElementById('form-add').action='" . $URL . $action . "/#" . $this->px . "Library';";
     $alert .= "return confirm('" . __(_("Do you want to delete the file?")) . "');\"";
     $event = "onclick=\"document.getElementById('form-add').target=''; ";
     $event .= "document.getElementById('form-add').action='" . $URL . $action . _sh . "#" . $this->px . "Library';\"";
     $path = path($href . "/upload/" . strtolower($this->type) . "/#" . $this->px . "Library");
     $target = "document.getElementById('form-add').target='" . $this->px . "Upload'; ";
     $action = "document.getElementById('form-add').action='" . $path . "'; ";
     $submit = "javascript:submit(); ";
     $eventUpload = 'onclick="' . $target . $action . $submit . '"';
     $HTML = a($this->px . "Library");
     if ($this->type === "images") {
         $aEvents = "onclick=\"showElement(document.getElementById('" . $this->px . "-library'));\" title=\"" . __(_("Click to show or hide")) . "\" class=\"pointer\"";
     } else {
         $aEvents = "onclick=\"showElement(document.getElementById('" . $this->px . "-library1'));\" title=\"" . __(_("Click to show or hide")) . "\" class=\"pointer\"";
     }
     $HTML .= formField($aEvents, $text);
     if ($this->type === "images") {
         if (POST("iGo") or POST("iMake") or POST("iDelete")) {
             $HTML .= div($this->px . "-library");
         } else {
             $HTML .= div($this->px . "-library", "id/class", "no-display");
         }
     } else {
         if (POST("dGo") or POST("dMake") or POST("dDelete")) {
             $HTML .= div($this->px . "-library1");
         } else {
             $HTML .= div($this->px . "-library1", "id/class", "no-display");
         }
     }
     $HTML .= div("extra", "class");
     $selected = NULL;
     if (POST($this->px . "Dirbase")) {
         if (POST($this->px . "Dirbase") !== $this->path) {
             $dir = str_replace($this->path, "/", POST($this->px . "Dirbase"));
             $selected = '<option value="' . POST($this->px . "Dirbase") . '" selected="selected">' . $dir . '</option>';
         }
     }
     if ($type === "images") {
         if (POST("iMake") and POST("iDirname") != "") {
             if (POST("iDirname") !== $this->path) {
                 $dir = str_replace($this->path, "/", POST("iDir"));
                 $selected = '<option value="' . POST("iDir") . slug(POST("iDirname")) . '/" selected="selected">';
                 $selected .= $dir . slug(POST("iDirname")) . '/</option>';
             }
         }
     } elseif ($type === "documents") {
         if (POST("dMake") and POST("dDirname") !== "") {
             if (POST("dDirname") !== $this->path) {
                 $dir = str_replace($this->path, "/", POST("dDir"));
                 $selected = '<option value="' . POST("dDir") . slug(POST("dDirname")) . '/" selected="selected">';
                 $selected .= $dir . slug(POST("dDirname")) . '/</option>';
             }
         }
     }
     $value = POST($this->px . "Dirbase") ? POST($this->px . "Dirbase") : $this->path;
     $value = POST($this->px . "Make") ? POST($this->px . "Dir") . slug(POST($this->px . "Dirname")) : $value;
     $parts = explode("/", $value);
     if (count($parts) > 0) {
         $part = NULL;
         for ($i = 0; $i <= count($parts) - 1; $i++) {
             $part .= slug($parts[$i]) . "/";
         }
         $part = str_replace("//", "/", $part);
     }
     $attributes = array("name" => $this->px . "Dir", "value" => $part, "type" => "hidden");
     $HTML .= formInput($attributes);
     $attributes = array("name" => $this->px . "Px", "value" => $this->px, "type" => "hidden");
     $HTML .= formInput($attributes);
     $attributes = array("name" => $this->px . "Application", "value" => $this->application, "type" => "hidden");
     $HTML .= formInput($attributes);
     $attributes = array("name" => $this->px . "Path", "value" => $this->path, "type" => "hidden");
     $HTML .= formInput($attributes);
     if (SESSION("ZanUserPrivilegeID") < 3) {
         $attributes = array("name" => $this->px . "Dirname", "type" => "text", "class" => "required");
         $HTML .= formInput($attributes);
         $attributes = array("name" => $this->px . "Make", "value" => __(_("Make directory")), "type" => "submit", "class" => "btn btn-info", "events" => $event);
         $HTML .= formInput($attributes);
         if (count($this->getDirs($this->path)) > 1) {
             $attributes = array("name" => $this->px . "Dirbase", "class" => "required");
             $HTML .= formSelect($attributes, $this->getDirs($this->path), $selected);
             $attributes = array("name" => $this->px . "Go", "value" => __(_("Go")), "type" => "submit", "class" => "btn btn-warning", "events" => $event);
             $HTML .= formInput($attributes);
             $HTML .= br();
         } else {
             $HTML .= br();
         }
         $HTML .= small(span("bold", __(_("The new folders will be created and the files will be uploaded in")) . ": ") . $part);
         $HTML .= br();
         if ($type === "images") {
             $HTML .= small(span("bold", __(_("Support files"))) . ": jpg, jpeg, png, gif " . __(_("and")) . " bmp.");
         } elseif ($type === "documents") {
             $formats = "csv, doc, docx, exe, pdf, ppt, pptx, rar, xls, xlsx " . __(_("and")) . " zip";
             $HTML .= small(span("bold", __(_("Support files"))) . ": " . $formats);
         }
         $HTML .= "<br />";
     }
     $HTML .= div(FALSE);
     $HTML .= div("library", "class");
     $HTML .= $this->getFiles($type);
     $HTML .= div(FALSE);
     $HTML .= div($this->px . "-upload-message", TRUE);
     $HTML .= formUploadFrame($this->px, $eventUpload);
     if (SESSION("ZanUserPrivilegeID") < 3) {
         $attributes = array("name" => $this->px . "Delete", "value" => __(_("Delete")), "type" => "submit", "class" => "btn btn-danger", "events" => $alert);
         $HTML .= formInput($attributes);
     }
     $HTML .= div(FALSE);
     return $HTML;
 }
Example #10
0
         $updatenum += $db->affected_rows();
         list($app_table, $app_filed) = getCommTypeTable($thiscomm['type']);
         if ($updatenum && $app_table && $thiscomm['typeid']) {
             $db->update("UPDATE {$app_table} SET c_num=c_num-" . S::sqlEscape($updatenum) . " WHERE {$app_filed}=" . S::sqlEscape($thiscomm['typeid']));
         }
         countPosts("-{$updatenum}");
     }
     adminmsg('operate_success', "{$basename}&job=list&title=" . rawurlencode($title) . "&username="******"&type={$type}&typeid={$typeid}&postdate_s={$postdate_s}&postdate_e={$postdate_e}&ordertype={$ordertype}&lines={$lines}&page={$page}&");
 } else {
     S::gp(array('type', 'typeid', 'title', 'username', 'postdate_s', 'postdate_e', 'ordertype', 'page', 'lines'));
     $lines = $lines ? $lines : $db_perpage;
     $ascChecked = $ordertype == 'asc' ? 'checked' : '';
     $descChecked = !$ascChecked ? 'checked' : '';
     $postdateStartString = $postdate_s && is_numeric($postdate_s) ? get_date($postdate_s, 'Y-m-d') : $postdate_s;
     $postdateEndString = $postdate_e && is_numeric($postdate_e) ? get_date($postdate_e, 'Y-m-d') : $postdate_e;
     $commentTypeSelections = formSelect('type', $type, array('diary' => '日志', 'photo' => '照片', 'board' => '留言'), 'class="select_wa"', '--请选择--');
     if (empty($type) && empty($title) && empty($username) && empty($postdate_s) && empty($postdate_e)) {
         $noticeMessage = getLangInfo('cpmsg', 'noenough_condition');
     } else {
         $postdate_s && !is_numeric($postdate_s) && ($postdate_s = PwStrtoTime($postdate_s));
         $postdate_e && !is_numeric($postdate_e) && ($postdate_e = PwStrtoTime($postdate_e));
         $postdate_e && ($sqlpostdate_e = $postdate_e + 86400);
         $sql = $urladd = '';
         if ($type) {
             $sql .= $sql ? ' AND' : '';
             $sql .= ' type=' . S::sqlEscape($type);
             $urladd .= '&type=' . $type;
         }
         if ($typeid) {
             $sql .= $sql ? ' AND' : '';
             $sql .= ' typeid=' . S::sqlEscape($typeid);
Example #11
0
            // Form element
            $optionValue = getOption('enclosure', $defaultValue);
            print formElement(formLabel('enclosure', 'CSV enclosure'), formSelect('enclosure', $optionValue, array('"' => 'Double quote (")', "'" => "Single quote (')")));
            // Apply delimiter
            $reader->setOption('enclosure', $optionValue);
            break;
        case 'loadSheet':
            // Available sheets
            $tSheets = $reader->getSheetNames($excelFile);
            $sheets = array();
            foreach ($tSheets as $sheet) {
                $sheets[$sheet] = $sheet;
            }
            // Form element
            $optionValue = getOption('loadSheet', $tSheets[0]);
            print formElement(formLabel('loadSheet', 'Excel sheet'), formSelect('loadSheet', $optionValue, $sheets));
            // Apply sheet
            $loadSheet = $optionValue;
            $reader->setOption('loadSheet', $optionValue);
            break;
    }
}
function getOption($name, $default = null)
{
    global $sessionOptions;
    return array_key_exists($name, $sessionOptions) ? $sessionOptions[$name] : $default;
}
print formElement('', formSubmit('filter', 'Save options'));
print formEnd();
########################################################################################################################
## Print Excel sheet ###################################################################################################
Example #12
0
 public function build()
 {
     $HTML = NULL;
     $hide = FALSE;
     $option = FALSE;
     foreach ($this->columns as $column) {
         if (!in_array($column["Field"], $this->hide)) {
             if (count($this->hide) > 0) {
                 if ($this->hideString and !$hide) {
                     $attributes = array("type" => "hidden", "name" => "_hide", "value" => base64_encode($this->hideString));
                     $HTML .= formInput($attributes);
                     unset($attributes);
                     $hide = TRUE;
                 }
             }
             if ($this->type($column["Type"]) === "string") {
                 $attributes = array("type" => "text", "name" => $column["Field"], "class" => "input", "field" => $this->rename($column["Field"]), "p" => TRUE, "value" => !$this->success ? recoverPOST($column["Field"]) : NULL);
                 if (isset($this->options)) {
                     if (!$option) {
                         $HTML .= formInput(array("type" => "hidden", "name" => "_options", "value" => base64_encode(serialize($this->options))));
                         $option = TRUE;
                     }
                     if (isset($this->options[$column["Field"]])) {
                         if ($this->options[$column["Field"]]["type"] === "select") {
                             $attrs = array("name" => $column["Field"], "class" => "select", "field" => $this->rename($column["Field"]), "p" => TRUE);
                             $HTML .= formSelect($attrs, $this->options[$column["Field"]]["options"]);
                             unset($attrs);
                         } elseif ($this->options[$column["Field"]]["type"] === "radio") {
                             $attrs = array("name" => $column["Field"], "class" => "radio", "field" => $this->rename($column["Field"]), "p" => TRUE);
                             $HTML .= formRadio($attrs, $this->options[$column["Field"]]["options"]);
                             unset($attrs);
                         } elseif ($this->options[$column["Field"]]["type"] === "password") {
                             $attrs = array("name" => $column["Field"], "type" => "password", "class" => "input", "field" => $this->rename($column["Field"]), "p" => TRUE);
                             $HTML .= formInput($attrs);
                             unset($attrs);
                         } elseif ($this->options[$column["Field"]]["type"] === "hidden") {
                             $attrs = array("name" => $column["Field"], "type" => "hidden", "value" => isset($this->options[$column["Field"]]["value"]) ? $this->options[$column["Field"]]["value"] : NULL);
                             $HTML .= formInput($attrs);
                             unset($attrs);
                         }
                     } else {
                         $HTML .= formInput($attributes);
                     }
                 } else {
                     $HTML .= formInput($attributes);
                 }
                 unset($attributes);
             } elseif ($this->type($column["Type"]) === "text") {
                 $attributes = array("name" => $column["Field"], "class" => "editor textarea", "field" => $this->rename($column["Field"]), "p" => TRUE, "value" => !$this->success ? recoverPOST($column["Field"]) : NULL);
                 $HTML .= formTextarea($attributes);
             }
         }
     }
     $HTML .= p(TRUE, "center");
     $attributes = array("type" => "submit", "name" => "save", "value" => __("Save"), "class" => "submit");
     $HTML .= formInput($attributes);
     unset($attributes);
     $attributes = array("type" => "submit", "name" => "cancel", "value" => __("Cancel"), "class" => "submit");
     $HTML .= formInput($attributes);
     unset($attributes);
     $HTML .= p(FALSE);
     $HTML .= formClose();
     return $HTML;
 }