PageRenderTime 26ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/admin.old.php

https://bitbucket.org/linards/dzeerveniite
PHP | 95 lines | 56 code | 23 blank | 16 comment | 17 complexity | 3a4217c123e1476e3f7bb4aa9cd600a8 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception, GPL-2.0
  1. <?
  2. //COOKIE_start();
  3. //var_dump($_COOKIE);
  4. error_reporting(E_ERRORS);
  5. ini_set("display_errors", "1");
  6. include_once("config.php");
  7. settype($page,"string");
  8. settype($contents,"string");
  9. if(isset($_COOKIE["user"])) $pub_user = new pub_user($_COOKIE["user"]);
  10. else $pub_user = new pub_user();
  11. if(isset($_REQUEST["logout"])) $pub_user->logout();
  12. //var_dump($pub_user->limited);
  13. $allowed = $pub_user->limited + $pub_user->allowed;
  14. $colors = new colors;
  15. $colors->load();
  16. //var_dump($colors);
  17. // te nāk centrs kolonna
  18. $contents .= $pub_user->info();
  19. //$contents .= $cat->road();
  20. if(!$pub_user->username) $contents .= $pub_user->auth();
  21. if(isset($_REQUEST["add"])){
  22. $data = new $_REQUEST["add"](null, $_REQUEST["id"]);
  23. if(in_array(get_class($data), $allowed)) $contents .= $data->edit();
  24. }
  25. elseif(isset($_REQUEST["op"])){
  26. $op = new $_REQUEST["op"];
  27. //if(isset($_REQUEST["id"]) || isset($_REQUEST["img"])) $contents .= $op->edit();
  28. $contents .= $op->road();
  29. if(in_array(get_class($op), $allowed)) $contents .= $op->edit();
  30. else $contents .= "<div class=\"deny\">Jums nav pieejas tiesību šiem datiem</div>";
  31. if(method_exists($op,"files") && in_array(get_class($op), $allowed)) $contents .= $op->files();
  32. if(in_array(get_class($op), $allowed) && get_class($op) == "db_cat") $contents .= $op->data_list();
  33. //var_dump($op);
  34. }
  35. //COOKIE_destroy();
  36. // te nāk augša
  37. $diff = 0; $h = 1; $a = -1; $f = 2;
  38. do{
  39. $a++;
  40. $diff = colorDistance($colors->get_color($a), "#fade47");
  41. } while($diff < 150); //echo $diff;
  42. if($a == $h) $h = 0;
  43. elseif($a == $f) $f = 0;
  44. $from = array("Dzērvenīte","#93cfbb", "#0000ff", "#b48773", "#cdc081", "/img/DSC_1225.jpg");
  45. $from[] = $colors->default_colors;
  46. $to = array($project_title, $colors->get_color($f), $colors->get_color($a), $colors->get_color(0), $colors->get_color($h), $colors->img);
  47. $newcols = array();
  48. $to[] = $colors->new_colors;
  49. $page .= str_replace($from, $to, file_get_contents("./inc/html/head-admin.htm"));
  50. $page .= file_get_contents("./inc/html/3-col-center-admin.htm");
  51. if(!$contents) $contents = "&nbsp;";
  52. $page .= $contents;
  53. //echo $cat->save();
  54. //var_dump($data);
  55. $page .= file_get_contents("./inc/html/3-col-left.htm");
  56. // te nāk kreisā mala
  57. $cat = new db_cat_menu($colors->colors);
  58. $page .= $cat->nav_list();
  59. //include("html/menu.htm");
  60. $from = array("#919e95", "#544c61", "#aab7a1");
  61. $to = array($colors->get_color($cat->colin + 1),$colors->get_color($cat->colin + 2),$colors->get_color($cat->colin + 3));
  62. $page .= str_replace($from, $to, file_get_contents("./inc/html/left-pane-admin.htm"));
  63. $info = new srv_info();
  64. $from = array("<!--lapinas-linki-->", "<!--info-->");
  65. $to = array($pub_user->links(), $info->out);
  66. $page .= str_replace($from, $to, file_get_contents("./inc/html/3-col-right-admin.htm"));
  67. // te nāk labā mala
  68. $page .= file_get_contents("./inc/html/3-col-bottom.htm");
  69. // te nāk apakša
  70. $page .= file_get_contents("./inc/html/foot.htm");
  71. echo $page;
  72. ?>