function view_cucatalogurls()
{
    global $action;
    tabheader(lang('co_class_manager'), '', '', 4);
    echo "<tr class=\"txt\">\n";
    echo "<td class=\"txtL w25B\">" . (in_str('rcatalog', $action) ? "<b>" . lang('reply_class_manager') . "</b>" : "<a href=\"?entry=cucatalogs&action=rcatalogsedit\">" . lang('reply_class_manager') . "</a>") . "</td>\n";
    echo "<td class=\"txtL w25B\"></td>\n";
    echo "<td class=\"txtL w25B\"></td>\n";
    echo "<td class=\"txtL w25B\"></td>\n";
    echo "</tr>\n";
    tabfooter();
}
Exemple #2
0
backallow('record') || amessage('no_apermission');
!in_array($action, array('badlogin', 'adminlog', 'currencylog')) && amessage('noexrecord');
$aps = array('badlogin' => 109, 'adminlog' => 110, 'currencylog' => 111);
unset($aps);
$rname = $action;
$yearmonth = date('Ym', $timestamp);
$recorddir = M_ROOT . './dynamic/records/';
$recordfile = $recorddir . $yearmonth . '_' . $rname . '.php';
$records = (array) @file($recordfile);
$filesize = @filesize($recordfile);
if ($filesize < 500000) {
    $dir = opendir($recorddir);
    $length = strlen($rname);
    $maxid = $id = 0;
    while ($file = readdir($dir)) {
        if (in_str($yearmonth . '_' . $rname, $file)) {
            $id = intval(substr($file, $length + 8));
            $id > $maxid && ($maxid = $id);
        }
    }
    closedir($dir);
    if ($maxid) {
        $rnamefile2 = $recorddir . $yearmonth . '_' . $rname . '_' . $maxid . '.php';
    } else {
        $lastyearmonth = date('Ym', $timestamp - 86400 * 28);
        $rnamefile2 = $recorddir . $lastyearmonth . '_' . $rname . '.php';
    }
    if (file_exists($rnamefile2) && ($records2 = @file($rnamefile2))) {
        $records = array_merge($records2, $records);
    }
}
Exemple #3
0
 function remotefromstr($string, $rpid)
 {
     global $rprojects;
     if (!$this->capacity) {
         return $string;
     }
     if (empty($rpid) || empty($rprojects[$rpid]['rmfiles'])) {
         return $string;
     }
     if (!preg_match_all("/(href|src)\\s*=\\s*(\"(.+?)\"|'(.+?)'|(.+?)(\\s|\\/?>))/is", $string, $matches)) {
         return $string;
     }
     $remoteurls = array_filter(array_merge($matches[3], $matches[4], $matches[5]));
     foreach ($remoteurls as $k => $v) {
         if (islocal($v, 1)) {
             unset($remoteurls[$k]);
         } elseif (!empty($rprojects[$rpid]['excludes'])) {
             foreach ($rprojects[$rpid]['excludes'] as $i) {
                 if (in_str($i, $v)) {
                     unset($remoteurls[$k]);
                     break;
                 }
             }
         }
     }
     $remoteurls = array_unique($remoteurls);
     $oldurls = $newurls = array();
     foreach ($remoteurls as $oldurl) {
         $filearr = $this->remote_upload($oldurl, $rpid);
         $newurl = $filearr['remote'];
         //本地路径的图片也要加上<!cmsurl />,这跟直接存数据库的附件是不一样的。
         if (strpos($newurl, '://') === false && strpos($newurl, '<!ftpurl />') === false) {
             $newurl = '<!cmsurl />' . $newurl;
         }
         if ($newurl != $oldurl) {
             $oldurls[] = $oldurl;
             $newurls[] = $newurl;
         }
     }
     return str_replace($oldurls, $newurls, $string);
 }
Exemple #4
0
             $pages = max(empty($pages) ? 0 : max(0, intval($pages)), count($selectid));
             $cncid = $selectid[0];
             $db->query("UPDATE {$tblprefix}cnodes SET cncids = REPLACE(cncids,'|{$cncid}|','') WHERE sid='{$sid}' AND cncids LIKE '%|{$cncid}|%'");
             if ($cnconfig = $cnconfigs[$cncid]) {
                 cnodesfromcnc($cnconfig, $sid);
                 $db->query("UPDATE {$tblprefix}cnodes SET inconfig=0 WHERE sid='{$sid}' AND inconfig='1' AND cncids=''");
                 $db->query("UPDATE {$tblprefix}cnodes SET inconfig=1 WHERE sid='{$sid}' AND inconfig='0' AND cncids !=''");
                 updatecache('cnodes', 0, $sid);
             }
             unset($selectid[0]);
             if ($selectid) {
                 $selectstr = implode(',', $selectid);
                 $npage = $pages - count($selectid) + 1;
                 amessage('operating', "?entry={$entry}&action={$action}&selectstr={$selectstr}&arcdeal={$arcdeal}&pages={$pages}&bcnconfigs=1{$param_suffix}", $pages, $npage, "<a href=\"?entry={$entry}&action={$action}{$param_suffix}\">", '</a>');
             }
         } elseif (in_str('ccid', $arcdeal)) {
             //更新结构但不更新节点
             if (!empty($selectid)) {
                 $coid = intval(str_replace('ccid', '', $arcdeal));
                 ${"cnccids{$coid}"} = empty(${"cnccids{$coid}"}) ? array() : ${"cnccids{$coid}"};
                 ${"cnmode{$coid}"} = empty(${"cnmode{$coid}"}) ? 0 : ${"cnmode{$coid}"};
                 foreach ($selectid as $k) {
                     modify_cnconfig(@$cnconfigs[$k], $coid, ${"cnccids{$coid}"}, ${"cnmode{$coid}"});
                 }
                 updatecache('cnconfigs', '', $sid);
             }
         }
     }
     adminlog(lang('update_catas_cnode'));
     amessage('ccnodeupdatefinish', "?entry={$entry}&action={$action}{$param_suffix}");
 }
Exemple #5
0
         trbasic(lang('sitedescrip'), 'mconfigsnew[cmsdescription]', $mconfigs['cmsdescription'], 'textarea');
         trbasic(lang('siteicpno'), 'mconfigsnew[cms_icpno]', $mconfigs['cms_icpno'], 'btext');
         trbasic(lang('bazscert'), 'mconfigsnew[bazscert]', $mconfigs['bazscert'], 'btext');
         trbasic('公共文件目录', 'mconfigsnew[public]', $mconfigs['public'], 'btext');
         trbasic(lang('copyrightmessage'), 'mconfigsnew[copyright]', $mconfigs['copyright'], 'textarea');
     } else {
         trspecial(lang('cmslogo'), 'subsitenew[cmslogo]', $subsite['cmslogo'], 'image');
         trbasic(lang('subsitetitle'), 'subsitenew[cmstitle]', $subsite['cmstitle'], 'btext');
         trbasic(lang('subkeyword'), 'subsitenew[cmskeyword]', $subsite['cmskeyword'], 'btext');
         trbasic(lang('subsitedescrip'), 'subsitenew[cmsdescription]', $subsite['cmsdescription'], 'textarea');
     }
     tabfooter('bmconfigs');
     a_guide('cfsite');
 } else {
     if (!$sid) {
         if (empty($mconfigsnew['hosturl']) || !in_str('http://', $mconfigsnew['hosturl'])) {
             amessage('hosturlillegal', M_REFERER);
         }
         $mconfigsnew['hosturl'] = strtolower($mconfigsnew['hosturl']);
         $mconfigsnew['cmsurl'] = empty($mconfigsnew['cmsurl']) ? '/' : trim(strtolower($mconfigsnew['cmsurl']));
         $mconfigsnew['cmsurl'] .= !ereg("/\$", $mconfigsnew['cmsurl']) ? '/' : '';
         foreach (array('mspacedir', 'memberdir') as $var) {
             $mconfigsnew[$var] = strtolower($mconfigsnew[$var]);
             if ($mconfigsnew[$var] == $mconfigs[$var]) {
                 continue;
             }
             if (!$mconfigsnew[$var] || preg_match("/[^a-z_0-9]+/", $mconfigsnew[$var])) {
                 $mconfigsnew[$var] = $mconfigs[$var];
                 continue;
             }
             if (is_dir(M_ROOT . $mconfigs[$var])) {
function pack_sqldump($table, $isdatatable = 1)
{
    global $db, $tblprefix, $sqlcompat, $sqlcharset, $dumpcharset, $usehex;
    $ntable = $tblprefix . $table;
    $createtable = $db->query("SHOW CREATE TABLE {$ntable}", 'SILENT');
    if ($db->error()) {
        return;
    }
    $tabledump = "DROP TABLE IF EXISTS {$ntable};\n";
    $create = $db->fetch_row($createtable);
    $tabledump .= $create[1] . ";\n\n";
    if ($sqlcompat == 'MYSQL41' && $db->version() < '4.1') {
        $tabledump = preg_replace("/TYPE\\=(.+)/", "ENGINE=\\1 DEFAULT CHARSET=" . $dumpcharset, $tabledump);
    }
    if ($db->version() > '4.1' && $sqlcharset) {
        $tabledump = preg_replace("/(DEFAULT)*\\s*CHARSET=.+/", "DEFAULT CHARSET=" . $sqlcharset . ";", $tabledump);
    }
    $tablestatus = $db->fetch_one("SHOW TABLE STATUS LIKE '{$ntable}'");
    if ($sqlcompat == 'MYSQL40' && $db->version() >= '4.1' && $db->version() < '5.1') {
        if ($tablestatus['Auto_increment'] != '') {
            $temppos = strpos($tabledump, ',');
            $tabledump = substr($tabledump, 0, $temppos) . ' auto_increment' . substr($tabledump, $temppos);
        }
        if ($tablestatus['Engine'] == 'MEMORY') {
            $tabledump = str_replace('TYPE=MEMORY', 'TYPE=HEAP', $tabledump);
        }
    }
    if ($isdatatable) {
        $tablefields = array();
        $query = $db->query("SHOW FULL COLUMNS FROM {$ntable}", 'SILENT');
        if (!$query) {
            if ($db->errno() == 1146) {
                return;
            }
            $usehex = FALSE;
        }
        while ($fieldrow = $db->fetch_array($query)) {
            $tablefields[] = $fieldrow;
        }
        $rows = $db->query("SELECT * FROM {$ntable}");
        $numfields = $db->num_fields($rows);
        while ($row = $db->fetch_row($rows)) {
            $comma = $t = '';
            for ($i = 0; $i < $numfields; $i++) {
                $t .= $comma . ($usehex && !empty($row[$i]) && (in_str('char', $tablefields[$i]['Type']) || in_str('text', $tablefields[$i]['Type'])) ? '0x' . bin2hex($row[$i]) : '\'' . mysql_escape_string($row[$i]) . '\'');
                $comma = ',';
            }
            $tabledump .= "INSERT INTO {$ntable} VALUES ({$t});\n";
        }
        $tabledump .= "\n";
    }
    $tabledump = str_replace($ntable, '{$tblprefix}' . $table, $tabledump);
    return $tabledump;
}
Exemple #7
0
 *	$cfg_dbqz:表前缀
 *	$epath:二级域名+路径,用以确定cache位置md5()或者搜索数据库
 *	$rid:view-(.*).html
 *
 =============================================*/
$host = $_SERVER["HTTP_HOST"];
$array_temp = explode(".", $host);
$len = count($array_temp);
$domain = $array_temp[$len - 2] . '.' . $array_temp[$len - 1];
if ($len == 2) {
    $ename = '';
    //主域名,无二级域名
} else {
    $ename = $array_temp[0] . '.';
}
$rid = in_str('view-', '.html', $_SERVER["REQUEST_URI"]);
$array_temp = explode('/', $_SERVER["REQUEST_URI"]);
//$_SERVER["REQUEST_URI"] 获取URL,以‘/’开头 '/'     '/xxx.zzz'       '/xxx/yyy.zzz'      三种格式
$path = $array_temp[1];
/*
 *	看path的值,
 *	如果为空,说明在根目录下“/”
 *	如果不包含“.“,说明是目录
 *	如果包含“.”,说明是文件
 */
if (strpos($path, ".") > 0) {
    //有'.'说明是文件,必定在根目录
    $path = '/';
} else {
    //没有'.'说明可能是'/'或者是'/xxx/yyy.zzz';对应path的值为'','xxx'
    $path = '/' . $path . "/";
Exemple #8
0
function findfiles($absdir, $str = '', $inc = 0)
{
    //$inc 0按扩展名查询,1按包含字串查询
    $tempfiles = array();
    if (is_dir($absdir)) {
        if ($tempdir = opendir($absdir)) {
            while (($tempfile = readdir($tempdir)) !== false) {
                if (filetype($absdir . "/" . $tempfile) == 'file') {
                    if (!$str) {
                        $tempfiles[] = $tempfile;
                    } elseif (!$inc && mextension($tempfile) == $str) {
                        $tempfiles[] = $tempfile;
                    } elseif ($inc && in_str($str, $tempfile)) {
                        $tempfiles[] = $tempfile;
                    }
                }
            }
            closedir($tempdir);
        }
    }
    return $tempfiles;
}
Exemple #9
0
 $configfile = preg_replace("/[\$]ckpre\\s*\\=\\s*[\"'].*?[\"'];/is", "\$ckpre = '';", $configfile);
 $configfile = preg_replace("/[\$]lan_version\\s*\\=\\s*[\"'].*?[\"'];/is", "\$lan_version = '" . $lan_ver . "';", $configfile);
 $fp = fopen($droot . 'base.inc.php', 'w');
 fwrite($fp, trim($configfile));
 fclose($fp);
 //安装sql文件
 if ($icharset != 'gbk') {
     $sqlfile = $droot . 'install/08cms.sql';
     $sqlstr = file2str($sqlfile);
     $sqlstr = str_replace("CHARSET=gbk", "CHARSET=" . $qcharset, $sqlstr);
     $sqlstr = str_replace("SET NAMES 'gbk'", "SET NAMES '" . $qcharset . "'", $sqlstr);
     str2file($sqlstr, $sqlfile);
     unset($sqlstr, $sqlfile);
 }
 //fckconfig.js
 $fcklang = in_str('sc', $lan) ? 'zh-cn' : 'zh';
 if ($fcklang != 'zh-cn') {
     $fckfile = $droot . 'include/fckeditor/fckconfig.js';
     $fckstr = file2str($fckfile);
     $fckstr = str_replace('zh-cn', 'zh', $fckstr);
     str2file($fckstr, $fckfile);
     unset($fckstr, $fckfile);
 }
 //*************************对整个文件作编码转换处理//////////////////////////////////////////////////////////////////////
 //系统内置缓存,包含部分语言包
 $ckeeps = array('index.htm', 'index.html');
 clear_files($droot . 'dynamic/cache/', $ckeeps);
 $convs = array();
 $convs[] = $droot . 'admina/home.inc.php';
 //管理后台首页
 $convs[] = $droot . 'admina/tools/upload.php';
Exemple #10
0
                }
                updatecache('mcnodes');
            }
        } else {
            if (!empty($mcnidsnew)) {
                foreach ($mcnidsnew as $k) {
                    if ($mcnvar == 'caid') {
                        $arr =& $acatalogs;
                        $tvar = 'title';
                    } elseif ($mcnvar == 'matid') {
                        $arr =& $matypes;
                        $tvar = 'cname';
                    } elseif (in_str('ccid', $mcnvar)) {
                        $arr = read_cache('coclasses', str_replace('ccid', '', $mcnvar));
                        $tvar = 'title';
                    } elseif (in_str('ugid', $mcnvar)) {
                        $arr = read_cache('usergroups', str_replace('ugid', '', $mcnvar));
                        $tvar = 'cname';
                    }
                    $db->query("INSERT INTO {$tblprefix}mcnodes SET alias='" . $arr[$k][$tvar] . "',addnum='{$mcnodenew['addnum']}',mcnid='{$k}',ename='{$mcnvar}={$k}',mcnvar='{$mcnvar}'");
                }
                updatecache('mcnodes');
            }
        }
        amessage('addmcnodefin', axaction(6, "?entry={$entry}&action=mcnodesedit{$param_suffix}"));
    }
} elseif ($action == 'mcnodedetail' && $cnid) {
    if (!($cnode = $db->fetch_one("SELECT * FROM {$tblprefix}mcnodes WHERE cnid='{$cnid}'"))) {
        amessage('pointcnode');
    }
    foreach (array('tpls', 'urls', 'statics', 'periods') as $var) {
Exemple #11
0
function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $simple = 0, $onclick = '')
{
    global $infloat, $handlekey;
    $multipage = '';
    $mpurl .= in_str('?', $mpurl) ? '&amp;' : '?';
    $onclick && ($onclick .= '(event);');
    $infloat && ($onclick .= "return floatwin('open_{$handlekey}',this)");
    $onclick && ($onclick = " onclick=\"{$onclick}\"");
    if ($num > $perpage) {
        //只有超过1页时,才显示分页导航
        $offset = 2;
        //当前页码之前显示的页码数
        $realpages = @ceil($num / $perpage);
        $pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages;
        //需要统计的页数
        if ($page > $pages) {
            $from = 1;
            $to = $pages;
        } else {
            $from = $curpage - $offset;
            $to = $from + $page - 1;
            if ($from < 1) {
                $to = $curpage + 1 - $from;
                $from = 1;
                if ($to - $from < $page) {
                    $to = $page;
                }
            } elseif ($to > $pages) {
                $from = $pages - $page + 1;
                $to = $pages;
            }
        }
        $multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="' . $mpurl . 'page=1" class="p_redirect"' . $onclick . '>1...</a>' : '') . ($curpage > 1 && !$simple ? '<a href="' . $mpurl . 'page=' . ($curpage - 1) . '" class="p_redirect"><<</a>' : '');
        for ($i = $from; $i <= $to; $i++) {
            $multipage .= $i == $curpage ? '<a class="p_curpage">' . $i . '</a>' : '<a href="' . $mpurl . 'page=' . $i . '" class="p_num"' . $onclick . '>' . $i . '</a>';
        }
        $multipage .= ($curpage < $pages && !$simple ? '<a href="' . $mpurl . 'page=' . ($curpage + 1) . '" class="p_redirect"' . $onclick . '>>></a>' : '') . ($to < $pages ? '<a href="' . $mpurl . 'page=' . $pages . '" class="p_redirect"' . $onclick . '>...' . $pages . '</a>' : '') . (!$simple && $pages > $page ? '<a class="p_pages" style="padding: 0px"><input class="p_input" type="text" name="custompage" onKeyDown="if(event.keyCode==13) {window.location=\'' . $mpurl . 'page=\'+this.value; return false;}"></a>' : '');
        $multipage = $multipage ? '<div class="p_bar">' . (!$simple ? '<a class="p_total">&nbsp;' . $num . '&nbsp;</a>' : '') . $multipage . '</div>' : '';
    }
    return $multipage;
}
Exemple #12
0
function m_cnparse($cnstr)
{
    //得到初始的资料
    $var = array_map('trim', explode('=', $cnstr));
    if ($var[0] == 'mcnid') {
        return array();
    }
    if ($var[0] == 'caid') {
        $arr = read_cache('acatalogs');
        $ret = read_cache('catalog', $var[1], 0, $arr[$var[1]]['sid']);
    } elseif (in_str('ccid', $var[0])) {
        $ret = read_cache('coclass', str_replace('ccid', '', $var[0]), $var[1]);
    } elseif (in_str('ugid', $var[0])) {
        $ret = read_cache('usergroup', str_replace('ugid', '', $var[0]), $var[1]);
    } elseif ($var[0] == 'matid') {
        $ret = read_cache('matype', $var[1]);
    }
    if (empty($ret['cname'])) {
        $ret['cname'] = @$ret['title'];
    }
    return $ret;
}
Exemple #13
0
 function func_deal($funcstr, &$content)
 {
     if (empty($funcstr) || empty($content) || !in_str('(*)', $funcstr)) {
         return;
     }
     $funcname = substr($funcstr, 0, strpos($funcstr, '('));
     if (empty($funcname) || !function_exists($funcname)) {
         return;
     }
     $funcstr = str_replace('(*)', $content, $funcstr);
     //		$str = str_replace( '\"','"', $str);
     if (!@eval("\$result = {$funcstr};")) {
         return;
     }
     $content = $result;
     unset($result);
 }
function pb_ad($defaults, $loop = 1, $location = '')
{
    $defaults = pb_switch($defaults);
    $location = clean($location);
    $ad_id = pb_obj($defaults, 'id');
    $width = pb_obj($defaults, 'style');
    $keywords = pb_obj($defaults, 'tags');
    $caption = pb_obj($defaults, 'caption', true);
    $type = pb_obj($defaults, 'type', 'long');
    $_SESSION['pb_ad_style'] = $width;
    $_SESSION['pb_ad_cap'] = $caption;
    $code_previx = "pb_ad" . $location;
    pb_page_code($code_previx);
    $adCount = 1;
    while ($adCount <= $loop) {
        if (empty($ad_id) || $ad_id == 'paid') {
            $result = pb_db("SELECT * FROM pb_doubleclick WHERE status=1 order by RAND() LIMIT 1");
            if ($result->num_rows > 0) {
                $ad_id = $result->fetch_assoc();
                $ad_id = $ad_id['id'];
            }
        }
        if ($ad_id == 'free') {
            $ran = pb_db("SELECT product_id, user_id, product_info FROM pb_post WHERE type='product' AND status='open' order by RAND() LIMIT 1", true);
            $data = json_decode($ran->product_info);
            $data = $data[0];
            $img_id = explode(',', $data->images);
            $img_id = $img_id[0];
            $img_cta = $data->title;
            $img_user = $ran->user_id;
            $pid = $ran->product_id;
            $pb_safe_image = pb_db("SELECT string FROM pb_safe_image WHERE uid='{$img_id}'", true);
            if (!in_array('free_ads_' . $pid, pb_page_code($code_previx, true))) {
                if (isset($pb_safe_image->string)) {
                    $img_url = $pb_safe_image->string;
                    array_push($_SESSION[$code_previx . PAGE_LOAD_CODE], 'free_ads_' . $pid);
                    print '<a class="pb_ad transition-300" href="/pb_doubleclick?path=/item?id=' . $pid . '&marketplace=free_user_ads&pg=' . PAGE_LOAD_CODE . '&source=' . $location . '&session=' . $code_previx . '&user_id=' . $img_user . '"';
                    print 'style="background:no-repeat center url(' . pb_safe_image_structure($img_url) . ');background-size:cover;' . $_SESSION['pb_ad_style'] . '">';
                    if (!empty($img_cta) && e($_SESSION['pb_ad_cap'])) {
                        print '<div class="transition-300">' . $img_cta . '</div>';
                    }
                    print '</a>';
                }
            }
        } else {
            $ad = pb_db("SELECT * FROM pb_doubleclick WHERE id='{$ad_id}' AND status=1 LIMIT 1", true);
            if ($type == 'long') {
                $img = $ad->cover;
            }
            if ($type == 'square') {
                $img = $ad->cover_square;
            }
            if (empty($img)) {
                $img = $ad->cover;
            }
            if (!in_str('/', $img)) {
                $img = pb_db("SELECT string FROM pb_safe_image WHERE uid='{$img}'", true)->string;
            }
            if (!in_array($ad->id, pb_page_code($code_previx, true))) {
                array_push($_SESSION[$code_previx . PAGE_LOAD_CODE], $ad->id);
                print '<a class="pb_ad transition-300" href="/pb_doubleclick?path=' . $ad->link . '&pg=' . PAGE_LOAD_CODE . '&source=' . $location . '&session=' . $code_previx . '&marketplace=user_ad&id=' . $ad->id . '"';
                print 'style="background:no-repeat center url(' . $img . ');background-size:cover;' . $_SESSION['pb_ad_style'] . '">';
                if (!empty($ad->cta) && e($_SESSION['pb_ad_cap'])) {
                    print '<div class="transition-300">' . $ad->cta . '</div>';
                }
                print '</a>';
            }
        }
        $adCount++;
    }
}
Exemple #15
0
function prepare()
{
    $args = func_get_args();
    if (count($args) == 1) {
        return $args[0];
    }
    // First element of $args get assigned to zero index of $clean_args
    // Array_shift removes the first value and returns it..
    $clean_args[] = array_shift($args);
    // The rest of $args are escaped and then assigned to $clean_args
    foreach ($args as $arg) {
        if (is_array($arg)) {
            foreach ((array) $arg as $v) {
                $str .= $comma . "'" . db_esc($v) . "'";
                $comma = ",";
            }
            $clean_args[] = $str;
        } else {
            $clean_args[] = db_esc($arg);
        }
    }
    // Have to use this coz we don't know how many args we're gonna pass to sprintf..
    $query = @call_user_func_array("sprintf", $clean_args);
    // Trackdown poorly formulated queries
    $err = error_get_last();
    if ($err["type"] == 2 && in_str("sprintf", $err["message"])) {
        $e = new Exception();
        alloc_error("Error in prepared query: \n" . $e->getTraceAsString() . "\n" . print_r($err, 1) . "\n" . print_r($clean_args, 1));
    }
    return $query;
}
Exemple #16
0
 public static function messages()
 {
     global $TPL;
     $class_to_icon["good"] = "icon-ok-sign";
     $class_to_icon["bad"] = "icon-exclamation-sign";
     $class_to_icon["help"] = "icon-info-sign";
     $search = array("&lt;br&gt;", "&lt;br /&gt;", "&lt;b&gt;", "&lt;/b&gt;", "&lt;u&gt;", "&lt;/u&gt;", '\\');
     $replace = array("<br>", "<br />", "<b>", "</b>", "<u>", "</u>", '');
     $types = array("message" => "bad", "message_good" => "good", "message_help" => "help", "message_good_no_esc" => "good", "message_help_no_esc" => "help");
     foreach ($types as $type => $class) {
         $str = "";
         $TPL[$type] and $str = is_array($TPL[$type]) ? implode("<br>", $TPL[$type]) : $TPL[$type];
         $_GET[$type] and $str = is_array($_GET[$type]) ? implode("<br>", $_GET[$type]) : $_GET[$type];
         if (in_str("no_esc", $type)) {
             $str and $msg[$type] = $str;
         } else {
             $str and $msg[$type] = str_replace($search, $replace, page::htmlentities($str));
         }
     }
     if (is_array($msg) && count($msg)) {
         $str = "<div style=\"text-align:center;\"><div class=\"message corner\" style=\"width:60%;\">";
         $str .= "<table cellspacing=\"0\">";
         foreach ($msg as $type => $info) {
             $class = $types[$type];
             $str .= "<tr>";
             $str .= "<td class='" . $class . "' width='1%' style='vertical-align:top;padding:6px;font-size:150%;'>";
             $str .= "<i class='" . $class_to_icon[$class] . "'></i><td/>";
             $str .= "<td class='" . $class . "' width='99%' style='vertical-align:top;padding-top:11px;text-align:left;font-weight:bold;'>" . $info . "</td></tr>";
         }
         $str .= "</table>";
         $str .= "</div></div>";
     }
     return $str;
 }
Exemple #17
0
    tabheader(lang('pageresult'));
    $listsarr = array('caid' => lang('be_catalog'));
    foreach ($cotypes as $k => $v) {
        if (!$v['self_reg']) {
            $listsarr["ccid{$k}"] = lang('belongcocl') . '-' . $v['cname'];
        }
    }
    $listsarr['jumpurl'] = lang('jumpurl');
    $listsarr['ucid'] = lang('uclass');
    $listsarr['cpupdate'] = lang('cpupdate');
    foreach ($channels as $chid => $channel) {
        $fields = read_cache('fields', $chid);
        foreach ($fields as $k => $v) {
            if (empty($listsarr[$k])) {
                $listsarr[$k] = $v['cname'];
            } elseif (!in_str($v['cname'], $listsarr[$k])) {
                $listsarr[$k] .= '/' . $v['cname'];
            }
        }
    }
    $listsarr['salecp'] = lang('arc_price');
    $listsarr['fsalecp'] = lang('annex_price');
    trbasic(lang('arange_field') . "<br><input class=\"checkbox\" type=\"checkbox\" name=\"chkalllists\" onclick=\"checkall(this.form,'listsnew','chkalllists')\">" . lang('selectall'), '', makecheckbox('listsnew[]', $listsarr, empty($inmurl['setting']['lists']) ? array() : explode(',', $inmurl['setting']['lists']), 5), '', lang('agnoselect1'));
    trbasic(lang('adm_title'), 'inmurlnew[mtitle]', $inmurl['mtitle'], 'text', lang('aga_title'));
    trbasic(lang('adm_guide'), 'inmurlnew[guide]', $inmurl['guide'], 'textarea', lang('aga_title'));
    $tnstr = "<input type=\"text\" size=\"25\" id=\"inmurlnew[tplname]\" name=\"inmurlnew[tplname]\" value=\"{$inmurl['tplname']}\">&nbsp; \n\t\t\t<input class=\"checkbox\" type=\"checkbox\" name=\"inmurlnew[onlyview]\" id=\"inmurlnew[onlyview]\" value=\"1\"" . (empty($inmurl['onlyview']) ? '' : ' checked') . ">" . lang('onlyview');
    trbasic(lang('customapage'), '', $tnstr, '', lang('agcustomapage'));
} else {
    foreach (array('lists') as $var) {
        $inmurlnew['setting'][$var] = empty(${$var . 'new'}) ? '' : implode(',', ${$var . 'new'});
    }
Exemple #18
0
 /**
  * Return banner of image.
  *
  * @param $src
  * @param int $width
  * @param int $height
  * @return mixed
  */
 function banner($src, $width = 0, $height = 0)
 {
     if (in_str($src, env('QINIU_CDN_URL'))) {
         return $src . '-banner';
     }
     return '/image/thumb?src=' . urlencode($src) . ($width ? '&width=' . $width : '&width=1800') . ($height ? '&height=' . $height : '&height=250');
 }
Exemple #19
0
<?php

(!defined('M_COM') || !defined('M_ADMIN')) && exit('No Permission');
if (empty($submitmode)) {
    trbasic(lang('customphp') . 'url', 'inurlnew[setting][customurl]', empty($inurl['setting']['customurl']) ? '' : $inurl['setting']['customurl'], 'btext');
} else {
    $inurlnew['setting']['customurl'] = strip_tags(trim($inurlnew['setting']['customurl']));
    $inurlnew['url'] = $inurlnew['setting']['customurl'] . (in_str('?', $inurlnew['setting']['customurl']) ? '&' : '?') . 'aid=';
}
Exemple #20
0
 *	$cfg_dbqz:表前缀
 *	$epath:二级域名+路径,用以确定cache位置md5()或者搜索数据库
 *	$rnid:read-(.*).html
 *
 =============================================*/
$host = $_SERVER["HTTP_HOST"];
$array_temp = explode(".", $host);
$len = count($array_temp);
$domain = $array_temp[$len - 2] . '.' . $array_temp[$len - 1];
if ($len == 2) {
    $ename = '';
    //主域名,无二级域名
} else {
    $ename = $array_temp[0] . '.';
}
$riid = in_str('reads-', '.html', $_SERVER["REQUEST_URI"]);
$array_temp = explode('/', $_SERVER["REQUEST_URI"]);
//$_SERVER["REQUEST_URI"] 获取URL,以‘/’开头 '/'     '/xxx.zzz'       '/xxx/yyy.zzz'      三种格式
$path = $array_temp[1];
/*
 *	看path的值,
 *	如果为空,说明在根目录下“/”
 *	如果不包含“.“,说明是目录
 *	如果包含“.”,说明是文件
 */
if (strpos($path, ".") > 0) {
    //有'.'说明是文件,必定在根目录
    $path = '/';
} else {
    //没有'.'说明可能是'/'或者是'/xxx/yyy.zzz';对应path的值为'','xxx'
    $path = '/' . $path . "/";
Exemple #21
0
    $realtask = new task();
    $realtask->set_id($tID);
    $realtask->select();
    unset($st1, $st2);
    if (substr($realtask->get_value("taskStatus"), 0, 6) == "closed") {
        $st1 = "<strike>";
        $st2 = "</strike>";
    } else {
        $wasopen = true;
    }
    $blockTaskLinks[] = $st1 . $realtask->get_task_link(array("prefixTaskID" => 1, "return" => "html")) . $st2;
}
$is = "was";
$wasopen and $is = "is";
$blockTaskLinks and $TPL["message_help_no_esc"][] = "This task " . $is . " blocking the start of:<br>" . implode("<br>", $blockTaskLinks);
if (in_str("pending_", $task->get_value("taskStatus"))) {
    $rows = $task->get_reopen_reminders();
    foreach ($rows as $r) {
        $TPL["message_help_no_esc"][] = 'This task is set to
                                    <a href="' . $TPL["url_alloc_reminder"] . 'step=3&reminderID=' . $r["rID"] . '&returnToParent=task">
				    automatically reopen at ' . $r["reminderTime"] . '</a>';
        // Which date gets plugged in is arbitrary, but it would be unusual for there to be more than one
        $TPL['reopen_task'] = strftime("%Y-%m-%d", strtotime($r['reminderTime']));
    }
}
if ($task->get_id()) {
    $TPL["task_taskType"] = $task->get_value("taskTypeID");
} else {
    $TPL["task_children_summary"] = "";
    $TPL["task_taskType"] = "Task";
}
Exemple #22
0
         foreach ($tclassarr as $k => $v) {
             $ftclassarr[] = $tclass == $k ? "<b>-{$v}-</b>" : "<a href=\"?entry=mtags&action=mtagsedit&ttype={$ttype}{$param_suffix}&tclass={$k}\">{$v}</a>";
         }
         $ftclassarr[] = $tclass == 'sch' ? "<b>-" . lang('tagsearch') . "-</b>" : ">><a href=\"?entry=mtags&action=mtagsedit&ttype={$ttype}{$param_suffix}&tclass=sch\">" . lang('tagsearch') . "</a>";
         echo tab_list($ftclassarr, 9, 0);
     }
     $searchstr = $tclass == 'sch' ? "&nbsp; &nbsp; <input class=\"text\" name=\"keyword\" type=\"text\" value=\"{$keyword}\" size=\"12\" style=\"vertical-align: middle;\">&nbsp;&nbsp;<input class=\"btn\" type=\"submit\" name=\"bfilter\" id=\"bfilter\" value=\"" . lang('filter0') . "\">" : '';
     $helpstr = $ttype == 'rtag' ? '' : "&nbsp; &nbsp; [<a href=\"tools/taghelp.html" . ($tclass ? '#' . str_replace('tag', '', $ttype) . '_' . $tclass : '') . "\" target=\"08cmstaghelp\">" . lang('help') . "</a>]";
     tabheader(lang($ttype . '_admin') . ($tclass == 'sch' ? '' : "&nbsp; &nbsp; [<a href=\"?entry=mtags&action=mtagadd&ttype={$ttype}{$param_suffix}&mtagnew[tclass]={$tclass}\">" . lang('add') . '</a>]') . $helpstr . $searchstr, 'mtagsedit', $rsubmiturl, '9');
     trcategory(array(lang('sn'), '<input class="checkbox" type="checkbox" name="chkall" onclick="checkall(this.form)">' . lang('del'), array(lang('tagname'), 'txtL'), array(lang('tag_style'), 'txtL'), lang('type'), lang('order'), lang('close'), lang('edit'), lang('copy'), lang('usual'), lang('code')));
     $i = 1;
     foreach ($mtags as $key => $mtag) {
         if ($tclass == $mtag['tclass'] || $tclass == 'sch') {
             $vieworder = $mtag['vieworder'];
             $mtag = read_cache($ttype, $key, '', $sid);
             if (!$keyword || in_str($keyword, $mtag['ename']) || in_str($keyword, $mtag['cname'])) {
                 $mtagcodestr = $tclass ? "<a href=\"?entry=mtags&action=mtagcode&ttype={$ttype}{$param_suffix}&tname={$key}\" onclick=\"return floatwin('open_mtagsedit',this)\">" . lang('code') . "</a>" : '-';
                 $setusualstr = "<a href=\"?entry=mtags&action=setusual&ttype={$ttype}{$param_suffix}&tname={$key}\" onclick=\"return floatwin('open_mtagsedit',this)\">" . lang('usual') . "</a>";
                 echo "<tr class=\"txt\">" . "<td class=\"txtC w30\">{$i}</td>\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$key}]\" value=\"{$key}\"></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"30\" maxlength=\"30\" name=\"mtagsnew[{$key}][cname]\" value=\"" . mhtmlspecialchars($mtag['cname']) . "\"></td>\n" . "<td class=\"txtL\">" . tag_style($key) . "</td>\n" . "<td class=\"txtC w100\">" . @$tclassarr[$mtag['tclass']] . "</td>\n" . "<td class=\"txtC w50\"><input type=\"text\" size=\"4\" name=\"mtagsnew[{$key}][vieworder]\" value=\"{$vieworder}\"></td>\n" . "<td class=\"txtC w40\">" . ($tclass ? "<input class=\"checkbox\" type=\"checkbox\" name=\"mtagsnew[{$key}][disabled]\" value=\"1\"" . (empty($mtag['disabled']) ? '' : ' checked') . ">" : '-') . "</td>\n" . "<td class=\"txtC w30\"><a href=\"?entry=mtags&action=mtagsdetail&ttype={$ttype}{$param_suffix}&tname={$key}\" onclick=\"return floatwin('open_mtagsedit',this)\">" . lang('detail') . "</a></td>\n" . "<td class=\"txtC w30\"><a href=\"?entry=mtags&action=mtagscopy&ttype={$ttype}{$param_suffix}&tname={$key}\" onclick=\"return floatwin('open_mtagsedit',this)\">" . lang('copy') . "</a></td>\n" . "<td class=\"txtC w30\">{$setusualstr}</td>\n" . "<td class=\"txtC w30\">{$mtagcodestr}</td>\n" . "</tr>\n";
                 $i++;
             }
         }
     }
     tabfooter('bmtagsedit', lang('modify'));
     a_guide($ttype . 'edit');
 } else {
     if (!empty($delete)) {
         foreach ($delete as $key) {
             del_cache($ttype, $key, '', $sid);
             unset($mtagsnew[$key], $mtags[$key]);
         }
Exemple #23
0
     $urlsarr = array('btag' => array(lang('btaglist'), "?entry=btags{$param_suffix}"), 'search' => array(lang('search_initag'), "?entry=btagsearch{$param_suffix}"), 'update' => array(lang('updatebtag'), "?entry=btags&action=update{$param_suffix}"));
     break;
 case 'channel':
     $urlsarr = array('channel' => array(lang('channeladmin'), "?entry=channels&action=channeledit{$param_suffix}"), 'field' => array(lang('common_field_manager'), "?entry=channels&action=initfieldsedit{$param_suffix}"));
     break;
 case 'channeldetail':
     $urlsarr = array('detail' => array(lang('base_setting'), "?entry=channels&action=channeldetail&chid={$chid}{$param_suffix}"), 'filed' => array(lang('channel_field'), "?entry=channels&action=channelfields&chid={$chid}{$param_suffix}"), 'album' => array(lang('abandcu'), "?entry=channels&action=channelalbum&chid={$chid}{$param_suffix}"), 'other' => array(lang('otherset'), "?entry=channels&action=channelother&chid={$chid}{$param_suffix}"), 'adv' => array(lang('advsetting'), "?entry=channels&action=channeladv&chid={$chid}{$param_suffix}"));
     break;
 case 'cnode':
     $urlsarr = array('cnodescommon' => array(lang('mcnodemanager'), "?entry=cnodes&action=cnodescommon{$param_suffix}"), 'cnconfigs' => array(lang('cnconfigadmin'), "?entry=cnodes&action=cnconfigs{$param_suffix}"), 'tpl' => array('>' . lang('othertpl'), "?entry=tplconfig&action=tplbase{$param_suffix}"));
     break;
 case 'mcnode':
     $urlsarr = array('mcnodesedit' => array(lang('mcnodeadmin'), "?entry=mcnodes&action=mcnodesedit{$param_suffix}"), 'mcnodeadd' => array(lang('addmcnode'), "?entry=mcnodes&action=mcnodeadd{$param_suffix}"), 'tpl' => array('>' . lang('othertpl'), "?entry=tplconfig&action=tplbase{$param_suffix}"));
     break;
 case 'cufield':
     $urlsarr_1 = array(in_str('pfield', $action) ? '<b>-' . lang('pu_field_manager') . '-</b>' : "<a href=\"?entry=cufields&action=pfieldsedit\">" . lang('pu_field_manager') . "</a>", in_str('ofield', $action) ? '<b>-' . lang('offer_field_manager') . '-</b>' : "<a href=\"?entry=cufields&action=ofieldsedit\">" . lang('offer_field_manager') . "</a>", in_str('rfield', $action) ? '<b>-' . lang('reply_field_manager') . '-</b>' : "<a href=\"?entry=cufields&action=rfieldsedit\">" . lang('reply_field_manager') . "</a>", in_str('cfield', $action) ? '<b>-' . lang('comment_field_manager') . '-</b>' : "<a href=\"?entry=cufields&action=cfieldsedit\">" . lang('comment_field_manager') . "</a>", in_str('bfield', $action) ? '<b>-' . lang('pickbug_field_manager') . '-</b>' : "<a href=\"?entry=cufields&action=bfieldsedit\">" . lang('pickbug_field_manager') . "</a>");
 case 'commu':
     $urlsarr = array('commu' => array(lang('commu_item_set'), "?entry=commus&action=commusedit"), 'coclass' => array(lang('ucoclass_admin'), "?entry=ucotypes&action=ucotypesedit"), 'field' => array(lang('commu_field_manager'), "?entry=cufields&action=pfieldsedit"));
     break;
 case 'cucata':
     $urlsarr = array('commu' => array(lang('commu_item_set'), "?entry=commus&action=commusedit"), 'rc' => array(lang('reply_class_manager'), "?entry=cucatalogs&action=rcatalogsedit"), 'p' => array(lang('pu_field_manager'), "?entry=cufields&action=pfieldsedit"), 'o' => array(lang('offer_field_manager'), "?entry=cufields&action=ofieldsedit"), 'r' => array(lang('reply_field_manager'), "?entry=cufields&action=rfieldsedit"), 'c' => array(lang('comment_field_manager'), "?entry=cufields&action=cfieldsedit"), 'b' => array(lang('pickbug_field_manager'), "?entry=cufields&action=bfieldsedit"));
     break;
 case 'currency':
     $urlsarr = array('type' => array(lang('currencytype'), "?entry=currencys&action=currencysedit"), 'project' => array(lang('crproject'), "?entry=currencys&action=crprojects"), 'price' => array(lang('crprice'), "?entry=currencys&action=crprices"));
     break;
 case 'cysave':
     $urlsarr = array('save' => array(lang('member_inout'), "?entry=currencys&action=currencysaving"), 'record' => array(lang('cu_operate_record'), "?entry=currencys&action=cradminlogs"));
     break;
 case 'data':
     $urlsarr = array('dbbackup' => array(lang('dbbackup'), "?entry=database&action=dbexport"), 'dbimport' => array(lang('import_db_backup'), "?entry=database&action=dbimport"), 'dboptimize' => array(lang('dbopre'), "?entry=database&action=dboptimize"), 'dbsql' => array(lang('dbsql'), "?entry=database&action=dbsql"), 'txt' => array(lang('fieldtotxt'), "?entry=fieldtotxt"), 'dbdict' => array(lang('dbdict'), "?entry=dbdict"));
     break;
Exemple #24
0
 function deal_incell()
 {
     global $cotypes, $sid, $orelays, $acatalogs, $m_thumb;
     if (in_array($this->tclass, array('archives', 'alarchives', 'relates', 'searchs'))) {
         arc_parse($this->item, $this->temparr['m_thumbid']);
     } elseif (in_array($this->tclass, array('marchives', 'masearchs'))) {
         marc_parse($this->item, $this->temparr['m_thumbid']);
     } elseif ($this->tclass == 'catalogs') {
         //这是一个特例(含节点),在标识中会加入新元素,需要先处理midarr,
         //读取继承参数
         parse_str(cnstr($this->temparr), $midarr);
         if (isset($midarr['caid']) && @$this->tag['cainherit'] != 'active') {
             unset($midarr['caid']);
         }
         foreach ($cotypes as $k => $v) {
             if (isset($midarr['ccid' . $k]) && @$this->tag['coinherit' . $k] != 'active') {
                 unset($midarr['ccid' . $k]);
             }
         }
         $listby = $this->tag['listby'] == 'ca' ? 0 : intval(str_replace('co', '', $this->tag['listby']));
         if (!$listby) {
             //先处理非列表项目,因为列表项id要放在最后
             foreach ($cotypes as $k => $v) {
                 //读取手动指定的参数
                 if ($v['sortable'] && !empty($this->tag['coinherit' . $k]) && is_numeric($this->tag['coinherit' . $k])) {
                     $midarr['ccid' . $k] = $this->tag['coinherit' . $k];
                 }
             }
             unset($midarr['caid']);
             $midarr['caid'] = $this->item['caid'];
         } else {
             $coid = $listby;
             if (!empty($this->tag['cainherit']) && is_numeric($this->tag['cainherit'])) {
                 $midarr['caid'] = $this->tag['cainherit'];
             }
             foreach ($cotypes as $k => $v) {
                 $k != $coid && $v['sortable'] && !empty($this->tag['coinherit' . $k]) && is_numeric($this->tag['coinherit' . $k]) && ($midarr['ccid' . $k] = $this->tag['coinherit' . $k]);
             }
             unset($midarr['ccid' . $coid]);
             $midarr['ccid' . $coid] = $this->item['ccid'];
         }
         if (!empty($this->tag['urlmode']) && !empty($midarr[$this->tag['urlmode']])) {
             $midarr = array_merge(array($this->tag['urlmode'] => $midarr[$this->tag['urlmode']]), $midarr);
         }
         $nsid = empty($this->tag['nsid']) ? 0 : intval($this->tag['nsid']);
         if (!$nsid) {
             $nsid = isset($temparr['nsid']) ? $temparr['nsid'] : $sid;
             //当前子站需要分析是否有传下来的id,否则认为是全局id
         } elseif ($nsid == -1) {
             $nsid = 0;
         } elseif ($nsid == -2) {
             $nsid = $sid;
         }
         $cnstr = cnstr($midarr);
         $this->item = cn_parsearr($cnstr, $nsid, $listby, $this->temparr['m_thumbid']);
         $cnode = cnodearr($cnstr, $this->item['sid']);
         re_cnode($this->item, $cnstr, $cnode);
         unset($cnode, $midarr);
     } elseif ($this->tclass == 'farchives') {
         $m_thumb->config[$this->temparr['m_thumbid']] = array('id' => $this->item['aid'], 'mode' => 'fa', 'smode' => $this->item['chid']);
     } elseif ($this->tclass == 'commus') {
         $m_thumb->config[$this->temparr['m_thumbid']] = array('id' => $this->item['cid'], 'mode' => 'cu', 'smode' => @$this->tag['cuid']);
     } elseif ($this->tclass == 'mcommus') {
         $m_thumb->config[$this->temparr['m_thumbid']] = array('id' => $this->item['cid'], 'mode' => 'mcu', 'smode' => @$this->tag['cuid']);
     } elseif ($this->tclass == 'mcatalogs') {
         if ($this->tag['listby'] == 'ca') {
             $this->item['indexurl'] = mcn_url($this->item['mcaid']);
             $this->item['listurl'] = mcn_url($this->item['mcaid'], 0, 1);
         } elseif ($this->tag['listby'] == 'uc') {
             $this->item['indexurl'] = mcn_url($this->item['mcaid'], $this->item['ucid']);
             $this->item['listurl'] = mcn_url($this->item['mcaid'], $this->item['ucid'], 1);
         }
     } elseif ($this->tclass == 'images') {
         if ($this->tmode == 'p') {
             $m_thumb->config[$this->temparr['m_thumbid']] = $m_thumb->config['main'];
         }
         if (@$this->tag['thumb'] && @$this->tag['maxwidth'] && @$this->tag['maxheight'] && islocal($this->item['url'], 1)) {
             //生成缩略图或启用缩略图
             $true_local = islocal($this->item['url'], 2);
             if ($true_local && is_file(local_atm($this->item['url']) . 's/' . $this->tag['maxwidth'] . '_' . $this->tag['maxheight'] . '.jpg') || !$true_local && in_str($this->tag['maxwidth'] . '_' . $this->tag['maxheight'], @$this->item['thumbs'])) {
                 //已生成缩略图
                 $this->item['url_s'] = $this->item['url'] . 's/' . $this->tag['maxwidth'] . '_' . $this->tag['maxheight'] . '.jpg';
             } else {
                 $this->item['url_s'] = @$m_thumb->thumb($this->item['url'], $this->temparr['m_thumbid'], $this->tag['tname'], $this->item['fid'], @$this->tag['maxwidth'], @$this->tag['maxheight']);
             }
         } else {
             $this->item['url_s'] = $this->item['url'];
         }
         if ($this->item['url_s'] != $this->item['url']) {
             //真正启用了缩略图,直接使用设定的宽高
             $this->item['width'] = @$this->tag['maxwidth'];
             $this->item['height'] = @$this->tag['maxheight'];
         } else {
             //使用原图来重计宽高
             $wh = imagewh($this->item['url'], @$this->item['width'], @$this->item['height'], @$this->tag['maxwidth'], @$this->tag['maxheight']);
             $this->item['width'] = $wh['width'];
             $this->item['height'] = $wh['height'];
         }
     } elseif ($this->tclass == 'members') {
         global $grouptypes;
         foreach ($grouptypes as $k => $v) {
             $this->item['grouptype' . $k . 'name'] = '';
             if (!empty($this->item['grouptype' . $k])) {
                 $usergroups = read_cache('usergroups', $k);
                 $this->item['grouptype' . $k . 'name'] = $usergroups[$this->item['grouptype' . $k]]['cname'];
             }
         }
         $m_thumb->config = array('id' => $this->item['mid'], 'mode' => 'm', 'smode' => $this->item['mchid']);
         unset($usergroups, $v);
     }
     //从上级标识接受参数作为当前原始标识
     if (!empty($this->tag['rrelays'])) {
         $midarr = array();
         $relays = relays2arr($this->tag['rrelays']);
         foreach ($relays as $k => $v) {
             if (isset($this->temparr[$v])) {
                 $midarr[$k] = $this->temparr[$v];
             }
         }
         $this->item += $midarr;
         unset($midarr);
     }
     $this->item += $this->temparr;
     //从当前原始标识向下级标识传送参数
     $this->midarr = $this->temparr;
     $relays = $orelays;
     !empty($this->tag['relays']) && ($relays = relays2arr($this->tag['relays']) + $relays);
     foreach ($relays as $k => $v) {
         if (isset($this->item[$v])) {
             $this->midarr[$k] = $this->item[$v];
         }
     }
     unset($relays);
 }
Exemple #25
0
 function add_interested_parties($commentID, $ip = array(), $op = array())
 {
     // We send this email to the default from address, so that a copy of the
     // original email is kept. The receiveEmail.php script will see that this
     // email is *from* the same address, and will then skip over it, when going
     // through the new emails.
     if (defined("ALLOC_DEFAULT_FROM_ADDRESS") && ALLOC_DEFAULT_FROM_ADDRESS) {
         list($from_address, $from_name) = parse_email_address(ALLOC_DEFAULT_FROM_ADDRESS);
         $emailRecipients[] = $from_address;
     }
     interestedParty::make_interested_parties("comment", $commentID, $ip);
     $emailRecipients[] = "interested";
     // Other parties that are added on-the-fly
     foreach ((array) $op as $email => $info) {
         if ($email && in_str("@", $email)) {
             unset($lt, $gt);
             // used above
             $str = $info["name"];
             $str and $str .= " ";
             $str and $lt = "<";
             $str and $gt = ">";
             $str .= $lt . str_replace(array("<", ">"), "", $email) . $gt;
             $emailRecipients[] = $str;
             // Add a new client contact
             if ($info["addContact"] && $info["clientID"]) {
                 $q = prepare("SELECT * FROM clientContact WHERE clientID = %d AND clientContactEmail = '%s'", $info["clientID"], trim($email));
                 $db = new db_alloc();
                 if (!$db->qr($q)) {
                     $cc = new clientContact();
                     $cc->set_value("clientContactName", trim($info["name"]));
                     $cc->set_value("clientContactEmail", trim($email));
                     $cc->set_value("clientID", sprintf("%d", $info["clientID"]));
                     $cc->save();
                 }
             }
             // Add the person to the interested parties list
             if ($info["addIP"] && !interestedParty::exists("comment", $commentID, trim($email))) {
                 $interestedParty = new interestedParty();
                 $interestedParty->set_value("fullName", trim($info["name"]));
                 $interestedParty->set_value("emailAddress", trim($email));
                 $interestedParty->set_value("entityID", $commentID);
                 $interestedParty->set_value("entity", "comment");
                 $interestedParty->set_value("external", $info["internal"] ? "0" : "1");
                 $interestedParty->set_value("interestedPartyActive", "1");
                 if (is_object($cc) && $cc->get_id()) {
                     $interestedParty->set_value("clientContactID", $cc->get_id());
                 }
                 $interestedParty->save();
             }
         }
     }
     return $emailRecipients;
 }
Exemple #26
0
                } else {
                    if (!$c_ftp->mdelete($checkfile)) {
                        $checkmsg .= 'settings_remote_delerr';
                    } else {
                        $c_ftp->mrmdir($checkdir);
                        $checkmsg = 'settings_remote_ok';
                    }
                }
            }
        }
    }
    echo '<script language="javascript" reload="1">alert(\'' . addslashes($checkmsg) . '\');parent.$(\'cfupload\').action=\'?entry=mconfigs&action=cfupload\';parent.$(\'cfupload\').target=\'_self\'</script>';
} elseif ($action == 'dbcheck') {
    $checkmsg = '';
    $dbsourcenew = mstripslashes($dbsourcenew);
    if (in_str('********', $dbsourcenew['dbpw'])) {
        $dbsourcenew['dbpw'] = authcode($dbsourcenew['dbpw0'], 'DECODE', md5($authkey));
    }
    $alertarr = array('add' => array('dbsourceadd', 'dbsourcesedit'), 'edit' => array('dbsourcedetail', 'dbsourcedetail'));
    $dbsourcenew['cname'] = trim(strip_tags($dbsourcenew['cname']));
    $dbsourcenew['dbhost'] = trim(strip_tags($dbsourcenew['dbhost']));
    $dbsourcenew['dbuser'] = trim(strip_tags($dbsourcenew['dbuser']));
    $dbsourcenew['dbname'] = trim(strip_tags($dbsourcenew['dbname']));
    if (empty($dbsourcenew['cname']) || empty($dbsourcenew['dbhost']) || empty($dbsourcenew['dbuser']) || empty($dbsourcenew['dbname'])) {
        $checkmsg = lang('dbsrc_data_miss');
    } else {
        $s_db = new cls_mysql();
        if (!$s_db->connect($dbsourcenew['dbhost'], $dbsourcenew['dbuser'], $dbsourcenew['dbpw'], $dbsourcenew['dbname'], 0, false, $dbsourcenew['dbcharset'])) {
            $checkmsg = lang('dbsrc_connect_error');
        } else {
            $checkmsg = lang('dbsrc_connect_correct');
trbasic(lang('tagid_inc_string'), 'bsearch[ename]', empty($bsearch['ename']) ? '' : $bsearch['ename']);
trbasic(lang('tagname_inc_string'), 'bsearch[cname]', empty($bsearch['cname']) ? '' : $bsearch['cname']);
trbasic(lang('tag_coclass'), 'bsearch[bclass]', makeoption(array('' => lang('nolimit')) + $bclasses, empty($bsearch['bclass']) ? '' : $bsearch['bclass']), 'select');
tabfooter('bbtagsearch', lang('search'));
if (submitcheck('bbtagsearch')) {
    $ename = trim(strtolower($bsearch['ename']));
    $cname = trim($bsearch['cname']);
    $bclass = trim($bsearch['bclass']);
    if (empty($ename) && empty($cname) && empty($bclass)) {
        amessage('inputsearchstring');
    }
    tabheader(lang('initag_search_result'), '', '', '8');
    trcategory(array(lang('sn'), lang('tagname'), array(lang('use_style') . '1', 'txtL'), array(lang('use_style') . '2', 'txtL'), array(lang('use_style') . '3', 'txtL'), lang('tagclass'), lang('detail_coclass'), lang('field_type')));
    $i = 1;
    foreach ($btagnames as $k => $v) {
        if ((!$ename || in_str($ename, $v['ename'])) && (!$cname || in_str($cname, $v['cname'])) && (!$bclass || $v['bclass'] == $bclass)) {
            $sclasses = array();
            if ($v['bclass'] == 'archive') {
                foreach ($channels as $chid => $channel) {
                    $sclasses[$chid] = $channel['cname'];
                }
            } elseif ($v['bclass'] == 'cnode') {
                $sclasses = array('catalog' => lang('catalog'), 'coclass' => lang('coclass'));
            } elseif ($v['bclass'] == 'freeinfo') {
                foreach ($fchannels as $chid => $channel) {
                    $sclasses[$chid] = $channel['cname'];
                }
            } elseif ($v['bclass'] == 'commu') {
                $sclasses = array('comment' => lang('comment'), 'purchase' => lang('purchase'), 'answer' => lang('answer'));
            } elseif ($v['bclass'] == 'other') {
                $sclasses = array('attachment' => lang('attachment'), 'vote' => lang('vote'));
Exemple #28
0
 /**
  * Convert a comma separated string of names, into an array with email addresses
  * @param string $people
  * @param string $entity the related entity that can assist in the look up
  * @param integer $entityID the id of the related entity
  * @return array an array of people, indexed by their email address
  */
 public function get_people($options = array(), $entity = "", $entityID = "")
 {
     $person_table =& get_cached_table("person");
     $people = $options;
     if ($entity && $entityID) {
         $e = new $entity();
         $e->set_id($entityID);
         $e->select();
         in_array("default", $people) and $default_recipients = $e->get_all_parties();
         in_array("internal", $people) and $internal_recipients = $e->get_all_parties();
     }
     // remove default and internal from the array
     $clean_people = array_diff($people, array("default", "internal"));
     if (is_object($e)) {
         $projectID = $e->get_project_id();
         $p = new project();
         $p->set_id($projectID);
         $p->select();
         $client = $p->get_foreign_object("client");
         $clientID = $client->get_id();
     }
     foreach ((array) $default_recipients as $email => $info) {
         if ($info["selected"]) {
             $rtn[$email] = $this->reduce_person_info($info);
         }
     }
     foreach ((array) $internal_recipients as $email => $info) {
         if ($info["selected"] && !$info["external"]) {
             $rtn[$email] = $this->reduce_person_info($info);
         }
     }
     foreach ((array) $clean_people as $person) {
         $bad_person = true;
         $person = trim($person);
         // personID
         if (is_numeric($person)) {
             if ($person_table[$person]["personActive"]) {
                 $rtn[$person_table[$person]["emailAddress"]] = $person_table[$person];
                 $bad_person = false;
                 continue;
             }
             // email addresses
         } else {
             if (in_str("@", $person)) {
                 foreach ($person_table as $pid => $data) {
                     if (same_email_address($person, $data["emailAddress"]) && $data["personActive"]) {
                         $rtn[$data["emailAddress"]] = $data;
                         $bad_person = false;
                         continue 2;
                     }
                 }
                 if ($ccID = clientContact::find_by_email($person)) {
                     $cc = new clientContact();
                     $cc->set_id($ccID);
                     $cc->select();
                     $rtn[$cc->get_value("clientContactEmail")] = $cc->row();
                     $bad_person = false;
                     continue;
                 }
                 // If we get here, then return the email address entered
                 list($e, $n) = parse_email_address($person);
                 $rtn[$e] = array("emailAddress" => $e, "name" => $n);
                 $bad_person = false;
                 continue;
                 // usernames, partial and full names
             } else {
                 foreach ($person_table as $pid => $data) {
                     // If matches username
                     if (strtolower($person) == strtolower($data["username"]) && $data["personActive"]) {
                         $rtn[$data["emailAddress"]] = $data;
                         $bad_person = false;
                         continue 2;
                     }
                 }
                 foreach ($person_table as $pid => $data) {
                     // If matches name
                     if (strtolower($person) == strtolower($data["firstName"] . " " . $data["surname"]) && $data["personActive"]) {
                         $rtn[$data["emailAddress"]] = $data;
                         $bad_person = false;
                         continue 2;
                     }
                 }
                 foreach ($person_table as $pid => $data) {
                     // If matches a section of name, eg: a search for "Ale" will match the full name "Alex Lance"
                     if (strtolower($person) == strtolower(substr(strtolower($data["firstName"] . " " . $data["surname"]), 0, strlen($person))) && $data["personActive"]) {
                         $rtn[$data["emailAddress"]] = $data;
                         $bad_person = false;
                         continue 2;
                     }
                 }
                 if ($ccID = clientContact::find_by_nick($person, $clientID)) {
                     $cc = new clientContact();
                     $cc->set_id($ccID);
                     $cc->select();
                     $rtn[$cc->get_value("clientContactEmail")] = $cc->row();
                     $bad_person = false;
                     continue;
                 }
                 if ($ccID = clientContact::find_by_name($person, $projectID)) {
                     $cc = new clientContact();
                     $cc->set_id($ccID);
                     $cc->select();
                     $rtn[$cc->get_value("clientContactEmail")] = $cc->row();
                     $bad_person = false;
                     continue;
                 }
                 if ($ccID = clientContact::find_by_partial_name($person, $projectID)) {
                     $cc = new clientContact();
                     $cc->set_id($ccID);
                     $cc->select();
                     $rtn[$cc->get_value("clientContactEmail")] = $cc->row();
                     $bad_person = false;
                     continue;
                 }
             }
         }
         if ($bad_person) {
             die("Unable to find person: " . $person);
         }
     }
     foreach ((array) $rtn as $id => $p) {
         $rtn[$id] = $this->reduce_person_info($p);
     }
     return (array) $rtn;
 }