GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — p2-php/ic2_setrank.php at master · thermon/p2-php Expand file tree/ Copy pathic2_setrank.phpMore file actions 104 lines (80 loc) · 2.16 KB / Copy pathic2_setrank.phpFile metadata and controls104 lines (80 loc) · 2.16 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 <?php /** * ImageCache2 - 画像のランクを変更する */ // {{{ p2基本設定読み込み&認証 require_once './conf/conf.inc.php'; $_login->authorize(); if (!$_conf['expack.ic2.enabled']) { p2die('ImageCache2は無効です。', 'conf/conf_admin_ex.inc.php の設定を変えてください。'); } // }}} // {{{ HTTPヘッダとXML宣言 P2Util::header_nocache(); header('Content-Type: text/html; charset=Shift_JIS'); // }}} // {{{ 初期化 // パラメータを検証 $remove = !empty($_GET['remove']); if (!isset($_GET['id']) || !(isset($_GET['rank']) || $remove)) { echo '-1'; exit; } $id = (int) $_GET['id']; $rank = isset($_GET['rank']) ? (int) $_GET['rank'] : 0; if ($id <= 0 || $rank > 5 || ($rank < -1 && !($remove && $rank == -5))) { echo '0'; exit; } // ライブラリ読み込み require_once 'PEAR.php'; require_once 'DB.php'; require_once 'DB/DataObject.php'; require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; // }}} // {{{ execute $finder = new IC2_DataObject_Images; $finder->whereAdd(sprintf('id = %d', $id)); $code = -1; if ($finder->find(1)) { if ($rank != -5) { $setter = new IC2_DataObject_Images; $setter->rank = $rank; $setter->whereAddQuoted('size', '=', $finder->size); $setter->whereAddQuoted('md5', '=', $finder->md5); $setter->whereAddQuoted('mime', '=', $finder->mime); if ($setter->update()) { $code = 1; } else { $code = 0; } } if ($remove) { global $_info_msg_ht; require_once P2EX_LIB_DIR . '/ic2/managedb.inc.php'; $orig_info_msg_ht = $_info_msg_ht; $_info_msg_ht = ''; $removed_files = manageDB_remove(array($finder->id), $rank < 0); if ($code != 0 && $_info_msg_ht === '') { $code = 1; } else { $code = 0; } $_info_msg_ht = $orig_info_msg_ht; } } echo $code; exit; // }}} /* * Local Variables: * mode: php * coding: cp932 * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: nil * End: */ // vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker: |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |