Exemple #1
0
 public function parse($isUpdate = false)
 {
     Ibos::import("application.extensions.simple_html_dom", true);
     if ($isUpdate) {
         $model = preg_replace("/\\s+data-id\\s?=\\s?\"?\\d+\"?/i", "", $this->printmodel);
         $max = 0;
     } else {
         $model = $this->printmodel;
         $max = intval($this->itemmax);
     }
     $elements = array();
     $doc = new simple_html_dom();
     $doc->load($model, true, true, CHARSET);
     $items = $doc->find("ic");
     $config = $this->getItemConfig();
     if (!empty($items) && !empty($config)) {
         $this->refactor($items, $config, $max, $elements);
     }
     $html = $doc->save();
     $this->_cache = $elements;
     CacheUtil::set("form_" . $this->ID, $elements);
     $form["printmodelshort"] = $html;
     if ($max != $this->itemmax) {
         $form["itemmax"] = $max;
     }
     $doc->clear();
     FlowFormType::model()->modify($this->ID, $form);
 }
Exemple #2
0
 public function actionCropImg()
 {
     if (EnvUtil::submitCheck("userSubmit")) {
         $params = $_POST;
         if (!isset($params) && empty($params)) {
             return null;
         }
         $tempAvatar = $params["src"];
         $avatarPath = "data/avatar/";
         $avatarBig = UserUtil::getAvatar($params["uid"], "big");
         $avatarMiddle = UserUtil::getAvatar($params["uid"], "middle");
         $avatarSmall = UserUtil::getAvatar($params["uid"], "small");
         if (LOCAL) {
             FileUtil::makeDirs($avatarPath . dirname($avatarBig));
         }
         FileUtil::createFile("data/avatar/" . $avatarBig, "");
         FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
         FileUtil::createFile("data/avatar/" . $avatarSmall, "");
         Ibos::import("ext.ThinkImage.ThinkImage", true);
         $imgObj = new ThinkImage(THINKIMAGE_GD);
         $imgObj->open($tempAvatar)->crop($params["w"], $params["h"], $params["x"], $params["y"])->save($tempAvatar);
         $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
         $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
         $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
         $this->success(Ibos::lang("Upload avatar succeed"), $this->createUrl("home/personal", array("op" => "avatar")));
         exit;
     }
 }
Exemple #3
0
 protected function init()
 {
     Ibos::setPathOfAlias("engineDriver", Ibos::getPathOfAlias("ext.enginedriver.sae"));
     $alias = Ibos::getPathOfAlias("engineDriver");
     $classes = array("CMemCache" => $alias . "/caching/CMemCache.php", "CDbCommand" => $alias . "/db/CDbCommand.php", "CDbConnection" => $alias . "/db/CDbConnection.php");
     Ibos::$classMap = CMap::mergeArray(Ibos::$classMap, $classes);
     Ibos::import("engineDriver.*");
 }
Exemple #4
0
 public static function getTplEditorContent($file)
 {
     Ibos::import("application.extensions.simple_html_dom", true);
     $doc = file_get_html($file);
     if (!$doc) {
         return null;
     }
     $e = $doc->find("div[id=page_content]", 0);
     if (!$e) {
         return null;
     }
     return $e->innertext;
 }
Exemple #5
0
 public function createChart($counter, $className, $properties = array())
 {
     $className = Ibos::import($className, true);
     $chart = new $className($counter);
     $this->chkInstance($chart);
     if (isset($this->charts[$className])) {
         $properties = $properties === array() ? $this->charts[$className] : CMap::mergeArray($this->charts[$className], $properties);
     }
     foreach ($properties as $name => $value) {
         $chart->{$name} = $value;
     }
     return $chart;
 }
Exemple #6
0
 public function createAdapter($className, $config = array(), $properties = array())
 {
     $className = Ibos::import($className, true);
     $adapter = new $className($config);
     $this->chkInstance($adapter);
     if ($adapter->check()) {
         foreach ($properties as $name => $value) {
             $adapter->{$name} = $value;
         }
         return $adapter;
     } else {
         $this->setError($className, $adapter->getError());
         return false;
     }
 }
Exemple #7
0
 private function setCommonBg($src)
 {
     $bgPath = "data/home/";
     $random = StringUtil::random(16);
     $bgBig = $random . "_big.jpg";
     $bgMiddle = $random . "_middle.jpg";
     $bgSmall = $random . "_small.jpg";
     FileUtil::createFile($bgPath . $bgBig, "");
     FileUtil::createFile($bgPath . $bgMiddle, "");
     FileUtil::createFile($bgPath . $bgSmall, "");
     Ibos::import("ext.ThinkImage.ThinkImage", true);
     $imgObj = new ThinkImage(THINKIMAGE_GD);
     $imgObj->open($src)->thumb(1000, 300, 1)->save($bgPath . $bgBig);
     $imgObj->open($src)->thumb(520, 156, 1)->save($bgPath . $bgMiddle);
     $imgObj->open($src)->thumb(400, 120, 1)->save($bgPath . $bgSmall);
     $data = array("desc" => "", "status" => 0, "system" => 0, "image" => $random);
     $addRes = BgTemplate::model()->add($data);
     return $addRes;
 }
