当前位置: 首页>>代码示例>>PHP>>正文


PHP main::error方法代码示例

本文整理汇总了PHP中main::error方法的典型用法代码示例。如果您正苦于以下问题:PHP main::error方法的具体用法?PHP main::error怎么用?PHP main::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在main的用法示例。


在下文中一共展示了main::error方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFile

 private function getFile($name, $prepare = 1, $override = 0, $showit = 0)
 {
     global $dbh, $postvar, $getvar, $instance;
     $link = "../themes/" . THEME . "/" . $name;
     if (!file_exists($link) || $override == 1) {
         $link = INC . "/" . $name;
     }
     if (!file_exists($link)) {
         $link = "../install/" . $name;
     }
     if (!file_exists($link)) {
         $link = $name;
     }
     if (!file_exists($link) && INSTALL == 1) {
         $error['Error'] = "File doesn't exist!";
         $error['Path'] = $link;
         main::error($error);
     } else {
         if ($prepare) {
             return self::prepare(file_get_contents($link));
         } else {
             return file_get_contents($link);
         }
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:25,代码来源:class_style.php

示例2: EditEmailTemplates

 private function EditEmailTemplates()
 {
     global $dbh, $postvar, $getvar, $instance;
     if (main::isint($getvar['do'])) {
         if ($postvar['edittpl']) {
             check::empty_fields();
             if (!main::errors()) {
                 $dbh->update("templates", array("subject" => $postvar['subject']), array("id", "=", $getvar['do']));
                 $template_info = $dbh->select("templates", array("id", "=", $getvar['do']));
                 $tmpl_file_base = INC . "/tpl/email/" . $template_info['dir'] . "/" . $template_info['name'];
                 if (!is_writable($tmpl_file_base . ".tpl")) {
                     main::errors("In order to make changes to this file (" . $tmpl_file_base . ".tpl), please make it writable.");
                 } else {
                     $contents = stripslashes($postvar['emailcontent']);
                     if ($contents) {
                         $filetochangeOpen = fopen($tmpl_file_base . ".tpl", "w");
                         if (!fputs($filetochangeOpen, $contents)) {
                             main::errors("Could not write the template file, " . $tmpl_file_base . ".tpl");
                         }
                         fclose($filetochangeOpen);
                     }
                     if (!main::errors()) {
                         main::errors("Template edited!");
                     }
                 }
             }
         }
         $template_data = $dbh->select("templates", array("id", "=", $getvar['do']));
         if (!$template_data['id']) {
             $error_array['Error'] = "Template not found.";
             $error_array['Template ID'] = $getvar['do'];
             main::error($error_array);
         } else {
             $tmpl_file_base = INC . "/tpl/email/" . $template_data['dir'] . "/" . $template_data['name'];
             $tmpl_content_file = @file_get_contents($tmpl_file_base . ".tpl");
             $tmpl_descrip_file = @file_get_contents($tmpl_file_base . ".desc.tpl");
             if (!$tmpl_content_file && !$tmpl_descrip_file) {
                 $error_array['Error'] = "One of the template files don't exist.<br>";
                 $error_array['Template Locations'] = "<br>" . $tmpl_file_base . ".tpl<br>" . $tmpl_file_base . ".desc.tpl";
                 main::error($error_array);
             } else {
                 $edit_email_template_array['SUBJECT'] = $template_data['subject'];
                 $edit_email_template_array['DESCRIPTION'] = $tmpl_descrip_file;
                 $edit_email_template_array['TEMPLATE'] = $tmpl_content_file;
             }
         }
         echo style::replaceVar("tpl/admin/mail/edit-email-template.tpl", $edit_email_template_array);
         return;
     }
     if (main::isint($postvar['template'])) {
         main::redirect("?page=email&sub=templates&do=" . $postvar['template']);
     }
     $templates_query = $dbh->select("templates", 0, array("acpvisual", "ASC"));
     while ($templates_data = $dbh->fetch_array($templates_query)) {
         $values[] = array($templates_data['acpvisual'], $templates_data['id']);
     }
     $select_email_template_array['TEMPLATES'] = main::dropDown("template", $values, 0, 1);
     echo style::replaceVar("tpl/admin/mail/select-email-template.tpl", $select_email_template_array);
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:59,代码来源:email.php

示例3: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     // An honest attempt to make this system a little less painful (for me)...
     if (array_key_exists("sub", $getvar) && !empty($getvar["sub"])) {
         $sub = "_" . strtolower($getvar["sub"]);
         if (method_exists($this, $sub)) {
             $this->{$sub}();
             return;
         }
         main::error(array(__FILE__ => "<code>\$this->{$sub}</code> isn't a method."));
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:13,代码来源:orderform.php

示例4: client

 public function client($id = 0)
 {
     if (!$id) {
         $id = $_SESSION['cuser'];
     }
     $id = $this->strip($id);
     $users_query = $this->select("users", array("id", "=", $id), 0, 0, 1);
     if ($this->num_rows($users_query) == 0) {
         $error['Error'] = "Couldn't retrieve client data!";
         $error['Username'] = $id;
         main::error($error);
     } else {
         $all_values = $this->fetch_array($users_query);
         return $all_values;
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:16,代码来源:class_db.php

示例5: remote

 private function remote($action, $url, $get = false, $returnErrors = false)
 {
     $server_details = $this->serverDetails($this->server);
     $ch = curl_init();
     $ip = gethostbyname($server_details['host']);
     if ($server_details['https']) {
         //Usually 2222
         if ($server_details['apiport'] != 443) {
             $port = $server_details['apiport'];
         }
         $serverstuff = "https://" . $server_details['user'] . ":" . $server_details['accesshash'] . "@" . $server_details['host'] . ":" . $port . "/" . $action;
         curl_setopt($ch, CURLOPT_URL, $serverstuff);
         curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     } else {
         //Usually 2222
         if ($server_details['apiport'] != 80) {
             $port = $server_details['apiport'];
         }
         $serverstuff = "http://" . $server_details['user'] . ":" . $server_details['accesshash'] . "@" . $server_details['host'] . ":" . $port . "/" . $action;
         curl_setopt($ch, CURLOPT_URL, $serverstuff);
     }
     if ($get) {
         curl_setopt($ch, CURLOPT_URL, $serverstuff . $url);
     } else {
         curl_setopt($ch, CURLOPT_URL, $serverstuff);
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $url);
     }
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     $curl_data = curl_exec($ch);
     if ($curl_data === false) {
         if ($returnErrors) {
             return curl_error($ch);
         }
         main::error(array("DA Connection Error" => curl_error($ch)));
         return false;
     }
     curl_close($ch);
     $split = explode("&", $curl_data);
     foreach ($split as $value) {
         $stuff = explode("=", $value);
         $final[$stuff[0]] = $stuff[1];
     }
     return $final;
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:50,代码来源:da.php

示例6: serverDetails

 private function serverDetails($server)
 {
     global $dbh, $postvar, $getvar, $instance;
     $servers_data = $dbh->select("servers", array("id", "=", $server));
     if (!$servers_data['id']) {
         $error_array['Error'] = "That server doesn't exist!";
         $error_array['Server ID'] = $id;
         main::error($error_array);
         return;
     } else {
         return $servers_data;
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:13,代码来源:kloxo.php

示例7: emailTemplate

 public function emailTemplate($name = 0, $id = 0)
 {
     global $dbh, $postvar, $getvar, $instance;
     if ($name) {
         $templates_data = $dbh->select("templates", array("name", "=", $name));
     } elseif ($id) {
         $templates_data = $dbh->select("templates", array("id", "=", $id));
     } else {
         $error_array['Error'] = "No name/id was sent onto the reciever!";
         main::error($error_array);
         return;
     }
     if (!$templates_data['id']) {
         $error_array['Error'] = "That template doesn't exist!";
         $error_array['Template Name/ID'] = $name . $id;
         main::error($error_array);
     } else {
         $tmpl_file_base = INC . "/tpl/email/" . $templates_data['dir'] . "/" . $templates_data['name'];
         $tmpl_content_file = @file_get_contents($tmpl_file_base . ".tpl");
         $tmpl_descrip_file = @file_get_contents($tmpl_file_base . ".desc.tpl");
         if (!$tmpl_content_file && !$tmpl_descrip_file) {
             $error_array['Error'] = "One of the template files don't exist.<br>";
             $error_array['Template locations'] = "<br>" . $tmpl_file_base . ".tpl<br>" . $tmpl_file_base . ".desc.tpl";
             main::error($error_array);
         } else {
             $template_data = array("id" => $templates_data['id'], "name" => $templates_data['name'], "acpvisual" => $templates_data['acpvisual'], "subject" => $templates_data['subject'], "content" => $tmpl_content_file, "description" => $tmpl_descrip_file);
             return $template_data;
         }
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:30,代码来源:class_email.php

示例8: forumCon

 private function forumCon($id)
 {
     global $dbh, $postvar, $getvar, $instance;
     $forum_conn_details = $this->forumdata($id);
     $forumcon = $dbh->connect($forum_conn_details['hostname'], $forum_conn_details['username'], $forum_conn_details['password'], $forum_conn_details['forumdb']);
     if (is_string($forumcon)) {
         $error_array['Error'] = $forumcon;
         $error_array['Forum ID'] = $id;
         main::error($error_array);
         return;
     } else {
         return $forumcon;
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:14,代码来源:p2h.php

示例9: checkPerms

 public function checkPerms($id, $user = 0)
 {
     global $dbh, $postvar, $getvar, $instance;
     if (!$user) {
         $user = $_SESSION['user'];
     }
     $staff_data = $dbh->select("staff", array("id", "=", $user));
     if (!$staff_data['id']) {
         $error_array['Error'] = "Staff member not found";
         $error_array['Staff ID'] = $user;
         main::error($error_array);
     } else {
         $perms = explode(",", $staff_data['perms']);
         foreach ($perms as $value) {
             if ($value == $id) {
                 return false;
             }
         }
         return true;
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:21,代码来源:class_main.php

示例10: packageBackend

 public function packageBackend($id)
 {
     global $dbh, $postvar, $getvar, $instance;
     $packages_data = $dbh->select("packages", array("id", "=", $id));
     if (!$packages_data['id']) {
         $error_array['Error'] = "That package doesn't exist!";
         $error_array['Package ID'] = $id;
         main::error($error_array);
         return;
     } else {
         return $packages_data['backend'];
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:13,代码来源:class_type.php

示例11: remote

 private function remote($url, $xml = 0, $term = false, $returnErrors = false)
 {
     global $dbh, $postvar, $getvar, $instance;
     $server_details = $this->serverDetails($this->server);
     $cleanaccesshash = preg_replace("'(\r|\n)'", "", $server_details['accesshash']);
     $authstr = $server_details['user'] . ":" . $cleanaccesshash;
     $ch = curl_init();
     if ($server_details['https']) {
         //Usually 2087
         if ($server_details['apiport'] != 443) {
             $port = $server_details['apiport'];
         }
         $serverstuff = "https://" . $server_details['host'] . ":" . $port . $url;
         curl_setopt($ch, CURLOPT_URL, $serverstuff);
         curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     } else {
         //Usually 2086
         if ($server_details['apiport'] != 80) {
             $port = $server_details['apiport'];
         }
         $serverstuff = "http://" . $server_details['host'] . ":" . $port . $url;
         curl_setopt($ch, CURLOPT_URL, $serverstuff);
     }
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $curlheaders[0] = "Authorization: WHM {$authstr}";
     curl_setopt($ch, CURLOPT_HTTPHEADER, $curlheaders);
     $curl_data = curl_exec($ch);
     if ($curl_data === false) {
         if ($returnErrors) {
             return curl_error($ch);
         }
         main::error(array("WHM Connection Error" => curl_error($ch)));
         return false;
     }
     curl_close($ch);
     if ($term == true) {
         return true;
     } elseif (strstr($curl_data, "SSL encryption is required")) {
         if ($returnErrors) {
             return "THT must connect via SSL!";
         }
         main::error(array("WHM Error" => "THT must connect via SSL!"));
         return false;
     } elseif (!$xml) {
         $xml = new SimpleXMLElement($curl_data);
     } else {
         return $curl_data;
     }
     return $xml;
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:52,代码来源:whm.php

示例12: changePwd

 public function changePwd($id, $newpwd)
 {
     global $dbh, $postvar, $getvar, $instance;
     $client = $dbh->client($id);
     if (!$client['id']) {
         $error_array['Error'] = "That user doesn't exist.";
         $error_array['User PID'] = $id;
         main::error($error_array);
         return;
     } else {
         $server = type::packageserver($client['pid']);
         $serverfile = self::createServer($client['pid']);
         if ($serverfile->changePwd($client['user'], $newpwd, $server)) {
             main::thtlog("Client Password Changed", "Password changed", $client['id']);
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:20,代码来源:class_server.php


注:本文中的main::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。