Exemple #8
0
 private function readLicence($licencekey)
 {
     $c = "";
     if (strpos($licencekey, "|") == false) {
         return false;
     }
     list($pre, $c) = explode("|", $licencekey);
     if (empty($c)) {
         return false;
     }
     $modulus = "247951816413205085921106286398120136896788014055199338629780778472204077308053767006218018324142651909195596003106594609159002643031774387211432583166542583483099049359378164797170552666392349957500492002826361302903529659499530039.0000000000";
     $public = "65537";
     $keylength = "768";
     Ibos::import("ext.auth.RSA", true);
     $RSA = new RSA();
     $pre = base64_decode($pre);
     $key = $RSA->verify($pre, $public, $modulus, $keylength);
     $key = trim($key, "");
     Ibos::import("ext.auth.AES", true);
     $AES = new AES(true);
     $keys = $AES->makeKey($key);
     $s = $AES->decryptString($c, $keys);
     $s = json_decode($s, true);
     return $s;
 }
Exemple #9
0
function restoreZip($id)
{
    $path = PATH_ROOT;
    if (strstr($path, 'data')) {
        $id = trim(str_replace('data', '', $id), '/');
    }
    if (!file_exists($id)) {
        return array('success' => 0, 'msg' => Ibos::lang('Database import file illegal', 'dashboard.default'));
    }
    $dataFileVol1 = trim(EnvUtil::getRequest('datafilevol1', 'G'));
    $multiVol = intval(EnvUtil::getRequest('multivol', 'G'));
    Ibos::import('ext.Zip', true);
    $unzip = new SimpleUnzip();
    $unzip->ReadFile($id);
    if ($unzip->Count() == 0 || $unzip->GetError(0) != 0 || !preg_match("/\\.sql\$/i", $importFile = $unzip->GetName(0))) {
        return array('success' => 0, 'msg' => Ibos::lang('Database import file illegal', 'dashboard.default'));
    }
    $identify = explode(',', base64_decode(preg_replace("/^# Identify:\\s*(\\w+).*/s", "\\1", substr($unzip->GetData(0), 0, 256))));
    $confirm = EnvUtil::getRequest('confirm', 'G');
    $confirm = !is_null($confirm) ? 1 : 0;
    if (!$confirm && $identify[1] != VERSION) {
        return array('type' => 'confirm', 'msg' => Ibos::lang('Database import confirm', 'dashboard.default'), 'url' => 'restore.php?' . http_build_query(array('op' => 'restorezip', 'confirm' => 'yes', 'id' => $id)));
    }
    $sqlFileCount = 0;
    foreach ($unzip->Entries as $entry) {
        if (preg_match("/\\.sql\$/i", $entry->Name)) {
            $fp = fopen('backup/' . $entry->Name, 'w');
            fwrite($fp, $entry->Data);
            fclose($fp);
            $sqlFileCount++;
        }
    }
    if (!$sqlFileCount) {
        return array('success' => 0, 'msg' => Ibos::lang('Database import file illegal', 'dashboard.default'));
    }
    if ($multiVol) {
        $multiVol++;
        $id = preg_replace("/-(\\d+)(\\..+)\$/", "-{$multiVol}\\2", $id);
        if (file_exists($multiVol)) {
            $param = array('op' => 'restorezip', 'multivol' => $multiVol, 'datafilevol1' => $dataFileVol1, 'delunzip' => $dataFileVol1, 'confirm' => 'yes');
            return array('type' => 'confirm', 'msg' => Ibos::lang('Database import multivol unzip redirect', 'dashboard.default', array('multivol' => $multiVol)), 'url' => 'restore.php?' . http_build_query($param));
        } else {
            $param = array('op' => 'restore', 'id' => $dataFileVol1, 'autorestore' => 'yes', 'delunzip' => 'yes');
            return array('type' => 'confirm', 'msg' => Ibos::lang('Database import multivol confirm', 'dashboard.default'), 'url' => 'restore.php?' . http_build_query($param));
        }
    }
    $info = '<b>' . basename($id) . '</b><br />' . Ibos::lang('Version') . ': ' . $identify[1] . '<br />' . Ibos::lang('Type') . ': ' . $identify[2] . '<br />' . Ibos::lang('Backup method') . ': ' . ($identify[3] == 'multivol' ? Ibos::lang('DBMultivol') : Ibos::lang('DBShell')) . '<br />';
    if ($identify[3] == 'multivol' && $identify[4] == 1 && preg_match("/-1(\\..+)\$/", $id)) {
        $dataFileVol1 = $id;
        $id = preg_replace("/-1(\\..+)\$/", "-2\\1", $id);
        if (file_exists($id)) {
            $param = array('op' => 'restorezip', 'multivol' => 1, 'datafilevol1' => 'backup/' . $importFile, 'id' => $id, 'confirm' => 'yes');
            return array('type' => 'redirect', 'msg' => Ibos::lang('Database import multivol unzip redirect', 'dashboard.default', array('multivol' => 1)), 'url' => 'restore.php?' . http_build_query($param));
        }
    }
    $param = array('op' => 'restore', 'datafilevol1' => $dataFileVol1, 'id' => 'backup/' . $importFile, 'delunzip' => 'yes', 'autorestore' => 'yes');
    return array('type' => 'confirm', 'msg' => Ibos::lang('Database import unzip', 'dashboard.default', array('info' => $info)), 'url' => 'restore.php?' . http_build_query($param));
}
Exemple #10
0
									<i class='os-company'></i>
									<span data-node-type="departmentName"><?php 
echo isset($unit['fullname']) ? $unit['fullname'] : '';
?>
</span>
								</a>
							</td>
							<td>--</td>
							<td><?php 
echo $lang['Headquarters'];
?>
</td>
							<td class='posr'></td>
						</tr>
						<?php 
Ibos::import('ext.Tree', true);
if ($perEdit) {
    $editOp = "<a href='javascript:;' class='org-dep-btn' data-action='moveupDept' title='上移'><i class='glyphicon-arrow-up'></i></a>\r\n\t\t\t\t\t\t\t\t\t<a href='javascript:;' class='org-dep-btn' data-action='movedownDept' title='下移'><i class='glyphicon-arrow-down'></i></a>";
} else {
    $editOp = '';
}
if ($perDel) {
    $delOp = "<a href='javascript:;' class='org-dep-btn' data-action='removeDept' title='删除'><i class='glyphicon-remove'></i></a>";
} else {
    $delOp = '';
}
foreach ($dept as $key => $value) {
    $type = $value['isbranch'] ? 'Branch' : 'Department';
    // 图标
    if ($value['manager'] > 0) {
        $manager = User::model()->fetchByUid($value['manager']);
Exemple #11
0
 public static function iIconv($str, $inCharset, $outCharset = CHARSET, $forceTable = false)
 {
     $inCharset = strtoupper($inCharset);
     $outCharset = strtoupper($outCharset);
     if (empty($str) || $inCharset == $outCharset) {
         return $str;
     }
     $out = "";
     if (!$forceTable) {
         if (function_exists("iconv")) {
             $out = iconv($inCharset, $outCharset . "//IGNORE", $str);
         } elseif (function_exists("mb_convert_encoding")) {
             $out = mb_convert_encoding($str, $outCharset, $inCharset);
         }
     }
     if ($out == "") {
         Ibos::import("ext.chinese.Chinese", true);
         $chinese = new Chinese($inCharset, $outCharset, true);
         $out = $chinese->Convert($str);
     }
     return $out;
 }
Exemple #12
0
 public function actionIndex()
 {
     $operation = EnvUtil::getRequest("op");
     switch ($operation) {
         case "thumbpreview":
         case "waterpreview":
             $temp = Ibos::engine()->IO()->file()->getTempPath() . "/watermark_temp.jpg";
             if (LOCAL) {
                 if (is_file($temp)) {
                     @unlink($temp);
                 }
             }
             $quality = EnvUtil::getRequest("quality");
             $source = PATH_ROOT . "/static/image/watermark_preview.jpg";
             if ($operation == "waterpreview") {
                 $trans = EnvUtil::getRequest("trans");
                 $type = EnvUtil::getRequest("type");
                 $val = EnvUtil::getRequest("val");
                 $pos = EnvUtil::getRequest("pos");
                 if ($type == "image") {
                     $sInfo = ImageUtil::getImageInfo($source);
                     $wInfo = ImageUtil::getImageInfo($val);
                     if ($sInfo["width"] < $wInfo["width"] || $sInfo["height"] < $wInfo["height"]) {
                         Ibos::import("ext.ThinkImage.ThinkImage", true);
                         $imgObj = new ThinkImage(THINKIMAGE_GD);
                         $imgObj->open($val)->thumb(260, 77, 1)->save($val);
                     }
                     ImageUtil::water($source, $val, $temp, $pos, $trans, $quality);
                 } else {
                     $hexColor = EnvUtil::getRequest("textcolor");
                     $size = EnvUtil::getRequest("size");
                     $fontPath = EnvUtil::getRequest("fontpath");
                     $rgb = ConvertUtil::hexColorToRGB($hexColor);
                     ImageUtil::waterMarkString($val, $size, $source, $temp, $pos, $quality, $rgb, self::TTF_FONT_PATH . $fontPath);
                 }
                 $image = $temp;
             }
             if (!LOCAL) {
                 if (Ibos::engine()->IO()->file()->createFile($temp, file_get_contents($image))) {
                     $image = FileUtil::fileName($temp);
                 }
             }
             $data = array("image" => $image, "sourceSize" => ConvertUtil::sizeCount(FileUtil::fileSize($source)), "thumbSize" => ConvertUtil::sizeCount(FileUtil::fileSize($image)), "ratio" => sprintf("%2.1f", FileUtil::fileSize($image) / FileUtil::fileSize($source) * 100) . "%");
             $this->render("imagePreview", $data);
             exit;
             break;
         case "upload":
             return $this->imgUpload("watermark", true);
             break;
     }
     $formSubmit = EnvUtil::submitCheck("uploadSubmit");
     $uploadKeys = "attachdir,attachurl,thumbquality,attachsize,filetype";
     $waterMarkkeys = "watermarkminwidth,watermarkminheight,watermarktype,watermarkposition,watermarktrans,watermarkquality,watermarkimg,watermarkstatus,watermarktext,watermarkfontpath";
     if ($formSubmit) {
         $keys = $uploadKeys . "," . $waterMarkkeys;
         $keyField = explode(",", $keys);
         foreach ($_POST as $key => $value) {
             if (in_array($key, $keyField)) {
                 Setting::model()->updateSettingValueByKey($key, $value);
             } elseif ($key == "watermarkstatus") {
                 Setting::model()->updateSettingValueByKey("watermarkstatus", 0);
             }
         }
         CacheUtil::update(array("setting"));
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $upload = Setting::model()->fetchSettingValueByKeys($uploadKeys);
         $waterMark = Setting::model()->fetchSettingValueByKeys($waterMarkkeys);
         $fontPath = DashboardUtil::getFontPathlist(self::TTF_FONT_PATH);
         $data = array("upload" => $upload, "waterMark" => $waterMark, "fontPath" => $fontPath);
         $this->render("index", $data);
     }
 }
Exemple #13
0
<?php

defined("IN_MODULE_ACTION") || exit("Access Denied");
CacheUtil::update(array("setting", "nav"));
$creditExists = CreditRule::model()->countByAttributes(array("action" => "addresume"));
if (!$creditExists) {
    $data = array("rulename" => "添加简历", "action" => "addresume", "cycletype" => "3", "rewardnum" => "1", "extcredits1" => "0", "extcredits2" => "1", "extcredits3" => "1");
    CreditRule::model()->add($data);
}
Ibos::import("application.modules.recruit.model.ResumeStats", true);
ResumeStats::model()->add(array("new" => 0, "pending" => 0, "interview" => 0, "employ" => 0, "eliminate" => 0, "datetime" => strtotime(date("Y-m-d")) - 86400));
Exemple #14
0
 private function createImgIcon($tempFile, $outputName)
 {
     $outputFile = $this->_iconPath . $outputName;
     FileUtil::createFile($outputFile, "");
     Ibos::import("ext.ThinkImage.ThinkImage", true);
     $imgObj = new ThinkImage(THINKIMAGE_GD);
     $imgObj->open($tempFile)->save($outputFile);
     return true;
 }
Exemple #15
0
 public static function getTree($data, $format = "<option value='\$catid' \$selected>\$spacer\$name</option>", $id = 0, $nbsp = "&nbsp;&nbsp;&nbsp;&nbsp;", $icon = array("&nbsp;&nbsp;", "&nbsp;&nbsp;", "&nbsp;&nbsp;"))
 {
     Ibos::import("ext.Tree", true);
     $tree = new tree();
     $tree->init($data);
     $tree->icon = $icon;
     $tree->nbsp = $nbsp;
     $trees = $tree->get_tree(0, $format, $id);
     return $trees;
 }
Exemple #16
0
 private function cropImg()
 {
     $uid = Ibos::app()->user->uid;
     $tempAvatar = $_POST["src"];
     $avatarPath = "data/avatar/";
     $avatarBig = UserUtil::getAvatar($uid, "big");
     $avatarMiddle = UserUtil::getAvatar($uid, "middle");
     $avatarSmall = UserUtil::getAvatar($uid, "small");
     if (LOCAL) {
         FileUtil::makeDirs($avatarPath . dirname($avatarBig));
     }
     FileUtil::createFile("data/avatar/" . $avatarBig, "");
     FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
     FileUtil::createFile("data/avatar/" . $avatarSmall, "");
     Ibos::import("ext.ThinkImage.ThinkImage", true);
     $imgObj = new ThinkImage(THINKIMAGE_GD);
     $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
     $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
     $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
 }